Fix privilege string parsing

This commit is contained in:
Jorge-Rodriguez 2021-03-30 19:08:14 +03:00
parent 78cd001194
commit aed63e879c
No known key found for this signature in database
GPG key ID: 43153D1EFD8F7D90

View file

@ -975,9 +975,14 @@ def handle_requiressl_in_priv_string(module, priv, tls_requires):
priv = priv_groups.group(1) + priv_groups.group(4) or None
else:
inner_priv_groups = re.search(r"(.*?),?REQUIRESSL,?(.*)", priv_groups.group(3))
priv = priv_groups.group(1) + priv_groups.group(2) + ','.join((inner_priv_groups.group(1), inner_priv_groups.group(3))) + priv_groups.group(4)
priv = '{0}{1}{2}{3}'.format(
priv_groups.group(1),
priv_groups.group(2),
','.join(filter(None, (inner_priv_groups.group(1), inner_priv_groups.group(2)))),
priv_groups.group(4)
)
if not tls_requires:
tls_requires = {"SSL": None}
tls_requires = "SSL"
else:
module.warn('Ignoring "REQUIRESSL" privilege as "tls_requires" is defined and it takes precedence.')
return priv, tls_requires