diff options
author | Dan Williams <dcbw@redhat.com> | 2010-02-26 18:01:55 -0800 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2010-02-26 18:01:55 -0800 |
commit | 438a047935f941e8f7d8df27a0069c70e4b4ea05 (patch) | |
tree | 8933f938d30e44ec4acb8f4a1c775789de90e9ae /src/mm-modem-cdma.c | |
parent | b9958e6ec5115822b1c2112da5ef2652aa847a51 (diff) |
core: add authorization providers and optional PolicyKit support
When the support is complete, use --with-polkit to enable
PolicyKit support. It's not there yet, but this commit adds an
authorization provider framework which will be extended to allow
hooking into PolicyKit.
Diffstat (limited to 'src/mm-modem-cdma.c')
-rw-r--r-- | src/mm-modem-cdma.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/src/mm-modem-cdma.c b/src/mm-modem-cdma.c index 112b93fa..0ba9f792 100644 --- a/src/mm-modem-cdma.c +++ b/src/mm-modem-cdma.c @@ -20,6 +20,7 @@ #include "mm-errors.h" #include "mm-callback-info.h" #include "mm-marshal.h" +#include "mm-auth-provider.h" static void impl_modem_cdma_get_signal_quality (MMModemCdma *modem, DBusGMethodInvocation *context); static void impl_modem_cdma_get_esn (MMModemCdma *modem, DBusGMethodInvocation *context); @@ -188,10 +189,38 @@ mm_modem_cdma_get_esn (MMModemCdma *self, } static void -impl_modem_cdma_get_esn (MMModemCdma *modem, - DBusGMethodInvocation *context) +esn_auth_cb (GObject *instance, + guint32 reqid, + MMAuthResult result, + gpointer user_data) { - mm_modem_cdma_get_esn (modem, str_call_done, context); + MMModemCdma *self = MM_MODEM_CDMA (instance); + DBusGMethodInvocation *context = user_data; + GError *error = NULL; + + /* Return any authorization error, otherwise get the ESN */ + if (!mm_modem_auth_finish (MM_MODEM (self), reqid, result, &error)) { + dbus_g_method_return_error (context, error); + g_error_free (error); + } else + mm_modem_cdma_get_esn (self, str_call_done, context); +} + +static void +impl_modem_cdma_get_esn (MMModemCdma *self, DBusGMethodInvocation *context) +{ + GError *error = NULL; + + /* Make sure the caller is authorized to get the ESN */ + if (!mm_modem_auth_request (MM_MODEM (self), + MM_AUTHORIZATION_DEVICE, + esn_auth_cb, + context, + NULL, + &error)) { + dbus_g_method_return_error (context, error); + g_error_free (error); + } } void |