PolicyKit/polkitd main.c,1.1,1.2 polkit-session.c,1.1,1.2
David Zeuthen
david at kemper.freedesktop.org
Thu Mar 16 15:28:49 PST 2006
Update of /cvs/hal/PolicyKit/polkitd
In directory kemper:/tmp/cvs-serv4946/polkitd
Modified Files:
main.c polkit-session.c
Log Message:
2006-03-16 David Zeuthen <davidz at 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
Index: main.c
===================================================================
RCS file: /cvs/hal/PolicyKit/polkitd/main.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- main.c 14 Mar 2006 06:14:33 -0000 1.1
+++ main.c 16 Mar 2006 23:28:47 -0000 1.2
@@ -214,8 +214,12 @@
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);
Index: polkit-session.c
===================================================================
RCS file: /cvs/hal/PolicyKit/polkitd/polkit-session.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- polkit-session.c 14 Mar 2006 06:14:33 -0000 1.1
+++ polkit-session.c 16 Mar 2006 23:28:47 -0000 1.2
@@ -688,6 +688,10 @@
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 @@
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 @@
{
/*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,
More information about the hal-commit
mailing list