2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-01 23:05:11 +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; int read_implies_exec = 0;
#endif #endif
int preprocess_only = 0; int preprocess_only = 0;
int skip_mode_force = 0;
char *subdomainbase = NULL; char *subdomainbase = NULL;
char *match_string = NULL; char *match_string = NULL;
@@ -465,6 +466,7 @@ static int process_args(int argc, char *argv[])
kernel_load = 0; kernel_load = 0;
skip_cache = 1; skip_cache = 1;
preprocess_only = 1; preprocess_only = 1;
skip_mode_force = 1;
break; break;
default: default:
display_usage(progname); display_usage(progname);
@@ -737,18 +739,20 @@ void reset_parser(char *filename)
int test_for_dir_mode(const char *basename, const char *linkdir) int test_for_dir_mode(const char *basename, const char *linkdir)
{ {
char *target = NULL;
int rc = 0; int rc = 0;
if (!skip_mode_force) {
char *target = NULL;
if (asprintf(&target, "%s/%s/%s", basedir, linkdir, basename) < 0) { if (asprintf(&target, "%s/%s/%s", basedir, linkdir, basename) < 0) {
perror("asprintf"); perror("asprintf");
exit(1); exit(1);
} }
if (access(target, R_OK) == 0) { if (access(target, R_OK) == 0)
rc = 1; rc = 1;
}
free(target); free(target);
}
return rc; return rc;
} }