fix: ensure filter directive get cleaned on build.

This commit is contained in:
Alexandre Pujol 2024-06-14 20:50:17 +01:00
parent 327c1dec33
commit 117e63d88f
No known key found for this signature in database
GPG Key ID: C5469996F0DF68EC
2 changed files with 2 additions and 1 deletions

View File

@ -11,3 +11,4 @@
@{lib}/security-misc/pam_faillock_not_if_x rPx,
@{lib}/security-misc/pam-abort-on-locked-password rPx,
@{lib}/security-misc/pam-info rPx,

View File

@ -65,7 +65,7 @@ func NewOption(file *paths.Path, match []string) *Option {
// Useful to remove directive text applied on some condition only
func (o *Option) Clean(profile string) string {
reg := regexp.MustCompile(`\s*` + Keyword + o.Name + ` .*$`)
return reg.ReplaceAllString(profile, "")
return strings.Replace(profile, o.Raw, reg.ReplaceAllString(o.Raw, ""), 1)
}
func RegisterDirective(d Directive) {