2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-29 13:28:19 +00:00

fix(inconsistent-missing-override): add missed override specifiers

This commit is contained in:
Eisuke Kawashima 2025-05-04 23:55:10 +09:00
parent 18c0d003ef
commit 5526138483
No known key found for this signature in database
GPG Key ID: 116C7D1A302A8D59
14 changed files with 173 additions and 173 deletions

View File

@ -53,7 +53,7 @@ public:
sock_type_n(-1), proto(NULL), proto_n(0), label(NULL), sock_type_n(-1), proto(NULL), proto_n(0), label(NULL),
peer_label(NULL) { } peer_label(NULL) { }
virtual ~af_rule() ~af_rule() override
{ {
free(sock_type); free(sock_type);
free(proto); free(proto);
@ -73,12 +73,12 @@ public:
virtual bool has_peer_conds(void) { return peer_label ? true : false; } virtual bool has_peer_conds(void) { return peer_label ? true : false; }
virtual ostream &dump_local(ostream &os); virtual ostream &dump_local(ostream &os);
virtual ostream &dump_peer(ostream &os); virtual ostream &dump_peer(ostream &os);
virtual ostream &dump(ostream &os); ostream &dump(ostream &os) override;
virtual int expand_variables(void); int expand_variables(void) override;
virtual int gen_policy_re(Profile &prof) = 0; int gen_policy_re(Profile &prof) override = 0;
virtual bool is_mergeable(void) { return true; } bool is_mergeable(void) override { return true; }
virtual int cmp(rule_t const &rhs) const int cmp(rule_t const &rhs) const override
{ {
int res = perms_rule_t::cmp(rhs); int res = perms_rule_t::cmp(rhs);
if (res) if (res)

View File

@ -41,13 +41,13 @@ public:
unix_rule(unsigned int type_p, audit_t audit_p, rule_mode_t rule_mode_p); unix_rule(unsigned int type_p, audit_t audit_p, rule_mode_t rule_mode_p);
unix_rule(perm32_t perms, struct cond_entry *conds, unix_rule(perm32_t perms, struct cond_entry *conds,
struct cond_entry *peer_conds); struct cond_entry *peer_conds);
virtual ~unix_rule() ~unix_rule() override
{ {
free(addr); free(addr);
free(peer_addr); free(peer_addr);
}; };
virtual bool valid_prefix(const prefixes &p, const char *&error) { bool valid_prefix(const prefixes &p, const char *&error) override {
// priority is partially supported for unix rules // priority is partially supported for unix rules
// rules that get downgraded to just network socket // rules that get downgraded to just network socket
// won't support them but the fine grained do. // won't support them but the fine grained do.
@ -57,17 +57,17 @@ public:
} }
return true; return true;
}; };
virtual bool has_peer_conds(void) { bool has_peer_conds(void) override {
return af_rule::has_peer_conds() || peer_addr; return af_rule::has_peer_conds() || peer_addr;
} }
virtual ostream &dump_local(ostream &os); ostream &dump_local(ostream &os) override;
virtual ostream &dump_peer(ostream &os); ostream &dump_peer(ostream &os) override;
virtual int expand_variables(void); int expand_variables(void) override;
virtual int gen_policy_re(Profile &prof); int gen_policy_re(Profile &prof) override;
// inherit is_mergable() from af_rule // inherit is_mergable() from af_rule
virtual int cmp(rule_t const &rhs) const int cmp(rule_t const &rhs) const override
{ {
int res = af_rule::cmp(rhs); int res = af_rule::cmp(rhs);
if (res) if (res)
@ -80,7 +80,7 @@ public:
}; };
protected: protected:
virtual void warn_once(const char *name) override; void warn_once(const char *name) override;
}; };
#endif /* __AA_AF_UNIX_H */ #endif /* __AA_AF_UNIX_H */

View File

