}
static void
-free_default(int type, union sudo_defs_val *sd_un)
+free_defs_val(int type, union sudo_defs_val *sd_un)
{
switch (type & T_MASK) {
case T_STR:
/* Clear any old settings. */
if (!firsttime) {
for (def = sudo_defs_table; def->name != NULL; def++)
- free_default(def->type, &def->sd_un);
+ free_defs_val(def->type, &def->sd_un);
}
/* First initialize the flags. */
memset(&sd_un, 0, sizeof(sd_un));
if (parse_default_entry(def, d->val, d->op, &sd_un, d->file,
d->lineno, quiet)) {
- free_default(def->type, &sd_un);
+ free_defs_val(def->type, &sd_un);
continue;
}
}
void
free_member(struct member *m)
{
+ debug_decl(free_member, SUDOERS_DEBUG_PARSER)
+
if (m->type == COMMAND) {
struct sudo_command *c = (struct sudo_command *)m->name;
free(c->cmnd);
}
free(m->name);
free(m);
+
+ debug_return;
}
/*
free_members(struct member_list *members)
{
struct member *m;
+ debug_decl(free_members, SUDOERS_DEBUG_PARSER)
while ((m = TAILQ_FIRST(members)) != NULL) {
TAILQ_REMOVE(members, m, entries);
free_member(m);
}
+
+ debug_return;
+}
+
+struct member_list *
+free_default(struct defaults *def, struct member_list *binding)
+{
+ debug_decl(free_default, SUDOERS_DEBUG_PARSER)
+
+ if (def->binding != binding) {
+ binding = def->binding;
+ free_members(def->binding);
+ free(def->binding);
+ }
+ rcstr_delref(def->file);
+ free(def->var);
+ free(def->val);
+ free(def);
+
+ debug_return_ptr(binding);
}
void
free_privilege(struct privilege *priv)
{
struct member_list *runasuserlist = NULL, *runasgrouplist = NULL;
+ struct member_list *binding = NULL;
struct cmndspec *cs;
struct defaults *def;
#ifdef HAVE_SELINUX
#ifdef HAVE_PRIV_SET
char *privs = NULL, *limitprivs = NULL;
#endif /* HAVE_PRIV_SET */
+ debug_decl(free_privilege, SUDOERS_DEBUG_PARSER)
free(priv->ldap_role);
free_members(&priv->hostlist);
}
while ((def = TAILQ_FIRST(&priv->defaults)) != NULL) {
TAILQ_REMOVE(&priv->defaults, def, entries);
- free(def->var);
- free(def->val);
- free(def);
+ binding = free_default(def, binding);
}
free(priv);
+
+ debug_return;
}
void
{
struct privilege *priv;
struct sudoers_comment *comment;
+ debug_decl(free_userspec, SUDOERS_DEBUG_PARSER)
free_members(&us->users);
while ((priv = TAILQ_FIRST(&us->privileges)) != NULL) {
}
rcstr_delref(us->file);
free(us);
+
+ debug_return;
}
/*
bool
init_parser(const char *path, bool quiet)
{
- struct member_list *binding;
- struct defaults *d;
+ struct member_list *binding = NULL;
+ struct defaults *def;
struct userspec *us;
bool ret = true;
void *next;
}
TAILQ_INIT(&userspecs);
- binding = NULL;
- TAILQ_FOREACH_SAFE(d, &defaults, entries, next) {
- if (d->binding != binding) {
- binding = d->binding;
- free_members(d->binding);
- free(d->binding);
- }
- rcstr_delref(d->file);
- free(d->var);
- free(d->val);
- free(d);
+ TAILQ_FOREACH_SAFE(def, &defaults, entries, next) {
+ binding = free_default(def, binding);
}
TAILQ_INIT(&defaults);
opts->limitprivs = NULL;
#endif
}
-#line 974 "gram.c"
+#line 995 "gram.c"
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
#if defined(__cplusplus) || defined(__STDC__)
static int yygrowstack(void)
}
}
break;
-#line 2099 "gram.c"
+#line 2120 "gram.c"
}
yyssp -= yym;
yystate = *yyssp;
void
free_member(struct member *m)
{
+ debug_decl(free_member, SUDOERS_DEBUG_PARSER)
+
if (m->type == COMMAND) {
struct sudo_command *c = (struct sudo_command *)m->name;
free(c->cmnd);
}
free(m->name);
free(m);
+
+ debug_return;
}
/*
free_members(struct member_list *members)
{
struct member *m;
+ debug_decl(free_members, SUDOERS_DEBUG_PARSER)
while ((m = TAILQ_FIRST(members)) != NULL) {
TAILQ_REMOVE(members, m, entries);
free_member(m);
}
+
+ debug_return;
+}
+
+struct member_list *
+free_default(struct defaults *def, struct member_list *binding)
+{
+ debug_decl(free_default, SUDOERS_DEBUG_PARSER)
+
+ if (def->binding != binding) {
+ binding = def->binding;
+ free_members(def->binding);
+ free(def->binding);
+ }
+ rcstr_delref(def->file);
+ free(def->var);
+ free(def->val);
+ free(def);
+
+ debug_return_ptr(binding);
}
void
free_privilege(struct privilege *priv)
{
struct member_list *runasuserlist = NULL, *runasgrouplist = NULL;
+ struct member_list *binding = NULL;
struct cmndspec *cs;
struct defaults *def;
#ifdef HAVE_SELINUX
#ifdef HAVE_PRIV_SET
char *privs = NULL, *limitprivs = NULL;
#endif /* HAVE_PRIV_SET */
+ debug_decl(free_privilege, SUDOERS_DEBUG_PARSER)
free(priv->ldap_role);
free_members(&priv->hostlist);
}
while ((def = TAILQ_FIRST(&priv->defaults)) != NULL) {
TAILQ_REMOVE(&priv->defaults, def, entries);
- free(def->var);
- free(def->val);
- free(def);
+ binding = free_default(def, binding);
}
free(priv);
+
+ debug_return;
}
void
{
struct privilege *priv;
struct sudoers_comment *comment;
+ debug_decl(free_userspec, SUDOERS_DEBUG_PARSER)
free_members(&us->users);
while ((priv = TAILQ_FIRST(&us->privileges)) != NULL) {
}
rcstr_delref(us->file);
free(us);
+
+ debug_return;
}
/*
bool
init_parser(const char *path, bool quiet)
{
- struct member_list *binding;
- struct defaults *d;
+ struct member_list *binding = NULL;
+ struct defaults *def;
struct userspec *us;
bool ret = true;
void *next;
}
TAILQ_INIT(&userspecs);
- binding = NULL;
- TAILQ_FOREACH_SAFE(d, &defaults, entries, next) {
- if (d->binding != binding) {
- binding = d->binding;
- free_members(d->binding);
- free(d->binding);
- }
- rcstr_delref(d->file);
- free(d->var);
- free(d->val);
- free(d);
+ TAILQ_FOREACH_SAFE(def, &defaults, entries, next) {
+ binding = free_default(def, 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);
/* match_addr.c */
bool addr_matches(char *n);