summaryrefslogtreecommitdiffstats
path: root/usr.bin/su
diff options
context:
space:
mode:
authorcognet <cognet@FreeBSD.org>2003-10-19 02:09:36 +0000
committercognet <cognet@FreeBSD.org>2003-10-19 02:09:36 +0000
commiteb4121cb0d886e7080dda5e17e03728e4d9cc1d7 (patch)
tree3cc044603987f27c9dcfd3fb8e594f2873886673 /usr.bin/su
parentf2c5a17d7999fce4ce1a532cffc4d2c10ee0b97f (diff)
downloadFreeBSD-src-eb4121cb0d886e7080dda5e17e03728e4d9cc1d7.zip
FreeBSD-src-eb4121cb0d886e7080dda5e17e03728e4d9cc1d7.tar.gz
Fix broken su -m behaviour :
chshell must return 0 if the shell is not a standard shell, or else it is possible to use an account without a valid shell. Reviewed by: des
Diffstat (limited to 'usr.bin/su')
-rw-r--r--usr.bin/su/su.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c
index f6d3ff3..dae818f 100644
--- a/usr.bin/su/su.c
+++ b/usr.bin/su/su.c
@@ -520,10 +520,8 @@ chshell(char *sh)
r = 0;
setusershell();
- do {
- cp = getusershell();
- r = strcmp(cp, sh);
- } while (!r && cp != NULL);
+ while ((cp = getusershell()) != NULL && !r)
+ r = (strcmp(cp, sh) == 0);
endusershell();
return r;
}
OpenPOWER on IntegriCloud