dbus/dbus dbus-userdb-util.c,1.2,1.3

Havoc Pennington hp at freedesktop.org
Mon Feb 14 11:07:31 PST 2005


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

Modified Files:
	dbus-userdb-util.c 
Log Message:
2005-02-14  Havoc Pennington  <hp at redhat.com>

	* dbus/dbus-userdb-util.c (_dbus_user_database_lookup_group):
	properly handle looking up group information by name; fix 
	from j at bootlab.org



Index: dbus-userdb-util.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-userdb-util.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dbus-userdb-util.c	17 Jan 2005 03:53:40 -0000	1.2
+++ dbus-userdb-util.c	14 Feb 2005 19:07:29 -0000	1.3
@@ -218,13 +218,29 @@
           return NULL;
         }
 
-      if (!_dbus_group_info_fill_gid (info, gid, error))
+      if (gid != DBUS_GID_UNSET)
         {
-          _DBUS_ASSERT_ERROR_IS_SET (error);
-          _dbus_group_info_free_allocated (info);
-          return NULL;
+          if (!_dbus_group_info_fill_gid (info, gid, error))
+            {
+              _DBUS_ASSERT_ERROR_IS_SET (error);
+              _dbus_group_info_free_allocated (info);
+              return NULL;
+            }
+        }
+      else
+        {
+          if (!_dbus_group_info_fill (info, groupname, error))
+            {
+              _DBUS_ASSERT_ERROR_IS_SET (error);
+              _dbus_group_info_free_allocated (info);
+              return NULL;
+            }
         }
 
+      /* don't use these past here */
+      gid = DBUS_GID_UNSET;
+      groupname = NULL;
+
       if (!_dbus_hash_table_insert_ulong (db->groups, info->gid, info))
         {
           dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);



More information about the dbus-commit mailing list