diff options
Diffstat (limited to 'extra')
35 files changed, 219 insertions, 107 deletions
diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index a569641a198..f8f71b00743 100644 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -31,24 +31,28 @@ IF(NOT CMAKE_CROSSCOMPILING) TARGET_LINK_LIBRARIES(comp_err mysys) ENDIF() -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/include/mysqld_error.h - ${PROJECT_BINARY_DIR}/sql/share/english/errmsg.sys - COMMAND comp_err - --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets - --out-dir=${PROJECT_BINARY_DIR}/sql/share/ - --header_file=${PROJECT_BINARY_DIR}/include/mysqld_error.h - --name_file=${PROJECT_BINARY_DIR}/include/mysqld_ername.h - --state_file=${PROJECT_BINARY_DIR}/include/sql_state.h - --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt - DEPENDS ${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt - ${CMAKE_CURRENT_SOURCE_DIR}/comp_err.c) +# Generate mysqld_error.h +# Try not to change its timestamp if not necessary(as touching +# mysqld_error.h results in rebuild of the almost whole server) +# To preserve timestamp, first generate a temp header file, then copy it +# to mysqld_error.h using cmake -E copy_if_different +ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp + COMMAND comp_err + --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets + --out-dir=${CMAKE_BINARY_DIR}/sql/share/ + --header_file=${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp + --name_file=${CMAKE_BINARY_DIR}/include/mysqld_ername.h.tmp + --state_file=${CMAKE_BINARY_DIR}/include/sql_state.h.tmp + --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp ${CMAKE_BINARY_DIR}/include/mysqld_error.h + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/mysqld_ername.h.tmp ${CMAKE_BINARY_DIR}/include/mysqld_ername.h + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/sql_state.h.tmp ${CMAKE_BINARY_DIR}/include/sql_state.h + DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt) ADD_CUSTOM_TARGET(GenError ALL DEPENDS - ${PROJECT_BINARY_DIR}/include/mysqld_error.h - ${PROJECT_BINARY_DIR}/sql/share/english/errmsg.sys - ${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt) + ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp) MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) TARGET_LINK_LIBRARIES(my_print_defaults mysys) @@ -57,6 +61,7 @@ MYSQL_ADD_EXECUTABLE(perror perror.c) ADD_DEPENDENCIES(perror GenError) TARGET_LINK_LIBRARIES(perror mysys) +IF(UNIX) MYSQL_ADD_EXECUTABLE(resolveip resolveip.c) TARGET_LINK_LIBRARIES(resolveip mysys) IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") @@ -65,9 +70,9 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") MY_SEARCH_LIBS(inet_aton "nsl;socket;resolv" SOLARIS_NSL) TARGET_LINK_LIBRARIES(resolveip ${SOLARIS_NSL}) ENDIF() +ENDIF() - -MYSQL_ADD_EXECUTABLE(replace replace.c) +MYSQL_ADD_EXECUTABLE(replace replace.c COMPONENT Server) TARGET_LINK_LIBRARIES(replace mysys) IF(UNIX) MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.c) @@ -75,7 +80,6 @@ IF(UNIX) MYSQL_ADD_EXECUTABLE(resolve_stack_dump resolve_stack_dump.c) TARGET_LINK_LIBRARIES(resolve_stack_dump mysys) - MYSQL_ADD_EXECUTABLE(mysql_waitpid mysql_waitpid.c) + MYSQL_ADD_EXECUTABLE(mysql_waitpid mysql_waitpid.c COMPONENT Client) TARGET_LINK_LIBRARIES(mysql_waitpid mysys) ENDIF() - diff --git a/extra/comp_err.c b/extra/comp_err.c index bf100fdef85..1fababf3ae5 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -1,5 +1,6 @@ /* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2011, Oracle and/or its affiliates & Anjuta Widenius + Copyright (c) 2008-2011 Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,6 +37,7 @@ #define HEADER_LENGTH 32 /* Length of header in errmsg.sys */ #define DEFAULT_CHARSET_DIR "../sql/share/charsets" #define ER_PREFIX "ER_" +#define ER_PREFIX2 "MARIA_ER_" #define WARN_PREFIX "WARN_" static char *OUTFILE= (char*) "errmsg.sys"; static char *HEADERFILE= (char*) "mysqld_error.h"; @@ -59,7 +61,7 @@ const char *empty_string= ""; /* For empty states */ */ const char *default_language= "eng"; -int er_offset= 1000; +uint er_offset= 1000; my_bool info_flag= 0; /* Storage of one error message row (for one language) */ @@ -87,7 +89,7 @@ struct languages struct errors { const char *er_name; /* Name of the error (ER_HASHCK) */ - int d_code; /* Error code number */ + uint d_code; /* Error code number */ const char *sql_code1; /* sql state */ const char *sql_code2; /* ODBC state */ struct errors *next_error; /* Pointer to next error */ @@ -110,7 +112,8 @@ static struct my_option my_long_options[]= NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Prints version", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"charset", 'C', "Charset dir", &charsets_dir, &charsets_dir, + {"charset", 'C', "Charset dir", + (char**) &charsets_dir, (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"in_file", 'F', "Input file", &TXTFILE, &TXTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -128,6 +131,7 @@ static struct my_option my_long_options[]= }; +static struct errors *generate_empty_message(uint dcode); static struct languages *parse_charset_string(char *str); static struct errors *parse_error_string(char *ptr, int er_count); static struct message *parse_message_string(struct message *new_message, @@ -226,7 +230,7 @@ static int create_header_files(struct errors *error_head) struct errors *tmp_error; struct message *er_msg; const char *er_text; - + uint current_d_code; DBUG_ENTER("create_header_files"); if (!(er_definef= my_fopen(HEADERFILE, O_WRONLY, MYF(MY_WME)))) @@ -251,13 +255,22 @@ static int create_header_files(struct errors *error_head) fprintf(er_definef, "#define ER_ERROR_FIRST %d\n", error_head->d_code); + current_d_code= error_head->d_code -1; for (tmp_error= error_head; tmp_error; tmp_error= tmp_error->next_error) { /* generating mysqld_error.h fprintf() will automatically add \r on windows */ - fprintf(er_definef, "#define %s %d\n", tmp_error->er_name, + + if (!tmp_error->er_name) + continue; /* Placeholder for gap */ + + if (tmp_error->d_code > current_d_code + 1) + fprintf(er_definef, "\n/* New section */\n\n"); + current_d_code= tmp_error->d_code; + + fprintf(er_definef, "#define %s %u\n", tmp_error->er_name, tmp_error->d_code); er_last= tmp_error->d_code; @@ -429,7 +442,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error, char *str, buff[1000]; struct errors *current_error= 0, **tail_error= top_error; struct message current_message; - int rcount= 0; + uint rcount= 0; + my_bool er_offset_found= 0; DBUG_ENTER("parse_input_file"); *top_error= 0; @@ -450,11 +464,32 @@ static int parse_input_file(const char *file_name, struct errors **top_error, } if (is_prefix(str, "start-error-number")) { - if (!(er_offset= parse_error_offset(str))) + uint tmp_er_offset; + if (!(tmp_er_offset= parse_error_offset(str))) { fprintf(stderr, "Failed to parse the error offset string!\n"); DBUG_RETURN(0); } + if (!er_offset_found) + { + er_offset_found= 1; + er_offset= tmp_er_offset; + } + else + { + /* Create empty error messages between er_offset and tmp_err_offset */ + if (tmp_er_offset < er_offset + rcount) + { + fprintf(stderr, "new start-error-number %u is smaller than current error message: %u\n", tmp_er_offset, er_offset + rcount); + DBUG_RETURN(0); + } + for ( ; er_offset + rcount < tmp_er_offset ; rcount++) + { + current_error= generate_empty_message(er_offset + rcount); + *tail_error= current_error; + tail_error= ¤t_error->next_error; + } + } continue; } if (is_prefix(str, "default-language")) @@ -501,7 +536,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error, DBUG_RETURN(0); continue; } - if (is_prefix(str, ER_PREFIX) || is_prefix(str, WARN_PREFIX)) + if (is_prefix(str, ER_PREFIX) || is_prefix(str, WARN_PREFIX) || + is_prefix(str, ER_PREFIX2)) { if (!(current_error= parse_error_string(str, rcount))) { @@ -516,12 +552,12 @@ static int parse_input_file(const char *file_name, struct errors **top_error, continue; } if (*str == '#' || *str == '\n') - continue; /* skip comment or empty lines */ + continue; /* skip comment or empty lines */ fprintf(stderr, "Wrong input file format. Stop!\nLine: %s\n", str); DBUG_RETURN(0); } - *tail_error= 0; /* Mark end of list */ + *tail_error= 0; /* Mark end of list */ my_fclose(file, MYF(0)); DBUG_RETURN(rcount); @@ -630,7 +666,6 @@ static struct message *find_message(struct errors *err, const char *lang, DBUG_RETURN(tmp); if (!strcmp(tmp->lang_short_name, default_language)) { - DBUG_ASSERT(tmp->text[0] != 0); return_val= tmp; } } @@ -850,6 +885,33 @@ static struct message *parse_message_string(struct message *new_message, } +static struct errors *generate_empty_message(uint d_code) +{ + struct errors *new_error; + struct message message; + + /* create a new element */ + if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error), + MYF(MY_WME)))) + return(0); + if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 1)) + return(0); /* OOM: Fatal error */ + + new_error->er_name= NULL; + new_error->d_code= d_code; + new_error->sql_code1= empty_string; + new_error->sql_code2= empty_string; + + if (!(message.lang_short_name= my_strdup(default_language, MYF(MY_WME))) || + !(message.text= my_strdup("", MYF(MY_WME)))) + return(0); + + /* Can't fail as msg is preallocated */ + (void) insert_dynamic(&new_error->msg, (uchar*) &message); + return(new_error); +} + + /* Parsing the string with error name and codes; returns the pointer to the errors struct @@ -862,7 +924,9 @@ static struct errors *parse_error_string(char *str, int er_count) DBUG_PRINT("enter", ("str: %s", str)); /* create a new element */ - new_error= (struct errors *) my_malloc(sizeof(*new_error), MYF(MY_WME)); + if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error), + MYF(MY_WME)))) + DBUG_RETURN(0); if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 0)) DBUG_RETURN(0); /* OOM: Fatal error */ @@ -992,7 +1056,7 @@ static struct languages *parse_charset_string(char *str) static void print_version(void) { DBUG_ENTER("print_version"); - printf("%s (Compile errormessage) Ver %s\n", my_progname, "2.0"); + printf("%s (Compile errormessage) Ver %s\n", my_progname, "3.0"); DBUG_VOID_RETURN; } diff --git a/extra/innochecksum.c b/extra/innochecksum.c index b55b510b888..ed4dfc48789 100644 --- a/extra/innochecksum.c +++ b/extra/innochecksum.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2011, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 55d3d1f8597..7558d6d00ae 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -1,6 +1,5 @@ - /* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2011, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,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"; @@ -51,34 +55,36 @@ static struct my_option my_long_options[] = {"config-file", 'c', "Deprecated, please use --defaults-file instead. " "Name of config file to read; if no extension is given, default " "extension (e.g., .ini or .cnf) will be added", - &config_file, &config_file, 0, GET_STR, REQUIRED_ARG, + (char**) &config_file, (char**) &config_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef DBUG_OFF {"debug", '#', "This is a non-debug version. Catch this and exit", 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, #else - {"debug", '#', "Output debug log", &default_dbug_option, - &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"debug", '#', "Output debug log", (char**) &default_dbug_option, + (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif {"defaults-file", 'c', "Like --config-file, except: if first option, " "then read this file only, do not read global or per-user config " "files; should be the first option", - &config_file, &config_file, 0, GET_STR, REQUIRED_ARG, + (char**) &config_file, (char*) &config_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"defaults-extra-file", 'e', "Read this file after the global config file and before the config " "file in the users home directory; should be the first option", - &my_defaults_extra_file, &my_defaults_extra_file, 0, + (void *)&my_defaults_extra_file, (void *)&my_defaults_extra_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"defaults-group-suffix", 'g', "In addition to the given groups, read also groups with this suffix", - &my_defaults_group_suffix, &my_defaults_group_suffix, + (char**) &my_defaults_group_suffix, (char**) &my_defaults_group_suffix, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"extra-file", 'e', "Deprecated. Synonym for --defaults-extra-file.", - &my_defaults_extra_file, - &my_defaults_extra_file, 0, GET_STR, + (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.", @@ -99,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 mysql\n", my_progname); + printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname); + exit(0); } @@ -116,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; @@ -142,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; } @@ -154,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; @@ -170,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))) { @@ -199,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/mysql_waitpid.c b/extra/mysql_waitpid.c index 23177eb51cb..7777da25aa1 100644 --- a/extra/mysql_waitpid.c +++ b/extra/mysql_waitpid.c @@ -1,4 +1,5 @@ -/* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. +/* + Copyright (c) 2003, 2010, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/perror.c b/extra/perror.c index 89a33393aea..de8a9b8a0c3 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2012, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -420,6 +420,8 @@ int main(int argc,char *argv[]) if (unknown_error) free(unknown_error); + my_handler_error_unregister(); + my_end(0); exit(error); return error; } diff --git a/extra/replace.c b/extra/replace.c index 53bc1fd925a..8aef9f9a0a0 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2011, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -138,6 +138,7 @@ int main(int argc, char *argv[]) } } free_buffer(); + my_free(replace); my_end(verbose ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR); exit(error ? 2 : 0); return 0; /* No compiler warning */ @@ -1086,7 +1087,7 @@ static int convert_file(REPLACE *rep, char * name) my_fclose(in,MYF(0)); my_fclose(out,MYF(0)); if (updated && ! error) - my_redel(org_name,tempname,MYF(MY_WME | MY_LINK_WARNING)); + my_redel(org_name, tempname, 0, MYF(MY_WME | MY_LINK_WARNING)); else my_delete(tempname,MYF(MY_WME)); if (!silent && ! error) diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index 3422b7ef4de..dd77e1785d0 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -1,4 +1,5 @@ -/* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. +/* + Copyright (c) 2001, 2010, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/resolveip.c b/extra/resolveip.c index f69aa7fec5f..b6840d9d463 100644 --- a/extra/resolveip.c +++ b/extra/resolveip.c @@ -1,4 +1,5 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* + Copyright (c) 2000, 2010, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,9 +25,7 @@ #ifndef WIN32 # include <sys/types.h> # include <sys/socket.h> -# ifndef HAVE_BROKEN_NETINET_INCLUDES -# include <netinet/in.h> -# endif +# include <netinet/in.h> # include <arpa/inet.h> # include <netdb.h> #endif diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp index 6f3ea1c6ad3..f93727aa9f3 100644 --- a/extra/yassl/include/yassl_int.hpp +++ b/extra/yassl/include/yassl_int.hpp @@ -440,7 +440,7 @@ public: const Ciphers& GetCiphers() const; const DH_Parms& GetDH_Parms() const; const Stats& GetStats() const; - const VerifyCallback getVerifyCallback() const; + VerifyCallback getVerifyCallback() const; pem_password_cb GetPasswordCb() const; void* GetUserData() const; bool GetSessionCacheOff() const; diff --git a/extra/yassl/src/buffer.cpp b/extra/yassl/src/buffer.cpp index 6f356e9fd4f..ec35f1760e7 100644 --- a/extra/yassl/src/buffer.cpp +++ b/extra/yassl/src/buffer.cpp @@ -21,6 +21,9 @@ * with SSL types and sockets */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <string.h> // memcpy #include "runtime.hpp" diff --git a/extra/yassl/src/crypto_wrapper.cpp b/extra/yassl/src/crypto_wrapper.cpp index d8952d0daf0..03e69ee1520 100644 --- a/extra/yassl/src/crypto_wrapper.cpp +++ b/extra/yassl/src/crypto_wrapper.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -954,7 +954,10 @@ x509* PemToDer(FILE* file, CertType type, EncryptedInfo* info) } } // get blank line - if (fgets(line, sizeof(line), file)) + if (fgets(line,sizeof(line), file) == 0) + { + /* Impossible case */ + } begin = ftell(file); } diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp index b0499a55e14..becc4e5ba83 100644 --- a/extra/yassl/src/ssl.cpp +++ b/extra/yassl/src/ssl.cpp @@ -1626,10 +1626,10 @@ unsigned long ERR_get_error() } - int SSL_CTX_use_certificate_chain_file(SSL_CTX*, const char*) + int SSL_CTX_use_certificate_chain_file(SSL_CTX* ctx, const char* file) { - // TDOD: - return SSL_SUCCESS; + // For the moment, treat like use_certificate_file + return read_file(ctx, file, SSL_FILETYPE_PEM, Cert); } diff --git a/extra/yassl/src/timer.cpp b/extra/yassl/src/timer.cpp index c1286b0724c..945cc8c8b0b 100644 --- a/extra/yassl/src/timer.cpp +++ b/extra/yassl/src/timer.cpp @@ -24,7 +24,7 @@ #include "timer.hpp" #ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 #include <windows.h> #else #include <sys/time.h> diff --git a/extra/yassl/src/yassl_error.cpp b/extra/yassl/src/yassl_error.cpp index 62fec6b3b23..2d42e82ab4a 100644 --- a/extra/yassl/src/yassl_error.cpp +++ b/extra/yassl/src/yassl_error.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp index 692190d3a75..d943775101b 100644 --- a/extra/yassl/src/yassl_imp.cpp +++ b/extra/yassl/src/yassl_imp.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index 73f8f2330c5..65e17b01544 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1852,7 +1852,7 @@ SSL_CTX::GetCA_List() const } -const VerifyCallback SSL_CTX::getVerifyCallback() const +VerifyCallback SSL_CTX::getVerifyCallback() const { return verifyCallback_; } diff --git a/extra/yassl/taocrypt/benchmark/benchmark.cpp b/extra/yassl/taocrypt/benchmark/benchmark.cpp index 1051b2a4a20..834f340b651 100644 --- a/extra/yassl/taocrypt/benchmark/benchmark.cpp +++ b/extra/yassl/taocrypt/benchmark/benchmark.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2006, 2012, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,6 +19,10 @@ // benchmark.cpp // TaoCrypt benchmark +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <string.h> #include <stdio.h> diff --git a/extra/yassl/taocrypt/include/block.hpp b/extra/yassl/taocrypt/include/block.hpp index d7a69211e02..601d9dbce57 100644 --- a/extra/yassl/taocrypt/include/block.hpp +++ b/extra/yassl/taocrypt/include/block.hpp @@ -163,7 +163,8 @@ public: void CleanNew(word32 newSize) { New(newSize); - memset(buffer_, 0, sz_ * sizeof(T)); + if (sz_ > 0) + memset(buffer_, 0, sz_ * sizeof(T)); } void New(word32 newSize) diff --git a/extra/yassl/taocrypt/include/blowfish.hpp b/extra/yassl/taocrypt/include/blowfish.hpp index 1f8d0589234..347cf05de4b 100644 --- a/extra/yassl/taocrypt/include/blowfish.hpp +++ b/extra/yassl/taocrypt/include/blowfish.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2006, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/taocrypt/include/file.hpp b/extra/yassl/taocrypt/include/file.hpp index 820fd8ff431..c340c4fa3ea 100644 --- a/extra/yassl/taocrypt/include/file.hpp +++ b/extra/yassl/taocrypt/include/file.hpp @@ -117,7 +117,7 @@ public: word32 size(bool use_current = false); private: - void put(Source&); + size_t put(Source&); FileSink(const FileSink&); // hide FileSink& operator=(const FileSink&); // hide diff --git a/extra/yassl/taocrypt/include/misc.hpp b/extra/yassl/taocrypt/include/misc.hpp index 1382d3690fb..4c8926483e2 100644 --- a/extra/yassl/taocrypt/include/misc.hpp +++ b/extra/yassl/taocrypt/include/misc.hpp @@ -136,9 +136,13 @@ void CleanUp(); // Turn on ia32 ASM for Big Integer // CodeWarrior defines _MSC_VER +// +// Do not use assembler with GCC, as the implementation for it is broken; +// it does not use proper GCC asm contraints and makes assumptions about +// frame pointers and so on, which breaks depending on GCC version and +// optimization level. #if !defined(TAOCRYPT_DISABLE_X86ASM) && ((defined(_MSC_VER) && \ - !defined(__MWERKS__) && defined(_M_IX86)) || \ - (defined(__GNUC__) && defined(__i386__))) + !defined(__MWERKS__) && defined(_M_IX86))) #define TAOCRYPT_X86ASM_AVAILABLE #endif diff --git a/extra/yassl/taocrypt/include/pwdbased.hpp b/extra/yassl/taocrypt/include/pwdbased.hpp index 9025cc1a50c..9b1b62fea45 100644 --- a/extra/yassl/taocrypt/include/pwdbased.hpp +++ b/extra/yassl/taocrypt/include/pwdbased.hpp @@ -51,9 +51,6 @@ word32 PBKDF2_HMAC<T>::DeriveKey(byte* derived, word32 dLen, const byte* pwd, if (dLen > MaxDerivedKeyLength()) return 0; - if (iterations < 0) - return 0; - ByteBlock buffer(T::DIGEST_SIZE); HMAC<T> hmac; diff --git a/extra/yassl/taocrypt/include/runtime.hpp b/extra/yassl/taocrypt/include/runtime.hpp index ef7ce092cde..29c4d2db236 100644 --- a/extra/yassl/taocrypt/include/runtime.hpp +++ b/extra/yassl/taocrypt/include/runtime.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/taocrypt/src/aes.cpp b/extra/yassl/taocrypt/src/aes.cpp index 9b04e7b0dbc..f976650e028 100644 --- a/extra/yassl/taocrypt/src/aes.cpp +++ b/extra/yassl/taocrypt/src/aes.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -51,7 +51,8 @@ void AES::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } - else if (mode_ == CBC) { + else if (mode_ == CBC) + { if (dir_ == ENCRYPTION) while (blocks--) { r_[0] ^= *(word32*)in; diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp index b4086522124..9a37219543e 100644 --- a/extra/yassl/taocrypt/src/algebra.cpp +++ b/extra/yassl/taocrypt/src/algebra.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,6 @@ /* based on Wei Dai's algebra.cpp from CryptoPP */ #undef NDEBUG -#define DEBUG // GCC 4.0 bug if NDEBUG and Optimize > 1 #include "runtime.hpp" #include "algebra.hpp" diff --git a/extra/yassl/taocrypt/src/blowfish.cpp b/extra/yassl/taocrypt/src/blowfish.cpp index cedae6af281..864f8bac260 100644 --- a/extra/yassl/taocrypt/src/blowfish.cpp +++ b/extra/yassl/taocrypt/src/blowfish.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2006, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,7 +53,8 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } - else if (mode_ == CBC) { + else if (mode_ == CBC) + { if (dir_ == ENCRYPTION) while (blocks--) { r_[0] ^= *(word32*)in; diff --git a/extra/yassl/taocrypt/src/coding.cpp b/extra/yassl/taocrypt/src/coding.cpp index bc4727cc5e3..8f317a484d8 100644 --- a/extra/yassl/taocrypt/src/coding.cpp +++ b/extra/yassl/taocrypt/src/coding.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/taocrypt/src/dsa.cpp b/extra/yassl/taocrypt/src/dsa.cpp index bf116d3e48d..72221441b2b 100644 --- a/extra/yassl/taocrypt/src/dsa.cpp +++ b/extra/yassl/taocrypt/src/dsa.cpp @@ -184,7 +184,7 @@ word32 DSA_Signer::Sign(const byte* sha_digest, byte* sig, s_ = (kInv * (H + x*r_)) % q; if (!(!!r_ && !!s_)) - return -1; + return (word32) -1; int rSz = r_.ByteCount(); diff --git a/extra/yassl/taocrypt/src/file.cpp b/extra/yassl/taocrypt/src/file.cpp index 0498038a04b..88ead8e550e 100644 --- a/extra/yassl/taocrypt/src/file.cpp +++ b/extra/yassl/taocrypt/src/file.cpp @@ -98,9 +98,9 @@ FileSink::~FileSink() // fill source from file sink -void FileSink::put(Source& source) +size_t FileSink::put(Source& source) { - fwrite(source.get_buffer(), 1, source.size(), file_); + return fwrite(source.get_buffer(), 1, source.size(), file_); } diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index bfced6d0c74..15deb59d4f3 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/extra/yassl/taocrypt/src/misc.cpp b/extra/yassl/taocrypt/src/misc.cpp index b576d3d59d2..e410cfe1946 100644 --- a/extra/yassl/taocrypt/src/misc.cpp +++ b/extra/yassl/taocrypt/src/misc.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -175,6 +175,15 @@ word Crop(word value, unsigned int size) #ifdef TAOCRYPT_X86ASM_AVAILABLE +#ifdef NOT_USED +#ifndef _MSC_VER + static jmp_buf s_env; + static void SigIllHandler(int) + { + longjmp(s_env, 1); + } +#endif +#endif bool HaveCpuId() { diff --git a/extra/yassl/taocrypt/src/twofish.cpp b/extra/yassl/taocrypt/src/twofish.cpp index 235b712b7c5..bf57f5dde44 100644 --- a/extra/yassl/taocrypt/src/twofish.cpp +++ b/extra/yassl/taocrypt/src/twofish.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2006, 2012, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,7 +54,8 @@ void Twofish::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } - else if (mode_ == CBC) { + else if (mode_ == CBC) + { if (dir_ == ENCRYPTION) while (blocks--) { r_[0] ^= *(word32*)in; diff --git a/extra/yassl/taocrypt/test/test.cpp b/extra/yassl/taocrypt/test/test.cpp index 0643b79e51b..00547d0f963 100644 --- a/extra/yassl/taocrypt/test/test.cpp +++ b/extra/yassl/taocrypt/test/test.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2006, 2012, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,6 +19,10 @@ // test.cpp // test taocrypt functionality +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <string.h> #include <stdio.h> diff --git a/extra/yassl/testsuite/test.hpp b/extra/yassl/testsuite/test.hpp index 7f49565b1f0..33f398ae269 100644 --- a/extra/yassl/testsuite/test.hpp +++ b/extra/yassl/testsuite/test.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2006, 2012, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by |