[apparmor] [patch] [parser] fix cache location for .features file
Tyler Hicks
tyhicks at canonical.com
Sat Sep 28 00:44:57 UTC 2013
On 2013-09-23 13:46:01, John Johansen wrote:
> 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.
>
> Signed-off-by: John Johansen <john.johansen at canonical.com>
>
> ---
>
> === modified file 'parser/parser_main.c'
> --- parser/parser_main.c 2013-07-29 16:52:18 +0000
> +++ parser/parser_main.c 2013-09-23 20:28:42 +0000
> @@ -1300,6 +1300,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();
> @@ -1326,7 +1327,11 @@
> * - If cache/.features exists, and does not match flags_string,
> * 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");
> exit(1);
> }
I noticed that basedir is still used later in this function for clearing
the cache files. But I took a sneak peek at your next patch and it looks
like it addresses this issue.
Acked-by: Tyler Hicks <tyhicks at canonical.com>
Tyler
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20130927/98791c4b/attachment.pgp>
More information about the AppArmor
mailing list