diff options
| author | Karel Zak <kzak@redhat.com> | 2006-12-07 00:26:16 +0100 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2006-12-07 00:26:16 +0100 |
| commit | c129767e063c5c9839cc9d94c34fd88dac3fb9a6 (patch) | |
| tree | 13dd85577b43ec1be3cf51a8d913282c2a92259c /login-utils | |
| parent | d03dd60840f0a08464d5266539ad356aefe24b03 (diff) | |
| download | util-linux-old-c129767e063c5c9839cc9d94c34fd88dac3fb9a6.tar.gz | |
Imported from util-linux-2.12b tarball.
Diffstat (limited to 'login-utils')
| -rw-r--r-- | login-utils/chsh.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/login-utils/chsh.c b/login-utils/chsh.c index 8d8f8862..03c0ec48 100644 --- a/login-utils/chsh.c +++ b/login-utils/chsh.c @@ -152,7 +152,13 @@ main (int argc, char *argv[]) { if (!oldshell[0]) oldshell = "/bin/sh"; /* reality check */ - if (uid != 0 && (uid != pw->pw_uid || !get_shell_list(oldshell))) { + if (uid != 0 && uid != pw->pw_uid) { + errno = EACCES; + fprintf(stderr,_("%s: Running UID doesn't match UID of user we're " + "altering, shell change denied\n"), whoami); + return (-1); + } + if (uid != 0 && !get_shell_list(oldshell)) { errno = EACCES; fprintf(stderr,_("%s: Your shell is not in /etc/shells, shell change" " denied\n"),whoami); |
