Fix cursor parsing

This commit is contained in:
Jorge-Rodriguez 2020-09-12 15:24:13 +03:00
parent 4fa9719c75
commit 7411ad42bd
No known key found for this signature in database
GPG key ID: 43153D1EFD8F7D90

View file

@ -429,7 +429,7 @@ def get_tls_requires(cursor, user, host):
query = "SHOW GRANTS for '%s'@'%s'" % (user, host) query = "SHOW GRANTS for '%s'@'%s'" % (user, host)
cursor.execute(query) cursor.execute(query)
require_list = list(filter(lambda x: "REQUIRE" in x, cursor.fetchall())) require_list = [tuple[0] for tuple in filter(lambda x: "REQUIRE" in x[0], cursor.fetchall())]
require_line = require_list[0] if require_list else "" require_line = require_list[0] if require_list else ""
pattern = r"(?<=\bREQUIRE\b)(.*?)(?=(?:\bPASSWORD\b|$))" pattern = r"(?<=\bREQUIRE\b)(.*?)(?=(?:\bPASSWORD\b|$))"
requires_match = re.search(pattern, require_line) requires_match = re.search(pattern, require_line)