mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2024-11-14 23:43:56 +01:00
feat(aa): sort local include at the end of a profile.
This commit is contained in:
parent
bd4e9bb135
commit
26d05f1869
@ -128,6 +128,12 @@ func (p *AppArmorProfile) Sort() {
|
||||
if typeOfI != typeOfJ {
|
||||
valueOfI := typeToValue(typeOfI)
|
||||
valueOfJ := typeToValue(typeOfJ)
|
||||
if typeOfI == reflect.TypeOf((*Include)(nil)) && p.Rules[i].(*Include).IfExists {
|
||||
valueOfI = "include_if_exists"
|
||||
}
|
||||
if typeOfJ == reflect.TypeOf((*Include)(nil)) && p.Rules[j].(*Include).IfExists {
|
||||
valueOfJ = "include_if_exists"
|
||||
}
|
||||
return ruleWeights[valueOfI] < ruleWeights[valueOfJ]
|
||||
}
|
||||
return p.Rules[i].Less(p.Rules[j])
|
||||
|
@ -78,7 +78,7 @@ var (
|
||||
"iouring",
|
||||
"dbus",
|
||||
"file",
|
||||
"include_local",
|
||||
"include_if_exists",
|
||||
}
|
||||
ruleWeights = map[string]int{}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user