@ -31,7 +31,7 @@ class all_rule: public prefix_rule_t {
public: public:
all_rule(void): prefix_rule_t(RULE_TYPE_ALL) { } all_rule(void): prefix_rule_t(RULE_TYPE_ALL) { }
virtual bool valid_prefix(const prefixes &p, const char *&error) { bool valid_prefix(const prefixes &p, const char *&error) override {
if (p.priority != 0) { if (p.priority != 0) {
error = _("priority prefix not allowed on all rules"); error = _("priority prefix not allowed on all rules");
return false; return false;
@ -43,30 +43,30 @@ public:
return true; return true;
}; };
int expand_variables(void) int expand_variables(void) override
{ {
return 0; return 0;
} }
virtual ostream &dump(ostream &os) { ostream &dump(ostream &os) override {
prefix_rule_t::dump(os); prefix_rule_t::dump(os);
os << "all"; os << "all";
return os; return os;
} }
virtual bool is_mergeable(void) { return true; } bool is_mergeable(void) override { return true; }
virtual int cmp(rule_t const &rhs) const int cmp(rule_t const &rhs) const override
{ {
return prefix_rule_t::cmp(rhs); return prefix_rule_t::cmp(rhs);
}; };
virtual void add_implied_rules(Profile &prof); void add_implied_rules(Profile &prof) override;
virtual int gen_policy_re(Profile &prof unused) { return RULE_OK; }; int gen_policy_re(Profile &prof unused) override { return RULE_OK; };
protected: protected:
virtual void warn_once(const char *name unused, const char *msg unused) { }; void warn_once(const char *name unused, const char *msg unused) override { };
virtual void warn_once(const char *name unused) { }; void warn_once(const char *name unused) override { };
}; };
#endif /* __AA_ALL_H */ #endif /* __AA_ALL_H */

View File

@ -42,7 +42,7 @@ public:
dbus_rule(perm32_t perms_p, struct cond_entry *conds, dbus_rule(perm32_t perms_p, struct cond_entry *conds,
struct cond_entry *peer_conds); struct cond_entry *peer_conds);
virtual ~dbus_rule() { ~dbus_rule() override {
free(bus); free(bus);
free(name); free(name);
free(peer_label); free(peer_label);
@ -50,7 +50,7 @@ public:
free(interface); free(interface);
free(member); free(member);
}; };
virtual bool valid_prefix(const prefixes &p, const char *&error) { bool valid_prefix(const prefixes &p, const char *&error) override {
if (p.owner != OWNER_UNSPECIFIED) { if (p.owner != OWNER_UNSPECIFIED) {
error = "owner prefix not allowed on dbus rules"; error = "owner prefix not allowed on dbus rules";
return false; return false;
@ -58,12 +58,12 @@ public:
return true; return true;
}; };
virtual ostream &dump(ostream &os); ostream &dump(ostream &os) override;
virtual int expand_variables(void); int expand_variables(void) override;
virtual int gen_policy_re(Profile &prof); int gen_policy_re(Profile &prof) override;
virtual bool is_mergeable(void) { return true; } bool is_mergeable(void) override { return true; }
virtual int cmp(rule_t const &rhs) const int cmp(rule_t const &rhs) const override
{ {
int res = perms_rule_t::cmp(rhs); int res = perms_rule_t::cmp(rhs);
if (res) if (res)
@ -89,7 +89,7 @@ public:
protected: protected:
virtual void warn_once(const char *name) override; void warn_once(const char *name) override;
}; };
#endif /* __AA_DBUS_H */ #endif /* __AA_DBUS_H */

View File

@ -32,12 +32,12 @@ public:
char *label; char *label;
io_uring_rule(perm32_t perms, struct cond_entry *conds, struct cond_entry *ring_conds); io_uring_rule(perm32_t perms, struct cond_entry *conds, struct cond_entry *ring_conds);
virtual ~io_uring_rule() ~io_uring_rule() override
{ {
free(label); free(label);
}; };
virtual bool valid_prefix(const prefixes &p, const char *&error) { bool valid_prefix(const prefixes &p, const char *&error) override {
if (p.owner) { if (p.owner) {
error = _("owner prefix not allowed on io_uring rules"); error = _("owner prefix not allowed on io_uring rules");
return false; return false;
@ -45,12 +45,12 @@ public:
return true; return true;
}; };
virtual ostream &dump(ostream &os); ostream &dump(ostream &os) override;
virtual int expand_variables(void); int expand_variables(void) override;
virtual int gen_policy_re(Profile &prof); int gen_policy_re(Profile &prof) override;
virtual bool is_mergeable(void) { return true; } bool is_mergeable(void) override { return true; }
virtual int cmp(rule_t const &rhs) const int cmp(rule_t const &rhs) const override
{ {
int res = perms_rule_t::cmp(rhs); int res = perms_rule_t::cmp(rhs);
if (res) if (res)
@ -60,7 +60,7 @@ public:
}; };
protected: protected:
virtual void warn_once(const char *name) override; void warn_once(const char *name) override;
}; };
#endif /* __AA_IO_URING_H */ #endif /* __AA_IO_URING_H */

View File

@ -373,13 +373,13 @@ public:
{ {
type_flags |= NODE_TYPE_TWOCHILD; type_flags |= NODE_TYPE_TWOCHILD;
}; };
virtual int normalize_eps(int dir); int normalize_eps(int dir) override;
}; };
class LeafNode: public Node { class LeafNode: public Node {
public: public:
LeafNode(): Node() { type_flags |= NODE_TYPE_LEAF; }; LeafNode(): Node() { type_flags |= NODE_TYPE_LEAF; };
virtual void normalize(int dir __attribute__((unused))) { return; } void normalize(int dir __attribute__((unused))) override { return; }
}; };
/* Match nothing (//). */ /* Match nothing (//). */
@ -391,22 +391,22 @@ public:
nullable = true; nullable = true;
label = 0; label = 0;
} }
void release(void) void release(void) override
{ {
/* don't delete Eps nodes because there is a single static /* don't delete Eps nodes because there is a single static
* instance shared by all trees. Look for epsnode in the code * instance shared by all trees. Look for epsnode in the code
*/ */
} }
void compute_firstpos() { } void compute_firstpos() override { }
void compute_lastpos() { } void compute_lastpos() override { }
int eq(Node *other) int eq(Node *other) override
{ {
if (other->is_type(NODE_TYPE_EPS)) if (other->is_type(NODE_TYPE_EPS))
return 1; return 1;
return 0; return 0;
} }
ostream &dump(ostream &os) ostream &dump(ostream &os) override
{ {
return os << "[]"; return os << "[]";
} }
@ -420,8 +420,8 @@ public:
class ImportantNode: public LeafNode { class ImportantNode: public LeafNode {
public: public:
ImportantNode(): LeafNode() { type_flags |= NODE_TYPE_IMPORTANT; } ImportantNode(): LeafNode() { type_flags |= NODE_TYPE_IMPORTANT; }
void compute_firstpos() { firstpos.insert(this); } void compute_firstpos() override { firstpos.insert(this); }
void compute_lastpos() { lastpos.insert(this); } void compute_lastpos() override { lastpos.insert(this); }
virtual void follow(Cases &cases) = 0; virtual void follow(Cases &cases) = 0;
virtual int is_accept(void) = 0; virtual int is_accept(void) = 0;
virtual int is_postprocess(void) = 0; virtual int is_postprocess(void) = 0;
@ -433,15 +433,15 @@ public:
class CNode: public ImportantNode { class CNode: public ImportantNode {
public: public:
CNode(): ImportantNode() { type_flags |= NODE_TYPE_C; } CNode(): ImportantNode() { type_flags |= NODE_TYPE_C; }
int is_accept(void) { return false; } int is_accept(void) override { return false; }
int is_postprocess(void) { return false; } int is_postprocess(void) override { return false; }
}; };
/* Match one specific character (/c/). */ /* Match one specific character (/c/). */
class CharNode: public CNode { class CharNode: public CNode {
public: public:
CharNode(transchar c): c(c) { type_flags |= NODE_TYPE_CHAR; } CharNode(transchar c): c(c) { type_flags |= NODE_TYPE_CHAR; }
void follow(Cases &cases) void follow(Cases &cases) override
{ {
NodeSet **x = &cases.cases[c]; NodeSet **x = &cases.cases[c];
if (!*x) { if (!*x) {
@ -452,7 +452,7 @@ public:
} }
(*x)->insert(followpos.begin(), followpos.end()); (*x)->insert(followpos.begin(), followpos.end());
} }
int eq(Node *other) int eq(Node *other) override
{ {
if (other->is_type(NODE_TYPE_CHAR)) { if (other->is_type(NODE_TYPE_CHAR)) {
CharNode *o = static_cast<CharNode *>(other); CharNode *o = static_cast<CharNode *>(other);
@ -460,12 +460,12 @@ public:
} }
return 0; return 0;
} }
ostream &dump(ostream &os) ostream &dump(ostream &os) override
{ {
return os << c; return os << c;
} }
int min_match_len() int min_match_len() override
{ {
if (c < 0) { if (c < 0) {
// oob characters indicates end of string. // oob characters indicates end of string.
@ -477,7 +477,7 @@ public:
return 1; return 1;
} }
bool contains_oob() { return c < 0; } bool contains_oob() override { return c < 0; }
transchar c; transchar c;
}; };
@ -489,7 +489,7 @@ public:
{ {
type_flags |= NODE_TYPE_CHARSET; type_flags |= NODE_TYPE_CHARSET;
} }
void follow(Cases &cases) void follow(Cases &cases) override
{ {
for (Chars::iterator i = chars.begin(); i != chars.end(); i++) { for (Chars::iterator i = chars.begin(); i != chars.end(); i++) {
NodeSet **x = &cases.cases[*i]; NodeSet **x = &cases.cases[*i];
@ -502,7 +502,7 @@ public:
(*x)->insert(followpos.begin(), followpos.end()); (*x)->insert(followpos.begin(), followpos.end());
} }
} }
int eq(Node *other) int eq(Node *other) override
{ {
if (!other->is_type(NODE_TYPE_CHARSET)) if (!other->is_type(NODE_TYPE_CHARSET))
return 0; return 0;
@ -518,7 +518,7 @@ public:
} }
return 1; return 1;
} }
ostream &dump(ostream &os) ostream &dump(ostream &os) override
{ {
os << '['; os << '[';
for (Chars::iterator i = chars.begin(); i != chars.end(); i++) for (Chars::iterator i = chars.begin(); i != chars.end(); i++)
@ -526,7 +526,7 @@ public:
return os << ']'; return os << ']';
} }
int min_match_len() int min_match_len() override
{ {
if (contains_oob()) { if (contains_oob()) {
return 0; return 0;
@ -534,7 +534,7 @@ public:
return 1; return 1;
} }
bool contains_oob() bool contains_oob() override
{ {
for (Chars::iterator i = chars.begin(); i != chars.end(); i++) { for (Chars::iterator i = chars.begin(); i != chars.end(); i++) {
if (*i < 0) { if (*i < 0) {
@ -554,7 +554,7 @@ public:
{ {
type_flags |= NODE_TYPE_NOTCHARSET; type_flags |= NODE_TYPE_NOTCHARSET;
} }
void follow(Cases &cases) void follow(Cases &cases) override
{ {
if (!cases.otherwise) if (!cases.otherwise)
cases.otherwise = new NodeSet; cases.otherwise = new NodeSet;
@ -575,7 +575,7 @@ public:
followpos.end()); followpos.end());
} }
} }
int eq(Node *other) int eq(Node *other) override
{ {
if (!other->is_type(NODE_TYPE_NOTCHARSET)) if (!other->is_type(NODE_TYPE_NOTCHARSET))
return 0; return 0;
@ -591,7 +591,7 @@ public:
} }
return 1; return 1;
} }
ostream &dump(ostream &os) ostream &dump(ostream &os) override
{ {
os << "[^"; os << "[^";
for (Chars::iterator i = chars.begin(); i != chars.end(); i++) for (Chars::iterator i = chars.begin(); i != chars.end(); i++)
@ -599,7 +599,7 @@ public:
return os << ']'; return os << ']';
} }
int min_match_len() int min_match_len() override
{ {
/* Inverse match does not match any oob char at this time /* Inverse match does not match any oob char at this time
* so only count characters * so only count characters
@ -607,7 +607,7 @@ public:
return 1; return 1;
} }
bool contains_oob() bool contains_oob() override
{ {
for (Chars::iterator i = chars.begin(); i != chars.end(); i++) { for (Chars::iterator i = chars.begin(); i != chars.end(); i++) {
if (*i < 0) { if (*i < 0) {
@ -624,7 +624,7 @@ public:
class AnyCharNode: public CNode { class AnyCharNode: public CNode {
public: public:
AnyCharNode() { type_flags |= NODE_TYPE_ANYCHAR; } AnyCharNode() { type_flags |= NODE_TYPE_ANYCHAR; }
void follow(Cases &cases) void follow(Cases &cases) override
{ {
if (!cases.otherwise) if (!cases.otherwise)
cases.otherwise = new NodeSet; cases.otherwise = new NodeSet;
@ -635,13 +635,13 @@ public:
if (i->first.c >= 0) if (i->first.c >= 0)
i->second->insert(followpos.begin(), followpos.end()); i->second->insert(followpos.begin(), followpos.end());
} }
int eq(Node *other) int eq(Node *other) override
{ {
if (other->is_type(NODE_TYPE_ANYCHAR)) if (other->is_type(NODE_TYPE_ANYCHAR))
return 1; return 1;
return 0; return 0;
} }
ostream &dump(ostream &os) { return os << "."; } ostream &dump(ostream &os) override { return os << "."; }
}; };
/* Match a node zero or more times. (This is a unary operator.) */ /* Match a node zero or more times. (This is a unary operator.) */
@ -652,29 +652,29 @@ public:
type_flags |= NODE_TYPE_STAR; type_flags |= NODE_TYPE_STAR;
nullable = true; nullable = true;
} }
void compute_firstpos() { firstpos = child[0]->firstpos; } void compute_firstpos() override { firstpos = child[0]->firstpos; }
void compute_lastpos() { lastpos = child[0]->lastpos; } void compute_lastpos() override { lastpos = child[0]->lastpos; }
void compute_followpos() void compute_followpos() override
{ {
NodeSet from = child[0]->lastpos, to = child[0]->firstpos; NodeSet from = child[0]->lastpos, to = child[0]->firstpos;
for (NodeSet::iterator i = from.begin(); i != from.end(); i++) { for (NodeSet::iterator i = from.begin(); i != from.end(); i++) {
(*i)->followpos.insert(to.begin(), to.end()); (*i)->followpos.insert(to.begin(), to.end());
} }
} }
int eq(Node *other) int eq(Node *other) override
{ {
if (other->is_type(NODE_TYPE_STAR)) if (other->is_type(NODE_TYPE_STAR))
return child[0]->eq(other->child[0]); return child[0]->eq(other->child[0]);
return 0; return 0;
} }
ostream &dump(ostream &os) ostream &dump(ostream &os) override
{ {
os << '('; os << '(';
child[0]->dump(os); child[0]->dump(os);
return os << ")*"; return os << ")*";
} }
bool contains_oob() { return child[0]->contains_oob(); } bool contains_oob() override { return child[0]->contains_oob(); }
}; };
/* Match a node zero or one times. */ /* Match a node zero or one times. */
@ -685,15 +685,15 @@ public:
type_flags |= NODE_TYPE_OPTIONAL; type_flags |= NODE_TYPE_OPTIONAL;
nullable = true; nullable = true;
} }
void compute_firstpos() { firstpos = child[0]->firstpos; } void compute_firstpos() override { firstpos = child[0]->firstpos; }
void compute_lastpos() { lastpos = child[0]->lastpos; } void compute_lastpos() override { lastpos = child[0]->lastpos; }
int eq(Node *other) int eq(Node *other) override
{ {
if (other->is_type(NODE_TYPE_OPTIONAL)) if (other->is_type(NODE_TYPE_OPTIONAL))
return child[0]->eq(other->child[0]); return child[0]->eq(other->child[0]);
return 0; return 0;
} }
ostream &dump(ostream &os) ostream &dump(ostream &os) override
{ {
os << '('; os << '(';
child[0]->dump(os); child[0]->dump(os);
@ -708,28 +708,28 @@ public:
{ {
type_flags |= NODE_TYPE_PLUS; type_flags |= NODE_TYPE_PLUS;
} }
void compute_nullable() { nullable = child[0]->nullable; } void compute_nullable() override { nullable = child[0]->nullable; }
void compute_firstpos() { firstpos = child[0]->firstpos; } void compute_firstpos() override { firstpos = child[0]->firstpos; }
void compute_lastpos() { lastpos = child[0]->lastpos; } void compute_lastpos() override { lastpos = child[0]->lastpos; }
void compute_followpos() void compute_followpos() override
{ {
NodeSet from = child[0]->lastpos, to = child[0]->firstpos; NodeSet from = child[0]->lastpos, to = child[0]->firstpos;
for (NodeSet::iterator i = from.begin(); i != from.end(); i++) { for (NodeSet::iterator i = from.begin(); i != from.end(); i++) {
(*i)->followpos.insert(to.begin(), to.end()); (*i)->followpos.insert(to.begin(), to.end());
} }
} }
int eq(Node *other) { int eq(Node *other) override {
if (other->is_type(NODE_TYPE_PLUS)) if (other->is_type(NODE_TYPE_PLUS))
return child[0]->eq(other->child[0]); return child[0]->eq(other->child[0]);
return 0; return 0;
} }
ostream &dump(ostream &os) { ostream &dump(ostream &os) override {
os << '('; os << '(';
child[0]->dump(os); child[0]->dump(os);
return os << ")+"; return os << ")+";
} }
int min_match_len() { return child[0]->min_match_len(); } int min_match_len() override { return child[0]->min_match_len(); }
bool contains_oob() { return child[0]->contains_oob(); } bool contains_oob() override { return child[0]->contains_oob(); }
}; };
/* Match a pair of consecutive nodes. */ /* Match a pair of consecutive nodes. */
@ -739,32 +739,32 @@ public:
{ {
type_flags |= NODE_TYPE_CAT; type_flags |= NODE_TYPE_CAT;
} }
void compute_nullable() void compute_nullable() override
{ {
nullable = child[0]->nullable && child[1]->nullable; nullable = child[0]->nullable && child[1]->nullable;
} }
void compute_firstpos() void compute_firstpos() override
{ {
if (child[0]->nullable) if (child[0]->nullable)
firstpos = child[0]->firstpos + child[1]->firstpos; firstpos = child[0]->firstpos + child[1]->firstpos;
else else
firstpos = child[0]->firstpos; firstpos = child[0]->firstpos;
} }
void compute_lastpos() void compute_lastpos() override
{ {
if (child[1]->nullable) if (child[1]->nullable)
lastpos = child[0]->lastpos + child[1]->lastpos; lastpos = child[0]->lastpos + child[1]->lastpos;
else else
lastpos = child[1]->lastpos; lastpos = child[1]->lastpos;
} }
void compute_followpos() void compute_followpos() override
{ {
NodeSet from = child[0]->lastpos, to = child[1]->firstpos; NodeSet from = child[0]->lastpos, to = child[1]->firstpos;
for (NodeSet::iterator i = from.begin(); i != from.end(); i++) { for (NodeSet::iterator i = from.begin(); i != from.end(); i++) {
(*i)->followpos.insert(to.begin(), to.end()); (*i)->followpos.insert(to.begin(), to.end());
} }
} }
int eq(Node *other) int eq(Node *other) override
{ {
if (other->is_type(NODE_TYPE_CAT)) { if (other->is_type(NODE_TYPE_CAT)) {
if (!child[0]->eq(other->child[0])) if (!child[0]->eq(other->child[0]))
@ -773,14 +773,14 @@ public:
} }
return 0; return 0;
} }
ostream &dump(ostream &os) ostream &dump(ostream &os) override
{ {
child[0]->dump(os); child[0]->dump(os);
child[1]->dump(os); child[1]->dump(os);
return os; return os;
} }
void normalize(int dir); void normalize(int dir) override;
int min_match_len() int min_match_len() override
{ {
int len = child[0]->min_match_len(); int len = child[0]->min_match_len();
if (child[0]->contains_oob()) { if (child[0]->contains_oob()) {
@ -792,7 +792,7 @@ public:
} }
return len + child[1]->min_match_len(); return len + child[1]->min_match_len();
} }
bool contains_oob() bool contains_oob() override
{ {
return child[0]->contains_oob() || child[1]->contains_oob(); return child[0]->contains_oob() || child[1]->contains_oob();
} }
@ -805,19 +805,19 @@ public:
{ {
type_flags |= NODE_TYPE_ALT; type_flags |= NODE_TYPE_ALT;
} }
void compute_nullable() void compute_nullable() override
{ {
nullable = child[0]->nullable || child[1]->nullable; nullable = child[0]->nullable || child[1]->nullable;
} }
void compute_lastpos() void compute_lastpos() override
{ {
lastpos = child[0]->lastpos + child[1]->lastpos; lastpos = child[0]->lastpos + child[1]->lastpos;
} }
void compute_firstpos() void compute_firstpos() override
{ {
firstpos = child[0]->firstpos + child[1]->firstpos; firstpos = child[0]->firstpos + child[1]->firstpos;
} }
int eq(Node *other) int eq(Node *other) override
{ {
if (other->is_type(NODE_TYPE_ALT)) { if (other->is_type(NODE_TYPE_ALT)) {
if (!child[0]->eq(other->child[0])) if (!child[0]->eq(other->child[0]))
@ -826,7 +826,7 @@ public:
} }
return 0; return 0;
} }
ostream &dump(ostream &os) ostream &dump(ostream &os) override
{ {
os << '('; os << '(';
child[0]->dump(os); child[0]->dump(os);
@ -835,8 +835,8 @@ public:
os << ')'; os << ')';
return os; return os;
} }
void normalize(int dir); void normalize(int dir) override;
int min_match_len() int min_match_len() override
{ {
int m1, m2; int m1, m2;
m1 = child[0]->min_match_len(); m1 = child[0]->min_match_len();
@ -846,7 +846,7 @@ public:
} }
return m2; return m2;
} }
bool contains_oob() bool contains_oob() override
{ {
return child[0]->contains_oob() || child[1]->contains_oob(); return child[0]->contains_oob() || child[1]->contains_oob();
} }
@ -858,20 +858,20 @@ public:
{ {
type_flags |= NODE_TYPE_SHARED; type_flags |= NODE_TYPE_SHARED;
} }
void release(void) void release(void) override
{ {
/* don't delete SharedNodes via release as they are shared, and /* don't delete SharedNodes via release as they are shared, and
* will be deleted when the table they are stored in is deleted * will be deleted when the table they are stored in is deleted
*/ */
} }
void follow(Cases &cases __attribute__ ((unused))) void follow(Cases &cases __attribute__ ((unused))) override
{ {
/* Nothing to follow. */ /* Nothing to follow. */
} }
/* requires shared nodes to be common by pointer */ /* requires shared nodes to be common by pointer */
int eq(Node *other) { return (this == other); } int eq(Node *other) override { return (this == other); }
}; };
/** /**
@ -881,8 +881,8 @@ public:
class AcceptNode: public SharedNode { class AcceptNode: public SharedNode {
public: public:
AcceptNode() { type_flags |= NODE_TYPE_ACCEPT; } AcceptNode() { type_flags |= NODE_TYPE_ACCEPT; }
int is_accept(void) { return true; } int is_accept(void) override { return true; }
int is_postprocess(void) { return false; } int is_postprocess(void) override { return false; }
}; };
class MatchFlag: public AcceptNode { class MatchFlag: public AcceptNode {
@ -891,7 +891,7 @@ public:
{ {
type_flags |= NODE_TYPE_MATCHFLAG; type_flags |= NODE_TYPE_MATCHFLAG;
} }
ostream &dump(ostream &os) { return os << "< 0x" << hex << perms << std::dec << '>'; } ostream &dump(ostream &os) override { return os << "< 0x" << hex << perms << std::dec << '>'; }
int priority; int priority;
perm32_t perms; perm32_t perms;
@ -1054,9 +1054,9 @@ public:
set<NodeVec *, deref_less_than> cache; set<NodeVec *, deref_less_than> cache;
NodeVecCache(void): cache() { }; NodeVecCache(void): cache() { };
~NodeVecCache() { clear(); }; ~NodeVecCache() override { clear(); };
virtual unsigned long size(void) const { return cache.size(); } unsigned long size(void) const override { return cache.size(); }
void clear() void clear()
{ {

View File

@ -324,9 +324,9 @@ public:
map<ProtoState, State *> cache; map<ProtoState, State *> cache;
NodeMap(void): cache() { }; NodeMap(void): cache() { };
~NodeMap() { clear(); }; ~NodeMap() override { clear(); };
virtual unsigned long size(void) const { return cache.size(); } unsigned long size(void) const override { return cache.size(); }
void clear() void clear()
{ {

View File

@ -159,7 +159,7 @@ public:
mnt_rule(struct cond_entry *src_conds, char *device_p, mnt_rule(struct cond_entry *src_conds, char *device_p,
struct cond_entry *dst_conds unused, char *mnt_point_p, struct cond_entry *dst_conds unused, char *mnt_point_p,
perm32_t perms_p); perm32_t perms_p);
virtual ~mnt_rule() ~mnt_rule() override
{ {
free_value_list(opts); free_value_list(opts);
free_value_list(dev_type); free_value_list(dev_type);
@ -168,25 +168,25 @@ public:
free(trans); free(trans);
} }
virtual bool valid_prefix(const prefixes &p, const char *&error) { bool valid_prefix(const prefixes &p, const char *&error) override {
if (p.owner != OWNER_UNSPECIFIED) { if (p.owner != OWNER_UNSPECIFIED) {
error = "owner prefix not allowed on mount rules"; error = "owner prefix not allowed on mount rules";
return false; return false;
} }
return true; return true;
}; };
virtual ostream &dump(ostream &os); ostream &dump(ostream &os) override;
virtual int expand_variables(void); int expand_variables(void) override;
virtual int gen_policy_re(Profile &prof); int gen_policy_re(Profile &prof) override;
virtual void post_parse_profile(Profile &prof unused); void post_parse_profile(Profile &prof unused) override;
virtual bool is_mergeable(void) { return true; } bool is_mergeable(void) override { return true; }
virtual int cmp(rule_t const &rhs) const; int cmp(rule_t const &rhs) const override;
// for now use default merge/dedup // for now use default merge/dedup
protected: protected:
virtual void warn_once(const char *name) override; void warn_once(const char *name) override;
}; };
int is_valid_mnt_cond(const char *name, int src); int is_valid_mnt_cond(const char *name, int src);

View File

@ -94,13 +94,13 @@ public:
char *label; char *label;
mqueue_rule(perm32_t perms, struct cond_entry *conds, char *qname = NULL); mqueue_rule(perm32_t perms, struct cond_entry *conds, char *qname = NULL);
virtual ~mqueue_rule() ~mqueue_rule() override
{ {
free(qname); free(qname);
free(label); free(label);
}; };
virtual bool valid_prefix(const prefixes &p, const char *&error) { bool valid_prefix(const prefixes &p, const char *&error) override {
// not yet, but soon // not yet, but soon
if (p.owner) { if (p.owner) {
error = _("owner prefix not allowed on mqueue rules"); error = _("owner prefix not allowed on mqueue rules");
@ -108,12 +108,12 @@ public:
} }
return true; return true;
}; };
virtual ostream &dump(ostream &os); ostream &dump(ostream &os) override;
virtual int expand_variables(void); int expand_variables(void) override;
virtual int gen_policy_re(Profile &prof); int gen_policy_re(Profile &prof) override;
virtual bool is_mergeable(void) { return true; } bool is_mergeable(void) override { return true; }
virtual int cmp(rule_t const &rhs) const int cmp(rule_t const &rhs) const override
{ {
int res = perms_rule_t::cmp(rhs); int res = perms_rule_t::cmp(rhs);
if (res) if (res)
@ -129,7 +129,7 @@ public:
}; };
protected: protected:
virtual void warn_once(const char *name) override; void warn_once(const char *name) override;
void validate_qname(void); void validate_qname(void);
}; };

View File

@ -167,7 +167,7 @@ public:
const char *protocol, struct cond_entry *conds, const char *protocol, struct cond_entry *conds,
struct cond_entry *peer_conds); struct cond_entry *peer_conds);
network_rule(perm32_t perms_p, unsigned int family, unsigned int type); network_rule(perm32_t perms_p, unsigned int family, unsigned int type);
virtual ~network_rule() ~network_rule() override
{ {
peer.free_conds(); peer.free_conds();
local.free_conds(); local.free_conds();
@ -197,7 +197,7 @@ public:
bool parse_port(ip_conds &entry); bool parse_port(ip_conds &entry);
// update TODO: in equality.sh when priority is a valid prefix // update TODO: in equality.sh when priority is a valid prefix
virtual bool valid_prefix(const prefixes &p, const char *&error) { bool valid_prefix(const prefixes &p, const char *&error) override {
if (p.priority != 0) { if (p.priority != 0) {
error = _("priority prefix not allowed on network rules"); error = _("priority prefix not allowed on network rules");
return false; return false;
@ -208,12 +208,12 @@ public:
} }
return true; return true;
}; };
virtual ostream &dump(ostream &os); ostream &dump(ostream &os) override;
virtual int expand_variables(void); int expand_variables(void) override;
virtual int gen_policy_re(Profile &prof); int gen_policy_re(Profile &prof) override;
virtual bool is_mergeable(void) { return true; } bool is_mergeable(void) override { return true; }
virtual int cmp(rule_t const &rhs) const; int cmp(rule_t const &rhs) const override;
/* array of type masks indexed by AF_FAMILY */ /* array of type masks indexed by AF_FAMILY */
/* allow, audit, deny and quiet are used for compatibility with AA_CLASS_NET */ /* allow, audit, deny and quiet are used for compatibility with AA_CLASS_NET */
@ -225,7 +225,7 @@ public:
bool alloc_net_table(void); bool alloc_net_table(void);
protected: protected:
virtual void warn_once(const char *name) override; void warn_once(const char *name) override;
}; };
#endif /* __AA_NETWORK_H */ #endif /* __AA_NETWORK_H */

