]> granicus.if.org Git - sudo/commitdiff
added code for -l flag
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 20 Sep 1994 21:36:32 +0000 (21:36 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 20 Sep 1994 21:36:32 +0000 (21:36 +0000)
sudo.c

diff --git a/sudo.c b/sudo.c
index 2f56589154c1eddebaab15851f40d85ab7896d7b..d2cfeb0d159468085ef36a1558f6cc40908be06a 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -133,7 +133,7 @@ char host[MAXHOSTNAMELEN + 1];
 struct interface *interfaces;
 int num_interfaces;
 char cwd[MAXPATHLEN + 1];
-uid_t uid = -2;
+uid_t uid = (uid_t)-2;
 
 
 /********************************************************************
@@ -175,6 +175,9 @@ main(argc, argv)
        case MODE_VALIDATE :
            cmnd = "validate";
            break;
+       case MODE_LIST :
+           cmnd = "list";
+           break;
     }
 
     /*
@@ -198,6 +201,9 @@ main(argc, argv)
     } else if (sudo_mode == MODE_KILL) {
        remove_timestamp();     /* remove the timestamp ticket file */
        exit(0);
+    } else if (sudo_mode == MODE_LIST) {
+       (void) validate();      /* list the user's available commands */
+       exit(0);
     }
 
     add_env();                 /* add in SUDO_* envariables */
@@ -359,6 +365,9 @@ static int parse_args()
            case 'k':
                ret = MODE_KILL;
                break;
+           case 'l':
+               ret = MODE_LIST;
+               break;
            case 'V':
                ret = MODE_VERSION;
                break;
@@ -389,7 +398,7 @@ static int parse_args()
 static void usage(exit_val)
     int exit_val;
 {
-    (void) fprintf(stderr, "usage: %s -V | -h | -v | -k | <command>\n", Argv[0]);
+    (void) fprintf(stderr, "usage: %s -V | -h | -l | -v | -k | <command>\n", Argv[0]);
     exit(exit_val);
 }
 
@@ -545,7 +554,7 @@ static void add_env()
     }
 
     /* add the SUDO_UID envariable */
-    for (len = 1 + (uid < 0), n = (int)uid; (n = n / 10) != 0; )
+    for (len = 1 + ((int)uid < 0), n = (int)uid; (n = n / 10) != 0; )
        ++len;
     
     uidstr = (char *) malloc(len+1);