summaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/addgroup.c1
-rw-r--r--loginutils/passwd.c4
-rw-r--r--loginutils/su.c4
3 files changed, 3 insertions, 6 deletions
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c
index 89414d7..2a840d7 100644
--- a/loginutils/addgroup.c
+++ b/loginutils/addgroup.c
@@ -159,6 +159,7 @@ int addgroup_main(int argc UNUSED_PARAM, char **argv)
/* check if group and user exist */
xuname2uid(argv[0]); /* unknown user: exit */
xgroup2gid(argv[1]); /* unknown group: exit */
+// race here!
/* check if user is already in this group */
gr = getgrnam(argv[1]);
for (; *(gr->gr_mem) != NULL; (gr->gr_mem)++) {
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index e3e74ba..aa89b87 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -118,9 +118,7 @@ int passwd_main(int argc UNUSED_PARAM, char **argv)
myname = xstrdup(xuid2uname(myuid));
name = argv[0] ? argv[0] : myname;
- pw = getpwnam(name);
- if (!pw)
- bb_error_msg_and_die("unknown user %s", name);
+ pw = xgetpwnam(name);
if (myuid && pw->pw_uid != myuid) {
/* LOGMODE_BOTH */
bb_error_msg_and_die("%s can't change password for %s", myname, name);
diff --git a/loginutils/su.c b/loginutils/su.c
index 61039d8..e7e0001 100644
--- a/loginutils/su.c
+++ b/loginutils/su.c
@@ -48,9 +48,7 @@ int su_main(int argc UNUSED_PARAM, char **argv)
openlog(applet_name, 0, LOG_AUTH);
}
- pw = getpwnam(opt_username);
- if (!pw)
- bb_error_msg_and_die("unknown id: %s", opt_username);
+ pw = xgetpwnam(opt_username);
/* Make sure pw->pw_shell is non-NULL. It may be NULL when NEW_USER
is a username that is retrieved via NIS (YP), but that doesn't have