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.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.c')
-rw-r--r-- | src/mm-modem.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/mm-modem.c b/src/mm-modem.c index 5bb2ef6b..0c8e6b25 100644 --- a/src/mm-modem.c +++ b/src/mm-modem.c @@ -608,6 +608,52 @@ mm_modem_set_state (MMModem *self, /*****************************************************************************/ +gboolean +mm_modem_auth_request (MMModem *self, + const char *authorization, + MMAuthRequestCb callback, + gpointer callback_data, + GDestroyNotify notify, + GError **error) +{ + g_return_val_if_fail (self != NULL, FALSE); + g_return_val_if_fail (MM_IS_MODEM (self), FALSE); + g_return_val_if_fail (authorization != NULL, FALSE); + g_return_val_if_fail (callback != NULL, FALSE); + + g_return_val_if_fail (MM_MODEM_GET_INTERFACE (self)->auth_request, FALSE); + return MM_MODEM_GET_INTERFACE (self)->auth_request (self, + authorization, + callback, + callback_data, + notify, + error); +} + +gboolean +mm_modem_auth_finish (MMModem *self, + guint32 reqid, + MMAuthResult result, + GError **error) +{ + gboolean success; + + g_return_val_if_fail (self != NULL, FALSE); + g_return_val_if_fail (MM_IS_MODEM (self), FALSE); + g_return_val_if_fail (reqid > 0, FALSE); + + g_return_val_if_fail (MM_MODEM_GET_INTERFACE (self)->auth_finish, FALSE); + success = MM_MODEM_GET_INTERFACE (self)->auth_finish (self, reqid, result, error); + + /* If the request failed, the implementor *should* return an error */ + if (!success && error) + g_warn_if_fail (*error != NULL); + + return success; +} + +/*****************************************************************************/ + static void mm_modem_init (gpointer g_iface) { |