]> git.pld-linux.org Git - packages/ModemManager.git/blame - 67d936e46cedfa3f9621946ac02156e8c15990e3.patch
- up to 0.5
[packages/ModemManager.git] / 67d936e46cedfa3f9621946ac02156e8c15990e3.patch
CommitLineData
9aac38b4
SS
1From 67d936e46cedfa3f9621946ac02156e8c15990e3 Mon Sep 17 00:00:00 2001
2From: Dan Williams <dcbw@redhat.com>
3Date: Wed, 01 Sep 2010 22:20:57 +0000
4Subject: polkit: fix for polkit >= 0.97 (bgo #628105)
5
6---
7diff --git a/configure.ac b/configure.ac
8index a0c65e7..af4bd09 100644
9--- a/configure.ac
10+++ b/configure.ac
11@@ -64,6 +64,10 @@ case $with_polkit in
12 AC_DEFINE(WITH_POLKIT, 1, [Define if you want to use PolicyKit])
13 AC_SUBST(POLKIT_CFLAGS)
14 AC_SUBST(POLKIT_LIBS)
15+
16+ # Check for polkit_authority_get_sync()
17+ AC_CHECK_LIB([polkit-gobject-1], [polkit_authority_get_sync], ac_have_pk_auth_get_sync="1", ac_have_pk_auth_get_sync="0")
18+ AC_DEFINE_UNQUOTED(HAVE_POLKIT_AUTHORITY_GET_SYNC, $ac_have_pk_auth_get_sync, [Define if you have a polkit with polkit_authority_get_sync()])
19 ;;
20 *)
21 with_polkit=no
22diff --git a/src/mm-auth-provider-polkit.c b/src/mm-auth-provider-polkit.c
23index c457eaf..2cd4a8a 100644
24--- a/src/mm-auth-provider-polkit.c
25+++ b/src/mm-auth-provider-polkit.c
26@@ -15,6 +15,7 @@
27
28 #include <polkit/polkit.h>
29
30+#include <config.h>
31 #include "mm-auth-request-polkit.h"
32 #include "mm-auth-provider-polkit.h"
33
34@@ -72,19 +73,39 @@ real_create_request (MMAuthProvider *provider,
35
36 /*****************************************************************************/
37
38+/* Fix for polkit 0.97 and later */
39+#if !HAVE_POLKIT_AUTHORITY_GET_SYNC
40+static inline PolkitAuthority *
41+polkit_authority_get_sync (GCancellable *cancellable, GError **error)
42+{
43+ PolkitAuthority *authority;
44+
45+ authority = polkit_authority_get ();
46+ if (!authority)
47+ g_set_error (error, 0, 0, "failed to get the PolicyKit authority");
48+ return authority;
49+}
50+#endif
51+
52 static void
53 mm_auth_provider_polkit_init (MMAuthProviderPolkit *self)
54 {
55 MMAuthProviderPolkitPrivate *priv = MM_AUTH_PROVIDER_POLKIT_GET_PRIVATE (self);
56+ GError *error = NULL;
57
58- priv->authority = polkit_authority_get ();
59+ priv->authority = polkit_authority_get_sync (NULL, &error);
60 if (priv->authority) {
61 priv->auth_changed_id = g_signal_connect (priv->authority,
62 "changed",
63 G_CALLBACK (pk_authority_changed_cb),
64 self);
65- } else
66- g_warning ("%s: failed to create PolicyKit authority.", __func__);
67+ } else {
68+ g_warning ("%s: failed to create PolicyKit authority: (%d) %s",
69+ __func__,
70+ error ? error->code : -1,
71+ error && error->message ? error->message : "(unknown)");
72+ g_clear_error (&error);
73+ }
74 }
75
76 static void
77--
78cgit v0.8.3-6-g21f6
This page took 0.073942 seconds and 4 git commands to generate.