dbus/dbus dbus-sysdeps.c,1.74,1.75

Havoc Pennington hp at freedesktop.org
Sun Aug 22 21:12:09 PDT 2004


Update of /cvs/dbus/dbus/dbus
In directory gabe:/tmp/cvs-serv30109/dbus

Modified Files:
	dbus-sysdeps.c 
Log Message:
2004-08-23  Havoc Pennington  <hp at redhat.com>

	* dbus/dbus-sysdeps.c (_dbus_change_identity): add setgroups() to
	drop supplementary groups, suggested by Steve Grubb



Index: dbus-sysdeps.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- dbus-sysdeps.c	10 Aug 2004 03:07:00 -0000	1.74
+++ dbus-sysdeps.c	23 Aug 2004 04:12:07 -0000	1.75
@@ -3281,6 +3281,16 @@
                         dbus_gid_t     gid,
                         DBusError     *error)
 {
+  /* setgroups() only works if we are a privileged process,
+   * so we don't return error on failure; the only possible
+   * failure is that we don't have perms to do it.
+   * FIXME not sure this is right, maybe if setuid()
+   * is going to work then setgroups() should also work.
+   */
+  if (setgroups (0, NULL) < 0)
+    dbus_warn ("Failed to drop supplementary groups: %s\n",
+               _dbus_strerror (errno));
+  
   /* Set GID first, or the setuid may remove our permission
    * to change the GID
    */



More information about the dbus-commit mailing list