Mercurial > hg > ltpdarepo
changeset 216:66de4aa7d53a
Fix unprivileged user permissions in upgrade step.
author | Daniele Nicolodi <daniele@grinta.net> |
---|---|
date | Mon, 21 Nov 2011 16:10:13 +0100 |
parents | 5b749cb6aa22 |
children | 4f5fc5c72aee |
files | src/ltpdarepo/upgrade.py |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ltpdarepo/upgrade.py Mon Nov 21 16:10:12 2011 +0100 +++ b/src/ltpdarepo/upgrade.py Mon Nov 21 16:10:13 2011 +0100 @@ -82,9 +82,19 @@ def upgrade_24_to_25(conn, **kwargs): curs = conn.cursor() + username = kwargs.get('USERNAME') + database = kwargs.get('DATABASE') + # make mysql beheave: use sql strict mode curs.execute("""SET GLOBAL SQL_MODE='STRICT_TRANS_TABLES'""") + # update permissions for super user + if username != 'root': + curs.execute("""REVOKE RELOAD, ALTER + ON *.* FROM %s@'localhost'""", username) + curs.execute("""GRANT EXECUTE, CREATE TEMPORARY TABLES + ON `%s`.* TO %%s@'localhost'""" % database, username) + # consolidate privileges: there is no need to specify grants # both for 'localhost' and for '%' hosts. drop privileges granted # for hosts different than '%'