return caller;
}
+static kit_bool_t
+_free_elem_in_list (KitList *list, void *data, void *user_data)
+{
+ kit_free (data);
+ return FALSE;
+}
+
static KitList *
_get_list_of_sessions (DBusConnection *con, uid_t uid, DBusError *error)
{
if (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_OBJECT_PATH) {
kit_warning ("Wrong reply from ConsoleKit (element is not a string)");
- kit_list_foreach (ret, (KitListForeachFunc) kit_free, NULL);
+ kit_list_foreach (ret, _free_elem_in_list, NULL);
kit_list_free (ret);
goto out;
}
del_sessions = TRUE;
}
- for (i = sessions; i != NULL; i = i->next) {
- char *session_id = i->data;
- if (strcmp (session_id, polkit_authorization_scope_session_get_ck_objref (auth)) == 0) {
- ret = TRUE;
- break;
+ if (sessions != NULL) {
+ for (i = sessions; i != NULL; i = i->next) {
+ char *session_id = i->data;
+ if (strcmp (session_id, polkit_authorization_scope_session_get_ck_objref (auth)) == 0) {
+ ret = TRUE;
+ break;
+ }
+ }
+
+ if (del_sessions) {
+ kit_list_foreach (sessions, _free_elem_in_list, NULL);
+ kit_list_free (sessions);
}
- }
-
- if (del_sessions) {
- kit_list_foreach (sessions, (KitListForeachFunc) kit_free, NULL);
- kit_list_free (sessions);
}
break;
*/
#undef PGH_DEBUG
/* #define PGH_DEBUG */
+#define PGH_DEBUG
/* synopsis: polkit-grant-helper <pid> <action-name>
*
*
*/
static polkit_bool_t
-do_auth (const char *user_to_auth)
+do_auth (const char *user_to_auth, gboolean *empty_conversation)
{
int helper_pid;
int helper_stdin;
child_stdin = NULL;
child_stdout = NULL;
ret = FALSE;
+ *empty_conversation = TRUE;
g_error = NULL;
if (!g_spawn_async_with_pipes (NULL,
if (strcmp (buf, "FAILURE\n") == 0) {
goto out;
}
+
+ *empty_conversation = FALSE;
+
/* send to parent */
fprintf (stdout, buf);
fflush (stdout);
PolKitCaller *caller;
uid_t caller_uid;
PolKitSession *session;
+ gboolean empty_conversation;
ret = 3;
ret = 1;
/* Start authentication */
- if (!do_auth (user_to_auth)) {
+ if (!do_auth (user_to_auth, &empty_conversation)) {
goto out;
}
+#ifdef PGH_DEBUG
+ fprintf (stderr, "polkit-grant-helper: empty_conversation=%d\n", empty_conversation);
+#endif /* PGH_DEBUG */
+
/* Ask caller if he want to slim down grant type... e.g. he
* might want to go from auth_self_keep_always to
* auth_self_keep_session..