diff --git a/CMakeLists.txt b/CMakeLists.txt index bb603974..5926d255 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ PROJECT(mariadb-client C) SET(CPACK_PACKAGE_VERSION_MAJOR 1) -SET(CPACK_PACKAGE_VERSION_MINOR 0) +SET(CPACK_PACKAGE_VERSION_MINOR 1) SET(CPACK_PACKAGE_VERSION_PATCH 0) # Minimum required version is Cmake 2.6.x diff --git a/include/mysql_com.h b/include/mysql_com.h index 0fb8e461..6d79c1ef 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -153,7 +153,6 @@ enum enum_server_command #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30) #define CLIENT_SUPPORTED_FLAGS (CLIENT_LONG_PASSWORD | \ - CLIENT_LONG_PASSWORD |\ CLIENT_FOUND_ROWS |\ CLIENT_LONG_FLAG |\ CLIENT_CONNECT_WITH_DB |\ diff --git a/libmariadb/errmsg.c b/libmariadb/errmsg.c index b0eb72b2..3b618582 100644 --- a/libmariadb/errmsg.c +++ b/libmariadb/errmsg.c @@ -138,8 +138,8 @@ const char *client_errors[]= /* 2055 */ "", /* 2056 */ "", /* 2057 */ "The number of parameters in bound buffers differs from number of columns in resultset", -/* 2058 */ "Can't connect twice. Already connected", -/* 2059 */ "Plugin %s could not be loaded: %s", +/* 2058 */ "Plugin %s could not be loaded: %s", +/* 2059 */ "Can't connect twice. Already connected", "" }; #endif diff --git a/libmariadb/my_auth.c b/libmariadb/my_auth.c index 24ce6f0b..dfa7e5d4 100644 --- a/libmariadb/my_auth.c +++ b/libmariadb/my_auth.c @@ -48,6 +48,7 @@ static auth_plugin_t old_password_client_plugin= struct st_mysql_client_plugin *mysql_client_builtins[]= { + (struct st_mysql_client_plugin *)&old_password_client_plugin, (struct st_mysql_client_plugin *)&native_password_client_plugin, 0 }; diff --git a/libmariadb/password.c b/libmariadb/password.c index 7e6e5900..ce0a6af7 100644 --- a/libmariadb/password.c +++ b/libmariadb/password.c @@ -179,31 +179,30 @@ void make_password_from_salt(char *to, ulong *hash_res) * Genererate a new message based on message and password * The same thing is done in client and server and the results are checked. */ - -char *scramble_323(char *to,const char *message,const char *password) +char *scramble_323(char *to, const char *message, const char *password) { struct rand_struct rand_st; - ulong hash_pass[2],hash_message[2]; + ulong hash_pass[2], hash_message[2]; + if (password && password[0]) { - char *to_start=to; - hash_password(hash_pass, password, strlen(password)); - hash_password(hash_message, message, strlen(message)); - randominit(&rand_st,hash_pass[0] ^ hash_message[0], - hash_pass[1] ^ hash_message[1]); - while (*message++) - *to++= (char) (floor(rnd(&rand_st)*31)+64); - { /* Make it harder to break */ - char extra=(char) (floor(rnd(&rand_st)*31)); - while (to_start != to) - *(to_start++)^=extra; - } + char extra, *to_start=to; + const char *end_scramble323= message + SCRAMBLE_LENGTH_323; + hash_password(hash_pass,password, (uint) strlen(password)); + /* Don't use strlen, could be > SCRAMBLE_LENGTH_323 ! */ + hash_password(hash_message, message, SCRAMBLE_LENGTH_323); + randominit(&rand_st, hash_pass[0] ^ hash_message[0], + hash_pass[1] ^ hash_message[1]); + for (; message < end_scramble323; message++) + *to++= (char) (floor(rnd(&rand_st) * 31) + 64); + extra=(char) (floor(rnd(&rand_st) * 31)); + while (to_start != to) + *(to_start++)^= extra; } - *to=0; + *to= 0; return to; } - my_bool check_scramble(const char *scrambled, const char *message, ulong *hash_pass, my_bool old_ver) { diff --git a/unittest/libmariadb/basic-t.c b/unittest/libmariadb/basic-t.c index 0ab37e79..5774bac6 100644 --- a/unittest/libmariadb/basic-t.c +++ b/unittest/libmariadb/basic-t.c @@ -424,6 +424,19 @@ static int test_status(MYSQL *mysql) return OK; } +static int bug_conc1(MYSQL *mysql) +{ + mysql_real_connect(mysql, hostname, username, password, schema, + port, socketname, 0); + FAIL_IF(mysql_errno(mysql) != CR_ALREADY_CONNECTED, + "Expected errno=CR_ALREADY_CONNECTED"); + FAIL_IF(strcmp(mysql_error(mysql), ER(CR_ALREADY_CONNECTED)) != 0, + "Wrong error message"); + FAIL_IF(strcmp(ER(CR_ALREADY_CONNECTED), "Can't connect twice. Already connected") != 0, + "wrong error message"); + return OK; +} + struct my_tests_st my_tests[] = { {"basic_connect", basic_connect, TEST_CONNECTION_NONE, 0, NULL, NULL}, {"use_utf8", use_utf8, TEST_CONNECTION_NEW, 0, opt_utf8, NULL}, @@ -433,6 +446,7 @@ struct my_tests_st my_tests[] = { {"test_mysql_insert_id", test_mysql_insert_id, TEST_CONNECTION_DEFAULT, 0, NULL, NULL}, {"test_bug12001", test_bug12001, TEST_CONNECTION_NEW, CLIENT_MULTI_STATEMENTS, NULL, NULL}, {"test_status", test_status, TEST_CONNECTION_NEW, CLIENT_MULTI_STATEMENTS, NULL, NULL}, + {"bug_conc1", bug_conc1, TEST_CONNECTION_NEW, 0, NULL, NULL}, {NULL, NULL, 0, 0, NULL, NULL} };