~ubuntu-branches/ubuntu/natty/mysql-5.1/natty-proposed

« back to all changes in this revision

Viewing changes to sql/mysqld.cc

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 08:30:45 UTC
  • mfrom: (1.4.1)
  • Revision ID: package-import@ubuntu.com-20120222083045-2rd53r4bnyx7qus4
Tags: 5.1.61-0ubuntu0.11.04.1
* SECURITY UPDATE: Update to 5.1.61 to fix multiple security issues
  (LP: #937869)
  - http://www.oracle.com/technetwork/topics/security/cpujan2012-366304.html
  - CVE-2011-2262
  - CVE-2012-0075
  - CVE-2012-0112
  - CVE-2012-0113
  - CVE-2012-0114
  - CVE-2012-0115
  - CVE-2012-0116
  - CVE-2012-0117
  - CVE-2012-0118
  - CVE-2012-0119
  - CVE-2012-0120
  - CVE-2012-0484
  - CVE-2012-0485
  - CVE-2012-0486
  - CVE-2012-0487
  - CVE-2012-0488
  - CVE-2012-0489
  - CVE-2012-0490
  - CVE-2012-0491
  - CVE-2012-0492
  - CVE-2012-0493
  - CVE-2012-0494
  - CVE-2012-0495
  - CVE-2012-0496

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
 
1
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
2
2
 
3
3
   This program is free software; you can redistribute it and/or modify
4
4
   it under the terms of the GNU General Public License as published by
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
15
*/
15
16
 
16
17
#include "mysql_priv.h"
17
18
#include <m_ctype.h>
123
124
 
124
125
#ifdef __WIN__ 
125
126
#include <crtdbg.h>
126
 
#define SIGNAL_FMT "exception 0x%x"
127
 
#else
128
 
#define SIGNAL_FMT "signal %d"
129
127
#endif
130
128
 
131
129
#ifdef __NETWARE__
171
169
int initgroups(const char *,unsigned int);
172
170
#endif
173
171
 
174
 
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
 
172
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT)
175
173
#include <ieeefp.h>
176
174
#ifdef HAVE_FP_EXCEPT                           // Fix type conflict
177
175
typedef fp_except fp_except_t;
178
176
#endif
179
 
#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
 
177
#endif /* __FreeBSD__ && HAVE_IEEEFP_H && !HAVE_FEDISABLEEXCEPT */
180
178
#ifdef HAVE_SYS_FPU_H
181
179
/* for IRIX to use set_fpc_csr() */
182
180
#include <sys/fpu.h>
202
200
 
203
201
inline void setup_fpu()
204
202
{
205
 
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
 
203
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT)
206
204
  /* We can't handle floating point exceptions with threads, so disable
207
205
     this on freebsd
208
 
     Don't fall for overflow, underflow,divide-by-zero or loss of precision
 
206
     Don't fall for overflow, underflow,divide-by-zero or loss of precision.
 
207
     fpsetmask() is deprecated in favor of fedisableexcept() in C99.
209
208
  */
210
 
#if defined(__i386__)
 
209
#if defined(FP_X_DNML)
211
210
  fpsetmask(~(FP_X_INV | FP_X_DNML | FP_X_OFL | FP_X_UFL | FP_X_DZ |
212
211
              FP_X_IMP));
213
212
#else
214
213
  fpsetmask(~(FP_X_INV |             FP_X_OFL | FP_X_UFL | FP_X_DZ |
215
214
              FP_X_IMP));
216
 
#endif /* __i386__ */
217
 
#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
 
215
#endif /* FP_X_DNML */
 
216
#endif /* __FreeBSD__ && HAVE_IEEEFP_H && !HAVE_FEDISABLEEXCEPT */
 
217
 
 
218
#ifdef HAVE_FEDISABLEEXCEPT
 
219
  fedisableexcept(FE_ALL_EXCEPT);
 
220
#endif
218
221
 
219
222
#ifdef HAVE_FESETROUND
220
223
    /* Set FPU rounding mode to "round-to-nearest" */
263
266
extern "C" int gethostname(char *name, int namelen);
264
267
#endif
265
268
 
266
 
extern "C" sig_handler handle_segfault(int sig);
 
269
extern "C" sig_handler handle_fatal_signal(int sig);
267
270
 
268
271
#if defined(__linux__)
269
272
#define ENABLE_TEMP_POOL 1
273
276
 
274
277
/* Constants */
275
278
 
 
279
#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
 
280
 
276
281
const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"};
277
282
/*
278
283
  WARNING: When adding new SQL modes don't forget to update the
407
412
 
408
413
/* static variables */
409
414
 
 
415
#ifdef HAVE_NPTL
 
416
volatile sig_atomic_t ld_assume_kernel_is_set= 0;
 
417
#endif
 
418
 
410
419
/* the default log output is log tables */
411
420
static bool lower_case_table_names_used= 0;
 
421
static bool max_long_data_size_used= false;
412
422
static bool volatile select_thread_in_use, signal_thread_in_use;
413
423
static bool volatile ready_to_exit;
414
424
static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0;
415
425
static my_bool opt_short_log_format= 0;
416
426
static uint kill_cached_threads, wake_thread;
417
427
static ulong killed_threads, thread_created;
418
 
static ulong max_used_connections;
 
428
       ulong max_used_connections;
419
429
static ulong my_bind_addr;                      /**< the address we bind to */
420
430
static volatile ulong cached_thread_count= 0;
421
431
static const char *sql_mode_str= "OFF";
544
554
ulong opt_binlog_format_id= (ulong) BINLOG_FORMAT_UNSPEC;
545
555
const char *opt_binlog_format= binlog_format_names[opt_binlog_format_id];
546
556
#ifdef HAVE_INITGROUPS
547
 
static bool calling_initgroups= FALSE; /**< Used in SIGSEGV handler. */
 
557
volatile sig_atomic_t calling_initgroups= 0; /**< Used in SIGSEGV handler. */
548
558
#endif
549
559
uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
550
560
uint mysqld_port_timeout;
574
584
ulong specialflag=0;
575
585
ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
576
586
ulong max_connections, max_connect_errors;
 
587
/*
 
588
  Maximum length of parameter value which can be set through
 
589
  mysql_send_long_data() call.
 
590
*/
 
591
ulong max_long_data_size;
577
592
uint  max_user_connections= 0;
578
593
/**
579
594
  Limit of the total number of prepared statements in the server.
713
728
 
714
729
/* Static variables */
715
730
 
716
 
static bool kill_in_progress, segfaulted;
 
731
static volatile sig_atomic_t kill_in_progress;
717
732
#ifdef HAVE_STACK_TRACE_ON_SEGV
718
733
static my_bool opt_do_pstack;
719
734
#endif /* HAVE_STACK_TRACE_ON_SEGV */
1602
1617
    calling_initgroups as a flag to the SIGSEGV handler that is then used to
1603
1618
    output a specific message to help the user resolve this problem.
1604
1619
  */
1605
 
  calling_initgroups= TRUE;
 
1620
  calling_initgroups= 1;
1606
1621
  initgroups((char*) user, user_info_arg->pw_gid);
1607
 
  calling_initgroups= FALSE;
 
1622
  calling_initgroups= 0;
1608
1623
#endif
1609
1624
  if (setgid(user_info_arg->pw_gid) == -1)
1610
1625
  {
1897
1912
  pthread_mutex_unlock(&LOCK_connection_count);
1898
1913
 
1899
1914
  (void) pthread_mutex_lock(&LOCK_thread_count);
 
1915
  /*
 
1916
    Used by binlog_reset_master.  It would be cleaner to use
 
1917
    DEBUG_SYNC here, but that's not possible because the THD's debug
 
1918
    sync feature has been shut down at this point.
 
1919
  */
 
1920
  DBUG_EXECUTE_IF("sleep_after_lock_thread_count_before_delete_thd", sleep(5););
1900
1921
  thread_count--;
1901
1922
  delete thd;
1902
1923
  DBUG_VOID_RETURN;
2150
2171
  __try
2151
2172
  {
2152
2173
    my_set_exception_pointers(ex_pointers);
2153
 
    handle_segfault(ex_pointers->ExceptionRecord->ExceptionCode);
 
2174
    handle_fatal_signal(ex_pointers->ExceptionRecord->ExceptionCode);
2154
2175
  }
2155
2176
  __except(EXCEPTION_EXECUTE_HANDLER)
2156
2177
  {
2461
2482
#endif
2462
2483
 
2463
2484
 
2464
 
extern "C" sig_handler handle_segfault(int sig)
2465
 
{
2466
 
  time_t curr_time;
2467
 
  struct tm tm;
2468
 
 
2469
 
  /*
2470
 
    Strictly speaking, one needs a mutex here
2471
 
    but since we have got SIGSEGV already, things are a mess
2472
 
    so not having the mutex is not as bad as possibly using a buggy
2473
 
    mutex - so we keep things simple
2474
 
  */
2475
 
  if (segfaulted)
2476
 
  {
2477
 
    fprintf(stderr, "Fatal " SIGNAL_FMT " while backtracing\n", sig);
2478
 
    exit(1);
2479
 
  }
2480
 
 
2481
 
  segfaulted = 1;
2482
 
 
2483
 
  curr_time= my_time(0);
2484
 
  localtime_r(&curr_time, &tm);
2485
 
 
2486
 
  fprintf(stderr,"\
2487
 
%02d%02d%02d %2d:%02d:%02d - mysqld got " SIGNAL_FMT " ;\n\
2488
 
This could be because you hit a bug. It is also possible that this binary\n\
2489
 
or one of the libraries it was linked against is corrupt, improperly built,\n\
2490
 
or misconfigured. This error can also be caused by malfunctioning hardware.\n",
2491
 
          tm.tm_year % 100, tm.tm_mon+1, tm.tm_mday,
2492
 
          tm.tm_hour, tm.tm_min, tm.tm_sec,
2493
 
          sig);
2494
 
  fprintf(stderr, "\
2495
 
We will try our best to scrape up some info that will hopefully help diagnose\n\
2496
 
the problem, but since we have already crashed, something is definitely wrong\n\
2497
 
and this may fail.\n\n");
2498
 
  fprintf(stderr, "key_buffer_size=%lu\n",
2499
 
          (ulong) dflt_key_cache->key_cache_mem_size);
2500
 
  fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size);
2501
 
  fprintf(stderr, "max_used_connections=%lu\n", max_used_connections);
2502
 
  fprintf(stderr, "max_threads=%u\n", thread_scheduler.max_threads);
2503
 
  fprintf(stderr, "threads_connected=%u\n", thread_count);
2504
 
  fprintf(stderr, "It is possible that mysqld could use up to \n\
2505
 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = %lu K\n\
2506
 
bytes of memory\n", ((ulong) dflt_key_cache->key_cache_mem_size +
2507
 
                     (global_system_variables.read_buff_size +
2508
 
                      global_system_variables.sortbuff_size) *
2509
 
                     thread_scheduler.max_threads +
2510
 
                     max_connections * sizeof(THD)) / 1024);
2511
 
  fprintf(stderr, "Hope that's ok; if not, decrease some variables in the equation.\n\n");
2512
 
 
2513
 
#if defined(HAVE_LINUXTHREADS)
2514
 
  if (sizeof(char*) == 4 && thread_count > UNSAFE_DEFAULT_LINUX_THREADS)
2515
 
  {
2516
 
    fprintf(stderr, "\
2517
 
You seem to be running 32-bit Linux and have %d concurrent connections.\n\
2518
 
If you have not changed STACK_SIZE in LinuxThreads and built the binary \n\
2519
 
yourself, LinuxThreads is quite likely to steal a part of the global heap for\n\
2520
 
the thread stack. Please read http://dev.mysql.com/doc/mysql/en/linux.html\n\n",
2521
 
            thread_count);
2522
 
  }
2523
 
#endif /* HAVE_LINUXTHREADS */
2524
 
 
2525
 
#ifdef HAVE_STACKTRACE
2526
 
  THD *thd=current_thd;
2527
 
 
2528
 
  if (!(test_flags & TEST_NO_STACKTRACE))
2529
 
  {
2530
 
    fprintf(stderr, "thd: 0x%lx\n",(long) thd);
2531
 
    fprintf(stderr, "Attempting backtrace. You can use the following "
2532
 
                    "information to find out\nwhere mysqld died. If "
2533
 
                    "you see no messages after this, something went\n"
2534
 
                    "terribly wrong...\n");
2535
 
    my_print_stacktrace(thd ? (uchar*) thd->thread_stack : NULL,
2536
 
                        my_thread_stack_size);
2537
 
  }
2538
 
  if (thd)
2539
 
  {
2540
 
    const char *kreason= "UNKNOWN";
2541
 
    switch (thd->killed) {
2542
 
    case THD::NOT_KILLED:
2543
 
      kreason= "NOT_KILLED";
2544
 
      break;
2545
 
    case THD::KILL_BAD_DATA:
2546
 
      kreason= "KILL_BAD_DATA";
2547
 
      break;
2548
 
    case THD::KILL_CONNECTION:
2549
 
      kreason= "KILL_CONNECTION";
2550
 
      break;
2551
 
    case THD::KILL_QUERY:
2552
 
      kreason= "KILL_QUERY";
2553
 
      break;
2554
 
    case THD::KILLED_NO_VALUE:
2555
 
      kreason= "KILLED_NO_VALUE";
2556
 
      break;
2557
 
    }
2558
 
    fprintf(stderr, "Trying to get some variables.\n\
2559
 
Some pointers may be invalid and cause the dump to abort...\n");
2560
 
    my_safe_print_str("thd->query", thd->query(), 1024);
2561
 
    fprintf(stderr, "thd->thread_id=%lu\n", (ulong) thd->thread_id);
2562
 
    fprintf(stderr, "thd->killed=%s\n", kreason);
2563
 
  }
2564
 
  fprintf(stderr, "\
2565
 
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains\n\
2566
 
information that should help you find out what is causing the crash.\n");
2567
 
  fflush(stderr);
2568
 
#endif /* HAVE_STACKTRACE */
2569
 
 
2570
 
#ifdef HAVE_INITGROUPS
2571
 
  if (calling_initgroups)
2572
 
    fprintf(stderr, "\n\
2573
 
This crash occured while the server was calling initgroups(). This is\n\
2574
 
often due to the use of a mysqld that is statically linked against glibc\n\
2575
 
and configured to use LDAP in /etc/nsswitch.conf. You will need to either\n\
2576
 
upgrade to a version of glibc that does not have this problem (2.3.4 or\n\
2577
 
later when used with nscd), disable LDAP in your nsswitch.conf, or use a\n\
2578
 
mysqld that is not statically linked.\n");
2579
 
#endif
2580
 
 
2581
 
#ifdef HAVE_NPTL
2582
 
  if (thd_lib_detected == THD_LIB_LT && !getenv("LD_ASSUME_KERNEL"))
2583
 
    fprintf(stderr,"\n\
2584
 
You are running a statically-linked LinuxThreads binary on an NPTL system.\n\
2585
 
This can result in crashes on some distributions due to LT/NPTL conflicts.\n\
2586
 
You should either build a dynamically-linked binary, or force LinuxThreads\n\
2587
 
to be used with the LD_ASSUME_KERNEL environment variable. Please consult\n\
2588
 
the documentation for your distribution on how to do that.\n");
2589
 
#endif
2590
 
  
2591
 
  if (locked_in_memory)
2592
 
  {
2593
 
    fprintf(stderr, "\n\
2594
 
The \"--memlock\" argument, which was enabled, uses system calls that are\n\
2595
 
unreliable and unstable on some operating systems and operating-system\n\
2596
 
versions (notably, some versions of Linux).  This crash could be due to use\n\
2597
 
of those buggy OS calls.  You should consider whether you really need the\n\
2598
 
\"--memlock\" parameter and/or consult the OS distributer about \"mlockall\"\n\
2599
 
bugs.\n");
2600
 
  }
2601
 
 
2602
 
#ifdef HAVE_WRITE_CORE
2603
 
  if (test_flags & TEST_CORE_ON_SIGNAL)
2604
 
  {
2605
 
    fprintf(stderr, "Writing a core file\n");
2606
 
    fflush(stderr);
2607
 
    my_write_core(sig);
2608
 
  }
2609
 
#endif
2610
 
 
2611
 
#ifndef __WIN__
2612
 
  /* On Windows, do not terminate, but pass control to exception filter */
2613
 
  exit(1);
2614
 
#endif
2615
 
}
2616
 
 
2617
2485
#if !defined(__WIN__) && !defined(__NETWARE__)
2618
2486
#ifndef SA_RESETHAND
2619
2487
#define SA_RESETHAND 0
2642
2510
    my_init_stacktrace();
2643
2511
#endif
2644
2512
#if defined(__amiga__)
2645
 
    sa.sa_handler=(void(*)())handle_segfault;
 
2513
    sa.sa_handler=(void(*)())handle_fatal_signal;
2646
2514
#else
2647
 
    sa.sa_handler=handle_segfault;
 
2515
    sa.sa_handler=handle_fatal_signal;
2648
2516
#endif
2649
2517
    sigaction(SIGSEGV, &sa, NULL);
2650
2518
    sigaction(SIGABRT, &sa, NULL);
2837
2705
    case SIGHUP:
2838
2706
      if (!abort_loop)
2839
2707
      {
2840
 
        bool not_used;
 
2708
        int not_used;
2841
2709
        mysql_print_status();           // Print some debug info
2842
2710
        reload_acl_and_cache((THD*) 0,
2843
2711
                             (REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
3032
2900
#endif
3033
2901
 
3034
2902
 
 
2903
#ifndef EMBEDDED_LIBRARY
 
2904
static
 
2905
int
 
2906
check_enough_stack_size()
 
2907
{
 
2908
  uchar stack_top;
 
2909
 
 
2910
  return check_stack_overrun(current_thd, STACK_MIN_SIZE,
 
2911
                             &stack_top);
 
2912
}
 
2913
#endif
 
2914
 
 
2915
 
3035
2916
/**
3036
2917
  Initialize one of the global date/time format variables.
3037
2918
 
3234
3115
 
3235
3116
  max_system_variables.pseudo_thread_id= (ulong)~0;
3236
3117
  server_start_time= flush_status_time= my_time(0);
3237
 
  /* TODO: remove this when my_time_t is 64 bit compatible */
3238
 
  if (server_start_time >= (time_t) MY_TIME_T_MAX)
3239
 
  {
3240
 
    sql_print_error("This MySQL server doesn't support dates later then 2038");
3241
 
    return 1;
3242
 
  }
3243
3118
 
3244
3119
  rpl_filter= new Rpl_filter;
3245
3120
  binlog_filter= new Rpl_filter;
3278
3153
  */
3279
3154
  mysql_bin_log.init_pthread_objects();
3280
3155
 
 
3156
  /* TODO: remove this when my_time_t is 64 bit compatible */
 
3157
  if (!IS_TIME_T_VALID_FOR_TIMESTAMP(server_start_time))
 
3158
  {
 
3159
    sql_print_error("This MySQL server doesn't support dates later then 2038");
 
3160
    return 1;
 
3161
  }
 
3162
 
3281
3163
  if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0)
3282
3164
  {
3283
3165
    strmake(glob_hostname, STRING_WITH_LEN("localhost"));
3412
3294
#endif
3413
3295
  mysys_uses_curses=0;
3414
3296
#ifdef USE_REGEX
3415
 
  my_regex_init(&my_charset_latin1);
 
3297
#ifndef EMBEDDED_LIBRARY
 
3298
  my_regex_init(&my_charset_latin1, check_enough_stack_size);
 
3299
#else
 
3300
  my_regex_init(&my_charset_latin1, NULL);
 
3301
#endif
3416
3302
#endif
3417
3303
  /*
3418
3304
    Process a comma-separated character set list and choose
4323
4209
int main(int argc, char **argv)
4324
4210
#endif
4325
4211
{
 
4212
#ifdef HAVE_NPTL
 
4213
  ld_assume_kernel_is_set= (getenv("LD_ASSUME_KERNEL") != 0);
 
4214
#endif
 
4215
 
4326
4216
  MY_INIT(argv[0]);             // init my_sys library & pthreads
4327
4217
  /* nothing should come before this line ^^^ */
4328
4218
 
5780
5670
  OPT_SLOW_QUERY_LOG_FILE,
5781
5671
  OPT_IGNORE_BUILTIN_INNODB,
5782
5672
  OPT_BINLOG_DIRECT_NON_TRANS_UPDATE,
5783
 
  OPT_DEFAULT_CHARACTER_SET_OLD
 
5673
  OPT_DEFAULT_CHARACTER_SET_OLD,
 
5674
  OPT_MAX_LONG_DATA_SIZE
5784
5675
};
5785
5676
 
5786
5677
 
6774
6665
   "as much as you can afford; 1GB on a 4GB machine that mainly runs MySQL is "
6775
6666
   "quite common.",
6776
6667
   &dflt_key_cache_var.param_buff_size, NULL, NULL, (GET_ULL | GET_ASK_ADDR),
6777
 
   REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, SIZE_T_MAX, MALLOC_OVERHEAD,
 
6668
   REQUIRED_ARG, KEY_CACHE_SIZE, 0, SIZE_T_MAX, MALLOC_OVERHEAD,
6778
6669
   IO_SIZE, 0},
6779
6670
  {"key_cache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD,
6780
6671
   "This characterizes the number of hits a hot block has to be untouched "
6860
6751
    &global_system_variables.max_length_for_sort_data,
6861
6752
    &max_system_variables.max_length_for_sort_data, 0, GET_ULONG,
6862
6753
    REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
 
6754
  {"max_long_data_size", OPT_MAX_LONG_DATA_SIZE,
 
6755
   "The maximum size of prepared statement parameter which can be provided "
 
6756
   "through mysql_send_long_data() API call. "
 
6757
   "Deprecated option; use max_allowed_packet instead.",
 
6758
   &max_long_data_size,
 
6759
   &max_long_data_size, 0, GET_ULONG,
 
6760
   REQUIRED_ARG, 1024*1024L, 1024, UINT_MAX32, MALLOC_OVERHEAD, 1, 0},
6863
6761
  {"max_prepared_stmt_count", OPT_MAX_PREPARED_STMT_COUNT,
6864
6762
   "Maximum number of prepared statements in the server.",
6865
6763
   &max_prepared_stmt_count, &max_prepared_stmt_count,
7750
7648
  if (!default_collation_name)
7751
7649
    default_collation_name= (char*) default_charset_info->name;
7752
7650
  print_version();
7753
 
  puts("\
7754
 
Copyright (C) 2000-2008 MySQL AB, by Monty and others.\n\
7755
 
Copyright (C) 2008 Sun Microsystems, Inc.\n\
7756
 
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
7757
 
and you are welcome to modify and redistribute it under the GPL license\n\n\
7758
 
Starts the MySQL database server.\n");
7759
 
 
 
7651
  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
 
7652
  puts("Starts the MySQL database server.\n");
7760
7653
  printf("Usage: %s [OPTIONS]\n", my_progname);
7761
7654
  if (!opt_verbose)
7762
7655
    puts("\nFor more help options (several pages), use mysqld --verbose --help.");
7833
7726
  opt_secure_file_priv= 0;
7834
7727
  opt_bootstrap= opt_myisam_log= 0;
7835
7728
  mqh_used= 0;
7836
 
  segfaulted= kill_in_progress= 0;
 
7729
  kill_in_progress= 0;
7837
7730
  cleanup_done= 0;
7838
7731
  defaults_argc= 0;
7839
7732
  defaults_argv= 0;
8668
8561
    }
8669
8562
    break;
8670
8563
#endif /* defined(ENABLED_DEBUG_SYNC) */
 
8564
  case OPT_MAX_LONG_DATA_SIZE:
 
8565
    max_long_data_size_used= true;
 
8566
    WARN_DEPRECATED(NULL, VER_CELOSIA, "--max_long_data_size", "--max_allowed_packet");
 
8567
    break;
8671
8568
  }
8672
8569
  return 0;
8673
8570
}
8757
8654
       opt_log_slow_slave_statements) &&
8758
8655
      !opt_slow_log)
8759
8656
    sql_print_warning("options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set");
 
8657
  if (global_system_variables.net_buffer_length > 
 
8658
      global_system_variables.max_allowed_packet)
 
8659
  {
 
8660
    sql_print_warning("net_buffer_length (%lu) is set to be larger "
 
8661
                      "than max_allowed_packet (%lu). Please rectify.",
 
8662
                      global_system_variables.net_buffer_length, 
 
8663
                      global_system_variables.max_allowed_packet);
 
8664
  }
8760
8665
 
8761
8666
#if defined(HAVE_BROKEN_REALPATH)
8762
8667
  my_use_symdir=0;
8829
8734
  else
8830
8735
    pool_of_threads_scheduler(&thread_scheduler);  /* purecov: tested */
8831
8736
#endif
 
8737
 
 
8738
  /*
 
8739
    If max_long_data_size is not specified explicitly use
 
8740
    value of max_allowed_packet.
 
8741
  */
 
8742
  if (!max_long_data_size_used)
 
8743
    max_long_data_size= global_system_variables.max_allowed_packet;
 
8744
 
8832
8745
  return 0;
8833
8746
}
8834
8747
 
8907
8820
bool is_secure_file_path(char *path)
8908
8821
{
8909
8822
  char buff1[FN_REFLEN], buff2[FN_REFLEN];
 
8823
  size_t opt_secure_file_priv_len;
8910
8824
  /*
8911
8825
    All paths are secure if opt_secure_file_path is 0
8912
8826
  */
8913
8827
  if (!opt_secure_file_priv)
8914
8828
    return TRUE;
8915
8829
 
 
8830
  opt_secure_file_priv_len= strlen(opt_secure_file_priv);
 
8831
 
8916
8832
  if (strlen(path) >= FN_REFLEN)
8917
8833
    return FALSE;
8918
8834
 
8930
8846
      return FALSE;
8931
8847
  }
8932
8848
  convert_dirname(buff2, buff1, NullS);
8933
 
  if (strncmp(opt_secure_file_priv, buff2, strlen(opt_secure_file_priv)))
8934
 
    return FALSE;
 
8849
  if (!lower_case_file_system)
 
8850
  {
 
8851
    if (strncmp(opt_secure_file_priv, buff2, opt_secure_file_priv_len))
 
8852
      return FALSE;
 
8853
  }
 
8854
  else
 
8855
  {
 
8856
    if (files_charset_info->coll->strnncoll(files_charset_info,
 
8857
                                            (uchar *) buff2, strlen(buff2),
 
8858
                                            (uchar *) opt_secure_file_priv,
 
8859
                                            opt_secure_file_priv_len,
 
8860
                                            TRUE))
 
8861
      return FALSE;
 
8862
  }
8935
8863
  return TRUE;
8936
8864
}
8937
8865
 
 
8866
 
8938
8867
static int fix_paths(void)
8939
8868
{
8940
8869
  char buff[FN_REFLEN],*pos;
8998
8927
  {
8999
8928
    if (*opt_secure_file_priv == 0)
9000
8929
    {
 
8930
      my_free(opt_secure_file_priv, MYF(0));
9001
8931
      opt_secure_file_priv= 0;
9002
8932
    }
9003
8933
    else