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