summaryrefslogtreecommitdiffstats
path: root/login-utils/chsh.c
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:26:16 +0100
committerKarel Zak2006-12-07 00:26:16 +0100
commitc129767e063c5c9839cc9d94c34fd88dac3fb9a6 (patch)
tree13dd85577b43ec1be3cf51a8d913282c2a92259c /login-utils/chsh.c
parentImported from util-linux-2.12a tarball. (diff)
downloadkernel-qcow2-util-linux-c129767e063c5c9839cc9d94c34fd88dac3fb9a6.tar.gz
kernel-qcow2-util-linux-c129767e063c5c9839cc9d94c34fd88dac3fb9a6.tar.xz
kernel-qcow2-util-linux-c129767e063c5c9839cc9d94c34fd88dac3fb9a6.zip
Imported from util-linux-2.12b tarball.
Diffstat (limited to 'login-utils/chsh.c')
-rw-r--r--login-utils/chsh.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/login-utils/chsh.c b/login-utils/chsh.c
index 8d8f8862e..03c0ec483 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);