Skip to content

Commit a315872

Browse files
committed
Fix of possible crash in config dialog in connection test function
Updated libmariadb to v3.3.3 tag. Removed dependency of msi file on gssapi client plugin, as it is static my default. Some changes and corrections in tests and travis config
1 parent bf86c4c commit a315872

File tree

8 files changed

+48
-23
lines changed

8 files changed

+48
-23
lines changed

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,15 @@ jobs:
4848
- env: srv=xpand
4949
- env: srv=mysql v=5.7
5050
- env: srv=mysql v=8.0
51-
- env: srv=mariadb v=10.8
51+
- env: srv=mariadb v=10.6
5252
os: windows
5353
- os: osx
5454
- os: linux
5555
arch: s390x
5656
dist: focal
57+
- env: srv=maxscale MAXSCALE_TEST_DISABLE=true
58+
- env: srv=skysql SKYSQL=true
59+
- env: srv=skysql-ha SKYSQL_HA=true MAXSCALE_TEST_DISABLE=true
5760
include:
5861
- stage: Minimal
5962
env: srv=mariadb v=10.6 local=1
@@ -104,6 +107,9 @@ jobs:
104107
name: "CS build"
105108
- os: osx
106109
compiler: clang
110+
before_script:
111+
- brew install openssl
112+
- brew install libiodbc
107113
- os: linux
108114
arch: s390x
109115
dist: focal

.travis/script.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ if [ "$TRAVIS_OS_NAME" = "windows" ] ; then
1515
echo "build from windows"
1616
ls -l
1717
if [ -e ./settestenv.sh ] ; then
18+
set +x
1819
source ./settestenv.sh
20+
set -ex
1921
fi
2022
else
2123
echo "build from linux"
@@ -26,23 +28,28 @@ else
2628
if [ -n "$MYSQL_TEST_SSL_PORT" ] ; then
2729
export TEST_SSL_PORT=$MYSQL_TEST_SSL_PORT
2830
fi
31+
if ! [ "$TRAVIS_OS_NAME" = "osx" ] ; then
32+
sudo apt install cmake
33+
fi
2934
fi
3035

3136
export TEST_DSN=maodbc_test
3237
export TEST_DRIVER=maodbc_test
3338
export TEST_UID=$TEST_DB_USER
3439
export TEST_SERVER=$TEST_DB_HOST
40+
set +x
3541
export TEST_PASSWORD=$TEST_DB_PASSWORD
42+
# Just to see in log that this was done
43+
echo "export TEST_PASSWORD=******************"
44+
set -ex
3645
export TEST_PORT=$TEST_DB_PORT
3746
export TEST_SCHEMA=testo
38-
export TEST_VERBOSE=true
3947
export TEST_SOCKET=
4048
if [ "${TEST_REQUIRE_TLS}" = "1" ] ; then
4149
export TEST_USETLS=true
4250
export TEST_ADD_PARAM="FORCETLS=1"
4351
fi
4452

45-
sudo apt install cmake
4653

4754
if [ "$TRAVIS_OS_NAME" = "windows" ] ; then
4855
cmake -DCONC_WITH_MSI=OFF -DCONC_WITH_UNIT_TESTS=OFF -DWITH_MSI=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=SCHANNEL .
@@ -101,10 +108,14 @@ fi
101108
echo "run connector test suite"
102109

103110
cd ./test
104-
export ODBCINI="$PWD/odbc.ini"
105-
export ODBCSYSINI=$PWD
106111

107-
cat $ODBCINI
112+
if ! [ "$TRAVIS_OS_NAME" = "windows" ] ; then
113+
export ODBCINI="$PWD/odbc.ini"
114+
export ODBCSYSINI=$PWD
115+
116+
cat $ODBCSYSINI/odbcinst.ini
117+
cat $ODBCSYSINI/odbc.ini | grep -v TEST_PASSWORD
118+
fi
108119

109120
ctest --output-on-failure
110121
# Running tests 2nd time with resultset streaming. "${TEST_REQUIRE_TLS}" = "1" basically means "not on skysql"

dsn/odbc_dsn.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,11 @@ char* HidePwd(char *ConnStr)
559559
}
560560
++Ptr;
561561
}
562-
++Ptr;
562+
/* Do not move if we already at the terminating null */
563+
if (*Ptr)
564+
{
565+
++Ptr;
566+
}
563567
}
564568

565569
return ConnStr;

libmariadb

ma_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ char* ltrim(char *Str)
4444
{
4545
if (Str)
4646
{
47-
while (*Str && isspace(Str[0]))
47+
while (*Str && iswspace(Str[0]))
4848
++Str;
4949
}
5050
return Str;

test/basic.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -734,15 +734,16 @@ ODBC_TEST(t_driverconnect_outstring)
734734
0, &conn_out_len, SQL_DRIVER_COMPLETE));
735735

736736
is_num(conn_out_len, strlen((const char*)conna));
737-
IS_STR(conna_out, conna, conn_out_len);
737+
/* Not to show sensitive data in automatic testing logs */
738+
IS_STR_EX(conna_out, conna, conn_out_len, FALSE);
738739

739740
CHECK_DBC_RC(hdbc1, SQLDisconnect(hdbc1));
740741

741742
CHECK_DBC_RC(hdbc1, SQLDriverConnect(hdbc1, NULL, conna, SQL_NTS, NULL,
742743
0, &conn_out_len, SQL_DRIVER_COMPLETE_REQUIRED));
743744

744745
is_num(conn_out_len, strlen((const char*)conna));
745-
IS_STR(conna_out, conna, conn_out_len);
746+
IS_STR_EX(conna_out, conna, conn_out_len, FALSE);
746747

747748
CHECK_DBC_RC(hdbc1, SQLDisconnect(hdbc1));
748749
CHECK_DBC_RC(hdbc1, SQLFreeHandle(SQL_HANDLE_DBC, hdbc1));
@@ -755,7 +756,7 @@ ODBC_TEST(t_driverconnect_outstring)
755756
SQL_DRIVER_NOPROMPT));
756757
/* Old iODBC returns octets count here */
757758
is_num(conn_out_len, strlen((const char*)conna)*lenCorrector);
758-
IS_WSTR(connw_out, connw, strlen((const char*)conna));
759+
IS_WSTR_EX(connw_out, connw, strlen((const char*)conna), FALSE);
759760

760761
CHECK_DBC_RC(hdbc1, SQLDisconnect(hdbc1));
761762

test/tap.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,10 @@ do {\
651651
}
652652

653653
#define IS(A) if (!(A)) { diag("Error in %s:%d", __FILE__, __LINE__); return FAIL; }
654-
#define IS_STR(A,B,C) do {const char *loc_a=(const char *)(A), *loc_b=(const char *)(B);\
655-
diag("%s %s", loc_a, loc_b);\
654+
#define IS_STR_EX(A,B,C,D) do {const char *loc_a=(const char *)(A), *loc_b=(const char *)(B);\
655+
if ((D)) diag("%s %s", loc_a, loc_b);\
656656
FAIL_IF(loc_a == NULL || loc_b == NULL || strncmp(loc_a, loc_b, (C)) != 0, "Strings do not match"); } while(0)
657+
#define IS_STR(A,B,C) IS_STR_EX(A,B,C,TRUE)
657658

658659
#define is_num(A,B) \
659660
do {\
@@ -1235,21 +1236,23 @@ void printHex(char *str, int len)
12351236
}
12361237
}
12371238

1238-
#define IS_WSTR(a, b, c) \
1239+
#define IS_WSTR_EX(a, b, c, _OUTPUT) \
12391240
do { \
12401241
SQLWCHAR *val_a= (SQLWCHAR*)(a), *val_b= (SQLWCHAR*)(b); \
12411242
int val_len= (int)(c); \
12421243
if (memcmp(val_a, val_b, val_len * sizeof(SQLWCHAR)) != 0) { \
1243-
printf("#%s('", #a); \
1244-
printHex((char*)val_a, val_len*sizeof(SQLWCHAR)); \
1245-
printf("') != %s('", #b); \
1246-
printHex((char*)val_b, val_len*sizeof(SQLWCHAR)); \
1247-
printf("') in %s on line %d", __FILE__, __LINE__); \
1248-
printf("\n"); \
1244+
if ((_OUTPUT)) {\
1245+
printf("#%s('", #a); \
1246+
printHex((char*)val_a, val_len*sizeof(SQLWCHAR)); \
1247+
printf("') != %s('", #b); \
1248+
printHex((char*)val_b, val_len*sizeof(SQLWCHAR)); \
1249+
printf("') in %s on line %d", __FILE__, __LINE__); \
1250+
printf("\n");\
1251+
}\
12491252
return FAIL;\
12501253
} \
12511254
} while (0);
1252-
1255+
#define IS_WSTR(a, b, c) IS_WSTR_EX(a, b, c, TRUE)
12531256

12541257

12551258
SQLWCHAR *dup_char_as_sqlwchar(SQLCHAR *from)

wininstall/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ IF(NOT USE_SYSTEM_INSTALLED_LIB)
126126
IF(ALL_PLUGINS_STATIC)
127127
ADD_DEPENDENCIES(ODBC_WIX maodbc maodbcs)
128128
ELSE()
129-
ADD_DEPENDENCIES(ODBC_WIX maodbc maodbcs dialog caching_sha2_password auth_gssapi_client sha256_password mysql_clear_password)
129+
ADD_DEPENDENCIES(ODBC_WIX maodbc maodbcs dialog caching_sha2_password sha256_password mysql_clear_password)
130130
ENDIF()
131131
ENDIF()
132132

0 commit comments

Comments
 (0)