diff options
Diffstat (limited to 'extra')
35 files changed, 327 insertions, 448 deletions
diff --git a/extra/.cvsignore b/extra/.cvsignore deleted file mode 100644 index e0042c405cc..00000000000 --- a/extra/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -comp_err -my_print_defaults -perror -print_defaults -replace -resolveip diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index cec0db6a4ae..a569641a198 100755..100644 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2006 MySQL AB +# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -11,45 +11,71 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake") +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") -SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") +INCLUDE_DIRECTORIES( +${CMAKE_SOURCE_DIR}/include +${ZLIB_INCLUDE_DIR} +# Following is for perror, in case NDB is compiled in. +${CMAKE_SOURCE_DIR}/storage/ndb/include +${CMAKE_SOURCE_DIR}/storage/ndb/include/util +${CMAKE_SOURCE_DIR}/storage/ndb/include/ndbapi +${CMAKE_SOURCE_DIR}/storage/ndb/include/portlib +${CMAKE_SOURCE_DIR}/storage/ndb/include/mgmapi) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) +# Default install component for the files is Server here +SET(MYSQL_INSTALL_COMPONENT Server) -ADD_EXECUTABLE(comp_err comp_err.c) -TARGET_LINK_LIBRARIES(comp_err debug dbug mysys strings zlib wsock32) +IF(NOT CMAKE_CROSSCOMPILING) + ADD_EXECUTABLE(comp_err comp_err.c) + TARGET_LINK_LIBRARIES(comp_err mysys) +ENDIF() -GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION) - -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_error.h - COMMAND ${COMP_ERR_EXE} +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_SOURCE_DIR}/sql/share/ - --header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h - --name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h - --state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h - --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt - DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt) + --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) ADD_CUSTOM_TARGET(GenError ALL - DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h) + DEPENDS + ${PROJECT_BINARY_DIR}/include/mysqld_error.h + ${PROJECT_BINARY_DIR}/sql/share/english/errmsg.sys + ${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt) + +MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) +TARGET_LINK_LIBRARIES(my_print_defaults mysys) + +MYSQL_ADD_EXECUTABLE(perror perror.c) +ADD_DEPENDENCIES(perror GenError) +TARGET_LINK_LIBRARIES(perror mysys) + +MYSQL_ADD_EXECUTABLE(resolveip resolveip.c) +TARGET_LINK_LIBRARIES(resolveip mysys) +IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") + INCLUDE(CheckFunctionExists) + INCLUDE(CheckLibraryExists) + MY_SEARCH_LIBS(inet_aton "nsl;socket;resolv" SOLARIS_NSL) + TARGET_LINK_LIBRARIES(resolveip ${SOLARIS_NSL}) +ENDIF() -ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) -TARGET_LINK_LIBRARIES(my_print_defaults strings mysys debug dbug taocrypt wsock32) -ADD_EXECUTABLE(perror perror.c) -TARGET_LINK_LIBRARIES(perror strings mysys debug dbug wsock32) +MYSQL_ADD_EXECUTABLE(replace replace.c) +TARGET_LINK_LIBRARIES(replace mysys) +IF(UNIX) + MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.c) -ADD_EXECUTABLE(resolveip resolveip.c) -TARGET_LINK_LIBRARIES(resolveip strings mysys debug dbug wsock32) + MYSQL_ADD_EXECUTABLE(resolve_stack_dump resolve_stack_dump.c) + TARGET_LINK_LIBRARIES(resolve_stack_dump mysys) -ADD_EXECUTABLE(replace replace.c) -TARGET_LINK_LIBRARIES(replace strings mysys debug dbug wsock32) + MYSQL_ADD_EXECUTABLE(mysql_waitpid mysql_waitpid.c) + TARGET_LINK_LIBRARIES(mysql_waitpid mysys) +ENDIF() -IF(EMBED_MANIFESTS) - MYSQL_EMBED_MANIFEST("myTest" "asInvoker") -ENDIF(EMBED_MANIFESTS) diff --git a/extra/Makefile.am b/extra/Makefile.am deleted file mode 100644 index 75422c4ee11..00000000000 --- a/extra/Makefile.am +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (C) 2000-2006 MySQL 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ - -I$(top_srcdir)/sql -LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \ - ../dbug/libdbug.a ../strings/libmystrings.a \ - $(ZLIB_LIBS) -BUILT_SOURCES= $(top_builddir)/include/mysqld_error.h \ - $(top_builddir)/include/sql_state.h \ - $(top_builddir)/include/mysqld_ername.h -pkginclude_HEADERS= $(BUILT_SOURCES) -DISTCLEANFILES = $(BUILT_SOURCES) -SUBDIRS = @yassl_dir@ -DIST_SUBDIRS = yassl - -# This will build mysqld_error.h, mysqld_ername.h and sql_state.h -# NOTE Built files should depend on their sources to avoid -# the built files being rebuilt in source dist -$(top_builddir)/include/mysqld_error.h: comp_err.c \ - $(top_srcdir)/sql/share/errmsg.txt - $(MAKE) $(AM_MAKEFLAGS) comp_err$(EXEEXT) - $(top_builddir)/extra/comp_err$(EXEEXT) \ - --charset=$(top_srcdir)/sql/share/charsets \ - --out-dir=$(top_builddir)/sql/share/ \ - --header_file=$(top_builddir)/include/mysqld_error.h \ - --name_file=$(top_builddir)/include/mysqld_ername.h \ - --state_file=$(top_builddir)/include/sql_state.h \ - --in_file=$(top_srcdir)/sql/share/errmsg.txt -$(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h -$(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h - -bin_PROGRAMS = replace perror resolveip my_print_defaults \ - resolve_stack_dump mysql_waitpid -# "innochecksum" should be switched -if BUILD_INNODB_TOOLS -bin_PROGRAMS += innochecksum -endif - -noinst_PROGRAMS = charset2html -EXTRA_PROGRAMS = comp_err -EXTRA_DIST = CMakeLists.txt - -perror.o: perror.c - $(COMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $< - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/extra/comp_err.c b/extra/comp_err.c index 895524ac453..bf100fdef85 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 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 @@ -41,7 +41,7 @@ static char *OUTFILE= (char*) "errmsg.sys"; static char *HEADERFILE= (char*) "mysqld_error.h"; static char *NAMEFILE= (char*) "mysqld_ername.h"; static char *STATEFILE= (char*) "sql_state.h"; -static char *TXTFILE= (char*) "../sql/share/errmsg.txt"; +static char *TXTFILE= (char*) "../sql/share/errmsg-utf8.txt"; static char *DATADIRECTORY= (char*) "../sql/share/"; #ifndef DBUG_OFF static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace"; @@ -199,13 +199,35 @@ int main(int argc, char *argv[]) } +static void print_escaped_string(FILE *f, const char *str) +{ + const char *tmp = str; + + while (tmp[0] != 0) + { + switch (tmp[0]) + { + case '\\': fprintf(f, "\\\\"); break; + case '\'': fprintf(f, "\\\'"); break; + case '\"': fprintf(f, "\\\""); break; + case '\n': fprintf(f, "\\n"); break; + case '\r': fprintf(f, "\\r"); break; + default: fprintf(f, "%c", tmp[0]); + } + tmp++; + } +} + + static int create_header_files(struct errors *error_head) { - uint er_last; + uint er_last= 0; FILE *er_definef, *sql_statef, *er_namef; struct errors *tmp_error; + struct message *er_msg; + const char *er_text; + DBUG_ENTER("create_header_files"); - LINT_INIT(er_last); if (!(er_definef= my_fopen(HEADERFILE, O_WRONLY, MYF(MY_WME)))) { @@ -245,9 +267,12 @@ static int create_header_files(struct errors *error_head) "{ %-40s,\"%s\", \"%s\" },\n", tmp_error->er_name, tmp_error->sql_code1, tmp_error->sql_code2); /*generating er_name file */ - fprintf(er_namef, "{ \"%s\", %d },\n", tmp_error->er_name, - tmp_error->d_code); - + er_msg= find_message(tmp_error, default_language, 0); + er_text = (er_msg ? er_msg->text : ""); + fprintf(er_namef, "{ \"%s\", %d, \"", tmp_error->er_name, + tmp_error->d_code); + print_escaped_string(er_namef, er_text); + fprintf(er_namef, "\" },\n"); } /* finishing off with mysqld_error.h */ fprintf(er_definef, "#define ER_ERROR_LAST %d\n", er_last); @@ -363,15 +388,15 @@ static void clean_up(struct languages *lang_head, struct errors *error_head) struct errors *tmp_error, *next_error; uint count, i; - my_free((uchar*) default_language, MYF(0)); + my_free((void*) default_language); for (tmp_lang= lang_head; tmp_lang; tmp_lang= next_language) { next_language= tmp_lang->next_lang; - my_free(tmp_lang->lang_short_name, MYF(0)); - my_free(tmp_lang->lang_long_name, MYF(0)); - my_free(tmp_lang->charset, MYF(0)); - my_free((uchar*) tmp_lang, MYF(0)); + my_free(tmp_lang->lang_short_name); + my_free(tmp_lang->lang_long_name); + my_free(tmp_lang->charset); + my_free(tmp_lang); } for (tmp_error= error_head; tmp_error; tmp_error= next_error) @@ -382,17 +407,17 @@ static void clean_up(struct languages *lang_head, struct errors *error_head) { struct message *tmp; tmp= dynamic_element(&tmp_error->msg, i, struct message*); - my_free((uchar*) tmp->lang_short_name, MYF(0)); - my_free((uchar*) tmp->text, MYF(0)); + my_free(tmp->lang_short_name); + my_free(tmp->text); } delete_dynamic(&tmp_error->msg); if (tmp_error->sql_code1[0]) - my_free((uchar*) tmp_error->sql_code1, MYF(0)); + my_free((void*) tmp_error->sql_code1); if (tmp_error->sql_code2[0]) - my_free((uchar*) tmp_error->sql_code2, MYF(0)); - my_free((uchar*) tmp_error->er_name, MYF(0)); - my_free((uchar*) tmp_error, MYF(0)); + my_free((void*) tmp_error->sql_code2); + my_free((void*) tmp_error->er_name); + my_free(tmp_error); } } @@ -535,7 +560,7 @@ static uint parse_error_offset(char *str) end= 0; ioffset= (uint) my_strtoll10(soffset, &end, &error); - my_free((uchar*) soffset, MYF(0)); + my_free(soffset); DBUG_RETURN(ioffset); } @@ -660,7 +685,7 @@ static ha_checksum checksum_format_specifier(const char* msg) case 'u': case 'x': case 's': - chksum= my_checksum(chksum, start, (uint) (p + 1 - start)); + chksum= my_checksum(chksum, (uchar*) start, (uint) (p + 1 - start)); start= 0; /* Not in format specifier anymore */ break; @@ -1039,11 +1064,11 @@ static char *parse_text_line(char *pos) switch (*++pos) { case '\\': case '"': - VOID(memmove (pos - 1, pos, len - (row - pos))); + (void) memmove (pos - 1, pos, len - (row - pos)); break; case 'n': pos[-1]= '\n'; - VOID(memmove (pos, pos + 1, len - (row - pos))); + (void) memmove (pos, pos + 1, len - (row - pos)); break; default: if (*pos >= '0' && *pos < '8') @@ -1053,10 +1078,10 @@ static char *parse_text_line(char *pos) nr= nr * 8 + (*(pos++) - '0'); pos -= i; pos[-1]= nr; - VOID(memmove (pos, pos + i, len - (row - pos))); + (void) memmove (pos, pos + i, len - (row - pos)); } else if (*pos) - VOID(memmove (pos - 1, pos, len - (row - pos))); /* Remove '\' */ + (void) memmove (pos - 1, pos, len - (row - pos)); /* Remove '\' */ } } else diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index c9a845b9524..55d3d1f8597 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -1,6 +1,6 @@ /* - Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 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 @@ -91,9 +91,6 @@ static struct my_option my_long_options[] = }; - -#include <help_start.h> - static void usage(my_bool version) { printf("%s Ver 1.6 for %s at %s\n",my_progname,SYSTEM_TYPE, @@ -109,8 +106,6 @@ static void usage(my_bool version) printf("\nExample usage:\n%s --defaults-file=example.cnf client mysql\n", my_progname); } -#include <help_end.h> - static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -196,12 +191,14 @@ int main(int argc, char **argv) config_file); } error= 2; + exit(error); } for (argument= arguments+1 ; *argument ; argument++) - puts(*argument); - my_free((char*) load_default_groups,MYF(0)); + if (!my_getopt_is_args_separator(*argument)) /* skip arguments separator */ + puts(*argument); + my_free(load_default_groups); free_defaults(arguments); - exit(error); + exit(0); } diff --git a/extra/mysql_waitpid.c b/extra/mysql_waitpid.c index 7aae2674bfd..23177eb51cb 100644 --- a/extra/mysql_waitpid.c +++ b/extra/mysql_waitpid.c @@ -1,5 +1,4 @@ -/* - Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 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 @@ -12,13 +11,10 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Wait until a program dies */ -#ifndef __NETWARE__ - #include <my_global.h> #include <m_string.h> #include <my_sys.h> @@ -105,15 +101,3 @@ void usage(void) my_print_help(my_long_options); exit(-1); } - -#else - -#include <stdio.h> - -main() -{ - fprintf(stderr,"This tool has not been ported to NetWare\n"); - return 0; -} - -#endif /* __NETWARE__ */ diff --git a/extra/perror.c b/extra/perror.c index d8e3c3a59a8..89a33393aea 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -12,8 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Return error-text for system error messages and handler messages */ @@ -35,6 +34,7 @@ static my_bool verbose, print_all_codes; #include "../include/my_base.h" #include "../mysys/my_handler_errors.h" +// #include "../include/my_compare.h" #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE static my_bool ndb_code; @@ -66,7 +66,8 @@ static struct my_option my_long_options[] = &ndb_code, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif #ifdef HAVE_SYS_ERRLIST - {"all", 'a', "Print all the error messages and the number.", + {"all", 'a', "Print all the error messages and the number. Deprecated," + " will be removed in a future release.", &print_all_codes, &print_all_codes, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif @@ -104,8 +105,6 @@ static HA_ERRORS ha_errlist[]= }; -#include <help_start.h> - static void print_version(void) { printf("%s Ver %s, for %s (%s)\n",my_progname,PERROR_VERSION, @@ -124,8 +123,6 @@ static void usage(void) my_print_variables(my_long_options); } -#include <help_end.h> - static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -186,36 +183,45 @@ static const char *get_ha_error_msg(int code) return NullS; } +typedef struct +{ + const char *name; + uint code; + const char *text; +} st_error; -/* - Register handler error messages for usage with my_error() +static st_error global_error_names[] = +{ +#include <mysqld_ername.h> + { 0, 0, 0 } +}; - NOTES - This is safe to call multiple times as my_error_register() - will ignore calls to register already registered error numbers. +/** + Lookup an error by code in the global_error_names array. + @param code the code to lookup + @param [out] name_ptr the error name, when found + @param [out] msg_ptr the error text, when found + @return 1 when found, otherwise 0 */ -void my_handler_error_register(void) +int get_ER_error_msg(uint code, const char **name_ptr, const char **msg_ptr) { - /* - If you got compilation error here about compile_time_assert array, check - that every HA_ERR_xxx constant has a corresponding error message in - handler_error_messages[] list (check mysys/ma_handler_errors.h and - include/my_base.h). - */ - compile_time_assert(HA_ERR_FIRST + array_elements(handler_error_messages) == - HA_ERR_LAST + 1); - my_error_register(handler_error_messages, HA_ERR_FIRST, - HA_ERR_FIRST+ array_elements(handler_error_messages)-1); -} + st_error *tmp_error; + tmp_error= & global_error_names[0]; -void my_handler_error_unregister(void) -{ - my_error_unregister(HA_ERR_FIRST, - HA_ERR_FIRST+ array_elements(handler_error_messages)-1); -} - + while (tmp_error->name != NULL) + { + if (tmp_error->code == code) + { + *name_ptr= tmp_error->name; + *msg_ptr= tmp_error->text; + return 1; + } + tmp_error++; + } + return 0; +} #if defined(__WIN__) static my_bool print_win_error_msg(DWORD error, my_bool verbose) @@ -237,12 +243,45 @@ static my_bool print_win_error_msg(DWORD error, my_bool verbose) } #endif +/* + Register handler error messages for usage with my_error() + + NOTES + This is safe to call multiple times as my_error_register() + will ignore calls to register already registered error numbers. +*/ + +static const char **get_handler_error_messages() +{ + return handler_error_messages; +} + +void my_handler_error_register(void) +{ + /* + If you got compilation error here about compile_time_assert array, check + that every HA_ERR_xxx constant has a corresponding error message in + handler_error_messages[] list (check mysys/ma_handler_errors.h and + include/my_base.h). + */ + compile_time_assert(HA_ERR_FIRST + array_elements(handler_error_messages) == + HA_ERR_LAST + 1); + my_error_register(get_handler_error_messages, HA_ERR_FIRST, + HA_ERR_FIRST+ array_elements(handler_error_messages)-1); +} +void my_handler_error_unregister(void) +{ + my_error_unregister(HA_ERR_FIRST, + HA_ERR_FIRST+ array_elements(handler_error_messages)-1); +} + int main(int argc,char *argv[]) { int error,code,found; const char *msg; + const char *name; char *unknown_error = 0; #if defined(__WIN__) my_bool skip_win_message= 0; @@ -259,9 +298,11 @@ int main(int argc,char *argv[]) if (print_all_codes) { HA_ERRORS *ha_err_ptr; + printf("WARNING: option '-a/--all' is deprecated and will be removed in a" + " future release.\n"); for (code=1 ; code < sys_nerr ; code++) { - if (sys_errlist[code][0]) + if (sys_errlist[code] && sys_errlist[code][0]) { /* Skip if no error-text */ printf("%3d = %s\n",code,sys_errlist[code]); } @@ -273,7 +314,7 @@ int main(int argc,char *argv[]) #endif { /* - On some system, like NETWARE, strerror(unknown_error) returns a + On some system, like Linux, strerror(unknown_error) returns a string 'Unknown Error'. To avoid printing it we try to find the error string by asking for an impossible big error message. @@ -348,6 +389,14 @@ int main(int argc,char *argv[]) else puts(msg); } + if (get_ER_error_msg(code, & name, & msg)) + { + found= 1; + if (verbose) + printf("MySQL error code %3d (%s): %s\n", code, name, msg); + else + puts(msg); + } if (!found) { #if defined(__WIN__) diff --git a/extra/replace.c b/extra/replace.c index 35739a60dca..53bc1fd925a 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -13,8 +13,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + 02110-1301 USA */ /* Replace strings in textfile @@ -42,7 +42,6 @@ fill_buffer_retaining() is taken from gnu-grep and modified. */ -#define DONT_USE_RAID #include <my_global.h> #include <m_ctype.h> #include <my_sys.h> @@ -55,7 +54,7 @@ typedef struct st_pointer_array { /* when using array-strings */ TYPELIB typelib; /* Pointer to strings */ uchar *str; /* Strings is here */ - int7 *flag; /* Flag about each var. */ + uint8 *flag; /* Flag about each var. */ uint array_allocs,max_count,length,max_length; } POINTER_ARRAY; @@ -265,12 +264,12 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name) if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD), MYF(MY_WME)))) { - my_free((uchar*) pa->typelib.type_names,MYF(0)); + my_free(pa->typelib.type_names); DBUG_RETURN (-1); } pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+ sizeof(*pa->flag)); - pa->flag= (int7*) (pa->typelib.type_names+pa->max_count); + pa->flag= (uint8*) (pa->typelib.type_names+pa->max_count); pa->length=0; pa->max_length=PS_MALLOC-MALLOC_OVERHEAD; pa->array_allocs=1; @@ -307,14 +306,14 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name) pa->typelib.type_names=new_array; old_count=pa->max_count; pa->max_count=len/(sizeof(uchar*) + sizeof(*pa->flag)); - pa->flag= (int7*) (pa->typelib.type_names+pa->max_count); + pa->flag= (uint8*) (pa->typelib.type_names+pa->max_count); memcpy((uchar*) pa->flag,(char *) (pa->typelib.type_names+old_count), old_count*sizeof(*pa->flag)); } pa->flag[pa->typelib.count]=0; /* Reset flag */ pa->typelib.type_names[pa->typelib.count++]= (char*) (pa->str+pa->length); pa->typelib.type_names[pa->typelib.count]= NullS; /* Put end-mark */ - VOID(strmov((char*) pa->str + pa->length, name)); + (void) strmov((char*) pa->str + pa->length, name); pa->length+=length; DBUG_RETURN(0); } /* insert_pointer_name */ @@ -327,9 +326,9 @@ static void free_pointer_array(reg1 POINTER_ARRAY *pa) if (pa->typelib.count) { pa->typelib.count=0; - my_free((uchar*) pa->typelib.type_names,MYF(0)); + my_free(pa->typelib.type_names); pa->typelib.type_names=0; - my_free((uchar*) pa->str,MYF(0)); + my_free(pa->str); } return; } /* free_pointer_array */ @@ -436,7 +435,7 @@ static REPLACE *init_replace(char * *from, char * *to,uint count, free_sets(&sets); DBUG_RETURN(0); } - VOID(make_new_set(&sets)); /* Set starting set */ + (void) make_new_set(&sets); /* Set starting set */ make_sets_invisible(&sets); /* Hide previus sets */ used_sets=-1; word_states=make_new_set(&sets); /* Start of new word */ @@ -444,7 +443,7 @@ static REPLACE *init_replace(char * *from, char * *to,uint count, if (!(follow=(FOLLOWS*) my_malloc((states+2)*sizeof(FOLLOWS),MYF(MY_WME)))) { free_sets(&sets); - my_free((uchar*) found_set,MYF(0)); + my_free(found_set); DBUG_RETURN(0); } @@ -666,9 +665,9 @@ static REPLACE *init_replace(char * *from, char * *to,uint count, replace[i].next[j]=(REPLACE*) (rep_str+(-sets.set[i].next[j]-1)); } } - my_free((uchar*) follow,MYF(0)); + my_free(follow); free_sets(&sets); - my_free((uchar*) found_set,MYF(0)); + my_free(found_set); DBUG_PRINT("exit",("Replace table has %d states",sets.count)); DBUG_RETURN(replace); } @@ -684,7 +683,7 @@ static int init_sets(REP_SETS *sets,uint states) if (!(sets->bit_buffer=(uint*) my_malloc(sizeof(uint)*sets->size_of_bits* SET_MALLOC_HUNC,MYF(MY_WME)))) { - my_free((uchar*) sets->set,MYF(0)); + my_free(sets->set); return 1; } return 0; @@ -745,8 +744,8 @@ static void free_last_set(REP_SETS *sets) static void free_sets(REP_SETS *sets) { - my_free((uchar*)sets->set_buffer,MYF(0)); - my_free((uchar*)sets->bit_buffer,MYF(0)); + my_free(sets->set_buffer); + my_free(sets->bit_buffer); return; } @@ -953,8 +952,8 @@ static void reset_buffer() static void free_buffer() { - my_free(buffer,MYF(MY_WME)); - my_free(out_buff,MYF(MY_WME)); + my_free(buffer); + my_free(out_buff); } diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index 70741eff6c7..3422b7ef4de 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -1,5 +1,4 @@ -/* - Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 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 @@ -12,14 +11,12 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Resolve numeric stack dump produced by mysqld 3.23.30 and later versions into symbolic names. By Sasha Pachev <sasha@mysql.com> */ -#define DONT_USE_RAID #include <my_global.h> #include <m_ctype.h> #include <my_sys.h> @@ -67,8 +64,6 @@ static struct my_option my_long_options[] = static void verify_sort(); -#include <help_start.h> - static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,DUMP_VERSION, @@ -92,8 +87,6 @@ The numeric-dump-file should contain a numeric stack trace from mysqld.\n\ If the numeric-dump-file is not given, the stack trace is read from stdin.\n"); } -#include <help_end.h> - static void die(const char* fmt, ...) { diff --git a/extra/resolveip.c b/extra/resolveip.c index 6a80fd7768a..f69aa7fec5f 100644 --- a/extra/resolveip.c +++ b/extra/resolveip.c @@ -1,5 +1,4 @@ -/* - Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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 @@ -12,8 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Resolves IP's to hostname and hostnames to IP's */ @@ -157,11 +155,8 @@ int main(int argc, char **argv) else { printf ("Host name of %s is %s", ip,hpaddr->h_name); -#ifndef __NETWARE__ - /* this information is not available on NetWare */ for (q = hpaddr->h_aliases; *q != 0; q++) (void) printf(", %s", *q); -#endif /* __NETWARE__ */ puts(""); } } diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt index eda5c3d4652..46e1abbc08e 100644 --- a/extra/yassl/CMakeLists.txt +++ b/extra/yassl/CMakeLists.txt @@ -11,18 +11,30 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/extra/yassl/include - ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include - ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL) - -ADD_DEFINITIONS("-D_LIB -DYASSL_PREFIX -DYASSL_THREAD_SAFE") +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/extra/yassl/include + ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include + ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL) +ADD_DEFINITIONS(${SSL_DEFINES}) +IF(CMAKE_COMPILER_IS_GNUXX) + #Remove -fno-implicit-templates + #(yassl sources cannot be compiled with it) + STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS +${CMAKE_CXX_FLAGS}) +ENDIF() SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp src/yassl_imp.cpp src/yassl_int.cpp) -IF(NOT SOURCE_SUBLIBS) - ADD_LIBRARY(yassl ${YASSL_SOURCES}) - ADD_DEPENDENCIES(yassl GenError) -ENDIF(NOT SOURCE_SUBLIBS) + +IF(HAVE_EXPLICIT_TEMPLATE_INSTANTIATION) + SET(YASSL_SOURCES ${YASSL_SOURCES} src/template_instnt.cpp) +ENDIF() + +ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES}) +RESTRICT_SYMBOL_EXPORTS(yassl) + + diff --git a/extra/yassl/Makefile.am b/extra/yassl/Makefile.am deleted file mode 100644 index 2280e02f537..00000000000 --- a/extra/yassl/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (C) 2005, 2006 MySQL 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -SUBDIRS = taocrypt src testsuite -EXTRA_DIST = CMakeLists.txt - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/extra/yassl/README b/extra/yassl/README index 7720a9453dd..24bdf32f989 100644 --- a/extra/yassl/README +++ b/extra/yassl/README @@ -12,7 +12,16 @@ before calling SSL_new(); *** end Note *** -yaSSL Release notes, version 2.1.2 (9/2/2011) +yaSSL Release notes, version 2.2.2 (7/5/2012) + + This release of yaSSL contains bug fixes and more security checks around + malicious certificates. + +See normal build instructions below under 1.0.6. +See libcurl build instructions below under 1.3.0 and note in 1.5.8. + + +*****************yaSSL Release notes, version 2.1.2 (9/2/2011) This release of yaSSL contains bug fixes, better non-blocking support with SSL_write, and OpenSSL RSA public key format support. diff --git a/extra/yassl/include/lock.hpp b/extra/yassl/include/lock.hpp index ae875001633..487bedfcc70 100644 --- a/extra/yassl/include/lock.hpp +++ b/extra/yassl/include/lock.hpp @@ -27,7 +27,7 @@ Visual Studio Source Annotations header (sourceannotations.h) fails to compile if outside of the global namespace. */ -#ifdef YASSL_THREAD_SAFE +#ifdef MULTI_THREADED #ifdef _WIN32 #include <windows.h> #endif @@ -36,8 +36,9 @@ namespace yaSSL { -#ifdef YASSL_THREAD_SAFE +#ifdef MULTI_THREADED #ifdef _WIN32 + #include <windows.h> class Mutex { CRITICAL_SECTION cs_; @@ -77,7 +78,7 @@ namespace yaSSL { }; #endif // _WIN32 -#else // YASSL_THREAD_SAFE (WE'RE SINGLE) +#else // MULTI_THREADED (WE'RE SINGLE) class Mutex { public: @@ -87,7 +88,7 @@ namespace yaSSL { }; }; -#endif // YASSL_THREAD_SAFE +#endif // MULTI_THREADED diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h index 0d99888da88..2fcba67cfdd 100644 --- a/extra/yassl/include/openssl/ssl.h +++ b/extra/yassl/include/openssl/ssl.h @@ -35,7 +35,7 @@ #include "rsa.h" -#define YASSL_VERSION "2.2.0" +#define YASSL_VERSION "2.2.2" #if defined(__cplusplus) diff --git a/extra/yassl/include/yassl_error.hpp b/extra/yassl/include/yassl_error.hpp index 87bb4c55e96..8efc7f72e87 100644 --- a/extra/yassl/include/yassl_error.hpp +++ b/extra/yassl/include/yassl_error.hpp @@ -65,7 +65,7 @@ enum YasslError { enum Library { yaSSL_Lib = 0, CryptoLib, SocketLib }; enum { MAX_ERROR_SZ = 80 }; -void SetErrorString(unsigned long, char*); +void SetErrorString(YasslError, char*); /* remove for now, if go back to exceptions use this wrapper // Base class for all yaSSL exceptions diff --git a/extra/yassl/src/Makefile.am b/extra/yassl/src/Makefile.am deleted file mode 100644 index 7db36f652ac..00000000000 --- a/extra/yassl/src/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. -# -# 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../taocrypt/include -I$(srcdir)/../taocrypt/mySTL - -noinst_LTLIBRARIES = libyassl.la -libyassl_la_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \ - handshake.cpp lock.cpp log.cpp socket_wrapper.cpp ssl.cpp \ - template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp -EXTRA_DIST = $(wildcard ../include/*.hpp) $(wildcard ../include/openssl/*.h) -AM_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX @yassl_thread_cxxflags@ - -# Don't update the files from bitkeeper -%::SCCS/s.% - diff --git a/extra/yassl/src/cert_wrapper.cpp b/extra/yassl/src/cert_wrapper.cpp index 7e73464001a..917cfa1a8fb 100644 --- a/extra/yassl/src/cert_wrapper.cpp +++ b/extra/yassl/src/cert_wrapper.cpp @@ -250,8 +250,7 @@ int CertManager::Validate() TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length()); TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_); - int err = cert.GetError().What(); - if ( err ) + if (int err = cert.GetError().What()) return err; const TaoCrypt::PublicKey& key = cert.GetPublicKey(); diff --git a/extra/yassl/src/lock.cpp b/extra/yassl/src/lock.cpp index 9eb41408ff7..d603440757f 100644 --- a/extra/yassl/src/lock.cpp +++ b/extra/yassl/src/lock.cpp @@ -26,7 +26,7 @@ namespace yaSSL { -#ifdef YASSL_THREAD_SAFE +#ifdef MULTI_THREADED #ifdef _WIN32 Mutex::Mutex() @@ -79,7 +79,7 @@ namespace yaSSL { #endif // _WIN32 -#endif // YASSL_THREAD_SAFE +#endif // MULTI_THREADED diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp index 00a3b885f88..ab5fee45038 100644 --- a/extra/yassl/src/ssl.cpp +++ b/extra/yassl/src/ssl.cpp @@ -27,7 +27,6 @@ - /* see man pages for function descriptions */ #include "runtime.hpp" @@ -1014,7 +1013,7 @@ char* ERR_error_string(unsigned long errNumber, char* buffer) static char* msg = (char*)"Please supply a buffer for error string"; if (buffer) { - SetErrorString(errNumber, buffer); + SetErrorString(YasslError(errNumber), buffer); return buffer; } diff --git a/extra/yassl/src/yassl_error.cpp b/extra/yassl/src/yassl_error.cpp index 74735347841..b9fccf782f0 100644 --- a/extra/yassl/src/yassl_error.cpp +++ b/extra/yassl/src/yassl_error.cpp @@ -31,11 +31,6 @@ #pragma warning(disable: 4996) #endif -#ifdef _MSC_VER - // 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy - #pragma warning(disable: 4996) -#endif - namespace yaSSL { @@ -60,7 +55,7 @@ Library Error::get_lib() const */ -void SetErrorString(unsigned long error, char* buffer) +void SetErrorString(YasslError error, char* buffer) { using namespace TaoCrypt; const int max = MAX_ERROR_SZ; // shorthand diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt index 5965f0d29d0..10ed614445e 100755..100644 --- a/extra/yassl/taocrypt/CMakeLists.txt +++ b/extra/yassl/taocrypt/CMakeLists.txt @@ -11,21 +11,28 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include) -ADD_DEFINITIONS("-DYASSL_THREAD_SAFE") - +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) +ADD_DEFINITIONS(${SSL_DEFINES}) SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp - src/md4.cpp src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp + src/md4.cpp src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp + src/rabbit.cpp src/hc128.cpp include/aes.hpp include/algebra.hpp include/arc4.hpp include/asn.hpp include/block.hpp include/coding.hpp include/des.hpp include/dh.hpp include/dsa.hpp include/dsa.hpp include/error.hpp include/file.hpp include/hash.hpp include/hmac.hpp include/integer.hpp include/md2.hpp include/md5.hpp include/misc.hpp include/modarith.hpp include/modes.hpp - include/random.hpp include/ripemd.hpp include/rsa.hpp include/sha.hpp) -IF(NOT SOURCE_SUBLIBS) - ADD_LIBRARY(taocrypt ${TAOCRYPT_SOURCES}) -ENDIF(NOT SOURCE_SUBLIBS) + include/random.hpp include/ripemd.hpp include/rsa.hpp include/sha.hpp + include/rabbit.hpp include/hc128.hpp) + +IF(HAVE_EXPLICIT_TEMPLATE_INSTANTIATION) + SET(TAOCRYPT_SOURCES ${TAOCRYPT_SOURCES} src/template_instnt.cpp) +ENDIF() + +ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES}) +RESTRICT_SYMBOL_EXPORTS(taocrypt) + diff --git a/extra/yassl/taocrypt/Makefile.am b/extra/yassl/taocrypt/Makefile.am deleted file mode 100644 index de59419a736..00000000000 --- a/extra/yassl/taocrypt/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (C) 2005, 2006 MySQL 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -SUBDIRS = src test benchmark -EXTRA_DIST = CMakeLists.txt $(wildcard mySTL/*.hpp) - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/extra/yassl/taocrypt/benchmark/Makefile.am b/extra/yassl/taocrypt/benchmark/Makefile.am deleted file mode 100644 index 32fe504734d..00000000000 --- a/extra/yassl/taocrypt/benchmark/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -# -# 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL -noinst_PROGRAMS = benchmark -benchmark_SOURCES = benchmark.cpp -benchmark_LDADD = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la -benchmark_CXXFLAGS = -DYASSL_PURE_C @yassl_thread_cxxflags@ -EXTRA_DIST = benchmark.dsp rsa1024.der dh1024.der dsa1024.der make.bat - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/extra/yassl/taocrypt/include/aes.hpp b/extra/yassl/taocrypt/include/aes.hpp index dc19c98a83a..e2041fc9350 100644 --- a/extra/yassl/taocrypt/include/aes.hpp +++ b/extra/yassl/taocrypt/include/aes.hpp @@ -92,7 +92,6 @@ typedef BlockCipher<ENCRYPTION, AES, CBC> AES_CBC_Encryption; typedef BlockCipher<DECRYPTION, AES, CBC> AES_CBC_Decryption; - } // naemspace #endif // TAO_CRYPT_AES_HPP diff --git a/extra/yassl/taocrypt/include/pwdbased.hpp b/extra/yassl/taocrypt/include/pwdbased.hpp index f40a336e2c3..d050fd8988b 100644 --- a/extra/yassl/taocrypt/include/pwdbased.hpp +++ b/extra/yassl/taocrypt/include/pwdbased.hpp @@ -48,9 +48,11 @@ word32 PBKDF2_HMAC<T>::DeriveKey(byte* derived, word32 dLen, const byte* pwd, word32 pLen, const byte* salt, word32 sLen, word32 iterations) const { - if (dLen > MaxDerivedKeyLength()) + if (dLen > MaxDerivedKeyLength()) return 0; + if (iterations < 0) + return 0; ByteBlock buffer(T::DIGEST_SIZE); HMAC<T> hmac; diff --git a/extra/yassl/taocrypt/src/Makefile.am b/extra/yassl/taocrypt/src/Makefile.am deleted file mode 100644 index bdfa156d5e9..00000000000 --- a/extra/yassl/taocrypt/src/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. -# -# 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL - -noinst_LTLIBRARIES = libtaocrypt.la - -libtaocrypt_la_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp \ - asn.cpp bftables.cpp blowfish.cpp coding.cpp des.cpp dh.cpp \ - dsa.cpp file.cpp hash.cpp integer.cpp md2.cpp md4.cpp md5.cpp misc.cpp \ - random.cpp ripemd.cpp rsa.cpp sha.cpp template_instnt.cpp \ - tftables.cpp twofish.cpp rabbit.cpp hc128.cpp - -libtaocrypt_la_CXXFLAGS = @yassl_taocrypt_extra_cxxflags@ -DYASSL_PURE_C \ - @yassl_thread_cxxflags@ - -EXTRA_DIST = $(wildcard ../include/*.hpp) - -# Don't update the files from bitkeeper -%::SCCS/s.% - diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp index 5ec4cac1c44..ad054809879 100644 --- a/extra/yassl/taocrypt/src/asn.cpp +++ b/extra/yassl/taocrypt/src/asn.cpp @@ -154,6 +154,8 @@ word32 GetLength(Source& source) else length = b; + if (source.IsLeft(length) == false) return 0; + return length; } @@ -832,7 +834,7 @@ void CertDecoder::GetName(NameType nt) if (email) { if (!(ptr = AddTag(ptr, buf_end, "/emailAddress=", 14, length))) { source_.SetError(CONTENT_E); - return; + return; } } diff --git a/extra/yassl/taocrypt/src/coding.cpp b/extra/yassl/taocrypt/src/coding.cpp index 8647ea13f20..ba485eea77e 100644 --- a/extra/yassl/taocrypt/src/coding.cpp +++ b/extra/yassl/taocrypt/src/coding.cpp @@ -103,6 +103,16 @@ void HexDecoder::Decode() byte b = coded_.next() - 0x30; // 0 starts at 0x30 byte b2 = coded_.next() - 0x30; + // sanity checks + if (b >= sizeof(hexDecode)/sizeof(hexDecode[0])) { + coded_.SetError(PEM_E); + return; + } + if (b2 >= sizeof(hexDecode)/sizeof(hexDecode[0])) { + coded_.SetError(PEM_E); + return; + } + b = hexDecode[b]; b2 = hexDecode[b2]; @@ -178,6 +188,7 @@ void Base64Decoder::Decode() { word32 bytes = coded_.size(); word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz); + const byte maxIdx = (byte)sizeof(base64Decode) + 0x2B - 1; plainSz = ((plainSz * 3) / 4) + 3; decoded_.New(plainSz); @@ -200,6 +211,16 @@ void Base64Decoder::Decode() if (e4 == pad) pad4 = true; + if (e1 < 0x2B || e2 < 0x2B || e3 < 0x2B || e4 < 0x2B) { + coded_.SetError(PEM_E); + return; + } + + if (e1 > maxIdx || e2 > maxIdx || e3 > maxIdx || e4 > maxIdx) { + coded_.SetError(PEM_E); + return; + } + e1 = base64Decode[e1 - 0x2B]; e2 = base64Decode[e2 - 0x2B]; e3 = (e3 == pad) ? 0 : base64Decode[e3 - 0x2B]; diff --git a/extra/yassl/taocrypt/taocrypt.dsw b/extra/yassl/taocrypt/taocrypt.dsw index d10d7534c3d..43115069160 100644 --- a/extra/yassl/taocrypt/taocrypt.dsw +++ b/extra/yassl/taocrypt/taocrypt.dsw @@ -3,6 +3,21 @@ Microsoft Developer Studio Workspace File, Format Version 6.00 ############################################################################### +Project: "benchmark"=.\benchmark\benchmark.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name taocrypt + End Project Dependency +}}} + +############################################################################### + Project: "taocrypt"=.\taocrypt.dsp - Package Owner=<4> Package=<5> @@ -15,7 +30,7 @@ Package=<4> ############################################################################### -Project: "test"=.\test.dsp - Package Owner=<4> +Project: "test"=.\test\test.dsp - Package Owner=<4> Package=<5> {{{ diff --git a/extra/yassl/taocrypt/test/Makefile.am b/extra/yassl/taocrypt/test/Makefile.am deleted file mode 100644 index 87f35f2f78e..00000000000 --- a/extra/yassl/taocrypt/test/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -# -# 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL -noinst_PROGRAMS = test -test_SOURCES = test.cpp -test_LDADD = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la -test_CXXFLAGS = -DYASSL_PURE_C @yassl_thread_cxxflags@ -EXTRA_DIST = make.bat - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/extra/yassl/taocrypt/test/memory.cpp b/extra/yassl/taocrypt/test/memory.cpp index ec398a64c45..a9b21f94902 100644 --- a/extra/yassl/taocrypt/test/memory.cpp +++ b/extra/yassl/taocrypt/test/memory.cpp @@ -31,7 +31,7 @@ To use MemoryTracker merely add this file to your project No need to instantiate anything -If your app is multi threaded define YASSL_THREAD_SAFE +If your app is multi threaded define MULTI_THREADED *********************************************************************/ diff --git a/extra/yassl/taocrypt/test.dsp b/extra/yassl/taocrypt/test/test.dsp index 1084f8e06e3..93b369de3d9 100644 --- a/extra/yassl/taocrypt/test.dsp +++ b/extra/yassl/taocrypt/test/test.dsp @@ -37,12 +37,12 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "test\Release" -# PROP Intermediate_Dir "test\Release" +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /O2 /I "include" /I "mySTL" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c +# ADD CPP /nologo /MD /W3 /O2 /I "../include" /I "../mySTL" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -61,12 +61,12 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "test\Debug" -# PROP Intermediate_Dir "test\Debug" +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "include" /I "mySTL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../include" /I "../mySTL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -87,7 +87,7 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=.\test\test.cpp +SOURCE=.\test.cpp # End Source File # End Group # Begin Group "Header Files" diff --git a/extra/yassl/testsuite/Makefile.am b/extra/yassl/testsuite/Makefile.am deleted file mode 100644 index 081b76401fa..00000000000 --- a/extra/yassl/testsuite/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -# -# 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../taocrypt/include -I$(srcdir)/../taocrypt/mySTL -noinst_PROGRAMS = testsuite -testsuite_SOURCES = testsuite.cpp ../taocrypt/test/test.cpp \ - ../examples/client/client.cpp ../examples/server/server.cpp \ - ../examples/echoclient/echoclient.cpp \ - ../examples/echoserver/echoserver.cpp -testsuite_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX -DNO_MAIN_DRIVER @yassl_thread_cxxflags@ -testsuite_LDADD = $(top_builddir)/extra/yassl/src/libyassl.la \ - $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la -EXTRA_DIST = testsuite.dsp test.hpp input quit make.bat - -# Don't update the files from bitkeeper -%::SCCS/s.% - diff --git a/extra/yassl/yassl.dsw b/extra/yassl/yassl.dsw index 288c88dfd5b..8da089fc1fa 100644 --- a/extra/yassl/yassl.dsw +++ b/extra/yassl/yassl.dsw @@ -90,7 +90,7 @@ Package=<4> ############################################################################### -Project: "test"=.\taocrypt\test.dsp - Package Owner=<4> +Project: "test"=.\taocrypt\test\test.dsp - Package Owner=<4> Package=<5> {{{ @@ -114,9 +114,6 @@ Package=<5> Package=<4> {{{ Begin Project Dependency - Project_Dep_Name taocrypt - End Project Dependency - Begin Project Dependency Project_Dep_Name yassl End Project Dependency }}} |