Fix TLS requirements parsing

This commit is contained in:
Jorge-Rodriguez 2020-09-15 18:59:23 +03:00
parent 2c0be4a73f
commit b679befe43
No known key found for this signature in database
GPG key ID: 43153D1EFD8F7D90

View file

@ -434,7 +434,11 @@ def get_tls_requires(cursor, user, host):
pattern = r"(?<=\bREQUIRE\b)(.*?)(?=(?:\bPASSWORD\b|$))"
requires_match = re.search(pattern, require_line)
requires = requires_match.group().strip() if requires_match else ""
if len(requires.split()) > 1:
if any((requires.startswith(req) for req in ('SSL', 'X509', 'NONE'))):
requires = requires.split()[0]
if requires == 'NONE':
requires = None
else:
import shlex
items = iter(shlex.split(requires))