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

parser: cleanup: drop unused add_local_entry and associated vars

The code for add_local_entry is actually currently unused and will
have to change anyways by the time it is. Some drop it and the
associated variables.

Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen
2023-02-22 17:19:12 -08:00
parent 68421547a1
commit e6e3f44ff9
2 changed files with 5 additions and 41 deletions

View File

@@ -70,7 +70,6 @@ mnt_rule *do_mnt_rule(struct cond_entry *src_conds, char *src,
mnt_rule *do_pivot_rule(struct cond_entry *old, char *root,
char *transition);
static void abi_features(char *filename, bool search);
void add_local_entry(Profile *prof);
bool add_prefix(struct cod_entry *entry, const prefixes &p, const char *&error);
bool check_x_qualifier(struct cod_entry *entry, const char *&errror);
@@ -438,7 +437,6 @@ local_profile: TOK_PROFILE profile_base
if ($2)
PDEBUG("Matched: local profile %s { ... }\n", prof->name);
prof->local = 1;
$$ = prof;
};
@@ -849,7 +847,6 @@ rules: rules local_profile
if (!$2)
yyerror(_("Assert: 'local_profile rule' returned NULL."));
add_hat_to_policy($1, $2);
add_local_entry($2);
$$ = $1;
};
@@ -1695,31 +1692,6 @@ struct cod_entry *do_file_rule(char *id, perms_t perms, char *link_id, char *nt)
return entry;
}
/* Note: NOT currently in use, used for
* /foo x -> { /bah, } style transitions
*/
void add_local_entry(Profile *prof)
{
/* ugh this has to be called after the hat is attached to its parent */
if (prof->local_perms) {
struct cod_entry *entry;
char *trans = (char *) malloc(strlen(prof->parent->name) +
strlen(prof->name) + 3);
char *name = strdup(prof->name);
if (!trans)
yyerror(_("Memory allocation error."));
sprintf(name, "%s//%s", prof->parent->name, prof->name);
entry = new_entry(name, prof->local_perms, NULL);
entry->audit = prof->local_audit;
entry->nt_name = trans;
if (!entry)
yyerror(_("Memory allocation error."));
add_entry_to_policy(prof, entry);
}
}
static const char *mnt_cond_msg[] = {"",
" not allowed as source conditional",
" not allowed as target conditional",

View File

@@ -189,9 +189,7 @@ public:
/* char *sub_name; */ /* subdomain name or NULL */
/* int default_deny; */ /* TRUE or FALSE */
int local;
perms_t local_perms;
audit_t local_audit;
bool local;
Profile *parent;
@@ -221,10 +219,6 @@ public:
xattrs.list = NULL;
xattrs.name = NULL;
local_perms = 0;
local = 0;
local_audit = AUDIT_UNSPECIFIED;
parent = NULL;
flags = { 0, MODE_UNSPECIFIED, 0, 0 };
@@ -267,12 +261,10 @@ public:
else
printf("Name:\t\t<NULL>\n");
if (local) {
if (parent)
printf("Local To:\t%s\n", parent->name);
else
printf("Local To:\t<NULL>\n");
}
if (parent)
printf("Local To:\t%s\n", parent->name);
else
printf("Local To:\t<NULL>\n");
flags.dump(cerr);
caps.dump();