diff options
Diffstat (limited to 'loginutils')
-rw-r--r-- | loginutils/addgroup.c | 1 | ||||
-rw-r--r-- | loginutils/passwd.c | 4 | ||||
-rw-r--r-- | loginutils/su.c | 4 |
3 files changed, 3 insertions, 6 deletions
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c index 89414d738..2a840d7c0 100644 --- a/loginutils/addgroup.c +++ b/loginutils/addgroup.c | |||
@@ -159,6 +159,7 @@ int addgroup_main(int argc UNUSED_PARAM, char **argv) | |||
159 | /* check if group and user exist */ | 159 | /* check if group and user exist */ |
160 | xuname2uid(argv[0]); /* unknown user: exit */ | 160 | xuname2uid(argv[0]); /* unknown user: exit */ |
161 | xgroup2gid(argv[1]); /* unknown group: exit */ | 161 | xgroup2gid(argv[1]); /* unknown group: exit */ |
162 | // race here! | ||
162 | /* check if user is already in this group */ | 163 | /* check if user is already in this group */ |
163 | gr = getgrnam(argv[1]); | 164 | gr = getgrnam(argv[1]); |
164 | for (; *(gr->gr_mem) != NULL; (gr->gr_mem)++) { | 165 | for (; *(gr->gr_mem) != NULL; (gr->gr_mem)++) { |
diff --git a/loginutils/passwd.c b/loginutils/passwd.c index e3e74bae7..aa89b87a7 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c | |||
@@ -118,9 +118,7 @@ int passwd_main(int argc UNUSED_PARAM, char **argv) | |||
118 | myname = xstrdup(xuid2uname(myuid)); | 118 | myname = xstrdup(xuid2uname(myuid)); |
119 | name = argv[0] ? argv[0] : myname; | 119 | name = argv[0] ? argv[0] : myname; |
120 | 120 | ||
121 | pw = getpwnam(name); | 121 | pw = xgetpwnam(name); |
122 | if (!pw) | ||
123 | bb_error_msg_and_die("unknown user %s", name); | ||
124 | if (myuid && pw->pw_uid != myuid) { | 122 | if (myuid && pw->pw_uid != myuid) { |
125 | /* LOGMODE_BOTH */ | 123 | /* LOGMODE_BOTH */ |
126 | bb_error_msg_and_die("%s can't change password for %s", myname, name); | 124 | 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 61039d823..e7e0001c7 100644 --- a/loginutils/su.c +++ b/loginutils/su.c | |||
@@ -48,9 +48,7 @@ int su_main(int argc UNUSED_PARAM, char **argv) | |||
48 | openlog(applet_name, 0, LOG_AUTH); | 48 | openlog(applet_name, 0, LOG_AUTH); |
49 | } | 49 | } |
50 | 50 | ||
51 | pw = getpwnam(opt_username); | 51 | pw = xgetpwnam(opt_username); |
52 | if (!pw) | ||
53 | bb_error_msg_and_die("unknown id: %s", opt_username); | ||
54 | 52 | ||
55 | /* Make sure pw->pw_shell is non-NULL. It may be NULL when NEW_USER | 53 | /* Make sure pw->pw_shell is non-NULL. It may be NULL when NEW_USER |
56 | is a username that is retrieved via NIS (YP), but that doesn't have | 54 | is a username that is retrieved via NIS (YP), but that doesn't have |