dbus/bus bus.c,1.69,1.70

John Palmieri johnp at kemper.freedesktop.org
Fri Aug 18 13:24:58 PDT 2006


Update of /cvs/dbus/dbus/bus
In directory kemper:/tmp/cvs-serv8430/bus

Modified Files:
	bus.c 
Log Message:
* Released 0.92

* dbus/dbus-threads.c (dbus_threads_init): change the documentation
  to reflect the init late change

* bus/bus.c (bus_context_new): Check user before we fork so we can
  print out an error message a user will be able to see



Index: bus.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/bus.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- bus.c	8 Aug 2006 23:30:39 -0000	1.69
+++ bus.c	18 Aug 2006 20:24:56 -0000	1.70
@@ -531,7 +531,8 @@
 {
   BusContext *context;
   BusConfigParser *parser;
-  
+  DBusCredentials creds;
+
   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
 
   context = NULL;
@@ -657,7 +658,25 @@
       BUS_SET_OOM (error);
       goto failed;
     }
-  
+
+  /* check user before we fork */
+  if (context->user != NULL)
+    {
+      DBusString u;
+
+      _dbus_string_init_const (&u, context->user);
+
+      if (!_dbus_credentials_from_username (&u, &creds) ||
+          creds.uid < 0 ||
+          creds.gid < 0)
+        {
+          dbus_set_error (error, DBUS_ERROR_FAILED,
+                          "Could not get UID and GID for username \"%s\"",
+                          context->user);
+          goto failed;
+        }
+    }
+
   /* Now become a daemon if appropriate */
   if ((force_fork != FORK_NEVER && context->fork) || force_fork == FORK_ALWAYS)
     {
@@ -749,21 +768,6 @@
    */
   if (context->user != NULL)
     {
-      DBusCredentials creds;
-      DBusString u;
-
-      _dbus_string_init_const (&u, context->user);
-
-      if (!_dbus_credentials_from_username (&u, &creds) ||
-          creds.uid < 0 ||
-          creds.gid < 0)
-        {
-          dbus_set_error (error, DBUS_ERROR_FAILED,
-                          "Could not get UID and GID for username \"%s\"",
-                          context->user);
-          goto failed;
-        }
-      
       if (!_dbus_change_identity (creds.uid, creds.gid, error))
 	{
 	  _DBUS_ASSERT_ERROR_IS_SET (error);



More information about the dbus-commit mailing list