mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-01 06:45:10 +00:00
standardize on "return foo;" rather than "return(foo);" or "return (foo);"
This commit is contained in:
@@ -141,14 +141,14 @@ _userlist_matches(struct passwd *pw, struct member_list *list)
|
||||
if (matched != UNSPEC)
|
||||
break;
|
||||
}
|
||||
return(matched);
|
||||
return matched;
|
||||
}
|
||||
|
||||
int
|
||||
userlist_matches(struct passwd *pw, struct member_list *list)
|
||||
{
|
||||
alias_seqno++;
|
||||
return(_userlist_matches(pw, list));
|
||||
return _userlist_matches(pw, list);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -168,7 +168,7 @@ _runaslist_matches(struct member_list *user_list, struct member_list *group_list
|
||||
if (runas_pw != NULL) {
|
||||
/* If no runas user or runas group listed in sudoers, use default. */
|
||||
if (tq_empty(user_list) && tq_empty(group_list))
|
||||
return(userpw_matches(def_runas_default, runas_pw->pw_name, runas_pw));
|
||||
return userpw_matches(def_runas_default, runas_pw->pw_name, runas_pw);
|
||||
|
||||
tq_foreach_rev(user_list, m) {
|
||||
switch (m->type) {
|
||||
@@ -230,10 +230,10 @@ _runaslist_matches(struct member_list *user_list, struct member_list *group_list
|
||||
}
|
||||
|
||||
if (user_matched == DENY || group_matched == DENY)
|
||||
return(DENY);
|
||||
return DENY;
|
||||
if (user_matched == group_matched || runas_gr == NULL)
|
||||
return(user_matched);
|
||||
return(UNSPEC);
|
||||
return user_matched;
|
||||
return UNSPEC;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -284,14 +284,14 @@ _hostlist_matches(struct member_list *list)
|
||||
if (matched != UNSPEC)
|
||||
break;
|
||||
}
|
||||
return(matched);
|
||||
return matched;
|
||||
}
|
||||
|
||||
int
|
||||
hostlist_matches(struct member_list *list)
|
||||
{
|
||||
alias_seqno++;
|
||||
return(_hostlist_matches(list));
|
||||
return _hostlist_matches(list);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -309,14 +309,14 @@ _cmndlist_matches(struct member_list *list)
|
||||
if (matched != UNSPEC)
|
||||
break;
|
||||
}
|
||||
return(matched);
|
||||
return matched;
|
||||
}
|
||||
|
||||
int
|
||||
cmndlist_matches(struct member_list *list)
|
||||
{
|
||||
alias_seqno++;
|
||||
return(_cmndlist_matches(list));
|
||||
return _cmndlist_matches(list);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -348,7 +348,7 @@ cmnd_matches(struct member *m)
|
||||
matched = !m->negated;
|
||||
break;
|
||||
}
|
||||
return(matched);
|
||||
return matched;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -396,13 +396,13 @@ command_matches(char *sudoers_cmnd, char *sudoers_args)
|
||||
*/
|
||||
if (strcmp(sudoers_cmnd, "sudoedit") != 0 ||
|
||||
strcmp(user_cmnd, "sudoedit") != 0)
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
if (command_args_match(sudoers_cmnd, sudoers_args)) {
|
||||
efree(safe_cmnd);
|
||||
safe_cmnd = estrdup(sudoers_cmnd);
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
} else
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (has_meta(sudoers_cmnd)) {
|
||||
@@ -411,10 +411,10 @@ command_matches(char *sudoers_cmnd, char *sudoers_args)
|
||||
* use glob(3) and/or fnmatch(3) to do the matching.
|
||||
*/
|
||||
if (def_fast_glob)
|
||||
return(command_matches_fnmatch(sudoers_cmnd, sudoers_args));
|
||||
return(command_matches_glob(sudoers_cmnd, sudoers_args));
|
||||
return command_matches_fnmatch(sudoers_cmnd, sudoers_args);
|
||||
return command_matches_glob(sudoers_cmnd, sudoers_args);
|
||||
}
|
||||
return(command_matches_normal(sudoers_cmnd, sudoers_args));
|
||||
return command_matches_normal(sudoers_cmnd, sudoers_args);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -428,14 +428,14 @@ command_matches_fnmatch(char *sudoers_cmnd, char *sudoers_args)
|
||||
* else return false.
|
||||
*/
|
||||
if (fnmatch(sudoers_cmnd, user_cmnd, FNM_PATHNAME) != 0)
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
if (command_args_match(sudoers_cmnd, sudoers_args)) {
|
||||
if (safe_cmnd)
|
||||
free(safe_cmnd);
|
||||
safe_cmnd = estrdup(user_cmnd);
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
} else
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -456,7 +456,7 @@ command_matches_glob(char *sudoers_cmnd, char *sudoers_args)
|
||||
if ((base = strrchr(sudoers_cmnd, '/')) != NULL) {
|
||||
base++;
|
||||
if (!has_meta(base) && strcmp(user_base, base) != 0)
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
@@ -469,7 +469,7 @@ command_matches_glob(char *sudoers_cmnd, char *sudoers_args)
|
||||
#define GLOB_FLAGS (GLOB_NOSORT | GLOB_MARK | GLOB_BRACE | GLOB_TILDE)
|
||||
if (glob(sudoers_cmnd, GLOB_FLAGS, NULL, &gl) != 0 || gl.gl_pathc == 0) {
|
||||
globfree(&gl);
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
/* For each glob match, compare basename, st_dev and st_ino. */
|
||||
for (ap = gl.gl_pathv; (cp = *ap) != NULL; ap++) {
|
||||
@@ -477,7 +477,7 @@ command_matches_glob(char *sudoers_cmnd, char *sudoers_args)
|
||||
dlen = strlen(cp);
|
||||
if (cp[dlen - 1] == '/') {
|
||||
if (command_matches_dir(cp, dlen))
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -499,14 +499,14 @@ command_matches_glob(char *sudoers_cmnd, char *sudoers_args)
|
||||
}
|
||||
globfree(&gl);
|
||||
if (cp == NULL)
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
|
||||
if (command_args_match(sudoers_cmnd, sudoers_args)) {
|
||||
efree(safe_cmnd);
|
||||
safe_cmnd = estrdup(user_cmnd);
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -519,7 +519,7 @@ command_matches_normal(char *sudoers_cmnd, char *sudoers_args)
|
||||
/* If it ends in '/' it is a directory spec. */
|
||||
dlen = strlen(sudoers_cmnd);
|
||||
if (sudoers_cmnd[dlen - 1] == '/')
|
||||
return(command_matches_dir(sudoers_cmnd, dlen));
|
||||
return command_matches_dir(sudoers_cmnd, dlen);
|
||||
|
||||
/* Only proceed if user_base and basename(sudoers_cmnd) match */
|
||||
if ((base = strrchr(sudoers_cmnd, '/')) == NULL)
|
||||
@@ -528,7 +528,7 @@ command_matches_normal(char *sudoers_cmnd, char *sudoers_args)
|
||||
base++;
|
||||
if (strcmp(user_base, base) != 0 ||
|
||||
stat(sudoers_cmnd, &sudoers_stat) == -1)
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
* Return true if inode/device matches AND
|
||||
@@ -539,13 +539,13 @@ command_matches_normal(char *sudoers_cmnd, char *sudoers_args)
|
||||
if (user_stat != NULL &&
|
||||
(user_stat->st_dev != sudoers_stat.st_dev ||
|
||||
user_stat->st_ino != sudoers_stat.st_ino))
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
if (command_args_match(sudoers_cmnd, sudoers_args)) {
|
||||
efree(safe_cmnd);
|
||||
safe_cmnd = estrdup(sudoers_cmnd);
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -564,11 +564,11 @@ command_matches_dir(char *sudoers_dir, size_t dlen)
|
||||
*/
|
||||
dirp = opendir(sudoers_dir);
|
||||
if (dirp == NULL)
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
|
||||
if (strlcpy(buf, sudoers_dir, sizeof(buf)) >= sizeof(buf)) {
|
||||
closedir(dirp);
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
while ((dent = readdir(dirp)) != NULL) {
|
||||
/* ignore paths > PATH_MAX (XXX - log) */
|
||||
@@ -589,7 +589,7 @@ command_matches_dir(char *sudoers_dir, size_t dlen)
|
||||
}
|
||||
|
||||
closedir(dirp);
|
||||
return(dent != NULL);
|
||||
return dent != NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -620,24 +620,24 @@ addr_matches_if(char *n)
|
||||
if (ifp->addr.ip4.s_addr == addr.ip4.s_addr ||
|
||||
(ifp->addr.ip4.s_addr & ifp->netmask.ip4.s_addr)
|
||||
== addr.ip4.s_addr)
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
break;
|
||||
#ifdef HAVE_IN6_ADDR
|
||||
case AF_INET6:
|
||||
if (memcmp(ifp->addr.ip6.s6_addr, addr.ip6.s6_addr,
|
||||
sizeof(addr.ip6.s6_addr)) == 0)
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
for (j = 0; j < sizeof(addr.ip6.s6_addr); j++) {
|
||||
if ((ifp->addr.ip6.s6_addr[j] & ifp->netmask.ip6.s6_addr[j]) != addr.ip6.s6_addr[j])
|
||||
break;
|
||||
}
|
||||
if (j == sizeof(addr.ip6.s6_addr))
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -694,7 +694,7 @@ addr_matches_if_netmask(char *n, char *m)
|
||||
switch(family) {
|
||||
case AF_INET:
|
||||
if ((ifp->addr.ip4.s_addr & mask.ip4.s_addr) == addr.ip4.s_addr)
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
#ifdef HAVE_IN6_ADDR
|
||||
case AF_INET6:
|
||||
for (j = 0; j < sizeof(addr.ip6.s6_addr); j++) {
|
||||
@@ -702,12 +702,12 @@ addr_matches_if_netmask(char *n, char *m)
|
||||
break;
|
||||
}
|
||||
if (j == sizeof(addr.ip6.s6_addr))
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
#endif /* HAVE_IN6_ADDR */
|
||||
}
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -728,7 +728,7 @@ addr_matches(char *n)
|
||||
} else
|
||||
retval = addr_matches_if(n);
|
||||
|
||||
return(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -739,14 +739,14 @@ hostname_matches(char *shost, char *lhost, char *pattern)
|
||||
{
|
||||
if (has_meta(pattern)) {
|
||||
if (strchr(pattern, '.'))
|
||||
return(!fnmatch(pattern, lhost, FNM_CASEFOLD));
|
||||
return !fnmatch(pattern, lhost, FNM_CASEFOLD);
|
||||
else
|
||||
return(!fnmatch(pattern, shost, FNM_CASEFOLD));
|
||||
return !fnmatch(pattern, shost, FNM_CASEFOLD);
|
||||
} else {
|
||||
if (strchr(pattern, '.'))
|
||||
return(!strcasecmp(lhost, pattern));
|
||||
return !strcasecmp(lhost, pattern);
|
||||
else
|
||||
return(!strcasecmp(shost, pattern));
|
||||
return !strcasecmp(shost, pattern);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -760,9 +760,9 @@ userpw_matches(char *sudoers_user, char *user, struct passwd *pw)
|
||||
if (pw != NULL && *sudoers_user == '#') {
|
||||
uid_t uid = (uid_t) atoi(sudoers_user + 1);
|
||||
if (uid == pw->pw_uid)
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
return(strcmp(sudoers_user, user) == 0);
|
||||
return strcmp(sudoers_user, user) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -775,9 +775,9 @@ group_matches(char *sudoers_group, struct group *gr)
|
||||
if (*sudoers_group == '#') {
|
||||
gid_t gid = (gid_t) atoi(sudoers_group + 1);
|
||||
if (gid == gr->gr_gid)
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
return(strcmp(gr->gr_name, sudoers_group) == 0);
|
||||
return strcmp(gr->gr_name, sudoers_group) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -821,7 +821,7 @@ done:
|
||||
if (pw0 != NULL)
|
||||
pw_delref(pw0);
|
||||
|
||||
return(matched);
|
||||
return matched;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -841,7 +841,7 @@ netgr_matches(char *netgr, char *lhost, char *shost, char *user)
|
||||
|
||||
/* make sure we have a valid netgroup, sudo style */
|
||||
if (*netgr++ != '+')
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
|
||||
#ifdef HAVE_GETDOMAINNAME
|
||||
/* get the domain name (if any) */
|
||||
@@ -857,10 +857,10 @@ netgr_matches(char *netgr, char *lhost, char *shost, char *user)
|
||||
|
||||
#ifdef HAVE_INNETGR
|
||||
if (innetgr(netgr, lhost, user, domain))
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
else if (lhost != shost && innetgr(netgr, shost, user, domain))
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
#endif /* HAVE_INNETGR */
|
||||
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user