PolicyKit: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Sun Feb 1 16:02:58 PST 2009


 src/polkitbackend/Makefile.am                   |    2 
 src/polkitbackend/polkitbackend.h               |    1 
 src/polkitbackend/polkitbackendauthority.c      |  466 ++++++++++++++---------
 src/polkitbackend/polkitbackendauthority.h      |  185 +++++----
 src/polkitbackend/polkitbackendlocalauthority.c |  484 +++++++++++++-----------
 src/polkitbackend/polkitbackendpendingcall.c    |  155 -------
 src/polkitbackend/polkitbackendpendingcall.h    |   84 ----
 src/polkitbackend/polkitbackendprivate.h        |    5 
 src/polkitbackend/polkitbackendtypes.h          |    3 
 9 files changed, 677 insertions(+), 708 deletions(-)

New commits:
commit a18f3dcbb52c7557229597aa48af63fe0f8a9024
Author: David Zeuthen <davidz at redhat.com>
Date:   Sun Feb 1 19:01:11 2009 -0500

    rework backend API

diff --git a/src/polkitbackend/Makefile.am b/src/polkitbackend/Makefile.am
index 6b128bc..156ffd6 100644
--- a/src/polkitbackend/Makefile.am
+++ b/src/polkitbackend/Makefile.am
@@ -54,7 +54,6 @@ libpolkit_backend_1include_HEADERS =                        		\
 	polkitbackendauthority.h					\
 	polkitbackendlocalauthority.h					\
 	polkitbackendactionpool.h					\
-	polkitbackendpendingcall.h					\
 	polkitbackendsessionmonitor.h					\
         $(NULL)
 
@@ -65,7 +64,6 @@ libpolkit_backend_1_la_SOURCES =                                   	\
 	polkitbackendauthority.h	polkitbackendauthority.c	\
 	polkitbackendlocalauthority.h	polkitbackendlocalauthority.c	\
 	polkitbackendactionpool.h	polkitbackendactionpool.c	\
-	polkitbackendpendingcall.h	polkitbackendpendingcall.c	\
 	polkitbackendsessionmonitor.h	polkitbackendsessionmonitor.c	\
 	$(BUILT_SOURCES)						\
         $(NULL)
diff --git a/src/polkitbackend/polkitbackend.h b/src/polkitbackend/polkitbackend.h
index 79caee0..3da728d 100644
--- a/src/polkitbackend/polkitbackend.h
+++ b/src/polkitbackend/polkitbackend.h
@@ -24,7 +24,6 @@
 
 #define _POLKIT_BACKEND_INSIDE_POLKIT_BACKEND_H 1
 #include <polkitbackend/polkitbackendtypes.h>
-#include <polkitbackend/polkitbackendpendingcall.h>
 #include <polkitbackend/polkitbackendauthority.h>
 #include <polkitbackend/polkitbackendlocalauthority.h>
 #include <polkitbackend/polkitbackendactionpool.h>
diff --git a/src/polkitbackend/polkitbackendauthority.c b/src/polkitbackend/polkitbackendauthority.c
index c553ba6..5ab6a4f 100644
--- a/src/polkitbackend/polkitbackendauthority.c
+++ b/src/polkitbackend/polkitbackendauthority.c
@@ -27,7 +27,6 @@
 #include <polkit/polkitprivate.h>
 #include "polkitbackendauthority.h"
 
-#include "polkitbackendpendingcall.h"
 #include "polkitbackendprivate.h"
 
 enum
@@ -78,127 +77,160 @@ polkit_backend_authority_system_bus_name_owner_changed (PolkitBackendAuthority
   klass->system_bus_name_owner_changed (authority, name, old_owner, new_owner);
 }
 
-void
+GList *
 polkit_backend_authority_enumerate_actions (PolkitBackendAuthority   *authority,
+                                            PolkitSubject            *caller,
                                             const gchar              *locale,
-                                            PolkitBackendPendingCall *pending_call)
+                                            GCancellable             *cancellable,
+                                            GError                  **error)
 {
   PolkitBackendAuthorityClass *klass;
 
   klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
 
-  klass->enumerate_actions (authority, locale, pending_call);
+  return klass->enumerate_actions (authority, caller, locale, cancellable, error);
 }
 
-void
+GList *
 polkit_backend_authority_enumerate_users (PolkitBackendAuthority   *authority,
-                                          PolkitBackendPendingCall *pending_call)
+                                          PolkitSubject            *caller,
+                                          GCancellable             *cancellable,
+                                          GError                  **error)
 {
   PolkitBackendAuthorityClass *klass;
 
   klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
 
-  klass->enumerate_users (authority, pending_call);
+  return klass->enumerate_users (authority, caller, cancellable, error);
 }
 
-void
+GList *
 polkit_backend_authority_enumerate_groups (PolkitBackendAuthority   *authority,
-                                           PolkitBackendPendingCall *pending_call)
+                                           PolkitSubject            *caller,
+                                           GCancellable             *cancellable,
+                                           GError                  **error)
 {
   PolkitBackendAuthorityClass *klass;
 
   klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
 
-  klass->enumerate_groups (authority, pending_call);
+  return klass->enumerate_groups (authority, caller, cancellable, error);
 }
 
 void
 polkit_backend_authority_check_authorization (PolkitBackendAuthority        *authority,
+                                              PolkitSubject                 *caller,
                                               PolkitSubject                 *subject,
                                               const gchar                   *action_id,
                                               PolkitCheckAuthorizationFlags  flags,
-                                              PolkitBackendPendingCall      *pending_call)
+                                              GCancellable                  *cancellable,
+                                              GAsyncReadyCallback            callback,
+                                              gpointer                       user_data)
 {
   PolkitBackendAuthorityClass *klass;
 
   klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
 
-  klass->check_authorization (authority, subject, action_id, flags, pending_call);
+  klass->check_authorization (authority, caller, subject, action_id, flags, cancellable, callback, user_data);
 }
 
-void
+PolkitAuthorizationResult
+polkit_backend_authority_check_authorization_finish (PolkitBackendAuthority  *authority,
+                                                     GAsyncResult            *res,
+                                                     GError                 **error)
+{
+  PolkitBackendAuthorityClass *klass;
+
+  klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
+
+  return klass->check_authorization_finish (authority, res, error);
+}
+
+GList *
 polkit_backend_authority_enumerate_authorizations  (PolkitBackendAuthority    *authority,
+                                                    PolkitSubject             *caller,
                                                     PolkitIdentity            *identity,
-                                                    PolkitBackendPendingCall  *pending_call)
+                                                    GCancellable              *cancellable,
+                                                    GError                   **error)
 {
   PolkitBackendAuthorityClass *klass;
 
   klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
 
-  klass->enumerate_authorizations (authority, identity, pending_call);
+  return klass->enumerate_authorizations (authority, caller, identity, cancellable, error);
 }
 
-void
+gboolean
 polkit_backend_authority_add_authorization  (PolkitBackendAuthority    *authority,
+                                             PolkitSubject             *caller,
                                              PolkitIdentity            *identity,
                                              PolkitAuthorization       *authorization,
-                                             PolkitBackendPendingCall  *pending_call)
+                                             GCancellable              *cancellable,
+                                             GError                   **error)
 {
   PolkitBackendAuthorityClass *klass;
 
   klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
 
-  klass->add_authorization (authority, identity, authorization, pending_call);
+  return klass->add_authorization (authority, caller, identity, authorization, cancellable, error);
 }
 
-void
+gboolean
 polkit_backend_authority_remove_authorization  (PolkitBackendAuthority    *authority,
+                                                PolkitSubject             *caller,
                                                 PolkitIdentity            *identity,
                                                 PolkitAuthorization       *authorization,
-                                                PolkitBackendPendingCall  *pending_call)
+                                                GCancellable              *cancellable,
+                                                GError                   **error)
 {
   PolkitBackendAuthorityClass *klass;
 
   klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
 
-  klass->remove_authorization (authority, identity, authorization, pending_call);
+  return klass->remove_authorization (authority, caller, identity, authorization, cancellable, error);
 }
 
-void
+gboolean
 polkit_backend_authority_register_authentication_agent (PolkitBackendAuthority    *authority,
+                                                        PolkitSubject             *caller,
                                                         const gchar               *object_path,
-                                                        PolkitBackendPendingCall  *pending_call)
+                                                        GCancellable              *cancellable,
+                                                        GError                   **error)
 {
   PolkitBackendAuthorityClass *klass;
 
   klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
 
-  klass->register_authentication_agent (authority, object_path, pending_call);
+  return klass->register_authentication_agent (authority, caller, object_path, cancellable, error);
 }
 
-void
+gboolean
 polkit_backend_authority_unregister_authentication_agent (PolkitBackendAuthority    *authority,
+                                                          PolkitSubject             *caller,
                                                           const gchar               *object_path,
-                                                          PolkitBackendPendingCall  *pending_call)
+                                                          GCancellable              *cancellable,
+                                                          GError                   **error)
 {
   PolkitBackendAuthorityClass *klass;
 
   klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
 
-  klass->unregister_authentication_agent (authority, object_path, pending_call);
+  return klass->unregister_authentication_agent (authority, caller, object_path, cancellable, error);
 }
 
