mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
parser: stop using dynamic_cast for prompt permission calculations
Like was done for the other MatchFlags switch to using a node type
instead of dynamic_cast as this will result in a performance
improvement.
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 9221d291ec
)
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
d4ee66e8f4
commit
71dbc73532
2 changed files with 6 additions and 2 deletions
|
@ -245,6 +245,7 @@ ostream &operator<<(ostream &os, Node &node);
|
|||
#define NODE_TYPE_MATCHFLAG (1 << 18)
|
||||
#define NODE_TYPE_EXACTMATCHFLAG (1 << 19)
|
||||
#define NODE_TYPE_DENYMATCHFLAG (1 << 20)
|
||||
#define NODE_TYPE_PROMPTMATCHFLAG (1 << 21)
|
||||
|
||||
/* An abstract node in the syntax tree. */
|
||||
class Node {
|
||||
|
@ -915,7 +916,10 @@ public:
|
|||
|
||||
class PromptMatchFlag: public MatchFlag {
|
||||
public:
|
||||
PromptMatchFlag(int priority, perm32_t prompt, perm32_t audit): MatchFlag(priority, prompt, audit) {}
|
||||
PromptMatchFlag(int priority, perm32_t prompt, perm32_t audit): MatchFlag(priority, prompt, audit)
|
||||
{
|
||||
type_flags |= NODE_TYPE_PROMPTMATCHFLAG;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1433,7 +1433,7 @@ int accept_perms(NodeVec *state, perms_t &perms, bool filedfa)
|
|||
} else if (match->is_type(NODE_TYPE_DENYMATCHFLAG)) {
|
||||
perms.deny |= match->perms;
|
||||
perms.quiet |= match->audit;
|
||||
} else if (dynamic_cast<PromptMatchFlag *>(match)) {
|
||||
} else if (match->is_type(NODE_TYPE_PROMPTMATCHFLAG)) {
|
||||
perms.prompt |= match->perms;
|
||||
perms.audit |= match->audit;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue