filter_defaults(void)
{
struct defaults *def, *next;
- struct member_list *binding = NULL;
+ struct member_list *prev_binding = NULL;
debug_decl(filter_defaults, SUDOERS_DEBUG_DEFAULTS)
TAILQ_FOREACH_SAFE(def, &defaults, entries, next) {
case DEFAULTS_USER:
if (!userlist_matches_filter(def->binding)) {
TAILQ_REMOVE(&defaults, def, entries);
- binding = free_default(def, binding);
+ free_default(def, &prev_binding);
} else {
- binding = def->binding;
+ prev_binding = def->binding;
}
break;
case DEFAULTS_HOST:
if (!hostlist_matches_filter(def->binding)) {
TAILQ_REMOVE(&defaults, def, entries);
- binding = free_default(def, binding);
+ free_default(def, &prev_binding);
} else {
- binding = def->binding;
+ prev_binding = def->binding;
}
break;
default:
debug_return;
}
-struct member_list *
-free_default(struct defaults *def, struct member_list *binding)
+void
+free_default(struct defaults *def, struct member_list **binding)
{
debug_decl(free_default, SUDOERS_DEBUG_PARSER)
- if (def->binding != binding) {
- binding = def->binding;
+ if (def->binding != *binding) {
+ *binding = def->binding;
free_members(def->binding);
free(def->binding);
}
free(def->val);
free(def);
- debug_return_ptr(binding);
+ debug_return;
}
void
free_privilege(struct privilege *priv)
{
struct member_list *runasuserlist = NULL, *runasgrouplist = NULL;
- struct member_list *binding = NULL;
+ struct member_list *prev_binding = NULL;
struct cmndspec *cs;
struct defaults *def;
#ifdef HAVE_SELINUX
}
while ((def = TAILQ_FIRST(&priv->defaults)) != NULL) {
TAILQ_REMOVE(&priv->defaults, def, entries);
- binding = free_default(def, binding);
+ free_default(def, &prev_binding);
}
free(priv);
bool
init_parser(const char *path, bool quiet)
{
- struct member_list *binding = NULL;
+ struct member_list *prev_binding = NULL;
struct defaults *def;
struct userspec *us;
bool ret = true;
TAILQ_INIT(&userspecs);
TAILQ_FOREACH_SAFE(def, &defaults, entries, next) {
- binding = free_default(def, binding);
+ free_default(def, &prev_binding);
}
TAILQ_INIT(&defaults);
debug_return;
}
-struct member_list *
-free_default(struct defaults *def, struct member_list *binding)
+void
+free_default(struct defaults *def, struct member_list **binding)
{
debug_decl(free_default, SUDOERS_DEBUG_PARSER)
- if (def->binding != binding) {
- binding = def->binding;
+ if (def->binding != *binding) {
+ *binding = def->binding;
free_members(def->binding);
free(def->binding);
}
free(def->val);
free(def);
- debug_return_ptr(binding);
+ debug_return;
}
void
free_privilege(struct privilege *priv)
{
struct member_list *runasuserlist = NULL, *runasgrouplist = NULL;
- struct member_list *binding = NULL;
+ struct member_list *prev_binding = NULL;
struct cmndspec *cs;
struct defaults *def;
#ifdef HAVE_SELINUX
}
while ((def = TAILQ_FIRST(&priv->defaults)) != NULL) {
TAILQ_REMOVE(&priv->defaults, def, entries);
- binding = free_default(def, binding);
+ free_default(def, &prev_binding);
}
free(priv);
bool
init_parser(const char *path, bool quiet)
{
- struct member_list *binding = NULL;
+ struct member_list *prev_binding = NULL;
struct defaults *def;
struct userspec *us;
bool ret = true;
TAILQ_INIT(&userspecs);
TAILQ_FOREACH_SAFE(def, &defaults, entries, next) {
- binding = free_default(def, binding);
+ free_default(def, &prev_binding);
}
TAILQ_INIT(&defaults);
void free_members(struct member_list *members);
void free_privilege(struct privilege *priv);
void free_userspec(struct userspec *us);
-struct member_list *free_default(struct defaults *def, struct member_list *binding);
+void free_default(struct defaults *def, struct member_list **binding);
/* match_addr.c */
bool addr_matches(char *n);