~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to client/mysqldump.c

  • Committer: Package Import Robot
  • Author(s): James Page, Otto Kekäläinen
  • Date: 2014-02-17 16:51:52 UTC
  • mfrom: (2.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20140217165152-k315d3175g865kkx
Tags: 5.5.35-1
[ Otto Kekäläinen ]
* New upstream release, fixing the following security issues:
  - Buffer overflow in client/mysql.cc (Closes: #737597).
    - CVE-2014-0001
  - http://www.oracle.com/technetwork/topics/security/cpujan2014-1972949.html
    - CVE-2013-5891
    - CVE-2013-5908
    - CVE-2014-0386
    - CVE-2014-0393
    - CVE-2014-0401
    - CVE-2014-0402
    - CVE-2014-0412
    - CVE-2014-0420
    - CVE-2014-0437
* Upstream https://mariadb.atlassian.net/browse/MDEV-4902
  fixes compatibility with Bison 3.0 (Closes: #733002)
* Updated Russian debconf translation (Closes: #734426)
* Updated Japanese debconf translation (Closes: #735284)
* Updated French debconf translation (Closes: #736480)
* Renamed SONAME properly (Closes: #732967)

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
/* Chars needed to store LONGLONG, excluding trailing '\0'. */
88
88
#define LONGLONG_LEN 20
89
89
 
90
 
/* general_log or slow_log tables under mysql database */
91
 
static inline my_bool general_log_or_slow_log_tables(const char *db, 
92
 
                                                     const char *table)
93
 
{
94
 
  return (strcmp(db, "mysql") == 0) &&
95
 
         ((strcmp(table, "general_log") == 0) ||
96
 
          (strcmp(table, "slow_log") == 0));
97
 
}
98
 
 
99
90
static void add_load_option(DYNAMIC_STRING *str, const char *option,
100
91
                             const char *option_value);
101
92
static ulong find_set(TYPELIB *lib, const char *x, uint length,
621
612
  puts("Dumping structure and contents of MySQL databases and tables.");
622
613
  short_usage_sub();
623
614
  print_defaults("my",load_default_groups);
624
 
  my_print_help(my_long_options);
 
615
  puts("");
 
616
my_print_help(my_long_options);
625
617
  my_print_variables(my_long_options);
626
618
} /* usage */
627
619
 
2466
2458
  DBUG_RETURN(0);
2467
2459
}
2468
2460
 
 
2461
/* general_log or slow_log tables under mysql database */
 
2462
static inline my_bool general_log_or_slow_log_tables(const char *db,
 
2463
                                                     const char *table)
 
2464
{
 
2465
  return (!my_strcasecmp(charset_info, db, "mysql")) &&
 
2466
          (!my_strcasecmp(charset_info, table, "general_log") ||
 
2467
           !my_strcasecmp(charset_info, table, "slow_log"));
 
2468
}
 
2469
 
2469
2470
/*
2470
2471
  get_table_structure -- retrievs database structure, prints out corresponding
2471
2472
  CREATE statement and fills out insert_pat if the table is the type we will
4340
4341
  char table_buff[NAME_LEN*2+3];
4341
4342
  char hash_key[2*NAME_LEN+2];  /* "db.tablename" */
4342
4343
  char *afterdot;
4343
 
  int using_mysql_db= my_strcasecmp(&my_charset_latin1, database, "mysql");
 
4344
  my_bool general_log_table_exists= 0, slow_log_table_exists=0;
 
4345
  int using_mysql_db= !my_strcasecmp(charset_info, database, "mysql");
4344
4346
  DBUG_ENTER("dump_all_tables_in_db");
4345
4347
 
4346
4348
  afterdot= strmov(hash_key, database);
4351
4353
  if (opt_xml)
4352
4354
    print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
4353
4355
 
4354
 
  if (strcmp(database, "mysql") == 0)
4355
 
  {
4356
 
    char table_type[NAME_LEN];
4357
 
    char ignore_flag;
4358
 
    uint num_fields;
4359
 
    num_fields= get_table_structure((char *) "general_log", 
4360
 
                                    database, table_type, &ignore_flag);
4361
 
    if (num_fields == 0)
4362
 
      verbose_msg("-- Warning: get_table_structure() failed with some internal "
4363
 
                  "error for 'general_log' table\n");
4364
 
    num_fields= get_table_structure((char *) "slow_log", 
4365
 
                                    database, table_type, &ignore_flag);
4366
 
    if (num_fields == 0)
4367
 
      verbose_msg("-- Warning: get_table_structure() failed with some internal "
4368
 
                  "error for 'slow_log' table\n");
4369
 
  }
4370
4356
  if (lock_tables)
4371
4357
  {
4372
4358
    DYNAMIC_STRING query;
4412
4398
        }
4413
4399
      }
4414
4400
    }
 
4401
    else
 
4402
    {
 
4403
      /*
 
4404
        If general_log and slow_log exists in the 'mysql' database,
 
4405
         we should dump the table structure. But we cannot
 
4406
         call get_table_structure() here as 'LOCK TABLES' query got executed
 
4407
         above on the session and that 'LOCK TABLES' query does not contain
 
4408
         'general_log' and 'slow_log' tables. (you cannot acquire lock
 
4409
         on log tables). Hence mark the existence of these log tables here and
 
4410
         after 'UNLOCK TABLES' query is executed on the session, get the table
 
4411
         structure from server and dump it in the file.
 
4412
      */
 
4413
      if (using_mysql_db)
 
4414
      {
 
4415
        if (!my_strcasecmp(charset_info, table, "general_log"))
 
4416
          general_log_table_exists= 1;
 
4417
        else if (!my_strcasecmp(charset_info, table, "slow_log"))
 
4418
          slow_log_table_exists= 1;
 
4419
      }
 
4420
    }
4415
4421
  }
4416
4422
  if (opt_events && mysql_get_server_version(mysql) >= 50106)
4417
4423
  {
4430
4436
  }
4431
4437
  if (lock_tables)
4432
4438
    (void) mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES");
4433
 
  if (flush_privileges && using_mysql_db == 0)
 
4439
  if (using_mysql_db)
 
4440
  {
 
4441
    char table_type[NAME_LEN];
 
4442
    char ignore_flag;
 
4443
    if (general_log_table_exists)
 
4444
    {
 
4445
      if (!get_table_structure((char *) "general_log",
 
4446
                               database, table_type, &ignore_flag) )
 
4447
        verbose_msg("-- Warning: get_table_structure() failed with some internal "
 
4448
                    "error for 'general_log' table\n");
 
4449
    }
 
4450
    if (slow_log_table_exists)
 
4451
    {
 
4452
      if (!get_table_structure((char *) "slow_log",
 
4453
                               database, table_type, &ignore_flag) )
 
4454
        verbose_msg("-- Warning: get_table_structure() failed with some internal "
 
4455
                    "error for 'slow_log' table\n");
 
4456
    }
 
4457
  }
 
4458
  if (flush_privileges && using_mysql_db)
4434
4459
  {
4435
4460
    fprintf(md_result_file,"\n--\n-- Flush Grant Tables \n--\n");
4436
4461
    fprintf(md_result_file,"\n/*! FLUSH PRIVILEGES */;\n");
5277
5302
  verbose_msg("-- Retrieving view structure for table %s...\n", table);
5278
5303
 
5279
5304
#ifdef NOT_REALLY_USED_YET
5280
 
  sprintf(insert_pat,"SET SQL_QUOTE_SHOW_CREATE=%d",
 
5305
  sprintf(insert_pat, "SET SQL_QUOTE_SHOW_CREATE=%d",
5281
5306
          (opt_quoted || opt_keywords));
5282
5307
#endif
5283
5308