View File

@ -35,16 +35,16 @@ public:
char *peer_label; char *peer_label;
ptrace_rule(perm32_t perms, struct cond_entry *conds); ptrace_rule(perm32_t perms, struct cond_entry *conds);
virtual ~ptrace_rule() ~ptrace_rule() override
{ {
free(peer_label); free(peer_label);
}; };
virtual ostream &dump(ostream &os); ostream &dump(ostream &os) override;
virtual int expand_variables(void); int expand_variables(void) override;
virtual int gen_policy_re(Profile &prof); int gen_policy_re(Profile &prof) override;
virtual bool valid_prefix(const prefixes &p, const char *&error) { bool valid_prefix(const prefixes &p, const char *&error) override {
if (p.owner != OWNER_UNSPECIFIED) { if (p.owner != OWNER_UNSPECIFIED) {
error = "owner prefix not allowed on ptrace rules"; error = "owner prefix not allowed on ptrace rules";
return false; return false;
@ -52,8 +52,8 @@ public:
return true; return true;
}; };
virtual bool is_mergeable(void) { return true; } bool is_mergeable(void) override { return true; }
virtual int cmp(rule_t const &rhs) const int cmp(rule_t const &rhs) const override
{ {
int res = perms_rule_t::cmp(rhs); int res = perms_rule_t::cmp(rhs);
if (res) if (res)
@ -63,7 +63,7 @@ public:
}; };
protected: protected:
virtual void warn_once(const char *name) override; void warn_once(const char *name) override;
}; };
#endif /* __AA_PTRACE_H */ #endif /* __AA_PTRACE_H */

