feat(aa-log): minor improvment in rule generation & formatting.
This commit is contained in:
parent
fbdf9cea64
commit
83bc7d3ade
7 changed files with 97 additions and 34 deletions
|
|
@ -495,9 +495,15 @@ func (r rule) String() string {
|
|||
}
|
||||
|
||||
func isAARE(str string) bool {
|
||||
return strings.HasPrefix(str, "@") ||
|
||||
strings.HasPrefix(str, "/") ||
|
||||
strings.HasPrefix(str, "\"")
|
||||
if len(str) < 1 {
|
||||
return false
|
||||
}
|
||||
switch str[0] {
|
||||
case '@', '/', '"':
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Convert a slice of internal rules to a slice of ApparmorRule.
|
||||
|
|
@ -652,8 +658,8 @@ done:
|
|||
}
|
||||
|
||||
// Parse apparmor profile rules by paragraphs
|
||||
func ParseRules(input string) ([]Rules, []string, error) {
|
||||
paragraphRules := []Rules{}
|
||||
func ParseRules(input string) (ParaRules, []string, error) {
|
||||
paragraphRules := ParaRules{}
|
||||
paragraphs := []string{}
|
||||
|
||||
for _, match := range regParagraph.FindAllStringSubmatch(input, -1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue