From e68f156aca327538d65b45efe40ba864d78860a7 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 8 Sep 1998 00:42:02 +0000 Subject: [PATCH] add RUNAS_DEFAULT --- OPTIONS | 4 ++++ options.h | 1 + parse.yacc | 2 +- sudo.c | 2 +- testsudoers.c | 2 +- visudo.c | 2 +- 6 files changed, 9 insertions(+), 4 deletions(-) diff --git a/OPTIONS b/OPTIONS index 80850994a..ae924434e 100644 --- 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. diff --git a/options.h b/options.h index cd400d3df..558ec940c 100644 --- 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 */ diff --git a/parse.yacc b/parse.yacc index 8dc1bc4da..a467ffeef 100644 --- a/parse.yacc +++ b/parse.yacc @@ -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 dc2c03be0..9e6061e83 100644 --- 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"; diff --git a/testsudoers.c b/testsudoers.c index 1b017c02b..8975a0488 100644 --- a/testsudoers.c +++ b/testsudoers.c @@ -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]; diff --git a/visudo.c b/visudo.c index 168e73ef6..45acd7506 100644 --- 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 -- 2.50.1