Catch up with latest polkit guidance
authorDavid Zeuthen <zeuthen@gmail.com>
Fri, 8 Jun 2012 17:43:35 +0000 (13:43 -0400)
committerDavid Zeuthen <zeuthen@gmail.com>
Fri, 8 Jun 2012 17:43:35 +0000 (13:43 -0400)
See

 http://cgit.freedesktop.org/polkit/commit/?id=acf3a06e55f9ca8a7f7bfa012c24e8794d27c85f
 https://bugzilla.gnome.org/show_bug.cgi?id=677718

for details.

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
src/udisksdaemonutil.c

index 9a2e601..723cffe 100644 (file)
@@ -652,14 +652,25 @@ udisks_daemon_util_check_authorization_sync (UDisksDaemon          *daemon,
                                                       &error);
   if (result == NULL)
     {
-      g_dbus_method_invocation_return_error (invocation,
-                                             UDISKS_ERROR,
-                                             UDISKS_ERROR_FAILED,
-                                             "Error checking authorization: %s (%s, %d)",
-                                             error->message,
-                                             g_quark_to_string (error->domain),
-                                             error->code);
-      g_error_free (error);
+      if (error->domain != POLKIT_ERROR)
+        {
+          /* assume polkit authority is not available (e.g. could be the service
+           * manager returning org.freedesktop.systemd1.Masked)
+           */
+          g_error_free (error);
+          ret = check_authorization_no_polkit (daemon, object, action_id, options, message, invocation);
+        }
+      else
+        {
+          g_dbus_method_invocation_return_error (invocation,
+                                                 UDISKS_ERROR,
+                                                 UDISKS_ERROR_FAILED,
+                                                 "Error checking authorization: %s (%s, %d)",
+                                                 error->message,
+                                                 g_quark_to_string (error->domain),
+                                                 error->code);
+          g_error_free (error);
+        }
       goto out;
     }
   if (!polkit_authorization_result_get_is_authorized (result))