refractor(aa): newRuleFromLog -> newBaseFromLog
This commit is contained in:
parent
afc0a7cd3b
commit
cdab2588aa
15 changed files with 18 additions and 18 deletions
|
|
@ -49,7 +49,7 @@ func newRule(rule []string) RuleBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func newRuleFromLog(log map[string]string) RuleBase {
|
func newBaseFromLog(log map[string]string) RuleBase {
|
||||||
comment := ""
|
comment := ""
|
||||||
fileInherit, noNewPrivs, optional := false, false, false
|
fileInherit, noNewPrivs, optional := false, false, false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ type Capability struct {
|
||||||
|
|
||||||
func newCapabilityFromLog(log map[string]string) Rule {
|
func newCapabilityFromLog(log map[string]string) Rule {
|
||||||
return &Capability{
|
return &Capability{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
Names: Must(toValues(CAPABILITY, "name", log["capname"])),
|
Names: Must(toValues(CAPABILITY, "name", log["capname"])),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ type ChangeProfile struct {
|
||||||
|
|
||||||
func newChangeProfileFromLog(log map[string]string) Rule {
|
func newChangeProfileFromLog(log map[string]string) Rule {
|
||||||
return &ChangeProfile{
|
return &ChangeProfile{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
ExecMode: log["mode"],
|
ExecMode: log["mode"],
|
||||||
Exec: log["exec"],
|
Exec: log["exec"],
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ func newDbusFromLog(log map[string]string) Rule {
|
||||||
peerName = log["name"]
|
peerName = log["name"]
|
||||||
}
|
}
|
||||||
return &Dbus{
|
return &Dbus{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
Access: []string{log["mask"]},
|
Access: []string{log["mask"]},
|
||||||
Bus: log["bus"],
|
Bus: log["bus"],
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ func newFileFromLog(log map[string]string) Rule {
|
||||||
return newLinkFromLog(log)
|
return newLinkFromLog(log)
|
||||||
}
|
}
|
||||||
return &File{
|
return &File{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
Owner: isOwner(log),
|
Owner: isOwner(log),
|
||||||
Path: log["name"],
|
Path: log["name"],
|
||||||
|
|
@ -114,7 +114,7 @@ type Link struct {
|
||||||
|
|
||||||
func newLinkFromLog(log map[string]string) Rule {
|
func newLinkFromLog(log map[string]string) Rule {
|
||||||
return &Link{
|
return &Link{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
Owner: isOwner(log),
|
Owner: isOwner(log),
|
||||||
Path: log["name"],
|
Path: log["name"],
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ type IOUring struct {
|
||||||
|
|
||||||
func newIOUringFromLog(log map[string]string) Rule {
|
func newIOUringFromLog(log map[string]string) Rule {
|
||||||
return &IOUring{
|
return &IOUring{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
Access: Must(toAccess(IOURING, log["requested"])),
|
Access: Must(toAccess(IOURING, log["requested"])),
|
||||||
Label: log["label"],
|
Label: log["label"],
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ type Mount struct {
|
||||||
|
|
||||||
func newMountFromLog(log map[string]string) Rule {
|
func newMountFromLog(log map[string]string) Rule {
|
||||||
return &Mount{
|
return &Mount{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
MountConditions: newMountConditionsFromLog(log),
|
MountConditions: newMountConditionsFromLog(log),
|
||||||
Source: log["srcname"],
|
Source: log["srcname"],
|
||||||
|
|
@ -114,7 +114,7 @@ type Umount struct {
|
||||||
|
|
||||||
func newUmountFromLog(log map[string]string) Rule {
|
func newUmountFromLog(log map[string]string) Rule {
|
||||||
return &Umount{
|
return &Umount{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
MountConditions: newMountConditionsFromLog(log),
|
MountConditions: newMountConditionsFromLog(log),
|
||||||
MountPoint: log["name"],
|
MountPoint: log["name"],
|
||||||
|
|
@ -160,7 +160,7 @@ type Remount struct {
|
||||||
|
|
||||||
func newRemountFromLog(log map[string]string) Rule {
|
func newRemountFromLog(log map[string]string) Rule {
|
||||||
return &Remount{
|
return &Remount{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
MountConditions: newMountConditionsFromLog(log),
|
MountConditions: newMountConditionsFromLog(log),
|
||||||
MountPoint: log["name"],
|
MountPoint: log["name"],
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ func newMqueueFromLog(log map[string]string) Rule {
|
||||||
mqueueType = "sysv"
|
mqueueType = "sysv"
|
||||||
}
|
}
|
||||||
return &Mqueue{
|
return &Mqueue{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
Access: Must(toAccess(MQUEUE, log["requested"])),
|
Access: Must(toAccess(MQUEUE, log["requested"])),
|
||||||
Type: mqueueType,
|
Type: mqueueType,
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ type Network struct {
|
||||||
|
|
||||||
func newNetworkFromLog(log map[string]string) Rule {
|
func newNetworkFromLog(log map[string]string) Rule {
|
||||||
return &Network{
|
return &Network{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
AddressExpr: newAddressExprFromLog(log),
|
AddressExpr: newAddressExprFromLog(log),
|
||||||
Domain: log["family"],
|
Domain: log["family"],
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ type PivotRoot struct {
|
||||||
|
|
||||||
func newPivotRootFromLog(log map[string]string) Rule {
|
func newPivotRootFromLog(log map[string]string) Rule {
|
||||||
return &PivotRoot{
|
return &PivotRoot{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
OldRoot: log["srcname"],
|
OldRoot: log["srcname"],
|
||||||
NewRoot: log["name"],
|
NewRoot: log["name"],
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ type Ptrace struct {
|
||||||
|
|
||||||
func newPtraceFromLog(log map[string]string) Rule {
|
func newPtraceFromLog(log map[string]string) Rule {
|
||||||
return &Ptrace{
|
return &Ptrace{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
Access: Must(toAccess(PTRACE, log["requested_mask"])),
|
Access: Must(toAccess(PTRACE, log["requested_mask"])),
|
||||||
Peer: log["peer"],
|
Peer: log["peer"],
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ type Rlimit struct {
|
||||||
|
|
||||||
func newRlimitFromLog(log map[string]string) Rule {
|
func newRlimitFromLog(log map[string]string) Rule {
|
||||||
return &Rlimit{
|
return &Rlimit{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Key: log["key"],
|
Key: log["key"],
|
||||||
Op: log["op"],
|
Op: log["op"],
|
||||||
Value: log["value"],
|
Value: log["value"],
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ type Signal struct {
|
||||||
|
|
||||||
func newSignalFromLog(log map[string]string) Rule {
|
func newSignalFromLog(log map[string]string) Rule {
|
||||||
return &Signal{
|
return &Signal{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
Access: Must(toAccess(SIGNAL, log["requested_mask"])),
|
Access: Must(toAccess(SIGNAL, log["requested_mask"])),
|
||||||
Set: []string{log["signal"]},
|
Set: []string{log["signal"]},
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ type Unix struct {
|
||||||
|
|
||||||
func newUnixFromLog(log map[string]string) Rule {
|
func newUnixFromLog(log map[string]string) Rule {
|
||||||
return &Unix{
|
return &Unix{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
Access: Must(toAccess(UNIX, log["requested_mask"])),
|
Access: Must(toAccess(UNIX, log["requested_mask"])),
|
||||||
Type: log["sock_type"],
|
Type: log["sock_type"],
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ type Userns struct {
|
||||||
|
|
||||||
func newUsernsFromLog(log map[string]string) Rule {
|
func newUsernsFromLog(log map[string]string) Rule {
|
||||||
return &Userns{
|
return &Userns{
|
||||||
RuleBase: newRuleFromLog(log),
|
RuleBase: newBaseFromLog(log),
|
||||||
Qualifier: newQualifierFromLog(log),
|
Qualifier: newQualifierFromLog(log),
|
||||||
Create: true,
|
Create: true,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue