diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-07-23 01:17:59 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-07-23 01:17:59 +0200 |
commit | 4b67834e9f8a336dbc917f3bf212550e61cc98b4 (patch) | |
tree | 69babe73a6daf006645912f0c31fcdc1868d3167 /src/logind.c | |
parent | e6a6b406791a76ca979ff5e615fd4d9a986a14b8 (diff) |
util: make use of get_user_creds() and get_group_creds() wherever applicable
Diffstat (limited to 'src/logind.c')
-rw-r--r-- | src/logind.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/logind.c b/src/logind.c index a081501a8c..8b99065b23 100644 --- a/src/logind.c +++ b/src/logind.c @@ -239,17 +239,18 @@ int manager_add_user(Manager *m, uid_t uid, gid_t gid, const char *name, User ** } int manager_add_user_by_name(Manager *m, const char *name, User **_user) { - struct passwd *p; + uid_t uid; + gid_t gid; + int r; assert(m); assert(name); - errno = 0; - p = getpwnam(name); - if (!p) - return errno ? -errno : -ENOENT; + r = get_user_creds(&name, &uid, &gid, NULL); + if (r < 0) + return r; - return manager_add_user(m, p->pw_uid, p->pw_gid, name, _user); + return manager_add_user(m, uid, gid, name, _user); } int manager_add_user_by_uid(Manager *m, uid_t uid, User **_user) { |