[apparmor] [patch] Store filename for includes and hats

Kshitij Gupta kgupta8592 at gmail.com
Sun Oct 18 18:37:33 UTC 2015


Hello,

On Sat, Oct 17, 2015 at 1:45 AM, Christian Boltz <apparmor at cboltz.de> wrote:

> Hello,
>
> $subject ;-)
>
> This also means the duplicate detection can use the hat's filename instead
> of the (possibly wrong) main profile's filename.
>
>
> [ 92-store-filename-for-includes-and-hats.diff ]
>
> --- utils/apparmor/aa.py        2015-10-11 20:35:28.502666115 +0200
> +++ utils/apparmor/aa.py        2015-10-16 22:10:06.456103610 +0200
> @@ -2527,8 +2527,7 @@
>              for hat in profile_data[p].keys():
>                  if profiles[p].get(hat, False):
>                      raise AppArmorException(_("Conflicting profiles for
> %s defined in two files:\n- %s\n- %s") %
> -                            # 'filename' is not set for hats, therefore
> print the filename of the main profile
> -                            (combine_name(p, hat),
> profiles[p][p]['filename'], profile_data[p][p]['filename']))
> +                            (combine_name(p, hat),
> profiles[p][hat]['filename'], profile_data[p][hat]['filename']))
>
>          profiles[p] = deepcopy(profile_data[p])
>
> @@ -2581,6 +2580,7 @@
>          profile = file
>          hat = file
>          profile_data[profile][hat] = profile_storage()
> +        profile_data[profile][hat]['filename'] = file
>
>      for lineno, line in enumerate(data):
>          line = line.strip()
> @@ -3004,6 +3004,7 @@
>              # nevertheless, just to be sure, don't overwrite existing
> profile_data.
>              if not profile_data[profile].get(hat, False):
>                  profile_data[profile][hat] = profile_storage()
> +                profile_data[profile][hat]['filename'] = file
>
We probably don't need to do the file name setting here since the above is
just to be on the safer side.

But I can live with it being there.

Thanks for the patch.

Acked-by: Kshitij Gupta <kgupta8592 at gmail.com>.


>              flags = matches.group('flags')
>
>
>
> Regards,
>
> Christian Boltz
> --
> "Kann mir jemand seine Erfahrungen mit dem Gigaset Router schildern.
> Ich möchte mit dem Gerät meine Kaffemaschine Mitropa 3000+ (SW-Stand
> 47.11 / HW-Rev.: 08/15) mit Ethernet-Interface fernbedienen, ist das
> Gerät geeignet und wie muß ich vorgehen?" [Eric Scheen in suse-linux]
>
>
> --
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/apparmor
>



-- 
Regards,

Kshitij Gupta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20151019/9c639817/attachment.html>


More information about the AppArmor mailing list