From f66346217c233f9689c3ad73312597821da94a82 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Fri, 8 Jun 2012 13:43:35 -0400 Subject: [PATCH] Catch up with latest polkit guidance 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 --- src/udisksdaemonutil.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/udisksdaemonutil.c b/src/udisksdaemonutil.c index 9a2e601..723cffe 100644 --- a/src/udisksdaemonutil.c +++ b/src/udisksdaemonutil.c @@ -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)) -- 2.7.4