summaryrefslogtreecommitdiffstats
path: root/lib/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Utils')
-rw-r--r--lib/Utils/Polkit.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/Utils/Polkit.cpp b/lib/Utils/Polkit.cpp
index 6d6cf0dd..f0dc4c79 100644
--- a/lib/Utils/Polkit.cpp
+++ b/lib/Utils/Polkit.cpp
@@ -25,21 +25,44 @@
#include <unistd.h>
#include "Polkit.h"
+#include "abrtlib.h"
+<<<<<<< HEAD
+/*number of seconds: timeout for the authorization*/
+#define POLKIT_TIMEOUT 20
+
+static gboolean do_cancel(GCancellable* cancellable)
+{
+ log("Timer has expired; cancelling authorization check\n");
+ g_cancellable_cancel(cancellable);
+ return FALSE;
+}
+
+=======
+>>>>>>> 5349d07f9cae8a2b9686916c1e5bd01a0fe14a29
static PolkitResult do_check(PolkitSubject *subject, const char *action_id)
{
PolkitAuthority *authority;
PolkitAuthorizationResult *result;
GError *error = NULL;
+ GCancellable * cancellable;
authority = polkit_authority_get();
+<<<<<<< HEAD
+ cancellable = g_cancellable_new();
+
+ g_timeout_add (POLKIT_TIMEOUT * 1000,
+ (GSourceFunc) do_cancel,
+ cancellable);
+=======
+>>>>>>> 5349d07f9cae8a2b9686916c1e5bd01a0fe14a29
result = polkit_authority_check_authorization_sync(authority,
subject,
action_id,
NULL,
POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
- NULL,
+ cancellable,
&error);
if (error)