]> granicus.if.org Git - sudo/commitdiff
added SHELL_SETS_HOME
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 27 Aug 1996 15:36:48 +0000 (15:36 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 27 Aug 1996 15:36:48 +0000 (15:36 +0000)
OPTIONS
options.h
sudo.c

diff --git a/OPTIONS b/OPTIONS
index 087f915e377dde240234292259b704bc2fbf3b9d..e8b0cd2274eaa1cc089ceacb4d05ac01632c3125 100644 (file)
--- a/OPTIONS
+++ b/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".
index 8f3931419cc074bdcc07b4b8d8462782b9ff5a34..6a14454fece5e42000f48887d9a1c903d94f178c 100644 (file)
--- a/options.h
+++ b/options.h
@@ -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 */
diff --git a/sudo.c b/sudo.c
index 3897c21f44021e0db4343a3e891601df594dc467..f26c68d2bce7d50655ba17b0fdb9e8c3bed42e5e 100644 (file)
--- a/sudo.c
+++ b/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;