mysql_user: fix malformed regex used to check current privileges (#52278)
* mysql_user: fix malformed regex used to check current privileges * Add changelog fragment for PR #52278
This commit is contained in:
parent
c68838fb13
commit
e73e9ecbc3
2 changed files with 3 additions and 1 deletions
2
changelogs/fragments/52278-mysql_user-fix-regex
Normal file
2
changelogs/fragments/52278-mysql_user-fix-regex
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- "mysql_user: fix the working but incorrect regex used to check the user privileges."
|
|
@ -444,7 +444,7 @@ def privileges_get(cursor, user, host):
|
|||
return x
|
||||
|
||||
for grant in grants:
|
||||
res = re.match("""GRANT (.+) ON (.+) TO (['`"]).*\\3@(['`"]).*\\4( IDENTIFIED BY PASSWORD (['`"]).+\5)? ?(.*)""", grant[0])
|
||||
res = re.match("""GRANT (.+) ON (.+) TO (['`"]).*\\3@(['`"]).*\\4( IDENTIFIED BY PASSWORD (['`"]).+\\6)? ?(.*)""", grant[0])
|
||||
if res is None:
|
||||
raise InvalidPrivsError('unable to parse the MySQL grant string: %s' % grant[0])
|
||||
privileges = res.group(1).split(", ")
|
||||
|
|
Loading…
Reference in a new issue