1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-09-11 08:30:59 +03:00

Fixed bug in character set autodetection

Fixed compiler warnings in test suite
Skipped change_users tests: They don't work anymore (mysql_change_user) security fix
Applied patch from John Schember
This commit is contained in:
Georg Richter
2013-03-13 11:00:56 +01:00
parent 420907a65a
commit d1b93bd17e
5 changed files with 18 additions and 9 deletions

View File

@@ -424,7 +424,7 @@ MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql);
MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql);
int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
const char *arg);
const void *arg);
void STDCALL mysql_free_result(MYSQL_RES *result);
void STDCALL mysql_data_seek(MYSQL_RES *result,
my_ulonglong offset);

View File

@@ -1500,7 +1500,9 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql,const char *host, const char *user,
*/
#if defined(HAVE_SYS_UN_H)
if ((!host || !strcmp(host,LOCAL_HOST)) && (unix_socket || mysql_unix_port))
if ((!host || strcmp(host,LOCAL_HOST) == 0) &&
mysql->options.protocol != MYSQL_PROTOCOL_TCP &&
(unix_socket || mysql_unix_port))
{
host=LOCAL_HOST;
if (!unix_socket)
@@ -1530,9 +1532,11 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql,const char *host, const char *user,
#elif defined(_WIN32)
{
if ((unix_socket ||
!host && is_NT() ||
host && !strcmp(host,LOCAL_HOST_NAMEDPIPE) ||
mysql->options.named_pipe || !have_tcpip))
(!host && is_NT()) ||
(host && strcmp(host,LOCAL_HOST_NAMEDPIPE) == 0) ||
mysql->options.named_pipe ||
!have_tcpip) &&
mysql->options.protocol != MYSQL_PROTOCOL_TCP)
{
sock=0;
if ((hPipe=create_named_pipe(net, mysql->options.connect_timeout,
@@ -2637,7 +2641,7 @@ mysql_get_client_info(void)
int STDCALL
mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
{
DBUG_ENTER("mysql_option");
DBUG_PRINT("enter",("option: %d",(int) option));

View File

@@ -867,7 +867,7 @@ struct st_madb_os_charset MADB_OS_CHARSET[]=
{"864", "Arabic (864)", NULL, MADB_CS_UNSUPPORTED},
{"865", "Nordic (DOS)", NULL, MADB_CS_UNSUPPORTED},
{"866", "Cyrillic (DOS)", "cp866", MADB_CS_EXACT},
{"869", "Greek, Modern (DOS)", NULL, MADB_CS_EXACT},
{"869", "Greek, Modern (DOS)", "greek", MADB_CS_EXACT},
{"870", "IBM EBCDIC Multilingual Latin 2", NULL, MADB_CS_UNSUPPORTED},
{"874", "Thai (Windows)", "tis620", MADB_CS_UNSUPPORTED},
{"875", "Greek Modern", NULL, MADB_CS_UNSUPPORTED},
@@ -996,7 +996,7 @@ struct st_madb_os_charset MADB_OS_CHARSET[]=
{"57010", "ISCII Gujarati", NULL, MADB_CS_UNSUPPORTED},
{"57011", "ISCII Punjabi", NULL, MADB_CS_UNSUPPORTED},
{"65000", "utf-7 Unicode (UTF-7)", NULL, MADB_CS_UNSUPPORTED},
{"65001", "utf-8 Unicode (UTF-8)", NULL, MADB_CS_EXACT},
{"65001", "utf-8 Unicode (UTF-8)", "utf8", MADB_CS_EXACT},
/* non Windows */
#else
{"ASCII", "US-ASCII", "ascii", MADB_CS_APPROX},

View File

@@ -167,6 +167,8 @@ static int test_change_user(MYSQL *mysql)
const char *db= "mysqltest_user_test_database";
int rc;
diag("Due to mysql_change_user security fix this test will not work anymore.");
return(SKIP);
DBUG_ENTER("test_change_user");
/* Prepare environment */
@@ -321,6 +323,9 @@ static int test_bug31669(MYSQL *mysql)
static char db[NAME_CHAR_LEN+1];
static char query[LARGE_BUFFER_SIZE*2];
diag("Due to mysql_change_user security fix this test will not work anymore.");
return(SKIP);
rc= mysql_change_user(mysql, NULL, NULL, NULL);
FAIL_UNLESS(rc, "Error expected");

View File

@@ -569,7 +569,7 @@ static int test_bug19671(MYSQL *mysql)
rc= mysql_query(mysql, "drop table t1");
check_mysql_rc(rc, mysql);
return OK;
return retcode;
}
/*