mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-30 22:05:46 +00:00
added SHELL_SETS_HOME
This commit is contained in:
6
OPTIONS
6
OPTIONS
@@ -173,6 +173,12 @@ SHELL_IF_NO_ARGS
|
||||
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".
|
||||
|
@@ -60,6 +60,7 @@
|
||||
/*#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 */
|
||||
|
7
sudo.c
7
sudo.c
@@ -150,7 +150,9 @@ char host[MAXHOSTNAMELEN + 1];
|
||||
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;
|
||||
@@ -324,9 +326,11 @@ int main(argc, argv)
|
||||
/* 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) {
|
||||
@@ -901,8 +905,9 @@ void set_perms(perm)
|
||||
perror("");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef SHELL_SETS_HOME
|
||||
runas_homedir = pw_ent->pw_dir;
|
||||
#endif /* SHELL_SETS_HOME */
|
||||
}
|
||||
|
||||
break;
|
||||
|
Reference in New Issue
Block a user