2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-29 13:28:19 +00:00

The feature file is not being written to the proper location if the parameter

--cache-loc= is specified. This results in using the .features file from
/etc/apparmor.d/cache or always recompiling policy.

The former case is particularly bad as the .features file in
/etc/apparmor.d/cache/ may not correspond to the file in the specified
cache location.

bug: launchpad.net/bugs/1229393

Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen 2013-09-23 14:56:16 -07:00
parent 204a96ed58
commit 01bdac1444

View File

@ -1300,6 +1300,7 @@ static void setup_flags(void)
{ {
char *cache_features_path = NULL; char *cache_features_path = NULL;
char *cache_flags = NULL; char *cache_flags = NULL;
int rc;
/* Get the match string to determine type of regex support needed */ /* Get the match string to determine type of regex support needed */
get_match_string(); get_match_string();
@ -1326,7 +1327,11 @@ static void setup_flags(void)
* - If cache/.features exists, and does not match flags_string, * - If cache/.features exists, and does not match flags_string,
* force cache reading/writing off. * force cache reading/writing off.
*/ */
if (asprintf(&cache_features_path, "%s/cache/.features", basedir) == -1) { if (cacheloc)
rc = asprintf(&cache_features_path, "%s/.features", cacheloc);
else
rc = asprintf(&cache_features_path, "%s/cache/.features", basedir);
if (rc == -1) {
perror("asprintf"); perror("asprintf");
exit(1); exit(1);
} }