add debug for each CheckClaim() call
authorDavid Zeuthen <davidz@redhat.com>
Mon, 12 Jan 2009 22:41:18 +0000 (17:41 -0500)
committerDavid Zeuthen <davidz@redhat.com>
Mon, 12 Jan 2009 22:41:18 +0000 (17:41 -0500)
src/polkitbackend/polkitbackendlocalauthority.c
src/polkitbackend/polkitbackendpendingcall.c

index ddc69c5..cbc5b4a 100644 (file)
@@ -220,9 +220,30 @@ polkit_backend_local_authority_check_claim (PolkitBackendAuthority   *authority,
                                             PolkitAuthorizationClaim *claim,
                                             PolkitBackendPendingCall *pending_call)
 {
+  gchar *inquirer_str;
+  gchar *subject_str;
+  PolkitSubject *inquirer;
+  PolkitSubject *subject;
+  const gchar *action_id;
+
+  inquirer = polkit_backend_pending_call_get_caller (pending_call);
+  subject = polkit_authorization_claim_get_subject (claim);
+  action_id = polkit_authorization_claim_get_action_id (claim);
+
+  inquirer_str = polkit_subject_to_string (inquirer);
+  subject_str = polkit_subject_to_string (subject);
+
+  g_debug ("%s is inquiring whether %s is authorized for %s",
+           inquirer_str,
+           subject_str,
+           action_id);
+
   polkit_backend_pending_call_return_error (pending_call,
                                             POLKIT_ERROR,
                                             POLKIT_ERROR_NOT_SUPPORTED,
                                             "Not implemented");
+
+  g_free (inquirer_str);
+  g_free (subject_str);
 }
 
index baefb25..9cce8b6 100644 (file)
@@ -29,6 +29,7 @@ typedef struct
 {
   EggDBusMethodInvocation *method_invocation;
   PolkitBackendServer *server;
+  PolkitSubject *inquirer;
 } PolkitBackendPendingCallPrivate;
 
 G_DEFINE_TYPE (PolkitBackendPendingCall, polkit_backend_pending_call, G_TYPE_OBJECT);
@@ -56,6 +57,9 @@ polkit_backend_pending_call_finalize (GObject *object)
   g_object_unref (priv->method_invocation);
   g_object_unref (priv->server);
 
+  if (priv->inquirer != NULL)
+    g_object_unref (priv->inquirer);
+
   G_OBJECT_CLASS (polkit_backend_pending_call_parent_class)->finalize (object);
 }
 
@@ -109,8 +113,17 @@ _polkit_backend_pending_call_get_method_invocation (PolkitBackendPendingCall *pe
 PolkitSubject *
 polkit_backend_pending_call_get_caller (PolkitBackendPendingCall *pending_call)
 {
-  /* TODO: implement */
-  return NULL;
+  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