mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-07-08 19:49:09 +00:00
pamd: handle non-PAM lines in authselect profile files (#12137)
* fix(pamd): handle non-PAM lines in authselect profile files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test(pamd): add test for authselect directive lines Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(changelog): add fragment for PR 12137 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ef5b22d18e
commit
5d62edc673
3 changed files with 19 additions and 1 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue