2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

parser: Enable cache overlay in the parser

Allow the parser to use cache overlays by extending the --cache-loc
flag to support multiple locations via a comma separated list.

eg.
  --cache-loc=/var/cache/apparmor/,/etc/apparmor.d/cache.d/

The overlayed cache directories are searched in the order
specified. So in the above example /var/cache/apparmor is searched
before /etc/apparmor.d/

Time stamps are ignored in the search, the first match found wins
regardless if there exists a matching cache file with a newer timestamp
in a directory is later in the search.

Cache writes will only occur to the first dir in the list. So
/var/cache/apparmor/ in the above example.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
This commit is contained in:
John Johansen
2018-03-09 01:54:15 -08:00
parent 9e48a5da5e
commit 481f59a39b
3 changed files with 124 additions and 30 deletions

View File

@@ -392,11 +392,7 @@ int aa_policy_cache_new(aa_policy_cache **policy_cache,
return -1;
}
if (max_caches > 1) {
errno = ENOTSUP;
return -1;
}
/* TODO: currently no reaping of caches in excess of max_caches */
pc = calloc(1, sizeof(*pc));
if (!pc) {
errno = ENOMEM;