feat(aa): be more verbose on rule.Merge
This commit is contained in:
parent
880f0ef37e
commit
7c006dee0a
11 changed files with 69 additions and 29 deletions
|
|
@ -79,10 +79,6 @@ func newBaseFromLog(log map[string]string) Base {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r Base) Merge(other Rule) bool {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *Base) merge(other Base) bool {
|
func (r *Base) merge(other Base) bool {
|
||||||
if other.Comment != "" {
|
if other.Comment != "" {
|
||||||
r.Comment += " " + other.Comment
|
r.Comment += " " + other.Comment
|
||||||
|
|
|
||||||
|
|
@ -35,3 +35,7 @@ func (r *Hat) Compare(other Rule) int {
|
||||||
o, _ := other.(*Hat)
|
o, _ := other.(*Hat)
|
||||||
return compare(r.Name, o.Name)
|
return compare(r.Name, o.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Hat) Merge(other Rule) bool {
|
||||||
|
return false // Never merge hat blocks
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,3 +77,7 @@ func (r *Capability) Compare(other Rule) int {
|
||||||
}
|
}
|
||||||
return r.Qualifier.Compare(o.Qualifier)
|
return r.Qualifier.Compare(o.Qualifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Capability) Merge(other Rule) bool {
|
||||||
|
return false // Never merge capabilities
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,3 +99,7 @@ func (r *ChangeProfile) Compare(other Rule) int {
|
||||||
}
|
}
|
||||||
return r.Qualifier.Compare(o.Qualifier)
|
return r.Qualifier.Compare(o.Qualifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *ChangeProfile) Merge(other Rule) bool {
|
||||||
|
return false // Never merge change_profile
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -242,3 +242,7 @@ func (r *Link) Compare(other Rule) int {
|
||||||
}
|
}
|
||||||
return r.Qualifier.Compare(o.Qualifier)
|
return r.Qualifier.Compare(o.Qualifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Link) Merge(other Rule) bool {
|
||||||
|
return false // Never merge link
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,3 +140,7 @@ func (r *Network) Compare(other Rule) int {
|
||||||
}
|
}
|
||||||
return r.Qualifier.Compare(o.Qualifier)
|
return r.Qualifier.Compare(o.Qualifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Network) Merge(other Rule) bool {
|
||||||
|
return false // Never merge network
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,3 +79,7 @@ func (r *PivotRoot) Compare(other Rule) int {
|
||||||
}
|
}
|
||||||
return r.Qualifier.Compare(o.Qualifier)
|
return r.Qualifier.Compare(o.Qualifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *PivotRoot) Merge(other Rule) bool {
|
||||||
|
return false // Never merge pivot root
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,10 @@ func (r *Comment) Compare(other Rule) int {
|
||||||
return 0 // Comments are always equal to each other as they are not compared
|
return 0 // Comments are always equal to each other as they are not compared
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Comment) Merge(other Rule) bool {
|
||||||
|
return false // Never merge comments
|
||||||
|
}
|
||||||
|
|
||||||
type Abi struct {
|
type Abi struct {
|
||||||
Base
|
Base
|
||||||
Path string
|
Path string
|
||||||
|
|
@ -101,6 +105,10 @@ func (r *Abi) Compare(other Rule) int {
|
||||||
return compare(r.IsMagic, o.IsMagic)
|
return compare(r.IsMagic, o.IsMagic)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Abi) Merge(other Rule) bool {
|
||||||
|
return false // Never merge abi
|
||||||
|
}
|
||||||
|
|
||||||
type Alias struct {
|
type Alias struct {
|
||||||
Base
|
Base
|
||||||
Path string
|
Path string
|
||||||
|
|
@ -145,6 +153,10 @@ func (r *Alias) Compare(other Rule) int {
|
||||||
return compare(r.RewrittenPath, o.RewrittenPath)
|
return compare(r.RewrittenPath, o.RewrittenPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Alias) Merge(other Rule) bool {
|
||||||
|
return false // Never merge alias
|
||||||
|
}
|
||||||
|
|
||||||
type Include struct {
|
type Include struct {
|
||||||
Base
|
Base
|
||||||
IfExists bool
|
IfExists bool
|
||||||
|
|
@ -218,6 +230,10 @@ func (r *Include) Compare(other Rule) int {
|
||||||
return compare(r.IfExists, o.IfExists)
|
return compare(r.IfExists, o.IfExists)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Include) Merge(other Rule) bool {
|
||||||
|
return false // Never merge include
|
||||||
|
}
|
||||||
|
|
||||||
type Variable struct {
|
type Variable struct {
|
||||||
Base
|
Base
|
||||||
Name string
|
Name string
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,17 @@ func (r *Ptrace) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Ptrace) Compare(other Rule) int {
|
||||||
|
o, _ := other.(*Ptrace)
|
||||||
|
if res := compare(r.Access, o.Access); res != 0 {
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
if res := compare(r.Peer, o.Peer); res != 0 {
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
return r.Qualifier.Compare(o.Qualifier)
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Ptrace) Merge(other Rule) bool {
|
func (r *Ptrace) Merge(other Rule) bool {
|
||||||
o, _ := other.(*Ptrace)
|
o, _ := other.(*Ptrace)
|
||||||
|
|
||||||
|
|
@ -79,14 +90,3 @@ func (r *Ptrace) Merge(other Rule) bool {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Ptrace) Compare(other Rule) int {
|
|
||||||
o, _ := other.(*Ptrace)
|
|
||||||
if res := compare(r.Access, o.Access); res != 0 {
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
if res := compare(r.Peer, o.Peer); res != 0 {
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
return r.Qualifier.Compare(o.Qualifier)
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -80,3 +80,7 @@ func (r *Rlimit) Compare(other Rule) int {
|
||||||
}
|
}
|
||||||
return compare(r.Value, o.Value)
|
return compare(r.Value, o.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Rlimit) Merge(other Rule) bool {
|
||||||
|
return false // Never merge rlimit
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,20 @@ func (r *Signal) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Signal) Compare(other Rule) int {
|
||||||
|
o, _ := other.(*Signal)
|
||||||
|
if res := compare(r.Access, o.Access); res != 0 {
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
if res := compare(r.Set, o.Set); res != 0 {
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
if res := compare(r.Peer, o.Peer); res != 0 {
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
return r.Qualifier.Compare(o.Qualifier)
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Signal) Merge(other Rule) bool {
|
func (r *Signal) Merge(other Rule) bool {
|
||||||
o, _ := other.(*Signal)
|
o, _ := other.(*Signal)
|
||||||
|
|
||||||
|
|
@ -107,17 +121,3 @@ func (r *Signal) Merge(other Rule) bool {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Signal) Compare(other Rule) int {
|
|
||||||
o, _ := other.(*Signal)
|
|
||||||
if res := compare(r.Access, o.Access); res != 0 {
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
if res := compare(r.Set, o.Set); res != 0 {
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
if res := compare(r.Peer, o.Peer); res != 0 {
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
return r.Qualifier.Compare(o.Qualifier)
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue