Commit 4fa68a3d authored by David Zeuthen's avatar David Zeuthen

Unref when the child dies (polkit_session_initiate_auth): Ref the object

    after creating child (polkit_session_initiator_disconnected): Make sure
    to nuke the kids
parent f6dd9fa0
2006-03-16 David Zeuthen <davidz@redhat.com>
* polkitd/polkit-session.c (data_from_pam): Unref when the child dies
(polkit_session_initiate_auth): Ref the object after creating child
(polkit_session_initiator_disconnected): Make sure to nuke the kids
2006-03-15 David Zeuthen <davidz@redhat.com>
* polkitd/polkit-manager.h: Include sys/types.h; fixed fd.o
......
......@@ -214,8 +214,12 @@ main (int argc, char *argv[])
g_error_free (error);
goto out;
}
if (request_name_result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
g_warning ("There is already a primary owner of the name org.freedesktop.PolicyKit");
goto out;
}
manager = polkit_manager_new (bus, bus_proxy);
......
......@@ -688,6 +688,10 @@ data_from_pam (GIOChannel *source,
session->priv->child_pid = 0;
waitpid (session->priv->child_pid, &status, 0);
}
/* release the ref we made when creating the child */
g_object_unref (session);
/* remove the source */
return FALSE;
}
......@@ -773,6 +777,9 @@ polkit_session_initiate_auth (PolicyKitSession *session,
session->priv->pam_channel_write = g_io_channel_unix_new (fdsb[1]);
session->priv->pam_channel = g_io_channel_unix_new (fds[0]);
/* ref because we need the object in data_from_pam */
g_object_ref (session);
g_io_add_watch (session->priv->pam_channel,
G_IO_IN | G_IO_ERR | G_IO_HUP,
data_from_pam,
......@@ -987,6 +994,10 @@ polkit_session_initiator_disconnected (PolicyKitSession *session)
{
/*g_debug ("initiator disconnected");*/
/* if we have a child... kill it */
if (session->priv->child_pid != 0)
kill (session->priv->child_pid, SIGTERM);
if (session->priv->have_granted_temp_privileges) {
if (!polkit_manager_remove_temporary_privilege (session->priv->manager,
session->priv->grant_to_uid,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment