]> granicus.if.org Git - sudo/commitdiff
Add rootpw, runaspw, and targetpw options.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 18 Feb 2000 17:56:28 +0000 (17:56 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 18 Feb 2000 17:56:28 +0000 (17:56 +0000)
CHANGES
defaults.c
defaults.h
getspwuid.c
sudo.c
sudo.h
sudoers.cat
sudoers.man
sudoers.pod
visudo.c

diff --git a/CHANGES b/CHANGES
index 6b5ea41d093b5bf96e0c183baf0314bae0bc67ea..86ce39fa3faaba5e9191c1336a2f742a00b4fc1e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1253,3 +1253,10 @@ Sudo 1.6.2 released.
 395) It is now possible to set the path to the editor for visudo as well
      as the flag that determines whether or not visudo will look at
      $EDITOR in the sudoers file.
+
+396) configure now pulls in the values of LIBS, LDFLAGS, CPPFLAGS, etc
+     as the documentation says it ought to.
+
+397) Added rootpw, runaspw, and targetpw to prompt for the root, runas_default
+     and target user's passwords respectively (instead of the invoking user's
+     password).
index 77d93a916862b470b273e5a89ea05e42e3fcee03..82421f15c57a19589688e222d85ab383a36cb5cc 100644 (file)
@@ -184,6 +184,15 @@ struct sudo_defs_types sudo_defs_table[] = {
     }, {
        "env_editor", T_FLAG,
        "Visudo will honor the EDITOR environment variable"
+    }, {
+       "rootpw", T_FLAG,
+       "Prompt for root's password, not the users's"
+    }, {
+       "runaspw", T_FLAG,
+       "Prompt for the runas_default user's password, not the users's"
+    }, {
+       "targetpw", T_FLAG,
+       "Prompt for the target user's password, not the users's"
     }, {
        "loglinelen", T_INT|T_BOOL,
        "Length at which to wrap log file lines (0 for no wrap): %d"
@@ -534,7 +543,7 @@ init_defaults()
     def_flag(I_INSULTS) = TRUE;
 #endif
 #ifdef ENV_EDITOR
-    def_flag(I_ENVEDITOR) = TRUE;
+    def_flag(I_ENV_EDITOR) = TRUE;
 #endif
 
     /* Syslog options need special care since they both strings and ints */
index 869e88d03c47e5336294f2cb3d8de406b506ae8d..7b23ac891cf2c7faa1d98fe7b54308b73bd80bdc 100644 (file)
@@ -111,36 +111,39 @@ struct sudo_defs_types {
 #define I_FQDN                 21
 #define I_INSULTS              22
 #define I_REQUIRETTY           23
-#define I_ENVEDITOR            24
+#define I_ENV_EDITOR           24
+#define I_ROOTPW               25
+#define I_RUNASPW              26
+#define I_TARGETPW             27
 
 /* Integer values */
-#define        I_LOGLEN        25      /* wrap log file line after N chars */
-#define        I_TS_TIMEOUT    26      /* timestamp stale after N minutes */
-#define        I_PW_TIMEOUT    27      /* exit if pass not entered in N minutes */
-#define        I_PW_TRIES      28      /* exit after N bad password tries */
-#define        I_UMASK         29      /* umask to use or 0777 to use user's */
+#define        I_LOGLEN        28      /* wrap log file line after N chars */
+#define        I_TS_TIMEOUT    29      /* timestamp stale after N minutes */
+#define        I_PW_TIMEOUT    30      /* exit if pass not entered in N minutes */
+#define        I_PW_TRIES      31      /* exit after N bad password tries */
+#define        I_UMASK         32      /* umask to use or 0777 to use user's */
 
 /* Strings */
-#define        I_LOGFILE       30      /* path to logfile (or NULL for none) */
-#define        I_MAILERPATH    31      /* path to sendmail or other mailer */
-#define        I_MAILERFLAGS   32      /* flags to pass to the mailer */
-#define        I_MAILTO        33      /* who to send bitch mail to */
-#define        I_MAILSUB       34      /* subject line of mail msg */
-#define        I_BADPASS_MSG   35      /* what to say when passwd is wrong */
-#define        I_TIMESTAMPDIR  36      /* path to timestamp dir */
-#define        I_EXEMPT_GRP    37      /* no password or PATH override for these */
-#define        I_PASSPROMPT    38      /* password prompt */
-#define        I_RUNAS_DEF     39      /* default user to run commands as */
-#define        I_SECURE_PATH   40      /* set $PATH to this if not NULL */
-#define        I_EDITOR        41      /* path to editor used by visudo */
+#define        I_LOGFILE       33      /* path to logfile (or NULL for none) */
+#define        I_MAILERPATH    34      /* path to sendmail or other mailer */
+#define        I_MAILERFLAGS   35      /* flags to pass to the mailer */
+#define        I_MAILTO        36      /* who to send bitch mail to */
+#define        I_MAILSUB       37      /* subject line of mail msg */
+#define        I_BADPASS_MSG   38      /* what to say when passwd is wrong */
+#define        I_TIMESTAMPDIR  39      /* path to timestamp dir */
+#define        I_EXEMPT_GRP    40      /* no password or PATH override for these */
+#define        I_PASSPROMPT    41      /* password prompt */
+#define        I_RUNAS_DEF     42      /* default user to run commands as */
+#define        I_SECURE_PATH   43      /* set $PATH to this if not NULL */
+#define        I_EDITOR        44      /* path to editor used by visudo */
 
 /* Integer versions of list/verify options */
-#define I_LISTPW       42
-#define I_VERIFYPW     43
+#define I_LISTPW       45
+#define I_VERIFYPW     46
 
 /* String versions of list/verify options */
-#define I_LISTPWSTR    44
-#define I_VERIFYPWSTR  45
+#define I_LISTPWSTR    47
+#define I_VERIFYPWSTR  48
 
 /*
  * Macros for accessing sudo_defs_table.
index 80d10d8e2456421c8a73e9a693ad7e7fea762118..c331f0baa3bd4bb3d1d31bba647b1b1c0e6f928d 100644 (file)
@@ -94,7 +94,6 @@ int crypt_type = INT_MAX;
  * Local functions not visible outside getspwuid.c
  */
 static char *sudo_getshell     __P((struct passwd *));
-static char *sudo_getepw       __P((struct passwd *));
 
 
 /*
@@ -123,7 +122,7 @@ sudo_getshell(pw)
  * Return the encrypted password for the user described by pw.  If shadow
  * passwords are in use, look in the shadow file.
  */
-static char *
+char *
 sudo_getepw(pw)
     struct passwd *pw;
 {
diff --git a/sudo.c b/sudo.c
index 697c6d95d4c1d05f2f207f5af1f9882e3c859867..e9f130038019e9316f0510c103547bd4c04bb2a4 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -108,6 +108,7 @@ static int init_vars                        __P((int));
 static void add_env                    __P((int));
 static void clean_env                  __P((char **, struct env_table *));
 static void initial_setup              __P((void));
+static void update_epasswd             __P((void));
 extern struct passwd *sudo_getpwuid    __P((uid_t));
 extern void list_matches               __P((void));
 
@@ -304,6 +305,9 @@ main(argc, argv)
            (void) close(fd);
     }
 
+    /* Update encrypted password in user_password if sudoers said to.  */
+    update_epasswd();
+
     /* Require a password unless the NOPASS tag was set.  */
     if (!(validated & FLAG_NOPASS))
        check_user();
@@ -1062,6 +1066,42 @@ set_fqdn()
     }
 }
 
+/*
+ * If the sudoers file says to prompt for a different user's password,
+ * update the encrypted password in user_passwd accordingly.
+ */
+static void
+update_epasswd()
+{
+    struct passwd *pw;
+
+    /* We may be configured to prompt for a password other than the user's */
+    if (def_ival(I_ROOTPW)) {
+       if ((pw = getpwuid(0)) == NULL)
+           log_error(0, "uid 0 does not exist in the passwd file!");
+       free(user_passwd);
+       user_passwd = estrdup(sudo_getepw(pw));
+    } else if (def_ival(I_RUNASPW)) {
+       if ((pw = getpwnam(def_str(I_RUNAS_DEF))) == NULL)
+           log_error(0, "user %s does not exist in the passwd file!",
+               def_str(I_RUNAS_DEF));
+       free(user_passwd);
+       user_passwd = estrdup(sudo_getepw(pw));
+    } else if (def_ival(I_TARGETPW)) {
+       if (**user_runas == '#') {
+           if ((pw = getpwuid(atoi(*user_runas + 1))) == NULL)
+               log_error(0, "uid %s does not exist in the passwd file!",
+                   user_runas);
+       } else {
+           if ((pw = getpwnam(*user_runas)) == NULL)
+               log_error(0, "user %s does not exist in the passwd file!",
+                   user_runas);
+       }
+       free(user_passwd);
+       user_passwd = estrdup(sudo_getepw(pw));
+    }
+}
+
 /*
  * Tell which options are mutually exclusive and exit.
  */
diff --git a/sudo.h b/sudo.h
index 0ffe6260a65ea4cee7afc37742ee3e9cc6aea44e..5f6972862b5cb04ae4d5c1f5609514422b816c98 100644 (file)
--- a/sudo.h
+++ b/sudo.h
@@ -208,6 +208,7 @@ int lock_file               __P((int, int));
 int touch              __P((char *, time_t));
 int user_is_exempt     __P((void));
 void set_fqdn          __P((void));
+char *sudo_getepw      __P((struct passwd *));
 YY_DECL;
 
 /* Only provide extern declarations outside of sudo.c. */
index 271b063db84dd288289f78a94d8aa4854ab33b8c..9e7533a873e87f773d55d7f0560224236bba069a 100644 (file)
@@ -381,13 +381,13 @@ sudoers(5)                 FILE FORMATS                sudoers(5)
                    to get a shell (which would be a root shell
                    and not be logged).
 
-       I\bI\bI\bIn\bn\bn\bnt\bt\bt\bte\be\be\beg\bg\bg\bge\be\be\ber\br\br\brs\bs\bs\bs:
-
-       passwd_tries
-                   The number of tries a user gets to enter
-                   his/her password before sudo logs the failure
-                   and exits.  The default is 3.
+       rootpw      If set, sudo will prompt for the root password
+                   instead of the password of the invoking user.
 
+       runaspw     If set, sudo will prompt for the password of
+                   the user defined by the _\br_\bu_\bn_\ba_\bs_\b__\bd_\be_\bf_\ba_\bu_\bl_\bt option
+                   (defaults to root) instead of the password of
+                   the invoking user.
 
 
 
@@ -400,6 +400,18 @@ sudoers(5)                 FILE FORMATS                sudoers(5)
 sudoers(5)                 FILE FORMATS                sudoers(5)
 
 
+       targetpw    If set, sudo will prompt for the password of
+                   the user specified by the -u flag (defaults to
+                   root) instead of the password of the invoking
+                   user.
+
+       I\bI\bI\bIn\bn\bn\bnt\bt\bt\bte\be\be\beg\bg\bg\bge\be\be\ber\br\br\brs\bs\bs\bs:
+
+       passwd_tries
+                   The number of tries a user gets to enter
+                   his/her password before sudo logs the failure
+                   and exits.  The default is 3.
+
        I\bI\bI\bIn\bn\bn\bnt\bt\bt\bte\be\be\beg\bg\bg\bge\be\be\ber\br\br\brs\bs\bs\bs t\bt\bt\bth\bh\bh\bha\ba\ba\bat\bt\bt\bt c\bc\bc\bca\ba\ba\ban\bn\bn\bn b\bb\bb\bbe\be\be\be u\bu\bu\bus\bs\bs\bse\be\be\bed\bd\bd\bd i\bi\bi\bin\bn\bn\bn a\ba\ba\ba b\bb\bb\bbo\bo\bo\boo\bo\bo\bol\bl\bl\ble\be\be\bea\ba\ba\ban\bn\bn\bn c\bc\bc\bco\bo\bo\bon\bn\bn\bnt\bt\bt\bte\be\be\bex\bx\bx\bxt\bt\bt\bt:
 
        loglinelen  Number of characters per line for the file
@@ -441,18 +453,6 @@ sudoers(5)                 FILE FORMATS                sudoers(5)
                    timestamp files.  The default is either
                    /var/run/sudo or /tmp/sudo.
 
-       passprompt  The default prompt to use when asking for a
-                   password; can be overridden via the -p option
-                   or the SUDO_PROMPT environment variable.
-                   Supports two escapes: "%u" expands to the
-                   user's login name and "%h" expands to the
-                   local hostname.  The default value is
-                   "Password:".
-
-       runas_default
-                   The default user to run commands as if the -u
-                   flag is not specified on the command line.
-                   This defaults to "root".
 
 
 
@@ -466,6 +466,19 @@ sudoers(5)                 FILE FORMATS                sudoers(5)
 sudoers(5)                 FILE FORMATS                sudoers(5)
 
 
+       passprompt  The default prompt to use when asking for a
+                   password; can be overridden via the -p option
+                   or the SUDO_PROMPT environment variable.
+                   Supports two escapes: "%u" expands to the
+                   user's login name and "%h" expands to the
+                   local hostname.  The default value is
+                   "Password:".
+
+       runas_default
+                   The default user to run commands as if the -u
+                   flag is not specified on the command line.
+                   This defaults to "root".
+
        syslog_goodpri
                    Syslog priority to use when user authenticates
                    successfully.  Defaults to "notice".
@@ -507,6 +520,18 @@ sudoers(5)                 FILE FORMATS                sudoers(5)
 
        verifypw    This option controls when a password will be
                    required when a user runs sudo with the -\b-\b-\b-v\bv\bv\bv.
+
+
+
+18/Feb/2000                   1.6.3                             8
+
+
+
+
+
+sudoers(5)                 FILE FORMATS                sudoers(5)
+
+
                    It has the following possible values:
 
                        all         All the user's I<sudoers> entries for the
@@ -521,17 +546,6 @@ sudoers(5)                 FILE FORMATS                sudoers(5)
                        never       The user need never enter a password to use
                                    the B<-v> flag.
 
-
-
-18/Feb/2000                   1.6.3                             8
-
-
-
-
-
-sudoers(5)                 FILE FORMATS                sudoers(5)
-
-
                        always      The user must always enter a password to use
                                    the B<-v> flag.
 
@@ -572,31 +586,31 @@ sudoers(5)                 FILE FORMATS                sudoers(5)
         User_Spec ::= User_list Host_List '=' User_List Cmnd_Spec_List \
                       (':' User_Spec)*
 
-        Cmnd_Spec_List ::= Cmnd_Spec |
-                           Cmnd_Spec ',' Cmnd_Spec_List
 
-        Cmnd_Spec ::= Runas_Spec? ('NOPASSWD:' | 'PASSWD:')? Cmnd
 
-        Runas_Spec ::= '(' Runas_List ')'
 
-       A u\bu\bu\bus\bs\bs\bse\be\be\ber\br\br\br s\bs\bs\bsp\bp\bp\bpe\be\be\bec\bc\bc\bci\bi\bi\bif\bf\bf\bfi\bi\bi\bic\bc\bc\bca\ba\ba\bat\bt\bt\bti\bi\bi\bio\bo\bo\bon\bn\bn\bn determines which commands a user may
-       run (and as what user) on specified hosts.  By default,
-       commands are run as r\br\br\bro\bo\bo\boo\bo\bo\bot\bt\bt\bt but this can be changed on a per-
-       command basis.
+18/Feb/2000                   1.6.3                             9
 
-       Let's break that down into its constituent parts:
 
 
 
 
-18/Feb/2000                   1.6.3                             9
+sudoers(5)                 FILE FORMATS                sudoers(5)
 
 
+        Cmnd_Spec_List ::= Cmnd_Spec |
+                           Cmnd_Spec ',' Cmnd_Spec_List
 
+        Cmnd_Spec ::= Runas_Spec? ('NOPASSWD:' | 'PASSWD:')? Cmnd
 
+        Runas_Spec ::= '(' Runas_List ')'
 
-sudoers(5)                 FILE FORMATS                sudoers(5)
+       A u\bu\bu\bus\bs\bs\bse\be\be\ber\br\br\br s\bs\bs\bsp\bp\bp\bpe\be\be\bec\bc\bc\bci\bi\bi\bif\bf\bf\bfi\bi\bi\bic\bc\bc\bca\ba\ba\bat\bt\bt\bti\bi\bi\bio\bo\bo\bon\bn\bn\bn determines which commands a user may
+       run (and as what user) on specified hosts.  By default,
+       commands are run as r\br\br\bro\bo\bo\boo\bo\bo\bot\bt\bt\bt but this can be changed on a per-
+       command basis.
 
+       Let's break that down into its constituent parts:
 
        R\bR\bR\bRu\bu\bu\bun\bn\bn\bna\ba\ba\bas\bs\bs\bs_\b_\b_\b_S\bS\bS\bSp\bp\bp\bpe\be\be\bec\bc\bc\bc
 
@@ -639,6 +653,17 @@ sudoers(5)                 FILE FORMATS                sudoers(5)
        able to run _\b/_\bb_\bi_\bn_\b/_\bk_\bi_\bl_\bl without a password the entry would
        be:
 
+
+
+18/Feb/2000                   1.6.3                            10
+
+
+
+
+
+sudoers(5)                 FILE FORMATS                sudoers(5)
+
+
         ray    rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm
 
        Note however, that the PASSWD tag has no effect on users
@@ -652,18 +677,6 @@ sudoers(5)                 FILE FORMATS                sudoers(5)
        pertain to the current host.  This behavior may be
        overridden via the verifypw and listpw options.
 
-
-
-
-18/Feb/2000                   1.6.3                            10
-
-
-
-
-
-sudoers(5)                 FILE FORMATS                sudoers(5)
-
-
        W\bW\bW\bWi\bi\bi\bil\bl\bl\bld\bd\bd\bdc\bc\bc\bca\ba\ba\bar\br\br\brd\bd\bd\bds\bs\bs\bs (\b(\b(\b(a\ba\ba\bak\bk\bk\bka\ba\ba\ba m\bm\bm\bme\be\be\bet\bt\bt\bta\ba\ba\ba c\bc\bc\bch\bh\bh\bha\ba\ba\bar\br\br\bra\ba\ba\bac\bc\bc\bct\bt\bt\bte\be\be\ber\br\br\brs\bs\bs\bs)\b)\b)\b):\b:\b:\b:
 
        s\bs\bs\bsu\bu\bu\bud\bd\bd\bdo\bo\bo\bo allows shell-style _\bw_\bi_\bl_\bd_\bc_\ba_\br_\bd_\bs to be used in pathnames
@@ -705,6 +718,18 @@ sudoers(5)                 FILE FORMATS                sudoers(5)
 
        The pound sign ('#') is used to indicate a comment (unless
        it occurs in the context of a user name and is followed by
+
+
+
+18/Feb/2000                   1.6.3                            11
+
+
+
+
+
+sudoers(5)                 FILE FORMATS                sudoers(5)
+
+
        one or more digits, in which case it is treated as a uid).
        Both the comment character and any text after it, up to
        the end of the line, are ignored.
@@ -718,18 +743,6 @@ sudoers(5)                 FILE FORMATS                sudoers(5)
        dangerous since in a command context, it allows the user
        to run a\ba\ba\ban\bn\bn\bny\by\by\by command on the system.
 
-
-
-
-18/Feb/2000                   1.6.3                            11
-
-
-
-
-
-sudoers(5)                 FILE FORMATS                sudoers(5)
-
-
        An exclamation point ('!') can be used as a logical _\bn_\bo_\bt
        operator both in an _\ba_\bl_\bi_\ba_\bs and in front of a Cmnd.  This
        allows one to exclude certain values.  Note, however, that
@@ -771,6 +784,18 @@ E\bE\bE\bEX\bX\bX\bXA\bA\bA\bAM\bM\bM\bMP\bP\bP\bPL\bL\bL\bLE\bE\bE\bES\bS\bS\bS
         Host_Alias     SERVERS = master, mail, www, ns
         Host_Alias     CDROM = orion, perseus, hercules
 
+
+
+
+18/Feb/2000                   1.6.3                            12
+
+
+
+
+
+sudoers(5)                 FILE FORMATS                sudoers(5)
+
+
         # Cmnd alias specification
         Cmnd_Alias     DUMPS = /usr/bin/mt, /usr/sbin/dump, /usr/sbin/rdump,\
                                /usr/sbin/restore, /usr/sbin/rrestore
@@ -784,18 +809,6 @@ E\bE\bE\bEX\bX\bX\bXA\bA\bA\bAM\bM\bM\bMP\bP\bP\bPL\bL\bL\bLE\bE\bE\bES\bS\bS\bS
                                 /usr/local/bin/zsh
         Cmnd_Alias     SU = /usr/bin/su
 
-
-
-
-18/Feb/2000                   1.6.3                            12
-
-
-
-
-
-sudoers(5)                 FILE FORMATS                sudoers(5)
-
-
        Here we override some of the compiled in default values.
        We want sudo to log via _\bs_\by_\bs_\bl_\bo_\bg(3) using the _\ba_\bu_\bt_\bh facility
        in all cases.  We don't want to subject the full time
@@ -837,31 +850,31 @@ sudoers(5)                 FILE FORMATS                sudoers(5)
        _\bC_\bS_\bN_\bE_\bT_\bS alias (the networks 128.138.243.0, 128.138.204.0,
        and 128.138.242.0).  Of those networks, only
        <128.138.204.0> has an explicit netmask (in CIDR notation)
-       indicating it is a class C network.  For the other
-       networks in _\bC_\bS_\bN_\bE_\bT_\bS, the local machine's netmask will be
-       used during matching.
 
-        lisa           CUNETS = ALL
 
-       The user l\bl\bl\bli\bi\bi\bis\bs\bs\bsa\ba\ba\ba may run any command on any host in the
-       _\bC_\bU_\bN_\bE_\bT_\bS alias (the class B network 128.138.0.0).
 
-        operator       ALL = DUMPS, KILL, PRINTING, SHUTDOWN, HALT, REBOOT,\
-                       /usr/oper/bin/
+18/Feb/2000                   1.6.3                            13
 
-       The o\bo\bo\bop\bp\bp\bpe\be\be\ber\br\br\bra\ba\ba\bat\bt\bt\bto\bo\bo\bor\br\br\br user may run commands limited to simple
 
 
 
-18/Feb/2000                   1.6.3                            13
 
+sudoers(5)                 FILE FORMATS                sudoers(5)
 
 
+       indicating it is a class C network.  For the other
+       networks in _\bC_\bS_\bN_\bE_\bT_\bS, the local machine's netmask will be
+       used during matching.
 
+        lisa           CUNETS = ALL
 
-sudoers(5)                 FILE FORMATS                sudoers(5)
+       The user l\bl\bl\bli\bi\bi\bis\bs\bs\bsa\ba\ba\ba may run any command on any host in the
+       _\bC_\bU_\bN_\bE_\bT_\bS alias (the class B network 128.138.0.0).
 
+        operator       ALL = DUMPS, KILL, PRINTING, SHUTDOWN, HALT, REBOOT,\
+                       /usr/oper/bin/
 
+       The o\bo\bo\bop\bp\bp\bpe\be\be\ber\br\br\bra\ba\ba\bat\bt\bt\bto\bo\bo\bor\br\br\br user may run commands limited to simple
        maintenance.  Here, those are commands related to backups,
        killing processes, the printing system, shutting down the
        system, and any commands in the directory _\b/_\bu_\bs_\br_\b/_\bo_\bp_\be_\br_\b/_\bb_\bi_\bn_\b/.
@@ -903,30 +916,31 @@ sudoers(5)                 FILE FORMATS                sudoers(5)
         john           ALPHA = /usr/bin/su [!-]*, !/usr/bin/su *root*
 
        On the _\bA_\bL_\bP_\bH_\bA machines, user j\bj\bj\bjo\bo\bo\boh\bh\bh\bhn\bn\bn\bn may su to anyone except
-       root but he is not allowed to give _\bs_\bu(1) any flags.
 
-        jen            ALL, !SERVERS = ALL
 
-       The user j\bj\bj\bje\be\be\ben\bn\bn\bn may run any command on any machine except for
-       those in the _\bS_\bE_\bR_\bV_\bE_\bR_\bS Host_Alias (master, mail, www and
-       ns).
 
-        jill           SERVERS = /usr/bin/, !SU, !SHELLS
+18/Feb/2000                   1.6.3                            14
 
-       For any machine in the _\bS_\bE_\bR_\bV_\bE_\bR_\bS Host_Alias, j\bj\bj\bji\bi\bi\bil\bl\bl\bll\bl\bl\bl may run
-       any commands in the directory /usr/bin/ except for those
-       commands belonging to the _\bS_\bU and _\bS_\bH_\bE_\bL_\bL_\bS Cmnd_Aliases.
 
 
 
-18/Feb/2000                   1.6.3                            14
 
+sudoers(5)                 FILE FORMATS                sudoers(5)
 
 
+       root but he is not allowed to give _\bs_\bu(1) any flags.
 
+        jen            ALL, !SERVERS = ALL
 
-sudoers(5)                 FILE FORMATS                sudoers(5)
+       The user j\bj\bj\bje\be\be\ben\bn\bn\bn may run any command on any machine except for
+       those in the _\bS_\bE_\bR_\bV_\bE_\bR_\bS Host_Alias (master, mail, www and
+       ns).
+
+        jill           SERVERS = /usr/bin/, !SU, !SHELLS
 
+       For any machine in the _\bS_\bE_\bR_\bV_\bE_\bR_\bS Host_Alias, j\bj\bj\bji\bi\bi\bil\bl\bl\bll\bl\bl\bl may run
+       any commands in the directory /usr/bin/ except for those
+       commands belonging to the _\bS_\bU and _\bS_\bH_\bE_\bL_\bL_\bS Cmnd_Aliases.
 
         steve          CSNETS = (operator) /usr/local/op_commands/
 
@@ -968,6 +982,18 @@ S\bS\bS\bSE\bE\bE\bEC\bC\bC\bCU\bU\bU\bUR\bR\bR\bRI\bI\bI\bIT\bT\bT\bTY\bY\bY\bY N\bN\bN\bNO\bO\bO\bOT\bT\bT\bTE\b
        restrictions should be considered advisory at best (and
        reinforced by policy).
 
+
+
+
+18/Feb/2000                   1.6.3                            15
+
+
+
+
+
+sudoers(5)                 FILE FORMATS                sudoers(5)
+
+
 C\bC\bC\bCA\bA\bA\bAV\bV\bV\bVE\bE\bE\bEA\bA\bA\bAT\bT\bT\bTS\bS\bS\bS
        The _\bs_\bu_\bd_\bo_\be_\br_\bs file should a\ba\ba\bal\bl\bl\blw\bw\bw\bwa\ba\ba\bay\by\by\bys\bs\bs\bs be edited by the v\bv\bv\bvi\bi\bi\bis\bs\bs\bsu\bu\bu\bud\bd\bd\bdo\bo\bo\bo
        command which locks the file and does grammatical
@@ -981,19 +1007,6 @@ C\bC\bC\bCA\bA\bA\bAV\bV\bV\bVE\bE\bE\bEA\bA\bA\bAT\bT\bT\bTS\bS\bS\bS
        hostname be fully-qualified as returned by the hostname
        command or use the _\bf_\bq_\bd_\bn option in _\bs_\bu_\bd_\bo_\be_\br_\bs.
 
-
-
-
-
-18/Feb/2000                   1.6.3                            15
-
-
-
-
-
-sudoers(5)                 FILE FORMATS                sudoers(5)
-
-
 F\bF\bF\bFI\bI\bI\bIL\bL\bL\bLE\bE\bE\bES\bS\bS\bS
         /etc/sudoers           List of who can run what
         /etc/group             Local groups file
@@ -1024,19 +1037,6 @@ S\bS\bS\bSE\bE\bE\bEE\bE\bE\bE A\bA\bA\bAL\bL\bL\bLS\bS\bS\bSO\bO\bO\bO
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
 
 
 
index 083b359176f83f74e0eb41ba16dac3e1c20c3404..705ca8ebb27929f68a2cdf2bc7a09e77b1737673 100644 (file)
@@ -2,8 +2,8 @@
 ''' $RCSfile$$Revision$$Date$
 '''
 ''' $Log$
-''' Revision 1.26  2000/02/18 17:11:43  millert
-''' enveditor -> env_editor
+''' Revision 1.27  2000/02/18 17:56:27  millert
+''' Add rootpw, runaspw, and targetpw options.
 '''
 '''
 .de Sh
@@ -469,6 +469,17 @@ If set, visudo will use the value of the \s-1EDITOR\s0 or \s-1VISUAL\s0 environm
 falling back on the default editor.  Note that this may create a
 security hole as most editors allow a user to get a shell (which
 would be a root shell and not be logged).
+.Ip "rootpw" 12
+If set, sudo will prompt for the root password instead of the password
+of the invoking user.
+.Ip "runaspw" 12
+If set, sudo will prompt for the password of the user defined by the
+\fIrunas_default\fR option (defaults to root) instead of the password
+of the invoking user.
+.Ip "targetpw" 12
+If set, sudo will prompt for the password of the user specified by
+the \f(CW-u\fR flag (defaults to root) instead of the password of the
+invoking user.
 .PP
 \fBIntegers\fR:
 .Ip "passwd_tries" 12
@@ -1009,6 +1020,12 @@ as returned by the \f(CWhostname\fR command or use the \fIfqdn\fR option in
 
 .IX Item "env_editor"
 
+.IX Item "rootpw"
+
+.IX Item "runaspw"
+
+.IX Item "targetpw"
+
 .IX Item "passwd_tries"
 
 .IX Item "loglinelen"
index aeca4b2bde80f23b1575a28abed79cb884b37b7f..ef2cd72f0d7880193161e678901da464dfea6245 100644 (file)
@@ -353,6 +353,23 @@ falling back on the default editor.  Note that this may create a
 security hole as most editors allow a user to get a shell (which
 would be a root shell and not be logged).
 
+=item rootpw
+
+If set, sudo will prompt for the root password instead of the password
+of the invoking user.
+
+=item runaspw
+
+If set, sudo will prompt for the password of the user defined by the
+I<runas_default> option (defaults to root) instead of the password
+of the invoking user.
+
+=item targetpw
+
+If set, sudo will prompt for the password of the user specified by
+the C<-u> flag (defaults to root) instead of the password of the
+invoking user.
+
 =back
 
 B<Integers>:
index fc14425f14a357ceb0700febc8f4fce176ad3343..f7cbd984fbc0329c646e9458ec66022a8eb53808 100644 (file)
--- a/visudo.c
+++ b/visudo.c
@@ -227,7 +227,7 @@ main(argc, argv)
      * If we are allowing EDITOR and VISUAL envariables set Editor
      * base on whichever exists...
      */
-    if (!def_flag(I_ENVEDITOR) ||
+    if (!def_flag(I_ENV_EDITOR) ||
        (!(Editor = getenv("EDITOR")) && !(Editor = getenv("VISUAL"))))
        Editor = def_str(I_EDITOR);