1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-06-12 19:15:31 +00:00

[PR #12137/5d62edc6 backport][stable-13] pamd: handle non-PAM lines in authselect profile files (#12145)

pamd: handle non-PAM lines in authselect profile files (#12137)

* fix(pamd): handle non-PAM lines in authselect profile files



* test(pamd): add test for authselect directive lines



* feat(changelog): add fragment for PR 12137



---------


(cherry picked from commit 5d62edc673)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
patchback[bot] 2026-05-31 00:05:03 +02:00 committed by GitHub
parent 3b5eb565fb
commit 9821ff20c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 1 deletions

View file

@ -348,6 +348,8 @@ class PamdRule(PamdLine):
@classmethod
def rule_from_string(cls, line):
rule_match = RULE_REGEX.search(line)
if rule_match is None:
return None
rule_args = parse_module_arguments(rule_match.group("args"))
return cls(rule_match.group("rule_type"), rule_match.group("control"), rule_match.group("path"), rule_args)
@ -432,7 +434,7 @@ class PamdService:
elif line.strip() == "":
pamd_line = PamdEmptyLine(line)
else:
pamd_line = PamdRule.rule_from_string(line)
pamd_line = PamdRule.rule_from_string(line) or PamdLine(line)
self.append(pamd_line)