1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

Fix for CONC-243:

ABI breakage: Revert parameter length from size_t to unsigned long.
  (affects mysql_stmt_prepare, mysql_real_query, mysql_send_query)
This commit is contained in:
Georg Richter
2017-03-14 16:11:04 +01:00
parent a1315d2a2d
commit 9a865bc88c
7 changed files with 20 additions and 16 deletions

View File

@@ -248,7 +248,7 @@ int ma_simple_command(MYSQL *mysql,enum enum_server_command command, const char
* function prototypes * function prototypes
*/ */
MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql); MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql);
int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, size_t length); int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, unsigned long length);
int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt); int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt); int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, unsigned int column, unsigned long offset); int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, unsigned int column, unsigned long offset);

View File

@@ -511,10 +511,10 @@ void STDCALL mysql_close(MYSQL *sock);
int STDCALL mysql_select_db(MYSQL *mysql, const char *db); int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
int STDCALL mysql_query(MYSQL *mysql, const char *q); int STDCALL mysql_query(MYSQL *mysql, const char *q);
int STDCALL mysql_send_query(MYSQL *mysql, const char *q, int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
size_t length); unsigned long length);
my_bool STDCALL mysql_read_query_result(MYSQL *mysql); my_bool STDCALL mysql_read_query_result(MYSQL *mysql);
int STDCALL mysql_real_query(MYSQL *mysql, const char *q, int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
size_t length); unsigned long length);
int STDCALL mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level); int STDCALL mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level);
int STDCALL mysql_dump_debug_info(MYSQL *mysql); int STDCALL mysql_dump_debug_info(MYSQL *mysql);
int STDCALL mysql_refresh(MYSQL *mysql, int STDCALL mysql_refresh(MYSQL *mysql,

View File

@@ -1944,7 +1944,7 @@ mysql_query(MYSQL *mysql, const char *query)
*/ */
int STDCALL int STDCALL
mysql_send_query(MYSQL* mysql, const char* query, size_t length) mysql_send_query(MYSQL* mysql, const char* query, unsigned long length)
{ {
return ma_simple_command(mysql, COM_QUERY, query, length, 1,0); return ma_simple_command(mysql, COM_QUERY, query, length, 1,0);
} }
@@ -2141,11 +2141,11 @@ mysql_read_query_result(MYSQL *mysql)
} }
int STDCALL int STDCALL
mysql_real_query(MYSQL *mysql, const char *query, size_t length) mysql_real_query(MYSQL *mysql, const char *query, unsigned long length)
{ {
my_bool skip_result= OPT_EXT_VAL(mysql, multi_command); my_bool skip_result= OPT_EXT_VAL(mysql, multi_command);
if (length == (size_t)-1) if (length == (unsigned long)-1)
length= strlen(query); length= strlen(query);
free_old_query(mysql); free_old_query(mysql);

View File

@@ -1381,7 +1381,7 @@ int STDCALL mysql_stmt_warning_count(MYSQL_STMT *stmt)
return stmt->upsert_status.warning_count; return stmt->upsert_status.warning_count;
} }
int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, size_t length) int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, unsigned long length)
{ {
MYSQL *mysql= stmt->mysql; MYSQL *mysql= stmt->mysql;
int rc= 1; int rc= 1;
@@ -1393,8 +1393,8 @@ int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, size_t lengt
return(1); return(1);
} }
if (length == (size_t) -1) if (length == (unsigned long) -1)
length= strlen(query); length= (unsigned long)strlen(query);
/* clear flags */ /* clear flags */
CLEAR_CLIENT_STMT_ERROR(stmt); CLEAR_CLIENT_STMT_ERROR(stmt);

View File

@@ -25,6 +25,8 @@
#define SC_IO_BUFFER_SIZE 0x4000 #define SC_IO_BUFFER_SIZE 0x4000
#define MAX_SSL_ERR_LEN 100 #define MAX_SSL_ERR_LEN 100
extern FILE *dump_file;
#define SCHANNEL_PAYLOAD(A) (A).cbMaximumMessage + (A).cbHeader + (A).cbTrailer #define SCHANNEL_PAYLOAD(A) (A).cbMaximumMessage + (A).cbHeader + (A).cbTrailer
void ma_schannel_set_win_error(MARIADB_PVIO *pvio); void ma_schannel_set_win_error(MARIADB_PVIO *pvio);
@@ -451,6 +453,8 @@ SECURITY_STATUS ma_schannel_handshake_loop(MARIADB_PVIO *pvio, my_bool InitialRe
rc = SEC_E_INTERNAL_ERROR; rc = SEC_E_INTERNAL_ERROR;
break; break;
} }
fprintf(dump_file, "\nServer (%d) - %ld bytes\n", pvio->mysql->thread_id, nbytes);
fwrite(sctx->IoBuffer + cbIoBuffer, nBytes, 1, dump_file);
cbData = (DWORD)nbytes; cbData = (DWORD)nbytes;
cbIoBuffer += cbData; cbIoBuffer += cbData;
} }
@@ -512,6 +516,8 @@ SECURITY_STATUS ma_schannel_handshake_loop(MARIADB_PVIO *pvio, my_bool InitialRe
DeleteSecurityContext(&sctx->ctxt); DeleteSecurityContext(&sctx->ctxt);
return SEC_E_INTERNAL_ERROR; return SEC_E_INTERNAL_ERROR;
} }
fprintf(dump_file, "\nClient (%d) - %ld bytes\n", pvio->mysql->thread_id, nbytes);
fwrite(OutBuffers.pvBuffer, nBytes, 1, dump_file);
cbData= (DWORD)nbytes; cbData= (DWORD)nbytes;
/* Free output context buffer */ /* Free output context buffer */
FreeContextBuffer(OutBuffers.pvBuffer); FreeContextBuffer(OutBuffers.pvBuffer);
@@ -655,6 +661,8 @@ SECURITY_STATUS ma_schannel_client_handshake(MARIADB_TLS *ctls)
sRet= SEC_E_INTERNAL_ERROR; sRet= SEC_E_INTERNAL_ERROR;
goto end; goto end;
} }
fprintf(dump_file, "\nClient (%d) - %ld bytes\n", pvio->mysql->thread_id, nbytes);
fwrite(BuffersOut.pvBuffer, nBytes, 1, dump_file);
r = (DWORD)nbytes; r = (DWORD)nbytes;
} }
sRet= ma_schannel_handshake_loop(pvio, TRUE, &ExtraData); sRet= ma_schannel_handshake_loop(pvio, TRUE, &ExtraData);
@@ -754,6 +762,8 @@ SECURITY_STATUS ma_schannel_read_decrypt(MARIADB_PVIO *pvio,
// todo: error // todo: error
return SEC_E_INVALID_HANDLE; return SEC_E_INVALID_HANDLE;
} }
fprintf(dump_file, "\nServer (%d) - %ld bytes\n", pvio->mysql->thread_id, nbytes);
fwrite(sctx->IoBuffer + dwOffset, nBytes, 1, dump_file);
dwOffset+= (DWORD)nbytes; dwOffset+= (DWORD)nbytes;
ZeroMemory(Buffers, sizeof(SecBuffer) * 4); ZeroMemory(Buffers, sizeof(SecBuffer) * 4);

View File

@@ -549,7 +549,7 @@ static int test_mysql_insert_id(MYSQL *mysql)
rc= mysql_query(mysql, "drop table t2"); rc= mysql_query(mysql, "drop table t2");
check_mysql_rc(rc, mysql); check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "create table t2 (f1 int not null primary key " rc= mysql_query(mysql, "create table t2 (f1 int not null primary key "
"auto_increment, f2 varchar(255), unique (f2)) engine=MyISAM"); "auto_increment, f2 varchar(200), unique (f2)) engine=MyISAM");
check_mysql_rc(rc, mysql); check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "insert into t2 values (null,'e')"); rc= mysql_query(mysql, "insert into t2 values (null,'e')");
res= mysql_insert_id(mysql); res= mysql_insert_id(mysql);

View File

@@ -704,12 +704,6 @@ static int test_wl4284_1(MYSQL *mysql)
return SKIP; return SKIP;
} }
if (!rc)
{
diag("InnoDB Storage engine not available");
return SKIP;
}
/* set AUTOCOMMIT to OFF */ /* set AUTOCOMMIT to OFF */
rc= mysql_autocommit(mysql, FALSE); rc= mysql_autocommit(mysql, FALSE);
check_mysql_rc(rc, mysql); check_mysql_rc(rc, mysql);