Hi!
On Oct 24, kpettersson@stripped wrote:
> ChangeSet@stripped, 2007-10-24 10:29:24+02:00, thek@adventure.(none) +1 -0
> Bug #16470 crash on grant if old grant tables
>
> If a user upgraded the server without running mysql_upgrade, and later tried
> to run a GRANT command on grant tables like tables_priv, the server would
> crash.
>
> This patch fixes this problem by checking if the grant tables were properly
> initialized before attempt to store any new grants.
>
> sql/sql_acl.cc@stripped, 2007-10-24 10:29:21+02:00, thek@adventure.(none) +3 -6
> If grant_reload fails, don't try to store new GRANTs because the grant tables
> weren't properly initialized.
> diff -Nrup a/sql/sql_acl.cc b/sql/sql_acl.cc
> --- a/sql/sql_acl.cc 2007-06-20 14:24:27 +02:00
> +++ b/sql/sql_acl.cc 2007-10-24 10:29:21 +02:00
> @@ -3328,20 +3328,17 @@ void grant_free(void)
> my_bool grant_init()
> {
> THD *thd;
> - my_bool return_val;
> DBUG_ENTER("grant_init");
>
> if (!(thd= new THD))
> DBUG_RETURN(1); /* purecov: deadcode */
> thd->thread_stack= (char*) &thd;
> thd->store_globals();
> - return_val= grant_reload(thd);
> + grant_option= !grant_reload(thd);
Nope. grant_option mean that one can use table- and column-level grants.
And one certainly can, event if procs_priv table doesn't exist.
You cannot disable table- and column-level grants in this case.
> delete thd;
> /* Remember that we don't have a THD */
> my_pthread_setspecific_ptr(THR_THD, 0);
> - /* Set the grant option flag so we will check grants */
> - grant_option= TRUE;
> - DBUG_RETURN(return_val);
> + DBUG_RETURN(!grant_option);
> }
Regards / Mit vielen Grüssen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Developer
/_/ /_/\_, /___/\___\_\___/ MySQL GmbH, Dachauer Str. 37, D-80335 München
<___/ Geschäftsführer: Kaj Arnö - HRB
München 162140