[sesexec] pass_shell_as_env only if user sets a shell

set environment variable only if the user actually requests a specific
shell.
This commit is contained in:
akarl10
2026-01-01 15:08:11 +01:00
parent c7b83c47b3
commit c1ed8b8eb6
+8 -6
View File
@@ -255,9 +255,12 @@ start_window_manager(const struct login_info *login_info,
}
}
if (g_cfg->sec.allow_alternate_shell &&
g_cfg->sec.pass_shell_as_env != NULL &&
g_cfg->sec.pass_shell_as_env[0] != '0')
if (s->shell[0] != '\0')
{
if (g_cfg->sec.allow_alternate_shell)
{
if (g_cfg->sec.pass_shell_as_env != NULL &&
g_cfg->sec.pass_shell_as_env[0] != '\0')
{
// Pass the shell in to the standard startwm scripts
// in an environment variable
@@ -267,11 +270,9 @@ start_window_manager(const struct login_info *login_info,
s->shell);
g_setenv_log(g_cfg->sec.pass_shell_as_env, s->shell, 1);
}
else if (s->shell[0] != '\0')
else
{
// Try to execute the shell directly (if permitted)
if (g_cfg->sec.allow_alternate_shell)
{
if (g_strchr(s->shell, ' ') != 0 || g_strchr(s->shell, '\t') != 0)
{
LOG(LOG_LEVEL_INFO,
@@ -289,6 +290,7 @@ start_window_manager(const struct login_info *login_info,
g_execlp3(s->shell, s->shell, 0);
}
}
}
else
{
LOG(LOG_LEVEL_WARNING,