Skip to content

Commit

Permalink
vncsession: use /bin/sh if the user shell is not set
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
casantos authored and LMattsson committed Oct 18, 2024
1 parent 128b30f commit 18502cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion unix/vncserver/vncsession.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ run_script(const char *username, const char *display, char **envp)

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

0 comments on commit 18502cb

Please sign in to comment.