chsh(1) uses empty shell setting (pw->pw_shell="") as a synonym for
/bin/sh. This convention is silly and unnecessary. (The vsftpd server
will not run if the shell assigned to user "ftp" is a null string --
according to bug rh#103004).
Signed-off-by: Karel Zak <kzak@redhat.com>
#endif
oldshell = pw->pw_shell;
- if (!oldshell[0]) oldshell = _PATH_BSHELL;
+ if (oldshell == NULL || *oldshell == '\0')
+ oldshell = _PATH_BSHELL; /* default */
/* reality check */
if (uid != 0 && uid != pw->pw_uid) {
printf (_("Shell not changed.\n"));
return 0;
}
- if (!strcmp(shell, _PATH_BSHELL)) shell = "";
pw->pw_shell = shell;
if (setpwnam (pw) < 0) {
perror ("setpwnam");
check_shell (char *shell) {
int i, c;
+ if (!shell)
+ return (-1);
+
if (*shell != '/') {
printf (_("%s: shell must be a full path name.\n"), whoami);
return (-1);