cd to home directory before running shell
authorJamie Cameron <jcameron@webmin.com>
Fri, 29 Apr 2011 20:22:41 +0000 (13:22 -0700)
committerJamie Cameron <jcameron@webmin.com>
Fri, 29 Apr 2011 20:22:41 +0000 (13:22 -0700)
ajaxterm/index.cgi

index 478355c..bc3ffd8 100755 (executable)
@@ -38,6 +38,9 @@ if (!$pid) {
        untie(*STDERR); open(STDERR, ">$logfile");
        $shell = &has_command("bash") ||
                 &has_command("sh") || "/bin/sh";
+       @uinfo = getpwnam("root");
+       $home = $uinfo[7] || "/";
+       $shell = "$shell -c ".quotemeta("cd '$home' ; exec $shell");
        exec($python, "ajaxterm.py", "--port", $port, "--log",
             $config{'autologin'} ? ("--command", $shell) : ( ));
        exit(1);