* sensitive information.
*/
#undef PAH_DEBUG
-#define PAH_DEBUG
+// #define PAH_DEBUG
static gboolean send_dbus_message (const char *cookie, const char *user);
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:
fprintf (stdout, "FAILURE\n");
fflush (stdout);
+ fflush (stderr);
+ usleep (10 * 1000); /* since fflush(3) seems buggy */
return 1;
}
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;
}
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;
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);
/* 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,