aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Santos <casantos@redhat.com>2024-07-25 18:39:59 -0300
committerCarlos Santos <casantos@redhat.com>2024-07-26 11:18:31 -0300
commit4db34f73d461b973867ddaf18bf690219229cd7a (patch)
tree094fbf35e50c42027e929e9b303cc9af93550780
parentf8266918695abde714bcada3115d35f0e1b5a06c (diff)
downloadtigervnc-4db34f73d461b973867ddaf18bf690219229cd7a.tar.gz
tigervnc-4db34f73d461b973867ddaf18bf690219229cd7a.zip
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 <casantos@redhat.com>
-rw-r--r--unix/vncserver/vncsession.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/unix/vncserver/vncsession.c b/unix/vncserver/vncsession.c
index 1ee096c7..98a0432a 100644
--- a/unix/vncserver/vncsession.c
+++ b/unix/vncserver/vncsession.c
@@ -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);