PolicyKit: Branch 'master'
David Zeuthen
david at kemper.freedesktop.org
Sat Jan 31 10:23:50 PST 2009
src/polkitagent/polkitagenthelper.c | 27 +++++++++++++++++++-----
src/polkitagent/polkitagentsession.c | 3 ++
src/polkitbackend/polkitbackendlocalauthority.c | 4 +--
3 files changed, 27 insertions(+), 7 deletions(-)
New commits:
commit 9a2a4a340ade17f87609588354400bbd7a0646a9
Author: David Zeuthen <davidz at redhat.com>
Date: Sat Jan 31 13:21:49 2009 -0500
add more debug and work around what looks like a bug in fflush(3)
diff --git a/src/polkitagent/polkitagenthelper.c b/src/polkitagent/polkitagenthelper.c
index b5181e5..437eada 100644
--- a/src/polkitagent/polkitagenthelper.c
+++ b/src/polkitagent/polkitagenthelper.c
@@ -40,7 +40,7 @@
* sensitive information.
*/
#undef PAH_DEBUG
-#define PAH_DEBUG
+// #define PAH_DEBUG
static gboolean send_dbus_message (const char *cookie, const char *user);
@@ -158,16 +158,31 @@ main (int argc, char *argv[])
fprintf (stderr, "polkit-agent-helper-1: successfully authenticated user '%s'.\n", user_to_auth);
#endif /* PAH_DEBUG */
+ pam_end (pam_h, rc);
+
+#ifdef PAH_DEBUG
+ fprintf (stderr, "polkit-agent-helper-1: sending D-Bus message to PolicyKit daemon\n");
+#endif /* PAH_DEBUG */
+
/* now send a D-Bus message to the PolicyKit daemon that
* includes a) the cookie; and b) the user we authenticated
*/
if (!send_dbus_message (cookie, user_to_auth))
- goto error;
+ {
+#ifdef PAH_DEBUG
+ fprintf (stderr, "polkit-agent-helper-1: error sending D-Bus message to PolicyKit daemon\n");
+#endif /* PAH_DEBUG */
+ goto error;
+ }
+
+#ifdef PAH_DEBUG
+ fprintf (stderr, "polkit-agent-helper-1: successfully sent D-Bus message to PolicyKit daemon\n");
+#endif /* PAH_DEBUG */
fprintf (stdout, "SUCCESS\n");
fflush (stdout);
-
- pam_end (pam_h, rc);
+ fflush (stderr);
+ usleep (10 * 1000); /* since fflush(3) seems buggy */
return 0;
error:
@@ -176,6 +191,8 @@ error:
fprintf (stdout, "FAILURE\n");
fflush (stdout);
+ fflush (stderr);
+ usleep (10 * 1000); /* since fflush(3) seems buggy */
return 1;
}
@@ -290,7 +307,7 @@ send_dbus_message (const char *cookie, const char *user)
NULL,
&error))
{
- g_printerr ("Error sending response to PolicyKit daemon: %s\n", error->message);
+ g_printerr ("polkit-agent-helper-1: error response to PolicyKit daemon: %s\n", error->message);
g_error_free (error);
goto out;
}
diff --git a/src/polkitagent/polkitagentsession.c b/src/polkitagent/polkitagentsession.c
index 0510227..fef2119 100644
--- a/src/polkitagent/polkitagentsession.c
+++ b/src/polkitagent/polkitagentsession.c
@@ -234,6 +234,7 @@ kill_helper (PolkitAgentSession *session)
if (session->child_pid > 0)
{
gint status;
+ //g_debug ("Sending SIGTERM to helper");
kill (session->child_pid, SIGTERM);
waitpid (session->child_pid, &status, 0);
session->child_pid = 0;
@@ -321,6 +322,8 @@ io_watch_have_data (GIOChannel *channel,
if (strlen (line) > 0 && line[strlen (line) - 1] == '\n')
line[strlen (line) - 1] = '\0';
+ //g_debug ("Got '%s' from helper", line);
+
if (g_str_has_prefix (line, "PAM_PROMPT_ECHO_OFF "))
{
g_signal_emit_by_name (session, "request-echo-off", line + sizeof "PAM_PROMPT_ECHO_OFF " - 1);
diff --git a/src/polkitbackend/polkitbackendlocalauthority.c b/src/polkitbackend/polkitbackendlocalauthority.c
index 77b6315..22738a8 100644
--- a/src/polkitbackend/polkitbackendlocalauthority.c
+++ b/src/polkitbackend/polkitbackendlocalauthority.c
@@ -1288,11 +1288,11 @@ authentication_agent_initiate_challenge (AuthenticationAgent *agent,
/* TODO: add uid 0 OR users in wheel group depending on value of @implicit_authorization */
identities = NULL;
identities = g_list_prepend (identities, g_object_ref (user_of_subject));
- //#if 0
+#if 0
identities = g_list_prepend (identities, polkit_unix_user_new (501));
identities = g_list_prepend (identities, polkit_unix_user_new (502));
identities = g_list_prepend (identities, polkit_unix_user_new (0));
- //#endif
+#endif
session = authentication_session_new (agent,
cookie,
More information about the hal-commit
mailing list