2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

add parser subsystem reset functions

Signed-Off-By: Kees Cook <kees.cook@canonical.com>
This commit is contained in:
John Johansen
2009-07-24 07:34:11 +00:00
parent 0137b992b4
commit 627c044e4d
5 changed files with 25 additions and 11 deletions

View File

@@ -212,6 +212,8 @@ extern int force_complain;
extern int regex_type;
extern void pwarn(char *fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
extern FILE *yyin;
extern void yyrestart(FILE *fp);
extern int yyparse(void);
extern void yyerror(char *msg, ...);
extern int yylex(void);
@@ -219,6 +221,7 @@ extern int yylex(void);
/* parser_regex.c */
extern int process_regex(struct codomain *cod);
extern int post_process_entry(struct cod_entry *entry);
extern void reset_regex(void);
/* parser_variable.c */
extern int process_variables(struct codomain *cod);
@@ -257,6 +260,7 @@ extern void *get_set_var(const char *var);
extern char *get_next_set_value(void **context);
extern void dump_symtab(void);
extern void dump_expanded_symtab(void);
void free_symtabs(void);
/* parser_alias.c */
extern int new_alias(const char *from, const char *to);
@@ -293,3 +297,4 @@ extern void dump_policy(void);
extern void dump_policy_hats(struct codomain *cod);
extern void dump_policy_names(void);
extern int die_if_any_regex(void);
void free_policies(void);

View File

@@ -42,17 +42,6 @@ static int compare_alias(const void *a, const void *b)
return strcmp(a_name, b_name);
}
static struct alias_rule *lookup_alias(const char *alias)
{
struct alias_rule tmp = { alias, NULL} , **lookup;
lookup = (struct alias_rule **) tfind(&tmp, alias_table, (comparison_fn_t) &compare_alias);
if (!lookup)
return NULL;
return *lookup;
}
int new_alias(const char *from, const char *to)
{
struct alias_rule *alias, **result;
@@ -189,4 +178,5 @@ void free_aliases(void)
{
if (alias_table)
tdestroy(alias_table, &free_alias);
alias_table = NULL;
}

View File

@@ -723,3 +723,10 @@ void free_policy(struct codomain *cod)
free(cod->dfa);
free(cod);
}
void free_policies(void)
{
if (policy_list)
tdestroy(policy_list, (__free_fn_t)&free_policy);
policy_list = NULL;
}

View File

@@ -642,6 +642,11 @@ out:
return error;
}
void reset_regex(void)
{
aare_reset_matchflags();
}
#ifdef UNIT_TEST
#define MY_TEST(statement, error) \
if (!(statement)) { \

View File

@@ -532,6 +532,13 @@ void dump_expanded_symtab(void)
twalk(my_symtab, &dump_expanded_symtab_entry);
}
void free_symtabs(void)
{
if (my_symtab)
tdestroy(my_symtab, (__free_fn_t)&free_symtab);
my_symtab = NULL;
}
#ifdef UNIT_TEST
#define MY_TEST(statement, error) \
if (!(statement)) { \