Cut the 3rd matching group as it fails to match roles without quotes

The group purpose was to match the closing quotes. We don't need the
value after the TO. So we can ignore this entirely.
This commit is contained in:
Laurent Indermuehle 2025-04-24 15:52:46 +02:00
parent 726fcaeca6
commit 7b13533ba1
No known key found for this signature in database
GPG key ID: 93FA944C9F34DD09

View file

@ -662,7 +662,7 @@ def privileges_get(cursor, user, host, maria_role=False):
if not maria_role:
res = re.match("""GRANT (.+) ON (.+) TO (['`"]).*\\3@(['`"]).*\\4( IDENTIFIED BY PASSWORD (['`"]).+\\6)? ?(.*)""", grant[0])
else:
res = re.match("""GRANT (.+) ON (.+) TO (['`"]).*\\3""", grant[0])
res = re.match("""GRANT (.+) ON (.+) TO .*""", grant[0])
if res is None:
# If a user has roles assigned, we'll have one of priv tuples looking like