mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 01:57:43 +00:00
fix: avoid using namespace std;
in header files
using directive in a header file is a bad practice because it may lead to unexpected results. https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rs-using-directive
This commit is contained in:
parent
e510dfd0e7
commit
7d5a021023
@ -30,6 +30,8 @@
|
|||||||
#include "profile.h"
|
#include "profile.h"
|
||||||
#include "af_unix.h"
|
#include "af_unix.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
/* See unix(7) for autobind address definition */
|
/* See unix(7) for autobind address definition */
|
||||||
#define autobind_address_pattern "\\x00[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]";
|
#define autobind_address_pattern "\\x00[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]";
|
||||||
|
|
||||||
|
@ -21,14 +21,12 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
/* TODO: have includecache be a frontend for file cache, don't just
|
/* TODO: have includecache be a frontend for file cache, don't just
|
||||||
* store name.
|
* store name.
|
||||||
*/
|
*/
|
||||||
class IncludeCache_t {
|
class IncludeCache_t {
|
||||||
public:
|
public:
|
||||||
set<string> cache;
|
std::set<std::string> cache;
|
||||||
|
|
||||||
IncludeCache_t() = default;
|
IncludeCache_t() = default;
|
||||||
virtual ~IncludeCache_t() = default;
|
virtual ~IncludeCache_t() = default;
|
||||||
@ -39,7 +37,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool insert(const char *name) {
|
bool insert(const char *name) {
|
||||||
pair<set<string>::iterator,bool> res = cache.insert(name);
|
std::pair<std::set<std::string>::iterator,bool> res = cache.insert(name);
|
||||||
if (res.second == false) {
|
if (res.second == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
#include "lib.h"
|
#include "lib.h"
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
int dirat_for_each(int dirfd, const char *name, void *data,
|
int dirat_for_each(int dirfd, const char *name, void *data,
|
||||||
int (* cb)(int, const char *, struct stat *, void *))
|
int (* cb)(int, const char *, struct stat *, void *))
|
||||||
{
|
{
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "chfa.h"
|
#include "chfa.h"
|
||||||
#include "../immunix.h"
|
#include "../immunix.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
aare_rules::~aare_rules(void)
|
aare_rules::~aare_rules(void)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
class UniquePermsCache {
|
class UniquePermsCache {
|
||||||
public:
|
public:
|
||||||
typedef map<UniquePerm, Node*> UniquePermMap;
|
typedef std::map<UniquePerm, Node*> UniquePermMap;
|
||||||
typedef UniquePermMap::iterator iterator;
|
typedef UniquePermMap::iterator iterator;
|
||||||
UniquePermMap nodes;
|
UniquePermMap nodes;
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ public:
|
|||||||
node = new ExactMatchFlag(priority, perms, audit);
|
node = new ExactMatchFlag(priority, perms, audit);
|
||||||
else
|
else
|
||||||
node = new MatchFlag(priority, perms, audit);
|
node = new MatchFlag(priority, perms, audit);
|
||||||
pair<iterator, bool> val = nodes.insert(make_pair(tmp, node));
|
std::pair<iterator, bool> val = nodes.insert(std::make_pair(tmp, node));
|
||||||
if (val.second == false) {
|
if (val.second == false) {
|
||||||
delete node;
|
delete node;
|
||||||
return val.first->second;
|
return val.first->second;
|
||||||
@ -121,17 +121,17 @@ class aare_rules {
|
|||||||
optflags const &opts, bool oob);
|
optflags const &opts, bool oob);
|
||||||
bool append_rule(const char *rule, bool oob, bool with_perm, optflags const &opts);
|
bool append_rule(const char *rule, bool oob, bool with_perm, optflags const &opts);
|
||||||
CHFA *create_chfa(int *min_match_len,
|
CHFA *create_chfa(int *min_match_len,
|
||||||
vector <aa_perms> &perms_table,
|
std::vector <aa_perms> &perms_table,
|
||||||
optflags const &opts, bool filedfa,
|
optflags const &opts, bool filedfa,
|
||||||
bool extended_perms, bool prompt);
|
bool extended_perms, bool prompt);
|
||||||
void *create_dfablob(size_t *size, int *min_match_len,
|
void *create_dfablob(size_t *size, int *min_match_len,
|
||||||
vector <aa_perms> &perms_table,
|
std::vector <aa_perms> &perms_table,
|
||||||
optflags const &opts,
|
optflags const &opts,
|
||||||
bool filedfa, bool extended_perms, bool prompt);
|
bool filedfa, bool extended_perms, bool prompt);
|
||||||
void *create_welded_dfablob(aare_rules *file_rules,
|
void *create_welded_dfablob(aare_rules *file_rules,
|
||||||
size_t *size, int *min_match_len,
|
size_t *size, int *min_match_len,
|
||||||
size_t *new_start,
|
size_t *new_start,
|
||||||
vector <aa_perms> &perms_table,
|
std::vector <aa_perms> &perms_table,
|
||||||
optflags const &opts,
|
optflags const &opts,
|
||||||
bool extended_perms, bool prompt);
|
bool extended_perms, bool prompt);
|
||||||
};
|
};
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
#include "../policydb.h"
|
#include "../policydb.h"
|
||||||
#include "flex-tables.h"
|
#include "flex-tables.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
void CHFA::init_free_list(vector<pair<size_t, size_t> > &free_list,
|
void CHFA::init_free_list(vector<pair<size_t, size_t> > &free_list,
|
||||||
size_t prev, size_t start)
|
size_t prev, size_t start)
|
||||||
{
|
{
|
||||||
|
@ -32,39 +32,37 @@
|
|||||||
#define MATCH_FLAG_OOB_TRANSITION 0x20000000
|
#define MATCH_FLAG_OOB_TRANSITION 0x20000000
|
||||||
#define base_mask_size(X) ((X) & ~BASE32_FLAGS)
|
#define base_mask_size(X) ((X) & ~BASE32_FLAGS)
|
||||||
|
|
||||||
using namespace std;
|
typedef std::vector<std::pair<const State *, size_t> > DefaultBase;
|
||||||
|
typedef std::vector<std::pair<const State *, const State *> > NextCheck;
|
||||||
typedef vector<pair<const State *, size_t> > DefaultBase;
|
|
||||||
typedef vector<pair<const State *, const State *> > NextCheck;
|
|
||||||
|
|
||||||
class CHFA {
|
class CHFA {
|
||||||
public:
|
public:
|
||||||
CHFA(void);
|
CHFA(void);
|
||||||
CHFA(DFA &dfa, map<transchar, transchar> &eq, optflags const &opts,
|
CHFA(DFA &dfa, std::map<transchar, transchar> &eq, optflags const &opts,
|
||||||
bool permindex, bool prompt);
|
bool permindex, bool prompt);
|
||||||
void dump(ostream & os);
|
void dump(ostream & os);
|
||||||
void flex_table(ostream &os, optflags const &opts);
|
void flex_table(ostream &os, optflags const &opts);
|
||||||
void init_free_list(vector<pair<size_t, size_t> > &free_list,
|
void init_free_list(std::vector<std::pair<size_t, size_t> > &free_list,
|
||||||
size_t prev, size_t start);
|
size_t prev, size_t start);
|
||||||
bool fits_in(vector<pair<size_t, size_t> > &free_list, size_t base,
|
bool fits_in(std::vector<std::pair<size_t, size_t> > &free_list, size_t base,
|
||||||
StateTrans &cases);
|
StateTrans &cases);
|
||||||
void insert_state(vector<pair<size_t, size_t> > &free_list,
|
void insert_state(std::vector<std::pair<size_t, size_t> > &free_list,
|
||||||
State *state, DFA &dfa);
|
State *state, DFA &dfa);
|
||||||
void weld_file_to_policy(CHFA &file_chfa, size_t &new_start,
|
void weld_file_to_policy(CHFA &file_chfa, size_t &new_start,
|
||||||
bool accept_idx, bool prompt,
|
bool accept_idx, bool prompt,
|
||||||
vector <aa_perms> &policy_perms,
|
std::vector <aa_perms> &policy_perms,
|
||||||
vector <aa_perms> &file_perms);
|
std::vector <aa_perms> &file_perms);
|
||||||
|
|
||||||
// private:
|
// private:
|
||||||
// sigh templates suck, friend declaration does not work so for now
|
// sigh templates suck, friend declaration does not work so for now
|
||||||
// make these public
|
// make these public
|
||||||
vector<uint32_t> accept;
|
std::vector<uint32_t> accept;
|
||||||
vector<uint32_t> accept2;
|
std::vector<uint32_t> accept2;
|
||||||
DefaultBase default_base;
|
DefaultBase default_base;
|
||||||
NextCheck next_check;
|
NextCheck next_check;
|
||||||
const State *start;
|
const State *start;
|
||||||
Renumber_Map num;
|
Renumber_Map num;
|
||||||
map<transchar, transchar> eq;
|
std::map<transchar, transchar> eq;
|
||||||
unsigned int chfaflags;
|
unsigned int chfaflags;
|
||||||
private:
|
private:
|
||||||
transchar max_eq;
|
transchar max_eq;
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
#include "expr-tree.h"
|
#include "expr-tree.h"
|
||||||
#include "apparmor_re.h"
|
#include "apparmor_re.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
/* Use a single static EpsNode as it carries no node specific information */
|
/* Use a single static EpsNode as it carries no node specific information */
|
||||||
EpsNode epsnode;
|
EpsNode epsnode;
|
||||||
|
|
||||||
|
@ -44,8 +44,6 @@
|
|||||||
#include "../perms.h"
|
#include "../perms.h"
|
||||||
#include "apparmor_re.h"
|
#include "apparmor_re.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* transchar - representative input character for state transitions
|
* transchar - representative input character for state transitions
|
||||||
*
|
*
|
||||||
@ -146,9 +144,9 @@ public:
|
|||||||
|
|
||||||
class Chars {
|
class Chars {
|
||||||
public:
|
public:
|
||||||
set<transchar> chars;
|
std::set<transchar> chars;
|
||||||
|
|
||||||
typedef set<transchar>::iterator iterator;
|
typedef std::set<transchar>::iterator iterator;
|
||||||
iterator begin() { return chars.begin(); }
|
iterator begin() { return chars.begin(); }
|
||||||
iterator end() { return chars.end(); }
|
iterator end() { return chars.end(); }
|
||||||
|
|
||||||
@ -166,11 +164,11 @@ public:
|
|||||||
{
|
{
|
||||||
return chars.find(key);
|
return chars.find(key);
|
||||||
}
|
}
|
||||||
pair<iterator,bool> insert(transchar c)
|
std::pair<iterator,bool> insert(transchar c)
|
||||||
{
|
{
|
||||||
return chars.insert(c);
|
return chars.insert(c);
|
||||||
}
|
}
|
||||||
pair<iterator,bool> insert(char c)
|
std::pair<iterator,bool> insert(char c)
|
||||||
{
|
{
|
||||||
transchar tmp(c);
|
transchar tmp(c);
|
||||||
return chars.insert(tmp);
|
return chars.insert(tmp);
|
||||||
@ -181,9 +179,9 @@ public:
|
|||||||
ostream &operator<<(ostream &os, transchar c);
|
ostream &operator<<(ostream &os, transchar c);
|
||||||
|
|
||||||
/* Compute the union of two sets. */
|
/* Compute the union of two sets. */
|
||||||
template<class T> set<T> operator+(const set<T> &a, const set<T> &b)
|
template<class T> std::set<T> operator+(const std::set<T> &a, const std::set<T> &b)
|
||||||
{
|
{
|
||||||
set<T> c(a);
|
std::set<T> c(a);
|
||||||
c.insert(b.begin(), b.end());
|
c.insert(b.begin(), b.end());
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@ -196,7 +194,7 @@ template<class T> set<T> operator+(const set<T> &a, const set<T> &b)
|
|||||||
*/
|
*/
|
||||||
class Node;
|
class Node;
|
||||||
class ImportantNode;
|
class ImportantNode;
|
||||||
typedef set<ImportantNode *> NodeSet;
|
typedef std::set<ImportantNode *> NodeSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text-dump a state (for debugging).
|
* Text-dump a state (for debugging).
|
||||||
@ -212,12 +210,12 @@ ostream &operator<<(ostream &os, const NodeSet &state);
|
|||||||
* enumerating all the explicit tranitions for default matches.
|
* enumerating all the explicit tranitions for default matches.
|
||||||
*/
|
*/
|
||||||
typedef struct Cases {
|
typedef struct Cases {
|
||||||
typedef map<transchar, NodeSet *>::iterator iterator;
|
typedef std::map<transchar, NodeSet *>::iterator iterator;
|
||||||
iterator begin() { return cases.begin(); }
|
iterator begin() { return cases.begin(); }
|
||||||
iterator end() { return cases.end(); }
|
iterator end() { return cases.end(); }
|
||||||
|
|
||||||
Cases(): otherwise(0) { }
|
Cases(): otherwise(0) { }
|
||||||
map<transchar, NodeSet *> cases;
|
std::map<transchar, NodeSet *> cases;
|
||||||
NodeSet *otherwise;
|
NodeSet *otherwise;
|
||||||
} Cases;
|
} Cases;
|
||||||
|
|
||||||
@ -891,7 +889,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) { return os << "< 0x" << std::hex << perms << std::dec << '>'; }
|
||||||
|
|
||||||
int priority;
|
int priority;
|
||||||
perm32_t perms;
|
perm32_t perms;
|
||||||
@ -925,7 +923,7 @@ public:
|
|||||||
|
|
||||||
/* Traverse the syntax tree depth-first in an iterator-like manner. */
|
/* Traverse the syntax tree depth-first in an iterator-like manner. */
|
||||||
class depth_first_traversal {
|
class depth_first_traversal {
|
||||||
stack<Node *>pos;
|
std::stack<Node *>pos;
|
||||||
void push_left(Node *node) {
|
void push_left(Node *node) {
|
||||||
pos.push(node);
|
pos.push(node);
|
||||||
|
|
||||||
@ -1050,7 +1048,7 @@ struct deref_less_than {
|
|||||||
|
|
||||||
class NodeVecCache: public CacheStats {
|
class NodeVecCache: public CacheStats {
|
||||||
public:
|
public:
|
||||||
set<NodeVec *, deref_less_than> cache;
|
std::set<NodeVec *, deref_less_than> cache;
|
||||||
|
|
||||||
NodeVecCache(void): cache() { };
|
NodeVecCache(void): cache() { };
|
||||||
~NodeVecCache() { clear(); };
|
~NodeVecCache() { clear(); };
|
||||||
@ -1059,7 +1057,7 @@ public:
|
|||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
for (set<NodeVec *>::iterator i = cache.begin();
|
for (std::set<NodeVec *>::iterator i = cache.begin();
|
||||||
i != cache.end(); i++) {
|
i != cache.end(); i++) {
|
||||||
delete *i;
|
delete *i;
|
||||||
}
|
}
|
||||||
@ -1071,7 +1069,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (!nodes)
|
if (!nodes)
|
||||||
return NULL;
|
return NULL;
|
||||||
pair<set<NodeVec *>::iterator,bool> uniq;
|
std::pair<std::set<NodeVec *>::iterator,bool> uniq;
|
||||||
NodeVec *nv = new NodeVec(nodes);
|
NodeVec *nv = new NodeVec(nodes);
|
||||||
uniq = cache.insert(nv);
|
uniq = cache.insert(nv);
|
||||||
if (uniq.second == false) {
|
if (uniq.second == false) {
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
#include "../immunix.h"
|
#include "../immunix.h"
|
||||||
#include "../perms.h"
|
#include "../perms.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
ostream &operator<<(ostream &os, const CacheStats &cache)
|
ostream &operator<<(ostream &os, const CacheStats &cache)
|
||||||
{
|
{
|
||||||
/* dump the state label */
|
/* dump the state label */
|
||||||
|
@ -42,8 +42,8 @@ extern int prompt_compat_mode;
|
|||||||
|
|
||||||
class State;
|
class State;
|
||||||
|
|
||||||
typedef map<transchar, State *> StateTrans;
|
typedef std::map<transchar, State *> StateTrans;
|
||||||
typedef list<State *> Partition;
|
typedef std::list<State *> Partition;
|
||||||
|
|
||||||
#include "../immunix.h"
|
#include "../immunix.h"
|
||||||
|
|
||||||
@ -62,9 +62,9 @@ public:
|
|||||||
}
|
}
|
||||||
ostream &dump(ostream &os)
|
ostream &dump(ostream &os)
|
||||||
{
|
{
|
||||||
os << "(0x " << hex
|
os << "(0x " << std::hex
|
||||||
<< allow << "/" << deny << "/" << "/" << prompt << "/" << audit << "/" << quiet
|
<< allow << "/" << deny << "/" << "/" << prompt << "/" << audit << "/" << quiet
|
||||||
<< ')' << dec;
|
<< ')' << std::dec;
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,11 +317,11 @@ public:
|
|||||||
class NodeMap: public CacheStats
|
class NodeMap: public CacheStats
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef map<ProtoState, State *>::iterator iterator;
|
typedef std::map<ProtoState, State *>::iterator iterator;
|
||||||
iterator begin() { return cache.begin(); }
|
iterator begin() { return cache.begin(); }
|
||||||
iterator end() { return cache.end(); }
|
iterator end() { return cache.end(); }
|
||||||
|
|
||||||
map<ProtoState, State *> cache;
|
std::map<ProtoState, State *> cache;
|
||||||
|
|
||||||
NodeMap(void): cache() { };
|
NodeMap(void): cache() { };
|
||||||
~NodeMap() { clear(); };
|
~NodeMap() { clear(); };
|
||||||
@ -334,10 +334,10 @@ public:
|
|||||||
CacheStats::clear();
|
CacheStats::clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
pair<iterator,bool> insert(ProtoState &proto, State *state)
|
std::pair<iterator,bool> insert(ProtoState &proto, State *state)
|
||||||
{
|
{
|
||||||
pair<iterator,bool> uniq;
|
std::pair<iterator,bool> uniq;
|
||||||
uniq = cache.insert(make_pair(proto, state));
|
uniq = cache.insert(std::make_pair(proto, state));
|
||||||
if (uniq.second == false) {
|
if (uniq.second == false) {
|
||||||
dup++;
|
dup++;
|
||||||
} else {
|
} else {
|
||||||
@ -349,7 +349,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef map<const State *, size_t> Renumber_Map;
|
typedef std::map<const State *, size_t> Renumber_Map;
|
||||||
|
|
||||||
/* Transitions in the DFA. */
|
/* Transitions in the DFA. */
|
||||||
class DFA {
|
class DFA {
|
||||||
@ -360,7 +360,7 @@ class DFA {
|
|||||||
NodeSet *nnodes, State *other);
|
NodeSet *nnodes, State *other);
|
||||||
void update_state_transitions(optflags const &opts, State *state);
|
void update_state_transitions(optflags const &opts, State *state);
|
||||||
void process_work_queue(const char *header, optflags const &);
|
void process_work_queue(const char *header, optflags const &);
|
||||||
void dump_diff_chain(ostream &os, map<State *, Partition> &relmap,
|
void dump_diff_chain(ostream &os, std::map<State *, Partition> &relmap,
|
||||||
Partition &chain, State *state,
|
Partition &chain, State *state,
|
||||||
unsigned int &count, unsigned int &total,
|
unsigned int &count, unsigned int &total,
|
||||||
unsigned int &max);
|
unsigned int &max);
|
||||||
@ -369,7 +369,7 @@ class DFA {
|
|||||||
NodeVecCache anodes_cache;
|
NodeVecCache anodes_cache;
|
||||||
NodeVecCache nnodes_cache;
|
NodeVecCache nnodes_cache;
|
||||||
NodeMap node_map;
|
NodeMap node_map;
|
||||||
list<State *> work_queue;
|
std::list<State *> work_queue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DFA(Node *root, optflags const &flags, bool filedfa);
|
DFA(Node *root, optflags const &flags, bool filedfa);
|
||||||
@ -394,14 +394,14 @@ public:
|
|||||||
void dump_uniq_perms(const char *s);
|
void dump_uniq_perms(const char *s);
|
||||||
ostream &dump_partition(ostream &os, Partition &p);
|
ostream &dump_partition(ostream &os, Partition &p);
|
||||||
ostream &dump_partitions(ostream &os, const char *description,
|
ostream &dump_partitions(ostream &os, const char *description,
|
||||||
list<Partition *> &partitions);
|
std::list<Partition *> &partitions);
|
||||||
map<transchar, transchar> equivalence_classes(optflags const &flags);
|
std::map<transchar, transchar> equivalence_classes(optflags const &flags);
|
||||||
void apply_equivalence_classes(map<transchar, transchar> &eq);
|
void apply_equivalence_classes(std::map<transchar, transchar> &eq);
|
||||||
|
|
||||||
void compute_perms_table_ent(State *state, size_t pos,
|
void compute_perms_table_ent(State *state, size_t pos,
|
||||||
vector <aa_perms> &perms_table,
|
std::vector <aa_perms> &perms_table,
|
||||||
bool prompt);
|
bool prompt);
|
||||||
void compute_perms_table(vector <aa_perms> &perms_table,
|
void compute_perms_table(std::vector <aa_perms> &perms_table,
|
||||||
bool prompt);
|
bool prompt);
|
||||||
|
|
||||||
unsigned int diffcount;
|
unsigned int diffcount;
|
||||||
@ -415,6 +415,6 @@ public:
|
|||||||
bool filedfa;
|
bool filedfa;
|
||||||
};
|
};
|
||||||
|
|
||||||
void dump_equivalence_classes(ostream &os, map<transchar, transchar> &eq);
|
void dump_equivalence_classes(ostream &os, std::map<transchar, transchar> &eq);
|
||||||
|
|
||||||
#endif /* __LIBAA_RE_HFA_H */
|
#endif /* __LIBAA_RE_HFA_H */
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
/* #define DEBUG_TREE */
|
/* #define DEBUG_TREE */
|
||||||
#include "expr-tree.h"
|
#include "expr-tree.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%union {
|
%union {
|
||||||
|
@ -228,6 +228,8 @@
|
|||||||
#include "profile.h"
|
#include "profile.h"
|
||||||
#include "mount.h"
|
#include "mount.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
struct mnt_keyword_table {
|
struct mnt_keyword_table {
|
||||||
const char *keyword;
|
const char *keyword;
|
||||||
unsigned int set;
|
unsigned int set;
|
||||||
|
@ -41,8 +41,6 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#define SD_CODE_SIZE (sizeof(u8))
|
#define SD_CODE_SIZE (sizeof(u8))
|
||||||
#define SD_STR_LEN (sizeof(u16))
|
#define SD_STR_LEN (sizeof(u16))
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
int __sd_serialize_profile(int option, aa_kernel_interface *kernel_interface,
|
int __sd_serialize_profile(int option, aa_kernel_interface *kernel_interface,
|
||||||
Profile *prof, int cache_fd);
|
Profile *prof, int cache_fd);
|
||||||
|
@ -46,6 +46,8 @@
|
|||||||
#include "policy_cache.h"
|
#include "policy_cache.h"
|
||||||
#include "file_cache.h"
|
#include "file_cache.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
#ifdef PDEBUG
|
#ifdef PDEBUG
|
||||||
#undef PDEBUG
|
#undef PDEBUG
|
||||||
#endif
|
#endif
|
||||||
|
@ -66,6 +66,8 @@ void *reallocarray(void *ptr, size_t nmemb, size_t size)
|
|||||||
#define NULL nullptr
|
#define NULL nullptr
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
int is_blacklisted(const char *name, const char *path)
|
int is_blacklisted(const char *name, const char *path)
|
||||||
{
|
{
|
||||||
int retval = _aa_is_blacklisted(name);
|
int retval = _aa_is_blacklisted(name);
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#define NPDEBUG(fmt, args...) /* Do nothing */
|
#define NPDEBUG(fmt, args...) /* Do nothing */
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
ProfileList policy_list;
|
ProfileList policy_list;
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
#define CIDR_32 htonl(0xffffffff)
|
#define CIDR_32 htonl(0xffffffff)
|
||||||
#define CIDR_24 htonl(0xffffff00)
|
#define CIDR_24 htonl(0xffffff00)
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
const char *profile_mode_table[] = {
|
const char *profile_mode_table[] = {
|
||||||
"",
|
"",
|
||||||
"enforce",
|
"enforce",
|
||||||
|
@ -42,16 +42,16 @@ struct deref_profileptr_lt {
|
|||||||
|
|
||||||
class ProfileList {
|
class ProfileList {
|
||||||
public:
|
public:
|
||||||
set<Profile *, deref_profileptr_lt> list;
|
std::set<Profile *, deref_profileptr_lt> list;
|
||||||
|
|
||||||
typedef set<Profile *, deref_profileptr_lt>::iterator iterator;
|
typedef std::set<Profile *, deref_profileptr_lt>::iterator iterator;
|
||||||
iterator begin() { return list.begin(); }
|
iterator begin() { return list.begin(); }
|
||||||
iterator end() { return list.end(); }
|
iterator end() { return list.end(); }
|
||||||
|
|
||||||
ProfileList() { };
|
ProfileList() { };
|
||||||
virtual ~ProfileList() { clear(); }
|
virtual ~ProfileList() { clear(); }
|
||||||
virtual bool empty(void) { return list.empty(); }
|
virtual bool empty(void) { return list.empty(); }
|
||||||
virtual pair<ProfileList::iterator,bool> insert(Profile *);
|
virtual std::pair<ProfileList::iterator,bool> insert(Profile *);
|
||||||
virtual void erase(ProfileList::iterator pos);
|
virtual void erase(ProfileList::iterator pos);
|
||||||
void clear(void);
|
void clear(void);
|
||||||
void dump(void);
|
void dump(void);
|
||||||
@ -368,7 +368,7 @@ struct dfa_stuff {
|
|||||||
void *dfa;
|
void *dfa;
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t file_start; /* special start in welded dfa */
|
size_t file_start; /* special start in welded dfa */
|
||||||
vector <aa_perms> perms_table;
|
std::vector <aa_perms> perms_table;
|
||||||
dfa_stuff(void): rules(NULL), dfa(NULL), size(0) { }
|
dfa_stuff(void): rules(NULL), dfa(NULL), size(0) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ public:
|
|||||||
void *xmatch;
|
void *xmatch;
|
||||||
size_t xmatch_size;
|
size_t xmatch_size;
|
||||||
int xmatch_len;
|
int xmatch_len;
|
||||||
vector <aa_perms> xmatch_perms_table;
|
std::vector <aa_perms> xmatch_perms_table;
|
||||||
struct cond_entry_list xattrs;
|
struct cond_entry_list xattrs;
|
||||||
|
|
||||||
/* char *sub_name; */ /* subdomain name or NULL */
|
/* char *sub_name; */ /* subdomain name or NULL */
|
||||||
@ -477,7 +477,7 @@ public:
|
|||||||
debug_cod_entries(entries);
|
debug_cod_entries(entries);
|
||||||
|
|
||||||
for (RuleList::iterator i = rule_ents.begin(); i != rule_ents.end(); i++) {
|
for (RuleList::iterator i = rule_ents.begin(); i != rule_ents.end(); i++) {
|
||||||
(*i)->dump(cout);
|
(*i)->dump(std::cout);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -511,7 +511,7 @@ public:
|
|||||||
|
|
||||||
void dump_name(bool fqp)
|
void dump_name(bool fqp)
|
||||||
{
|
{
|
||||||
cout << get_name(fqp);;
|
std::cout << get_name(fqp);;
|
||||||
}
|
}
|
||||||
|
|
||||||
void post_parse_profile(void);
|
void post_parse_profile(void);
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
#include "perms.h"
|
#include "perms.h"
|
||||||
#include "policydb.h"
|
#include "policydb.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#define PROMPT_COMPAT_UNKNOWN 0
|
#define PROMPT_COMPAT_UNKNOWN 0
|
||||||
#define PROMPT_COMPAT_IGNORE 1
|
#define PROMPT_COMPAT_IGNORE 1
|
||||||
#define PROMPT_COMPAT_PERMSV2 2
|
#define PROMPT_COMPAT_PERMSV2 2
|
||||||
@ -436,9 +434,9 @@ public:
|
|||||||
class_rule_t::dump(os);
|
class_rule_t::dump(os);
|
||||||
|
|
||||||
if (saved)
|
if (saved)
|
||||||
os << "(0x" << hex << perms << "/orig " << saved << ") ";
|
os << "(0x" << std::hex << perms << "/orig " << saved << ") ";
|
||||||
else
|
else
|
||||||
os << "(0x" << hex << perms << ") ";
|
os << "(0x" << std::hex << perms << ") ";
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
@ -464,7 +462,7 @@ public:
|
|||||||
virtual ostream &dump(ostream &os) {
|
virtual ostream &dump(ostream &os) {
|
||||||
class_rule_t::dump(os);
|
class_rule_t::dump(os);
|
||||||
|
|
||||||
os << "(0x" << hex << perms << ") ";
|
os << "(0x" << std::hex << perms << ") ";
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#include "parser_yacc.h"
|
#include "parser_yacc.h"
|
||||||
#include "signal.h"
|
#include "signal.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
#define MAXMAPPED_SIG 35
|
#define MAXMAPPED_SIG 35
|
||||||
#define MINRT_SIG 128 /* base of RT sigs */
|
#define MINRT_SIG 128 /* base of RT sigs */
|
||||||
#define MAXRT_SIG 32 /* Max RT above MINRT_SIG */
|
#define MAXRT_SIG 32 /* Max RT above MINRT_SIG */
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#define AA_VALID_SIGNAL_PERMS (AA_MAY_SEND | AA_MAY_RECEIVE)
|
#define AA_VALID_SIGNAL_PERMS (AA_MAY_SEND | AA_MAY_RECEIVE)
|
||||||
|
|
||||||
|
|
||||||
typedef set<int> Signals;
|
typedef std::set<int> Signals;
|
||||||
|
|
||||||
int find_signal_mapping(const char *sig);
|
int find_signal_mapping(const char *sig);
|
||||||
int parse_signal_perms(const char *str_perms, perm32_t *perms, int fail);
|
int parse_signal_perms(const char *str_perms, perm32_t *perms, int fail);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user