summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-userdb.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-04-28 19:29:42 +0000
committerHavoc Pennington <hp@redhat.com>2003-04-28 19:29:42 +0000
commit893d859ed4ab785f46485fad28779f026fa166a1 (patch)
tree7e4791276313367c96ad042d711da409a22e902b /dbus/dbus-userdb.c
parente8d396efef695b9868b0112c4a6266c97678fa8a (diff)
2003-04-28 Havoc Pennington <hp@redhat.com>dbus-0.10
* configure.in: 0.10 * NEWS: update * bus/system.conf.in: add <includedir>system.d</includedir> * dbus/dbus-userdb.c (_dbus_user_database_lookup): fix bug when username was provided but not uid * bus/config-parser.c (struct BusConfigParser): keep track of whether the parser is toplevel or was included; change some of the error handling if it's included.
Diffstat (limited to 'dbus/dbus-userdb.c')
-rw-r--r--dbus/dbus-userdb.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/dbus/dbus-userdb.c b/dbus/dbus-userdb.c
index 00f2dced..4a7b7488 100644
--- a/dbus/dbus-userdb.c
+++ b/dbus/dbus-userdb.c
@@ -69,7 +69,8 @@ _dbus_user_database_lookup (DBusUserDatabase *db,
DBusUserInfo *info;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
-
+ _dbus_assert (uid != DBUS_UID_UNSET || username != NULL);
+
if (uid != DBUS_UID_UNSET)
info = _dbus_hash_table_lookup_ulong (db->users, uid);
else
@@ -93,13 +94,30 @@ _dbus_user_database_lookup (DBusUserDatabase *db,
return NULL;
}
- if (!_dbus_user_info_fill_uid (info, uid, error))
+ if (uid != DBUS_UID_UNSET)
{
- _DBUS_ASSERT_ERROR_IS_SET (error);
- free_user_info (info);
- return NULL;
+ if (!_dbus_user_info_fill_uid (info, uid, error))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ free_user_info (info);
+ return NULL;
+ }
+ }
+ else
+ {
+ if (!_dbus_user_info_fill (info, username, error))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ free_user_info (info);
+ return NULL;
+ }
}
+ /* be sure we don't use these after here */
+ uid = DBUS_UID_UNSET;
+ username = NULL;
+
+ /* insert into hash */
if (!_dbus_hash_table_insert_ulong (db->users, info->uid, info))
{
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);