diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-04-15 15:09:22 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-04-15 15:09:22 +0200 |
commit | a9035be5b7a7b3865ddb4ef34a5d0cfc65dfc254 (patch) | |
tree | a9df7341e91623f62fe37cd47fce139d8888fc95 /extra | |
parent | 3a1c91d87d69ef243b3e78be6089102cafef0a8e (diff) | |
parent | f57ecb7786177e0af3b1e3ec94302720b2e0f967 (diff) | |
download | mariadb-git-a9035be5b7a7b3865ddb4ef34a5d0cfc65dfc254.tar.gz |
10.0-base merge
Diffstat (limited to 'extra')
-rw-r--r-- | extra/my_print_defaults.c | 48 | ||||
-rw-r--r-- | extra/yassl/src/handshake.cpp | 8 |
2 files changed, 38 insertions, 18 deletions
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 8a16e677cb9..7558d6d00ae 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -26,8 +26,13 @@ #include <my_sys.h> #include <m_string.h> #include <my_getopt.h> +#include <mysql_version.h> +#define load_default_groups mysqld_groups +#include <mysqld_default_groups.h> +#undef load_default_groups +my_bool opt_mysqld; const char *config_file="my"; /* Default config file */ uint verbose= 0, opt_defaults_file_used= 0; const char *default_dbug_option="d:t:o,/tmp/my_print_defaults.trace"; @@ -78,6 +83,8 @@ static struct my_option my_long_options[] = (void *)&my_defaults_extra_file, (void *)&my_defaults_extra_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"mysqld", 0, "Read the same set of groups that the mysqld binary does.", + &opt_mysqld, &opt_mysqld, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"no-defaults", 'n', "Return an empty string (useful for scripts).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"help", '?', "Display this help message and exit.", @@ -98,11 +105,12 @@ static void usage(my_bool version) return; puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("Prints all arguments that is give to some program using the default files"); - printf("Usage: %s [OPTIONS] groups\n", my_progname); + printf("Usage: %s [OPTIONS] [groups]\n", my_progname); my_print_help(my_long_options); my_print_default_files(config_file); my_print_variables(my_long_options); printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname); + exit(0); } @@ -115,17 +123,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_defaults_file_used= 1; break; case 'n': - exit(0); + exit(0); case 'I': case '?': - usage(0); - exit(0); + usage(0); case 'v': verbose++; break; case 'V': - usage(1); - exit(0); + usage(1); case '#': DBUG_PUSH(argument ? argument : default_dbug_option); break; @@ -141,11 +147,6 @@ static int get_options(int *argc,char ***argv) if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); - if (*argc < 1) - { - usage(0); - return 1; - } return 0; } @@ -153,9 +154,10 @@ static int get_options(int *argc,char ***argv) int main(int argc, char **argv) { int count, error, args_used; - char **load_default_groups, *tmp_arguments[6]; + char **load_default_groups= 0, *tmp_arguments[6]; char **argument, **arguments, **org_argv; char *defaults, *extra_defaults, *group_suffix; + int nargs, i= 0; MY_INIT(argv[0]); org_argv= argv; @@ -169,13 +171,25 @@ int main(int argc, char **argv) arguments[count]= 0; /* Check out the args */ - if (!(load_default_groups=(char**) my_malloc((argc+1)*sizeof(char*), - MYF(MY_WME)))) - exit(1); if (get_options(&argc,&argv)) exit(1); - memcpy((char*) load_default_groups, (char*) argv, (argc + 1) * sizeof(*argv)); + nargs= argc + 1; + if (opt_mysqld) + nargs+= array_elements(mysqld_groups); + + if (nargs < 2) + usage(0); + + load_default_groups=(char**) my_malloc(nargs*sizeof(char*), MYF(MY_WME)); + if (!load_default_groups) + exit(1); + if (opt_mysqld) + { + for (; mysqld_groups[i]; i++) + load_default_groups[i]= (char*) mysqld_groups[i]; + } + memcpy(load_default_groups + i, argv, (argc + 1) * sizeof(*argv)); if ((error= load_defaults(config_file, (const char **) load_default_groups, &count, &arguments))) { @@ -198,6 +212,6 @@ int main(int argc, char **argv) puts(*argument); my_free(load_default_groups); free_defaults(arguments); - + my_end(0); exit(0); } diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp index 3a1ade9816c..97db6264dbb 100644 --- a/extra/yassl/src/handshake.cpp +++ b/extra/yassl/src/handshake.cpp @@ -767,8 +767,14 @@ int DoProcessReply(SSL& ssl) while (buffer.get_current() < hdr.length_ + RECORD_HEADER + offset) { // each message in record, can be more than 1 if not encrypted - if (ssl.getSecurity().get_parms().pending_ == false) // cipher on + if (ssl.getSecurity().get_parms().pending_ == false) { // cipher on + // sanity check for malicious/corrupted/illegal input + if (buffer.get_remaining() < hdr.length_) { + ssl.SetError(bad_input); + return 0; + } decrypt_message(ssl, buffer, hdr.length_); + } mySTL::auto_ptr<Message> msg(mf.CreateObject(hdr.type_)); if (!msg.get()) { |