List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:October 23 2007 4:01pm
Subject:Re: bk commit into 5.0 tree (thek:1.2537) BUG#16470
View as plain text  
Hi Kristofer,

kpettersson@stripped wrote:
> ChangeSet@stripped, 2007-10-23 16:07:32+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-23 16:07:31+02:00, thek@adventure.(none) +9 -3
>     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-23 16:07:31 +02:00
> @@ -2786,7 +2786,12 @@ bool mysql_table_grant(THD *thd, TABLE_L
>                 MYF(0));
>      DBUG_RETURN(TRUE);
>    }
> -
> +  if (!grant_option)
> +  {
> +    my_message(ER_TABLE_NEEDS_UPGRADE, ER(ER_ILLEGAL_GRANT_FOR_TABLE),
> +                MYF(0));
> +    DBUG_RETURN(TRUE);
> +  }

Maybe a new error code?

>    if (!revoke_grant)
>    {
>      if (columns.elements)
> @@ -3335,13 +3340,14 @@ my_bool grant_init()
>      DBUG_RETURN(1);				/* purecov: deadcode */
>    thd->thread_stack= (char*) &thd;
>    thd->store_globals();
> -  return_val=  grant_reload(thd);
> +  if (grant_reload(thd))
> +    return TRUE;

thd leaked?

>    delete thd;
>    /* Remember that we don't have a THD */
>    my_pthread_setspecific_ptr(THR_THD,  0);

shouldn't the return point be here in case of error?

>    /* Set the grant option flag so we will check grants */
>    grant_option= TRUE;
> -  DBUG_RETURN(return_val);
> +  DBUG_RETURN(FALSE);
>  }
>  

Regards,

-- 
Davi Arnaut, Software Engineer
MySQL Inc, www.mysql.com

Are you MySQL certified?  www.mysql.com/certification
Thread
bk commit into 5.0 tree (thek:1.2537) BUG#16470kpettersson23 Oct
  • Re: bk commit into 5.0 tree (thek:1.2537) BUG#16470Davi Arnaut23 Oct
  • Re: bk commit into 5.0 tree (thek:1.2537) BUG#16470Sergei Golubchik23 Oct