mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
parser: Improve the rule skip test.
Rules can be marked as being deleted/merged, and should be skipped on further processing. Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
7393aaac21
commit
dbca8ebb89
4 changed files with 9 additions and 3 deletions
|
@ -848,7 +848,7 @@ int clear_and_convert_entry(std::string& buffer, char *entry)
|
||||||
int post_process_policydb_ents(Profile *prof)
|
int post_process_policydb_ents(Profile *prof)
|
||||||
{
|
{
|
||||||
for (RuleList::iterator i = prof->rule_ents.begin(); i != prof->rule_ents.end(); i++) {
|
for (RuleList::iterator i = prof->rule_ents.begin(); i != prof->rule_ents.end(); i++) {
|
||||||
if ((*i)->flags & RULE_FLAG_DELETED)
|
if ((*i)->skip_processing())
|
||||||
continue;
|
continue;
|
||||||
if ((*i)->gen_policy_re(*prof) == RULE_ERROR)
|
if ((*i)->gen_policy_re(*prof) == RULE_ERROR)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -267,7 +267,7 @@ static int process_variables_in_entries(struct cod_entry *entry_list)
|
||||||
static int process_variables_in_rules(Profile &prof)
|
static int process_variables_in_rules(Profile &prof)
|
||||||
{
|
{
|
||||||
for (RuleList::iterator i = prof.rule_ents.begin(); i != prof.rule_ents.end(); i++) {
|
for (RuleList::iterator i = prof.rule_ents.begin(); i != prof.rule_ents.end(); i++) {
|
||||||
if ((*i)->flags & RULE_FLAG_DELETED)
|
if ((*i)->skip_processing())
|
||||||
continue;
|
continue;
|
||||||
int error = (*i)->expand_variables();
|
int error = (*i)->expand_variables();
|
||||||
if (error)
|
if (error)
|
||||||
|
|
|
@ -318,7 +318,7 @@ void post_process_file_entries(Profile *prof)
|
||||||
void post_process_rule_entries(Profile *prof)
|
void post_process_rule_entries(Profile *prof)
|
||||||
{
|
{
|
||||||
for (RuleList::iterator i = prof->rule_ents.begin(); i != prof->rule_ents.end(); i++) {
|
for (RuleList::iterator i = prof->rule_ents.begin(); i != prof->rule_ents.end(); i++) {
|
||||||
if ((*i)->flags & RULE_FLAG_DELETED)
|
if ((*i)->skip_processing())
|
||||||
continue;
|
continue;
|
||||||
(*i)->post_parse_profile(*prof);
|
(*i)->post_parse_profile(*prof);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,12 @@ public:
|
||||||
|
|
||||||
bool is_type(int type) { return rule_type == type; }
|
bool is_type(int type) { return rule_type == type; }
|
||||||
|
|
||||||
|
// rule has been marked as should be skipped by regular processing
|
||||||
|
bool skip_processing()
|
||||||
|
{
|
||||||
|
return (flags == RULE_FLAG_DELETED ||
|
||||||
|
flags == RULE_FLAG_MERGED);
|
||||||
|
}
|
||||||
//virtual bool operator<(rule_t const &rhs)const = 0;
|
//virtual bool operator<(rule_t const &rhs)const = 0;
|
||||||
virtual std::ostream &dump(std::ostream &os) = 0;
|
virtual std::ostream &dump(std::ostream &os) = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue