2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 14:25:52 +00:00

parser: rename post_process() method and move code around

The post_process() method is misnamed, it fires when the profile is
finished parsing but fires before variable expansion. Rename it
to better reflect what it does and move the trigger code into
profile as a start of cleaning this stage up.

Also document the order the hooks fire in

Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen
2021-09-08 00:25:28 -07:00
parent 28ae20983b
commit 10a75c431f
15 changed files with 223 additions and 202 deletions

View File

@@ -37,9 +37,23 @@ public:
//virtual bool operator<(rule_t const &rhs)const = 0;
virtual std::ostream &dump(std::ostream &os) = 0;
// Follow methods in order of being called by the parse
// called when profile is finished parsing
virtual void post_parse_profile(Profile &prof __attribute__ ((unused))) { };
// called before final expansion of variables. So implied rules
// can reference variables
virtual void add_implied_rules(Profile &prof __attribute__ ((unused))) { };
// currently only called post parse
// needs to change to being interatively called during parse
// to support expansion in include names and profile names
virtual int expand_variables(void) = 0;
// called late frontend to generate data for regex backend
virtual int gen_policy_re(Profile &prof) = 0;
virtual void post_process(Profile &prof) = 0;
protected:
const char *warned_name = NULL;