]> granicus.if.org Git - sudo/commitdiff
add RUNAS_DEFAULT
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 8 Sep 1998 00:42:02 +0000 (00:42 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 8 Sep 1998 00:42:02 +0000 (00:42 +0000)
OPTIONS
options.h
parse.yacc
sudo.c
testsudoers.c
visudo.c

diff --git a/OPTIONS b/OPTIONS
index 80850994a8c52e0065c05db172745cbe872981ec..ae924434e0bf38550cac5403a13bb6ae923ee7c7 100644 (file)
--- a/OPTIONS
+++ b/OPTIONS
@@ -1,5 +1,9 @@
 The following options may be used to configure sudo 1.4
 
+RUNAS_DEFAULT
+    The default user to run commands as if the -u flag is not specified
+    on the command line.  This defaults to "root".
+
 FQDN
     Define this if you want to put fully qualified hostnames in the sudoers
     file.  Ie: instead of myhost you would use myhost.mydomain.edu.
index cd400d3df0ec814cc5e29667a9badc33d29bcac6..558ec940ca824b46be347d4b24005eb9b63c4157 100644 (file)
--- a/options.h
+++ b/options.h
@@ -31,6 +31,7 @@
 
 /* User-configurable Sudo runtime options */
 
+#define RUNAS_DEFAULT "root"   /* default user to run cmd as if no -u flag */
 /*#define FQDN                 /* expect fully qualified hosts in sudoers */
 #define LOGGING SLOG_SYSLOG    /* log via SLOG_SYSLOG, SLOG_FILE, SLOG_BOTH */
 #define LOGFAC LOG_LOCAL2      /* syslog facility for sudo to use */
index 8dc1bc4daaf0b5153ffb4bf66befa84201d18350..a467ffeeff7ca13381742cb824da5842c6a68b59 100644 (file)
@@ -308,7 +308,7 @@ opcmnd              :       cmnd { ; }
                ;
 
 runasspec      :       /* empty */ {
-                           $$ = (strcmp("root", runas_user) == 0);
+                           $$ = (strcmp(RUNAS_DEFAULT, runas_user) == 0);
                        }
                |       RUNAS runaslist {
                            $$ = $2;
diff --git a/sudo.c b/sudo.c
index dc2c03be035f2ff234f568b7babef42a44962e6a..9e6061e83634b46f05c9b097e25ae2deadcc0701 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -141,7 +141,7 @@ char **Argv;
 int NewArgc = 0;
 char **NewArgv = NULL;
 struct passwd *user_pw_ent;
-char *runas_user = "root";
+char *runas_user = RUNAS_DEFAULT;
 char *cmnd = NULL;
 char *cmnd_args = NULL;
 char *tty = "unknown";
index 1b017c02bd703e4067d008f54a1ccee6e3814986..8975a0488d572c73fad5eebb5083515d3e97415d 100644 (file)
@@ -78,7 +78,7 @@ extern int num_interfaces;
 
 char *cmnd = NULL;
 char *cmnd_args = NULL;
-char *runas_user = "root";
+char *runas_user = RUNAS_DEFAULT;
 char host[MAXHOSTNAMELEN];
 char *shost;
 char cwd[MAXPATHLEN];
index 168e73ef68151fefcdefc0c677eeab32870d45f6..45acd7506bff70adad72bd62e55397f0f0d3bf8f 100644 (file)
--- a/visudo.c
+++ b/visudo.c
@@ -105,7 +105,7 @@ int NewArgc = 0;
 char *sudoers = _PATH_SUDO_SUDOERS;
 char *stmp = _PATH_SUDO_STMP;
 int parse_error = FALSE;
-char *runas_user = "root";
+char *runas_user = RUNAS_DEFAULT;
 
 /*
  * For the parsing routines