View File

@ -354,7 +354,7 @@ public:
return *ptr < rhs; return *ptr < rhs;
} }
virtual int cmp(rule_t const &rhs) const { int cmp(rule_t const &rhs) const override {
int res = rule_t::cmp(rhs); int res = rule_t::cmp(rhs);
if (res) if (res)
return res; return res;
@ -363,7 +363,7 @@ public:
return lhsptr->cmp(*rhsptr); return lhsptr->cmp(*rhsptr);
} }
virtual bool operator<(rule_t const &rhs) const { bool operator<(rule_t const &rhs) const override {
if (rule_type < rhs.rule_type) if (rule_type < rhs.rule_type)
return true; return true;
if (rhs.rule_type < rule_type) if (rhs.rule_type < rule_type)
@ -373,7 +373,7 @@ public:
return *this < *rhsptr; return *this < *rhsptr;
} }
virtual ostream &dump(ostream &os) { ostream &dump(ostream &os) override {
prefixes::dump(os); prefixes::dump(os);
return os; return os;
@ -394,11 +394,11 @@ public:
* can in herit the generic one that redirects to cmp() * can in herit the generic one that redirects to cmp()
* that does get overriden * that does get overriden
*/ */
virtual bool operator<(rule_t const &rhs) const { bool operator<(rule_t const &rhs) const override {
return cmp(rhs) < 0; return cmp(rhs) < 0;
} }
virtual ostream &dump(ostream &os) { ostream &dump(ostream &os) override {
prefix_rule_t::dump(os); prefix_rule_t::dump(os);
os << aa_class_table[aa_class()]; os << aa_class_table[aa_class()];
@ -415,12 +415,12 @@ class perms_rule_t: public class_rule_t {
public: public:
perms_rule_t(int c): class_rule_t(c), perms(0), saved(0) { }; perms_rule_t(int c): class_rule_t(c), perms(0), saved(0) { };
virtual int cmp(rule_t const &rhs) const { int cmp(rule_t const &rhs) const override {
/* don't compare perms so they can be merged */ /* don't compare perms so they can be merged */
return class_rule_t::cmp(rhs); return class_rule_t::cmp(rhs);
} }
virtual bool merge(rule_t &rhs) bool merge(rule_t &rhs) override
{ {
int res = class_rule_t::merge(rhs); int res = class_rule_t::merge(rhs);
if (!res) if (!res)
@ -432,7 +432,7 @@ public:
}; };
/* defaut perms, override/mask off if none default used */ /* defaut perms, override/mask off if none default used */
virtual ostream &dump(ostream &os) { ostream &dump(ostream &os) override {
class_rule_t::dump(os); class_rule_t::dump(os);
if (saved) if (saved)
@ -451,7 +451,7 @@ class dedup_perms_rule_t: public class_rule_t {
public: public:
dedup_perms_rule_t(int c): class_rule_t(c), perms(0) { }; dedup_perms_rule_t(int c): class_rule_t(c), perms(0) { };
virtual int cmp(rule_t const &rhs) const { int cmp(rule_t const &rhs) const override {
int res = class_rule_t::cmp(rhs); int res = class_rule_t::cmp(rhs);
if (res) if (res)
return res; return res;
@ -461,7 +461,7 @@ public:
// inherit default merge which does dedup // inherit default merge which does dedup
/* defaut perms, override/mask off if none default used */ /* defaut perms, override/mask off if none default used */
virtual ostream &dump(ostream &os) { ostream &dump(ostream &os) override {
class_rule_t::dump(os); class_rule_t::dump(os);
os << "(0x" << hex << perms << ") "; os << "(0x" << hex << perms << ") ";

View File

@ -42,11 +42,11 @@ public:
char *peer_label; char *peer_label;
signal_rule(perm32_t perms, struct cond_entry *conds); signal_rule(perm32_t perms, struct cond_entry *conds);
virtual ~signal_rule() { ~signal_rule() override {
signals.clear(); signals.clear();
free(peer_label); free(peer_label);
}; };
virtual bool valid_prefix(const prefixes &p, const char *&error) { bool valid_prefix(const prefixes &p, const char *&error) override {
if (p.owner != OWNER_UNSPECIFIED) { if (p.owner != OWNER_UNSPECIFIED) {
error = "owner prefix not allowed on signal rules"; error = "owner prefix not allowed on signal rules";
return false; return false;
@ -54,15 +54,15 @@ public:
return true; return true;
}; };
virtual ostream &dump(ostream &os); ostream &dump(ostream &os) override;
virtual int expand_variables(void); int expand_variables(void) override;
virtual int gen_policy_re(Profile &prof); int gen_policy_re(Profile &prof) override;
virtual bool is_mergeable(void) { return true; } bool is_mergeable(void) override { return true; }
virtual int cmp(rule_t const &rhs) const; int cmp(rule_t const &rhs) const override;
protected: protected:
virtual void warn_once(const char *name) override; void warn_once(const char *name) override;
}; };
#endif /* __AA_SIGNAL_H */ #endif /* __AA_SIGNAL_H */

View File

@ -27,30 +27,30 @@ class userns_rule: public perms_rule_t {
void move_conditionals(struct cond_entry *conds); void move_conditionals(struct cond_entry *conds);
public: public:
userns_rule(perm32_t perms, struct cond_entry *conds); userns_rule(perm32_t perms, struct cond_entry *conds);
virtual ~userns_rule() ~userns_rule() override
{ {
}; };
virtual bool valid_prefix(const prefixes &p, const char *&error) { bool valid_prefix(const prefixes &p, const char *&error) override {
if (p.owner) { if (p.owner) {
error = _("owner prefix not allowed on userns rules"); error = _("owner prefix not allowed on userns rules");
return false; return false;
} }
return true; return true;
}; };
virtual ostream &dump(ostream &os); ostream &dump(ostream &os) override;
virtual int expand_variables(void); int expand_variables(void) override;
virtual int gen_policy_re(Profile &prof); int gen_policy_re(Profile &prof) override;
virtual bool is_mergeable(void) { return true; } bool is_mergeable(void) override { return true; }
virtual int cmp(rule_t const &rhs) const int cmp(rule_t const &rhs) const override
{ {
return perms_rule_t::cmp(rhs); return perms_rule_t::cmp(rhs);
}; };
/* merge perms not required atm since there's only one permission */ /* merge perms not required atm since there's only one permission */
protected: protected:
virtual void warn_once(const char *name) override; void warn_once(const char *name) override;
}; };
#endif /* __AA_USERNS_H */ #endif /* __AA_USERNS_H */