Skip to content

Fix aa-cleanprof to work with named profiles

Christian Boltz requested to merge cboltz/apparmor:cboltz-cleanprof into master

This needed replacement of "program" with "profile" at various places in (of course this description is over-simplified).

The changes in get_next_to_profile() (which is used by several aa-* minitools) are restricted to cleanprof to avoid side effects in the other aa-* minitools.

However, the other aa-* minitools possibly also suffer from problems with named profiles, but checking and fixing that is left for another commit ;-)

Fixes: #351 (closed)


The fix needs an additional function in ProfileList (profile_from_attachment()) to get the profile name for a given attachment.

Since this is not very different from filename_from_attachment(), move most of the code into a thing_from_attachment() function, and make {profile,filename}_from_attachment wrappers for it.

Also adjust the tests to the changed internal data structure, and add tests for profile_from_attachment().

I propose this patch for 3.0..master. (3.0 will probably need a slightly different patch - I'll submit a separate MR once this MR is merged.)

Merge request reports