Description: 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 <[email protected]> Acked-by: Tyler Hicks <[email protected]> Origin: commit, revision id: [email protected] Author: John Johansen <[email protected]> Last-Update: 2013-09-29 X-Bzr-Revision-Id: [email protected]
Refreshed by Seth Arnold <[email protected]> --- parser/parser_main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) Index: b/parser/parser_main.c =================================================================== --- a/parser/parser_main.c +++ b/parser/parser_main.c @@ -1209,6 +1209,7 @@ { char *cache_features_path = NULL; char *cache_flags = NULL; + int rc; /* Get the match string to determine type of regex support needed */ get_match_string(); @@ -1230,12 +1231,16 @@ /* - * Deal with cache directory versioning: - * - If cache/.features is missing, create it if --write-cache. - * - If cache/.features exists, and does not match flags_string, - * force cache reading/writing off. - */ - if (asprintf(&cache_features_path, "%s/.features", cacheloc) == -1) { + * Deal with cache directory versioning: + * - If cache/.features is missing, create it if --write-cache. + * - If cache/.features exists, and does not match flags_string, + * force cache reading/writing off. + */ + if (cacheloc) + rc = asprintf(&cache_features_path, "%s/.features", cacheloc); + else + rc = asprintf(&cache_features_path, "%s/cache/.features", basedir); + if (rc == -1) { PERROR(_("Memory allocation error.")); exit(1); } -- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
