mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-30 06:00:10 +01:00
Merge branch 'unused-userdb' into 'master'
Remove unused bits of userdb See merge request dbus/dbus!92 Reviewed-by: pwithnall
This commit is contained in:
commit
af89e0db8d
5 changed files with 4 additions and 143 deletions
|
|
@ -2992,46 +2992,6 @@ _dbus_pid_for_log (void)
|
|||
return getpid ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a UID from a UID string.
|
||||
*
|
||||
* @param uid_str the UID in string form
|
||||
* @param uid UID to fill in
|
||||
* @returns #TRUE if successfully filled in UID
|
||||
*/
|
||||
dbus_bool_t
|
||||
_dbus_parse_uid (const DBusString *uid_str,
|
||||
dbus_uid_t *uid)
|
||||
{
|
||||
int end;
|
||||
long val;
|
||||
|
||||
if (_dbus_string_get_length (uid_str) == 0)
|
||||
{
|
||||
_dbus_verbose ("UID string was zero length\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
val = -1;
|
||||
end = 0;
|
||||
if (!_dbus_string_parse_int (uid_str, 0, &val,
|
||||
&end))
|
||||
{
|
||||
_dbus_verbose ("could not parse string as a UID\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (end != _dbus_string_get_length (uid_str))
|
||||
{
|
||||
_dbus_verbose ("string contained trailing stuff after UID\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*uid = val;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if !DBUS_USE_SYNC
|
||||
/* To be thread-safe by default on platforms that don't necessarily have
|
||||
* atomic operations (notably Debian armel, which is armv4t), we must
|
||||
|
|
|
|||
|
|
@ -141,9 +141,6 @@ void _dbus_group_info_free (DBusGroupInfo *info);
|
|||
DBUS_PRIVATE_EXPORT
|
||||
dbus_uid_t _dbus_geteuid (void);
|
||||
|
||||
dbus_bool_t _dbus_parse_uid (const DBusString *uid_str,
|
||||
dbus_uid_t *uid);
|
||||
|
||||
DBUS_PRIVATE_EXPORT
|
||||
void _dbus_close_all (void);
|
||||
DBUS_PRIVATE_EXPORT
|
||||
|
|
|
|||
|
|
@ -181,8 +181,10 @@ _dbus_get_group_id (const DBusString *groupname,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!_dbus_user_database_get_groupname (db, groupname,
|
||||
&info, NULL))
|
||||
info = _dbus_user_database_lookup_group (db, DBUS_GID_UNSET, groupname,
|
||||
NULL);
|
||||
|
||||
if (info == NULL)
|
||||
{
|
||||
_dbus_user_database_unlock_system ();
|
||||
return FALSE;
|
||||
|
|
@ -339,48 +341,6 @@ _dbus_user_database_lookup_group (DBusUserDatabase *db,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the user information for the given group name,
|
||||
* returned group info should not be freed.
|
||||
*
|
||||
* @param db user database
|
||||
* @param groupname the group name
|
||||
* @param info return location for const ref to group info
|
||||
* @param error error location
|
||||
* @returns #FALSE if error is set
|
||||
*/
|
||||
dbus_bool_t
|
||||
_dbus_user_database_get_groupname (DBusUserDatabase *db,
|
||||
const DBusString *groupname,
|
||||
const DBusGroupInfo **info,
|
||||
DBusError *error)
|
||||
{
|
||||
*info = _dbus_user_database_lookup_group (db, DBUS_GID_UNSET, groupname, error);
|
||||
return *info != NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the user information for the given GID,
|
||||
* returned group info should not be freed.
|
||||
*
|
||||
* @param db user database
|
||||
* @param gid the group ID
|
||||
* @param info return location for const ref to group info
|
||||
* @param error error location
|
||||
* @returns #FALSE if error is set
|
||||
*/
|
||||
dbus_bool_t
|
||||
_dbus_user_database_get_gid (DBusUserDatabase *db,
|
||||
dbus_gid_t gid,
|
||||
const DBusGroupInfo **info,
|
||||
DBusError *error)
|
||||
{
|
||||
*info = _dbus_user_database_lookup_group (db, gid, NULL, error);
|
||||
return *info != NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets all groups corresponding to the given UID. Returns #FALSE
|
||||
* if no memory, or user isn't known, but always initializes
|
||||
|
|
|
|||
|
|
@ -415,48 +415,6 @@ _dbus_homedir_from_current_process (const DBusString **homedir)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the home directory for the given user.
|
||||
*
|
||||
* @param username the username
|
||||
* @param homedir string to append home directory to
|
||||
* @returns #TRUE if user existed and we appended their homedir
|
||||
*/
|
||||
dbus_bool_t
|
||||
_dbus_homedir_from_username (const DBusString *username,
|
||||
DBusString *homedir)
|
||||
{
|
||||
DBusUserDatabase *db;
|
||||
const DBusUserInfo *info;
|
||||
|
||||
/* FIXME: this can't distinguish ENOMEM from other errors */
|
||||
if (!_dbus_user_database_lock_system ())
|
||||
return FALSE;
|
||||
|
||||
db = _dbus_user_database_get_system ();
|
||||
if (db == NULL)
|
||||
{
|
||||
_dbus_user_database_unlock_system ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!_dbus_user_database_get_username (db, username,
|
||||
&info, NULL))
|
||||
{
|
||||
_dbus_user_database_unlock_system ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!_dbus_string_append (homedir, info->homedir))
|
||||
{
|
||||
_dbus_user_database_unlock_system ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
_dbus_user_database_unlock_system ();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the home directory for the given user.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -61,20 +61,11 @@ dbus_bool_t _dbus_user_database_get_uid (DBusUserDatabase *db,
|
|||
dbus_uid_t uid,
|
||||
const DBusUserInfo **info,
|
||||
DBusError *error);
|
||||
dbus_bool_t _dbus_user_database_get_gid (DBusUserDatabase *db,
|
||||
dbus_gid_t gid,
|
||||
const DBusGroupInfo **info,
|
||||
DBusError *error);
|
||||
DBUS_PRIVATE_EXPORT
|
||||
dbus_bool_t _dbus_user_database_get_username (DBusUserDatabase *db,
|
||||
const DBusString *username,
|
||||
const DBusUserInfo **info,
|
||||
DBusError *error);
|
||||
dbus_bool_t _dbus_user_database_get_groupname (DBusUserDatabase *db,
|
||||
const DBusString *groupname,
|
||||
const DBusGroupInfo **info,
|
||||
DBusError *error);
|
||||
|
||||
DBUS_PRIVATE_EXPORT
|
||||
DBusUserInfo* _dbus_user_database_lookup (DBusUserDatabase *db,
|
||||
dbus_uid_t uid,
|
||||
|
|
@ -107,8 +98,6 @@ DBUS_PRIVATE_EXPORT
|
|||
dbus_bool_t _dbus_get_user_id_and_primary_group (const DBusString *username,
|
||||
dbus_uid_t *uid_p,
|
||||
dbus_gid_t *gid_p);
|
||||
dbus_bool_t _dbus_credentials_from_uid (dbus_uid_t user_id,
|
||||
DBusCredentials *credentials);
|
||||
dbus_bool_t _dbus_groups_from_uid (dbus_uid_t uid,
|
||||
dbus_gid_t **group_ids,
|
||||
int *n_group_ids);
|
||||
|
|
@ -124,9 +113,6 @@ DBUS_PRIVATE_EXPORT
|
|||
dbus_bool_t _dbus_username_from_current_process (const DBusString **username);
|
||||
DBUS_PRIVATE_EXPORT
|
||||
dbus_bool_t _dbus_homedir_from_current_process (const DBusString **homedir);
|
||||
dbus_bool_t _dbus_homedir_from_username (const DBusString *username,
|
||||
DBusString *homedir);
|
||||
|
||||
dbus_bool_t _dbus_homedir_from_uid (dbus_uid_t uid,
|
||||
DBusString *homedir);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue