2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

added code for -l flag

This commit is contained in:
Todd C. Miller
1994-09-20 21:36:32 +00:00
parent 7021bdc4ed
commit 410f21dd76

15
sudo.c
View File

@@ -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);