"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dbus/dbus-userdb-util.c" between
dbus-1.12.18.tar.gz and dbus-1.12.20.tar.gz

About: D-Bus is an inter-process communication (IPC) system, allowing multiple, concurrently-running applications to communicate with one another. D-Bus supplies both a system daemon and a per-user-login-session daemon.

dbus-userdb-util.c  (dbus-1.12.18):dbus-userdb-util.c  (dbus-1.12.20)
skipping to change at line 41 skipping to change at line 41
#ifdef HAVE_SYSTEMD #ifdef HAVE_SYSTEMD
#include <systemd/sd-login.h> #include <systemd/sd-login.h>
#endif #endif
/** /**
* @addtogroup DBusInternalsUtils * @addtogroup DBusInternalsUtils
* @{ * @{
*/ */
static DBusGroupInfo *
_dbus_group_info_ref (DBusGroupInfo *info)
{
_dbus_assert (info->refcount > 0);
_dbus_assert (info->refcount < SIZE_MAX);
info->refcount++;
return info;
}
/** /**
* Checks to see if the UID sent in is the console user * Checks to see if the UID sent in is the console user
* *
* @param uid UID of person to check * @param uid UID of person to check
* @param error return location for errors * @param error return location for errors
* @returns #TRUE if the UID is the same as the console user and there are no er rors * @returns #TRUE if the UID is the same as the console user and there are no er rors
*/ */
dbus_bool_t dbus_bool_t
_dbus_is_console_user (dbus_uid_t uid, _dbus_is_console_user (dbus_uid_t uid,
DBusError *error) DBusError *error)
skipping to change at line 243 skipping to change at line 252
/** /**
* Looks up a gid or group name in the user database. Only one of * Looks up a gid or group name in the user database. Only one of
* name or GID can be provided. There are wrapper functions for this * name or GID can be provided. There are wrapper functions for this
* that are better to use, this one does no locking or anything on the * that are better to use, this one does no locking or anything on the
* database and otherwise sort of sucks. * database and otherwise sort of sucks.
* *
* @param db the database * @param db the database
* @param gid the group ID or #DBUS_GID_UNSET * @param gid the group ID or #DBUS_GID_UNSET
* @param groupname group name or #NULL * @param groupname group name or #NULL
* @param error error to fill in * @param error error to fill in
* @returns the entry in the database * @returns the entry in the database (borrowed, do not free)
*/ */
DBusGroupInfo* const DBusGroupInfo *
_dbus_user_database_lookup_group (DBusUserDatabase *db, _dbus_user_database_lookup_group (DBusUserDatabase *db,
dbus_gid_t gid, dbus_gid_t gid,
const DBusString *groupname, const DBusString *groupname,
DBusError *error) DBusError *error)
{ {
DBusGroupInfo *info; DBusGroupInfo *info;
_DBUS_ASSERT_ERROR_IS_CLEAR (error); _DBUS_ASSERT_ERROR_IS_CLEAR (error);
/* See if the group is really a number */ /* See if the group is really a number */
skipping to change at line 290 skipping to change at line 299
else else
_dbus_verbose ("No cache for groupname \"%s\"\n", _dbus_verbose ("No cache for groupname \"%s\"\n",
_dbus_string_get_const_data (groupname)); _dbus_string_get_const_data (groupname));
info = dbus_new0 (DBusGroupInfo, 1); info = dbus_new0 (DBusGroupInfo, 1);
if (info == NULL) if (info == NULL)
{ {
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
return NULL; return NULL;
} }
info->refcount = 1;
if (gid != DBUS_GID_UNSET) if (gid != DBUS_GID_UNSET)
{ {
if (!_dbus_group_info_fill_gid (info, gid, error)) if (!_dbus_group_info_fill_gid (info, gid, error))
{ {
_DBUS_ASSERT_ERROR_IS_SET (error); _DBUS_ASSERT_ERROR_IS_SET (error);
_dbus_group_info_free_allocated (info); _dbus_group_info_unref (info);
return NULL; return NULL;
} }
} }
else else
{ {
if (!_dbus_group_info_fill (info, groupname, error)) if (!_dbus_group_info_fill (info, groupname, error))
{ {
_DBUS_ASSERT_ERROR_IS_SET (error); _DBUS_ASSERT_ERROR_IS_SET (error);
_dbus_group_info_free_allocated (info); _dbus_group_info_unref (info);
return NULL; return NULL;
} }
} }
/* don't use these past here */ /* don't use these past here */
gid = DBUS_GID_UNSET; gid = DBUS_GID_UNSET;
groupname = NULL; groupname = NULL;
if (!_dbus_hash_table_insert_uintptr (db->groups, info->gid, info)) if (_dbus_hash_table_insert_uintptr (db->groups, info->gid, info))
{
_dbus_group_info_ref (info);
}
else
{ {
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
_dbus_group_info_free_allocated (info); _dbus_group_info_unref (info);
return NULL; return NULL;
} }
if (!_dbus_hash_table_insert_string (db->groups_by_name, if (_dbus_hash_table_insert_string (db->groups_by_name,
info->groupname, info->groupname,
info)) info))
{
_dbus_group_info_ref (info);
}
else
{ {
_dbus_hash_table_remove_uintptr (db->groups, info->gid); _dbus_hash_table_remove_uintptr (db->groups, info->gid);
_dbus_group_info_unref (info);
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
return NULL; return NULL;
} }
/* Release the original reference */
_dbus_group_info_unref (info);
/* Return a borrowed reference to the DBusGroupInfo owned by the
* two hash tables */
return info; return info;
} }
} }
/** /**
* Gets the user information for the given group name, * Gets the user information for the given group name,
* returned group info should not be freed. * returned group info should not be freed.
* *
* @param db user database * @param db user database
* @param groupname the group name * @param groupname the group name
 End of changes. 11 change blocks. 
9 lines changed or deleted 33 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)