Convert to ANSI C function declarations
This commit is contained in:
@@ -57,8 +57,7 @@ unsigned int alias_seqno;
|
||||
* Aliases are sorted by name with the type used as a tie-breaker.
|
||||
*/
|
||||
int
|
||||
alias_compare(v1, v2)
|
||||
const void *v1, *v2;
|
||||
alias_compare(const void *v1, const void *v2)
|
||||
{
|
||||
const struct alias *a1 = (const struct alias *)v1;
|
||||
const struct alias *a2 = (const struct alias *)v2;
|
||||
@@ -78,9 +77,7 @@ alias_compare(v1, v2)
|
||||
* Returns a pointer to the alias structure or NULL if not found.
|
||||
*/
|
||||
struct alias *
|
||||
alias_find(name, type)
|
||||
char *name;
|
||||
int type;
|
||||
alias_find(char *name, int type)
|
||||
{
|
||||
struct alias key;
|
||||
struct rbnode *node;
|
||||
@@ -107,10 +104,7 @@ alias_find(name, type)
|
||||
* Returns NULL on success and an error string on failure.
|
||||
*/
|
||||
char *
|
||||
alias_add(name, type, members)
|
||||
char *name;
|
||||
int type;
|
||||
struct member *members;
|
||||
alias_add(char *name, int type, struct member *members)
|
||||
{
|
||||
static char errbuf[512];
|
||||
struct alias *a;
|
||||
@@ -132,9 +126,7 @@ alias_add(name, type, members)
|
||||
* Apply a function to each alias entry and pass in a cookie.
|
||||
*/
|
||||
void
|
||||
alias_apply(func, cookie)
|
||||
int (*func)(void *, void *);
|
||||
void *cookie;
|
||||
alias_apply(int (*func)(void *, void *), void *cookie)
|
||||
{
|
||||
rbapply(aliases, func, cookie, inorder);
|
||||
}
|
||||
@@ -143,7 +135,7 @@ alias_apply(func, cookie)
|
||||
* Returns TRUE if there are no aliases, else FALSE.
|
||||
*/
|
||||
int
|
||||
no_aliases()
|
||||
no_aliases(void)
|
||||
{
|
||||
return(rbisempty(aliases));
|
||||
}
|
||||
@@ -152,8 +144,7 @@ no_aliases()
|
||||
* Free memory used by an alias struct and its members.
|
||||
*/
|
||||
void
|
||||
alias_free(v)
|
||||
void *v;
|
||||
alias_free(void *v)
|
||||
{
|
||||
struct alias *a = (struct alias *)v;
|
||||
struct member *m;
|
||||
@@ -178,9 +169,7 @@ alias_free(v)
|
||||
* Find the named alias, remove it from the tree and return it.
|
||||
*/
|
||||
struct alias *
|
||||
alias_remove(name, type)
|
||||
char *name;
|
||||
int type;
|
||||
alias_remove(char *name, int type)
|
||||
{
|
||||
struct rbnode *node;
|
||||
struct alias key, *a;
|
||||
@@ -194,7 +183,7 @@ alias_remove(name, type)
|
||||
}
|
||||
|
||||
void
|
||||
init_aliases()
|
||||
init_aliases(void)
|
||||
{
|
||||
if (aliases != NULL)
|
||||
rbdestroy(aliases, alias_free);
|
||||
|
@@ -91,9 +91,7 @@ static void update_timestamp(char *, char *);
|
||||
* XXX - check return values
|
||||
*/
|
||||
int
|
||||
check_user(validated, mode)
|
||||
int validated;
|
||||
int mode;
|
||||
check_user(int validated, int mode)
|
||||
{
|
||||
char *timestampdir = NULL;
|
||||
char *timestampfile = NULL;
|
||||
@@ -190,8 +188,7 @@ static const char lecture_text[] = "\n"
|
||||
* Standard sudo lecture.
|
||||
*/
|
||||
static void
|
||||
lecture(status)
|
||||
int status;
|
||||
lecture(int status)
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[BUFSIZ];
|
||||
@@ -225,9 +222,7 @@ lecture(status)
|
||||
* Update the time on the timestamp file/dir or create it if necessary.
|
||||
*/
|
||||
static void
|
||||
update_timestamp(timestampdir, timestampfile)
|
||||
char *timestampdir;
|
||||
char *timestampfile;
|
||||
update_timestamp(char *timestampdir, char *timestampfile)
|
||||
{
|
||||
if (timestamp_uid != 0)
|
||||
set_perms(PERM_TIMESTAMP);
|
||||
@@ -257,10 +252,7 @@ update_timestamp(timestampdir, timestampfile)
|
||||
* allocated result. Returns the same string if there are no escapes.
|
||||
*/
|
||||
static char *
|
||||
expand_prompt(old_prompt, user, host)
|
||||
char *old_prompt;
|
||||
char *user;
|
||||
char *host;
|
||||
expand_prompt(char *old_prompt, char *user, char *host)
|
||||
{
|
||||
size_t len, n;
|
||||
int subst;
|
||||
@@ -386,7 +378,7 @@ oflow:
|
||||
* Checks if the user is exempt from supplying a password.
|
||||
*/
|
||||
int
|
||||
user_is_exempt()
|
||||
user_is_exempt(void)
|
||||
{
|
||||
if (!def_exempt_group)
|
||||
return(FALSE);
|
||||
@@ -397,9 +389,7 @@ user_is_exempt()
|
||||
* Fills in timestampdir as well as timestampfile if using tty tickets.
|
||||
*/
|
||||
static int
|
||||
build_timestamp(timestampdir, timestampfile)
|
||||
char **timestampdir;
|
||||
char **timestampfile;
|
||||
build_timestamp(char **timestampdir, char **timestampfile)
|
||||
{
|
||||
char *dirparent;
|
||||
int len;
|
||||
@@ -448,11 +438,7 @@ build_timestamp(timestampdir, timestampfile)
|
||||
* Check the timestamp file and directory and return their status.
|
||||
*/
|
||||
static int
|
||||
timestamp_status(timestampdir, timestampfile, user, flags)
|
||||
char *timestampdir;
|
||||
char *timestampfile;
|
||||
char *user;
|
||||
int flags;
|
||||
timestamp_status(char *timestampdir, char *timestampfile, char *user, int flags)
|
||||
{
|
||||
struct stat sb;
|
||||
struct timeval boottime, mtime;
|
||||
@@ -646,8 +632,7 @@ done:
|
||||
* Remove the timestamp ticket file/dir.
|
||||
*/
|
||||
void
|
||||
remove_timestamp(remove)
|
||||
int remove;
|
||||
remove_timestamp(int remove)
|
||||
{
|
||||
struct timeval tv;
|
||||
char *timestampdir, *timestampfile, *path;
|
||||
|
@@ -114,7 +114,7 @@ static const char *logpri2str(int);
|
||||
* Print version and configure info.
|
||||
*/
|
||||
void
|
||||
dump_defaults()
|
||||
dump_defaults(void)
|
||||
{
|
||||
struct sudo_defs_types *cur;
|
||||
struct list_member *item;
|
||||
@@ -183,7 +183,7 @@ dump_defaults()
|
||||
* List each option along with its description.
|
||||
*/
|
||||
void
|
||||
list_options()
|
||||
list_options(void)
|
||||
{
|
||||
struct sudo_defs_types *cur;
|
||||
char *p;
|
||||
@@ -216,10 +216,7 @@ list_options()
|
||||
* This is only meaningful for variables that are *optional*.
|
||||
*/
|
||||
int
|
||||
set_default(var, val, op)
|
||||
char *var;
|
||||
char *val;
|
||||
int op; /* TRUE or FALSE */
|
||||
set_default(char *var, char *val, int op)
|
||||
{
|
||||
struct sudo_defs_types *cur;
|
||||
int num;
|
||||
@@ -365,7 +362,7 @@ set_default(var, val, op)
|
||||
* Any of these may be overridden at runtime by a "Defaults" file.
|
||||
*/
|
||||
void
|
||||
init_defaults()
|
||||
init_defaults(void)
|
||||
{
|
||||
static int firsttime = 1;
|
||||
struct sudo_defs_types *def;
|
||||
@@ -509,8 +506,7 @@ init_defaults()
|
||||
* Pass in a an OR'd list of which default types to update.
|
||||
*/
|
||||
int
|
||||
update_defaults(what)
|
||||
int what;
|
||||
update_defaults(int what)
|
||||
{
|
||||
struct defaults *def;
|
||||
|
||||
@@ -551,10 +547,7 @@ update_defaults(what)
|
||||
}
|
||||
|
||||
static int
|
||||
store_int(val, def, op)
|
||||
char *val;
|
||||
struct sudo_defs_types *def;
|
||||
int op;
|
||||
store_int(char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
char *endp;
|
||||
long l;
|
||||
@@ -574,10 +567,7 @@ store_int(val, def, op)
|
||||
}
|
||||
|
||||
static int
|
||||
store_uint(val, def, op)
|
||||
char *val;
|
||||
struct sudo_defs_types *def;
|
||||
int op;
|
||||
store_uint(char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
char *endp;
|
||||
long l;
|
||||
@@ -597,10 +587,7 @@ store_uint(val, def, op)
|
||||
}
|
||||
|
||||
static int
|
||||
store_float(val, def, op)
|
||||
char *val;
|
||||
struct sudo_defs_types *def;
|
||||
int op;
|
||||
store_float(char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
char *endp;
|
||||
double d;
|
||||
@@ -620,10 +607,7 @@ store_float(val, def, op)
|
||||
}
|
||||
|
||||
static int
|
||||
store_tuple(val, def, op)
|
||||
char *val;
|
||||
struct sudo_defs_types *def;
|
||||
int op;
|
||||
store_tuple(char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
struct def_values *v;
|
||||
|
||||
@@ -652,10 +636,7 @@ store_tuple(val, def, op)
|
||||
}
|
||||
|
||||
static int
|
||||
store_str(val, def, op)
|
||||
char *val;
|
||||
struct sudo_defs_types *def;
|
||||
int op;
|
||||
store_str(char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
|
||||
efree(def->sd_un.str);
|
||||
@@ -669,10 +650,7 @@ store_str(val, def, op)
|
||||
}
|
||||
|
||||
static int
|
||||
store_list(str, def, op)
|
||||
char *str;
|
||||
struct sudo_defs_types *def;
|
||||
int op;
|
||||
store_list(char *str, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
char *start, *end;
|
||||
|
||||
@@ -700,10 +678,7 @@ store_list(str, def, op)
|
||||
}
|
||||
|
||||
static int
|
||||
store_syslogfac(val, def, op)
|
||||
char *val;
|
||||
struct sudo_defs_types *def;
|
||||
int op;
|
||||
store_syslogfac(char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
struct strmap *fac;
|
||||
|
||||
@@ -727,8 +702,7 @@ store_syslogfac(val, def, op)
|
||||
}
|
||||
|
||||
static const char *
|
||||
logfac2str(n)
|
||||
int n;
|
||||
logfac2str(int n)
|
||||
{
|
||||
#ifdef LOG_NFACILITIES
|
||||
struct strmap *fac;
|
||||
@@ -742,10 +716,7 @@ logfac2str(n)
|
||||
}
|
||||
|
||||
static int
|
||||
store_syslogpri(val, def, op)
|
||||
char *val;
|
||||
struct sudo_defs_types *def;
|
||||
int op;
|
||||
store_syslogpri(char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
struct strmap *pri;
|
||||
|
||||
@@ -762,8 +733,7 @@ store_syslogpri(val, def, op)
|
||||
}
|
||||
|
||||
static const char *
|
||||
logpri2str(n)
|
||||
int n;
|
||||
logpri2str(int n)
|
||||
{
|
||||
struct strmap *pri;
|
||||
|
||||
@@ -773,10 +743,7 @@ logpri2str(n)
|
||||
}
|
||||
|
||||
static int
|
||||
store_mode(val, def, op)
|
||||
char *val;
|
||||
struct sudo_defs_types *def;
|
||||
int op;
|
||||
store_mode(char *val, struct sudo_defs_types *def, int op)
|
||||
{
|
||||
char *endp;
|
||||
long l;
|
||||
@@ -795,11 +762,7 @@ store_mode(val, def, op)
|
||||
}
|
||||
|
||||
static void
|
||||
list_op(val, len, def, op)
|
||||
char *val;
|
||||
size_t len;
|
||||
struct sudo_defs_types *def;
|
||||
enum list_ops op;
|
||||
list_op(char *val, size_t len, struct sudo_defs_types *def, enum list_ops op)
|
||||
{
|
||||
struct list_member *cur, *prev, *tmp;
|
||||
|
||||
|
@@ -53,11 +53,7 @@
|
||||
* but it is in '.' and IGNORE_DOT is set.
|
||||
*/
|
||||
int
|
||||
find_path(infile, outfile, sbp, path)
|
||||
char *infile; /* file to find */
|
||||
char **outfile; /* result parameter */
|
||||
struct stat *sbp; /* stat result parameter */
|
||||
char *path; /* path to search */
|
||||
find_path(char *infile, char **outfile, struct stat *sbp, char *path)
|
||||
{
|
||||
static char command[PATH_MAX]; /* qualified filename */
|
||||
char *n; /* for traversing path */
|
||||
|
@@ -82,8 +82,7 @@ int crypt_type = INT_MAX;
|
||||
* If shadow passwords are in use, look in the shadow file.
|
||||
*/
|
||||
char *
|
||||
sudo_getepw(pw)
|
||||
const struct passwd *pw;
|
||||
sudo_getepw(const struct passwd *pw)
|
||||
{
|
||||
char *epw = NULL;
|
||||
|
||||
@@ -150,7 +149,7 @@ done:
|
||||
}
|
||||
|
||||
void
|
||||
sudo_setspent()
|
||||
sudo_setspent(void)
|
||||
{
|
||||
#ifdef HAVE_GETPRPWNAM
|
||||
setprpwent();
|
||||
@@ -170,7 +169,7 @@ sudo_setspent()
|
||||
}
|
||||
|
||||
void
|
||||
sudo_endspent()
|
||||
sudo_endspent(void)
|
||||
{
|
||||
#ifdef HAVE_GETPRPWNAM
|
||||
endprpwent();
|
||||
|
@@ -30,8 +30,7 @@
|
||||
* timespecs in struct stat or, otherwise, using time().
|
||||
*/
|
||||
int
|
||||
gettime(tv)
|
||||
struct timeval *tv;
|
||||
gettime(struct timeval *tv)
|
||||
{
|
||||
int rval;
|
||||
#if defined(HAVE_GETTIMEOFDAY) && (defined(HAVE_ST_MTIM) || defined(HAVE_ST_MTIMESPEC))
|
||||
|
@@ -42,9 +42,7 @@
|
||||
* Verify that path is a normal file and executable by root.
|
||||
*/
|
||||
char *
|
||||
sudo_goodpath(path, sbp)
|
||||
const char *path;
|
||||
struct stat *sbp;
|
||||
sudo_goodpath(const char *path, struct stat *sbp)
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
|
@@ -96,7 +96,7 @@ struct rtentry;
|
||||
* machine's ip addresses and netmasks.
|
||||
*/
|
||||
void
|
||||
load_interfaces()
|
||||
load_interfaces(void)
|
||||
{
|
||||
struct ifaddrs *ifa, *ifaddrs;
|
||||
struct sockaddr_in *sin;
|
||||
@@ -183,7 +183,7 @@ load_interfaces()
|
||||
* machine's ip addresses and netmasks.
|
||||
*/
|
||||
void
|
||||
load_interfaces()
|
||||
load_interfaces(void)
|
||||
{
|
||||
struct ifconf *ifconf;
|
||||
struct ifreq *ifr, ifr_tmp;
|
||||
@@ -318,7 +318,7 @@ load_interfaces()
|
||||
* Stub function for those without SIOCGIFCONF
|
||||
*/
|
||||
void
|
||||
load_interfaces()
|
||||
load_interfaces(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -326,7 +326,7 @@ load_interfaces()
|
||||
#endif /* SIOCGIFCONF && !STUB_LOAD_INTERFACES */
|
||||
|
||||
void
|
||||
dump_interfaces()
|
||||
dump_interfaces(void)
|
||||
{
|
||||
int i;
|
||||
#ifdef HAVE_IN6_ADDR
|
||||
|
@@ -72,7 +72,7 @@ static struct timeval last_time;
|
||||
static union script_fd io_outfile, io_timfile;
|
||||
|
||||
static void
|
||||
io_nextid()
|
||||
io_nextid(void)
|
||||
{
|
||||
struct stat sb;
|
||||
char buf[32], *ep;
|
||||
|
@@ -250,7 +250,7 @@ struct sudo_nss sudo_nss_ldap = {
|
||||
* append one if we want something other than LDAP_PORT.
|
||||
*/
|
||||
static void
|
||||
sudo_ldap_conf_add_ports()
|
||||
sudo_ldap_conf_add_ports(void)
|
||||
{
|
||||
|
||||
char *host, *port, defport[13];
|
||||
@@ -291,8 +291,7 @@ toobig:
|
||||
* where the trailing slash is optional.
|
||||
*/
|
||||
static int
|
||||
sudo_ldap_parse_uri(uri_list)
|
||||
const char *uri_list;
|
||||
sudo_ldap_parse_uri(const char *uri_list)
|
||||
{
|
||||
char *buf, *uri, *host, *cp, *port;
|
||||
char hostbuf[LINE_MAX];
|
||||
@@ -367,10 +366,7 @@ toobig:
|
||||
#endif /* HAVE_LDAP_INITIALIZE */
|
||||
|
||||
static int
|
||||
sudo_ldap_init(ldp, host, port)
|
||||
LDAP **ldp;
|
||||
const char *host;
|
||||
int port;
|
||||
sudo_ldap_init(LDAP **ldp, const char *host, int port)
|
||||
{
|
||||
LDAP *ld = NULL;
|
||||
int rc = LDAP_CONNECT_ERROR;
|
||||
@@ -439,10 +435,7 @@ done:
|
||||
* netgroup, else FALSE.
|
||||
*/
|
||||
int
|
||||
sudo_ldap_check_user_netgroup(ld, entry, user)
|
||||
LDAP *ld;
|
||||
LDAPMessage *entry;
|
||||
char *user;
|
||||
sudo_ldap_check_user_netgroup(LDAP *ld, LDAPMessage *entry, char *user)
|
||||
{
|
||||
struct berval **bv, **p;
|
||||
char *val;
|
||||
@@ -476,9 +469,7 @@ sudo_ldap_check_user_netgroup(ld, entry, user)
|
||||
* host match, else FALSE.
|
||||
*/
|
||||
int
|
||||
sudo_ldap_check_host(ld, entry)
|
||||
LDAP *ld;
|
||||
LDAPMessage *entry;
|
||||
sudo_ldap_check_host(LDAP *ld, LDAPMessage *entry)
|
||||
{
|
||||
struct berval **bv, **p;
|
||||
char *val;
|
||||
@@ -510,9 +501,7 @@ sudo_ldap_check_host(ld, entry)
|
||||
}
|
||||
|
||||
int
|
||||
sudo_ldap_check_runas_user(ld, entry)
|
||||
LDAP *ld;
|
||||
LDAPMessage *entry;
|
||||
sudo_ldap_check_runas_user(LDAP *ld, LDAPMessage *entry)
|
||||
{
|
||||
struct berval **bv, **p;
|
||||
char *val;
|
||||
@@ -583,9 +572,7 @@ sudo_ldap_check_runas_user(ld, entry)
|
||||
}
|
||||
|
||||
int
|
||||
sudo_ldap_check_runas_group(ld, entry)
|
||||
LDAP *ld;
|
||||
LDAPMessage *entry;
|
||||
sudo_ldap_check_runas_group(LDAP *ld, LDAPMessage *entry)
|
||||
{
|
||||
struct berval **bv, **p;
|
||||
char *val;
|
||||
@@ -619,9 +606,7 @@ sudo_ldap_check_runas_group(ld, entry)
|
||||
* else FALSE. RunAs info is optional.
|
||||
*/
|
||||
int
|
||||
sudo_ldap_check_runas(ld, entry)
|
||||
LDAP *ld;
|
||||
LDAPMessage *entry;
|
||||
sudo_ldap_check_runas(LDAP *ld, LDAPMessage *entry)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -639,10 +624,7 @@ sudo_ldap_check_runas(ld, entry)
|
||||
* FALSE if disallowed and UNSPEC if not matched.
|
||||
*/
|
||||
int
|
||||
sudo_ldap_check_command(ld, entry, setenv_implied)
|
||||
LDAP *ld;
|
||||
LDAPMessage *entry;
|
||||
int *setenv_implied;
|
||||
sudo_ldap_check_command(LDAP *ld, LDAPMessage *entry, int *setenv_implied)
|
||||
{
|
||||
struct berval **bv, **p;
|
||||
char *allowed_cmnd, *allowed_args, *val;
|
||||
@@ -704,10 +686,7 @@ sudo_ldap_check_command(ld, entry, setenv_implied)
|
||||
* Returns TRUE if found and allowed, FALSE if negated, else UNSPEC.
|
||||
*/
|
||||
int
|
||||
sudo_ldap_check_bool(ld, entry, option)
|
||||
LDAP *ld;
|
||||
LDAPMessage *entry;
|
||||
char *option;
|
||||
sudo_ldap_check_bool(LDAP *ld, LDAPMessage *entry, char *option)
|
||||
{
|
||||
struct berval **bv, **p;
|
||||
char ch, *var;
|
||||
@@ -741,9 +720,7 @@ sudo_ldap_check_bool(ld, entry, option)
|
||||
* from the cn=defaults entry and also once when a final sudoRole is matched.
|
||||
*/
|
||||
void
|
||||
sudo_ldap_parse_options(ld, entry)
|
||||
LDAP *ld;
|
||||
LDAPMessage *entry;
|
||||
sudo_ldap_parse_options(LDAP *ld, LDAPMessage *entry)
|
||||
{
|
||||
struct berval **bv, **p;
|
||||
char op, *var, *val;
|
||||
@@ -790,8 +767,7 @@ sudo_ldap_parse_options(ld, entry)
|
||||
* builds together a filter to check against ldap
|
||||
*/
|
||||
char *
|
||||
sudo_ldap_build_pass1(pw)
|
||||
struct passwd *pw;
|
||||
sudo_ldap_build_pass1(struct passwd *pw)
|
||||
{
|
||||
struct group *grp;
|
||||
size_t sz;
|
||||
@@ -846,8 +822,7 @@ sudo_ldap_build_pass1(pw)
|
||||
* Map yes/true/on to TRUE, no/false/off to FALSE, else -1
|
||||
*/
|
||||
int
|
||||
_atobool(s)
|
||||
const char *s;
|
||||
_atobool(const char *s)
|
||||
{
|
||||
switch (*s) {
|
||||
case 'y':
|
||||
@@ -882,8 +857,7 @@ _atobool(s)
|
||||
}
|
||||
|
||||
static void
|
||||
sudo_ldap_read_secret(path)
|
||||
const char *path;
|
||||
sudo_ldap_read_secret(const char *path)
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[LINE_MAX], *cp;
|
||||
@@ -904,7 +878,7 @@ sudo_ldap_read_secret(path)
|
||||
}
|
||||
|
||||
int
|
||||
sudo_ldap_read_config()
|
||||
sudo_ldap_read_config(void)
|
||||
{
|
||||
FILE *fp;
|
||||
char *cp, *keyword, *value;
|
||||
@@ -1100,9 +1074,7 @@ sudo_ldap_read_config()
|
||||
* Extract the dn from an entry and return the first rdn from it.
|
||||
*/
|
||||
static char *
|
||||
sudo_ldap_get_first_rdn(ld, entry)
|
||||
LDAP *ld;
|
||||
LDAPMessage *entry;
|
||||
sudo_ldap_get_first_rdn(LDAP *ld, LDAPMessage *entry)
|
||||
{
|
||||
#ifdef HAVE_LDAP_STR2DN
|
||||
char *dn, *rdn = NULL;
|
||||
@@ -1131,10 +1103,8 @@ sudo_ldap_get_first_rdn(ld, entry)
|
||||
* Fetch and display the global Options.
|
||||
*/
|
||||
int
|
||||
sudo_ldap_display_defaults(nss, pw, lbuf)
|
||||
struct sudo_nss *nss;
|
||||
struct passwd *pw;
|
||||
struct lbuf *lbuf;
|
||||
sudo_ldap_display_defaults(struct sudo_nss *nss, struct passwd *pw,
|
||||
struct lbuf *lbuf)
|
||||
{
|
||||
struct berval **bv, **p;
|
||||
LDAP *ld = (LDAP *) nss->handle;
|
||||
@@ -1171,10 +1141,8 @@ sudo_ldap_display_defaults(nss, pw, lbuf)
|
||||
* STUB
|
||||
*/
|
||||
int
|
||||
sudo_ldap_display_bound_defaults(nss, pw, lbuf)
|
||||
struct sudo_nss *nss;
|
||||
struct passwd *pw;
|
||||
struct lbuf *lbuf;
|
||||
sudo_ldap_display_bound_defaults(struct sudo_nss *nss, struct passwd *pw,
|
||||
struct lbuf *lbuf)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
@@ -1183,10 +1151,7 @@ sudo_ldap_display_bound_defaults(nss, pw, lbuf)
|
||||
* Print a record in the short form, ala file sudoers.
|
||||
*/
|
||||
int
|
||||
sudo_ldap_display_entry_short(ld, entry, lbuf)
|
||||
LDAP *ld;
|
||||
LDAPMessage *entry;
|
||||
struct lbuf *lbuf;
|
||||
sudo_ldap_display_entry_short(LDAP *ld, LDAPMessage *entry, struct lbuf *lbuf)
|
||||
{
|
||||
struct berval **bv, **p;
|
||||
int count = 0;
|
||||
@@ -1266,10 +1231,7 @@ sudo_ldap_display_entry_short(ld, entry, lbuf)
|
||||
* Print a record in the long form.
|
||||
*/
|
||||
int
|
||||
sudo_ldap_display_entry_long(ld, entry, lbuf)
|
||||
LDAP *ld;
|
||||
LDAPMessage *entry;
|
||||
struct lbuf *lbuf;
|
||||
sudo_ldap_display_entry_long(LDAP *ld, LDAPMessage *entry, struct lbuf *lbuf)
|
||||
{
|
||||
struct berval **bv, **p;
|
||||
char *rdn;
|
||||
@@ -1341,10 +1303,8 @@ sudo_ldap_display_entry_long(ld, entry, lbuf)
|
||||
* Like sudo_ldap_lookup(), except we just print entries.
|
||||
*/
|
||||
int
|
||||
sudo_ldap_display_privs(nss, pw, lbuf)
|
||||
struct sudo_nss *nss;
|
||||
struct passwd *pw;
|
||||
struct lbuf *lbuf;
|
||||
sudo_ldap_display_privs(struct sudo_nss *nss, struct passwd *pw,
|
||||
struct lbuf *lbuf)
|
||||
{
|
||||
LDAP *ld = (LDAP *) nss->handle;
|
||||
LDAPMessage *entry = NULL, *result = NULL;
|
||||
@@ -1396,9 +1356,7 @@ sudo_ldap_display_privs(nss, pw, lbuf)
|
||||
}
|
||||
|
||||
int
|
||||
sudo_ldap_display_cmnd(nss, pw)
|
||||
struct sudo_nss *nss;
|
||||
struct passwd *pw;
|
||||
sudo_ldap_display_cmnd(struct sudo_nss *nss, struct passwd *pw)
|
||||
{
|
||||
LDAP *ld = (LDAP *) nss->handle;
|
||||
LDAPMessage *entry = NULL, *result = NULL; /* used for searches */
|
||||
@@ -1454,11 +1412,8 @@ sudo_ldap_display_cmnd(nss, pw)
|
||||
|
||||
#ifdef HAVE_LDAP_SASL_INTERACTIVE_BIND_S
|
||||
static int
|
||||
sudo_ldap_sasl_interact(ld, flags, _auth_id, _interact)
|
||||
LDAP *ld;
|
||||
unsigned int flags;
|
||||
void *_auth_id;
|
||||
void *_interact;
|
||||
sudo_ldap_sasl_interact(LDAP *ld, unsigned int flags, void *_auth_id,
|
||||
void *_interact)
|
||||
{
|
||||
char *auth_id = (char *)_auth_id;
|
||||
sasl_interact_t *interact = (sasl_interact_t *)_interact;
|
||||
@@ -1487,8 +1442,7 @@ sudo_ldap_sasl_interact(ld, flags, _auth_id, _interact)
|
||||
* Set LDAP options based on the config table.
|
||||
*/
|
||||
int
|
||||
sudo_ldap_set_options(ld)
|
||||
LDAP *ld;
|
||||
sudo_ldap_set_options(LDAP *ld)
|
||||
{
|
||||
struct ldap_config_table *cur;
|
||||
int rc;
|
||||
@@ -1574,8 +1528,7 @@ sudo_ldap_set_options(ld)
|
||||
* Connect to the LDAP server specified by ld
|
||||
*/
|
||||
static int
|
||||
sudo_ldap_bind_s(ld)
|
||||
LDAP *ld;
|
||||
sudo_ldap_bind_s(LDAP *ld)
|
||||
{
|
||||
int rc;
|
||||
const char *old_ccname = user_ccname;
|
||||
@@ -1653,8 +1606,7 @@ sudo_ldap_bind_s(ld)
|
||||
* Returns 0 on success and non-zero on failure.
|
||||
*/
|
||||
int
|
||||
sudo_ldap_open(nss)
|
||||
struct sudo_nss *nss;
|
||||
sudo_ldap_open(struct sudo_nss *nss)
|
||||
{
|
||||
LDAP *ld;
|
||||
int rc, ldapnoinit = FALSE;
|
||||
@@ -1721,8 +1673,7 @@ sudo_ldap_open(nss)
|
||||
}
|
||||
|
||||
int
|
||||
sudo_ldap_setdefs(nss)
|
||||
struct sudo_nss *nss;
|
||||
sudo_ldap_setdefs(struct sudo_nss *nss)
|
||||
{
|
||||
LDAP *ld = (LDAP *) nss->handle;
|
||||
LDAPMessage *entry = NULL, *result = NULL; /* used for searches */
|
||||
@@ -1749,10 +1700,7 @@ sudo_ldap_setdefs(nss)
|
||||
* like sudoers_lookup() - only LDAP style
|
||||
*/
|
||||
int
|
||||
sudo_ldap_lookup(nss, ret, pwflag)
|
||||
struct sudo_nss *nss;
|
||||
int ret;
|
||||
int pwflag;
|
||||
sudo_ldap_lookup(struct sudo_nss *nss, int ret, int pwflag)
|
||||
{
|
||||
LDAP *ld = (LDAP *) nss->handle;
|
||||
LDAPMessage *entry = NULL, *result = NULL;
|
||||
@@ -1920,8 +1868,7 @@ done:
|
||||
* shut down LDAP connection
|
||||
*/
|
||||
int
|
||||
sudo_ldap_close(nss)
|
||||
struct sudo_nss *nss;
|
||||
sudo_ldap_close(struct sudo_nss *nss)
|
||||
{
|
||||
if (nss->handle != NULL) {
|
||||
ldap_unbind_ext_s((LDAP *) nss->handle, NULL, NULL);
|
||||
@@ -1934,8 +1881,7 @@ sudo_ldap_close(nss)
|
||||
* STUB
|
||||
*/
|
||||
int
|
||||
sudo_ldap_parse(nss)
|
||||
struct sudo_nss *nss;
|
||||
sudo_ldap_parse(struct sudo_nss *nss)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
@@ -78,14 +78,7 @@ extern sigjmp_buf error_jmp;
|
||||
* Sadly this is a maze of #ifdefs.
|
||||
*/
|
||||
static void
|
||||
#ifdef __STDC__
|
||||
mysyslog(int pri, const char *fmt, ...)
|
||||
#else
|
||||
mysyslog(pri, fmt, va_alist)
|
||||
int pri;
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
#ifdef BROKEN_SYSLOG
|
||||
int i;
|
||||
@@ -93,11 +86,7 @@ mysyslog(pri, fmt, va_alist)
|
||||
char buf[MAXSYSLOGLEN+1];
|
||||
va_list ap;
|
||||
|
||||
#ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
#ifdef LOG_NFACILITIES
|
||||
openlog("sudo", 0, def_syslog);
|
||||
#else
|
||||
@@ -128,9 +117,7 @@ mysyslog(pri, fmt, va_alist)
|
||||
* message into parts if it is longer than MAXSYSLOGLEN.
|
||||
*/
|
||||
static void
|
||||
do_syslog(pri, msg)
|
||||
int pri;
|
||||
char *msg;
|
||||
do_syslog(int pri, char *msg)
|
||||
{
|
||||
size_t len, maxlen;
|
||||
char *p, *tmp, save;
|
||||
@@ -173,8 +160,7 @@ do_syslog(pri, msg)
|
||||
}
|
||||
|
||||
static void
|
||||
do_logfile(msg)
|
||||
char *msg;
|
||||
do_logfile(char *msg)
|
||||
{
|
||||
char *full_line;
|
||||
char *beg, *oldend, *end;
|
||||
@@ -269,9 +255,7 @@ do_logfile(msg)
|
||||
* Log and mail the denial message, optionally informing the user.
|
||||
*/
|
||||
void
|
||||
log_denial(status, inform_user)
|
||||
int status;
|
||||
int inform_user;
|
||||
log_denial(int status, int inform_user)
|
||||
{
|
||||
char *message;
|
||||
char *logline;
|
||||
@@ -325,8 +309,7 @@ log_denial(status, inform_user)
|
||||
* Log and potentially mail the allowed command.
|
||||
*/
|
||||
void
|
||||
log_allowed(status)
|
||||
int status;
|
||||
log_allowed(int status)
|
||||
{
|
||||
char *logline;
|
||||
|
||||
@@ -347,26 +330,15 @@ log_allowed(status)
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef __STDC__
|
||||
log_error(int flags, const char *fmt, ...)
|
||||
#else
|
||||
log_error(flags, fmt, va_alist)
|
||||
int flags;
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
int serrno = errno;
|
||||
char *message;
|
||||
char *logline;
|
||||
va_list ap;
|
||||
#ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
|
||||
/* Expand printf-style format + args. */
|
||||
va_start(ap, fmt);
|
||||
evasprintf(&message, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
@@ -611,8 +583,7 @@ send_mail(const char *fmt, ...)
|
||||
* Determine whether we should send mail based on "status" and defaults options.
|
||||
*/
|
||||
static int
|
||||
should_mail(status)
|
||||
int status;
|
||||
should_mail(int status)
|
||||
{
|
||||
|
||||
return(def_mail_always || ISSET(status, VALIDATE_ERROR) ||
|
||||
@@ -633,9 +604,7 @@ should_mail(status)
|
||||
* Allocate and fill in a new logline.
|
||||
*/
|
||||
static char *
|
||||
new_logline(message, serrno)
|
||||
const char *message;
|
||||
int serrno;
|
||||
new_logline(const char *message, int serrno)
|
||||
{
|
||||
size_t len = 0;
|
||||
char *evstr = NULL;
|
||||
|
@@ -110,9 +110,7 @@ static int command_matches_normal(char *, char *);
|
||||
* Returns ALLOW, DENY or UNSPEC.
|
||||
*/
|
||||
static int
|
||||
_userlist_matches(pw, list)
|
||||
struct passwd *pw;
|
||||
struct member_list *list;
|
||||
_userlist_matches(struct passwd *pw, struct member_list *list)
|
||||
{
|
||||
struct member *m;
|
||||
struct alias *a;
|
||||
@@ -151,9 +149,7 @@ _userlist_matches(pw, list)
|
||||
}
|
||||
|
||||
int
|
||||
userlist_matches(pw, list)
|
||||
struct passwd *pw;
|
||||
struct member_list *list;
|
||||
userlist_matches(struct passwd *pw, struct member_list *list)
|
||||
{
|
||||
alias_seqno++;
|
||||
return(_userlist_matches(pw, list));
|
||||
@@ -165,9 +161,7 @@ userlist_matches(pw, list)
|
||||
* Returns ALLOW, DENY or UNSPEC.
|
||||
*/
|
||||
static int
|
||||
_runaslist_matches(user_list, group_list)
|
||||
struct member_list *user_list;
|
||||
struct member_list *group_list;
|
||||
_runaslist_matches(struct member_list *user_list, struct member_list *group_list)
|
||||
{
|
||||
struct member *m;
|
||||
struct alias *a;
|
||||
@@ -244,9 +238,7 @@ _runaslist_matches(user_list, group_list)
|
||||
}
|
||||
|
||||
int
|
||||
runaslist_matches(user_list, group_list)
|
||||
struct member_list *user_list;
|
||||
struct member_list *group_list;
|
||||
runaslist_matches(struct member_list *user_list, struct member_list *group_list)
|
||||
{
|
||||
alias_seqno++;
|
||||
return(_runaslist_matches(user_list ? user_list : &empty,
|
||||
@@ -258,8 +250,7 @@ runaslist_matches(user_list, group_list)
|
||||
* Returns ALLOW, DENY or UNSPEC.
|
||||
*/
|
||||
static int
|
||||
_hostlist_matches(list)
|
||||
struct member_list *list;
|
||||
_hostlist_matches(struct member_list *list)
|
||||
{
|
||||
struct member *m;
|
||||
struct alias *a;
|
||||
@@ -298,8 +289,7 @@ _hostlist_matches(list)
|
||||
}
|
||||
|
||||
int
|
||||
hostlist_matches(list)
|
||||
struct member_list *list;
|
||||
hostlist_matches(struct member_list *list)
|
||||
{
|
||||
alias_seqno++;
|
||||
return(_hostlist_matches(list));
|
||||
@@ -310,8 +300,7 @@ hostlist_matches(list)
|
||||
* Returns ALLOW, DENY or UNSPEC.
|
||||
*/
|
||||
static int
|
||||
_cmndlist_matches(list)
|
||||
struct member_list *list;
|
||||
_cmndlist_matches(struct member_list *list)
|
||||
{
|
||||
struct member *m;
|
||||
int matched = UNSPEC;
|
||||
@@ -325,8 +314,7 @@ _cmndlist_matches(list)
|
||||
}
|
||||
|
||||
int
|
||||
cmndlist_matches(list)
|
||||
struct member_list *list;
|
||||
cmndlist_matches(struct member_list *list)
|
||||
{
|
||||
alias_seqno++;
|
||||
return(_cmndlist_matches(list));
|
||||
@@ -337,8 +325,7 @@ cmndlist_matches(list)
|
||||
* Returns ALLOW, DENY or UNSPEC.
|
||||
*/
|
||||
int
|
||||
cmnd_matches(m)
|
||||
struct member *m;
|
||||
cmnd_matches(struct member *m)
|
||||
{
|
||||
struct alias *a;
|
||||
struct sudo_command *c;
|
||||
@@ -370,9 +357,7 @@ cmnd_matches(m)
|
||||
* otherwise, return TRUE if user_cmnd names one of the inodes in path.
|
||||
*/
|
||||
int
|
||||
command_matches(sudoers_cmnd, sudoers_args)
|
||||
char *sudoers_cmnd;
|
||||
char *sudoers_args;
|
||||
command_matches(char *sudoers_cmnd, char *sudoers_args)
|
||||
{
|
||||
/* Check for pseudo-commands */
|
||||
if (sudoers_cmnd[0] != '/') {
|
||||
@@ -409,9 +394,7 @@ command_matches(sudoers_cmnd, sudoers_args)
|
||||
}
|
||||
|
||||
static int
|
||||
command_matches_fnmatch(sudoers_cmnd, sudoers_args)
|
||||
char *sudoers_cmnd;
|
||||
char *sudoers_args;
|
||||
command_matches_fnmatch(char *sudoers_cmnd, char *sudoers_args)
|
||||
{
|
||||
/*
|
||||
* Return true if fnmatch(3) succeeds AND
|
||||
@@ -435,9 +418,7 @@ command_matches_fnmatch(sudoers_cmnd, sudoers_args)
|
||||
}
|
||||
|
||||
static int
|
||||
command_matches_glob(sudoers_cmnd, sudoers_args)
|
||||
char *sudoers_cmnd;
|
||||
char *sudoers_args;
|
||||
command_matches_glob(char *sudoers_cmnd, char *sudoers_args)
|
||||
{
|
||||
struct stat sudoers_stat;
|
||||
size_t dlen;
|
||||
@@ -511,9 +492,7 @@ command_matches_glob(sudoers_cmnd, sudoers_args)
|
||||
}
|
||||
|
||||
static int
|
||||
command_matches_normal(sudoers_cmnd, sudoers_args)
|
||||
char *sudoers_cmnd;
|
||||
char *sudoers_args;
|
||||
command_matches_normal(char *sudoers_cmnd, char *sudoers_args)
|
||||
{
|
||||
struct stat sudoers_stat;
|
||||
char *base;
|
||||
@@ -558,9 +537,7 @@ command_matches_normal(sudoers_cmnd, sudoers_args)
|
||||
* Return TRUE if user_cmnd names one of the inodes in dir, else FALSE.
|
||||
*/
|
||||
static int
|
||||
command_matches_dir(sudoers_dir, dlen)
|
||||
char *sudoers_dir;
|
||||
size_t dlen;
|
||||
command_matches_dir(char *sudoers_dir, size_t dlen)
|
||||
{
|
||||
struct stat sudoers_stat;
|
||||
struct dirent *dent;
|
||||
@@ -601,8 +578,7 @@ command_matches_dir(sudoers_dir, dlen)
|
||||
}
|
||||
|
||||
static int
|
||||
addr_matches_if(n)
|
||||
char *n;
|
||||
addr_matches_if(char *n)
|
||||
{
|
||||
int i;
|
||||
struct in_addr addr;
|
||||
@@ -653,9 +629,7 @@ addr_matches_if(n)
|
||||
}
|
||||
|
||||
static int
|
||||
addr_matches_if_netmask(n, m)
|
||||
char *n;
|
||||
char *m;
|
||||
addr_matches_if_netmask(char *n, char *m)
|
||||
{
|
||||
int i;
|
||||
struct in_addr addr, mask;
|
||||
@@ -731,8 +705,7 @@ addr_matches_if_netmask(n, m)
|
||||
* "n" is a network that we are on, else returns FALSE.
|
||||
*/
|
||||
int
|
||||
addr_matches(n)
|
||||
char *n;
|
||||
addr_matches(char *n)
|
||||
{
|
||||
char *m;
|
||||
int retval;
|
||||
@@ -752,10 +725,7 @@ addr_matches(n)
|
||||
* Returns TRUE if the hostname matches the pattern, else FALSE
|
||||
*/
|
||||
int
|
||||
hostname_matches(shost, lhost, pattern)
|
||||
char *shost;
|
||||
char *lhost;
|
||||
char *pattern;
|
||||
hostname_matches(char *shost, char *lhost, char *pattern)
|
||||
{
|
||||
if (has_meta(pattern)) {
|
||||
if (strchr(pattern, '.'))
|
||||
@@ -775,10 +745,7 @@ hostname_matches(shost, lhost, pattern)
|
||||
* else returns FALSE.
|
||||
*/
|
||||
int
|
||||
userpw_matches(sudoers_user, user, pw)
|
||||
char *sudoers_user;
|
||||
char *user;
|
||||
struct passwd *pw;
|
||||
userpw_matches(char *sudoers_user, char *user, struct passwd *pw)
|
||||
{
|
||||
if (pw != NULL && *sudoers_user == '#') {
|
||||
uid_t uid = (uid_t) atoi(sudoers_user + 1);
|
||||
@@ -793,9 +760,7 @@ userpw_matches(sudoers_user, user, pw)
|
||||
* else returns FALSE.
|
||||
*/
|
||||
int
|
||||
group_matches(sudoers_group, gr)
|
||||
char *sudoers_group;
|
||||
struct group *gr;
|
||||
group_matches(char *sudoers_group, struct group *gr)
|
||||
{
|
||||
if (*sudoers_group == '#') {
|
||||
gid_t gid = (gid_t) atoi(sudoers_group + 1);
|
||||
@@ -810,10 +775,7 @@ group_matches(sudoers_group, gr)
|
||||
* else returns FALSE.
|
||||
*/
|
||||
int
|
||||
usergr_matches(group, user, pw)
|
||||
char *group;
|
||||
char *user;
|
||||
struct passwd *pw;
|
||||
usergr_matches(char *group, char *user, struct passwd *pw)
|
||||
{
|
||||
/* make sure we have a valid usergroup, sudo style */
|
||||
if (*group++ != '%')
|
||||
@@ -849,11 +811,7 @@ usergr_matches(group, user, pw)
|
||||
* XXX - swap order of host & shost
|
||||
*/
|
||||
int
|
||||
netgr_matches(netgr, lhost, shost, user)
|
||||
char *netgr;
|
||||
char *lhost;
|
||||
char *shost;
|
||||
char *user;
|
||||
netgr_matches(char *netgr, char *lhost, char *shost, char *user)
|
||||
{
|
||||
static char *domain;
|
||||
#ifdef HAVE_GETDOMAINNAME
|
||||
|
@@ -31,16 +31,10 @@
|
||||
#ifndef _NONUNIX_H
|
||||
#define _NONUNIX_H
|
||||
|
||||
void
|
||||
sudo_nonunix_groupcheck_init(void);
|
||||
|
||||
void
|
||||
sudo_nonunix_groupcheck_cleanup(void);
|
||||
|
||||
int
|
||||
sudo_nonunix_groupcheck( const char* group, const char* user, const struct passwd* pwd );
|
||||
|
||||
int
|
||||
sudo_nonunix_groupcheck_available(void);
|
||||
void sudo_nonunix_groupcheck_init(void);
|
||||
void sudo_nonunix_groupcheck_cleanup(void);
|
||||
int sudo_nonunix_groupcheck(const char *group, const char *user,
|
||||
const struct passwd *pwd);
|
||||
int sudo_nonunix_groupcheck_available(void);
|
||||
|
||||
#endif /* _NONUNIX_H */
|
||||
|
@@ -80,8 +80,7 @@ static void print_member(struct lbuf *, char *, int, int, int);
|
||||
static int display_bound_defaults(int, struct lbuf *);
|
||||
|
||||
int
|
||||
sudo_file_open(nss)
|
||||
struct sudo_nss *nss;
|
||||
sudo_file_open(struct sudo_nss *nss)
|
||||
{
|
||||
if (def_ignore_local_sudoers)
|
||||
return(-1);
|
||||
@@ -90,8 +89,7 @@ sudo_file_open(nss)
|
||||
}
|
||||
|
||||
int
|
||||
sudo_file_close(nss)
|
||||
struct sudo_nss *nss;
|
||||
sudo_file_close(struct sudo_nss *nss)
|
||||
{
|
||||
/* Free parser data structures and close sudoers file. */
|
||||
init_parser(NULL, 0);
|
||||
@@ -107,8 +105,7 @@ sudo_file_close(nss)
|
||||
* Parse the specified sudoers file.
|
||||
*/
|
||||
int
|
||||
sudo_file_parse(nss)
|
||||
struct sudo_nss *nss;
|
||||
sudo_file_parse(struct sudo_nss *nss)
|
||||
{
|
||||
if (nss->handle == NULL)
|
||||
return(-1);
|
||||
@@ -127,8 +124,7 @@ sudo_file_parse(nss)
|
||||
* Wrapper around update_defaults() for nsswitch code.
|
||||
*/
|
||||
int
|
||||
sudo_file_setdefs(nss)
|
||||
struct sudo_nss *nss;
|
||||
sudo_file_setdefs(struct sudo_nss *nss)
|
||||
{
|
||||
if (nss->handle == NULL)
|
||||
return(-1);
|
||||
@@ -143,10 +139,7 @@ sudo_file_setdefs(nss)
|
||||
* allowed to run the specified command on this host as the target user.
|
||||
*/
|
||||
int
|
||||
sudo_file_lookup(nss, validated, pwflag)
|
||||
struct sudo_nss *nss;
|
||||
int validated;
|
||||
int pwflag;
|
||||
sudo_file_lookup(struct sudo_nss *nss, int validated, int pwflag)
|
||||
{
|
||||
int match, host_match, runas_match, cmnd_match;
|
||||
struct cmndspec *cs;
|
||||
@@ -265,10 +258,8 @@ sudo_file_lookup(nss, validated, pwflag)
|
||||
(cs->tags.t != UNSPEC && cs->tags.t != IMPLIED && cs->tags.t != tags->t)
|
||||
|
||||
static void
|
||||
sudo_file_append_cmnd(cs, tags, lbuf)
|
||||
struct cmndspec *cs;
|
||||
struct cmndtag *tags;
|
||||
struct lbuf *lbuf;
|
||||
sudo_file_append_cmnd(struct cmndspec *cs, struct cmndtag *tags,
|
||||
struct lbuf *lbuf)
|
||||
{
|
||||
struct member *m;
|
||||
|
||||
@@ -304,10 +295,8 @@ sudo_file_append_cmnd(cs, tags, lbuf)
|
||||
}
|
||||
|
||||
static int
|
||||
sudo_file_display_priv_short(pw, us, lbuf)
|
||||
struct passwd *pw;
|
||||
struct userspec *us;
|
||||
struct lbuf *lbuf;
|
||||
sudo_file_display_priv_short(struct passwd *pw, struct userspec *us,
|
||||
struct lbuf *lbuf)
|
||||
{
|
||||
struct cmndspec *cs;
|
||||
struct member *m;
|
||||
@@ -358,10 +347,8 @@ sudo_file_display_priv_short(pw, us, lbuf)
|
||||
}
|
||||
|
||||
static int
|
||||
sudo_file_display_priv_long(pw, us, lbuf)
|
||||
struct passwd *pw;
|
||||
struct userspec *us;
|
||||
struct lbuf *lbuf;
|
||||
sudo_file_display_priv_long(struct passwd *pw, struct userspec *us,
|
||||
struct lbuf *lbuf)
|
||||
{
|
||||
struct cmndspec *cs;
|
||||
struct member *m;
|
||||
@@ -412,10 +399,8 @@ sudo_file_display_priv_long(pw, us, lbuf)
|
||||
}
|
||||
|
||||
int
|
||||
sudo_file_display_privs(nss, pw, lbuf)
|
||||
struct sudo_nss *nss;
|
||||
struct passwd *pw;
|
||||
struct lbuf *lbuf;
|
||||
sudo_file_display_privs(struct sudo_nss *nss, struct passwd *pw,
|
||||
struct lbuf *lbuf)
|
||||
{
|
||||
struct userspec *us;
|
||||
int nfound = 0;
|
||||
@@ -439,10 +424,8 @@ sudo_file_display_privs(nss, pw, lbuf)
|
||||
* Display matching Defaults entries for the given user on this host.
|
||||
*/
|
||||
int
|
||||
sudo_file_display_defaults(nss, pw, lbuf)
|
||||
struct sudo_nss *nss;
|
||||
struct passwd *pw;
|
||||
struct lbuf *lbuf;
|
||||
sudo_file_display_defaults(struct sudo_nss *nss, struct passwd *pw,
|
||||
struct lbuf *lbuf)
|
||||
{
|
||||
struct defaults *d;
|
||||
char *prefix;
|
||||
@@ -493,10 +476,8 @@ sudo_file_display_defaults(nss, pw, lbuf)
|
||||
* Display Defaults entries that are per-runas or per-command
|
||||
*/
|
||||
int
|
||||
sudo_file_display_bound_defaults(nss, pw, lbuf)
|
||||
struct sudo_nss *nss;
|
||||
struct passwd *pw;
|
||||
struct lbuf *lbuf;
|
||||
sudo_file_display_bound_defaults(struct sudo_nss *nss, struct passwd *pw,
|
||||
struct lbuf *lbuf)
|
||||
{
|
||||
int nfound = 0;
|
||||
|
||||
@@ -511,9 +492,7 @@ sudo_file_display_bound_defaults(nss, pw, lbuf)
|
||||
* Display Defaults entries of the given type.
|
||||
*/
|
||||
static int
|
||||
display_bound_defaults(dtype, lbuf)
|
||||
int dtype;
|
||||
struct lbuf *lbuf;
|
||||
display_bound_defaults(int dtype, struct lbuf *lbuf)
|
||||
{
|
||||
struct defaults *d;
|
||||
struct member *m, *binding = NULL;
|
||||
@@ -574,9 +553,7 @@ display_bound_defaults(dtype, lbuf)
|
||||
}
|
||||
|
||||
int
|
||||
sudo_file_display_cmnd(nss, pw)
|
||||
struct sudo_nss *nss;
|
||||
struct passwd *pw;
|
||||
sudo_file_display_cmnd(struct sudo_nss *nss, struct passwd *pw)
|
||||
{
|
||||
struct cmndspec *cs;
|
||||
struct member *match;
|
||||
@@ -624,10 +601,8 @@ sudo_file_display_cmnd(nss, pw)
|
||||
* Print the contents of a struct member to stdout
|
||||
*/
|
||||
static void
|
||||
_print_member(lbuf, name, type, negated, alias_type)
|
||||
struct lbuf *lbuf;
|
||||
char *name;
|
||||
int type, negated, alias_type;
|
||||
_print_member(struct lbuf *lbuf, char *name, int type, int negated,
|
||||
int alias_type)
|
||||
{
|
||||
struct alias *a;
|
||||
struct member *m;
|
||||
@@ -665,10 +640,8 @@ _print_member(lbuf, name, type, negated, alias_type)
|
||||
}
|
||||
|
||||
static void
|
||||
print_member(lbuf, name, type, negated, alias_type)
|
||||
struct lbuf *lbuf;
|
||||
char *name;
|
||||
int type, negated, alias_type;
|
||||
print_member(struct lbuf *lbuf, char *name, int type, int negated,
|
||||
int alias_type)
|
||||
{
|
||||
alias_seqno++;
|
||||
_print_member(lbuf, name, type, negated, alias_type);
|
||||
|
@@ -67,9 +67,7 @@ static int cmp_grnam(const void *, const void *);
|
||||
* Compare by uid.
|
||||
*/
|
||||
static int
|
||||
cmp_pwuid(v1, v2)
|
||||
const void *v1;
|
||||
const void *v2;
|
||||
cmp_pwuid(const void *v1, const void *v2)
|
||||
{
|
||||
const struct passwd *pw1 = (const struct passwd *) v1;
|
||||
const struct passwd *pw2 = (const struct passwd *) v2;
|
||||
@@ -80,9 +78,7 @@ cmp_pwuid(v1, v2)
|
||||
* Compare by user name.
|
||||
*/
|
||||
static int
|
||||
cmp_pwnam(v1, v2)
|
||||
const void *v1;
|
||||
const void *v2;
|
||||
cmp_pwnam(const void *v1, const void *v2)
|
||||
{
|
||||
const struct passwd *pw1 = (const struct passwd *) v1;
|
||||
const struct passwd *pw2 = (const struct passwd *) v2;
|
||||
@@ -111,8 +107,7 @@ do { \
|
||||
* that we care about. Fills in pw_passwd from shadow file.
|
||||
*/
|
||||
static struct passwd *
|
||||
sudo_pwdup(pw)
|
||||
const struct passwd *pw;
|
||||
sudo_pwdup(const struct passwd *pw)
|
||||
{
|
||||
char *cp;
|
||||
const char *pw_shell;
|
||||
@@ -162,8 +157,7 @@ sudo_pwdup(pw)
|
||||
* Fills in pw_passwd from shadow file if necessary.
|
||||
*/
|
||||
struct passwd *
|
||||
sudo_getpwuid(uid)
|
||||
uid_t uid;
|
||||
sudo_getpwuid(uid_t uid)
|
||||
{
|
||||
struct passwd key, *pw;
|
||||
struct rbnode *node;
|
||||
@@ -202,8 +196,7 @@ sudo_getpwuid(uid)
|
||||
* Fills in pw_passwd from shadow file if necessary.
|
||||
*/
|
||||
struct passwd *
|
||||
sudo_getpwnam(name)
|
||||
const char *name;
|
||||
sudo_getpwnam(const char *name)
|
||||
{
|
||||
struct passwd key, *pw;
|
||||
struct rbnode *node;
|
||||
@@ -246,9 +239,7 @@ sudo_getpwnam(name)
|
||||
* Take a uid in string form "#123" and return a faked up passwd struct.
|
||||
*/
|
||||
struct passwd *
|
||||
sudo_fakepwnam(user, gid)
|
||||
const char *user;
|
||||
gid_t gid;
|
||||
sudo_fakepwnam(const char *user, gid_t gid)
|
||||
{
|
||||
struct passwd *pw;
|
||||
struct rbnode *node;
|
||||
@@ -288,8 +279,7 @@ sudo_fakepwnam(user, gid)
|
||||
* Take a gid in string form "#123" and return a faked up group struct.
|
||||
*/
|
||||
struct group *
|
||||
sudo_fakegrnam(group)
|
||||
const char *group;
|
||||
sudo_fakegrnam(const char *group)
|
||||
{
|
||||
struct group *gr;
|
||||
struct rbnode *node;
|
||||
@@ -342,8 +332,7 @@ sudo_freepwcache(void)
|
||||
}
|
||||
|
||||
static void
|
||||
pw_free(v)
|
||||
void *v;
|
||||
pw_free(void *v)
|
||||
{
|
||||
struct passwd *pw = (struct passwd *) v;
|
||||
|
||||
@@ -369,9 +358,7 @@ sudo_endpwent(void)
|
||||
* Compare by gid.
|
||||
*/
|
||||
static int
|
||||
cmp_grgid(v1, v2)
|
||||
const void *v1;
|
||||
const void *v2;
|
||||
cmp_grgid(const void *v1, const void *v2)
|
||||
{
|
||||
const struct group *grp1 = (const struct group *) v1;
|
||||
const struct group *grp2 = (const struct group *) v2;
|
||||
@@ -382,9 +369,7 @@ cmp_grgid(v1, v2)
|
||||
* Compare by group name.
|
||||
*/
|
||||
static int
|
||||
cmp_grnam(v1, v2)
|
||||
const void *v1;
|
||||
const void *v2;
|
||||
cmp_grnam(const void *v1, const void *v2)
|
||||
{
|
||||
const struct group *grp1 = (const struct group *) v1;
|
||||
const struct group *grp2 = (const struct group *) v2;
|
||||
@@ -392,8 +377,7 @@ cmp_grnam(v1, v2)
|
||||
}
|
||||
|
||||
struct group *
|
||||
sudo_grdup(gr)
|
||||
const struct group *gr;
|
||||
sudo_grdup(const struct group *gr)
|
||||
{
|
||||
char *cp;
|
||||
size_t nsize, psize, nmem, total, len;
|
||||
@@ -442,8 +426,7 @@ sudo_grdup(gr)
|
||||
* Get a group entry by gid and allocate space for it.
|
||||
*/
|
||||
struct group *
|
||||
sudo_getgrgid(gid)
|
||||
gid_t gid;
|
||||
sudo_getgrgid(gid_t gid)
|
||||
{
|
||||
struct group key, *gr;
|
||||
struct rbnode *node;
|
||||
@@ -476,8 +459,7 @@ sudo_getgrgid(gid)
|
||||
* Get a group entry by name and allocate space for it.
|
||||
*/
|
||||
struct group *
|
||||
sudo_getgrnam(name)
|
||||
const char *name;
|
||||
sudo_getgrnam(const char *name)
|
||||
{
|
||||
struct group key, *gr;
|
||||
struct rbnode *node;
|
||||
@@ -547,9 +529,7 @@ sudo_endgrent(void)
|
||||
}
|
||||
|
||||
int
|
||||
user_in_group(pw, group)
|
||||
struct passwd *pw;
|
||||
const char *group;
|
||||
user_in_group(struct passwd *pw, const char *group)
|
||||
{
|
||||
#ifdef HAVE_MBR_CHECK_MEMBERSHIP
|
||||
uuid_t gu, uu;
|
||||
|
@@ -85,8 +85,7 @@ static void _rbdestroy(struct rbtree *, struct rbnode *, void (*)(void *));
|
||||
* Allocates and returns the initialized (empty) tree.
|
||||
*/
|
||||
struct rbtree *
|
||||
rbcreate(compar)
|
||||
int (*compar)(const void *, const void*);
|
||||
rbcreate(int (*compar)(const void *, const void*))
|
||||
{
|
||||
struct rbtree *tree;
|
||||
|
||||
@@ -116,9 +115,7 @@ rbcreate(compar)
|
||||
* Perform a left rotation starting at node.
|
||||
*/
|
||||
static void
|
||||
rotate_left(tree, node)
|
||||
struct rbtree *tree;
|
||||
struct rbnode *node;
|
||||
rotate_left(struct rbtree *tree, struct rbnode *node)
|
||||
{
|
||||
struct rbnode *child;
|
||||
|
||||
@@ -141,9 +138,7 @@ rotate_left(tree, node)
|
||||
* Perform a right rotation starting at node.
|
||||
*/
|
||||
static void
|
||||
rotate_right(tree, node)
|
||||
struct rbtree *tree;
|
||||
struct rbnode *node;
|
||||
rotate_right(struct rbtree *tree, struct rbnode *node)
|
||||
{
|
||||
struct rbnode *child;
|
||||
|
||||
@@ -168,9 +163,7 @@ rotate_right(tree, node)
|
||||
* already exists, a pointer to the existant node is returned.
|
||||
*/
|
||||
struct rbnode *
|
||||
rbinsert(tree, data)
|
||||
struct rbtree *tree;
|
||||
void *data;
|
||||
rbinsert(struct rbtree *tree, void *data)
|
||||
{
|
||||
struct rbnode *node = rbfirst(tree);
|
||||
struct rbnode *parent = rbroot(tree);
|
||||
@@ -262,9 +255,7 @@ rbinsert(tree, data)
|
||||
* Returns a pointer to the node if found, else NULL.
|
||||
*/
|
||||
struct rbnode *
|
||||
rbfind(tree, key)
|
||||
struct rbtree *tree;
|
||||
void *key;
|
||||
rbfind(struct rbtree *tree, void *key)
|
||||
{
|
||||
struct rbnode *node = rbfirst(tree);
|
||||
int res;
|
||||
@@ -283,12 +274,8 @@ rbfind(tree, key)
|
||||
* error value is returned. Returns 0 on successful traversal.
|
||||
*/
|
||||
int
|
||||
rbapply_node(tree, node, func, cookie, order)
|
||||
struct rbtree *tree;
|
||||
struct rbnode *node;
|
||||
int (*func)(void *, void *);
|
||||
void *cookie;
|
||||
enum rbtraversal order;
|
||||
rbapply_node(struct rbtree *tree, struct rbnode *node,
|
||||
int (*func)(void *, void *), void *cookie, enum rbtraversal order)
|
||||
{
|
||||
int error;
|
||||
|
||||
@@ -314,9 +301,7 @@ rbapply_node(tree, node, func, cookie, order)
|
||||
* Returns the successor of node, or nil if there is none.
|
||||
*/
|
||||
static struct rbnode *
|
||||
rbsuccessor(tree, node)
|
||||
struct rbtree *tree;
|
||||
struct rbnode *node;
|
||||
rbsuccessor(struct rbtree *tree, struct rbnode *node)
|
||||
{
|
||||
struct rbnode *succ;
|
||||
|
||||
@@ -337,10 +322,7 @@ rbsuccessor(tree, node)
|
||||
* Recursive portion of rbdestroy().
|
||||
*/
|
||||
static void
|
||||
_rbdestroy(tree, node, destroy)
|
||||
struct rbtree *tree;
|
||||
struct rbnode *node;
|
||||
void (*destroy)(void *);
|
||||
_rbdestroy(struct rbtree *tree, struct rbnode *node, void (*destroy)(void *))
|
||||
{
|
||||
if (node != rbnil(tree)) {
|
||||
_rbdestroy(tree, node->left, destroy);
|
||||
@@ -356,9 +338,7 @@ _rbdestroy(tree, node, destroy)
|
||||
* for each node and then freeing the tree itself.
|
||||
*/
|
||||
void
|
||||
rbdestroy(tree, destroy)
|
||||
struct rbtree *tree;
|
||||
void (*destroy)(void *);
|
||||
rbdestroy(struct rbtree *tree, void (*destroy)(void *))
|
||||
{
|
||||
_rbdestroy(tree, rbfirst(tree), destroy);
|
||||
efree(tree);
|
||||
@@ -367,9 +347,7 @@ rbdestroy(tree, destroy)
|
||||
/*
|
||||
* Delete node 'z' from the tree and return its data pointer.
|
||||
*/
|
||||
void *rbdelete(tree, z)
|
||||
struct rbtree *tree;
|
||||
struct rbnode *z;
|
||||
void *rbdelete(struct rbtree *tree, struct rbnode *z)
|
||||
{
|
||||
struct rbnode *x, *y;
|
||||
void *data = z->data;
|
||||
@@ -411,9 +389,7 @@ void *rbdelete(tree, z)
|
||||
* colors to restore the 4 properties inherent in red-black trees.
|
||||
*/
|
||||
static void
|
||||
rbrepair(tree, node)
|
||||
struct rbtree *tree;
|
||||
struct rbnode *node;
|
||||
rbrepair(struct rbtree *tree, struct rbnode *node)
|
||||
{
|
||||
struct rbnode *sibling;
|
||||
|
||||
|
@@ -55,7 +55,7 @@ extern struct sudo_nss sudo_nss_ldap;
|
||||
* Returns a tail queue of matches.
|
||||
*/
|
||||
struct sudo_nss_list *
|
||||
sudo_read_nss()
|
||||
sudo_read_nss(void)
|
||||
{
|
||||
FILE *fp;
|
||||
char *cp;
|
||||
@@ -113,7 +113,7 @@ nomatch:
|
||||
* Returns a tail queue of matches.
|
||||
*/
|
||||
struct sudo_nss_list *
|
||||
sudo_read_nss()
|
||||
sudo_read_nss(void)
|
||||
{
|
||||
FILE *fp;
|
||||
char *cp, *ep;
|
||||
@@ -189,7 +189,7 @@ nomatch:
|
||||
* Non-nsswitch.conf version with hard-coded order.
|
||||
*/
|
||||
struct sudo_nss_list *
|
||||
sudo_read_nss()
|
||||
sudo_read_nss(void)
|
||||
{
|
||||
static struct sudo_nss_list snl;
|
||||
|
||||
@@ -207,8 +207,7 @@ sudo_read_nss()
|
||||
|
||||
/* Reset user_groups based on passwd entry. */
|
||||
static void
|
||||
reset_groups(pw)
|
||||
struct passwd *pw;
|
||||
reset_groups(struct passwd *pw)
|
||||
{
|
||||
#if defined(HAVE_INITGROUPS) && defined(HAVE_GETGROUPS)
|
||||
if (pw != sudo_user.pw) {
|
||||
@@ -245,9 +244,7 @@ output(const char *buf)
|
||||
* We only get here if the user is allowed to run something on this host.
|
||||
*/
|
||||
void
|
||||
display_privs(snl, pw)
|
||||
struct sudo_nss_list *snl;
|
||||
struct passwd *pw;
|
||||
display_privs(struct sudo_nss_list *snl, struct passwd *pw)
|
||||
{
|
||||
struct sudo_nss *nss;
|
||||
struct lbuf lbuf;
|
||||
@@ -303,9 +300,7 @@ display_privs(snl, pw)
|
||||
* command is allowed.
|
||||
*/
|
||||
int
|
||||
display_cmnd(snl, pw)
|
||||
struct sudo_nss_list *snl;
|
||||
struct passwd *pw;
|
||||
display_cmnd(struct sudo_nss_list *snl, struct passwd *pw)
|
||||
{
|
||||
struct sudo_nss *nss;
|
||||
|
||||
|
@@ -711,8 +711,7 @@ init_vars(char * const envp[])
|
||||
* and apply any command-specific defaults entries.
|
||||
*/
|
||||
static int
|
||||
set_cmnd(sudo_mode)
|
||||
int sudo_mode;
|
||||
set_cmnd(int sudo_mode)
|
||||
{
|
||||
int rval;
|
||||
|
||||
@@ -778,10 +777,7 @@ set_cmnd(sudo_mode)
|
||||
* Returns a handle to the sudoers file or NULL on error.
|
||||
*/
|
||||
FILE *
|
||||
open_sudoers(sudoers, doedit, keepopen)
|
||||
const char *sudoers;
|
||||
int doedit;
|
||||
int *keepopen;
|
||||
open_sudoers(const char *sudoers, int doedit, int *keepopen)
|
||||
{
|
||||
struct stat statbuf;
|
||||
FILE *fp = NULL;
|
||||
@@ -855,8 +851,7 @@ open_sudoers(sudoers, doedit, keepopen)
|
||||
|
||||
#ifdef HAVE_LOGIN_CAP_H
|
||||
static void
|
||||
set_loginclass(pw)
|
||||
struct passwd *pw;
|
||||
set_loginclass(struct passwd *pw)
|
||||
{
|
||||
int errflags;
|
||||
|
||||
@@ -890,16 +885,14 @@ set_loginclass(pw)
|
||||
}
|
||||
#else
|
||||
static void
|
||||
set_loginclass(pw)
|
||||
struct passwd *pw;
|
||||
set_loginclass(struct passwd *pw)
|
||||
{
|
||||
}
|
||||
#endif /* HAVE_LOGIN_CAP_H */
|
||||
|
||||
#ifdef HAVE_PROJECT_H
|
||||
static void
|
||||
set_project(pw)
|
||||
struct passwd *pw;
|
||||
set_project(struct passwd *pw)
|
||||
{
|
||||
int errflags = NO_MAIL|MSG_ONLY|NO_EXIT;
|
||||
int errval;
|
||||
@@ -956,8 +949,7 @@ set_project(pw)
|
||||
}
|
||||
#else
|
||||
static void
|
||||
set_project(pw)
|
||||
struct passwd *pw;
|
||||
set_project(struct passwd *pw)
|
||||
{
|
||||
}
|
||||
#endif /* HAVE_PROJECT_H */
|
||||
@@ -1007,8 +999,7 @@ set_fqdn(void)
|
||||
* By default, this is "root". Updates runas_pw as a side effect.
|
||||
*/
|
||||
static void
|
||||
set_runaspw(user)
|
||||
char *user;
|
||||
set_runaspw(char *user)
|
||||
{
|
||||
if (*user == '#') {
|
||||
if ((runas_pw = sudo_getpwuid(atoi(user + 1))) == NULL)
|
||||
@@ -1026,8 +1017,7 @@ set_runaspw(user)
|
||||
* Updates runas_pw as a side effect.
|
||||
*/
|
||||
static void
|
||||
set_runasgr(group)
|
||||
char *group;
|
||||
set_runasgr(char *group)
|
||||
{
|
||||
if (*group == '#') {
|
||||
if ((runas_gr = sudo_getgrgid(atoi(group + 1))) == NULL)
|
||||
@@ -1044,7 +1034,7 @@ set_runasgr(group)
|
||||
* case, this matches sudo_user.pw or runas_pw.
|
||||
*/
|
||||
static struct passwd *
|
||||
get_authpw()
|
||||
get_authpw(void)
|
||||
{
|
||||
struct passwd *pw;
|
||||
|
||||
@@ -1069,8 +1059,7 @@ get_authpw()
|
||||
* Cleanup hook for error()/errorx()
|
||||
*/
|
||||
void
|
||||
cleanup(gotsignal)
|
||||
int gotsignal;
|
||||
cleanup(int gotsignal)
|
||||
{
|
||||
struct sudo_nss *nss;
|
||||
|
||||
|
@@ -171,9 +171,7 @@ static void usage(void);
|
||||
isalnum((s)[3]) && isalnum((s)[4]) && isalnum((s)[5]) && (s)[6] == '\0')
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ch, plen, nready, interactive = 0, listonly = 0;
|
||||
const char *id, *user = NULL, *pattern = NULL, *tty = NULL;
|
||||
@@ -369,8 +367,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
static void
|
||||
delay(secs)
|
||||
double secs;
|
||||
delay(double secs)
|
||||
{
|
||||
struct timespec ts, rts;
|
||||
int rval;
|
||||
@@ -396,9 +393,7 @@ delay(secs)
|
||||
* Build expression list from search args
|
||||
*/
|
||||
static int
|
||||
parse_expr(headp, argv)
|
||||
struct search_node **headp;
|
||||
char **argv;
|
||||
parse_expr(struct search_node **headp, char *argv[])
|
||||
{
|
||||
struct search_node *sn, *newsn;
|
||||
char or = 0, not = 0, type, **av;
|
||||
@@ -528,9 +523,7 @@ parse_expr(headp, argv)
|
||||
}
|
||||
|
||||
static int
|
||||
match_expr(head, log)
|
||||
struct search_node *head;
|
||||
struct log_info *log;
|
||||
match_expr(struct search_node *head, struct log_info *log)
|
||||
{
|
||||
struct search_node *sn;
|
||||
int matched = 1, rc;
|
||||
@@ -586,11 +579,7 @@ match_expr(head, log)
|
||||
}
|
||||
|
||||
static int
|
||||
list_session_dir(pathbuf, re, user, tty)
|
||||
char *pathbuf;
|
||||
REGEX_T *re;
|
||||
const char *user;
|
||||
const char *tty;
|
||||
list_session_dir(char *pathbuf, REGEX_T *re, const char *user, const char *tty)
|
||||
{
|
||||
FILE *fp;
|
||||
DIR *d;
|
||||
@@ -688,12 +677,8 @@ list_session_dir(pathbuf, re, user, tty)
|
||||
}
|
||||
|
||||
static int
|
||||
list_sessions(argc, argv, pattern, user, tty)
|
||||
int argc;
|
||||
char **argv;
|
||||
const char *pattern;
|
||||
const char *user;
|
||||
const char *tty;
|
||||
list_sessions(int argc, char **argv, const char *pattern, const char *user,
|
||||
const char *tty)
|
||||
{
|
||||
DIR *d1, *d2;
|
||||
struct dirent *dp1, *dp2;
|
||||
@@ -760,9 +745,7 @@ list_sessions(argc, argv, pattern, user, tty)
|
||||
* pause, slow, fast
|
||||
*/
|
||||
static void
|
||||
check_input(ttyfd, speed)
|
||||
int ttyfd;
|
||||
double *speed;
|
||||
check_input(int ttyfd, double *speed)
|
||||
{
|
||||
fd_set *fdsr;
|
||||
int nready, paused = 0;
|
||||
@@ -803,7 +786,7 @@ check_input(ttyfd, speed)
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s [-d directory] [-m max_wait] [-s speed_factor] ID\n",
|
||||
@@ -818,8 +801,7 @@ usage()
|
||||
* Cleanup hook for error()/errorx()
|
||||
*/
|
||||
void
|
||||
cleanup(signo)
|
||||
int signo;
|
||||
cleanup(int signo)
|
||||
{
|
||||
term_restore(STDOUT_FILENO, 0);
|
||||
if (signo)
|
||||
|
@@ -115,9 +115,7 @@ extern struct passwd *getpwnam(const char *);
|
||||
extern struct passwd *getpwuid(uid_t);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct cmndspec *cs;
|
||||
struct privilege *priv;
|
||||
@@ -297,8 +295,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
void
|
||||
set_runaspw(user)
|
||||
char *user;
|
||||
set_runaspw(char *user)
|
||||
{
|
||||
if (*user == '#') {
|
||||
if ((runas_pw = sudo_getpwuid(atoi(user + 1))) == NULL)
|
||||
@@ -310,8 +307,7 @@ set_runaspw(user)
|
||||
}
|
||||
|
||||
void
|
||||
set_runasgr(group)
|
||||
char *group;
|
||||
set_runasgr(char *group)
|
||||
{
|
||||
if (*group == '#') {
|
||||
if ((runas_gr = sudo_getgrgid(atoi(group + 1))) == NULL)
|
||||
@@ -323,41 +319,37 @@ set_runasgr(group)
|
||||
}
|
||||
|
||||
void
|
||||
sudo_setspent()
|
||||
sudo_setspent(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
sudo_endspent()
|
||||
sudo_endspent(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char *
|
||||
sudo_getepw(pw)
|
||||
const struct passwd *pw;
|
||||
sudo_getepw(const struct passwd *pw)
|
||||
{
|
||||
return (pw->pw_passwd);
|
||||
}
|
||||
|
||||
void
|
||||
set_fqdn()
|
||||
set_fqdn(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FILE *
|
||||
open_sudoers(path, isdir, keepopen)
|
||||
const char *path;
|
||||
int isdir;
|
||||
int *keepopen;
|
||||
open_sudoers(const char *path, int isdir, int *keepopen)
|
||||
{
|
||||
return(fopen(path, "r"));
|
||||
}
|
||||
|
||||
void
|
||||
init_envtables()
|
||||
init_envtables(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -374,8 +366,7 @@ restore_perms(void)
|
||||
}
|
||||
|
||||
void
|
||||
cleanup(gotsignal)
|
||||
int gotsignal;
|
||||
cleanup(int gotsignal)
|
||||
{
|
||||
if (!gotsignal) {
|
||||
sudo_endpwent();
|
||||
@@ -384,8 +375,7 @@ cleanup(gotsignal)
|
||||
}
|
||||
|
||||
void
|
||||
print_member(m)
|
||||
struct member *m;
|
||||
print_member(struct member *m)
|
||||
{
|
||||
struct sudo_command *c;
|
||||
|
||||
@@ -403,7 +393,7 @@ print_member(m)
|
||||
}
|
||||
|
||||
void
|
||||
print_defaults()
|
||||
print_defaults(void)
|
||||
{
|
||||
struct defaults *d;
|
||||
struct member *m;
|
||||
@@ -438,8 +428,7 @@ print_defaults()
|
||||
}
|
||||
|
||||
int
|
||||
print_alias(v1, v2)
|
||||
void *v1, *v2;
|
||||
print_alias(void *v1, void *v2)
|
||||
{
|
||||
struct alias *a = (struct alias *)v1;
|
||||
struct member *m;
|
||||
@@ -474,8 +463,7 @@ print_alias(v1, v2)
|
||||
}
|
||||
|
||||
void
|
||||
print_privilege(priv)
|
||||
struct privilege *priv;
|
||||
print_privilege(struct privilege *priv)
|
||||
{
|
||||
struct cmndspec *cs;
|
||||
struct member *m;
|
||||
@@ -522,7 +510,7 @@ print_privilege(priv)
|
||||
}
|
||||
|
||||
void
|
||||
print_userspecs()
|
||||
print_userspecs(void)
|
||||
{
|
||||
struct member *m;
|
||||
struct userspec *us;
|
||||
@@ -540,7 +528,7 @@ print_userspecs()
|
||||
}
|
||||
|
||||
void
|
||||
dump_sudoers()
|
||||
dump_sudoers(void)
|
||||
{
|
||||
print_defaults();
|
||||
|
||||
@@ -552,7 +540,7 @@ dump_sudoers()
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
(void) fprintf(stderr, "usage: %s [-d] [-G grfile] [-g group] [-h host] [-p pwfile] [-u user] <user> <command> [args]\n", getprogname());
|
||||
exit(1);
|
||||
|
@@ -37,9 +37,7 @@ char *get_timestr(time_t, int);
|
||||
* Uses strftime() if available, else falls back to ctime().
|
||||
*/
|
||||
char *
|
||||
get_timestr(tstamp, log_year)
|
||||
time_t tstamp;
|
||||
int log_year;
|
||||
get_timestr(time_t tstamp, int log_year)
|
||||
{
|
||||
char *s;
|
||||
#ifdef HAVE_STRFTIME
|
||||
|
@@ -79,8 +79,7 @@ struct passwd *getpwnam(const char *);
|
||||
struct passwd *getpwuid(uid_t);
|
||||
|
||||
void
|
||||
setpwfile(file)
|
||||
const char *file;
|
||||
setpwfile(const char *file)
|
||||
{
|
||||
pwfile = file;
|
||||
if (pwf != NULL)
|
||||
@@ -88,7 +87,7 @@ setpwfile(file)
|
||||
}
|
||||
|
||||
void
|
||||
setpwent()
|
||||
setpwent(void)
|
||||
{
|
||||
if (pwf == NULL)
|
||||
pwf = fopen(pwfile, "r");
|
||||
@@ -98,7 +97,7 @@ setpwent()
|
||||
}
|
||||
|
||||
void
|
||||
endpwent()
|
||||
endpwent(void)
|
||||
{
|
||||
if (pwf != NULL) {
|
||||
fclose(pwf);
|
||||
@@ -108,7 +107,7 @@ endpwent()
|
||||
}
|
||||
|
||||
struct passwd *
|
||||
getpwent()
|
||||
getpwent(void)
|
||||
{
|
||||
static struct passwd pw;
|
||||
static char pwbuf[LINE_MAX];
|
||||
@@ -151,8 +150,7 @@ getpwent()
|
||||
}
|
||||
|
||||
struct passwd *
|
||||
getpwnam(name)
|
||||
const char *name;
|
||||
getpwnam(const char *name)
|
||||
{
|
||||
struct passwd *pw;
|
||||
|
||||
@@ -172,8 +170,7 @@ getpwnam(name)
|
||||
}
|
||||
|
||||
struct passwd *
|
||||
getpwuid(uid)
|
||||
uid_t uid;
|
||||
getpwuid(uid_t uid)
|
||||
{
|
||||
struct passwd *pw;
|
||||
|
||||
@@ -193,8 +190,7 @@ getpwuid(uid)
|
||||
}
|
||||
|
||||
void
|
||||
setgrfile(file)
|
||||
const char *file;
|
||||
setgrfile(const char *file)
|
||||
{
|
||||
grfile = file;
|
||||
if (grf != NULL)
|
||||
@@ -202,7 +198,7 @@ setgrfile(file)
|
||||
}
|
||||
|
||||
void
|
||||
setgrent()
|
||||
setgrent(void)
|
||||
{
|
||||
if (grf == NULL)
|
||||
grf = fopen(grfile, "r");
|
||||
@@ -212,7 +208,7 @@ setgrent()
|
||||
}
|
||||
|
||||
void
|
||||
endgrent()
|
||||
endgrent(void)
|
||||
{
|
||||
if (grf != NULL) {
|
||||
fclose(grf);
|
||||
@@ -222,7 +218,7 @@ endgrent()
|
||||
}
|
||||
|
||||
struct group *
|
||||
getgrent()
|
||||
getgrent(void)
|
||||
{
|
||||
static struct group gr;
|
||||
static char grbuf[LINE_MAX], *gr_mem[GRMEM_MAX+1];
|
||||
@@ -263,8 +259,7 @@ getgrent()
|
||||
}
|
||||
|
||||
struct group *
|
||||
getgrnam(name)
|
||||
const char *name;
|
||||
getgrnam(const char *name)
|
||||
{
|
||||
struct group *gr;
|
||||
|
||||
@@ -284,8 +279,7 @@ getgrnam(name)
|
||||
}
|
||||
|
||||
struct group *
|
||||
getgrgid(gid)
|
||||
gid_t gid;
|
||||
getgrgid(gid_t gid)
|
||||
{
|
||||
struct group *gr;
|
||||
|
||||
|
@@ -262,7 +262,7 @@ sudo_nonunix_groupcheck_init(void)
|
||||
* Clean up nonunix_groupcheck state.
|
||||
*/
|
||||
void
|
||||
sudo_nonunix_groupcheck_cleanup()
|
||||
sudo_nonunix_groupcheck_cleanup(void)
|
||||
{
|
||||
if (err_msg) {
|
||||
free(err_msg);
|
||||
|
@@ -141,9 +141,7 @@ static struct sudoerslist {
|
||||
static struct rbtree *alias_freelist;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct sudoersfile *sp;
|
||||
char *args, *editor, *sudoers_path;
|
||||
@@ -251,10 +249,7 @@ main(argc, argv)
|
||||
* Returns TRUE on success, else FALSE.
|
||||
*/
|
||||
static int
|
||||
edit_sudoers(sp, editor, args, lineno)
|
||||
struct sudoersfile *sp;
|
||||
char *editor, *args;
|
||||
int lineno;
|
||||
edit_sudoers(struct sudoersfile *sp, char *editor, char *args, int lineno)
|
||||
{
|
||||
int tfd; /* sudoers temp file descriptor */
|
||||
int modified; /* was the file modified? */
|
||||
@@ -399,9 +394,7 @@ edit_sudoers(sp, editor, args, lineno)
|
||||
* Returns TRUE on success, else FALSE.
|
||||
*/
|
||||
static int
|
||||
reparse_sudoers(editor, args, strict, quiet)
|
||||
char *editor, *args;
|
||||
int strict, quiet;
|
||||
reparse_sudoers(char *editor, char *args, int strict, int quiet)
|
||||
{
|
||||
struct sudoersfile *sp, *last;
|
||||
FILE *fp;
|
||||
@@ -477,9 +470,7 @@ reparse_sudoers(editor, args, strict, quiet)
|
||||
* move it into place. Returns TRUE on success, else FALSE.
|
||||
*/
|
||||
static int
|
||||
install_sudoers(sp, oldperms)
|
||||
struct sudoersfile *sp;
|
||||
int oldperms;
|
||||
install_sudoers(struct sudoersfile *sp, int oldperms)
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
@@ -555,42 +546,41 @@ install_sudoers(sp, oldperms)
|
||||
|
||||
/* STUB */
|
||||
void
|
||||
set_fqdn()
|
||||
set_fqdn(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* STUB */
|
||||
void
|
||||
init_envtables()
|
||||
init_envtables(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* STUB */
|
||||
int
|
||||
user_is_exempt()
|
||||
user_is_exempt(void)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/* STUB */
|
||||
void
|
||||
sudo_setspent()
|
||||
sudo_setspent(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* STUB */
|
||||
void
|
||||
sudo_endspent()
|
||||
sudo_endspent(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char *
|
||||
sudo_getepw(pw)
|
||||
const struct passwd *pw;
|
||||
sudo_getepw(const struct passwd *pw)
|
||||
{
|
||||
return (pw->pw_passwd);
|
||||
}
|
||||
@@ -600,7 +590,7 @@ sudo_getepw(pw)
|
||||
* to do now. Returns the first letter of their choice.
|
||||
*/
|
||||
static char
|
||||
whatnow()
|
||||
whatnow(void)
|
||||
{
|
||||
int choice, c;
|
||||
|
||||
@@ -631,7 +621,7 @@ whatnow()
|
||||
* Install signal handlers for visudo.
|
||||
*/
|
||||
static void
|
||||
setup_signals()
|
||||
setup_signals(void)
|
||||
{
|
||||
sigaction_t sa;
|
||||
|
||||
@@ -649,9 +639,7 @@ setup_signals()
|
||||
}
|
||||
|
||||
static int
|
||||
run_command(path, argv)
|
||||
char *path;
|
||||
char **argv;
|
||||
run_command(char *path, char **argv)
|
||||
{
|
||||
int status;
|
||||
pid_t pid, rv;
|
||||
@@ -684,10 +672,7 @@ run_command(path, argv)
|
||||
}
|
||||
|
||||
static int
|
||||
check_syntax(sudoers_path, quiet, strict)
|
||||
char *sudoers_path;
|
||||
int quiet;
|
||||
int strict;
|
||||
check_syntax(char *sudoers_path, int quiet, int strict)
|
||||
{
|
||||
struct stat sb;
|
||||
int error;
|
||||
@@ -751,10 +736,7 @@ check_syntax(sudoers_path, quiet, strict)
|
||||
* any subsequent files #included via a callback from the parser.
|
||||
*/
|
||||
FILE *
|
||||
open_sudoers(path, doedit, keepopen)
|
||||
const char *path;
|
||||
int doedit;
|
||||
int *keepopen;
|
||||
open_sudoers(const char *path, int doedit, int *keepopen)
|
||||
{
|
||||
struct sudoersfile *entry;
|
||||
FILE *fp;
|
||||
@@ -806,8 +788,7 @@ open_sudoers(path, doedit, keepopen)
|
||||
}
|
||||
|
||||
static char *
|
||||
get_editor(args)
|
||||
char **args;
|
||||
get_editor(char **args)
|
||||
{
|
||||
char *Editor, *EditorArgs, *EditorPath, *UserEditor, *UserEditorArgs;
|
||||
|
||||
@@ -910,8 +891,7 @@ get_editor(args)
|
||||
* Split out any command line arguments and return them.
|
||||
*/
|
||||
static char *
|
||||
get_args(cmnd)
|
||||
char *cmnd;
|
||||
get_args(char *cmnd)
|
||||
{
|
||||
char *args;
|
||||
|
||||
@@ -930,7 +910,7 @@ get_args(cmnd)
|
||||
* Look up the hostname and set user_host and user_shost.
|
||||
*/
|
||||
static void
|
||||
get_hostname()
|
||||
get_hostname(void)
|
||||
{
|
||||
char *p, thost[MAXHOSTNAMELEN + 1];
|
||||
|
||||
@@ -951,9 +931,7 @@ get_hostname()
|
||||
}
|
||||
|
||||
static void
|
||||
alias_remove_recursive(name, type)
|
||||
char *name;
|
||||
int type;
|
||||
alias_remove_recursive(char *name, int type)
|
||||
{
|
||||
struct member *m;
|
||||
struct alias *a;
|
||||
@@ -976,9 +954,7 @@ alias_remove_recursive(name, type)
|
||||
* aliases or unused aliases.
|
||||
*/
|
||||
static int
|
||||
check_aliases(strict, quiet)
|
||||
int strict;
|
||||
int quiet;
|
||||
check_aliases(int strict, int quiet)
|
||||
{
|
||||
struct cmndspec *cs;
|
||||
struct member *m, *binding;
|
||||
@@ -1089,11 +1065,7 @@ check_aliases(strict, quiet)
|
||||
}
|
||||
|
||||
static void
|
||||
print_undefined(name, type, strict, quiet)
|
||||
char *name;
|
||||
int type;
|
||||
int strict;
|
||||
int quiet;
|
||||
print_undefined(char *name, int type, int strict, int quiet)
|
||||
{
|
||||
if (!quiet) {
|
||||
warningx("%s: %s_Alias `%s' referenced but not defined",
|
||||
@@ -1105,9 +1077,7 @@ print_undefined(name, type, strict, quiet)
|
||||
}
|
||||
|
||||
static int
|
||||
print_unused(v1, v2)
|
||||
void *v1;
|
||||
void *v2;
|
||||
print_unused(void *v1, void *v2)
|
||||
{
|
||||
struct alias *a = (struct alias *)v1;
|
||||
char *prefix = (char *)v2;
|
||||
@@ -1123,8 +1093,7 @@ print_unused(v1, v2)
|
||||
* Unlink any sudoers temp files that remain.
|
||||
*/
|
||||
void
|
||||
cleanup(gotsignal)
|
||||
int gotsignal;
|
||||
cleanup(int gotsignal)
|
||||
{
|
||||
struct sudoersfile *sp;
|
||||
|
||||
@@ -1142,8 +1111,7 @@ cleanup(gotsignal)
|
||||
* Unlink sudoers temp files (if any) and exit.
|
||||
*/
|
||||
static RETSIGTYPE
|
||||
quit(signo)
|
||||
int signo;
|
||||
quit(int signo)
|
||||
{
|
||||
cleanup(signo);
|
||||
#define emsg " exiting due to signal.\n"
|
||||
@@ -1153,7 +1121,7 @@ quit(signo)
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
(void) fprintf(stderr, "usage: %s [-c] [-q] [-s] [-V] [-f sudoers]\n",
|
||||
getprogname());
|
||||
|
Reference in New Issue
Block a user