Skip to content

Commit

Permalink
Closes mysql#30. Remove identification from GRANT statement with a re…
Browse files Browse the repository at this point in the history
…gex substitution
  • Loading branch information
swozny committed Apr 16, 2018
1 parent 08276b2 commit d1d9ca4
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions mysql/utilities/common/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,16 +680,7 @@ def clone(self, new_user, destination=None, globals_privs=False):
grant = row[0].replace(base_user_ticks, new_user_ticks, 1)

# Need to remove the IDENTIFIED BY clause for the base user.
search_str = "IDENTIFIED BY PASSWORD"
try:
start = grant.index(search_str)
except:
start = 0

if start > 0:
end = grant.index("'", start + len(search_str) + 2) + 2
grant = grant[0:start] + grant[end:]

grant = re.sub(r"IDENTIFIED\sBY\sPASSWORD(?:(?:\s<secret>)|(?:\s\'[^\']+\')?)",'',grant)
if self.verbosity > 0:
print grant

Expand Down

0 comments on commit d1d9ca4

Please sign in to comment.