Function names should be flush with the start of the line so they can be found trivially in an editor and with grep
This commit is contained in:
9
alloc.c
9
alloc.c
@@ -64,7 +64,8 @@ static const char rcsid[] = "$Sudo$";
|
|||||||
* malloc(3) fails.
|
* malloc(3) fails.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VOID *emalloc(size)
|
VOID *
|
||||||
|
emalloc(size)
|
||||||
size_t size;
|
size_t size;
|
||||||
{
|
{
|
||||||
VOID *ptr;
|
VOID *ptr;
|
||||||
@@ -85,7 +86,8 @@ VOID *emalloc(size)
|
|||||||
* if the system realloc(3) does not support this.
|
* if the system realloc(3) does not support this.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VOID *erealloc(ptr, size)
|
VOID *
|
||||||
|
erealloc(ptr, size)
|
||||||
VOID *ptr;
|
VOID *ptr;
|
||||||
size_t size;
|
size_t size;
|
||||||
{
|
{
|
||||||
@@ -105,7 +107,8 @@ VOID *erealloc(ptr, size)
|
|||||||
* malloc(3) fails. NOTE: unlike strdup(3), estrdup(NULL) is legal.
|
* malloc(3) fails. NOTE: unlike strdup(3), estrdup(NULL) is legal.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *estrdup(src)
|
char *
|
||||||
|
estrdup(src)
|
||||||
const char *src;
|
const char *src;
|
||||||
{
|
{
|
||||||
char *dst = NULL;
|
char *dst = NULL;
|
||||||
|
60
check.c
60
check.c
@@ -157,7 +157,8 @@ extern int xrealm;
|
|||||||
* verify who s/he is.
|
* verify who s/he is.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void check_user()
|
void
|
||||||
|
check_user()
|
||||||
{
|
{
|
||||||
register int rtn;
|
register int rtn;
|
||||||
mode_t oldmask;
|
mode_t oldmask;
|
||||||
@@ -200,7 +201,8 @@ void check_user()
|
|||||||
* this function checks the user is exempt from supplying a password.
|
* this function checks the user is exempt from supplying a password.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int user_is_exempt()
|
int
|
||||||
|
user_is_exempt()
|
||||||
{
|
{
|
||||||
#ifdef EXEMPTGROUP
|
#ifdef EXEMPTGROUP
|
||||||
struct group *grp;
|
struct group *grp;
|
||||||
@@ -233,7 +235,8 @@ int user_is_exempt()
|
|||||||
* TIMEOUT minutes, no password will be required
|
* TIMEOUT minutes, no password will be required
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int check_timestamp()
|
static int
|
||||||
|
check_timestamp()
|
||||||
{
|
{
|
||||||
register char *p;
|
register char *p;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
@@ -346,7 +349,8 @@ static int check_timestamp()
|
|||||||
* via utime(2).
|
* via utime(2).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int touch(file)
|
static int
|
||||||
|
touch(file)
|
||||||
char *file;
|
char *file;
|
||||||
{
|
{
|
||||||
#if defined(HAVE_UTIME) && !defined(HAVE_UTIME_NULL)
|
#if defined(HAVE_UTIME) && !defined(HAVE_UTIME_NULL)
|
||||||
@@ -379,7 +383,8 @@ static int touch(file)
|
|||||||
* This function changes the timestamp to "now"
|
* This function changes the timestamp to "now"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void update_timestamp()
|
static void
|
||||||
|
update_timestamp()
|
||||||
{
|
{
|
||||||
if (timedir_is_good) {
|
if (timedir_is_good) {
|
||||||
/* become root */
|
/* become root */
|
||||||
@@ -408,7 +413,8 @@ static void update_timestamp()
|
|||||||
* This function removes the timestamp ticket file
|
* This function removes the timestamp ticket file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void remove_timestamp()
|
void
|
||||||
|
remove_timestamp()
|
||||||
{
|
{
|
||||||
#ifdef USE_TTY_TICKETS
|
#ifdef USE_TTY_TICKETS
|
||||||
char *p;
|
char *p;
|
||||||
@@ -456,7 +462,8 @@ void remove_timestamp()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_SECURID
|
#ifdef HAVE_SECURID
|
||||||
static void check_passwd()
|
static void
|
||||||
|
check_passwd()
|
||||||
{
|
{
|
||||||
struct SD_CLIENT sd_dat, *sd; /* SecurID data block */
|
struct SD_CLIENT sd_dat, *sd; /* SecurID data block */
|
||||||
register int counter = TRIES_FOR_PASSWORD;
|
register int counter = TRIES_FOR_PASSWORD;
|
||||||
@@ -498,7 +505,8 @@ static void check_passwd()
|
|||||||
}
|
}
|
||||||
#else /* !HAVE_SECURID */
|
#else /* !HAVE_SECURID */
|
||||||
#ifdef HAVE_AUTHSRV
|
#ifdef HAVE_AUTHSRV
|
||||||
static void check_passwd()
|
static void
|
||||||
|
check_passwd()
|
||||||
{
|
{
|
||||||
char *pass; /* this is what gets entered */
|
char *pass; /* this is what gets entered */
|
||||||
Cfg *confp;
|
Cfg *confp;
|
||||||
@@ -581,7 +589,8 @@ static void check_passwd()
|
|||||||
}
|
}
|
||||||
#else /* !HAVE_AUTHSRV */
|
#else /* !HAVE_AUTHSRV */
|
||||||
|
|
||||||
static void check_passwd()
|
static void
|
||||||
|
check_passwd()
|
||||||
{
|
{
|
||||||
char *pass; /* this is what gets entered */
|
char *pass; /* this is what gets entered */
|
||||||
int counter = TRIES_FOR_PASSWORD;
|
int counter = TRIES_FOR_PASSWORD;
|
||||||
@@ -739,7 +748,8 @@ static void check_passwd()
|
|||||||
*
|
*
|
||||||
* Validate a user via kerberos.
|
* Validate a user via kerberos.
|
||||||
*/
|
*/
|
||||||
static int sudo_krb_validate_user(pw, pass)
|
static int
|
||||||
|
sudo_krb_validate_user(pw, pass)
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
char *pass;
|
char *pass;
|
||||||
{
|
{
|
||||||
@@ -794,7 +804,8 @@ static int sudo_krb_validate_user(pw, pass)
|
|||||||
* OK since we're a short lived program. I'd rather do that than contort
|
* OK since we're a short lived program. I'd rather do that than contort
|
||||||
* the code to handle the cleanup.
|
* the code to handle the cleanup.
|
||||||
*/
|
*/
|
||||||
static int sudo_krb5_validate_user(pw, pass)
|
static int
|
||||||
|
sudo_krb5_validate_user(pw, pass)
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
char *pass;
|
char *pass;
|
||||||
{
|
{
|
||||||
@@ -852,7 +863,8 @@ static int sudo_krb5_validate_user(pw, pass)
|
|||||||
*
|
*
|
||||||
* Returns 1 for confirmation, -1 for failure, 0 for uncertainty.
|
* Returns 1 for confirmation, -1 for failure, 0 for uncertainty.
|
||||||
*/
|
*/
|
||||||
static int verify_krb_v5_tgt(ccache)
|
static int
|
||||||
|
verify_krb_v5_tgt(ccache)
|
||||||
krb5_ccache ccache;
|
krb5_ccache ccache;
|
||||||
{
|
{
|
||||||
char phost[BUFSIZ];
|
char phost[BUFSIZ];
|
||||||
@@ -935,7 +947,8 @@ cleanup:
|
|||||||
static char *PAM_username;
|
static char *PAM_username;
|
||||||
static char *PAM_password;
|
static char *PAM_password;
|
||||||
|
|
||||||
static int PAM_conv(num_msg, msg, resp, appdata_ptr)
|
static int
|
||||||
|
PAM_conv(num_msg, msg, resp, appdata_ptr)
|
||||||
int num_msg;
|
int num_msg;
|
||||||
PAM_CONST struct pam_message **msg;
|
PAM_CONST struct pam_message **msg;
|
||||||
struct pam_response **resp;
|
struct pam_response **resp;
|
||||||
@@ -978,7 +991,8 @@ static int PAM_conv(num_msg, msg, resp, appdata_ptr)
|
|||||||
return(PAM_SUCCESS);
|
return(PAM_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pam_auth(user, password)
|
static int
|
||||||
|
pam_auth(user, password)
|
||||||
char *user;
|
char *user;
|
||||||
char *password;
|
char *password;
|
||||||
{
|
{
|
||||||
@@ -1010,7 +1024,8 @@ static int pam_auth(user, password)
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pam_attempt_auth()
|
static void
|
||||||
|
pam_attempt_auth()
|
||||||
{
|
{
|
||||||
int i = TRIES_FOR_PASSWORD;
|
int i = TRIES_FOR_PASSWORD;
|
||||||
|
|
||||||
@@ -1047,7 +1062,8 @@ static void pam_attempt_auth()
|
|||||||
* s/key challenge * and fills in the user's skey structure.
|
* s/key challenge * and fills in the user's skey structure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *sudo_skeyprompt(user_skey, p)
|
static char *
|
||||||
|
sudo_skeyprompt(user_skey, p)
|
||||||
struct skey *user_skey;
|
struct skey *user_skey;
|
||||||
char *p;
|
char *p;
|
||||||
{
|
{
|
||||||
@@ -1117,7 +1133,8 @@ static char *sudo_skeyprompt(user_skey, p)
|
|||||||
* OPIE challenge * and fills in the user's opie structure.
|
* OPIE challenge * and fills in the user's opie structure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *sudo_opieprompt(user_opie, p)
|
static char *
|
||||||
|
sudo_opieprompt(user_opie, p)
|
||||||
struct opie *user_opie;
|
struct opie *user_opie;
|
||||||
char *p;
|
char *p;
|
||||||
{
|
{
|
||||||
@@ -1182,7 +1199,8 @@ static char *sudo_opieprompt(user_opie, p)
|
|||||||
* this function just prints the the reminder message
|
* this function just prints the the reminder message
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void reminder()
|
static void
|
||||||
|
reminder()
|
||||||
{
|
{
|
||||||
#ifdef SHORT_MESSAGE
|
#ifdef SHORT_MESSAGE
|
||||||
(void) fprintf(stderr, "\n%s\n%s\n\n%s\n%s\n\n",
|
(void) fprintf(stderr, "\n%s\n%s\n\n%s\n%s\n\n",
|
||||||
@@ -1211,7 +1229,8 @@ static void reminder()
|
|||||||
* (and insult them if insults are configured).
|
* (and insult them if insults are configured).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void pass_warn(fp)
|
void
|
||||||
|
pass_warn(fp)
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1230,7 +1249,8 @@ void pass_warn(fp)
|
|||||||
* allocated result. Returns the same string if no escapes.
|
* allocated result. Returns the same string if no escapes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *expand_prompt(old_prompt, user, host)
|
static char *
|
||||||
|
expand_prompt(old_prompt, user, host)
|
||||||
char *old_prompt;
|
char *old_prompt;
|
||||||
char *user;
|
char *user;
|
||||||
char *host;
|
char *host;
|
||||||
|
@@ -66,7 +66,8 @@ static int tcollect __P((int, int, uchar_t *, int, prompt_t *));
|
|||||||
* Collection routine (callback) for limiting the timeouts in SIA
|
* Collection routine (callback) for limiting the timeouts in SIA
|
||||||
* prompts.
|
* prompts.
|
||||||
*/
|
*/
|
||||||
static int tcollect(timeout, rendition, title, nprompts, prompts)
|
static int
|
||||||
|
tcollect(timeout, rendition, title, nprompts, prompts)
|
||||||
int timeout;
|
int timeout;
|
||||||
int rendition;
|
int rendition;
|
||||||
uchar_t *title;
|
uchar_t *title;
|
||||||
@@ -100,7 +101,8 @@ static int tcollect(timeout, rendition, title, nprompts, prompts)
|
|||||||
* Try to authenticate the user using Security Integration Architecture
|
* Try to authenticate the user using Security Integration Architecture
|
||||||
* (SIA). Added 9/26/98 by Spider Boardman
|
* (SIA). Added 9/26/98 by Spider Boardman
|
||||||
*/
|
*/
|
||||||
void sia_attempt_auth()
|
void
|
||||||
|
sia_attempt_auth()
|
||||||
{
|
{
|
||||||
SIAENTITY *siah = NULL;
|
SIAENTITY *siah = NULL;
|
||||||
int retval;
|
int retval;
|
||||||
|
@@ -64,7 +64,8 @@ static unsigned char error_string[dce_c_error_string_len];
|
|||||||
|
|
||||||
|
|
||||||
/* returns 1 ("true") if user is a valid DCE principal, 0 otherwise */
|
/* returns 1 ("true") if user is a valid DCE principal, 0 otherwise */
|
||||||
int dce_pwent(username, plain_pw)
|
int
|
||||||
|
dce_pwent(username, plain_pw)
|
||||||
char *username;
|
char *username;
|
||||||
char *plain_pw;
|
char *plain_pw;
|
||||||
{
|
{
|
||||||
@@ -183,7 +184,8 @@ char *plain_pw;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* returns 0 for DCE "ok" status, 1 otherwise */
|
/* returns 0 for DCE "ok" status, 1 otherwise */
|
||||||
static int check_dce_status(input_status, comment)
|
static int
|
||||||
|
check_dce_status(input_status, comment)
|
||||||
error_status_t input_status;
|
error_status_t input_status;
|
||||||
char *comment;
|
char *comment;
|
||||||
{
|
{
|
||||||
|
@@ -82,7 +82,8 @@ static const char rcsid[] = "$Sudo$";
|
|||||||
* but it is in '.' and IGNORE_DOT_PATH is in effect.
|
* but it is in '.' and IGNORE_DOT_PATH is in effect.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int find_path(infile, outfile)
|
int
|
||||||
|
find_path(infile, outfile)
|
||||||
char *infile; /* file to find */
|
char *infile; /* file to find */
|
||||||
char **outfile; /* result parameter */
|
char **outfile; /* result parameter */
|
||||||
{
|
{
|
||||||
|
@@ -99,7 +99,8 @@ static char *sudo_getepw __P((struct passwd *));
|
|||||||
* SHELL evariable or the passwd(5) entry (in that order).
|
* SHELL evariable or the passwd(5) entry (in that order).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *sudo_getshell(pw)
|
static char *
|
||||||
|
sudo_getshell(pw)
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
{
|
{
|
||||||
char *pw_shell;
|
char *pw_shell;
|
||||||
@@ -126,7 +127,8 @@ static char *sudo_getshell(pw)
|
|||||||
* normal UN*X password is returned instead.
|
* normal UN*X password is returned instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *sudo_getepw(pw)
|
static char *
|
||||||
|
sudo_getepw(pw)
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -200,7 +202,8 @@ static char *sudo_getepw(pw)
|
|||||||
* are in use, it substitutes the shadow password for pw_passwd.
|
* are in use, it substitutes the shadow password for pw_passwd.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct passwd *sudo_getpwuid(uid)
|
struct passwd *
|
||||||
|
sudo_getpwuid(uid)
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
{
|
{
|
||||||
struct passwd *pw, *local_pw;
|
struct passwd *pw, *local_pw;
|
||||||
|
@@ -65,7 +65,8 @@ static const char rcsid[] = "$Sudo$";
|
|||||||
* that is a normal file and executable by root.
|
* that is a normal file and executable by root.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char * sudo_goodpath(path)
|
char *
|
||||||
|
sudo_goodpath(path)
|
||||||
const char * path;
|
const char * path;
|
||||||
{
|
{
|
||||||
struct stat statbuf; /* for stat(2) */
|
struct stat statbuf; /* for stat(2) */
|
||||||
|
@@ -94,7 +94,8 @@ extern char **Argv;
|
|||||||
* and sets the constituent ip addrs and netmasks.
|
* and sets the constituent ip addrs and netmasks.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void load_interfaces()
|
void
|
||||||
|
load_interfaces()
|
||||||
{
|
{
|
||||||
struct ifconf *ifconf;
|
struct ifconf *ifconf;
|
||||||
struct ifreq *ifr, ifr_tmp;
|
struct ifreq *ifr, ifr_tmp;
|
||||||
@@ -246,7 +247,8 @@ void load_interfaces()
|
|||||||
* Stub function for those without SIOCGIFCONF
|
* Stub function for those without SIOCGIFCONF
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void load_interfaces()
|
void
|
||||||
|
load_interfaces()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
12
lex.yy.c
12
lex.yy.c
@@ -1992,7 +1992,8 @@ int main()
|
|||||||
#endif
|
#endif
|
||||||
#line 269 "parse.lex"
|
#line 269 "parse.lex"
|
||||||
|
|
||||||
static void fill(s, len)
|
static void
|
||||||
|
fill(s, len)
|
||||||
char *s;
|
char *s;
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
@@ -2006,7 +2007,8 @@ static void fill(s, len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fill_cmnd(s, len)
|
static void
|
||||||
|
fill_cmnd(s, len)
|
||||||
char *s;
|
char *s;
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
@@ -2024,7 +2026,8 @@ static void fill_cmnd(s, len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fill_args(s, len, addspace)
|
static void
|
||||||
|
fill_args(s, len, addspace)
|
||||||
char *s;
|
char *s;
|
||||||
int len;
|
int len;
|
||||||
int addspace;
|
int addspace;
|
||||||
@@ -2071,7 +2074,8 @@ static void fill_args(s, len, addspace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int yywrap()
|
int
|
||||||
|
yywrap()
|
||||||
{
|
{
|
||||||
#ifdef YY_NEW_FILE
|
#ifdef YY_NEW_FILE
|
||||||
YY_NEW_FILE;
|
YY_NEW_FILE;
|
||||||
|
21
logging.c
21
logging.c
@@ -90,7 +90,8 @@ extern int errorlineno;
|
|||||||
* guarantee that the syslog() operation will succeed!
|
* guarantee that the syslog() operation will succeed!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void syslog_wrapper(pri, fmt, arg1, arg2)
|
static void
|
||||||
|
syslog_wrapper(pri, fmt, arg1, arg2)
|
||||||
int pri;
|
int pri;
|
||||||
char *fmt;
|
char *fmt;
|
||||||
char *arg1;
|
char *arg1;
|
||||||
@@ -116,7 +117,8 @@ static void syslog_wrapper(pri, fmt, arg1, arg2)
|
|||||||
* syslogs the error or writes it to the log file
|
* syslogs the error or writes it to the log file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void log_error(code)
|
void
|
||||||
|
log_error(code)
|
||||||
int code;
|
int code;
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
@@ -448,7 +450,8 @@ void log_error(code)
|
|||||||
|
|
||||||
static char *mail_argv[] = { "sendmail", "-t", (char *) NULL };
|
static char *mail_argv[] = { "sendmail", "-t", (char *) NULL };
|
||||||
|
|
||||||
static void send_mail()
|
static void
|
||||||
|
send_mail()
|
||||||
{
|
{
|
||||||
char *mailer = _PATH_SENDMAIL;
|
char *mailer = _PATH_SENDMAIL;
|
||||||
char *subject = MAILSUBJECT;
|
char *subject = MAILSUBJECT;
|
||||||
@@ -526,7 +529,8 @@ static void send_mail()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static void send_mail()
|
static void
|
||||||
|
send_mail()
|
||||||
{
|
{
|
||||||
/* no mailer defined */
|
/* no mailer defined */
|
||||||
return;
|
return;
|
||||||
@@ -542,7 +546,8 @@ static void send_mail()
|
|||||||
* This function gets rid of all the ugly zombies
|
* This function gets rid of all the ugly zombies
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static RETSIGTYPE reapchild(sig)
|
static RETSIGTYPE
|
||||||
|
reapchild(sig)
|
||||||
int sig;
|
int sig;
|
||||||
{
|
{
|
||||||
int pid, status, save_errno = errno;
|
int pid, status, save_errno = errno;
|
||||||
@@ -570,7 +575,8 @@ static RETSIGTYPE reapchild(sig)
|
|||||||
* when an error occurs
|
* when an error occurs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void inform_user(code)
|
void
|
||||||
|
inform_user(code)
|
||||||
int code;
|
int code;
|
||||||
{
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
@@ -689,7 +695,8 @@ void inform_user(code)
|
|||||||
* This function determines whether to send mail or not...
|
* This function determines whether to send mail or not...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int appropriate(code)
|
static int
|
||||||
|
appropriate(code)
|
||||||
int code;
|
int code;
|
||||||
{
|
{
|
||||||
|
|
||||||
|
18
parse.c
18
parse.c
@@ -99,7 +99,8 @@ static int has_meta __P((char *));
|
|||||||
* This routine is called from the sudo.c module and tries to validate
|
* This routine is called from the sudo.c module and tries to validate
|
||||||
* the user, host and command triplet.
|
* the user, host and command triplet.
|
||||||
*/
|
*/
|
||||||
int validate(check_cmnd)
|
int
|
||||||
|
validate(check_cmnd)
|
||||||
int check_cmnd;
|
int check_cmnd;
|
||||||
{
|
{
|
||||||
int return_code;
|
int return_code;
|
||||||
@@ -202,7 +203,8 @@ int validate(check_cmnd)
|
|||||||
* If path doesn't end in /, return TRUE iff cmnd & path name the same inode;
|
* If path doesn't end in /, return TRUE iff cmnd & path name the same inode;
|
||||||
* otherwise, return TRUE if cmnd names one of the inodes in path.
|
* otherwise, return TRUE if cmnd names one of the inodes in path.
|
||||||
*/
|
*/
|
||||||
int command_matches(cmnd, user_args, path, sudoers_args)
|
int
|
||||||
|
command_matches(cmnd, user_args, path, sudoers_args)
|
||||||
char *cmnd;
|
char *cmnd;
|
||||||
char *user_args;
|
char *user_args;
|
||||||
char *path;
|
char *path;
|
||||||
@@ -330,7 +332,8 @@ int command_matches(cmnd, user_args, path, sudoers_args)
|
|||||||
* Returns TRUE if "n" is one of our ip addresses or if
|
* Returns TRUE if "n" is one of our ip addresses or if
|
||||||
* "n" is a network that we are on, else returns FALSE.
|
* "n" is a network that we are on, else returns FALSE.
|
||||||
*/
|
*/
|
||||||
int addr_matches(n)
|
int
|
||||||
|
addr_matches(n)
|
||||||
char *n;
|
char *n;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -366,7 +369,8 @@ int addr_matches(n)
|
|||||||
* Returns TRUE if the given user belongs to the named group,
|
* Returns TRUE if the given user belongs to the named group,
|
||||||
* else returns FALSE.
|
* else returns FALSE.
|
||||||
*/
|
*/
|
||||||
int usergr_matches(group, user)
|
int
|
||||||
|
usergr_matches(group, user)
|
||||||
char *group;
|
char *group;
|
||||||
char *user;
|
char *user;
|
||||||
{
|
{
|
||||||
@@ -405,7 +409,8 @@ int usergr_matches(group, user)
|
|||||||
* else return FALSE. Either of "host" or "user" may be NULL
|
* else return FALSE. Either of "host" or "user" may be NULL
|
||||||
* in which case that argument is not checked...
|
* in which case that argument is not checked...
|
||||||
*/
|
*/
|
||||||
int netgr_matches(netgr, host, user)
|
int
|
||||||
|
netgr_matches(netgr, host, user)
|
||||||
char *netgr;
|
char *netgr;
|
||||||
char *host;
|
char *host;
|
||||||
char *user;
|
char *user;
|
||||||
@@ -444,7 +449,8 @@ int netgr_matches(netgr, host, user)
|
|||||||
* Returns TRUE if "s" has shell meta characters in it,
|
* Returns TRUE if "s" has shell meta characters in it,
|
||||||
* else returns FALSE.
|
* else returns FALSE.
|
||||||
*/
|
*/
|
||||||
static int has_meta(s)
|
static int
|
||||||
|
has_meta(s)
|
||||||
char *s;
|
char *s;
|
||||||
{
|
{
|
||||||
register char *t;
|
register char *t;
|
||||||
|
12
parse.lex
12
parse.lex
@@ -267,7 +267,8 @@ PASSWD[[:blank:]]*: {
|
|||||||
} /* parse error */
|
} /* parse error */
|
||||||
|
|
||||||
%%
|
%%
|
||||||
static void fill(s, len)
|
static void
|
||||||
|
fill(s, len)
|
||||||
char *s;
|
char *s;
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
@@ -281,7 +282,8 @@ static void fill(s, len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fill_cmnd(s, len)
|
static void
|
||||||
|
fill_cmnd(s, len)
|
||||||
char *s;
|
char *s;
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
@@ -299,7 +301,8 @@ static void fill_cmnd(s, len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fill_args(s, len, addspace)
|
static void
|
||||||
|
fill_args(s, len, addspace)
|
||||||
char *s;
|
char *s;
|
||||||
int len;
|
int len;
|
||||||
int addspace;
|
int addspace;
|
||||||
@@ -346,7 +349,8 @@ static void fill_args(s, len, addspace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int yywrap()
|
int
|
||||||
|
yywrap()
|
||||||
{
|
{
|
||||||
#ifdef YY_NEW_FILE
|
#ifdef YY_NEW_FILE
|
||||||
YY_NEW_FILE;
|
YY_NEW_FILE;
|
||||||
|
39
parse.yacc
39
parse.yacc
@@ -153,7 +153,8 @@ static void expand_match_list __P((void));
|
|||||||
void init_parser __P((void));
|
void init_parser __P((void));
|
||||||
void yyerror __P((char *));
|
void yyerror __P((char *));
|
||||||
|
|
||||||
void yyerror(s)
|
void
|
||||||
|
yyerror(s)
|
||||||
char *s;
|
char *s;
|
||||||
{
|
{
|
||||||
/* save the line the first error occured on */
|
/* save the line the first error occured on */
|
||||||
@@ -678,7 +679,8 @@ size_t nslots = 0;
|
|||||||
* This function compares two aliasinfo structures.
|
* This function compares two aliasinfo structures.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int aliascmp(a1, a2)
|
static int
|
||||||
|
aliascmp(a1, a2)
|
||||||
const VOID *a1, *a2;
|
const VOID *a1, *a2;
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
@@ -701,7 +703,8 @@ static int aliascmp(a1, a2)
|
|||||||
* This function compares two generic_alias structures.
|
* This function compares two generic_alias structures.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int genaliascmp(entry, key)
|
static int
|
||||||
|
genaliascmp(entry, key)
|
||||||
const VOID *entry, *key;
|
const VOID *entry, *key;
|
||||||
{
|
{
|
||||||
struct generic_alias *ga1 = (struct generic_alias *) key;
|
struct generic_alias *ga1 = (struct generic_alias *) key;
|
||||||
@@ -719,7 +722,8 @@ static int genaliascmp(entry, key)
|
|||||||
* aliases list.
|
* aliases list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int add_alias(alias, type)
|
static int
|
||||||
|
add_alias(alias, type)
|
||||||
char *alias;
|
char *alias;
|
||||||
int type;
|
int type;
|
||||||
{
|
{
|
||||||
@@ -765,7 +769,8 @@ static int add_alias(alias, type)
|
|||||||
* This function searches for the named alias of the specified type.
|
* This function searches for the named alias of the specified type.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int find_alias(alias, type)
|
static int
|
||||||
|
find_alias(alias, type)
|
||||||
char *alias;
|
char *alias;
|
||||||
int type;
|
int type;
|
||||||
{
|
{
|
||||||
@@ -786,7 +791,8 @@ static int find_alias(alias, type)
|
|||||||
* This function allocates more space for the aliases list.
|
* This function allocates more space for the aliases list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int more_aliases()
|
static int
|
||||||
|
more_aliases()
|
||||||
{
|
{
|
||||||
nslots += MOREALIASES;
|
nslots += MOREALIASES;
|
||||||
if (nslots == MOREALIASES)
|
if (nslots == MOREALIASES)
|
||||||
@@ -805,7 +811,8 @@ static int more_aliases()
|
|||||||
* This function lists the contents of the aliases list.
|
* This function lists the contents of the aliases list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void dumpaliases()
|
void
|
||||||
|
dumpaliases()
|
||||||
{
|
{
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
@@ -840,7 +847,8 @@ void dumpaliases()
|
|||||||
* `sudo -l'.
|
* `sudo -l'.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void list_matches()
|
void
|
||||||
|
list_matches()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *p;
|
char *p;
|
||||||
@@ -910,7 +918,8 @@ void list_matches()
|
|||||||
* a separator if one is given.
|
* a separator if one is given.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void append(src, dstp, dst_len, dst_size, separator)
|
static void
|
||||||
|
append(src, dstp, dst_len, dst_size, separator)
|
||||||
char *src, **dstp;
|
char *src, **dstp;
|
||||||
size_t *dst_len, *dst_size;
|
size_t *dst_len, *dst_size;
|
||||||
int separator;
|
int separator;
|
||||||
@@ -953,7 +962,8 @@ static void append(src, dstp, dst_len, dst_size, separator)
|
|||||||
* the associated counters.
|
* the associated counters.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void reset_aliases()
|
void
|
||||||
|
reset_aliases()
|
||||||
{
|
{
|
||||||
if (aliases) {
|
if (aliases) {
|
||||||
free(aliases);
|
free(aliases);
|
||||||
@@ -970,7 +980,8 @@ void reset_aliases()
|
|||||||
* This function increments ga_list_len, allocating more space as necesary.
|
* This function increments ga_list_len, allocating more space as necesary.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void expand_ga_list()
|
static void
|
||||||
|
expand_ga_list()
|
||||||
{
|
{
|
||||||
if (++ga_list_len >= ga_list_size) {
|
if (++ga_list_len >= ga_list_size) {
|
||||||
while ((ga_list_size += STACKINCREMENT) < ga_list_len)
|
while ((ga_list_size += STACKINCREMENT) < ga_list_len)
|
||||||
@@ -990,7 +1001,8 @@ static void expand_ga_list()
|
|||||||
* This function increments cm_list_len, allocating more space as necesary.
|
* This function increments cm_list_len, allocating more space as necesary.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void expand_match_list()
|
static void
|
||||||
|
expand_match_list()
|
||||||
{
|
{
|
||||||
if (++cm_list_len >= cm_list_size) {
|
if (++cm_list_len >= cm_list_size) {
|
||||||
while ((cm_list_size += STACKINCREMENT) < cm_list_len)
|
while ((cm_list_size += STACKINCREMENT) < cm_list_len)
|
||||||
@@ -1014,7 +1026,8 @@ static void expand_match_list()
|
|||||||
* allocates new space for various data structures.
|
* allocates new space for various data structures.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void init_parser()
|
void
|
||||||
|
init_parser()
|
||||||
{
|
{
|
||||||
/* Free up old data structures if we run the parser more than once. */
|
/* Free up old data structures if we run the parser more than once. */
|
||||||
if (match) {
|
if (match) {
|
||||||
|
3
putenv.c
3
putenv.c
@@ -60,7 +60,8 @@ static const char rcsid[] = "$Sudo$";
|
|||||||
* Note that this string becomes a part of the environment.
|
* Note that this string becomes a part of the environment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int putenv(str)
|
int
|
||||||
|
putenv(str)
|
||||||
const char *str;
|
const char *str;
|
||||||
{
|
{
|
||||||
char **current;
|
char **current;
|
||||||
|
@@ -68,7 +68,8 @@ static const char rcsid[] = "$Sudo$";
|
|||||||
* using the SecureWare crypt functions. Returns 1 on a match, else 0.
|
* using the SecureWare crypt functions. Returns 1 on a match, else 0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int check_secureware(pass)
|
int
|
||||||
|
check_secureware(pass)
|
||||||
char *pass;
|
char *pass;
|
||||||
{
|
{
|
||||||
#ifdef __alpha
|
#ifdef __alpha
|
||||||
|
30
sudo.c
30
sudo.c
@@ -173,7 +173,8 @@ struct env_table badenv_table[] = {
|
|||||||
* the driving force behind sudo...
|
* the driving force behind sudo...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int main(argc, argv)
|
int
|
||||||
|
main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
@@ -389,7 +390,8 @@ int main(argc, argv)
|
|||||||
* user_pw_ent, host, cwd, interfaces.
|
* user_pw_ent, host, cwd, interfaces.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void load_globals(sudo_mode)
|
static void
|
||||||
|
load_globals(sudo_mode)
|
||||||
int sudo_mode;
|
int sudo_mode;
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
@@ -546,7 +548,8 @@ static void load_globals(sudo_mode)
|
|||||||
* this function parses the arguments to sudo
|
* this function parses the arguments to sudo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int parse_args()
|
static int
|
||||||
|
parse_args()
|
||||||
{
|
{
|
||||||
int ret = MODE_RUN; /* what mode is suod to be run in? */
|
int ret = MODE_RUN; /* what mode is suod to be run in? */
|
||||||
int excl = 0; /* exclusive arg, no others allowed */
|
int excl = 0; /* exclusive arg, no others allowed */
|
||||||
@@ -687,7 +690,8 @@ static int parse_args()
|
|||||||
* Tell which options are mutually exclusive and exit
|
* Tell which options are mutually exclusive and exit
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void usage_excl(exit_val)
|
static void
|
||||||
|
usage_excl(exit_val)
|
||||||
int exit_val;
|
int exit_val;
|
||||||
{
|
{
|
||||||
(void) fprintf(stderr, "Only one of the -v, -k, -l, -V and -h options may be used\n");
|
(void) fprintf(stderr, "Only one of the -v, -k, -l, -V and -h options may be used\n");
|
||||||
@@ -701,7 +705,8 @@ static void usage_excl(exit_val)
|
|||||||
* this function just gives you instructions and exits
|
* this function just gives you instructions and exits
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void usage(exit_val)
|
static void
|
||||||
|
usage(exit_val)
|
||||||
int exit_val;
|
int exit_val;
|
||||||
{
|
{
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
@@ -723,7 +728,8 @@ static void usage(exit_val)
|
|||||||
* this function adds sudo-specific variables into the environment
|
* this function adds sudo-specific variables into the environment
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void add_env(contiguous)
|
static void
|
||||||
|
add_env(contiguous)
|
||||||
int contiguous;
|
int contiguous;
|
||||||
{
|
{
|
||||||
char idstr[MAX_UID_T_LEN + 1];
|
char idstr[MAX_UID_T_LEN + 1];
|
||||||
@@ -811,7 +817,8 @@ static void add_env(contiguous)
|
|||||||
* Returns 1 on success, 0 on failure.
|
* Returns 1 on success, 0 on failure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int load_cmnd(sudo_mode)
|
static int
|
||||||
|
load_cmnd(sudo_mode)
|
||||||
int sudo_mode;
|
int sudo_mode;
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
@@ -841,7 +848,8 @@ static int load_cmnd(sudo_mode)
|
|||||||
* uid SUDOERS_UID, gid SUDOERS_GID and is mode SUDOERS_MODE.
|
* uid SUDOERS_UID, gid SUDOERS_GID and is mode SUDOERS_MODE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int check_sudoers()
|
static int
|
||||||
|
check_sudoers()
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
int rootstat, i;
|
int rootstat, i;
|
||||||
@@ -928,7 +936,8 @@ static int check_sudoers()
|
|||||||
* this function sets real and effective uids and gids based on perm.
|
* this function sets real and effective uids and gids based on perm.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void set_perms(perm, sudo_mode)
|
void
|
||||||
|
set_perms(perm, sudo_mode)
|
||||||
int perm;
|
int perm;
|
||||||
int sudo_mode;
|
int sudo_mode;
|
||||||
{
|
{
|
||||||
@@ -1075,7 +1084,8 @@ void set_perms(perm, sudo_mode)
|
|||||||
* variables here as well but cmnd has not been defined at this point.
|
* variables here as well but cmnd has not been defined at this point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void clean_env(envp, badenv_table)
|
static void
|
||||||
|
clean_env(envp, badenv_table)
|
||||||
char **envp;
|
char **envp;
|
||||||
struct env_table *badenv_table;
|
struct env_table *badenv_table;
|
||||||
{
|
{
|
||||||
|
157
sudo.tab.c
157
sudo.tab.c
@@ -171,7 +171,8 @@ static void expand_match_list __P((void));
|
|||||||
void init_parser __P((void));
|
void init_parser __P((void));
|
||||||
void yyerror __P((char *));
|
void yyerror __P((char *));
|
||||||
|
|
||||||
void yyerror(s)
|
void
|
||||||
|
yyerror(s)
|
||||||
char *s;
|
char *s;
|
||||||
{
|
{
|
||||||
/* save the line the first error occured on */
|
/* save the line the first error occured on */
|
||||||
@@ -185,14 +186,14 @@ void yyerror(s)
|
|||||||
#endif
|
#endif
|
||||||
parse_error = TRUE;
|
parse_error = TRUE;
|
||||||
}
|
}
|
||||||
#line 172 "parse.yacc"
|
#line 173 "parse.yacc"
|
||||||
typedef union {
|
typedef union {
|
||||||
char *string;
|
char *string;
|
||||||
int BOOLEAN;
|
int BOOLEAN;
|
||||||
struct sudo_command command;
|
struct sudo_command command;
|
||||||
int tok;
|
int tok;
|
||||||
} YYSTYPE;
|
} YYSTYPE;
|
||||||
#line 196 "sudo.tab.c"
|
#line 197 "sudo.tab.c"
|
||||||
#define ALIAS 257
|
#define ALIAS 257
|
||||||
#define NTWKADDR 258
|
#define NTWKADDR 258
|
||||||
#define FQHOST 259
|
#define FQHOST 259
|
||||||
@@ -497,7 +498,7 @@ short *yyss;
|
|||||||
short *yysslim;
|
short *yysslim;
|
||||||
YYSTYPE *yyvs;
|
YYSTYPE *yyvs;
|
||||||
int yystacksize;
|
int yystacksize;
|
||||||
#line 661 "parse.yacc"
|
#line 662 "parse.yacc"
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -518,7 +519,8 @@ size_t nslots = 0;
|
|||||||
* This function compares two aliasinfo structures.
|
* This function compares two aliasinfo structures.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int aliascmp(a1, a2)
|
static int
|
||||||
|
aliascmp(a1, a2)
|
||||||
const VOID *a1, *a2;
|
const VOID *a1, *a2;
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
@@ -541,7 +543,8 @@ static int aliascmp(a1, a2)
|
|||||||
* This function compares two generic_alias structures.
|
* This function compares two generic_alias structures.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int genaliascmp(entry, key)
|
static int
|
||||||
|
genaliascmp(entry, key)
|
||||||
const VOID *entry, *key;
|
const VOID *entry, *key;
|
||||||
{
|
{
|
||||||
struct generic_alias *ga1 = (struct generic_alias *) key;
|
struct generic_alias *ga1 = (struct generic_alias *) key;
|
||||||
@@ -559,7 +562,8 @@ static int genaliascmp(entry, key)
|
|||||||
* aliases list.
|
* aliases list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int add_alias(alias, type)
|
static int
|
||||||
|
add_alias(alias, type)
|
||||||
char *alias;
|
char *alias;
|
||||||
int type;
|
int type;
|
||||||
{
|
{
|
||||||
@@ -605,7 +609,8 @@ static int add_alias(alias, type)
|
|||||||
* This function searches for the named alias of the specified type.
|
* This function searches for the named alias of the specified type.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int find_alias(alias, type)
|
static int
|
||||||
|
find_alias(alias, type)
|
||||||
char *alias;
|
char *alias;
|
||||||
int type;
|
int type;
|
||||||
{
|
{
|
||||||
@@ -626,7 +631,8 @@ static int find_alias(alias, type)
|
|||||||
* This function allocates more space for the aliases list.
|
* This function allocates more space for the aliases list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int more_aliases()
|
static int
|
||||||
|
more_aliases()
|
||||||
{
|
{
|
||||||
nslots += MOREALIASES;
|
nslots += MOREALIASES;
|
||||||
if (nslots == MOREALIASES)
|
if (nslots == MOREALIASES)
|
||||||
@@ -645,7 +651,8 @@ static int more_aliases()
|
|||||||
* This function lists the contents of the aliases list.
|
* This function lists the contents of the aliases list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void dumpaliases()
|
void
|
||||||
|
dumpaliases()
|
||||||
{
|
{
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
@@ -680,7 +687,8 @@ void dumpaliases()
|
|||||||
* `sudo -l'.
|
* `sudo -l'.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void list_matches()
|
void
|
||||||
|
list_matches()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *p;
|
char *p;
|
||||||
@@ -750,7 +758,8 @@ void list_matches()
|
|||||||
* a separator if one is given.
|
* a separator if one is given.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void append(src, dstp, dst_len, dst_size, separator)
|
static void
|
||||||
|
append(src, dstp, dst_len, dst_size, separator)
|
||||||
char *src, **dstp;
|
char *src, **dstp;
|
||||||
size_t *dst_len, *dst_size;
|
size_t *dst_len, *dst_size;
|
||||||
int separator;
|
int separator;
|
||||||
@@ -793,7 +802,8 @@ static void append(src, dstp, dst_len, dst_size, separator)
|
|||||||
* the associated counters.
|
* the associated counters.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void reset_aliases()
|
void
|
||||||
|
reset_aliases()
|
||||||
{
|
{
|
||||||
if (aliases) {
|
if (aliases) {
|
||||||
free(aliases);
|
free(aliases);
|
||||||
@@ -810,7 +820,8 @@ void reset_aliases()
|
|||||||
* This function increments ga_list_len, allocating more space as necesary.
|
* This function increments ga_list_len, allocating more space as necesary.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void expand_ga_list()
|
static void
|
||||||
|
expand_ga_list()
|
||||||
{
|
{
|
||||||
if (++ga_list_len >= ga_list_size) {
|
if (++ga_list_len >= ga_list_size) {
|
||||||
while ((ga_list_size += STACKINCREMENT) < ga_list_len)
|
while ((ga_list_size += STACKINCREMENT) < ga_list_len)
|
||||||
@@ -830,7 +841,8 @@ static void expand_ga_list()
|
|||||||
* This function increments cm_list_len, allocating more space as necesary.
|
* This function increments cm_list_len, allocating more space as necesary.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void expand_match_list()
|
static void
|
||||||
|
expand_match_list()
|
||||||
{
|
{
|
||||||
if (++cm_list_len >= cm_list_size) {
|
if (++cm_list_len >= cm_list_size) {
|
||||||
while ((cm_list_size += STACKINCREMENT) < cm_list_len)
|
while ((cm_list_size += STACKINCREMENT) < cm_list_len)
|
||||||
@@ -854,7 +866,8 @@ static void expand_match_list()
|
|||||||
* allocates new space for various data structures.
|
* allocates new space for various data structures.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void init_parser()
|
void
|
||||||
|
init_parser()
|
||||||
{
|
{
|
||||||
/* Free up old data structures if we run the parser more than once. */
|
/* Free up old data structures if we run the parser more than once. */
|
||||||
if (match) {
|
if (match) {
|
||||||
@@ -874,7 +887,7 @@ void init_parser()
|
|||||||
if (printmatches == TRUE)
|
if (printmatches == TRUE)
|
||||||
expand_match_list();
|
expand_match_list();
|
||||||
}
|
}
|
||||||
#line 878 "sudo.tab.c"
|
#line 891 "sudo.tab.c"
|
||||||
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
|
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
|
||||||
#if defined(__cplusplus) || __STDC__
|
#if defined(__cplusplus) || __STDC__
|
||||||
static int yygrowstack(void)
|
static int yygrowstack(void)
|
||||||
@@ -1055,19 +1068,19 @@ yyreduce:
|
|||||||
switch (yyn)
|
switch (yyn)
|
||||||
{
|
{
|
||||||
case 3:
|
case 3:
|
||||||
#line 210 "parse.yacc"
|
#line 211 "parse.yacc"
|
||||||
{ ; }
|
{ ; }
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
#line 212 "parse.yacc"
|
#line 213 "parse.yacc"
|
||||||
{ yyerrok; }
|
{ yyerrok; }
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
#line 213 "parse.yacc"
|
#line 214 "parse.yacc"
|
||||||
{ push; }
|
{ push; }
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
#line 213 "parse.yacc"
|
#line 214 "parse.yacc"
|
||||||
{
|
{
|
||||||
while (top && user_matches != TRUE) {
|
while (top && user_matches != TRUE) {
|
||||||
pop;
|
pop;
|
||||||
@@ -1075,23 +1088,23 @@ case 6:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
#line 219 "parse.yacc"
|
#line 220 "parse.yacc"
|
||||||
{ ; }
|
{ ; }
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
#line 221 "parse.yacc"
|
#line 222 "parse.yacc"
|
||||||
{ ; }
|
{ ; }
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
#line 223 "parse.yacc"
|
#line 224 "parse.yacc"
|
||||||
{ ; }
|
{ ; }
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
#line 225 "parse.yacc"
|
#line 226 "parse.yacc"
|
||||||
{ ; }
|
{ ; }
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
#line 233 "parse.yacc"
|
#line 234 "parse.yacc"
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We already did a push if necessary in
|
* We already did a push if necessary in
|
||||||
@@ -1104,13 +1117,13 @@ case 13:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
#line 246 "parse.yacc"
|
#line 247 "parse.yacc"
|
||||||
{
|
{
|
||||||
push;
|
push;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
#line 248 "parse.yacc"
|
#line 249 "parse.yacc"
|
||||||
{
|
{
|
||||||
pop;
|
pop;
|
||||||
if (host_matched == TRUE)
|
if (host_matched == TRUE)
|
||||||
@@ -1120,13 +1133,13 @@ case 16:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
#line 256 "parse.yacc"
|
#line 257 "parse.yacc"
|
||||||
{
|
{
|
||||||
host_matches = TRUE;
|
host_matches = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
#line 259 "parse.yacc"
|
#line 260 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (addr_matches(yyvsp[0].string))
|
if (addr_matches(yyvsp[0].string))
|
||||||
host_matches = TRUE;
|
host_matches = TRUE;
|
||||||
@@ -1134,7 +1147,7 @@ case 18:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
#line 264 "parse.yacc"
|
#line 265 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (netgr_matches(yyvsp[0].string, host, NULL))
|
if (netgr_matches(yyvsp[0].string, host, NULL))
|
||||||
host_matches = TRUE;
|
host_matches = TRUE;
|
||||||
@@ -1142,7 +1155,7 @@ case 19:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
#line 269 "parse.yacc"
|
#line 270 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (strcasecmp(shost, yyvsp[0].string) == 0)
|
if (strcasecmp(shost, yyvsp[0].string) == 0)
|
||||||
host_matches = TRUE;
|
host_matches = TRUE;
|
||||||
@@ -1150,7 +1163,7 @@ case 20:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 21:
|
case 21:
|
||||||
#line 274 "parse.yacc"
|
#line 275 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (strcasecmp(host, yyvsp[0].string) == 0)
|
if (strcasecmp(host, yyvsp[0].string) == 0)
|
||||||
host_matches = TRUE;
|
host_matches = TRUE;
|
||||||
@@ -1158,7 +1171,7 @@ case 21:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 22:
|
case 22:
|
||||||
#line 279 "parse.yacc"
|
#line 280 "parse.yacc"
|
||||||
{
|
{
|
||||||
/* could be an all-caps hostname */
|
/* could be an all-caps hostname */
|
||||||
if (find_alias(yyvsp[0].string, HOST_ALIAS) == TRUE ||
|
if (find_alias(yyvsp[0].string, HOST_ALIAS) == TRUE ||
|
||||||
@@ -1168,7 +1181,7 @@ case 22:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 25:
|
case 25:
|
||||||
#line 292 "parse.yacc"
|
#line 293 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (printmatches == TRUE &&
|
if (printmatches == TRUE &&
|
||||||
(runas_matches == -1 || cmnd_matches == -1)) {
|
(runas_matches == -1 || cmnd_matches == -1)) {
|
||||||
@@ -1187,11 +1200,11 @@ case 25:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 26:
|
case 26:
|
||||||
#line 310 "parse.yacc"
|
#line 311 "parse.yacc"
|
||||||
{ ; }
|
{ ; }
|
||||||
break;
|
break;
|
||||||
case 27:
|
case 27:
|
||||||
#line 311 "parse.yacc"
|
#line 312 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (printmatches == TRUE && host_matches == TRUE &&
|
if (printmatches == TRUE && host_matches == TRUE &&
|
||||||
user_matches == TRUE) {
|
user_matches == TRUE) {
|
||||||
@@ -1207,7 +1220,7 @@ case 27:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 28:
|
case 28:
|
||||||
#line 323 "parse.yacc"
|
#line 324 "parse.yacc"
|
||||||
{
|
{
|
||||||
pop;
|
pop;
|
||||||
if (cmnd_matched == TRUE)
|
if (cmnd_matched == TRUE)
|
||||||
@@ -1218,7 +1231,7 @@ case 28:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 29:
|
case 29:
|
||||||
#line 333 "parse.yacc"
|
#line 334 "parse.yacc"
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If this is the first entry in a command list
|
* If this is the first entry in a command list
|
||||||
@@ -1230,11 +1243,11 @@ case 29:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 30:
|
case 30:
|
||||||
#line 342 "parse.yacc"
|
#line 343 "parse.yacc"
|
||||||
{ ; }
|
{ ; }
|
||||||
break;
|
break;
|
||||||
case 33:
|
case 33:
|
||||||
#line 349 "parse.yacc"
|
#line 350 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (printmatches == TRUE && host_matches == TRUE &&
|
if (printmatches == TRUE && host_matches == TRUE &&
|
||||||
user_matches == TRUE)
|
user_matches == TRUE)
|
||||||
@@ -1244,7 +1257,7 @@ case 33:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 34:
|
case 34:
|
||||||
#line 356 "parse.yacc"
|
#line 357 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (printmatches == TRUE && host_matches == TRUE &&
|
if (printmatches == TRUE && host_matches == TRUE &&
|
||||||
user_matches == TRUE) {
|
user_matches == TRUE) {
|
||||||
@@ -1258,7 +1271,7 @@ case 34:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 35:
|
case 35:
|
||||||
#line 366 "parse.yacc"
|
#line 367 "parse.yacc"
|
||||||
{
|
{
|
||||||
pop;
|
pop;
|
||||||
if (runas_matched == TRUE)
|
if (runas_matched == TRUE)
|
||||||
@@ -1268,7 +1281,7 @@ case 35:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 36:
|
case 36:
|
||||||
#line 374 "parse.yacc"
|
#line 375 "parse.yacc"
|
||||||
{
|
{
|
||||||
runas_matches = (strcmp(yyvsp[0].string, runas_user) == 0);
|
runas_matches = (strcmp(yyvsp[0].string, runas_user) == 0);
|
||||||
if (printmatches == TRUE && in_alias == TRUE)
|
if (printmatches == TRUE && in_alias == TRUE)
|
||||||
@@ -1284,7 +1297,7 @@ case 36:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 37:
|
case 37:
|
||||||
#line 387 "parse.yacc"
|
#line 388 "parse.yacc"
|
||||||
{
|
{
|
||||||
runas_matches = usergr_matches(yyvsp[0].string, runas_user);
|
runas_matches = usergr_matches(yyvsp[0].string, runas_user);
|
||||||
if (printmatches == TRUE && in_alias == TRUE)
|
if (printmatches == TRUE && in_alias == TRUE)
|
||||||
@@ -1301,7 +1314,7 @@ case 37:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 38:
|
case 38:
|
||||||
#line 401 "parse.yacc"
|
#line 402 "parse.yacc"
|
||||||
{
|
{
|
||||||
runas_matches = netgr_matches(yyvsp[0].string, NULL, runas_user);
|
runas_matches = netgr_matches(yyvsp[0].string, NULL, runas_user);
|
||||||
if (printmatches == TRUE && in_alias == TRUE)
|
if (printmatches == TRUE && in_alias == TRUE)
|
||||||
@@ -1318,7 +1331,7 @@ case 38:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 39:
|
case 39:
|
||||||
#line 415 "parse.yacc"
|
#line 416 "parse.yacc"
|
||||||
{
|
{
|
||||||
/* could be an all-caps username */
|
/* could be an all-caps username */
|
||||||
if (find_alias(yyvsp[0].string, RUNAS_ALIAS) == TRUE ||
|
if (find_alias(yyvsp[0].string, RUNAS_ALIAS) == TRUE ||
|
||||||
@@ -1339,7 +1352,7 @@ case 39:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 40:
|
case 40:
|
||||||
#line 433 "parse.yacc"
|
#line 434 "parse.yacc"
|
||||||
{
|
{
|
||||||
runas_matches = TRUE;
|
runas_matches = TRUE;
|
||||||
if (printmatches == TRUE && in_alias == TRUE)
|
if (printmatches == TRUE && in_alias == TRUE)
|
||||||
@@ -1354,13 +1367,13 @@ case 40:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 41:
|
case 41:
|
||||||
#line 447 "parse.yacc"
|
#line 448 "parse.yacc"
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 42:
|
case 42:
|
||||||
#line 450 "parse.yacc"
|
#line 451 "parse.yacc"
|
||||||
{
|
{
|
||||||
no_passwd = TRUE;
|
no_passwd = TRUE;
|
||||||
if (printmatches == TRUE && host_matches == TRUE &&
|
if (printmatches == TRUE && host_matches == TRUE &&
|
||||||
@@ -1369,7 +1382,7 @@ case 42:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 43:
|
case 43:
|
||||||
#line 456 "parse.yacc"
|
#line 457 "parse.yacc"
|
||||||
{
|
{
|
||||||
no_passwd = FALSE;
|
no_passwd = FALSE;
|
||||||
if (printmatches == TRUE && host_matches == TRUE &&
|
if (printmatches == TRUE && host_matches == TRUE &&
|
||||||
@@ -1378,7 +1391,7 @@ case 43:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 44:
|
case 44:
|
||||||
#line 464 "parse.yacc"
|
#line 465 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (printmatches == TRUE && in_alias == TRUE) {
|
if (printmatches == TRUE && in_alias == TRUE) {
|
||||||
append("ALL", &ga_list[ga_list_len-1].entries,
|
append("ALL", &ga_list[ga_list_len-1].entries,
|
||||||
@@ -1400,7 +1413,7 @@ case 44:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 45:
|
case 45:
|
||||||
#line 483 "parse.yacc"
|
#line 484 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (printmatches == TRUE && in_alias == TRUE) {
|
if (printmatches == TRUE && in_alias == TRUE) {
|
||||||
append(yyvsp[0].string, &ga_list[ga_list_len-1].entries,
|
append(yyvsp[0].string, &ga_list[ga_list_len-1].entries,
|
||||||
@@ -1422,7 +1435,7 @@ case 45:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 46:
|
case 46:
|
||||||
#line 502 "parse.yacc"
|
#line 503 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (printmatches == TRUE && in_alias == TRUE) {
|
if (printmatches == TRUE && in_alias == TRUE) {
|
||||||
append(yyvsp[0].command.cmnd, &ga_list[ga_list_len-1].entries,
|
append(yyvsp[0].command.cmnd, &ga_list[ga_list_len-1].entries,
|
||||||
@@ -1458,11 +1471,11 @@ case 46:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 49:
|
case 49:
|
||||||
#line 541 "parse.yacc"
|
#line 542 "parse.yacc"
|
||||||
{ push; }
|
{ push; }
|
||||||
break;
|
break;
|
||||||
case 50:
|
case 50:
|
||||||
#line 541 "parse.yacc"
|
#line 542 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (host_matches == TRUE &&
|
if (host_matches == TRUE &&
|
||||||
add_alias(yyvsp[-3].string, HOST_ALIAS) == FALSE)
|
add_alias(yyvsp[-3].string, HOST_ALIAS) == FALSE)
|
||||||
@@ -1471,7 +1484,7 @@ case 50:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 55:
|
case 55:
|
||||||
#line 557 "parse.yacc"
|
#line 558 "parse.yacc"
|
||||||
{
|
{
|
||||||
push;
|
push;
|
||||||
if (printmatches == TRUE) {
|
if (printmatches == TRUE) {
|
||||||
@@ -1483,7 +1496,7 @@ case 55:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 56:
|
case 56:
|
||||||
#line 565 "parse.yacc"
|
#line 566 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (cmnd_matches == TRUE &&
|
if (cmnd_matches == TRUE &&
|
||||||
add_alias(yyvsp[-3].string, CMND_ALIAS) == FALSE)
|
add_alias(yyvsp[-3].string, CMND_ALIAS) == FALSE)
|
||||||
@@ -1496,11 +1509,11 @@ case 56:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 57:
|
case 57:
|
||||||
#line 577 "parse.yacc"
|
#line 578 "parse.yacc"
|
||||||
{ ; }
|
{ ; }
|
||||||
break;
|
break;
|
||||||
case 61:
|
case 61:
|
||||||
#line 585 "parse.yacc"
|
#line 586 "parse.yacc"
|
||||||
{
|
{
|
||||||
push;
|
push;
|
||||||
if (printmatches == TRUE) {
|
if (printmatches == TRUE) {
|
||||||
@@ -1512,7 +1525,7 @@ case 61:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 62:
|
case 62:
|
||||||
#line 593 "parse.yacc"
|
#line 594 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (runas_matches > 0 &&
|
if (runas_matches > 0 &&
|
||||||
add_alias(yyvsp[-3].string, RUNAS_ALIAS) == FALSE)
|
add_alias(yyvsp[-3].string, RUNAS_ALIAS) == FALSE)
|
||||||
@@ -1525,11 +1538,11 @@ case 62:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 65:
|
case 65:
|
||||||
#line 609 "parse.yacc"
|
#line 610 "parse.yacc"
|
||||||
{ push; }
|
{ push; }
|
||||||
break;
|
break;
|
||||||
case 66:
|
case 66:
|
||||||
#line 609 "parse.yacc"
|
#line 610 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (user_matches == TRUE &&
|
if (user_matches == TRUE &&
|
||||||
add_alias(yyvsp[-3].string, USER_ALIAS) == FALSE)
|
add_alias(yyvsp[-3].string, USER_ALIAS) == FALSE)
|
||||||
@@ -1539,17 +1552,17 @@ case 66:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 67:
|
case 67:
|
||||||
#line 618 "parse.yacc"
|
#line 619 "parse.yacc"
|
||||||
{ ; }
|
{ ; }
|
||||||
break;
|
break;
|
||||||
case 70:
|
case 70:
|
||||||
#line 623 "parse.yacc"
|
#line 624 "parse.yacc"
|
||||||
{
|
{
|
||||||
push;
|
push;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 71:
|
case 71:
|
||||||
#line 625 "parse.yacc"
|
#line 626 "parse.yacc"
|
||||||
{
|
{
|
||||||
pop;
|
pop;
|
||||||
if (user_matched == TRUE)
|
if (user_matched == TRUE)
|
||||||
@@ -1559,7 +1572,7 @@ case 71:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 72:
|
case 72:
|
||||||
#line 633 "parse.yacc"
|
#line 634 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (strcmp(yyvsp[0].string, user_name) == 0)
|
if (strcmp(yyvsp[0].string, user_name) == 0)
|
||||||
user_matches = TRUE;
|
user_matches = TRUE;
|
||||||
@@ -1567,7 +1580,7 @@ case 72:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 73:
|
case 73:
|
||||||
#line 638 "parse.yacc"
|
#line 639 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (usergr_matches(yyvsp[0].string, user_name))
|
if (usergr_matches(yyvsp[0].string, user_name))
|
||||||
user_matches = TRUE;
|
user_matches = TRUE;
|
||||||
@@ -1575,7 +1588,7 @@ case 73:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 74:
|
case 74:
|
||||||
#line 643 "parse.yacc"
|
#line 644 "parse.yacc"
|
||||||
{
|
{
|
||||||
if (netgr_matches(yyvsp[0].string, NULL, user_name))
|
if (netgr_matches(yyvsp[0].string, NULL, user_name))
|
||||||
user_matches = TRUE;
|
user_matches = TRUE;
|
||||||
@@ -1583,7 +1596,7 @@ case 74:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 75:
|
case 75:
|
||||||
#line 648 "parse.yacc"
|
#line 649 "parse.yacc"
|
||||||
{
|
{
|
||||||
/* could be an all-caps username */
|
/* could be an all-caps username */
|
||||||
if (find_alias(yyvsp[0].string, USER_ALIAS) == TRUE ||
|
if (find_alias(yyvsp[0].string, USER_ALIAS) == TRUE ||
|
||||||
@@ -1593,12 +1606,12 @@ case 75:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 76:
|
case 76:
|
||||||
#line 655 "parse.yacc"
|
#line 656 "parse.yacc"
|
||||||
{
|
{
|
||||||
user_matches = TRUE;
|
user_matches = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#line 1602 "sudo.tab.c"
|
#line 1615 "sudo.tab.c"
|
||||||
}
|
}
|
||||||
yyssp -= yym;
|
yyssp -= yym;
|
||||||
yystate = *yyssp;
|
yystate = *yyssp;
|
||||||
|
@@ -67,7 +67,8 @@ static const char rcsid[] = "$Sudo$";
|
|||||||
* else it returns 0.
|
* else it returns 0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int sudo_setenv(var, val)
|
int
|
||||||
|
sudo_setenv(var, val)
|
||||||
char *var;
|
char *var;
|
||||||
char *val;
|
char *val;
|
||||||
{
|
{
|
||||||
|
@@ -98,7 +98,8 @@ void dumpaliases __P((void));
|
|||||||
* Returns TRUE if "s" has shell meta characters in it,
|
* Returns TRUE if "s" has shell meta characters in it,
|
||||||
* else returns FALSE.
|
* else returns FALSE.
|
||||||
*/
|
*/
|
||||||
int has_meta(s)
|
int
|
||||||
|
has_meta(s)
|
||||||
char *s;
|
char *s;
|
||||||
{
|
{
|
||||||
register char *t;
|
register char *t;
|
||||||
@@ -115,7 +116,8 @@ int has_meta(s)
|
|||||||
* return TRUE if cmnd matches, in the sudo sense,
|
* return TRUE if cmnd matches, in the sudo sense,
|
||||||
* the pathname in path; otherwise, return FALSE
|
* the pathname in path; otherwise, return FALSE
|
||||||
*/
|
*/
|
||||||
int command_matches(cmnd, user_args, path, sudoers_args)
|
int
|
||||||
|
command_matches(cmnd, user_args, path, sudoers_args)
|
||||||
char *cmnd;
|
char *cmnd;
|
||||||
char *user_args;
|
char *user_args;
|
||||||
char *path;
|
char *path;
|
||||||
@@ -172,7 +174,8 @@ int command_matches(cmnd, user_args, path, sudoers_args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int addr_matches(n)
|
int
|
||||||
|
addr_matches(n)
|
||||||
char *n;
|
char *n;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -203,7 +206,8 @@ int addr_matches(n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int usergr_matches(group, user)
|
int
|
||||||
|
usergr_matches(group, user)
|
||||||
char *group;
|
char *group;
|
||||||
char *user;
|
char *user;
|
||||||
{
|
{
|
||||||
@@ -232,7 +236,8 @@ int usergr_matches(group, user)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int netgr_matches(netgr, host, user)
|
int
|
||||||
|
netgr_matches(netgr, host, user)
|
||||||
char *netgr;
|
char *netgr;
|
||||||
char *host;
|
char *host;
|
||||||
char *user;
|
char *user;
|
||||||
@@ -267,14 +272,16 @@ int netgr_matches(netgr, host, user)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void set_perms(i, j)
|
void
|
||||||
|
set_perms(i, j)
|
||||||
int i, j;
|
int i, j;
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(argc, argv)
|
int
|
||||||
|
main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
|
@@ -96,7 +96,8 @@ static const char rcsid[] = "$Sudo$";
|
|||||||
* and input will time out based on the value of timeout.
|
* and input will time out based on the value of timeout.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char * tgetpass(prompt, timeout)
|
char *
|
||||||
|
tgetpass(prompt, timeout)
|
||||||
const char *prompt;
|
const char *prompt;
|
||||||
int timeout;
|
int timeout;
|
||||||
{
|
{
|
||||||
|
3
utime.c
3
utime.c
@@ -53,7 +53,8 @@ static const char rcsid[] = "$Sudo$";
|
|||||||
* utime(3) sets the access and mod times of the named file.
|
* utime(3) sets the access and mod times of the named file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int utime(file, tvp)
|
int
|
||||||
|
utime(file, tvp)
|
||||||
const char *file; /* file to udpate */
|
const char *file; /* file to udpate */
|
||||||
const struct utimbuf *utp; /* what to update to */
|
const struct utimbuf *utp; /* what to update to */
|
||||||
{
|
{
|
||||||
|
30
visudo.c
30
visudo.c
@@ -125,7 +125,8 @@ struct passwd *user_pw_ent;
|
|||||||
* where it all begins...
|
* where it all begins...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int main(argc, argv)
|
int
|
||||||
|
main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
@@ -370,7 +371,8 @@ int main(argc, argv)
|
|||||||
* These exist to allow us to use the same parser as sudo(8).
|
* These exist to allow us to use the same parser as sudo(8).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int command_matches(cmnd, user_args, path, sudoers_args)
|
int
|
||||||
|
command_matches(cmnd, user_args, path, sudoers_args)
|
||||||
char *cmnd;
|
char *cmnd;
|
||||||
char *user_args;
|
char *user_args;
|
||||||
char *path;
|
char *path;
|
||||||
@@ -380,20 +382,23 @@ int command_matches(cmnd, user_args, path, sudoers_args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int addr_matches(n)
|
int
|
||||||
|
addr_matches(n)
|
||||||
char *n;
|
char *n;
|
||||||
{
|
{
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int usergr_matches(g, u)
|
int
|
||||||
|
usergr_matches(g, u)
|
||||||
char *g, *u;
|
char *g, *u;
|
||||||
{
|
{
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int netgr_matches(n, h, u)
|
int
|
||||||
|
netgr_matches(n, h, u)
|
||||||
char *n, *h, *u;
|
char *n, *h, *u;
|
||||||
{
|
{
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
@@ -407,7 +412,8 @@ int netgr_matches(n, h, u)
|
|||||||
* Prints a help message and exits w/ exit value of 1.
|
* Prints a help message and exits w/ exit value of 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void usage()
|
static void
|
||||||
|
usage()
|
||||||
{
|
{
|
||||||
(void) fprintf(stderr, "usage: %s [-V]\n", Argv[0]);
|
(void) fprintf(stderr, "usage: %s [-V]\n", Argv[0]);
|
||||||
Exit(-1);
|
Exit(-1);
|
||||||
@@ -423,7 +429,8 @@ static void usage()
|
|||||||
* A positive parameter is considered to be a signal and is reported.
|
* A positive parameter is considered to be a signal and is reported.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static RETSIGTYPE Exit(sig)
|
static RETSIGTYPE
|
||||||
|
Exit(sig)
|
||||||
int sig;
|
int sig;
|
||||||
{
|
{
|
||||||
(void) unlink(stmp);
|
(void) unlink(stmp);
|
||||||
@@ -443,7 +450,8 @@ static RETSIGTYPE Exit(sig)
|
|||||||
* to do now. Returns first letter of their choice (always lowercase).
|
* to do now. Returns first letter of their choice (always lowercase).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char whatnow()
|
static char
|
||||||
|
whatnow()
|
||||||
{
|
{
|
||||||
char choice;
|
char choice;
|
||||||
int ok;
|
int ok;
|
||||||
@@ -475,7 +483,8 @@ static char whatnow()
|
|||||||
* Print out a help message for whatnow().
|
* Print out a help message for whatnow().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void whatnow_help()
|
static void
|
||||||
|
whatnow_help()
|
||||||
{
|
{
|
||||||
(void) printf("Options are:\n");
|
(void) printf("Options are:\n");
|
||||||
(void) printf(" (e)dit sudoers file again\n");
|
(void) printf(" (e)dit sudoers file again\n");
|
||||||
@@ -491,7 +500,8 @@ static void whatnow_help()
|
|||||||
* Install signal handlers for visudo.
|
* Install signal handlers for visudo.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void setup_signals()
|
static void
|
||||||
|
setup_signals()
|
||||||
{
|
{
|
||||||
#ifdef POSIX_SIGNALS
|
#ifdef POSIX_SIGNALS
|
||||||
struct sigaction action; /* posix signal structure */
|
struct sigaction action; /* posix signal structure */
|
||||||
|
Reference in New Issue
Block a user