fixed the problem for not beable to revoke *.*, for more detail https://github.com/saltstack/salt/issues/23201, fixed mysql cannot create user with pure digit password, for more info https://github.com/saltstack/salt/issues/23664

This commit is contained in:
lisa2lisa 2015-05-14 23:51:18 +02:00
parent cdf421b9ed
commit a29f161a58

View file

@ -1055,7 +1055,7 @@ def user_exists(user,
qry += ' AND Password = \'\''
elif password:
qry += ' AND Password = PASSWORD(%(password)s)'
args['password'] = password
args['password'] = str(password)
elif password_hash:
qry += ' AND Password = %(password)s'
args['password'] = password_hash
@ -1167,7 +1167,7 @@ def user_create(user,
args['host'] = host
if password is not None:
qry += ' IDENTIFIED BY %(password)s'
args['password'] = password
args['password'] = str(password)
elif password_hash is not None:
qry += ' IDENTIFIED BY PASSWORD %(password)s'
args['password'] = password_hash
@ -1721,6 +1721,11 @@ def grant_revoke(grant,
# _ and % are authorized on GRANT queries and should get escaped
# on the db name, but only if not requesting a table level grant
s_database = quote_identifier(dbc, for_grants=(table is '*'))
if dbc is '*':
# add revoke for *.*
# before the modification query send to mysql will looks like
# REVOKE SELECT ON `*`.* FROM %(user)s@%(host)s
s_database = dbc
if table is not '*':
table = quote_identifier(table)
# identifiers cannot be used as values, same thing for grants