2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 14:25:52 +00:00

The apparmor parser applies the disabled and complain mode directories even when just

dumping the preprocessor output to stdout.

Add a flag to test whether to skip forcing the mode and use it with -p (dump preprocessed
profile).
This commit is contained in:
John Johansen
2010-07-10 17:46:06 -07:00
parent a30ecbfe3c
commit da6df9fdc5
2 changed files with 13 additions and 9 deletions

View File

@@ -81,6 +81,7 @@ int read_implies_exec = 1;
int read_implies_exec = 0;
#endif
int preprocess_only = 0;
int skip_mode_force = 0;
char *subdomainbase = NULL;
char *match_string = NULL;
@@ -465,6 +466,7 @@ static int process_args(int argc, char *argv[])
kernel_load = 0;
skip_cache = 1;
preprocess_only = 1;
skip_mode_force = 1;
break;
default:
display_usage(progname);
@@ -737,18 +739,20 @@ void reset_parser(char *filename)
int test_for_dir_mode(const char *basename, const char *linkdir)
{
char *target = NULL;
int rc = 0;
if (asprintf(&target, "%s/%s/%s", basedir, linkdir, basename) < 0) {
perror("asprintf");
exit(1);
}
if (!skip_mode_force) {
char *target = NULL;
if (asprintf(&target, "%s/%s/%s", basedir, linkdir, basename) < 0) {
perror("asprintf");
exit(1);
}
if (access(target, R_OK) == 0) {
rc = 1;
if (access(target, R_OK) == 0)
rc = 1;
free(target);
}
free(target);
return rc;
}

View File

@@ -538,7 +538,7 @@ static int process_profile_name_xmatch(struct codomain *cod)
cod->xmatch = aare_create_dfa(rule, &cod->xmatch_size,
dfaflags);
aare_delete_ruleset(rule);
if (!cod->xmatch)
if (!cod->xmatch)
return FALSE;
}