diff --git a/pkg/aa/change_profile.go b/pkg/aa/change_profile.go index 7ba53d0d..f0966bc5 100644 --- a/pkg/aa/change_profile.go +++ b/pkg/aa/change_profile.go @@ -51,7 +51,7 @@ func (r *ChangeProfile) Equals(other any) bool { } func (r *ChangeProfile) String() string { - return renderTemplate(tokCHANGEPROFILE, r) + return renderTemplate(r.Kind(), r) } func (r *ChangeProfile) Constraint() constraint { diff --git a/pkg/aa/file.go b/pkg/aa/file.go index 1f2190fd..12d8b96b 100644 --- a/pkg/aa/file.go +++ b/pkg/aa/file.go @@ -27,6 +27,16 @@ func init() { } } +func isOwner(log map[string]string) bool { + fsuid, hasFsUID := log["fsuid"] + ouid, hasOuUID := log["ouid"] + isDbus := strings.Contains(log["operation"], "dbus") + if hasFsUID && hasOuUID && fsuid == ouid && ouid != "0" && !isDbus { + return true + } + return false +} + // cmpFileAccess compares two access strings for file rules. // It is aimed to be used in slices.SortFunc. func cmpFileAccess(i, j string) int { @@ -164,13 +174,3 @@ func (r *Link) Constraint() constraint { func (r *Link) Kind() string { return tokLINK } - -func isOwner(log map[string]string) bool { - fsuid, hasFsUID := log["fsuid"] - ouid, hasOuUID := log["ouid"] - isDbus := strings.Contains(log["operation"], "dbus") - if hasFsUID && hasOuUID && fsuid == ouid && ouid != "0" && !isDbus { - return true - } - return false -} diff --git a/pkg/aa/preamble.go b/pkg/aa/preamble.go index 2197612f..539e719c 100644 --- a/pkg/aa/preamble.go +++ b/pkg/aa/preamble.go @@ -65,7 +65,7 @@ func (r *Abi) Equals(other any) bool { } func (r *Abi) String() string { - return renderTemplate(tokABI, r) + return renderTemplate(r.Kind(), r) } func (r *Abi) Constraint() constraint { @@ -96,7 +96,7 @@ func (r Alias) Equals(other any) bool { } func (r *Alias) String() string { - return renderTemplate(tokALIAS, r) + return renderTemplate(r.Kind(), r) } func (r *Alias) Constraint() constraint { @@ -131,7 +131,7 @@ func (r *Include) Equals(other any) bool { } func (r *Include) String() string { - return renderTemplate(tokINCLUDE, r) + return renderTemplate(r.Kind(), r) } func (r *Include) Constraint() constraint {