From 01d4f47ef5402bf1a9024e18efff84ce3bcdd7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Fri, 18 Oct 2013 04:41:18 -0700 Subject: [PATCH] Added GRANT privilege ON database.* TO role; functionality --- sql/sql_acl.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 520b90f4386..b6a0515ad52 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -3256,8 +3256,12 @@ static int replace_db_table(TABLE *table, const char *db, /* Check if there is such a user in user table in memory? */ if (!find_user_no_anon(combo.host.str,combo.user.str, FALSE)) { - my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), MYF(0)); - DBUG_RETURN(-1); + /* The user could be a role, check if the user is registered as a role */ + if (!combo.host.length && !find_acl_role(combo.user.str)) + { + my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), MYF(0)); + DBUG_RETURN(-1); + } } table->use_all_columns();