|
|
1b092f |
diff -up sudo-1.8.6p3/plugins/sudoers/alias.c.cycledetect sudo-1.8.6p3/plugins/sudoers/alias.c
|
|
|
1b092f |
--- sudo-1.8.6p3/plugins/sudoers/alias.c.cycledetect 2012-09-18 15:56:29.000000000 +0200
|
|
|
1b092f |
+++ sudo-1.8.6p3/plugins/sudoers/alias.c 2013-08-09 10:52:04.785860905 +0200
|
|
|
1b092f |
@@ -1,5 +1,5 @@
|
|
|
1b092f |
/*
|
|
|
1b092f |
- * Copyright (c) 2004-2005, 2007-2011
|
|
|
1b092f |
+ * Copyright (c) 2004-2005, 2007-2013
|
|
|
1b092f |
* Todd C. Miller <Todd.Miller@courtesan.com>
|
|
|
1b092f |
*
|
|
|
1b092f |
* Permission to use, copy, modify, and distribute this software for any
|
|
|
1b092f |
@@ -50,7 +50,6 @@
|
|
|
1b092f |
* Globals
|
|
|
1b092f |
*/
|
|
|
1b092f |
struct rbtree *aliases;
|
|
|
1b092f |
-unsigned int alias_seqno;
|
|
|
1b092f |
|
|
|
1b092f |
/*
|
|
|
1b092f |
* Comparison function for the red-black tree.
|
|
|
1b092f |
@@ -76,29 +75,31 @@ alias_compare(const void *v1, const void
|
|
|
1b092f |
/*
|
|
|
1b092f |
* Search the tree for an alias with the specified name and type.
|
|
|
1b092f |
* Returns a pointer to the alias structure or NULL if not found.
|
|
|
1b092f |
+ * Caller is responsible for calling alias_put() on the returned
|
|
|
1b092f |
+ * alias to mark it as unused.
|
|
|
1b092f |
*/
|
|
|
1b092f |
struct alias *
|
|
|
1b092f |
-alias_find(char *name, int type)
|
|
|
1b092f |
+alias_get(char *name, int type)
|
|
|
1b092f |
{
|
|
|
1b092f |
struct alias key;
|
|
|
1b092f |
struct rbnode *node;
|
|
|
1b092f |
struct alias *a = NULL;
|
|
|
1b092f |
- debug_decl(alias_find, SUDO_DEBUG_ALIAS)
|
|
|
1b092f |
+ debug_decl(alias_get, SUDO_DEBUG_ALIAS)
|
|
|
1b092f |
|
|
|
1b092f |
key.name = name;
|
|
|
1b092f |
key.type = type;
|
|
|
1b092f |
if ((node = rbfind(aliases, &key)) != NULL) {
|
|
|
1b092f |
/*
|
|
|
1b092f |
- * Compare the global sequence number with the one stored
|
|
|
1b092f |
- * in the alias. If they match then we've seen this alias
|
|
|
1b092f |
- * before and found a loop.
|
|
|
1b092f |
+ * Check whether this alias is already in use.
|
|
|
1b092f |
+ * If so, we've detected a loop. If not, set the flag,
|
|
|
1b092f |
+ * which the caller should clear with a call to alias_put().
|
|
|
1b092f |
*/
|
|
|
1b092f |
a = node->data;
|
|
|
1b092f |
- if (a->seqno == alias_seqno) {
|
|
|
1b092f |
+ if (a->used) {
|
|
|
1b092f |
errno = ELOOP;
|
|
|
1b092f |
debug_return_ptr(NULL);
|
|
|
1b092f |
}
|
|
|
1b092f |
- a->seqno = alias_seqno;
|
|
|
1b092f |
+ a->used = true;
|
|
|
1b092f |
} else {
|
|
|
1b092f |
errno = ENOENT;
|
|
|
1b092f |
}
|
|
|
1b092f |
@@ -106,6 +107,17 @@ alias_find(char *name, int type)
|
|
|
1b092f |
}
|
|
|
1b092f |
|
|
|
1b092f |
/*
|
|
|
1b092f |
+ * Clear the "used" flag in an alias once the caller is done with it.
|
|
|
1b092f |
+ */
|
|
|
1b092f |
+void
|
|
|
1b092f |
+alias_put(struct alias *a)
|
|
|
1b092f |
+{
|
|
|
1b092f |
+ debug_decl(alias_put, SUDO_DEBUG_ALIAS)
|
|
|
1b092f |
+ a->used = false;
|
|
|
1b092f |
+ debug_return;
|
|
|
1b092f |
+}
|
|
|
1b092f |
+
|
|
|
1b092f |
+/*
|
|
|
1b092f |
* Add an alias to the aliases redblack tree.
|
|
|
1b092f |
* Returns NULL on success and an error string on failure.
|
|
|
1b092f |
*/
|
|
|
1b092f |
@@ -119,7 +131,7 @@ alias_add(char *name, int type, struct m
|
|
|
1b092f |
a = ecalloc(1, sizeof(*a));
|
|
|
1b092f |
a->name = name;
|
|
|
1b092f |
a->type = type;
|
|
|
1b092f |
- /* a->seqno = 0; */
|
|
|
1b092f |
+ /* a->used = false; */
|
|
|
1b092f |
list2tq(&a->members, members);
|
|
|
1b092f |
if (rbinsert(aliases, a)) {
|
|
|
1b092f |
snprintf(errbuf, sizeof(errbuf), _("Alias `%s' already defined"), name);
|
|
|
1b092f |
diff -up sudo-1.8.6p3/plugins/sudoers/match.c.cycledetect sudo-1.8.6p3/plugins/sudoers/match.c
|
|
|
1b092f |
--- sudo-1.8.6p3/plugins/sudoers/match.c.cycledetect 2013-08-09 10:52:04.783860895 +0200
|
|
|
1b092f |
+++ sudo-1.8.6p3/plugins/sudoers/match.c 2013-08-09 10:52:04.785860905 +0200
|
|
|
1b092f |
@@ -101,13 +101,13 @@ static bool command_matches_normal(char
|
|
|
1b092f |
* Check for user described by pw in a list of members.
|
|
|
1b092f |
* Returns ALLOW, DENY or UNSPEC.
|
|
|
1b092f |
*/
|
|
|
1b092f |
-static int
|
|
|
1b092f |
-_userlist_matches(struct passwd *pw, struct member_list *list)
|
|
|
1b092f |
+int
|
|
|
1b092f |
+userlist_matches(struct passwd *pw, struct member_list *list)
|
|
|
1b092f |
{
|
|
|
1b092f |
struct member *m;
|
|
|
1b092f |
struct alias *a;
|
|
|
1b092f |
int rval, matched = UNSPEC;
|
|
|
1b092f |
- debug_decl(_userlist_matches, SUDO_DEBUG_MATCH)
|
|
|
1b092f |
+ debug_decl(userlist_matches, SUDO_DEBUG_MATCH)
|
|
|
1b092f |
|
|
|
1b092f |
tq_foreach_rev(list, m) {
|
|
|
1b092f |
switch (m->type) {
|
|
|
1b092f |
@@ -123,10 +123,11 @@ _userlist_matches(struct passwd *pw, str
|
|
|
1b092f |
matched = !m->negated;
|
|
|
1b092f |
break;
|
|
|
1b092f |
case ALIAS:
|
|
|
1b092f |
- if ((a = alias_find(m->name, USERALIAS)) != NULL) {
|
|
|
1b092f |
- rval = _userlist_matches(pw, &a->members);
|
|
|
1b092f |
+ if ((a = alias_get(m->name, USERALIAS)) != NULL) {
|
|
|
1b092f |
+ rval = userlist_matches(pw, &a->members);
|
|
|
1b092f |
if (rval != UNSPEC)
|
|
|
1b092f |
matched = m->negated ? !rval : rval;
|
|
|
1b092f |
+ alias_put(a);
|
|
|
1b092f |
break;
|
|
|
1b092f |
}
|
|
|
1b092f |
/* FALLTHROUGH */
|
|
|
1b092f |
@@ -141,20 +142,13 @@ _userlist_matches(struct passwd *pw, str
|
|
|
1b092f |
debug_return_bool(matched);
|
|
|
1b092f |
}
|
|
|
1b092f |
|
|
|
1b092f |
-int
|
|
|
1b092f |
-userlist_matches(struct passwd *pw, struct member_list *list)
|
|
|
1b092f |
-{
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
- return _userlist_matches(pw, list);
|
|
|
1b092f |
-}
|
|
|
1b092f |
-
|
|
|
1b092f |
/*
|
|
|
1b092f |
* Check for user described by pw in a list of members.
|
|
|
1b092f |
* If both lists are empty compare against def_runas_default.
|
|
|
1b092f |
* Returns ALLOW, DENY or UNSPEC.
|
|
|
1b092f |
*/
|
|
|
1b092f |
-static int
|
|
|
1b092f |
-_runaslist_matches(struct member_list *user_list,
|
|
|
1b092f |
+int
|
|
|
1b092f |
+runaslist_matches(struct member_list *user_list,
|
|
|
1b092f |
struct member_list *group_list, struct member **matching_user,
|
|
|
1b092f |
struct member **matching_group)
|
|
|
1b092f |
{
|
|
|
1b092f |
@@ -163,7 +157,7 @@ _runaslist_matches(struct member_list *u
|
|
|
1b092f |
int rval;
|
|
|
1b092f |
int user_matched = UNSPEC;
|
|
|
1b092f |
int group_matched = UNSPEC;
|
|
|
1b092f |
- debug_decl(_runaslist_matches, SUDO_DEBUG_MATCH)
|
|
|
1b092f |
+ debug_decl(runaslist_matches, SUDO_DEBUG_MATCH)
|
|
|
1b092f |
|
|
|
1b092f |
if (runas_pw != NULL) {
|
|
|
1b092f |
/* If no runas user or runas group listed in sudoers, use default. */
|
|
|
1b092f |
@@ -184,11 +178,12 @@ _runaslist_matches(struct member_list *u
|
|
|
1b092f |
user_matched = !m->negated;
|
|
|
1b092f |
break;
|
|
|
1b092f |
case ALIAS:
|
|
|
1b092f |
- if ((a = alias_find(m->name, RUNASALIAS)) != NULL) {
|
|
|
1b092f |
- rval = _runaslist_matches(&a->members, &empty,
|
|
|
1b092f |
+ if ((a = alias_get(m->name, RUNASALIAS)) != NULL) {
|
|
|
1b092f |
+ rval = runaslist_matches(&a->members, &empty,
|
|
|
1b092f |
matching_user, NULL);
|
|
|
1b092f |
if (rval != UNSPEC)
|
|
|
1b092f |
user_matched = m->negated ? !rval : rval;
|
|
|
1b092f |
+ alias_put(a);
|
|
|
1b092f |
break;
|
|
|
1b092f |
}
|
|
|
1b092f |
/* FALLTHROUGH */
|
|
|
1b092f |
@@ -221,11 +216,12 @@ _runaslist_matches(struct member_list *u
|
|
|
1b092f |
group_matched = !m->negated;
|
|
|
1b092f |
break;
|
|
|
1b092f |
case ALIAS:
|
|
|
1b092f |
- if ((a = alias_find(m->name, RUNASALIAS)) != NULL) {
|
|
|
1b092f |
- rval = _runaslist_matches(&empty, &a->members,
|
|
|
1b092f |
+ if ((a = alias_get(m->name, RUNASALIAS)) != NULL) {
|
|
|
1b092f |
+ rval = runaslist_matches(&empty, &a->members,
|
|
|
1b092f |
NULL, matching_group);
|
|
|
1b092f |
if (rval != UNSPEC)
|
|
|
1b092f |
group_matched = m->negated ? !rval : rval;
|
|
|
1b092f |
+ alias_put(a);
|
|
|
1b092f |
break;
|
|
|
1b092f |
}
|
|
|
1b092f |
/* FALLTHROUGH */
|
|
|
1b092f |
@@ -253,27 +249,17 @@ _runaslist_matches(struct member_list *u
|
|
|
1b092f |
debug_return_int(UNSPEC);
|
|
|
1b092f |
}
|
|
|
1b092f |
|
|
|
1b092f |
-int
|
|
|
1b092f |
-runaslist_matches(struct member_list *user_list,
|
|
|
1b092f |
- struct member_list *group_list, struct member **matching_user,
|
|
|
1b092f |
- struct member **matching_group)
|
|
|
1b092f |
-{
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
- return _runaslist_matches(user_list ? user_list : &empty,
|
|
|
1b092f |
- group_list ? group_list : &empty, matching_user, matching_group);
|
|
|
1b092f |
-}
|
|
|
1b092f |
-
|
|
|
1b092f |
/*
|
|
|
1b092f |
* Check for host and shost in a list of members.
|
|
|
1b092f |
* Returns ALLOW, DENY or UNSPEC.
|
|
|
1b092f |
*/
|
|
|
1b092f |
-static int
|
|
|
1b092f |
-_hostlist_matches(struct member_list *list)
|
|
|
1b092f |
+int
|
|
|
1b092f |
+hostlist_matches(struct member_list *list)
|
|
|
1b092f |
{
|
|
|
1b092f |
struct member *m;
|
|
|
1b092f |
struct alias *a;
|
|
|
1b092f |
int rval, matched = UNSPEC;
|
|
|
1b092f |
- debug_decl(_hostlist_matches, SUDO_DEBUG_MATCH)
|
|
|
1b092f |
+ debug_decl(hostlist_matches, SUDO_DEBUG_MATCH)
|
|
|
1b092f |
|
|
|
1b092f |
tq_foreach_rev(list, m) {
|
|
|
1b092f |
switch (m->type) {
|
|
|
1b092f |
@@ -289,10 +275,11 @@ _hostlist_matches(struct member_list *li
|
|
|
1b092f |
matched = !m->negated;
|
|
|
1b092f |
break;
|
|
|
1b092f |
case ALIAS:
|
|
|
1b092f |
- if ((a = alias_find(m->name, HOSTALIAS)) != NULL) {
|
|
|
1b092f |
- rval = _hostlist_matches(&a->members);
|
|
|
1b092f |
+ if ((a = alias_get(m->name, HOSTALIAS)) != NULL) {
|
|
|
1b092f |
+ rval = hostlist_matches(&a->members);
|
|
|
1b092f |
if (rval != UNSPEC)
|
|
|
1b092f |
matched = m->negated ? !rval : rval;
|
|
|
1b092f |
+ alias_put(a);
|
|
|
1b092f |
break;
|
|
|
1b092f |
}
|
|
|
1b092f |
/* FALLTHROUGH */
|
|
|
1b092f |
@@ -307,23 +294,16 @@ _hostlist_matches(struct member_list *li
|
|
|
1b092f |
debug_return_bool(matched);
|
|
|
1b092f |
}
|
|
|
1b092f |
|
|
|
1b092f |
-int
|
|
|
1b092f |
-hostlist_matches(struct member_list *list)
|
|
|
1b092f |
-{
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
- return _hostlist_matches(list);
|
|
|
1b092f |
-}
|
|
|
1b092f |
-
|
|
|
1b092f |
/*
|
|
|
1b092f |
* Check for cmnd and args in a list of members.
|
|
|
1b092f |
* Returns ALLOW, DENY or UNSPEC.
|
|
|
1b092f |
*/
|
|
|
1b092f |
-static int
|
|
|
1b092f |
-_cmndlist_matches(struct member_list *list)
|
|
|
1b092f |
+int
|
|
|
1b092f |
+cmndlist_matches(struct member_list *list)
|
|
|
1b092f |
{
|
|
|
1b092f |
struct member *m;
|
|
|
1b092f |
int matched = UNSPEC;
|
|
|
1b092f |
- debug_decl(_cmndlist_matches, SUDO_DEBUG_MATCH)
|
|
|
1b092f |
+ debug_decl(cmndlist_matches, SUDO_DEBUG_MATCH)
|
|
|
1b092f |
|
|
|
1b092f |
tq_foreach_rev(list, m) {
|
|
|
1b092f |
matched = cmnd_matches(m);
|
|
|
1b092f |
@@ -333,13 +313,6 @@ _cmndlist_matches(struct member_list *li
|
|
|
1b092f |
debug_return_bool(matched);
|
|
|
1b092f |
}
|
|
|
1b092f |
|
|
|
1b092f |
-int
|
|
|
1b092f |
-cmndlist_matches(struct member_list *list)
|
|
|
1b092f |
-{
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
- return _cmndlist_matches(list);
|
|
|
1b092f |
-}
|
|
|
1b092f |
-
|
|
|
1b092f |
/*
|
|
|
1b092f |
* Check cmnd and args.
|
|
|
1b092f |
* Returns ALLOW, DENY or UNSPEC.
|
|
|
1b092f |
@@ -357,11 +330,11 @@ cmnd_matches(struct member *m)
|
|
|
1b092f |
matched = !m->negated;
|
|
|
1b092f |
break;
|
|
|
1b092f |
case ALIAS:
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
- if ((a = alias_find(m->name, CMNDALIAS)) != NULL) {
|
|
|
1b092f |
- rval = _cmndlist_matches(&a->members);
|
|
|
1b092f |
+ if ((a = alias_get(m->name, CMNDALIAS)) != NULL) {
|
|
|
1b092f |
+ rval = cmndlist_matches(&a->members);
|
|
|
1b092f |
if (rval != UNSPEC)
|
|
|
1b092f |
matched = m->negated ? !rval : rval;
|
|
|
1b092f |
+ alias_put(a);
|
|
|
1b092f |
}
|
|
|
1b092f |
break;
|
|
|
1b092f |
case COMMAND:
|
|
|
1b092f |
diff -up sudo-1.8.6p3/plugins/sudoers/parse.c.cycledetect sudo-1.8.6p3/plugins/sudoers/parse.c
|
|
|
1b092f |
--- sudo-1.8.6p3/plugins/sudoers/parse.c.cycledetect 2012-09-18 15:57:43.000000000 +0200
|
|
|
1b092f |
+++ sudo-1.8.6p3/plugins/sudoers/parse.c 2013-08-09 10:52:04.785860905 +0200
|
|
|
1b092f |
@@ -676,13 +676,14 @@ _print_member(struct lbuf *lbuf, char *n
|
|
|
1b092f |
}
|
|
|
1b092f |
break;
|
|
|
1b092f |
case ALIAS:
|
|
|
1b092f |
- if ((a = alias_find(name, alias_type)) != NULL) {
|
|
|
1b092f |
+ if ((a = alias_get(name, alias_type)) != NULL) {
|
|
|
1b092f |
tq_foreach_fwd(&a->members, m) {
|
|
|
1b092f |
if (m != tq_first(&a->members))
|
|
|
1b092f |
lbuf_append(lbuf, ", ");
|
|
|
1b092f |
_print_member(lbuf, m->name, m->type,
|
|
|
1b092f |
negated ? !m->negated : m->negated, alias_type);
|
|
|
1b092f |
}
|
|
|
1b092f |
+ alias_put(a);
|
|
|
1b092f |
break;
|
|
|
1b092f |
}
|
|
|
1b092f |
/* FALLTHROUGH */
|
|
|
1b092f |
@@ -697,6 +698,5 @@ static void
|
|
|
1b092f |
print_member(struct lbuf *lbuf, char *name, int type, int negated,
|
|
|
1b092f |
int alias_type)
|
|
|
1b092f |
{
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
_print_member(lbuf, name, type, negated, alias_type);
|
|
|
1b092f |
}
|
|
|
1b092f |
diff -up sudo-1.8.6p3/plugins/sudoers/parse.h.cycledetect sudo-1.8.6p3/plugins/sudoers/parse.h
|
|
|
1b092f |
--- sudo-1.8.6p3/plugins/sudoers/parse.h.cycledetect 2012-09-18 15:56:29.000000000 +0200
|
|
|
1b092f |
+++ sudo-1.8.6p3/plugins/sudoers/parse.h 2013-08-09 10:54:30.984565529 +0200
|
|
|
1b092f |
@@ -148,7 +148,7 @@ struct runascontainer {
|
|
|
1b092f |
struct alias {
|
|
|
1b092f |
char *name; /* alias name */
|
|
|
1b092f |
unsigned short type; /* {USER,HOST,RUNAS,CMND}ALIAS */
|
|
|
1b092f |
- unsigned short seqno; /* sequence number */
|
|
|
1b092f |
+ bool used; /* "used" flag for cycle detection */
|
|
|
1b092f |
struct member_list members; /* list of alias members */
|
|
|
1b092f |
};
|
|
|
1b092f |
|
|
|
1b092f |
@@ -170,35 +170,39 @@ struct defaults {
|
|
|
1b092f |
extern struct userspec_list userspecs;
|
|
|
1b092f |
extern struct defaults_list defaults;
|
|
|
1b092f |
|
|
|
1b092f |
-/*
|
|
|
1b092f |
- * Alias sequence number to avoid loops.
|
|
|
1b092f |
- */
|
|
|
1b092f |
-extern unsigned int alias_seqno;
|
|
|
1b092f |
-
|
|
|
1b092f |
-/*
|
|
|
1b092f |
- * Prototypes
|
|
|
1b092f |
- */
|
|
|
1b092f |
-char *alias_add(char *, int, struct member *);
|
|
|
1b092f |
-bool addr_matches(char *);
|
|
|
1b092f |
-int cmnd_matches(struct member *);
|
|
|
1b092f |
-int cmndlist_matches(struct member_list *);
|
|
|
1b092f |
-bool command_matches(char *, char *);
|
|
|
1b092f |
-int hostlist_matches(struct member_list *);
|
|
|
1b092f |
-bool hostname_matches(char *, char *, char *);
|
|
|
1b092f |
-bool netgr_matches(char *, char *, char *, char *);
|
|
|
1b092f |
+/* alias.c */
|
|
|
1b092f |
bool no_aliases(void);
|
|
|
1b092f |
-int runaslist_matches(struct member_list *, struct member_list *, struct member **, struct member **);
|
|
|
1b092f |
-int userlist_matches(struct passwd *, struct member_list *);
|
|
|
1b092f |
-bool usergr_matches(char *, char *, struct passwd *);
|
|
|
1b092f |
-bool userpw_matches(char *, char *, struct passwd *);
|
|
|
1b092f |
-bool group_matches(char *, struct group *);
|
|
|
1b092f |
-struct alias *alias_find(char *, int);
|
|
|
1b092f |
-struct alias *alias_remove(char *, int);
|
|
|
1b092f |
-void alias_free(void *);
|
|
|
1b092f |
-void alias_apply(int (*)(void *, void *), void *);
|
|
|
1b092f |
+char *alias_add(char *name, int type, struct member *members);
|
|
|
1b092f |
+int alias_compare(const void *a1, const void *a2);
|
|
|
1b092f |
+struct alias *alias_get(char *name, int type);
|
|
|
1b092f |
+struct alias *alias_remove(char *name, int type);
|
|
|
1b092f |
+void alias_apply(int (*func)(void *, void *), void *cookie);
|
|
|
1b092f |
+void alias_free(void *a);
|
|
|
1b092f |
+void alias_put(struct alias *a);
|
|
|
1b092f |
void init_aliases(void);
|
|
|
1b092f |
-void init_lexer(void);
|
|
|
1b092f |
+/* gram.c */
|
|
|
1b092f |
void init_parser(const char *, bool);
|
|
|
1b092f |
-int alias_compare(const void *, const void *);
|
|
|
1b092f |
+
|
|
|
1b092f |
+/* match_addr.c */
|
|
|
1b092f |
+bool addr_matches(char *n);
|
|
|
1b092f |
+
|
|
|
1b092f |
+/* match.c */
|
|
|
1b092f |
+bool command_matches(char *sudoers_cmnd, char *sudoers_args);
|
|
|
1b092f |
+bool group_matches(char *sudoers_group, struct group *gr);
|
|
|
1b092f |
+bool hostname_matches(char *shost, char *lhost, char *pattern);
|
|
|
1b092f |
+bool netgr_matches(char *netgr, char *lhost, char *shost, char *user);
|
|
|
1b092f |
+bool usergr_matches(char *group, char *user, struct passwd *pw);
|
|
|
1b092f |
+bool userpw_matches(char *sudoers_user, char *user, struct passwd *pw);
|
|
|
1b092f |
+int cmnd_matches(struct member *m);
|
|
|
1b092f |
+int cmndlist_matches(struct member_list *list);
|
|
|
1b092f |
+int hostlist_matches(struct member_list *list);
|
|
|
1b092f |
+int runaslist_matches(struct member_list *user_list, struct member_list *group_list, struct member **matching_user, struct member **matching_group);
|
|
|
1b092f |
+int userlist_matches(struct passwd *pw, struct member_list *list);
|
|
|
1b092f |
+
|
|
|
1b092f |
+/* toke.c */
|
|
|
1b092f |
+ void init_lexer(void);
|
|
|
1b092f |
+
|
|
|
1b092f |
+/* base64.c */
|
|
|
1b092f |
+ size_t base64_decode(const char *str, unsigned char *dst, size_t dsize);
|
|
|
1b092f |
|
|
|
1b092f |
#endif /* _SUDO_PARSE_H */
|
|
|
1b092f |
diff -up sudo-1.8.6p3/plugins/sudoers/visudo.c.cycledetect sudo-1.8.6p3/plugins/sudoers/visudo.c
|
|
|
1b092f |
--- sudo-1.8.6p3/plugins/sudoers/visudo.c.cycledetect 2013-08-09 10:52:04.759860779 +0200
|
|
|
1b092f |
+++ sudo-1.8.6p3/plugins/sudoers/visudo.c 2013-08-09 10:52:04.786860910 +0200
|
|
|
1b092f |
@@ -1084,7 +1084,6 @@ alias_remove_recursive(char *name, int t
|
|
|
1b092f |
}
|
|
|
1b092f |
rbinsert(alias_freelist, a);
|
|
|
1b092f |
}
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
debug_return_bool(rval);
|
|
|
1b092f |
}
|
|
|
1b092f |
|
|
|
1b092f |
@@ -1096,12 +1095,13 @@ check_alias(char *name, int type, int st
|
|
|
1b092f |
int errors = 0;
|
|
|
1b092f |
debug_decl(check_alias, SUDO_DEBUG_ALIAS)
|
|
|
1b092f |
|
|
|
1b092f |
- if ((a = alias_find(name, type)) != NULL) {
|
|
|
1b092f |
+ if ((a = alias_get(name, type)) != NULL) {
|
|
|
1b092f |
/* check alias contents */
|
|
|
1b092f |
tq_foreach_fwd(&a->members, m) {
|
|
|
1b092f |
if (m->type == ALIAS)
|
|
|
1b092f |
errors += check_alias(m->name, type, strict, quiet);
|
|
|
1b092f |
}
|
|
|
1b092f |
+ alias_put(a);
|
|
|
1b092f |
} else {
|
|
|
1b092f |
if (!quiet) {
|
|
|
1b092f |
char *fmt;
|
|
|
1b092f |
@@ -1146,26 +1146,22 @@ check_aliases(bool strict, bool quiet)
|
|
|
1b092f |
tq_foreach_fwd(&userspecs, us) {
|
|
|
1b092f |
tq_foreach_fwd(&us->users, m) {
|
|
|
1b092f |
if (m->type == ALIAS) {
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
errors += check_alias(m->name, USERALIAS, strict, quiet);
|
|
|
1b092f |
}
|
|
|
1b092f |
}
|
|
|
1b092f |
tq_foreach_fwd(&us->privileges, priv) {
|
|
|
1b092f |
tq_foreach_fwd(&priv->hostlist, m) {
|
|
|
1b092f |
if (m->type == ALIAS) {
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
errors += check_alias(m->name, HOSTALIAS, strict, quiet);
|
|
|
1b092f |
}
|
|
|
1b092f |
}
|
|
|
1b092f |
tq_foreach_fwd(&priv->cmndlist, cs) {
|
|
|
1b092f |
tq_foreach_fwd(&cs->runasuserlist, m) {
|
|
|
1b092f |
if (m->type == ALIAS) {
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
errors += check_alias(m->name, RUNASALIAS, strict, quiet);
|
|
|
1b092f |
}
|
|
|
1b092f |
}
|
|
|
1b092f |
if ((m = cs->cmnd)->type == ALIAS) {
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
errors += check_alias(m->name, CMNDALIAS, strict, quiet);
|
|
|
1b092f |
}
|
|
|
1b092f |
}
|
|
|
1b092f |
@@ -1176,7 +1172,6 @@ check_aliases(bool strict, bool quiet)
|
|
|
1b092f |
tq_foreach_fwd(&userspecs, us) {
|
|
|
1b092f |
tq_foreach_fwd(&us->users, m) {
|
|
|
1b092f |
if (m->type == ALIAS) {
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
if (!alias_remove_recursive(m->name, USERALIAS))
|
|
|
1b092f |
errors++;
|
|
|
1b092f |
}
|
|
|
1b092f |
@@ -1184,7 +1179,6 @@ check_aliases(bool strict, bool quiet)
|
|
|
1b092f |
tq_foreach_fwd(&us->privileges, priv) {
|
|
|
1b092f |
tq_foreach_fwd(&priv->hostlist, m) {
|
|
|
1b092f |
if (m->type == ALIAS) {
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
if (!alias_remove_recursive(m->name, HOSTALIAS))
|
|
|
1b092f |
errors++;
|
|
|
1b092f |
}
|
|
|
1b092f |
@@ -1192,13 +1186,11 @@ check_aliases(bool strict, bool quiet)
|
|
|
1b092f |
tq_foreach_fwd(&priv->cmndlist, cs) {
|
|
|
1b092f |
tq_foreach_fwd(&cs->runasuserlist, m) {
|
|
|
1b092f |
if (m->type == ALIAS) {
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
if (!alias_remove_recursive(m->name, RUNASALIAS))
|
|
|
1b092f |
errors++;
|
|
|
1b092f |
}
|
|
|
1b092f |
}
|
|
|
1b092f |
if ((m = cs->cmnd)->type == ALIAS) {
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
if (!alias_remove_recursive(m->name, CMNDALIAS))
|
|
|
1b092f |
errors++;
|
|
|
1b092f |
}
|
|
|
1b092f |
@@ -1225,7 +1217,6 @@ check_aliases(bool strict, bool quiet)
|
|
|
1b092f |
tq_foreach_fwd(&d->binding, binding) {
|
|
|
1b092f |
for (m = binding; m != NULL; m = m->next) {
|
|
|
1b092f |
if (m->type == ALIAS) {
|
|
|
1b092f |
- alias_seqno++;
|
|
|
1b092f |
if (!alias_remove_recursive(m->name, atype))
|
|
|
1b092f |
errors++;
|
|
|
1b092f |
}
|