diff --git a/mysql-test/suite/roles/role_grant_propagate-29458.result b/mysql-test/suite/roles/role_grant_propagate-29458.result index a8ee6e7d987..28aa053f38a 100644 --- a/mysql-test/suite/roles/role_grant_propagate-29458.result +++ b/mysql-test/suite/roles/role_grant_propagate-29458.result @@ -79,7 +79,6 @@ grant insert(a) on some_db.t1 to r_active_column; grant insert on *.* to middle_level; grant alter routine on procedure some_db.p1 to r_active_proc; grant alter routine on function some_db.f1 to r_active_func; -flush privileges; connect con1, localhost, foo,,; select * from some_db.t1; ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' diff --git a/mysql-test/suite/roles/role_grant_propagate-29458.test b/mysql-test/suite/roles/role_grant_propagate-29458.test index 07c29a3800c..1b0906dce25 100644 --- a/mysql-test/suite/roles/role_grant_propagate-29458.test +++ b/mysql-test/suite/roles/role_grant_propagate-29458.test @@ -103,7 +103,6 @@ grant insert on *.* to middle_level; grant alter routine on procedure some_db.p1 to r_active_proc; grant alter routine on function some_db.f1 to r_active_func; -flush privileges; --connect (con1, localhost, foo,,) --error ER_TABLEACCESS_DENIED_ERROR diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 31e0f64e6dc..0110a1f0c65 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -6793,23 +6793,24 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, table_name= table_list->table_name.str; grant_name= routine_hash_search(Str->host.str, NullS, db_name, Str->user.str, table_name, sph, 1); - if (!grant_name || !grant_name->init_privs) + if (revoke_grant && (!grant_name || !grant_name->init_privs)) { - if (revoke_grant) - { - my_error(ER_NONEXISTING_PROC_GRANT, MYF(0), - Str->user.str, Str->host.str, table_name); - result= TRUE; - continue; - } + my_error(ER_NONEXISTING_PROC_GRANT, MYF(0), + Str->user.str, Str->host.str, table_name); + result= TRUE; + continue; + } + if (!grant_name) + { + DBUG_ASSERT(!revoke_grant); grant_name= new GRANT_NAME(Str->host.str, db_name, - Str->user.str, table_name, - rights, TRUE); + Str->user.str, table_name, + rights, TRUE); if (!grant_name || - my_hash_insert(sph->get_priv_hash(), (uchar*) grant_name)) + my_hash_insert(sph->get_priv_hash(), (uchar*) grant_name)) { result= TRUE; - continue; + continue; } }