2024-05-05 13:57:15 +01:00
|
|
|
// apparmor.d - Full set of apparmor profiles
|
|
|
|
// Copyright (C) 2021-2024 Alexandre Pujol <alexandre@pujol.io>
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
|
|
|
|
package aa
|
|
|
|
|
|
|
|
const (
|
2024-05-28 18:22:14 +01:00
|
|
|
ALL Kind = "all"
|
2024-05-05 13:57:15 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type All struct {
|
2024-06-25 19:50:27 +01:00
|
|
|
Base
|
2024-05-05 13:57:15 +01:00
|
|
|
}
|
|
|
|
|
2024-06-19 23:22:49 +01:00
|
|
|
func newAll(q Qualifier, rule rule) (Rule, error) {
|
2024-06-25 19:50:27 +01:00
|
|
|
return &All{Base: newBase(rule)}, nil
|
2024-06-19 23:22:49 +01:00
|
|
|
}
|
|
|
|
|
2024-06-25 19:56:36 +01:00
|
|
|
func (r *All) Kind() Kind {
|
|
|
|
return ALL
|
|
|
|
}
|
|
|
|
|
2024-06-27 18:45:32 +01:00
|
|
|
func (r *All) Constraint() Constraint {
|
|
|
|
return BlockRule
|
2024-06-25 19:56:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *All) String() string {
|
|
|
|
return renderTemplate(r.Kind(), r)
|
|
|
|
}
|
|
|
|
|
2024-05-25 22:36:39 +01:00
|
|
|
func (r *All) Validate() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2024-06-19 18:34:58 +01:00
|
|
|
func (r *All) Compare(other Rule) int {
|
|
|
|
return 0
|
2024-05-05 13:57:15 +01:00
|
|
|
}
|
|
|
|
|
2024-06-22 20:59:43 +01:00
|
|
|
func (r *All) Merge(other Rule) bool {
|
|
|
|
o, _ := other.(*All)
|
2024-06-25 19:50:27 +01:00
|
|
|
b := &r.Base
|
2024-06-29 22:27:39 +01:00
|
|
|
return b.merge(o.Base) // Always merge all rules
|
2024-06-22 20:59:43 +01:00
|
|
|
}
|
2024-06-29 22:27:39 +01:00
|
|
|
|
|
|
|
func (r *All) Lengths() []int {
|
|
|
|
return []int{} // No len for all
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *All) setPaddings(max []int) {} // No paddings for all
|