// apparmor.d - Full set of apparmor profiles // Copyright (C) 2021-2024 Alexandre Pujol // SPDX-License-Identifier: GPL-2.0-only package aa import ( "maps" "slices" "strings" ) // Profile represents a single AppArmor profile. type Profile struct { RuleBase Header Rules Rules } // Header represents the header of a profile. type Header struct { Name string Attachments []string Attributes map[string]string Flags []string } func (p *Profile) Less(other any) bool { o, _ := other.(*Profile) if p.Name != o.Name { return p.Name < o.Name } return len(p.Attachments) < len(o.Attachments) } func (p *Profile) Equals(other any) bool { o, _ := other.(*Profile) return p.Name == o.Name && slices.Equal(p.Attachments, o.Attachments) && maps.Equal(p.Attributes, o.Attributes) && slices.Equal(p.Flags, o.Flags) }