mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 12:20:09 +01:00
libnm: use nm_getpwuid() in _permissions_user_allowed()
No need to clone the string again. Use nm_getpwuid() directly and avoid an additional clone.
This commit is contained in:
parent
5a7d1ec208
commit
a7de74018e
1 changed files with 6 additions and 5 deletions
|
|
@ -358,7 +358,7 @@ invalid:
|
|||
static gboolean
|
||||
_permissions_user_allowed(NMSettingConnection *setting, const char *uname, gulong uid)
|
||||
{
|
||||
gs_free char *uname_free = NULL;
|
||||
gs_free struct passwd *pw = NULL;
|
||||
NMSettingConnectionPrivate *priv;
|
||||
guint i;
|
||||
|
||||
|
|
@ -379,11 +379,12 @@ _permissions_user_allowed(NMSettingConnection *setting, const char *uname, gulon
|
|||
continue;
|
||||
|
||||
if (!uname) {
|
||||
if (uid != G_MAXULONG)
|
||||
uname_free = nm_utils_uid_to_name(uid);
|
||||
if (!uname_free)
|
||||
if (uid != G_MAXULONG) {
|
||||
pw = nm_getpwuid(uid);
|
||||
uname = nm_passwd_name(pw);
|
||||
}
|
||||
if (!uname)
|
||||
return FALSE;
|
||||
uname = uname_free;
|
||||
}
|
||||
|
||||
if (nm_streq(permission->item, uname))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue