system: wrap console output functions
This eliminates all fmsg imports from internal/system. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"slices"
|
||||
|
||||
"git.gensokyo.uk/security/fortify/acl"
|
||||
"git.gensokyo.uk/security/fortify/internal/fmsg"
|
||||
)
|
||||
|
||||
// UpdatePerm appends an ephemeral acl update Op.
|
||||
@@ -31,23 +30,21 @@ type ACL struct {
|
||||
perms acl.Perms
|
||||
}
|
||||
|
||||
func (a *ACL) Type() Enablement {
|
||||
return a.et
|
||||
}
|
||||
func (a *ACL) Type() Enablement { return a.et }
|
||||
|
||||
func (a *ACL) apply(sys *I) error {
|
||||
fmsg.Verbose("applying ACL", a)
|
||||
return fmsg.WrapErrorSuffix(acl.UpdatePerm(a.path, sys.uid, a.perms...),
|
||||
sys.println("applying ACL", a)
|
||||
return sys.wrapErrSuffix(acl.UpdatePerm(a.path, sys.uid, a.perms...),
|
||||
fmt.Sprintf("cannot apply ACL entry to %q:", a.path))
|
||||
}
|
||||
|
||||
func (a *ACL) revert(sys *I, ec *Criteria) error {
|
||||
if ec.hasType(a) {
|
||||
fmsg.Verbose("stripping ACL", a)
|
||||
return fmsg.WrapErrorSuffix(acl.UpdatePerm(a.path, sys.uid),
|
||||
sys.println("stripping ACL", a)
|
||||
return sys.wrapErrSuffix(acl.UpdatePerm(a.path, sys.uid),
|
||||
fmt.Sprintf("cannot strip ACL entry from %q:", a.path))
|
||||
} else {
|
||||
fmsg.Verbose("skipping ACL", a)
|
||||
sys.println("skipping ACL", a)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -60,9 +57,7 @@ func (a *ACL) Is(o Op) bool {
|
||||
slices.Equal(a.perms, a0.perms)
|
||||
}
|
||||
|
||||
func (a *ACL) Path() string {
|
||||
return a.path
|
||||
}
|
||||
func (a *ACL) Path() string { return a.path }
|
||||
|
||||
func (a *ACL) String() string {
|
||||
return fmt.Sprintf("%s type: %s path: %q",
|
||||
|
||||
Reference in New Issue
Block a user