diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 13:39:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 13:39:13 +0000 |
commit | 86fbb58c3ac0865482819c10a3e81f2eea001c36 (patch) | |
tree | 28c9e526ea739c6f9b89e36115e1e2698bddf981 /libmariadb | |
parent | Releasing progress-linux version 1:10.11.6-2~progress7.99u1. (diff) | |
download | mariadb-86fbb58c3ac0865482819c10a3e81f2eea001c36.tar.xz mariadb-86fbb58c3ac0865482819c10a3e81f2eea001c36.zip |
Merging upstream version 1:10.11.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libmariadb')
-rw-r--r-- | libmariadb/.travis.yml | 103 | ||||
-rw-r--r-- | libmariadb/CMakeLists.txt | 2 | ||||
-rw-r--r-- | libmariadb/cmake/FindZStd.cmake | 2 | ||||
-rw-r--r-- | libmariadb/libmariadb/mariadb_lib.c | 47 | ||||
-rw-r--r-- | libmariadb/plugins/pvio/pvio_npipe.c | 27 | ||||
-rw-r--r-- | libmariadb/unittest/libmariadb/charset.c | 3 | ||||
-rw-r--r-- | libmariadb/unittest/libmariadb/connection.c | 6 |
7 files changed, 74 insertions, 116 deletions
diff --git a/libmariadb/.travis.yml b/libmariadb/.travis.yml index d084bc17..aab4dfec 100644 --- a/libmariadb/.travis.yml +++ b/libmariadb/.travis.yml @@ -1,10 +1,5 @@ -os: linux -dist: focal language: c -services: docker -addons: - hosts: - - mariadb.example.com +version: ~> 1.0 cache: apt: true @@ -12,98 +7,22 @@ cache: directories: - $HOME/docker -before_install: - - git clone https://github.com/mariadb-corporation/connector-test-machine.git - # Load cached docker images - - if [[ -d $HOME/docker ]]; then ls $HOME/docker/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load"; fi +env: + global: local=0 DB=testc CLEAR_TEXT=0 -install: - - |- - if [ -z "$server_branch" ] ; then - case $TRAVIS_OS_NAME in - windows) - connector-test-machine/launch.bat -t "$srv" -v "$v" -d testc - ;; - linux) - source connector-test-machine/launch.sh -t "$srv" -v "$v" -d testc -l "$local" -n "$native" - ;; - esac - fi - - -env: local=0 - -stages: - - Minimal - - name: Enterprise - if: type = push AND fork = false - - Community +import: mariadb-corporation/connector-test-machine:common-build.yml@master jobs: - fast_finish: true - allow_failures: - - env: srv=maxscale - - env: srv=skysql - - env: srv=skysql-ha - - env: srv=xpand - - env: srv=mysql v=5.7 - - env: srv=mysql v=8.0 include: - - stage: Minimal - env: srv=mariadb v=10.6 packet=8 - name: "CS 10.6" - - env: srv=mariadb-es - name: "ES latest" - if: type = push AND fork = false - - env: server_branch=10.11 - name: "10.11 Server unit testing" - - - stage: Enterprise - env: srv=mariadb-es v=10.4 - dist: bionic - name: "ES 10.4" - - env: srv=mariadb-es v=10.5 - dist: bionic - name: "ES 10.5" - - env: srv=mariadb-es v=10.6 - name: "ES 10.6" - - env: srv=mariadb-es-test v=23.08 - name: "ES 23.08" - - env: srv=maxscale - name: "Maxscale" - - env: srv=xpand - name: "Xpand" - - stage: Community - env: srv=mariadb v=10.11 - os: windows - language: shell - name: "Windows" - - env: server_branch=10.6 - name: "10.6 Server unit testing" + env: srv=mariadb v=10.11 local=1 TEST_OPTION=--ps-protocol + name: "CS 10.11 with ps-protocol" + - stage: Other + env: server_branch=10.6 + name: "CS 10.6 Server unit testing" + - env: server_branch=10.11 + name: "CS 10.11 Server unit testing" - env: server_branch=11.3 TEST_OPTION=--ps-protocol name: "11.3 Server unit testing with ps-protocol" - - env: srv=mariadb v=10.4 local=1 - dist: bionic - name: "CS 10.4" - - env: srv=mariadb v=10.5 local=1 - dist: bionic - name: "CS 10.5" - - env: srv=mariadb v=10.9 local=1 - name: "CS 10.9" - - env: srv=mariadb v=10.10 local=1 - name: "CS 10.10" - - env: srv=mariadb v=10.11 local=1 - name: "CS 10.11" - - env: srv=mariadb v=10.11 local=1 TEST_OPTION=--ps-protocol - name: "CS 10.11 with ps-protocol" - - env: srv=mariadb v=11.0 local=1 - name: "CS 11.0" - - env: srv=mariadb v=11.1 local=1 - name: "CS 11.1" - - env: srv=mysql v=5.7 native=1 - name: "MySQL 5.7" - - env: srv=mysql v=8.0 native=1 - name: "MySQL 8.0" script: ./travis.sh diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt index 206e4e03..4aab676d 100644 --- a/libmariadb/CMakeLists.txt +++ b/libmariadb/CMakeLists.txt @@ -36,7 +36,7 @@ SET(CC_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) SET(CPACK_PACKAGE_VERSION_MAJOR 3) SET(CPACK_PACKAGE_VERSION_MINOR 3) -SET(CPACK_PACKAGE_VERSION_PATCH 8) +SET(CPACK_PACKAGE_VERSION_PATCH 9) SET(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") MATH(EXPR MARIADB_PACKAGE_VERSION_ID "${CPACK_PACKAGE_VERSION_MAJOR} * 10000 + ${CPACK_PACKAGE_VERSION_MINOR} * 100 + diff --git a/libmariadb/cmake/FindZStd.cmake b/libmariadb/cmake/FindZStd.cmake index d03e96fc..f4bb5398 100644 --- a/libmariadb/cmake/FindZStd.cmake +++ b/libmariadb/cmake/FindZStd.cmake @@ -10,7 +10,7 @@ find_path(ZSTD_INCLUDE_DIRS HINTS ${ZSTD_ROOT_DIR}/include) find_library(ZSTD_LIBRARIES - NAMES zstd + NAMES zstd zstd_static HINTS ${ZSTD_ROOT_DIR}/lib) include(FindPackageHandleStandardArgs) diff --git a/libmariadb/libmariadb/mariadb_lib.c b/libmariadb/libmariadb/mariadb_lib.c index e8db51a0..36219385 100644 --- a/libmariadb/libmariadb/mariadb_lib.c +++ b/libmariadb/libmariadb/mariadb_lib.c @@ -241,18 +241,29 @@ restart: } goto restart; } - net->last_errno= last_errno; - if (pos[0]== '#') + if (IS_MYSQL_ERROR(last_errno) || IS_MARIADB_ERROR(last_errno)) { - ma_strmake(net->sqlstate, pos+1, SQLSTATE_LENGTH); - pos+= SQLSTATE_LENGTH + 1; + /* The server appears to have sent an error code within the + * range(s) of error codes that should only be generated + * client-side. + */ + my_set_error(mysql, CR_MALFORMED_PACKET, SQLSTATE_UNKNOWN, 0); } else { - strncpy(net->sqlstate, SQLSTATE_UNKNOWN, SQLSTATE_LENGTH); + net->last_errno= last_errno; + if (pos[0]== '#') + { + ma_strmake(net->sqlstate, pos+1, SQLSTATE_LENGTH); + pos+= SQLSTATE_LENGTH + 1; + } + else + { + strncpy(net->sqlstate, SQLSTATE_UNKNOWN, SQLSTATE_LENGTH); + } + ma_strmake(net->last_error,(char*) pos, + min(len,sizeof(net->last_error)-1)); } - ma_strmake(net->last_error,(char*) pos, - min(len,sizeof(net->last_error)-1)); } else { @@ -1787,11 +1798,20 @@ restart: */ if ((pkt_length=ma_net_safe_read(mysql)) == packet_error) { - if (mysql->net.last_errno == CR_SERVER_LOST) + + unsigned int code= mysql->net.last_errno; + if (code == CR_SERVER_LOST) my_set_error(mysql, CR_SERVER_LOST, SQLSTATE_UNKNOWN, ER(CR_SERVER_LOST_EXTENDED), "handshake: reading initial communication packet", errno); + else if (IS_MYSQL_ERROR(code) || IS_MARIADB_ERROR(code)) + ; /* not forged - generated on the client side */ + else if (mysql->options.use_ssl) + my_set_error(mysql, CR_CONNECTION_ERROR, SQLSTATE_UNKNOWN, + "Received error packet before completion of TLS handshake. " + "The authenticity of the following error cannot be verified:\n%d - %s", + code, mysql->net.last_error); goto error; } @@ -1803,17 +1823,6 @@ restart: mysql->protocol_version= end[0]; end++; - /* Check if server sends an error */ - if (mysql->protocol_version == 0XFF) - { - net_get_error(end, pkt_length - 1, net->last_error, sizeof(net->last_error), - &net->last_errno, net->sqlstate); - /* fix for bug #26426 */ - if (net->last_errno == 1040) - memcpy(net->sqlstate, "08004", SQLSTATE_LENGTH); - goto error; - } - if (mysql->protocol_version < PROTOCOL_VERSION) { net->last_errno= CR_VERSION_ERROR; diff --git a/libmariadb/plugins/pvio/pvio_npipe.c b/libmariadb/plugins/pvio/pvio_npipe.c index 17c59cef..d2d5222a 100644 --- a/libmariadb/plugins/pvio/pvio_npipe.c +++ b/libmariadb/plugins/pvio/pvio_npipe.c @@ -150,19 +150,38 @@ static BOOL complete_io(HANDLE file, OVERLAPPED *ov, BOOL ret, DWORD timeout, DW return GetOverlappedResult(file, ov, size, FALSE); } +/* + Disable posting IO completion event to the port. + Handle can be bound to IOCP outside of the connector for other purposes + (e.g polling functionality) +*/ + +static inline void disable_iocp_notification(HANDLE *h) +{ + *h= (HANDLE) ((ULONG_PTR) *h | 1); +} + +static inline void enable_iocp_notification(HANDLE *h) +{ + *h= (HANDLE) ((ULONG_PTR) *h & ~1); +} + ssize_t pvio_npipe_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length) { BOOL ret; ssize_t r= -1; struct st_pvio_npipe *cpipe= NULL; DWORD size; + HANDLE *h; if (!pvio || !pvio->data) return -1; cpipe= (struct st_pvio_npipe *)pvio->data; - + h= &cpipe->overlapped.hEvent; + disable_iocp_notification(h); ret= ReadFile(cpipe->pipe, buffer, (DWORD)length, NULL, &cpipe->overlapped); + enable_iocp_notification(h); ret= complete_io(cpipe->pipe, &cpipe->overlapped, ret, pvio->timeout[PVIO_READ_TIMEOUT], &size); r= ret? (ssize_t) size:-1; @@ -175,13 +194,15 @@ ssize_t pvio_npipe_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length) struct st_pvio_npipe *cpipe= NULL; BOOL ret; DWORD size; - + HANDLE *h; if (!pvio || !pvio->data) return -1; cpipe= (struct st_pvio_npipe *)pvio->data; - + h= &cpipe->overlapped.hEvent; + disable_iocp_notification(h); ret= WriteFile(cpipe->pipe, buffer, (DWORD)length, NULL , &cpipe->overlapped); + enable_iocp_notification(h); ret= complete_io(cpipe->pipe, &cpipe->overlapped, ret, pvio->timeout[PVIO_WRITE_TIMEOUT], &size); r= ret ? (ssize_t)size : -1; return r; diff --git a/libmariadb/unittest/libmariadb/charset.c b/libmariadb/unittest/libmariadb/charset.c index b438f8d9..4d17731f 100644 --- a/libmariadb/unittest/libmariadb/charset.c +++ b/libmariadb/unittest/libmariadb/charset.c @@ -47,6 +47,9 @@ int bug_8378(MYSQL *mysql) { MYSQL_RES *res; MYSQL_ROW row; + /* MXS-4898: MaxScale sends utf8mb4 in handshake OK packet */ + SKIP_MAXSCALE; + len= mysql_real_escape_string(mysql, out, TEST_BUG8378_IN, 4); FAIL_IF(memcmp(out, TEST_BUG8378_OUT, len), "wrong result"); diff --git a/libmariadb/unittest/libmariadb/connection.c b/libmariadb/unittest/libmariadb/connection.c index 517bc538..fa232cad 100644 --- a/libmariadb/unittest/libmariadb/connection.c +++ b/libmariadb/unittest/libmariadb/connection.c @@ -1222,6 +1222,9 @@ static int test_mdev13100(MYSQL *my __attribute__((unused))) int rc; FILE *fp; + /* MXS-4898: MaxScale sends utf8mb4 in handshake OK packet */ + SKIP_MAXSCALE; + if (!(fp= fopen("./mdev13100.cnf", "w"))) return FAIL; @@ -1240,6 +1243,7 @@ static int test_mdev13100(MYSQL *my __attribute__((unused))) diag("Error: %s", mysql_error(mysql)); return FAIL; } + diag("Default charset: %s", mysql_character_set_name(mysql)); FAIL_IF(strcmp("latin2", mysql_character_set_name(mysql)), "Expected charset latin2"); mysql_close(mysql); @@ -2190,6 +2194,7 @@ void my_status_callback(void *ptr, enum enum_mariadb_status_info type, ...) { MARIADB_CONST_STRING *str= va_arg(ap, MARIADB_CONST_STRING *); strncpy(data->database, str->str, str->length); + data->database[str->length]= 0; } break; case SESSION_TRACK_SYSTEM_VARIABLES: @@ -2200,6 +2205,7 @@ void my_status_callback(void *ptr, enum enum_mariadb_status_info type, ...) if (!strncmp(key->str, "character_set_client", key->length)) { strncpy(data->charset, val->str, val->length); + data->charset[val->length]= 0; } } break; |