From 06e586ee7b81e57f22fde07cc90b1eed86bc826e Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sat, 10 Apr 1999 04:49:03 +0000 Subject: [PATCH] Function names should be flush with the start of the line so they can be found trivially in an editor and with grep --- alloc.c | 9 ++- check.c | 60 ++++++++++++------- check_sia.c | 6 +- dce_pwent.c | 6 +- find_path.c | 3 +- getspwuid.c | 9 ++- goodpath.c | 3 +- interfaces.c | 6 +- lex.yy.c | 12 ++-- logging.c | 21 ++++--- parse.c | 18 ++++-- parse.lex | 12 ++-- parse.yacc | 39 ++++++++----- putenv.c | 3 +- secureware.c | 3 +- sudo.c | 30 ++++++---- sudo.tab.c | 157 +++++++++++++++++++++++++++----------------------- sudo_setenv.c | 3 +- testsudoers.c | 21 ++++--- tgetpass.c | 3 +- utime.c | 3 +- visudo.c | 30 ++++++---- 22 files changed, 285 insertions(+), 172 deletions(-) diff --git a/alloc.c b/alloc.c index 758c7266a..59271579f 100644 --- a/alloc.c +++ b/alloc.c @@ -64,7 +64,8 @@ static const char rcsid[] = "$Sudo$"; * malloc(3) fails. */ -VOID *emalloc(size) +VOID * +emalloc(size) size_t size; { VOID *ptr; @@ -85,7 +86,8 @@ VOID *emalloc(size) * if the system realloc(3) does not support this. */ -VOID *erealloc(ptr, size) +VOID * +erealloc(ptr, size) VOID *ptr; size_t size; { @@ -105,7 +107,8 @@ VOID *erealloc(ptr, size) * malloc(3) fails. NOTE: unlike strdup(3), estrdup(NULL) is legal. */ -char *estrdup(src) +char * +estrdup(src) const char *src; { char *dst = NULL; diff --git a/check.c b/check.c index 53b615bdb..984a79b68 100644 --- a/check.c +++ b/check.c @@ -157,7 +157,8 @@ extern int xrealm; * verify who s/he is. */ -void check_user() +void +check_user() { register int rtn; mode_t oldmask; @@ -200,7 +201,8 @@ void check_user() * this function checks the user is exempt from supplying a password. */ -int user_is_exempt() +int +user_is_exempt() { #ifdef EXEMPTGROUP struct group *grp; @@ -233,7 +235,8 @@ int user_is_exempt() * TIMEOUT minutes, no password will be required */ -static int check_timestamp() +static int +check_timestamp() { register char *p; struct stat statbuf; @@ -346,7 +349,8 @@ static int check_timestamp() * via utime(2). */ -static int touch(file) +static int +touch(file) char *file; { #if defined(HAVE_UTIME) && !defined(HAVE_UTIME_NULL) @@ -379,7 +383,8 @@ static int touch(file) * This function changes the timestamp to "now" */ -static void update_timestamp() +static void +update_timestamp() { if (timedir_is_good) { /* become root */ @@ -408,7 +413,8 @@ static void update_timestamp() * This function removes the timestamp ticket file */ -void remove_timestamp() +void +remove_timestamp() { #ifdef USE_TTY_TICKETS char *p; @@ -456,7 +462,8 @@ void remove_timestamp() */ #ifdef HAVE_SECURID -static void check_passwd() +static void +check_passwd() { struct SD_CLIENT sd_dat, *sd; /* SecurID data block */ register int counter = TRIES_FOR_PASSWORD; @@ -498,7 +505,8 @@ static void check_passwd() } #else /* !HAVE_SECURID */ #ifdef HAVE_AUTHSRV -static void check_passwd() +static void +check_passwd() { char *pass; /* this is what gets entered */ Cfg *confp; @@ -581,7 +589,8 @@ static void check_passwd() } #else /* !HAVE_AUTHSRV */ -static void check_passwd() +static void +check_passwd() { char *pass; /* this is what gets entered */ int counter = TRIES_FOR_PASSWORD; @@ -739,7 +748,8 @@ static void check_passwd() * * Validate a user via kerberos. */ -static int sudo_krb_validate_user(pw, pass) +static int +sudo_krb_validate_user(pw, pass) struct passwd *pw; 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 * 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; char *pass; { @@ -852,7 +863,8 @@ static int sudo_krb5_validate_user(pw, pass) * * 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; { char phost[BUFSIZ]; @@ -935,7 +947,8 @@ cleanup: static char *PAM_username; 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; PAM_CONST struct pam_message **msg; struct pam_response **resp; @@ -978,7 +991,8 @@ static int PAM_conv(num_msg, msg, resp, appdata_ptr) return(PAM_SUCCESS); } -static int pam_auth(user, password) +static int +pam_auth(user, password) char *user; char *password; { @@ -1010,7 +1024,8 @@ static int pam_auth(user, password) return(1); } -static void pam_attempt_auth() +static void +pam_attempt_auth() { 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. */ -static char *sudo_skeyprompt(user_skey, p) +static char * +sudo_skeyprompt(user_skey, p) struct skey *user_skey; char *p; { @@ -1117,7 +1133,8 @@ static char *sudo_skeyprompt(user_skey, p) * 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; char *p; { @@ -1182,7 +1199,8 @@ static char *sudo_opieprompt(user_opie, p) * this function just prints the the reminder message */ -static void reminder() +static void +reminder() { #ifdef SHORT_MESSAGE (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). */ -void pass_warn(fp) +void +pass_warn(fp) FILE *fp; { @@ -1230,7 +1249,8 @@ void pass_warn(fp) * 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 *user; char *host; diff --git a/check_sia.c b/check_sia.c index 54c4b12b1..45f8c2681 100644 --- a/check_sia.c +++ b/check_sia.c @@ -66,7 +66,8 @@ static int tcollect __P((int, int, uchar_t *, int, prompt_t *)); * Collection routine (callback) for limiting the timeouts in SIA * prompts. */ -static int tcollect(timeout, rendition, title, nprompts, prompts) +static int +tcollect(timeout, rendition, title, nprompts, prompts) int timeout; int rendition; uchar_t *title; @@ -100,7 +101,8 @@ static int tcollect(timeout, rendition, title, nprompts, prompts) * Try to authenticate the user using Security Integration Architecture * (SIA). Added 9/26/98 by Spider Boardman */ -void sia_attempt_auth() +void +sia_attempt_auth() { SIAENTITY *siah = NULL; int retval; diff --git a/dce_pwent.c b/dce_pwent.c index a894aa562..c1e108a99 100644 --- a/dce_pwent.c +++ b/dce_pwent.c @@ -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 */ -int dce_pwent(username, plain_pw) +int +dce_pwent(username, plain_pw) char *username; char *plain_pw; { @@ -183,7 +184,8 @@ char *plain_pw; } /* 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; char *comment; { diff --git a/find_path.c b/find_path.c index 8fea324d8..84e81f221 100644 --- a/find_path.c +++ b/find_path.c @@ -82,7 +82,8 @@ static const char rcsid[] = "$Sudo$"; * 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 **outfile; /* result parameter */ { diff --git a/getspwuid.c b/getspwuid.c index cf586e006..0e718d753 100644 --- a/getspwuid.c +++ b/getspwuid.c @@ -99,7 +99,8 @@ static char *sudo_getepw __P((struct passwd *)); * SHELL evariable or the passwd(5) entry (in that order). */ -static char *sudo_getshell(pw) +static char * +sudo_getshell(pw) struct passwd *pw; { char *pw_shell; @@ -126,7 +127,8 @@ static char *sudo_getshell(pw) * normal UN*X password is returned instead. */ -static char *sudo_getepw(pw) +static char * +sudo_getepw(pw) struct passwd *pw; { @@ -200,7 +202,8 @@ static char *sudo_getepw(pw) * are in use, it substitutes the shadow password for pw_passwd. */ -struct passwd *sudo_getpwuid(uid) +struct passwd * +sudo_getpwuid(uid) uid_t uid; { struct passwd *pw, *local_pw; diff --git a/goodpath.c b/goodpath.c index c9fe0a262..93d334c4a 100644 --- a/goodpath.c +++ b/goodpath.c @@ -65,7 +65,8 @@ static const char rcsid[] = "$Sudo$"; * that is a normal file and executable by root. */ -char * sudo_goodpath(path) +char * +sudo_goodpath(path) const char * path; { struct stat statbuf; /* for stat(2) */ diff --git a/interfaces.c b/interfaces.c index 93d3ea4e3..a6899cce7 100644 --- a/interfaces.c +++ b/interfaces.c @@ -94,7 +94,8 @@ extern char **Argv; * and sets the constituent ip addrs and netmasks. */ -void load_interfaces() +void +load_interfaces() { struct ifconf *ifconf; struct ifreq *ifr, ifr_tmp; @@ -246,7 +247,8 @@ void load_interfaces() * Stub function for those without SIOCGIFCONF */ -void load_interfaces() +void +load_interfaces() { return; } diff --git a/lex.yy.c b/lex.yy.c index 663ef3dd6..1667083d3 100644 --- a/lex.yy.c +++ b/lex.yy.c @@ -1992,7 +1992,8 @@ int main() #endif #line 269 "parse.lex" -static void fill(s, len) +static void +fill(s, len) char *s; 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; 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; int len; int addspace; @@ -2071,7 +2074,8 @@ static void fill_args(s, len, addspace) } -int yywrap() +int +yywrap() { #ifdef YY_NEW_FILE YY_NEW_FILE; diff --git a/logging.c b/logging.c index d70d85b4f..ff1174513 100644 --- a/logging.c +++ b/logging.c @@ -90,7 +90,8 @@ extern int errorlineno; * 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; char *fmt; char *arg1; @@ -116,7 +117,8 @@ static void syslog_wrapper(pri, fmt, arg1, arg2) * syslogs the error or writes it to the log file */ -void log_error(code) +void +log_error(code) int code; { char *p; @@ -448,7 +450,8 @@ void log_error(code) static char *mail_argv[] = { "sendmail", "-t", (char *) NULL }; -static void send_mail() +static void +send_mail() { char *mailer = _PATH_SENDMAIL; char *subject = MAILSUBJECT; @@ -526,7 +529,8 @@ static void send_mail() } } #else -static void send_mail() +static void +send_mail() { /* no mailer defined */ return; @@ -542,7 +546,8 @@ static void send_mail() * This function gets rid of all the ugly zombies */ -static RETSIGTYPE reapchild(sig) +static RETSIGTYPE +reapchild(sig) int sig; { int pid, status, save_errno = errno; @@ -570,7 +575,8 @@ static RETSIGTYPE reapchild(sig) * when an error occurs */ -void inform_user(code) +void +inform_user(code) int code; { switch (code) { @@ -689,7 +695,8 @@ void inform_user(code) * This function determines whether to send mail or not... */ -static int appropriate(code) +static int +appropriate(code) int code; { diff --git a/parse.c b/parse.c index 49031e3fa..c1b0d94ac 100644 --- a/parse.c +++ b/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 * the user, host and command triplet. */ -int validate(check_cmnd) +int +validate(check_cmnd) int check_cmnd; { 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; * 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 *user_args; 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 * "n" is a network that we are on, else returns FALSE. */ -int addr_matches(n) +int +addr_matches(n) char *n; { int i; @@ -366,7 +369,8 @@ int addr_matches(n) * Returns TRUE if the given user belongs to the named group, * else returns FALSE. */ -int usergr_matches(group, user) +int +usergr_matches(group, user) char *group; char *user; { @@ -405,7 +409,8 @@ int usergr_matches(group, user) * else return FALSE. Either of "host" or "user" may be NULL * in which case that argument is not checked... */ -int netgr_matches(netgr, host, user) +int +netgr_matches(netgr, host, user) char *netgr; char *host; char *user; @@ -444,7 +449,8 @@ int netgr_matches(netgr, host, user) * Returns TRUE if "s" has shell meta characters in it, * else returns FALSE. */ -static int has_meta(s) +static int +has_meta(s) char *s; { register char *t; diff --git a/parse.lex b/parse.lex index 28bd80bc7..e92402b53 100644 --- a/parse.lex +++ b/parse.lex @@ -267,7 +267,8 @@ PASSWD[[:blank:]]*: { } /* parse error */ %% -static void fill(s, len) +static void +fill(s, len) char *s; 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; 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; int len; int addspace; @@ -346,7 +349,8 @@ static void fill_args(s, len, addspace) } -int yywrap() +int +yywrap() { #ifdef YY_NEW_FILE YY_NEW_FILE; diff --git a/parse.yacc b/parse.yacc index a8bc13da9..e181c3808 100644 --- a/parse.yacc +++ b/parse.yacc @@ -153,7 +153,8 @@ static void expand_match_list __P((void)); void init_parser __P((void)); void yyerror __P((char *)); -void yyerror(s) +void +yyerror(s) char *s; { /* save the line the first error occured on */ @@ -678,7 +679,8 @@ size_t nslots = 0; * This function compares two aliasinfo structures. */ -static int aliascmp(a1, a2) +static int +aliascmp(a1, a2) const VOID *a1, *a2; { int r; @@ -701,7 +703,8 @@ static int aliascmp(a1, a2) * This function compares two generic_alias structures. */ -static int genaliascmp(entry, key) +static int +genaliascmp(entry, key) const VOID *entry, *key; { struct generic_alias *ga1 = (struct generic_alias *) key; @@ -719,7 +722,8 @@ static int genaliascmp(entry, key) * aliases list. */ -static int add_alias(alias, type) +static int +add_alias(alias, type) char *alias; int type; { @@ -765,7 +769,8 @@ static int add_alias(alias, 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; int type; { @@ -786,7 +791,8 @@ static int find_alias(alias, type) * This function allocates more space for the aliases list. */ -static int more_aliases() +static int +more_aliases() { nslots += MOREALIASES; if (nslots == MOREALIASES) @@ -805,7 +811,8 @@ static int more_aliases() * This function lists the contents of the aliases list. */ -void dumpaliases() +void +dumpaliases() { size_t n; @@ -840,7 +847,8 @@ void dumpaliases() * `sudo -l'. */ -void list_matches() +void +list_matches() { int i; char *p; @@ -910,7 +918,8 @@ void list_matches() * 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; size_t *dst_len, *dst_size; int separator; @@ -953,7 +962,8 @@ static void append(src, dstp, dst_len, dst_size, separator) * the associated counters. */ -void reset_aliases() +void +reset_aliases() { if (aliases) { free(aliases); @@ -970,7 +980,8 @@ void reset_aliases() * 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) { 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. */ -static void expand_match_list() +static void +expand_match_list() { if (++cm_list_len >= cm_list_size) { while ((cm_list_size += STACKINCREMENT) < cm_list_len) @@ -1014,7 +1026,8 @@ static void expand_match_list() * 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. */ if (match) { diff --git a/putenv.c b/putenv.c index 926c04b16..aa8a5c6a9 100644 --- a/putenv.c +++ b/putenv.c @@ -60,7 +60,8 @@ static const char rcsid[] = "$Sudo$"; * Note that this string becomes a part of the environment. */ -int putenv(str) +int +putenv(str) const char *str; { char **current; diff --git a/secureware.c b/secureware.c index d6320ad28..f85ad38bb 100644 --- a/secureware.c +++ b/secureware.c @@ -68,7 +68,8 @@ static const char rcsid[] = "$Sudo$"; * using the SecureWare crypt functions. Returns 1 on a match, else 0. */ -int check_secureware(pass) +int +check_secureware(pass) char *pass; { #ifdef __alpha diff --git a/sudo.c b/sudo.c index 2df77a1ba..343b84820 100644 --- a/sudo.c +++ b/sudo.c @@ -173,7 +173,8 @@ struct env_table badenv_table[] = { * the driving force behind sudo... */ -int main(argc, argv) +int +main(argc, argv) int argc; char **argv; { @@ -389,7 +390,8 @@ int main(argc, argv) * user_pw_ent, host, cwd, interfaces. */ -static void load_globals(sudo_mode) +static void +load_globals(sudo_mode) int sudo_mode; { char *p; @@ -546,7 +548,8 @@ static void load_globals(sudo_mode) * 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 excl = 0; /* exclusive arg, no others allowed */ @@ -687,7 +690,8 @@ static int parse_args() * Tell which options are mutually exclusive and exit */ -static void usage_excl(exit_val) +static void +usage_excl(exit_val) int exit_val; { (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 */ -static void usage(exit_val) +static void +usage(exit_val) int exit_val; { (void) fprintf(stderr, @@ -723,7 +728,8 @@ static void usage(exit_val) * this function adds sudo-specific variables into the environment */ -static void add_env(contiguous) +static void +add_env(contiguous) int contiguous; { char idstr[MAX_UID_T_LEN + 1]; @@ -811,7 +817,8 @@ static void add_env(contiguous) * Returns 1 on success, 0 on failure. */ -static int load_cmnd(sudo_mode) +static int +load_cmnd(sudo_mode) int sudo_mode; { int retval; @@ -841,7 +848,8 @@ static int load_cmnd(sudo_mode) * uid SUDOERS_UID, gid SUDOERS_GID and is mode SUDOERS_MODE. */ -static int check_sudoers() +static int +check_sudoers() { struct stat statbuf; int rootstat, i; @@ -928,7 +936,8 @@ static int check_sudoers() * 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 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. */ -static void clean_env(envp, badenv_table) +static void +clean_env(envp, badenv_table) char **envp; struct env_table *badenv_table; { diff --git a/sudo.tab.c b/sudo.tab.c index 6de5ac87e..6254e523e 100644 --- a/sudo.tab.c +++ b/sudo.tab.c @@ -171,7 +171,8 @@ static void expand_match_list __P((void)); void init_parser __P((void)); void yyerror __P((char *)); -void yyerror(s) +void +yyerror(s) char *s; { /* save the line the first error occured on */ @@ -185,14 +186,14 @@ void yyerror(s) #endif parse_error = TRUE; } -#line 172 "parse.yacc" +#line 173 "parse.yacc" typedef union { char *string; int BOOLEAN; struct sudo_command command; int tok; } YYSTYPE; -#line 196 "sudo.tab.c" +#line 197 "sudo.tab.c" #define ALIAS 257 #define NTWKADDR 258 #define FQHOST 259 @@ -497,7 +498,7 @@ short *yyss; short *yysslim; YYSTYPE *yyvs; int yystacksize; -#line 661 "parse.yacc" +#line 662 "parse.yacc" typedef struct { @@ -518,7 +519,8 @@ size_t nslots = 0; * This function compares two aliasinfo structures. */ -static int aliascmp(a1, a2) +static int +aliascmp(a1, a2) const VOID *a1, *a2; { int r; @@ -541,7 +543,8 @@ static int aliascmp(a1, a2) * This function compares two generic_alias structures. */ -static int genaliascmp(entry, key) +static int +genaliascmp(entry, key) const VOID *entry, *key; { struct generic_alias *ga1 = (struct generic_alias *) key; @@ -559,7 +562,8 @@ static int genaliascmp(entry, key) * aliases list. */ -static int add_alias(alias, type) +static int +add_alias(alias, type) char *alias; int type; { @@ -605,7 +609,8 @@ static int add_alias(alias, 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; int type; { @@ -626,7 +631,8 @@ static int find_alias(alias, type) * This function allocates more space for the aliases list. */ -static int more_aliases() +static int +more_aliases() { nslots += MOREALIASES; if (nslots == MOREALIASES) @@ -645,7 +651,8 @@ static int more_aliases() * This function lists the contents of the aliases list. */ -void dumpaliases() +void +dumpaliases() { size_t n; @@ -680,7 +687,8 @@ void dumpaliases() * `sudo -l'. */ -void list_matches() +void +list_matches() { int i; char *p; @@ -750,7 +758,8 @@ void list_matches() * 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; size_t *dst_len, *dst_size; int separator; @@ -793,7 +802,8 @@ static void append(src, dstp, dst_len, dst_size, separator) * the associated counters. */ -void reset_aliases() +void +reset_aliases() { if (aliases) { free(aliases); @@ -810,7 +820,8 @@ void reset_aliases() * 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) { 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. */ -static void expand_match_list() +static void +expand_match_list() { if (++cm_list_len >= cm_list_size) { while ((cm_list_size += STACKINCREMENT) < cm_list_len) @@ -854,7 +866,8 @@ static void expand_match_list() * 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. */ if (match) { @@ -874,7 +887,7 @@ void init_parser() if (printmatches == TRUE) expand_match_list(); } -#line 878 "sudo.tab.c" +#line 891 "sudo.tab.c" /* allocate initial stack or double stack size, up to YYMAXDEPTH */ #if defined(__cplusplus) || __STDC__ static int yygrowstack(void) @@ -1055,19 +1068,19 @@ yyreduce: switch (yyn) { case 3: -#line 210 "parse.yacc" +#line 211 "parse.yacc" { ; } break; case 4: -#line 212 "parse.yacc" +#line 213 "parse.yacc" { yyerrok; } break; case 5: -#line 213 "parse.yacc" +#line 214 "parse.yacc" { push; } break; case 6: -#line 213 "parse.yacc" +#line 214 "parse.yacc" { while (top && user_matches != TRUE) { pop; @@ -1075,23 +1088,23 @@ case 6: } break; case 7: -#line 219 "parse.yacc" +#line 220 "parse.yacc" { ; } break; case 8: -#line 221 "parse.yacc" +#line 222 "parse.yacc" { ; } break; case 9: -#line 223 "parse.yacc" +#line 224 "parse.yacc" { ; } break; case 10: -#line 225 "parse.yacc" +#line 226 "parse.yacc" { ; } break; case 13: -#line 233 "parse.yacc" +#line 234 "parse.yacc" { /* * We already did a push if necessary in @@ -1104,13 +1117,13 @@ case 13: } break; case 15: -#line 246 "parse.yacc" +#line 247 "parse.yacc" { push; } break; case 16: -#line 248 "parse.yacc" +#line 249 "parse.yacc" { pop; if (host_matched == TRUE) @@ -1120,13 +1133,13 @@ case 16: } break; case 17: -#line 256 "parse.yacc" +#line 257 "parse.yacc" { host_matches = TRUE; } break; case 18: -#line 259 "parse.yacc" +#line 260 "parse.yacc" { if (addr_matches(yyvsp[0].string)) host_matches = TRUE; @@ -1134,7 +1147,7 @@ case 18: } break; case 19: -#line 264 "parse.yacc" +#line 265 "parse.yacc" { if (netgr_matches(yyvsp[0].string, host, NULL)) host_matches = TRUE; @@ -1142,7 +1155,7 @@ case 19: } break; case 20: -#line 269 "parse.yacc" +#line 270 "parse.yacc" { if (strcasecmp(shost, yyvsp[0].string) == 0) host_matches = TRUE; @@ -1150,7 +1163,7 @@ case 20: } break; case 21: -#line 274 "parse.yacc" +#line 275 "parse.yacc" { if (strcasecmp(host, yyvsp[0].string) == 0) host_matches = TRUE; @@ -1158,7 +1171,7 @@ case 21: } break; case 22: -#line 279 "parse.yacc" +#line 280 "parse.yacc" { /* could be an all-caps hostname */ if (find_alias(yyvsp[0].string, HOST_ALIAS) == TRUE || @@ -1168,7 +1181,7 @@ case 22: } break; case 25: -#line 292 "parse.yacc" +#line 293 "parse.yacc" { if (printmatches == TRUE && (runas_matches == -1 || cmnd_matches == -1)) { @@ -1187,11 +1200,11 @@ case 25: } break; case 26: -#line 310 "parse.yacc" +#line 311 "parse.yacc" { ; } break; case 27: -#line 311 "parse.yacc" +#line 312 "parse.yacc" { if (printmatches == TRUE && host_matches == TRUE && user_matches == TRUE) { @@ -1207,7 +1220,7 @@ case 27: } break; case 28: -#line 323 "parse.yacc" +#line 324 "parse.yacc" { pop; if (cmnd_matched == TRUE) @@ -1218,7 +1231,7 @@ case 28: } break; case 29: -#line 333 "parse.yacc" +#line 334 "parse.yacc" { /* * If this is the first entry in a command list @@ -1230,11 +1243,11 @@ case 29: } break; case 30: -#line 342 "parse.yacc" +#line 343 "parse.yacc" { ; } break; case 33: -#line 349 "parse.yacc" +#line 350 "parse.yacc" { if (printmatches == TRUE && host_matches == TRUE && user_matches == TRUE) @@ -1244,7 +1257,7 @@ case 33: } break; case 34: -#line 356 "parse.yacc" +#line 357 "parse.yacc" { if (printmatches == TRUE && host_matches == TRUE && user_matches == TRUE) { @@ -1258,7 +1271,7 @@ case 34: } break; case 35: -#line 366 "parse.yacc" +#line 367 "parse.yacc" { pop; if (runas_matched == TRUE) @@ -1268,7 +1281,7 @@ case 35: } break; case 36: -#line 374 "parse.yacc" +#line 375 "parse.yacc" { runas_matches = (strcmp(yyvsp[0].string, runas_user) == 0); if (printmatches == TRUE && in_alias == TRUE) @@ -1284,7 +1297,7 @@ case 36: } break; case 37: -#line 387 "parse.yacc" +#line 388 "parse.yacc" { runas_matches = usergr_matches(yyvsp[0].string, runas_user); if (printmatches == TRUE && in_alias == TRUE) @@ -1301,7 +1314,7 @@ case 37: } break; case 38: -#line 401 "parse.yacc" +#line 402 "parse.yacc" { runas_matches = netgr_matches(yyvsp[0].string, NULL, runas_user); if (printmatches == TRUE && in_alias == TRUE) @@ -1318,7 +1331,7 @@ case 38: } break; case 39: -#line 415 "parse.yacc" +#line 416 "parse.yacc" { /* could be an all-caps username */ if (find_alias(yyvsp[0].string, RUNAS_ALIAS) == TRUE || @@ -1339,7 +1352,7 @@ case 39: } break; case 40: -#line 433 "parse.yacc" +#line 434 "parse.yacc" { runas_matches = TRUE; if (printmatches == TRUE && in_alias == TRUE) @@ -1354,13 +1367,13 @@ case 40: } break; case 41: -#line 447 "parse.yacc" +#line 448 "parse.yacc" { ; } break; case 42: -#line 450 "parse.yacc" +#line 451 "parse.yacc" { no_passwd = TRUE; if (printmatches == TRUE && host_matches == TRUE && @@ -1369,7 +1382,7 @@ case 42: } break; case 43: -#line 456 "parse.yacc" +#line 457 "parse.yacc" { no_passwd = FALSE; if (printmatches == TRUE && host_matches == TRUE && @@ -1378,7 +1391,7 @@ case 43: } break; case 44: -#line 464 "parse.yacc" +#line 465 "parse.yacc" { if (printmatches == TRUE && in_alias == TRUE) { append("ALL", &ga_list[ga_list_len-1].entries, @@ -1400,7 +1413,7 @@ case 44: } break; case 45: -#line 483 "parse.yacc" +#line 484 "parse.yacc" { if (printmatches == TRUE && in_alias == TRUE) { append(yyvsp[0].string, &ga_list[ga_list_len-1].entries, @@ -1422,7 +1435,7 @@ case 45: } break; case 46: -#line 502 "parse.yacc" +#line 503 "parse.yacc" { if (printmatches == TRUE && in_alias == TRUE) { append(yyvsp[0].command.cmnd, &ga_list[ga_list_len-1].entries, @@ -1458,11 +1471,11 @@ case 46: } break; case 49: -#line 541 "parse.yacc" +#line 542 "parse.yacc" { push; } break; case 50: -#line 541 "parse.yacc" +#line 542 "parse.yacc" { if (host_matches == TRUE && add_alias(yyvsp[-3].string, HOST_ALIAS) == FALSE) @@ -1471,7 +1484,7 @@ case 50: } break; case 55: -#line 557 "parse.yacc" +#line 558 "parse.yacc" { push; if (printmatches == TRUE) { @@ -1483,7 +1496,7 @@ case 55: } break; case 56: -#line 565 "parse.yacc" +#line 566 "parse.yacc" { if (cmnd_matches == TRUE && add_alias(yyvsp[-3].string, CMND_ALIAS) == FALSE) @@ -1496,11 +1509,11 @@ case 56: } break; case 57: -#line 577 "parse.yacc" +#line 578 "parse.yacc" { ; } break; case 61: -#line 585 "parse.yacc" +#line 586 "parse.yacc" { push; if (printmatches == TRUE) { @@ -1512,7 +1525,7 @@ case 61: } break; case 62: -#line 593 "parse.yacc" +#line 594 "parse.yacc" { if (runas_matches > 0 && add_alias(yyvsp[-3].string, RUNAS_ALIAS) == FALSE) @@ -1525,11 +1538,11 @@ case 62: } break; case 65: -#line 609 "parse.yacc" +#line 610 "parse.yacc" { push; } break; case 66: -#line 609 "parse.yacc" +#line 610 "parse.yacc" { if (user_matches == TRUE && add_alias(yyvsp[-3].string, USER_ALIAS) == FALSE) @@ -1539,17 +1552,17 @@ case 66: } break; case 67: -#line 618 "parse.yacc" +#line 619 "parse.yacc" { ; } break; case 70: -#line 623 "parse.yacc" +#line 624 "parse.yacc" { push; } break; case 71: -#line 625 "parse.yacc" +#line 626 "parse.yacc" { pop; if (user_matched == TRUE) @@ -1559,7 +1572,7 @@ case 71: } break; case 72: -#line 633 "parse.yacc" +#line 634 "parse.yacc" { if (strcmp(yyvsp[0].string, user_name) == 0) user_matches = TRUE; @@ -1567,7 +1580,7 @@ case 72: } break; case 73: -#line 638 "parse.yacc" +#line 639 "parse.yacc" { if (usergr_matches(yyvsp[0].string, user_name)) user_matches = TRUE; @@ -1575,7 +1588,7 @@ case 73: } break; case 74: -#line 643 "parse.yacc" +#line 644 "parse.yacc" { if (netgr_matches(yyvsp[0].string, NULL, user_name)) user_matches = TRUE; @@ -1583,7 +1596,7 @@ case 74: } break; case 75: -#line 648 "parse.yacc" +#line 649 "parse.yacc" { /* could be an all-caps username */ if (find_alias(yyvsp[0].string, USER_ALIAS) == TRUE || @@ -1593,12 +1606,12 @@ case 75: } break; case 76: -#line 655 "parse.yacc" +#line 656 "parse.yacc" { user_matches = TRUE; } break; -#line 1602 "sudo.tab.c" +#line 1615 "sudo.tab.c" } yyssp -= yym; yystate = *yyssp; diff --git a/sudo_setenv.c b/sudo_setenv.c index 60d44da9e..963cad4ad 100644 --- a/sudo_setenv.c +++ b/sudo_setenv.c @@ -67,7 +67,8 @@ static const char rcsid[] = "$Sudo$"; * else it returns 0. */ -int sudo_setenv(var, val) +int +sudo_setenv(var, val) char *var; char *val; { diff --git a/testsudoers.c b/testsudoers.c index 8f03721b5..9d58ffbee 100644 --- a/testsudoers.c +++ b/testsudoers.c @@ -98,7 +98,8 @@ void dumpaliases __P((void)); * Returns TRUE if "s" has shell meta characters in it, * else returns FALSE. */ -int has_meta(s) +int +has_meta(s) char *s; { register char *t; @@ -115,7 +116,8 @@ int has_meta(s) * return TRUE if cmnd matches, in the sudo sense, * 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 *user_args; 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; { int i; @@ -203,7 +206,8 @@ int addr_matches(n) } -int usergr_matches(group, user) +int +usergr_matches(group, user) char *group; 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 *host; 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; { return; } -int main(argc, argv) +int +main(argc, argv) int argc; char **argv; { diff --git a/tgetpass.c b/tgetpass.c index 6986a85e7..b28ddb107 100644 --- a/tgetpass.c +++ b/tgetpass.c @@ -96,7 +96,8 @@ static const char rcsid[] = "$Sudo$"; * and input will time out based on the value of timeout. */ -char * tgetpass(prompt, timeout) +char * +tgetpass(prompt, timeout) const char *prompt; int timeout; { diff --git a/utime.c b/utime.c index 654d69086..39dc5c81a 100644 --- a/utime.c +++ b/utime.c @@ -53,7 +53,8 @@ static const char rcsid[] = "$Sudo$"; * 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 struct utimbuf *utp; /* what to update to */ { diff --git a/visudo.c b/visudo.c index b3971df69..b7d309aa0 100644 --- a/visudo.c +++ b/visudo.c @@ -125,7 +125,8 @@ struct passwd *user_pw_ent; * where it all begins... */ -int main(argc, argv) +int +main(argc, argv) int argc; char **argv; { @@ -370,7 +371,8 @@ int main(argc, argv) * 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 *user_args; 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; { return(TRUE); } -int usergr_matches(g, u) +int +usergr_matches(g, u) char *g, *u; { return(TRUE); } -int netgr_matches(n, h, u) +int +netgr_matches(n, h, u) char *n, *h, *u; { return(TRUE); @@ -407,7 +412,8 @@ int netgr_matches(n, h, u) * 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]); Exit(-1); @@ -423,7 +429,8 @@ static void usage() * A positive parameter is considered to be a signal and is reported. */ -static RETSIGTYPE Exit(sig) +static RETSIGTYPE +Exit(sig) int sig; { (void) unlink(stmp); @@ -443,7 +450,8 @@ static RETSIGTYPE Exit(sig) * to do now. Returns first letter of their choice (always lowercase). */ -static char whatnow() +static char +whatnow() { char choice; int ok; @@ -475,7 +483,8 @@ static char whatnow() * Print out a help message for whatnow(). */ -static void whatnow_help() +static void +whatnow_help() { (void) printf("Options are:\n"); (void) printf(" (e)dit sudoers file again\n"); @@ -491,7 +500,8 @@ static void whatnow_help() * Install signal handlers for visudo. */ -static void setup_signals() +static void +setup_signals() { #ifdef POSIX_SIGNALS struct sigaction action; /* posix signal structure */ -- 2.50.1