]> source.dussan.org Git - tigervnc.git/commitdiff
vncsession: use /bin/sh if the user shell is not set 1787/head
authorCarlos Santos <casantos@redhat.com>
Thu, 25 Jul 2024 21:39:59 +0000 (18:39 -0300)
committerCarlos Santos <casantos@redhat.com>
Fri, 26 Jul 2024 14:18:31 +0000 (11:18 -0300)
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>
unix/vncserver/vncsession.c

index 1ee096c7c54b0e4467758abf478f491dda4e8899..98a0432aa375f50bd9061e420fa96d1290816ce6 100644 (file)
@@ -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);