mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 17:30:16 +01:00
all: use nm_utils_name_to_uid() instead of getpwnam()
This commit is contained in:
parent
714955c3b5
commit
99abd397d0
3 changed files with 1 additions and 24 deletions
|
|
@ -280,28 +280,6 @@ ck_finalize (NMSessionMonitor *monitor)
|
|||
|
||||
NM_DEFINE_SINGLETON_GETTER (NMSessionMonitor, nm_session_monitor_get, NM_TYPE_SESSION_MONITOR);
|
||||
|
||||
/**
|
||||
* nm_session_monitor_user_to_uid:
|
||||
* @user: User naee.
|
||||
* @out_uid: Return location for UID.
|
||||
*
|
||||
* Translates a user name to a UID.
|
||||
*/
|
||||
gboolean
|
||||
nm_session_monitor_user_to_uid (const char *user, uid_t *out_uid)
|
||||
{
|
||||
struct passwd *pw = getpwnam (user);
|
||||
|
||||
g_assert (out_uid);
|
||||
|
||||
if (!pw)
|
||||
return FALSE;
|
||||
|
||||
*out_uid = pw->pw_uid;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_session_monitor_session_exists:
|
||||
* @self: the session monitor
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ GType nm_session_monitor_get_type (void) G_GNUC_CONST;
|
|||
|
||||
NMSessionMonitor *nm_session_monitor_get (void);
|
||||
|
||||
gboolean nm_session_monitor_user_to_uid (const char *user, uid_t *out_uid);
|
||||
gboolean nm_session_monitor_session_exists (NMSessionMonitor *self,
|
||||
uid_t uid,
|
||||
gboolean active);
|
||||
|
|
|
|||
|
|
@ -357,7 +357,7 @@ nm_settings_connection_check_visibility (NMSettingsConnection *self,
|
|||
|
||||
if (!nm_setting_connection_get_permission (s_con, i, NULL, &user, NULL))
|
||||
continue;
|
||||
if (!nm_session_monitor_user_to_uid (user, &uid))
|
||||
if (!nm_utils_name_to_uid (user, &uid))
|
||||
continue;
|
||||
if (!nm_session_monitor_session_exists (session_monitor, uid, FALSE))
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue