Merge pull request #46171 from amaclean199/fix_mysql_grants_comparison

Fix mysql grant comparisons
This commit is contained in:
Nicole Thomas 2018-03-27 13:54:47 -04:00 committed by GitHub
commit b548a3e742
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1800,8 +1800,10 @@ def grant_exists(grant,
if not target_tokens: # Avoid the overhead of re-calc in loop
target_tokens = _grant_to_tokens(target)
grant_tokens = _grant_to_tokens(grant)
grant_tokens_database = grant_tokens['database'].replace('"', '').replace('\\', '').replace('`', '')
target_tokens_database = target_tokens['database'].replace('"', '').replace('\\', '').replace('`', '')
if grant_tokens['user'] == target_tokens['user'] and \
grant_tokens['database'] == target_tokens['database'] and \
grant_tokens_database == target_tokens_database and \
grant_tokens['host'] == target_tokens['host'] and \
set(grant_tokens['grant']) >= set(target_tokens['grant']):
return True