From 7b340cdb43e80656dddfeddac8390157ee1bf5d6 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 14 Feb 2005 19:07:29 +0000 Subject: 2005-02-14 Havoc Pennington * dbus/dbus-userdb-util.c (_dbus_user_database_lookup_group): properly handle looking up group information by name; fix from j@bootlab.org --- dbus/dbus-userdb-util.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'dbus/dbus-userdb-util.c') diff --git a/dbus/dbus-userdb-util.c b/dbus/dbus-userdb-util.c index 10226007..3d51f71d 100644 --- a/dbus/dbus-userdb-util.c +++ b/dbus/dbus-userdb-util.c @@ -218,12 +218,28 @@ _dbus_user_database_lookup_group (DBusUserDatabase *db, 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)) { -- cgit