When running a login shell via sesh, make new argv[0] -shell, not

/path/to-shell.  RedHat bz #1065418
This commit is contained in:
Todd C. Miller
2014-07-12 06:51:00 -06:00
parent 691421011d
commit 3f216cc2be

View File

@@ -74,12 +74,12 @@ main(int argc, char *argv[], char *envp[])
/* If invoked as a login shell, modify argv[0] accordingly. */ /* If invoked as a login shell, modify argv[0] accordingly. */
if (login_shell) { if (login_shell) {
if ((cp = strrchr(argv[0], '/')) == NULL) if ((cp = strrchr(argv[0], '/')) != NULL)
cp = argv[0]; argv[0] = cp;
*cp = '-'; argv[0][0] = '-';
} }
sudo_execve(cmnd, argv, envp, noexec); sudo_execve(cmnd, argv, envp, noexec);
sudo_warn(U_("unable to execute %s"), argv[0]); sudo_warn(U_("unable to execute %s"), cmnd);
sudo_debug_exit_int(__func__, __FILE__, __LINE__, sudo_debug_subsys, EXIT_FAILURE); sudo_debug_exit_int(__func__, __FILE__, __LINE__, sudo_debug_subsys, EXIT_FAILURE);
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
} }