mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2024-11-14 23:43:56 +01:00
fix(aa): ineffective assignment
This commit is contained in:
parent
ff5ff965cd
commit
228d3b653c
@ -26,7 +26,8 @@ func (r *All) Compare(other Rule) int {
|
||||
|
||||
func (r *All) Merge(other Rule) bool {
|
||||
o, _ := other.(*All)
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
b := &r.RuleBase
|
||||
return b.merge(o.RuleBase)
|
||||
}
|
||||
|
||||
func (r *All) String() string {
|
||||
|
@ -83,8 +83,10 @@ func (r RuleBase) Merge(other Rule) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (r RuleBase) merge(other RuleBase) bool {
|
||||
r.Comment += " " + other.Comment
|
||||
func (r *RuleBase) merge(other RuleBase) bool {
|
||||
if other.Comment != "" {
|
||||
r.Comment += " " + other.Comment
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,8 @@ func (r *Dbus) Merge(other Rule) bool {
|
||||
r.Interface == o.Interface && r.Member == o.Member &&
|
||||
r.PeerName == o.PeerName && r.PeerLabel == o.PeerLabel {
|
||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
b := &r.RuleBase
|
||||
return b.merge(o.RuleBase)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -138,7 +138,8 @@ func (r *File) Merge(other Rule) bool {
|
||||
}
|
||||
if r.Owner == o.Owner && r.Path == o.Path && r.Target == o.Target {
|
||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
b := &r.RuleBase
|
||||
return b.merge(o.RuleBase)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -71,7 +71,8 @@ func (r *IOUring) Merge(other Rule) bool {
|
||||
}
|
||||
if r.Label == o.Label {
|
||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
b := &r.RuleBase
|
||||
return b.merge(o.RuleBase)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ func (m MountConditions) Compare(other MountConditions) int {
|
||||
return compare(m.Options, other.Options)
|
||||
}
|
||||
|
||||
func (m MountConditions) Merge(other MountConditions) bool {
|
||||
func (m *MountConditions) Merge(other MountConditions) bool {
|
||||
if m.FsType == other.FsType {
|
||||
m.Options = merge(MOUNT, "flags", m.Options, other.Options)
|
||||
return true
|
||||
@ -143,13 +143,15 @@ func (r *Mount) Compare(other Rule) int {
|
||||
|
||||
func (r *Mount) Merge(other Rule) bool {
|
||||
o, _ := other.(*Mount)
|
||||
mc := &r.MountConditions
|
||||
|
||||
if !r.Qualifier.Equal(o.Qualifier) {
|
||||
return false
|
||||
}
|
||||
if r.Source == o.Source && r.MountPoint == o.MountPoint &&
|
||||
r.MountConditions.Merge(o.MountConditions) {
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
mc.Merge(o.MountConditions) {
|
||||
b := &r.RuleBase
|
||||
return b.merge(o.RuleBase)
|
||||
}
|
||||
return false
|
||||
}
|
||||
@ -220,12 +222,14 @@ func (r *Umount) Compare(other Rule) int {
|
||||
|
||||
func (r *Umount) Merge(other Rule) bool {
|
||||
o, _ := other.(*Umount)
|
||||
mc := &r.MountConditions
|
||||
|
||||
if !r.Qualifier.Equal(o.Qualifier) {
|
||||
return false
|
||||
}
|
||||
if r.MountPoint == o.MountPoint && r.MountConditions.Merge(o.MountConditions) {
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
if r.MountPoint == o.MountPoint && mc.Merge(o.MountConditions) {
|
||||
b := &r.RuleBase
|
||||
return b.merge(o.RuleBase)
|
||||
}
|
||||
return false
|
||||
}
|
||||
@ -297,12 +301,14 @@ func (r *Remount) Compare(other Rule) int {
|
||||
|
||||
func (r *Remount) Merge(other Rule) bool {
|
||||
o, _ := other.(*Remount)
|
||||
mc := &r.MountConditions
|
||||
|
||||
if !r.Qualifier.Equal(o.Qualifier) {
|
||||
return false
|
||||
}
|
||||
if r.MountPoint == o.MountPoint && r.MountConditions.Merge(o.MountConditions) {
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
if r.MountPoint == o.MountPoint && mc.Merge(o.MountConditions) {
|
||||
b := &r.RuleBase
|
||||
return b.merge(o.RuleBase)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -105,7 +105,8 @@ func (r *Mqueue) Merge(other Rule) bool {
|
||||
}
|
||||
if r.Type == o.Type && r.Label == o.Label && r.Name == o.Name {
|
||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
b := &r.RuleBase
|
||||
return b.merge(o.RuleBase)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -261,7 +261,8 @@ func (r *Variable) Merge(other Rule) bool {
|
||||
|
||||
if r.Name == o.Name && r.Define == o.Define {
|
||||
r.Values = merge(r.Kind(), "access", r.Values, o.Values)
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
b := &r.RuleBase
|
||||
return b.merge(o.RuleBase)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -62,7 +62,8 @@ func (r *Ptrace) Merge(other Rule) bool {
|
||||
}
|
||||
if r.Peer == o.Peer {
|
||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
b := &r.RuleBase
|
||||
return b.merge(o.RuleBase)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -86,10 +86,12 @@ func (r *Signal) Merge(other Rule) bool {
|
||||
switch {
|
||||
case r.Peer == o.Peer && compare(r.Set, o.Set) == 0:
|
||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
b := &r.RuleBase
|
||||
return b.merge(o.RuleBase)
|
||||
case r.Peer == o.Peer && compare(r.Access, o.Access) == 0:
|
||||
r.Set = merge(r.Kind(), "set", r.Set, o.Set)
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
b := &r.RuleBase
|
||||
return b.merge(o.RuleBase)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -119,7 +119,8 @@ func (r *Unix) Merge(other Rule) bool {
|
||||
r.Label == o.Label && r.Attr == o.Attr && r.Opt == o.Opt &&
|
||||
r.PeerLabel == o.PeerLabel && r.PeerAddr == o.PeerAddr {
|
||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
b := &r.RuleBase
|
||||
return b.merge(o.RuleBase)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -56,7 +56,8 @@ func (r *Userns) Compare(other Rule) int {
|
||||
|
||||
func (r *Userns) Merge(other Rule) bool {
|
||||
o, _ := other.(*Userns)
|
||||
return r.RuleBase.merge(o.RuleBase)
|
||||
b := &r.RuleBase
|
||||
return b.merge(o.RuleBase)
|
||||
}
|
||||
|
||||
func (r *Userns) String() string {
|
||||
|
Loading…
Reference in New Issue
Block a user