From 266255640e7ea2ec9976899eefaa6ef2d4286eaa Mon Sep 17 00:00:00 2001 From: John Hamelink Date: Mon, 26 Aug 2013 17:16:34 +0100 Subject: [PATCH] Fixed #3767 - mysql_user command fails with dots (and underscores) in database names. --- database/mysql_user | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/database/mysql_user b/database/mysql_user index ade11331be9..6c81af8c548 100644 --- a/database/mysql_user +++ b/database/mysql_user @@ -223,7 +223,7 @@ def privileges_get(cursor, user,host): privileges = [ pick(x) for x in privileges] if "WITH GRANT OPTION" in res.group(4): privileges.append('GRANT') - db = res.group(2).replace('`', '') + db = res.group(2) output[db] = privileges return output @@ -241,8 +241,17 @@ def privileges_unpack(priv): output = {} for item in priv.split('/'): pieces = item.split(':') + if pieces[0].find('.') != -1: + + pieces[0] = pieces[0].split('.') + for idx, piece in enumerate(pieces): + if pieces[0][idx] != "*": + pieces[0][idx] = "`" + pieces[0][idx] + "`" + pieces[0] = '.'.join(pieces[0]) + output[pieces[0]] = pieces[1].upper().split(',') + if '*.*' not in output: output['*.*'] = ['USAGE']