~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/db.cc

  • Committer: Monty Taylor
  • Date: 2010-03-02 19:10:25 UTC
  • mto: (1317.1.8)
  • mto: This revision was merged to the branch mainline in revision 1322.
  • Revision ID: mordred@inaugust.com-20100302191025-zoxjz4xwkoa6160h
Prevent unauthorized users from changing schema.

Show diffs side-by-side

added added

removed removed

Lines of Context:
605
605
 
606
606
bool mysql_change_db(Session *session, const std::string &new_db_name)
607
607
{
608
 
  LEX_STRING new_db_file_name;
609
608
 
610
609
  assert(not new_db_name.empty());
611
610
 
 
611
  if (not plugin::Authorization::isAuthorized(session->getSecurityContext(),
 
612
                                              new_db_name))
 
613
  {
 
614
    /* Error message is set in isAuthorized */
 
615
    return true;
 
616
  }
 
617
 
 
618
 
612
619
  /*
613
620
    Now we need to make a copy because check_db_name requires a
614
621
    non-constant argument. Actually, it takes database file name.
616
623
    TODO: fix check_db_name().
617
624
  */
618
625
 
 
626
  LEX_STRING new_db_file_name;
619
627
  new_db_file_name.length= new_db_name.length();
620
628
  new_db_file_name.str= (char *)malloc(new_db_name.length() + 1);
621
629
  if (new_db_file_name.str == NULL)