Skip to content

Commit 18502cb

Browse files
casantosLMattsson
authored andcommitted
vncsession: use /bin/sh if the user shell is not set
An empty shell field in the password file is valid, although not common. Use /bin/sh in this case, as documented in the passwd(5) man page, since the vncserver script requires a non-empty SHELL environment variable. Fixes issue #1786. Signed-off-by: Carlos Santos <[email protected]> (cherry picked from commit 4db34f7)
1 parent 128b30f commit 18502cb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

unix/vncserver/vncsession.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ run_script(const char *username, const char *display, char **envp)
545545

546546
// Set up some basic environment for the script
547547
setenv("HOME", pwent->pw_dir, 1);
548-
setenv("SHELL", pwent->pw_shell, 1);
548+
setenv("SHELL", *pwent->pw_shell != '\0' ? pwent->pw_shell : "/bin/sh", 1);
549549
setenv("LOGNAME", pwent->pw_name, 1);
550550
setenv("USER", pwent->pw_name, 1);
551551
setenv("USERNAME", pwent->pw_name, 1);

0 commit comments

Comments
 (0)