in the invoking user's /etc/passwd entry).
This is off by default.
+SHELL_SETS_HOME
+ If sudo is invoked with the "-s" flag the HOME environmental variable
+ will be set to the home directory of the target user (which is root
+ unless the "-u" option is used).
+ This is off by default.
+
USE_TTY_TICKETS
This makes sudo use a different ticket file for each tty (per user).
Ie: instead of the ticket file being "username" it is "username.tty".
/*#define SECURE_PATH "/bin:/usr/ucb:/usr/bin:/usr/etc:/etc" /* secure path */
/*#define USE_EXECV /* use execv() instead of execvp() */
/*#define SHELL_IF_NO_ARGS /* if sudo is given no arguments run a shell */
+/*#define SHELL_SETS_HOME /* -s sets $HOME to runas user's homedir */
/*#define USE_TTY_TICKETS /* have a different ticket file for each tty */
/*#define SKEY_ONLY /* validate user via s/key only */
/*#define LONG_SKEY_PROMPT /* use a two line s/key prompt */
char *shost;
char cwd[MAXPATHLEN + 1];
struct stat cmnd_st;
+#ifdef SHELL_SETS_HOME
static char *runas_homedir = NULL;
+#endif /* SHELL_SETS_HOME */
extern struct interface *interfaces;
extern int num_interfaces;
extern int printmatches;
/* become specified user or root */
set_perms(PERM_RUNAS);
+#ifdef SHELL_SETS_HOME
/* set $HOME for `sudo -s' */
if ((sudo_mode & MODE_SHELL) && runas_homedir)
(void) sudo_setenv("HOME", runas_homedir);
+#endif /* SHELL_SETS_HOME */
#ifndef PROFILING
if ((sudo_mode & MODE_BACKGROUND) && fork() > 0) {
perror("");
exit(1);
}
-
+#ifdef SHELL_SETS_HOME
runas_homedir = pw_ent->pw_dir;
+#endif /* SHELL_SETS_HOME */
}
break;