-void
+gboolean
 polkit_backend_authority_authentication_agent_response (PolkitBackendAuthority    *authority,
+                                                        PolkitSubject             *caller,
                                                         const gchar               *cookie,
                                                         PolkitIdentity            *identity,
-                                                        PolkitBackendPendingCall  *pending_call)
+                                                        GCancellable              *cancellable,
+                                                        GError                   **error)
 {
   PolkitBackendAuthorityClass *klass;
 
   klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
 
-  klass->authentication_agent_response (authority, cookie, identity, pending_call);
+  return klass->authentication_agent_response (authority, caller, cookie, identity, cancellable, error);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -308,19 +340,29 @@ authority_handle_enumerate_actions (_PolkitAuthority        *instance,
                                     EggDBusMethodInvocation *method_invocation)
 {
   Server *server = SERVER (instance);
-  PolkitBackendPendingCall *pending_call;
+  PolkitSubject *caller;
+  EggDBusArraySeq *array;
+  GError *error;
+  GList *actions;
+  GList *l;
 
-  pending_call = _polkit_backend_pending_call_new (method_invocation);
+  error = NULL;
+  caller = NULL;
+  actions = NULL;
 
-  polkit_backend_authority_enumerate_actions (server->authority, locale, pending_call);
-}
+  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
 
-void
-polkit_backend_authority_enumerate_actions_finish (PolkitBackendPendingCall *pending_call,
-                                                   GList                    *actions)
-{
-  EggDBusArraySeq *array;
-  GList *l;
+  actions = polkit_backend_authority_enumerate_actions (server->authority,
+                                                        caller,
+                                                        locale,
+                                                        NULL,
+                                                        &error);
+  if (error != NULL)
+    {
+      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_error_free (error);
+      goto out;
+    }
 
   array = egg_dbus_array_seq_new (G_TYPE_OBJECT, //_POLKIT_TYPE_ACTION_DESCRIPTION,
                                   (GDestroyNotify) g_object_unref,
@@ -336,15 +378,14 @@ polkit_backend_authority_enumerate_actions_finish (PolkitBackendPendingCall *pen
       egg_dbus_array_seq_add (array, real);
     }
 
-  _polkit_authority_handle_enumerate_actions_finish (_polkit_backend_pending_call_get_method_invocation (pending_call),
-                                                     array);
+  _polkit_authority_handle_enumerate_actions_finish (method_invocation, array);
 
   g_object_unref (array);
 
+ out:
   g_list_foreach (actions, (GFunc) g_object_unref, NULL);
   g_list_free (actions);
-
-  g_object_unref (pending_call);
+  g_object_unref (caller);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -354,26 +395,33 @@ authority_manager_handle_enumerate_users (_PolkitAuthorityManager *instance,
                                           EggDBusMethodInvocation *method_invocation)
 {
   Server *server = SERVER (instance);
-  PolkitBackendPendingCall *pending_call;
+  PolkitSubject *caller;
+  EggDBusArraySeq *array;
+  GError *error;
+  GList *identities;
+  GList *l;
 
-  pending_call = _polkit_backend_pending_call_new (method_invocation);
+  error = NULL;
 
-  polkit_backend_authority_enumerate_users (server->authority, pending_call);
-}
+  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
 
-void
-polkit_backend_authority_enumerate_users_finish (PolkitBackendPendingCall *pending_call,
-                                                 GList                    *users)
-{
-  EggDBusArraySeq *array;
-  GList *l;
+  identities = polkit_backend_authority_enumerate_users (server->authority,
+                                                         caller,
+                                                         NULL,
+                                                         &error);
+  if (error != NULL)
+    {
+      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_error_free (error);
+      goto out;
+    }
 
   array = egg_dbus_array_seq_new (G_TYPE_OBJECT, //_POLKIT_TYPE_IDENTITY,
                                   (GDestroyNotify) g_object_unref,
                                   NULL,
                                   NULL);
 
-  for (l = users; l != NULL; l = l->next)
+  for (l = identities; l != NULL; l = l->next)
     {
       PolkitIdentity *identity = POLKIT_IDENTITY (l->data);
       _PolkitIdentity *real;
@@ -382,15 +430,16 @@ polkit_backend_authority_enumerate_users_finish (PolkitBackendPendingCall *pendi
       egg_dbus_array_seq_add (array, real);
     }
 
-  _polkit_authority_manager_handle_enumerate_users_finish (_polkit_backend_pending_call_get_method_invocation (pending_call),
-                                                           array);
+  _polkit_authority_manager_handle_enumerate_users_finish (method_invocation, array);
 
   g_object_unref (array);
 
-  g_list_foreach (users, (GFunc) g_object_unref, NULL);
-  g_list_free (users);
+ out:
+
+  g_list_foreach (identities, (GFunc) g_object_unref, NULL);
+  g_list_free (identities);
 
-  g_object_unref (pending_call);
+  g_object_unref (caller);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -400,26 +449,33 @@ authority_manager_handle_enumerate_groups (_PolkitAuthorityManager *instance,
                                            EggDBusMethodInvocation *method_invocation)
 {
   Server *server = SERVER (instance);
-  PolkitBackendPendingCall *pending_call;
+  PolkitSubject *caller;
+  EggDBusArraySeq *array;
+  GError *error;
+  GList *identities;
+  GList *l;
 
-  pending_call = _polkit_backend_pending_call_new (method_invocation);
+  error = NULL;
 
-  polkit_backend_authority_enumerate_groups (server->authority, pending_call);
-}
+  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
 
-void
-polkit_backend_authority_enumerate_groups_finish (PolkitBackendPendingCall *pending_call,
-                                                  GList                    *groups)
-{
-  EggDBusArraySeq *array;
-  GList *l;
+  identities = polkit_backend_authority_enumerate_groups (server->authority,
+                                                          caller,
+                                                          NULL,
+                                                          &error);
+  if (error != NULL)
+    {
+      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_error_free (error);
+      goto out;
+    }
 
   array = egg_dbus_array_seq_new (G_TYPE_OBJECT, //_POLKIT_TYPE_IDENTITY,
                                   (GDestroyNotify) g_object_unref,
                                   NULL,
                                   NULL);
 
-  for (l = groups; l != NULL; l = l->next)
+  for (l = identities; l != NULL; l = l->next)
     {
       PolkitIdentity *identity = POLKIT_IDENTITY (l->data);
       _PolkitIdentity *real;
@@ -428,20 +484,45 @@ polkit_backend_authority_enumerate_groups_finish (PolkitBackendPendingCall *pend
       egg_dbus_array_seq_add (array, real);
     }
 
-  _polkit_authority_manager_handle_enumerate_groups_finish (_polkit_backend_pending_call_get_method_invocation (pending_call),
-                                                            array);
+  _polkit_authority_manager_handle_enumerate_groups_finish (method_invocation, array);
 
   g_object_unref (array);
 
-  g_list_foreach (groups, (GFunc) g_object_unref, NULL);
-  g_list_free (groups);
+ out:
+
+  g_list_foreach (identities, (GFunc) g_object_unref, NULL);
+  g_list_free (identities);
 
-  g_object_unref (pending_call);
+  g_object_unref (caller);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
+check_auth_cb (GObject      *source_object,
+               GAsyncResult *res,
+               gpointer      user_data)
+{
+  EggDBusMethodInvocation *method_invocation = EGG_DBUS_METHOD_INVOCATION (user_data);
+  PolkitAuthorizationResult result;
+  GError *error;
+
+  error = NULL;
+  result = polkit_backend_authority_check_authorization_finish (POLKIT_BACKEND_AUTHORITY (source_object),
+                                                                res,
+                                                                &error);
+  if (error != NULL)
+    {
+      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_error_free (error);
+    }
+  else
+    {
+      _polkit_authority_handle_check_authorization_finish (method_invocation, result);
+    }
+}
+
+static void
 authority_handle_check_authorization (_PolkitAuthority               *instance,
                                       _PolkitSubject                 *real_subject,
                                       const gchar                    *action_id,
@@ -449,30 +530,24 @@ authority_handle_check_authorization (_PolkitAuthority               *instance,
                                       EggDBusMethodInvocation        *method_invocation)
 {
   Server *server = SERVER (instance);
-  PolkitBackendPendingCall *pending_call;
   PolkitSubject *subject;
+  PolkitSubject *caller;
 
-  pending_call = _polkit_backend_pending_call_new (method_invocation);
+  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
 
   subject = polkit_subject_new_for_real (real_subject);
 
-  g_object_set_data_full (G_OBJECT (pending_call), "subject", subject, (GDestroyNotify) g_object_unref);
+  g_object_set_data_full (G_OBJECT (method_invocation), "caller", caller, (GDestroyNotify) g_object_unref);
+  g_object_set_data_full (G_OBJECT (method_invocation), "subject", subject, (GDestroyNotify) g_object_unref);
 
   polkit_backend_authority_check_authorization (server->authority,
+                                                caller,
                                                 subject,
                                                 action_id,
                                                 flags,
-                                                pending_call);
-}
-
-void
-polkit_backend_authority_check_authorization_finish (PolkitBackendPendingCall  *pending_call,
-                                                     PolkitAuthorizationResult  result)
-{
-  _polkit_authority_handle_check_authorization_finish (_polkit_backend_pending_call_get_method_invocation (pending_call),
-                                                       result);
-
-  g_object_unref (pending_call);
+                                                NULL, /* TODO: use cancellable */
+                                                check_auth_cb,
+                                                method_invocation);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -483,50 +558,58 @@ authority_manager_handle_enumerate_authorizations (_PolkitAuthorityManager
                                                    EggDBusMethodInvocation        *method_invocation)
 {
   Server *server = SERVER (instance);
-  PolkitBackendPendingCall *pending_call;
+  PolkitSubject *caller;
   PolkitIdentity *identity;
+  EggDBusArraySeq *array;
+  GError *error;
+  GList *authorizations;
+  GList *l;
 
-  pending_call = _polkit_backend_pending_call_new (method_invocation);
+  error = NULL;
 
-  identity = polkit_identity_new_for_real (real_identity);
+  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
 
-  g_object_set_data_full (G_OBJECT (pending_call), "identity", identity, (GDestroyNotify) g_object_unref);
+  identity = polkit_identity_new_for_real (real_identity);
 
-  polkit_backend_authority_enumerate_authorizations (server->authority,
-                                                     identity,
-                                                     pending_call);
-}
+  authorizations = polkit_backend_authority_enumerate_authorizations (server->authority,
+                                                                      caller,
+                                                                      identity,
+                                                                      NULL,
+                                                                      &error);
 
-void
-polkit_backend_authority_enumerate_authorizations_finish (PolkitBackendPendingCall  *pending_call,
-                                                          GList                     *authorizations)
-{
-  EggDBusArraySeq *array;
-  GList *l;
+  if (error != NULL)
+    {
+      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_error_free (error);
+      goto out;
+    }
 
-  array = egg_dbus_array_seq_new (G_TYPE_OBJECT, //_POLKIT_TYPE_AUTHORIZATION,
+  array = egg_dbus_array_seq_new (G_TYPE_OBJECT, //_POLKIT_TYPE_IDENTITY,
                                   (GDestroyNotify) g_object_unref,
                                   NULL,
                                   NULL);
 
   for (l = authorizations; l != NULL; l = l->next)
     {
-      PolkitAuthorization *a = POLKIT_AUTHORIZATION (l->data);
+      PolkitAuthorization *authorization = POLKIT_AUTHORIZATION (l->data);
       _PolkitAuthorization *real;
 
-      real = polkit_authorization_get_real (a);
+      real = polkit_authorization_get_real (authorization);
       egg_dbus_array_seq_add (array, real);
     }
 
-  _polkit_authority_manager_handle_enumerate_authorizations_finish (_polkit_backend_pending_call_get_method_invocation (pending_call),
-                                                                    array);
+  _polkit_authority_manager_handle_enumerate_authorizations_finish (method_invocation, array);
 
   g_object_unref (array);
 
+ out:
+
   g_list_foreach (authorizations, (GFunc) g_object_unref, NULL);
   g_list_free (authorizations);
 
-  g_object_unref (pending_call);
+  g_object_unref (caller);
+
+  g_object_unref (identity);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -538,30 +621,37 @@ authority_manager_handle_add_authorization (_PolkitAuthorityManager        *inst
                                             EggDBusMethodInvocation        *method_invocation)
 {
   Server *server = SERVER (instance);
-  PolkitBackendPendingCall *pending_call;
+  PolkitSubject *caller;
   PolkitIdentity *identity;
   PolkitAuthorization *authorization;
+  GError *error;
+
 
-  pending_call = _polkit_backend_pending_call_new (method_invocation);
+  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
 
   identity = polkit_identity_new_for_real (real_identity);
 
   authorization = polkit_authorization_new_for_real (real_authorization);
 
-  g_object_set_data_full (G_OBJECT (pending_call), "identity", identity, (GDestroyNotify) g_object_unref);
-  g_object_set_data_full (G_OBJECT (pending_call), "authorization", authorization, (GDestroyNotify) g_object_unref);
+  error = NULL;
+  if (!polkit_backend_authority_add_authorization (server->authority,
+                                                   caller,
+                                                   identity,
+                                                   authorization,
+                                                   NULL,
+                                                   &error))
+    {
+      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_error_free (error);
+      goto out;
+    }
 
-  polkit_backend_authority_add_authorization (server->authority,
-                                              identity,
-                                              authorization,
-                                              pending_call);
-}
+  _polkit_authority_manager_handle_add_authorization_finish (method_invocation);
 
-void
-polkit_backend_authority_add_authorization_finish (PolkitBackendPendingCall  *pending_call)
-{
-  _polkit_authority_manager_handle_add_authorization_finish (_polkit_backend_pending_call_get_method_invocation (pending_call));
-  g_object_unref (pending_call);
+ out:
+  g_object_unref (authorization);
+  g_object_unref (identity);
+  g_object_unref (caller);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -573,30 +663,37 @@ authority_manager_handle_remove_authorization (_PolkitAuthorityManager        *i
                                                EggDBusMethodInvocation        *method_invocation)
 {
   Server *server = SERVER (instance);
-  PolkitBackendPendingCall *pending_call;
+  PolkitSubject *caller;
   PolkitIdentity *identity;
   PolkitAuthorization *authorization;
+  GError *error;
+
 
-  pending_call = _polkit_backend_pending_call_new (method_invocation);
+  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
 
   identity = polkit_identity_new_for_real (real_identity);
 
   authorization = polkit_authorization_new_for_real (real_authorization);
 
-  g_object_set_data_full (G_OBJECT (pending_call), "identity", identity, (GDestroyNotify) g_object_unref);
-  g_object_set_data_full (G_OBJECT (pending_call), "authorization", authorization, (GDestroyNotify) g_object_unref);
+  error = NULL;
+  if (!polkit_backend_authority_remove_authorization (server->authority,
+                                                      caller,
+                                                      identity,
+                                                      authorization,
+                                                      NULL,
+                                                      &error))
+    {
+      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_error_free (error);
+      goto out;
+    }
 
-  polkit_backend_authority_remove_authorization (server->authority,
-                                                 identity,
-                                                 authorization,
-                                                 pending_call);
-}
+  _polkit_authority_manager_handle_remove_authorization_finish (method_invocation);
 
-void
-polkit_backend_authority_remove_authorization_finish (PolkitBackendPendingCall  *pending_call)
-{
-  _polkit_authority_manager_handle_remove_authorization_finish (_polkit_backend_pending_call_get_method_invocation (pending_call));
-  g_object_unref (pending_call);
+ out:
+  g_object_unref (authorization);
+  g_object_unref (identity);
+  g_object_unref (caller);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -607,20 +704,27 @@ authority_handle_register_authentication_agent (_PolkitAuthority               *
                                                 EggDBusMethodInvocation        *method_invocation)
 {
   Server *server = SERVER (instance);
-  PolkitBackendPendingCall *pending_call;
+  PolkitSubject *caller;
+  GError *error;
 
-  pending_call = _polkit_backend_pending_call_new (method_invocation);
+  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
 
-  polkit_backend_authority_register_authentication_agent (server->authority,
-                                                          object_path,
-                                                          pending_call);
-}
+  error = NULL;
+  if (!polkit_backend_authority_register_authentication_agent (server->authority,
+                                                               caller,
+                                                               object_path,
+                                                               NULL,
+                                                               &error))
+    {
+      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_error_free (error);
+      goto out;
+    }
 
-void
-polkit_backend_authority_register_authentication_agent_finish (PolkitBackendPendingCall  *pending_call)
-{
-  _polkit_authority_handle_register_authentication_agent_finish (_polkit_backend_pending_call_get_method_invocation (pending_call));
-  g_object_unref (pending_call);
+  _polkit_authority_handle_register_authentication_agent_finish (method_invocation);
+
+ out:
+  g_object_unref (caller);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -631,20 +735,27 @@ authority_handle_unregister_authentication_agent (_PolkitAuthority
                                                   EggDBusMethodInvocation        *method_invocation)
 {
   Server *server = SERVER (instance);
-  PolkitBackendPendingCall *pending_call;
+  PolkitSubject *caller;
+  GError *error;
 
-  pending_call = _polkit_backend_pending_call_new (method_invocation);
+  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
 
-  polkit_backend_authority_unregister_authentication_agent (server->authority,
-                                                          object_path,
-                                                          pending_call);
-}
+  error = NULL;
+  if (!polkit_backend_authority_unregister_authentication_agent (server->authority,
+                                                                 caller,
+                                                                 object_path,
+                                                                 NULL,
+                                                                 &error))
+    {
+      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_error_free (error);
+      goto out;
+    }
 
-void
-polkit_backend_authority_unregister_authentication_agent_finish (PolkitBackendPendingCall  *pending_call)
-{
-  _polkit_authority_handle_unregister_authentication_agent_finish (_polkit_backend_pending_call_get_method_invocation (pending_call));
-  g_object_unref (pending_call);
+  _polkit_authority_handle_unregister_authentication_agent_finish (method_invocation);
+
+ out:
+  g_object_unref (caller);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -656,26 +767,33 @@ authority_handle_authentication_agent_response (_PolkitAuthority               *
                                                 EggDBusMethodInvocation        *method_invocation)
 {
   Server *server = SERVER (instance);
-  PolkitBackendPendingCall *pending_call;
+  PolkitSubject *caller;
   PolkitIdentity *identity;
-
-  pending_call = _polkit_backend_pending_call_new (method_invocation);
+  GError *error;
 
   identity = polkit_identity_new_for_real (real_identity);
 
-  g_object_set_data_full (G_OBJECT (pending_call), "identity", identity, (GDestroyNotify) g_object_unref);
+  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
 
-  polkit_backend_authority_authentication_agent_response (server->authority,
-                                                          cookie,
-                                                          identity,
-                                                          pending_call);
-}
+  error = NULL;
+  if (!polkit_backend_authority_authentication_agent_response (server->authority,
+                                                               caller,
+                                                               cookie,
+                                                               identity,
+                                                               NULL,
+                                                               &error))
+    {
+      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_error_free (error);
+      goto out;
+    }
 
-void
-polkit_backend_authority_authentication_agent_response_finish (PolkitBackendPendingCall  *pending_call)
-{
-  _polkit_authority_handle_authentication_agent_response_finish (_polkit_backend_pending_call_get_method_invocation (pending_call));
-  g_object_unref (pending_call);
+  _polkit_authority_handle_authentication_agent_response_finish (method_invocation);
+
+ out:
+  g_object_unref (caller);
+
+  g_object_unref (identity);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/polkitbackend/polkitbackendauthority.h b/src/polkitbackend/polkitbackendauthority.h
index 413f18f..dcef4cb 100644
--- a/src/polkitbackend/polkitbackendauthority.h
+++ b/src/polkitbackend/polkitbackendauthority.h
@@ -62,48 +62,73 @@ struct _PolkitBackendAuthorityClass
                                           const gchar              *old_owner,
                                           const gchar              *new_owner);
 
-  void (*enumerate_actions)  (PolkitBackendAuthority   *authority,
-                              const gchar              *locale,
-                              PolkitBackendPendingCall *pending_call);
-
-  void (*enumerate_users)    (PolkitBackendAuthority   *authority,
-                              PolkitBackendPendingCall *pending_call);
-
-  void (*enumerate_groups)   (PolkitBackendAuthority   *authority,
-                              PolkitBackendPendingCall *pending_call);
+  GList *(*enumerate_actions)  (PolkitBackendAuthority   *authority,
+                                PolkitSubject            *caller,
+                                const gchar              *locale,
+                                GCancellable             *cancellable,
+                                GError                  **error);
+
+  GList *(*enumerate_users)    (PolkitBackendAuthority   *authority,
+                                PolkitSubject            *caller,
+                                GCancellable             *cancellable,
+                                GError                  **error);
+
+  GList *(*enumerate_groups)   (PolkitBackendAuthority   *authority,
+                                PolkitSubject            *caller,
+                                GCancellable             *cancellable,
+                                GError                  **error);
 
   void (*check_authorization) (PolkitBackendAuthority        *authority,
+                               PolkitSubject                 *caller,
                                PolkitSubject                 *subject,
                                const gchar                   *action_id,
                                PolkitCheckAuthorizationFlags  flags,
-                               PolkitBackendPendingCall      *pending_call);
-
-  void (*enumerate_authorizations) (PolkitBackendAuthority   *authority,
+                               GCancellable                  *cancellable,
+                               GAsyncReadyCallback            callback,
+                               gpointer                       user_data);
+
+  PolkitAuthorizationResult (*check_authorization_finish) (PolkitBackendAuthority  *authority,
+                                                           GAsyncResult            *res,
+                                                           GError                 **error);
+
+  GList *(*enumerate_authorizations) (PolkitBackendAuthority   *authority,
+                                      PolkitSubject            *caller,
+                                      PolkitIdentity           *identity,
+                                      GCancellable             *cancellable,
+                                      GError                  **error);
+
+  gboolean (*add_authorization) (PolkitBackendAuthority   *authority,
+                                 PolkitSubject            *caller,
+                                 PolkitIdentity           *identity,
+                                 PolkitAuthorization      *authorization,
+                                 GCancellable             *cancellable,
+                                 GError                  **error);
+
+  gboolean (*remove_authorization) (PolkitBackendAuthority   *authority,
+                                    PolkitSubject            *caller,
                                     PolkitIdentity           *identity,
-                                    PolkitBackendPendingCall *pending_call);
-
-  void (*add_authorization) (PolkitBackendAuthority   *authority,
-                             PolkitIdentity           *identity,
-                             PolkitAuthorization      *authorization,
-                             PolkitBackendPendingCall *pending_call);
-
-  void (*remove_authorization) (PolkitBackendAuthority   *authority,
-                                PolkitIdentity           *identity,
-                                PolkitAuthorization      *authorization,
-                                PolkitBackendPendingCall *pending_call);
-
-  void (*register_authentication_agent) (PolkitBackendAuthority   *authority,
-                                         const gchar              *object_path,
-                                         PolkitBackendPendingCall *pending_call);
-
-  void (*unregister_authentication_agent) (PolkitBackendAuthority   *authority,
-                                           const gchar              *object_path,
-                                           PolkitBackendPendingCall *pending_call);
-
-  void (*authentication_agent_response) (PolkitBackendAuthority   *authority,
-                                         const gchar              *cookie,
-                                         PolkitIdentity           *identity,
-                                         PolkitBackendPendingCall *pending_call);
+                                    PolkitAuthorization      *authorization,
+                                    GCancellable             *cancellable,
+                                    GError                  **error);
+
+  gboolean (*register_authentication_agent) (PolkitBackendAuthority   *authority,
+                                             PolkitSubject            *caller,
+                                             const gchar              *object_path,
+                                             GCancellable             *cancellable,
+                                             GError                  **error);
+
+  gboolean (*unregister_authentication_agent) (PolkitBackendAuthority   *authority,
+                                               PolkitSubject            *caller,
+                                               const gchar              *object_path,
+                                               GCancellable             *cancellable,
+                                               GError                  **error);
+
+  gboolean (*authentication_agent_response) (PolkitBackendAuthority   *authority,
+                                             PolkitSubject            *caller,
+                                             const gchar              *cookie,
+                                             PolkitIdentity           *identity,
+                                             GCancellable             *cancellable,
+                                             GError                  **error);
 
   /*< private >*/
   /* Padding for future expansion */
@@ -126,76 +151,76 @@ void     polkit_backend_authority_system_bus_name_owner_changed (PolkitBackendAu
                                                                  const gchar              *old_owner,
                                                                  const gchar              *new_owner);
 
-void     polkit_backend_authority_enumerate_actions         (PolkitBackendAuthority    *authority,
+GList   *polkit_backend_authority_enumerate_actions         (PolkitBackendAuthority    *authority,
+                                                             PolkitSubject             *caller,
                                                              const gchar               *locale,
-                                                             PolkitBackendPendingCall  *pending_call);
+                                                             GCancellable              *cancellable,
+                                                             GError                   **error);
 
-void     polkit_backend_authority_enumerate_users           (PolkitBackendAuthority    *authority,
-                                                             PolkitBackendPendingCall  *pending_call);
+GList   *polkit_backend_authority_enumerate_users           (PolkitBackendAuthority    *authority,
+                                                             PolkitSubject             *caller,
+                                                             GCancellable              *cancellable,
+                                                             GError                   **error);
 
-void     polkit_backend_authority_enumerate_groups          (PolkitBackendAuthority    *authority,
-                                                             PolkitBackendPendingCall  *pending_call);
+GList   *polkit_backend_authority_enumerate_groups          (PolkitBackendAuthority    *authority,
+                                                             PolkitSubject             *caller,
+                                                             GCancellable              *cancellable,
+                                                             GError                   **error);
 
 void     polkit_backend_authority_check_authorization       (PolkitBackendAuthority        *authority,
+                                                             PolkitSubject                 *caller,
                                                              PolkitSubject                 *subject,
                                                              const gchar                   *action_id,
                                                              PolkitCheckAuthorizationFlags  flags,
-                                                             PolkitBackendPendingCall      *pending_call);
+                                                             GCancellable                  *cancellable,
+                                                             GAsyncReadyCallback            callback,
+                                                             gpointer                       user_data);
 
-void     polkit_backend_authority_enumerate_authorizations  (PolkitBackendAuthority    *authority,
+PolkitAuthorizationResult polkit_backend_authority_check_authorization_finish (PolkitBackendAuthority  *authority,
+                                                                               GAsyncResult            *res,
+                                                                               GError                 **error);
+
+GList   *polkit_backend_authority_enumerate_authorizations  (PolkitBackendAuthority    *authority,
+                                                             PolkitSubject             *caller,
                                                              PolkitIdentity            *identity,
-                                                             PolkitBackendPendingCall  *pending_call);
+                                                             GCancellable              *cancellable,
+                                                             GError                   **error);
 
-void     polkit_backend_authority_add_authorization         (PolkitBackendAuthority    *authority,
+gboolean polkit_backend_authority_add_authorization         (PolkitBackendAuthority    *authority,
+                                                             PolkitSubject             *caller,
                                                              PolkitIdentity            *identity,
                                                              PolkitAuthorization       *authorization,
-                                                             PolkitBackendPendingCall  *pending_call);
+                                                             GCancellable              *cancellable,
+                                                             GError                   **error);
 
-void     polkit_backend_authority_remove_authorization      (PolkitBackendAuthority    *authority,
+gboolean polkit_backend_authority_remove_authorization      (PolkitBackendAuthority    *authority,
+                                                             PolkitSubject             *caller,
                                                              PolkitIdentity            *identity,
                                                              PolkitAuthorization       *authorization,
-                                                             PolkitBackendPendingCall  *pending_call);
+                                                             GCancellable              *cancellable,
+                                                             GError                   **error);
 
-void     polkit_backend_authority_register_authentication_agent (PolkitBackendAuthority    *authority,
+gboolean polkit_backend_authority_register_authentication_agent (PolkitBackendAuthority    *authority,
+                                                                 PolkitSubject             *caller,
                                                                  const gchar               *object_path,
-                                                                 PolkitBackendPendingCall  *pending_call);
+                                                                 GCancellable              *cancellable,
+                                                                 GError                   **error);
 
-void     polkit_backend_authority_unregister_authentication_agent (PolkitBackendAuthority    *authority,
+gboolean polkit_backend_authority_unregister_authentication_agent (PolkitBackendAuthority    *authority,
+                                                                   PolkitSubject             *caller,
                                                                    const gchar               *object_path,
-                                                                   PolkitBackendPendingCall  *pending_call);
+                                                                   GCancellable              *cancellable,
+                                                                   GError                   **error);
 
-void     polkit_backend_authority_authentication_agent_response (PolkitBackendAuthority    *authority,
+gboolean polkit_backend_authority_authentication_agent_response (PolkitBackendAuthority    *authority,
+                                                                 PolkitSubject             *caller,
                                                                  const gchar               *cookie,
                                                                  PolkitIdentity            *identity,
-                                                                 PolkitBackendPendingCall  *pending_call);
+                                                                 GCancellable              *cancellable,
+                                                                 GError                   **error);
 
 /* --- */
 
-void     polkit_backend_authority_enumerate_actions_finish        (PolkitBackendPendingCall  *pending_call,
-                                                                   GList                     *actions);
-
-void     polkit_backend_authority_enumerate_users_finish          (PolkitBackendPendingCall  *pending_call,
-                                                                   GList                     *users);
-
-void     polkit_backend_authority_enumerate_groups_finish         (PolkitBackendPendingCall  *pending_call,
-                                                                   GList                     *groups);
-
-void     polkit_backend_authority_check_authorization_finish      (PolkitBackendPendingCall  *pending_call,
-                                                                   PolkitAuthorizationResult  result);
-
-void     polkit_backend_authority_enumerate_authorizations_finish (PolkitBackendPendingCall  *pending_call,
-                                                                   GList                     *authorizations);
-
-void     polkit_backend_authority_add_authorization_finish        (PolkitBackendPendingCall  *pending_call);
-
-void     polkit_backend_authority_remove_authorization_finish     (PolkitBackendPendingCall  *pending_call);
-
-void     polkit_backend_authority_register_authentication_agent_finish   (PolkitBackendPendingCall  *pending_call);
-
-void     polkit_backend_authority_unregister_authentication_agent_finish (PolkitBackendPendingCall  *pending_call);
-
-void     polkit_backend_authority_authentication_agent_response_finish (PolkitBackendPendingCall  *pending_call);
-
 gboolean polkit_backend_register_authority (PolkitBackendAuthority   *authority,
                                             const gchar              *well_known_name,
                                             const gchar              *object_path,
diff --git a/src/polkitbackend/polkitbackendlocalauthority.c b/src/polkitbackend/polkitbackendlocalauthority.c
index 22738a8..31557ca 100644
--- a/src/polkitbackend/polkitbackendlocalauthority.c
+++ b/src/polkitbackend/polkitbackendlocalauthority.c
@@ -29,7 +29,6 @@
 #include <polkit/polkit.h>
 #include "polkitbackendlocalauthority.h"
 #include "polkitbackendactionpool.h"
-#include "polkitbackendpendingcall.h"
 #include "polkitbackendsessionmonitor.h"
 
 #include "_polkitagentbindings.h"
@@ -132,21 +131,35 @@ static void polkit_backend_local_authority_system_bus_name_owner_changed (Polkit
                                                                           const gchar              *old_owner,
                                                                           const gchar              *new_owner);
 
-static void polkit_backend_local_authority_enumerate_actions  (PolkitBackendAuthority   *authority,
-                                                               const gchar              *locale,
-                                                               PolkitBackendPendingCall *pending_call);
+static GList *polkit_backend_local_authority_enumerate_actions  (PolkitBackendAuthority   *authority,
+                                                                 PolkitSubject            *caller,
+                                                                 const gchar              *locale,
+                                                                 GCancellable             *cancellable,
+                                                                 GError                  **error);
 
-static void polkit_backend_local_authority_enumerate_users    (PolkitBackendAuthority   *authority,
-                                                               PolkitBackendPendingCall *pending_call);
+static GList *polkit_backend_local_authority_enumerate_users    (PolkitBackendAuthority   *authority,
+                                                                 PolkitSubject            *caller,
+                                                                 GCancellable             *cancellable,
+                                                                 GError                  **error);
 
-static void polkit_backend_local_authority_enumerate_groups   (PolkitBackendAuthority   *authority,
-                                                               PolkitBackendPendingCall *pending_call);
+static GList *polkit_backend_local_authority_enumerate_groups   (PolkitBackendAuthority   *authority,
+                                                                 PolkitSubject            *caller,
+                                                                 GCancellable             *cancellable,
+                                                                 GError                  **error);
 
 static void polkit_backend_local_authority_check_authorization (PolkitBackendAuthority        *authority,
+                                                                PolkitSubject                 *caller,
                                                                 PolkitSubject                 *subject,
                                                                 const gchar                   *action_id,
                                                                 PolkitCheckAuthorizationFlags  flags,
-                                                                PolkitBackendPendingCall      *pending_call);
+                                                                GCancellable                  *cancellable,
+                                                                GAsyncReadyCallback            callback,
+                                                                gpointer                       user_data);
+
+static PolkitAuthorizationResult polkit_backend_local_authority_check_authorization_finish (
+                                                                 PolkitBackendAuthority  *authority,
+                                                                 GAsyncResult            *res,
+                                                                 GError                 **error);
 
 static PolkitAuthorizationResult check_authorization_sync (PolkitBackendAuthority         *authority,
                                                            PolkitSubject                  *subject,
@@ -155,32 +168,44 @@ static PolkitAuthorizationResult check_authorization_sync (PolkitBackendAuthorit
                                                            PolkitImplicitAuthorization    *out_implicit_authorization,
                                                            GError                        **error);
 
-static void polkit_backend_local_authority_enumerate_authorizations (PolkitBackendAuthority   *authority,
-                                                                     PolkitIdentity            *identity,
-                                                                     PolkitBackendPendingCall *pending_call);
-
-static void polkit_backend_local_authority_add_authorization (PolkitBackendAuthority   *authority,
-                                                              PolkitIdentity           *identity,
-                                                              PolkitAuthorization      *authorization,
-                                                              PolkitBackendPendingCall *pending_call);
-
-static void polkit_backend_local_authority_remove_authorization (PolkitBackendAuthority   *authority,
-                                                                 PolkitIdentity           *identity,
-                                                                 PolkitAuthorization      *authorization,
-                                                                 PolkitBackendPendingCall *pending_call);
-
-static void polkit_backend_local_authority_register_authentication_agent (PolkitBackendAuthority   *authority,
-                                                                          const gchar              *object_path,
-                                                                          PolkitBackendPendingCall *pending_call);
-
-static void polkit_backend_local_authority_unregister_authentication_agent (PolkitBackendAuthority   *authority,
-                                                                            const gchar              *object_path,
-                                                                            PolkitBackendPendingCall *pending_call);
-
-static void polkit_backend_local_authority_authentication_agent_response (PolkitBackendAuthority   *authority,
-                                                                          const gchar              *cookie,
-                                                                          PolkitIdentity           *identity,
-                                                                          PolkitBackendPendingCall *pending_call);
+static GList *polkit_backend_local_authority_enumerate_authorizations (PolkitBackendAuthority   *authority,
+                                                                       PolkitSubject            *caller,
+                                                                       PolkitIdentity           *identity,
+                                                                       GCancellable             *cancellable,
+                                                                       GError                  **error);
+
+static gboolean polkit_backend_local_authority_add_authorization (PolkitBackendAuthority   *authority,
+                                                                  PolkitSubject            *caller,
+                                                                  PolkitIdentity           *identity,
+                                                                  PolkitAuthorization      *authorization,
+                                                                  GCancellable             *cancellable,
+                                                                  GError                  **error);
+
+static gboolean polkit_backend_local_authority_remove_authorization (PolkitBackendAuthority   *authority,
+                                                                     PolkitSubject            *caller,
+                                                                     PolkitIdentity           *identity,
+                                                                     PolkitAuthorization      *authorization,
+                                                                     GCancellable             *cancellable,
+                                                                     GError                  **error);
+
+static gboolean polkit_backend_local_authority_register_authentication_agent (PolkitBackendAuthority   *authority,
+                                                                              PolkitSubject            *caller,
+                                                                              const gchar              *object_path,
+                                                                              GCancellable             *cancellable,
+                                                                              GError                  **error);
+
+static gboolean polkit_backend_local_authority_unregister_authentication_agent (PolkitBackendAuthority   *authority,
+                                                                                PolkitSubject            *caller,
+                                                                                const gchar              *object_path,
+                                                                                GCancellable             *cancellable,
+                                                                                GError                  **error);
+
+static gboolean polkit_backend_local_authority_authentication_agent_response (PolkitBackendAuthority   *authority,
+                                                                              PolkitSubject            *caller,
+                                                                              const gchar              *cookie,
+                                                                              PolkitIdentity           *identity,
+                                                                              GCancellable             *cancellable,
+                                                                              GError                  **error);
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -265,6 +290,7 @@ polkit_backend_local_authority_class_init (PolkitBackendLocalAuthorityClass *kla
   authority_class->enumerate_users                 = polkit_backend_local_authority_enumerate_users;
   authority_class->enumerate_groups                = polkit_backend_local_authority_enumerate_groups;
   authority_class->check_authorization             = polkit_backend_local_authority_check_authorization;
+  authority_class->check_authorization_finish      = polkit_backend_local_authority_check_authorization_finish;
   authority_class->enumerate_authorizations        = polkit_backend_local_authority_enumerate_authorizations;
   authority_class->add_authorization               = polkit_backend_local_authority_add_authorization;
   authority_class->remove_authorization            = polkit_backend_local_authority_remove_authorization;
@@ -285,10 +311,12 @@ polkit_backend_local_authority_new (void)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void
+static GList *
 polkit_backend_local_authority_enumerate_actions (PolkitBackendAuthority   *authority,
+                                                  PolkitSubject            *caller,
                                                   const gchar              *locale,
-                                                  PolkitBackendPendingCall *pending_call)
+                                                  GCancellable             *cancellable,
+                                                  GError                  **error)
 {
   PolkitBackendLocalAuthority *local_authority;
   PolkitBackendLocalAuthorityPrivate *priv;
@@ -299,15 +327,16 @@ polkit_backend_local_authority_enumerate_actions (PolkitBackendAuthority   *auth
 
   actions = polkit_backend_action_pool_get_all_actions (priv->action_pool, locale);
 
-  polkit_backend_authority_enumerate_actions_finish (pending_call,
-                                                     actions);
+  return actions;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void
+static GList *
 polkit_backend_local_authority_enumerate_users (PolkitBackendAuthority   *authority,
-                                                PolkitBackendPendingCall *pending_call)
+                                                PolkitSubject            *caller,
+                                                GCancellable             *cancellable,
+                                                GError                  **error)
 {
   PolkitBackendLocalAuthority *local_authority;
   PolkitBackendLocalAuthorityPrivate *priv;
@@ -322,11 +351,10 @@ polkit_backend_local_authority_enumerate_users (PolkitBackendAuthority   *author
   passwd = getpwent ();
   if (passwd == NULL)
     {
-      polkit_backend_pending_call_return_error (pending_call,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_FAILED,
-                                                "getpwent failed: %s",
-                                                strerror (errno));
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "getpwent failed: %m");
       goto out;
     }
 
@@ -343,17 +371,17 @@ polkit_backend_local_authority_enumerate_users (PolkitBackendAuthority   *author
 
   list = g_list_reverse (list);
 
-  polkit_backend_authority_enumerate_users_finish (pending_call, list);
-
  out:
-  ;
+  return list;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void
+static GList *
 polkit_backend_local_authority_enumerate_groups (PolkitBackendAuthority   *authority,
-                                                 PolkitBackendPendingCall *pending_call)
+                                                 PolkitSubject            *caller,
+                                                 GCancellable             *cancellable,
+                                                 GError                  **error)
 {
   PolkitBackendLocalAuthority *local_authority;
   PolkitBackendLocalAuthorityPrivate *priv;
@@ -368,11 +396,10 @@ polkit_backend_local_authority_enumerate_groups (PolkitBackendAuthority   *autho
   group = getgrent ();
   if (group == NULL)
     {
-      polkit_backend_pending_call_return_error (pending_call,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_FAILED,
-                                                "getpwent failed: %s",
-                                                strerror (errno));
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "getpwent failed: %m");
       goto out;
     }
 
@@ -389,10 +416,8 @@ polkit_backend_local_authority_enumerate_groups (PolkitBackendAuthority   *autho
 
   list = g_list_reverse (list);
 
-  polkit_backend_authority_enumerate_groups_finish (pending_call, list);
-
  out:
-  ;
+  return list;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -407,7 +432,7 @@ check_authorization_challenge_cb (AuthenticationAgent         *agent,
                                   gboolean                     authentication_success,
                                   gpointer                     user_data)
 {
-  PolkitBackendPendingCall *pending_call = POLKIT_BACKEND_PENDING_CALL (user_data);
+  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
   PolkitAuthorizationResult result;
   gchar *subject_str;
 
@@ -456,72 +481,108 @@ check_authorization_challenge_cb (AuthenticationAgent         *agent,
       result = POLKIT_AUTHORIZATION_RESULT_NOT_AUTHORIZED;
     }
 
-  polkit_backend_authority_check_authorization_finish (pending_call, result);
+  g_simple_async_result_set_op_res_gpointer (simple,
+                                             GINT_TO_POINTER ((gint) result),
+                                             NULL);
+  g_simple_async_result_complete (simple);
+  g_object_unref (simple);
 
   g_free (subject_str);
 }
 
+static PolkitAuthorizationResult
+polkit_backend_local_authority_check_authorization_finish (PolkitBackendAuthority  *authority,
+                                                           GAsyncResult            *res,
+                                                           GError                 **error)
+{
+  GSimpleAsyncResult *simple;
+  PolkitAuthorizationResult result;
+
+  simple = G_SIMPLE_ASYNC_RESULT (res);
+
+  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_backend_local_authority_check_authorization);
+
+  result = POLKIT_AUTHORIZATION_RESULT_NOT_AUTHORIZED;
+
+  if (g_simple_async_result_propagate_error (simple, error))
+    goto out;
+
+  result = (PolkitAuthorizationResult) (GPOINTER_TO_INT (g_simple_async_result_get_op_res_gpointer (simple)));
+
+ out:
+  return result;
+}
+
 static void
 polkit_backend_local_authority_check_authorization (PolkitBackendAuthority         *authority,
+                                                    PolkitSubject                  *caller,
                                                     PolkitSubject                  *subject,
                                                     const gchar                    *action_id,
                                                     PolkitCheckAuthorizationFlags   flags,
-                                                    PolkitBackendPendingCall       *pending_call)
+                                                    GCancellable                   *cancellable,
+                                                    GAsyncReadyCallback             callback,
+                                                    gpointer                        user_data)
 {
   PolkitBackendLocalAuthority *local_authority;
   PolkitBackendLocalAuthorityPrivate *priv;
-  PolkitSubject *inquirer;
-  gchar *inquirer_str;
+  gchar *caller_str;
   gchar *subject_str;
-  PolkitIdentity *user_of_inquirer;
+  PolkitIdentity *user_of_caller;
   PolkitIdentity *user_of_subject;
-  gchar *user_of_inquirer_str;
+  gchar *user_of_caller_str;
   gchar *user_of_subject_str;
   PolkitAuthorizationResult result;
   PolkitImplicitAuthorization implicit_authorization;
   GError *error;
+  GSimpleAsyncResult *simple;
 
   local_authority = POLKIT_BACKEND_LOCAL_AUTHORITY (authority);
   priv = POLKIT_BACKEND_LOCAL_AUTHORITY_GET_PRIVATE (local_authority);
 
   error = NULL;
-  inquirer = NULL;
-  inquirer_str = NULL;
+  caller_str = NULL;
   subject_str = NULL;
-  user_of_inquirer = NULL;
+  user_of_caller = NULL;
   user_of_subject = NULL;
-  user_of_inquirer_str = NULL;
+  user_of_caller_str = NULL;
   user_of_subject_str = NULL;
 
-  inquirer = polkit_backend_pending_call_get_caller (pending_call);
+  simple = g_simple_async_result_new (G_OBJECT (authority),
+                                      callback,
+                                      user_data,
+                                      polkit_backend_local_authority_check_authorization);
 
-  inquirer_str = polkit_subject_to_string (inquirer);
+  caller_str = polkit_subject_to_string (caller);
   subject_str = polkit_subject_to_string (subject);
 
   g_debug ("%s is inquiring whether %s is authorized for %s",
-           inquirer_str,
+           caller_str,
            subject_str,
            action_id);
 
-  user_of_inquirer = polkit_backend_session_monitor_get_user_for_subject (priv->session_monitor,
-                                                                          inquirer,
-                                                                          &error);
+  user_of_caller = polkit_backend_session_monitor_get_user_for_subject (priv->session_monitor,
+                                                                        caller,
+                                                                        &error);
   if (error != NULL)
     {
-      polkit_backend_pending_call_return_gerror (pending_call, error);
+      g_simple_async_result_set_from_error (simple, error);
+      g_simple_async_result_complete (simple);
+      g_object_unref (simple);
       g_error_free (error);
       goto out;
     }
 
-  user_of_inquirer_str = polkit_identity_to_string (user_of_inquirer);
-  g_debug (" user of inquirer is %s", user_of_inquirer_str);
+  user_of_caller_str = polkit_identity_to_string (user_of_caller);
+  g_debug (" user of caller is %s", user_of_caller_str);
 
   user_of_subject = polkit_backend_session_monitor_get_user_for_subject (priv->session_monitor,
                                                                          subject,
                                                                          &error);
   if (error != NULL)
     {
-      polkit_backend_pending_call_return_gerror (pending_call, error);
+      g_simple_async_result_set_from_error (simple, error);
+      g_simple_async_result_complete (simple);
+      g_object_unref (simple);
       g_error_free (error);
       goto out;
     }
@@ -529,13 +590,13 @@ polkit_backend_local_authority_check_authorization (PolkitBackendAuthority
   user_of_subject_str = polkit_identity_to_string (user_of_subject);
   g_debug (" user of subject is %s", user_of_subject_str);
 
-  /* if the user of the inquirer and the user of the subject isn't the same, then
-   * the org.freedesktop.policykit.read authorization is required for the inquirer
+  /* if the user of the caller and the user of the subject isn't the same, then
+   * the org.freedesktop.policykit.read authorization is required for the caller
    */
-  if (!polkit_identity_equal (user_of_inquirer, user_of_subject))
+  if (!polkit_identity_equal (user_of_caller, user_of_subject))
     {
       result = check_authorization_sync (authority,
-                                         inquirer,
+                                         caller,
                                          "org.freedesktop.policykit.read",
                                          POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE, /* no user interaction */
                                          NULL,
@@ -543,18 +604,22 @@ polkit_backend_local_authority_check_authorization (PolkitBackendAuthority
 
       if (error != NULL)
         {
-          polkit_backend_pending_call_return_gerror (pending_call, error);
+          g_simple_async_result_set_from_error (simple, error);
+          g_simple_async_result_complete (simple);
+          g_object_unref (simple);
           g_error_free (error);
           goto out;
         }
       else if (result != POLKIT_AUTHORIZATION_RESULT_AUTHORIZED)
         {
-          polkit_backend_pending_call_return_error (pending_call,
-                                                    POLKIT_ERROR,
-                                                    POLKIT_ERROR_NOT_AUTHORIZED,
-                                                    "%s is not authorized to know about authorizations for %s (requires org.freedesktop.policykit.read authorization)",
-                                                    inquirer_str,
-                                                    subject_str);
+          g_simple_async_result_set_error (simple,
+                                           POLKIT_ERROR,
+                                           POLKIT_ERROR_NOT_AUTHORIZED,
+                                           "%s is not authorized to know about authorizations for %s (requires org.freedesktop.policykit.read authorization)",
+                                           caller_str,
+                                           subject_str);
+          g_simple_async_result_complete (simple);
+          g_object_unref (simple);
           goto out;
         }
     }
@@ -567,14 +632,13 @@ polkit_backend_local_authority_check_authorization (PolkitBackendAuthority
                                      &error);
   if (error != NULL)
     {
-      polkit_backend_pending_call_return_gerror (pending_call, error);
+      g_simple_async_result_set_from_error (simple, error);
+      g_simple_async_result_complete (simple);
+      g_object_unref (simple);
       g_error_free (error);
       goto out;
     }
 
-  /* TODO: temporary hack */
-  //flags |= POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION;
-
   /* Caller is up for a challenge! With light sabers! Use an authentication agent if one exists... */
   if ((result == POLKIT_AUTHORIZATION_RESULT_CHALLENGE) &&
       (flags & POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION))
@@ -584,7 +648,13 @@ polkit_backend_local_authority_check_authorization (PolkitBackendAuthority
       agent = get_authentication_agent_for_subject (local_authority, subject);
       if (agent == NULL)
         {
-          g_debug (" challenge requested, but no authentication agent available");
+          g_simple_async_result_set_error (simple,
+                                           POLKIT_ERROR,
+                                           POLKIT_ERROR_FAILED,
+                                           "Challenge requested, but no suitable authentication agent is available");
+          g_simple_async_result_complete (simple);
+          g_object_unref (simple);
+          goto out;
         }
       else
         {
@@ -595,28 +665,25 @@ polkit_backend_local_authority_check_authorization (PolkitBackendAuthority
                                                    user_of_subject,
                                                    local_authority,
                                                    action_id,
-                                                   inquirer,
+                                                   caller,
                                                    implicit_authorization,
                                                    check_authorization_challenge_cb,
-                                                   pending_call);
-          goto out;
+                                                   simple);
         }
 
     }
 
-  polkit_backend_authority_check_authorization_finish (pending_call, result);
-
  out:
 
-  if (user_of_inquirer != NULL)
-    g_object_unref (user_of_inquirer);
+  if (user_of_caller != NULL)
+    g_object_unref (user_of_caller);
 
   if (user_of_subject != NULL)
     g_object_unref (user_of_subject);
 
-  g_free (inquirer_str);
+  g_free (caller_str);
   g_free (subject_str);
-  g_free (user_of_inquirer_str);
+  g_free (user_of_caller_str);
   g_free (user_of_subject_str);
 }
 
@@ -797,14 +864,17 @@ check_authorization_sync (PolkitBackendAuthority         *authority,
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void
+static GList *
 polkit_backend_local_authority_enumerate_authorizations (PolkitBackendAuthority   *authority,
+                                                         PolkitSubject            *caller,
                                                          PolkitIdentity           *identity,
-                                                         PolkitBackendPendingCall *pending_call)
+                                                         GCancellable             *cancellable,
+                                                         GError                  **error)
 {
   PolkitBackendLocalAuthority *local_authority;
   PolkitBackendLocalAuthorityPrivate *priv;
   gchar *identity_str;
+  GList *list;
 
   local_authority = POLKIT_BACKEND_LOCAL_AUTHORITY (authority);
   priv = POLKIT_BACKEND_LOCAL_AUTHORITY_GET_PRIVATE (local_authority);
@@ -815,20 +885,22 @@ polkit_backend_local_authority_enumerate_authorizations (PolkitBackendAuthority
 
   /* TODO: check if caller is authorized */
 
-  polkit_backend_authority_enumerate_authorizations_finish (pending_call,
-                                                            get_authorizations_for_identity (local_authority,
-                                                                                             identity));
+  list = get_authorizations_for_identity (local_authority, identity);
 
   g_free (identity_str);
+
+  return list;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void
+static gboolean
 polkit_backend_local_authority_add_authorization (PolkitBackendAuthority   *authority,
+                                                  PolkitSubject            *caller,
                                                   PolkitIdentity           *identity,
                                                   PolkitAuthorization      *authorization,
-                                                  PolkitBackendPendingCall *pending_call)
+                                                  GCancellable             *cancellable,
+                                                  GError                  **error)
 {
   PolkitBackendLocalAuthority *local_authority;
   PolkitBackendLocalAuthorityPrivate *priv;
@@ -836,13 +908,14 @@ polkit_backend_local_authority_add_authorization (PolkitBackendAuthority   *auth
   const gchar *action_id;
   gboolean is_negative;
   gchar *subject_str;
-  GError *error;
+  gboolean ret;
 
   local_authority = POLKIT_BACKEND_LOCAL_AUTHORITY (authority);
   priv = POLKIT_BACKEND_LOCAL_AUTHORITY_GET_PRIVATE (local_authority);
 
+  ret = FALSE;
+
   subject_str = NULL;
-  error = NULL;
 
   subject = polkit_authorization_get_subject (authorization);
   action_id = polkit_authorization_get_action_id (authorization);
@@ -861,37 +934,37 @@ polkit_backend_local_authority_add_authorization (PolkitBackendAuthority   *auth
   /* We can only add temporary authorizations to users, not e.g. groups */
   if (subject != NULL && !POLKIT_IS_UNIX_USER (identity))
     {
-      polkit_backend_pending_call_return_error (pending_call,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_FAILED,
-                                                "Can only add temporary authorizations to users");
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "Can only add temporary authorizations to users");
       goto out;
     }
 
   if (!add_authorization_for_identity (local_authority,
                                        identity,
                                        authorization,
-                                       &error))
-    {
-      polkit_backend_pending_call_return_gerror (pending_call, error);
-      g_error_free (error);
-    }
-  else
+                                       error))
     {
-      polkit_backend_authority_add_authorization_finish (pending_call);
+      goto out;
     }
 
+  ret = TRUE;
+
  out:
   g_free (subject_str);
+  return ret;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void
+static gboolean
 polkit_backend_local_authority_remove_authorization (PolkitBackendAuthority   *authority,
+                                                     PolkitSubject            *caller,
                                                      PolkitIdentity           *identity,
                                                      PolkitAuthorization      *authorization,
-                                                     PolkitBackendPendingCall *pending_call)
+                                                     GCancellable             *cancellable,
+                                                     GError                  **error)
 {
   PolkitBackendLocalAuthority *local_authority;
   PolkitBackendLocalAuthorityPrivate *priv;
@@ -899,13 +972,14 @@ polkit_backend_local_authority_remove_authorization (PolkitBackendAuthority   *a
   const gchar *action_id;
   gboolean is_negative;
   gchar *subject_str;
-  GError *error;
+  gboolean ret;
 
   local_authority = POLKIT_BACKEND_LOCAL_AUTHORITY (authority);
   priv = POLKIT_BACKEND_LOCAL_AUTHORITY_GET_PRIVATE (local_authority);
 
+  ret = FALSE;
+
   subject_str = NULL;
-  error = NULL;
 
   subject = polkit_authorization_get_subject (authorization);
   action_id = polkit_authorization_get_action_id (authorization);
@@ -921,32 +995,29 @@ polkit_backend_local_authority_remove_authorization (PolkitBackendAuthority   *a
 
   /* TODO: check if caller is authorized */
 
-  /* We can only remove temporary authorizations to users, not e.g. groups */
+  /* We can only remove temporary authorizations from users, not e.g. groups */
   if (subject != NULL && !POLKIT_IS_UNIX_USER (identity))
     {
-      polkit_backend_pending_call_return_error (pending_call,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_FAILED,
-                                                "Can only remove temporary authorizations from users");
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "Can only remove temporary authorizations from users");
       goto out;
     }
 
   if (!remove_authorization_for_identity (local_authority,
                                           identity,
                                           authorization,
-                                          &error))
+                                          error))
     {
-      polkit_backend_pending_call_return_gerror (pending_call, error);
-      g_error_free (error);
-    }
-  else
-    {
-      polkit_backend_authority_remove_authorization_finish (pending_call);
+      goto out;
     }
 
- out:
+  ret = TRUE;
 
+ out:
   g_free (subject_str);
+  return ret;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -1368,43 +1439,44 @@ authentication_session_cancel (AuthenticationSession *session)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void
+static gboolean
 polkit_backend_local_authority_register_authentication_agent (PolkitBackendAuthority   *authority,
+                                                              PolkitSubject            *caller,
                                                               const gchar              *object_path,
-                                                              PolkitBackendPendingCall *pending_call)
+                                                              GCancellable             *cancellable,
+                                                              GError                  **error)
 {
   PolkitBackendLocalAuthority *local_authority;
   PolkitBackendLocalAuthorityPrivate *priv;
-  PolkitSubject *caller;
   PolkitSubject *session_for_caller;
   AuthenticationAgent *agent;
+  gboolean ret;
 
   session_for_caller = NULL;
+  ret = FALSE;
 
   local_authority = POLKIT_BACKEND_LOCAL_AUTHORITY (authority);
   priv = POLKIT_BACKEND_LOCAL_AUTHORITY_GET_PRIVATE (local_authority);
 
-  caller = polkit_backend_pending_call_get_caller (pending_call);
-
   session_for_caller = polkit_backend_session_monitor_get_session_for_subject (priv->session_monitor,
                                                                                caller,
                                                                                NULL);
   if (session_for_caller == NULL)
     {
-      polkit_backend_pending_call_return_error (pending_call,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_FAILED,
-                                                "Cannot determine session");
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "Cannot determine session");
       goto out;
     }
 
   agent = g_hash_table_lookup (priv->hash_session_to_authentication_agent, session_for_caller);
   if (agent != NULL)
     {
-      polkit_backend_pending_call_return_error (pending_call,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_FAILED,
-                                                "An authentication agent already exists for session");
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "An authentication agent already exists for session");
       goto out;
     }
 
@@ -1423,67 +1495,71 @@ polkit_backend_local_authority_register_authentication_agent (PolkitBackendAutho
            polkit_system_bus_name_get_name (POLKIT_SYSTEM_BUS_NAME (caller)),
            object_path);
 
-  polkit_backend_authority_register_authentication_agent_finish (pending_call);
+  ret = TRUE;
 
  out:
   if (session_for_caller != NULL)
     g_object_unref (session_for_caller);
+
+  return ret;
 }
 
-static void
+static gboolean
 polkit_backend_local_authority_unregister_authentication_agent (PolkitBackendAuthority   *authority,
+                                                                PolkitSubject            *caller,
                                                                 const gchar              *object_path,
-                                                                PolkitBackendPendingCall *pending_call)
+                                                                GCancellable             *cancellable,
+                                                                GError                  **error)
 {
   PolkitBackendLocalAuthority *local_authority;
   PolkitBackendLocalAuthorityPrivate *priv;
-  PolkitSubject *caller;
   PolkitSubject *session_for_caller;
   AuthenticationAgent *agent;
+  gboolean ret;
 
   local_authority = POLKIT_BACKEND_LOCAL_AUTHORITY (authority);
   priv = POLKIT_BACKEND_LOCAL_AUTHORITY_GET_PRIVATE (local_authority);
 
-  caller = polkit_backend_pending_call_get_caller (pending_call);
+  ret = FALSE;
 
   session_for_caller = polkit_backend_session_monitor_get_session_for_subject (priv->session_monitor,
                                                                                caller,
                                                                                NULL);
   if (session_for_caller == NULL)
     {
-      polkit_backend_pending_call_return_error (pending_call,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_FAILED,
-                                                "Cannot determine session");
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "Cannot determine session");
       goto out;
     }
 
   agent = g_hash_table_lookup (priv->hash_session_to_authentication_agent, session_for_caller);
   if (agent == NULL)
     {
-      polkit_backend_pending_call_return_error (pending_call,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_FAILED,
-                                                "No such agent registered");
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "No such agent registered");
       goto out;
     }
 
   if (strcmp (agent->unique_system_bus_name,
               polkit_system_bus_name_get_name (POLKIT_SYSTEM_BUS_NAME (caller))) != 0)
     {
-      polkit_backend_pending_call_return_error (pending_call,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_FAILED,
-                                                "System bus names do not match");
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "System bus names do not match");
       goto out;
     }
 
   if (strcmp (agent->object_path, object_path) != 0)
     {
-      polkit_backend_pending_call_return_error (pending_call,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_FAILED,
-                                                "Object paths do not match");
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "Object paths do not match");
       goto out;
     }
 
@@ -1496,34 +1572,36 @@ polkit_backend_local_authority_unregister_authentication_agent (PolkitBackendAut
   /* this works because we have exactly one agent per session */
   g_hash_table_remove (priv->hash_session_to_authentication_agent, agent->session);
 
-  polkit_backend_authority_unregister_authentication_agent_finish (pending_call);
+  ret = TRUE;
 
  out:
   if (session_for_caller != NULL)
     g_object_unref (session_for_caller);
+  return ret;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void
+static gboolean
 polkit_backend_local_authority_authentication_agent_response (PolkitBackendAuthority   *authority,
+                                                              PolkitSubject            *caller,
                                                               const gchar              *cookie,
                                                               PolkitIdentity           *identity,
-                                                              PolkitBackendPendingCall *pending_call)
+                                                              GCancellable             *cancellable,
+                                                              GError                  **error)
 {
   PolkitBackendLocalAuthority *local_authority;
   PolkitBackendLocalAuthorityPrivate *priv;
-  PolkitSubject *caller;
   PolkitIdentity *user_of_caller;
   gchar *identity_str;
-  GError *error;
   AuthenticationSession *session;
   GList *l;
+  gboolean ret;
 
   local_authority = POLKIT_BACKEND_LOCAL_AUTHORITY (authority);
   priv = POLKIT_BACKEND_LOCAL_AUTHORITY_GET_PRIVATE (local_authority);
 
-  error = NULL;
+  ret = FALSE;
   user_of_caller = NULL;
 
   identity_str = polkit_identity_to_string (identity);
@@ -1532,25 +1610,20 @@ polkit_backend_local_authority_authentication_agent_response (PolkitBackendAutho
            cookie,
            identity_str);
 
-  caller = polkit_backend_pending_call_get_caller (pending_call);
-
   user_of_caller = polkit_backend_session_monitor_get_user_for_subject (priv->session_monitor,
                                                                         caller,
-                                                                        &error);
-  if (error != NULL)
-    {
-      polkit_backend_pending_call_return_gerror (pending_call, error);
-      g_error_free (error);
-      goto out;
-    }
+                                                                        error);
+  if (user_of_caller == NULL)
+    goto out;
 
   /* only uid 0 is allowed to invoke this method */
   if (!POLKIT_IS_UNIX_USER (user_of_caller) || polkit_unix_user_get_uid (POLKIT_UNIX_USER (user_of_caller)) != 0)
     {
-      polkit_backend_pending_call_return_error (pending_call,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_FAILED,
-                                                "Only uid 0 may invoke this method. This incident has been logged.");
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "Only uid 0 may invoke this method. This incident has been logged.");
+      /* TODO: actually log this */
       goto out;
     }
 
@@ -1558,10 +1631,10 @@ polkit_backend_local_authority_authentication_agent_response (PolkitBackendAutho
   session = get_authentication_session_for_cookie (local_authority, cookie);
   if (session == NULL)
     {
-      polkit_backend_pending_call_return_error (pending_call,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_FAILED,
-                                                "No session for cookie");
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "No session for cookie");
       goto out;
     }
 
@@ -1573,25 +1646,28 @@ polkit_backend_local_authority_authentication_agent_response (PolkitBackendAutho
       if (polkit_identity_equal (i, identity))
         break;
     }
+
   if (l == NULL)
     {
-      polkit_backend_pending_call_return_error (pending_call,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_FAILED,
-                                                "The authenticated identity is wrong");
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "The authenticated identity is wrong");
       goto out;
     }
 
   /* checks out, mark the session as authenticated */
   session->is_authenticated = TRUE;
 
-  polkit_backend_authority_authentication_agent_response_finish (pending_call);
+  ret = TRUE;
 
  out:
   g_free (identity_str);
 
   if (user_of_caller != NULL)
     g_object_unref (user_of_caller);
+
+  return ret;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/polkitbackend/polkitbackendpendingcall.c b/src/polkitbackend/polkitbackendpendingcall.c
deleted file mode 100644
index 5489ef2..0000000
--- a/src/polkitbackend/polkitbackendpendingcall.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) 2008 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: David Zeuthen <davidz at redhat.com>
- */
-
-#include "config.h"
-
-#include <polkit/polkit.h>
-#include "polkitbackendpendingcall.h"
-#include "polkitbackendprivate.h"
-
-typedef struct
-{
-  EggDBusMethodInvocation *method_invocation;
-  PolkitSubject *inquirer;
-} PolkitBackendPendingCallPrivate;
-
-G_DEFINE_TYPE (PolkitBackendPendingCall, polkit_backend_pending_call, G_TYPE_OBJECT);
-
-#define POLKIT_BACKEND_PENDING_CALL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), POLKIT_BACKEND_TYPE_PENDING_CALL, PolkitBackendPendingCallPrivate))
-
-static void
-polkit_backend_pending_call_init (PolkitBackendPendingCall *pending_call)
-{
-  PolkitBackendPendingCallPrivate *priv;
-
-  priv = POLKIT_BACKEND_PENDING_CALL_GET_PRIVATE (pending_call);
-
-}
-
-static void
-polkit_backend_pending_call_finalize (GObject *object)
-{
-  PolkitBackendPendingCall *pending_call;
-  PolkitBackendPendingCallPrivate *priv;
-
-  pending_call = POLKIT_BACKEND_PENDING_CALL (object);
-  priv = POLKIT_BACKEND_PENDING_CALL_GET_PRIVATE (pending_call);
-
-  g_object_unref (priv->method_invocation);
-
-  if (priv->inquirer != NULL)
-    g_object_unref (priv->inquirer);
-
-  G_OBJECT_CLASS (polkit_backend_pending_call_parent_class)->finalize (object);
-}
-
-static void
-polkit_backend_pending_call_class_init (PolkitBackendPendingCallClass *klass)
-{
-  GObjectClass *gobject_class;
-
-  gobject_class = G_OBJECT_CLASS (klass);
-
-  gobject_class->finalize = polkit_backend_pending_call_finalize;
-
-  g_type_class_add_private (klass, sizeof (PolkitBackendPendingCallPrivate));
-}
-
-PolkitBackendPendingCall *
-_polkit_backend_pending_call_new (EggDBusMethodInvocation *method_invocation)
-{
-  PolkitBackendPendingCall *pending_call;
-  PolkitBackendPendingCallPrivate *priv;
-
-  pending_call = POLKIT_BACKEND_PENDING_CALL (g_object_new (POLKIT_BACKEND_TYPE_PENDING_CALL,
-                                                            NULL));
-
-  priv = POLKIT_BACKEND_PENDING_CALL_GET_PRIVATE (pending_call);
-
-  priv->method_invocation = g_object_ref (method_invocation);
-
-  return pending_call;
-}
-
-EggDBusMethodInvocation *
-_polkit_backend_pending_call_get_method_invocation (PolkitBackendPendingCall *pending_call)
-{
-  PolkitBackendPendingCallPrivate *priv;
-  priv = POLKIT_BACKEND_PENDING_CALL_GET_PRIVATE (pending_call);
-  return priv->method_invocation;
-}
-
-
-PolkitSubject *
-polkit_backend_pending_call_get_caller (PolkitBackendPendingCall *pending_call)
-{
-  PolkitBackendPendingCallPrivate *priv;
-
-  priv = POLKIT_BACKEND_PENDING_CALL_GET_PRIVATE (pending_call);
-
-  if (priv->inquirer != NULL)
-    goto out;
-
-  priv->inquirer = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (priv->method_invocation));
-
- out:
-  return priv->inquirer;
-}
-
-void
-polkit_backend_pending_call_return_gerror (PolkitBackendPendingCall *pending_call,
-                                           GError                   *error)
-{
-  PolkitBackendPendingCallPrivate *priv;
-
-  priv = POLKIT_BACKEND_PENDING_CALL_GET_PRIVATE (pending_call);
-
-  egg_dbus_method_invocation_return_gerror (priv->method_invocation,
-                                            error);
-
-  g_object_unref (pending_call);
-}
-
-void
-polkit_backend_pending_call_return_error (PolkitBackendPendingCall *pending_call,
-                                          GQuark                    domain,
-                                          gint                      code,
-                                          const gchar              *format,
-                                          ...)
-{
-  GError *error;
-  va_list va_args;
-  gchar *literal_message;
-
-  va_start (va_args, format);
-  literal_message = g_strdup_vprintf (format, va_args);
-
-  error = g_error_new_literal (domain,
-                               code,
-                               literal_message);
-
-  polkit_backend_pending_call_return_gerror (pending_call, error);
-
-  g_error_free (error);
-  g_free (literal_message);
-  va_end (va_args);
-}
-
diff --git a/src/polkitbackend/polkitbackendpendingcall.h b/src/polkitbackend/polkitbackendpendingcall.h
deleted file mode 100644
index 18142ea..0000000
--- a/src/polkitbackend/polkitbackendpendingcall.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2008 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: David Zeuthen <davidz at redhat.com>
- */
-
-#if !defined (_POLKIT_BACKEND_COMPILATION) && !defined(_POLKIT_BACKEND_INSIDE_POLKIT_BACKEND_H)
-#error "Only <polkitbackend/polkitbackend.h> can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef __POLKIT_BACKEND_PENDING_CALL_H
-#define __POLKIT_BACKEND_PENDING_CALL_H
-
-#include <glib-object.h>
-#include "polkitbackendtypes.h"
-
-G_BEGIN_DECLS
-
-#define POLKIT_BACKEND_TYPE_PENDING_CALL         (polkit_backend_pending_call_get_type ())
-#define POLKIT_BACKEND_PENDING_CALL(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), POLKIT_BACKEND_TYPE_PENDING_CALL, PolkitBackendPendingCall))
-#define POLKIT_BACKEND_PENDING_CALL_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), POLKIT_BACKEND_TYPE_PENDING_CALL, PolkitBackendPendingCallClass))
-#define POLKIT_BACKEND_PENDING_CALL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), POLKIT_BACKEND_TYPE_PENDING_CALL,PolkitBackendPendingCallClass))
-#define POLKIT_BACKEND_IS_PENDING_CALL(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), POLKIT_BACKEND_TYPE_PENDING_CALL))
-#define POLKIT_BACKEND_IS_PENDING_CALL_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), POLKIT_BACKEND_TYPE_PENDING_CALL))
-
-#if 0
-typedef struct _PolkitBackendPendingCall         PolkitBackendPendingCall;
-#endif
-typedef struct _PolkitBackendPendingCallClass    PolkitBackendPendingCallClass;
-
-struct _PolkitBackendPendingCall
-{
-  GObject parent_instance;
-};
-
-struct _PolkitBackendPendingCallClass
-{
-  GObjectClass parent_class;
-
-  /*< public >*/
-
-  /*< private >*/
-  /* Padding for future expansion */
-  void (*_polkit_reserved1) (void);
-  void (*_polkit_reserved2) (void);
-  void (*_polkit_reserved3) (void);
-  void (*_polkit_reserved4) (void);
-  void (*_polkit_reserved5) (void);
-  void (*_polkit_reserved6) (void);
-  void (*_polkit_reserved7) (void);
-  void (*_polkit_reserved8) (void);
-};
-
-GType                 polkit_backend_pending_call_get_type     (void) G_GNUC_CONST;
-PolkitSubject        *polkit_backend_pending_call_get_caller   (PolkitBackendPendingCall *pending_call);
-void                  polkit_backend_pending_call_return_error (PolkitBackendPendingCall *pending_call,
-                                                                GQuark                    domain,
-                                                                gint                      code,
-                                                                const gchar              *format,
-                                                                ...);
-void                  polkit_backend_pending_call_return_gerror (PolkitBackendPendingCall *pending_call,
-                                                                 GError                   *error);
-
-
-
-G_END_DECLS
-
-#endif /* __POLKIT_BACKEND_PENDING_CALL_H */
-
diff --git a/src/polkitbackend/polkitbackendprivate.h b/src/polkitbackend/polkitbackendprivate.h
index 67950de..6e7946e 100644
--- a/src/polkitbackend/polkitbackendprivate.h
+++ b/src/polkitbackend/polkitbackendprivate.h
@@ -23,10 +23,5 @@
 #define __POLKIT_BACKEND_PRIVATE_H
 
 #include <polkit/_polkitbindings.h>
-#include "polkitbackendpendingcall.h"
-
-PolkitBackendPendingCall *_polkit_backend_pending_call_new (EggDBusMethodInvocation *method_invocation);
-
-EggDBusMethodInvocation  *_polkit_backend_pending_call_get_method_invocation (PolkitBackendPendingCall *pending_call);
 
 #endif /* __POLKIT_BACKEND_PRIVATE_H */
diff --git a/src/polkitbackend/polkitbackendtypes.h b/src/polkitbackend/polkitbackendtypes.h
index 2aeeb7c..b2b0111 100644
--- a/src/polkitbackend/polkitbackendtypes.h
+++ b/src/polkitbackend/polkitbackendtypes.h
@@ -30,9 +30,6 @@ typedef struct _PolkitBackendAuthority PolkitBackendAuthority;
 struct _PolkitBackendLocalAuthority;
 typedef struct _PolkitBackendLocalAuthority PolkitBackendLocalAuthority;
 
-struct _PolkitBackendPendingCall;
-typedef struct _PolkitBackendPendingCall PolkitBackendPendingCall;
-
 struct _PolkitBackendSessionMonitor;
 typedef struct _PolkitBackendSessionMonitor PolkitBackendSessionMonitor;
 


More information about the hal-commit mailing list