From b06d4ae63fc95f50870510ca0acbaf049ba6dbb2 Mon Sep 17 00:00:00 2001 From: infirit Date: Sat, 12 Sep 2015 12:03:15 +0200 Subject: Return error when authentication dialog is dismissed This allows PolicyKit applications to disambiguate between when the authentication dialog is dismissed versus when authentication fails (e.g. the wrong password has been entered). From polkit-gnome, commit: 2511afae6b72fe3b4714d07ab6373c93c2923a5e From: David Zeuthen Gnome bug: https://bugs.freedesktop.org/show_bug.cgi?id=30653 --- src/polkitmatelistener.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/polkitmatelistener.c') diff --git a/src/polkitmatelistener.c b/src/polkitmatelistener.c index 1b7c486..926fccd 100644 --- a/src/polkitmatelistener.c +++ b/src/polkitmatelistener.c @@ -23,6 +23,7 @@ #include "config.h" #include +#include #include "polkitmatelistener.h" #include "polkitmateauthenticator.h" @@ -153,8 +154,9 @@ maybe_initiate_next_authenticator (PolkitMateListener *listener) static void authenticator_completed (PolkitMateAuthenticator *authenticator, - gboolean gained_authorization, - gpointer user_data) + gboolean gained_authorization, + gboolean dismissed, + gpointer user_data) { AuthData *data = user_data; @@ -164,6 +166,14 @@ authenticator_completed (PolkitMateAuthenticator *authenticator, g_object_unref (authenticator); + if (dismissed) + { + g_simple_async_result_set_error (data->simple, + POLKIT_ERROR, + POLKIT_ERROR_CANCELLED, + _("Authentication dialog was dismissed by the user")); + } + g_simple_async_result_complete (data->simple); g_object_unref (data->simple); -- cgit v1.2.1