summaryrefslogtreecommitdiff
path: root/src/radius_shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/radius_shell.c')
-rw-r--r--src/radius_shell.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/radius_shell.c b/src/radius_shell.c
index a94c7f3..5da76dc 100644
--- a/src/radius_shell.c
+++ b/src/radius_shell.c
@@ -92,6 +92,7 @@ execit:
/*
* Eventually handle this program being linked or symlinked
* and that the shell is one of the shells in /etc/shells
+ * Expect it to be installed as /sbin/radius/bash, etc.
*/
shell = strrchr(args[0], '/');
if (!shell)
@@ -103,15 +104,22 @@ execit:
else
check = shell;
+ /* need to validate shell from basename is valid here */
+
+
/* should really check this against /etc/shell */
snprintf(execshell, sizeof execshell, "/bin/%s", check);
#else
check = "bash";
- shell = "-bash";
+ if (*args[0] == '-')
+ shell = "-bash";
+ else
+ shell = "bash";
snprintf(execshell, sizeof execshell, "/bin/%s", check);
#endif
- execl(execshell, shell, NULL);
+ args[0] = shell;
+ execv(execshell, args);
fprintf(stderr, "Exec of shell %s failed: %s\n", execshell,
strerror(errno));
exit(1);