2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-05 08:45:22 +00:00

Convert the parser to C++

This conversion is nothing more than what is required to get it to
compile. Further improvements will come as the code is refactored.

Unfortunately due to C++ not supporting designated initializers, the auto
generation of af names needed to be reworked, and "netlink" and "unix"
domain socket keywords leaked in. Since these where going to be added in
separate patches I have not bothered to do the extra work to replace them
with a temporary place holder.

Signed-off-by: John Johansen <john.johansen@canonical.com>
[tyhicks: merged with dbus changes and memory leak fixes]
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
This commit is contained in:
John Johansen
2013-09-27 16:13:22 -07:00
committed by Tyler Hicks
parent b0a1488820
commit a34059b1e5
22 changed files with 293 additions and 276 deletions

View File

@@ -22,12 +22,18 @@
#ifndef __AA_PARSER_H
#define __AA_PARSER_H
#include <string.h>
#include <netinet/in.h>
#include <sys/resource.h>
#include "immunix.h"
#include "libapparmor_re/apparmor_re.h"
#include "libapparmor_re/aare_rules.h"
using namespace std;
#include <set>
struct mnt_ent;
/* Global variable to pass token to lexer. Will be replaced by parameter
@@ -52,7 +58,7 @@ struct flagval {
struct named_transition {
int present;
char *namespace;
char *ns;
char *name;
};
@@ -75,7 +81,7 @@ struct cond_entry {
};
struct cod_entry {
char *namespace;
char *ns;
char *name;
char *link_name;
char *nt_name;
@@ -115,7 +121,7 @@ struct alt_name {
};
struct codomain {
char *namespace;
char *ns;
char *name; /* codomain name */
char *attachment;
struct alt_name *altnames;
@@ -287,7 +293,7 @@ extern dfaflags_t dfaflags;
extern char *progname;
extern char *subdomainbase;
extern char *profilename;
extern char *profile_namespace;
extern char *profile_ns;
extern char *current_filename;
extern FILE *ofile;
extern int read_implies_exec;
@@ -342,8 +348,7 @@ extern int get_rlimit(const char *name);
extern char *process_var(const char *var);
extern int parse_mode(const char *mode);
extern int parse_dbus_mode(const char *str_mode, int *mode, int fail);
extern struct cod_entry *new_entry(char *namespace, char *id, int mode,
char *link_id);
extern struct cod_entry *new_entry(char *ns, char *id, int mode, char *link_id);
extern struct aa_network_entry *new_network_ent(unsigned int family,
unsigned int type,
unsigned int protocol);