Skip to content

Commit

Permalink
MENT-27 One more iteration
Browse files Browse the repository at this point in the history
Pipeline amendments plus changed testcases, that create users, to make
them with more "secure" pwd to satisfy "policy requirements"
  • Loading branch information
lawrinn committed Jul 30, 2019
1 parent 18ee34b commit 8bbcd0e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
27 changes: 18 additions & 9 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ jobs:
cmake -G "Visual Studio 16 2019" -DCONC_WITH_MSI=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SIGNCODE=0 -DWITH_SSL=SCHANNEL -DWITH_OPENSSL=OFF
cmake --build . --config RelWithDebInfo
displayName: 'build connector'
- task: CopyFiles@2
inputs:
contents: 'wininstall/**.msi'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: msi_package

- task: PowerShell@2
inputs:
Expand All @@ -85,7 +93,7 @@ jobs:
$regPath = "HKCU:\Software\ODBC\ODBC.INI\test"
New-Item -Path $regPath
New-ItemProperty -Path $regPath -Name "CONN_TIMEOUT" -Value "0"
New-ItemProperty -Path $regPath -Name "DATABASE" -Value "testo"
New-ItemProperty -Path $regPath -Name "DATABASE" -Value "test"
New-ItemProperty -Path $regPath -Name "DESCRIPTION" -Value "MariaDB ODBC test"
New-ItemProperty -Path $regPath -Name "Driver" -Value "MariaDB ODBC 3.1 Driver"
New-ItemProperty -Path $regPath -Name "OPTIONS" -Value "0"
Expand All @@ -103,14 +111,14 @@ jobs:
inputs:
targetType: inline
script: |
$msifile = Get-ChildItem $env:$(System.DefaultWorkingDirectory)\mariadb-connector-odbc*.msi | Select-Object -First 1
Push-AppveyorArtifact $msifile.FullName -FileName $msifile.Name
$msifile = Get-ChildItem $env:$(System.DefaultWorkingDirectory)\wininstall\mariadb-connector-odbc*.msi | Select-Object -First 1
Write $msifile
msiexec /i $msifile INSTALLDIR=c:\mariadb-odbc /qn
msiexec /i $msifile.fullname INSTALLDIR=c:\mariadb-odbc /qn
displayName: 'install odbc'

- script: |
set MARIADB_PLUGIN_DIR=$(System.DefaultWorkingDirectory)\libmariadb\plugins\lib\RelWithDebInfo
SET TEST_SCHEMA=test
timeout /T 1
cd test
Expand Down Expand Up @@ -225,12 +233,13 @@ jobs:
- script: |
sudo apt-get install -f -y make cmake
cd libmariadb
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=OPENSSL -DCERT_PATH=$(System.DefaultWorkingDirectory)/tmp
make
#cd libmariadb
#cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=OPENSSL -DCERT_PATH=$(System.DefaultWorkingDirectory)/tmp
#make
cd ..
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_OPENSSL=ON -DWITH_SSL=OPENSSL
#cd ..
export TEST_SCHEMA=testo
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_OPENSSL=ON -DWITH_SSL=OPENSSL .
cmake --build . --config RelWithDebInfo
displayName: 'Build'
Expand Down
2 changes: 1 addition & 1 deletion test/catalog1.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ ODBC_TEST(my_colpriv)
OK_SIMPLE_STMT(Stmt, "CREATE TABLE test_colprev3(a INT,b INT,c INT, d INT)");

(void)SQLExecDirect(Stmt, (SQLCHAR *)"DROP USER my_colpriv", SQL_NTS);
OK_SIMPLE_STMT(Stmt, "CREATE USER my_colpriv");
OK_SIMPLE_STMT(Stmt, "CREATE USER my_colpriv IDENTIFIED BY 's3CureP@wd'");

OK_SIMPLE_STMT(Stmt, "GRANT SELECT(a,b),INSERT(d),UPDATE(c) ON test_colprev1 TO my_colpriv");
OK_SIMPLE_STMT(Stmt, "GRANT SELECT(c,a),UPDATE(a,b) ON test_colprev3 TO my_colpriv");
Expand Down
10 changes: 5 additions & 5 deletions test/catalog2.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ ODBC_TEST(t_bug50195)
{
diag("Test is run in Travis");
SQLExecDirect(Stmt, (SQLCHAR *)"DROP USER bug50195@'%'", SQL_NTS);
OK_SIMPLE_STMT(Stmt, "CREATE USER bug50195@'%' IDENTIFIED BY 'a'");
OK_SIMPLE_STMT(Stmt, "CREATE USER bug50195@'%' IDENTIFIED BY 's3CureP@wd'");

OK_SIMPLE_STMT(Stmt, "GRANT ALL ON bug50195 TO bug50195@'%'");
OK_SIMPLE_STMT(Stmt, "REVOKE SELECT ON bug50195 FROM bug50195@'%'");
Expand All @@ -305,8 +305,8 @@ ODBC_TEST(t_bug50195)
SQLExecDirect(Stmt, (SQLCHAR *)"DROP USER [email protected]", SQL_NTS);
SQLExecDirect(Stmt, (SQLCHAR *)"DROP USER bug50195@localhost", SQL_NTS);

OK_SIMPLE_STMT(Stmt, "CREATE USER [email protected] IDENTIFIED BY 'a'");
OK_SIMPLE_STMT(Stmt, "CREATE USER bug50195@localhost IDENTIFIED BY 'a'");
OK_SIMPLE_STMT(Stmt, "CREATE USER [email protected] IDENTIFIED BY 's3CureP@wd'");
OK_SIMPLE_STMT(Stmt, "CREATE USER bug50195@localhost IDENTIFIED BY 's3CureP@wd'");

OK_SIMPLE_STMT(Stmt, "GRANT ALL ON bug50195 TO bug50195@'127.0.0.1'");
OK_SIMPLE_STMT(Stmt, "GRANT ALL ON bug50195 TO bug50195@'localhost'");
Expand All @@ -319,11 +319,11 @@ ODBC_TEST(t_bug50195)

CHECK_ENV_RC(Env, SQLAllocConnect(Env, &hdbc1));

hstmt1= DoConnect(hdbc1, FALSE, my_dsn, "bug50195", "a", 0, NULL, NULL, NULL, NULL);
hstmt1= DoConnect(hdbc1, FALSE, my_dsn, "bug50195", "s3CureP@wd", 0, NULL, NULL, NULL, NULL);

if (hstmt1 == NULL)
{
diag("Couldn't connect with new user of allocate the stmt");
diag("Couldn't connect with new user or allocate the stmt");

if (Travis != 0 && TravisOnOsx == 0)
{
Expand Down
8 changes: 4 additions & 4 deletions test/unicode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1153,11 +1153,11 @@ ODBC_TEST(t_bug28168)
SQLWCHAR *grantQuery= W(L"GRANT ALL ON t_bug28168 to "
L"'\x03A8\x0391\x03A1\x039F uid'@"
L"localhost identified by "
L"'\x03A8\x0391\x03A1\x039F pwd'");
L"'\x03A8\x0391\x03A1\x039F pWd@2019'");
SQLWCHAR *grantQuery2= W(L"GRANT ALL ON t_bug28168 to "
L"'\x03A8\x0391\x03A1\x039F uid'@"
L"'%' identified by "
L"'\x03A8\x0391\x03A1\x039F pwd'");
L"'\x03A8\x0391\x03A1\x039F pWd@2019'");
SQLSMALLINT errmsglen;
SQLINTEGER native_error= 0;

Expand Down Expand Up @@ -1201,7 +1201,7 @@ ODBC_TEST(t_bug28168)
wcscat(conn_in, L";UID=");
wcscat(conn_in, L"{\x03A8\x0391\x03A1\x039F uid}");
wcscat(conn_in, L";PWD=");
wcscat(conn_in, L"{\x03A8\x0391\x03A1\x039F pwd}");
wcscat(conn_in, L"{\x03A8\x0391\x03A1\x039F pWd@2019}");
wcscat(conn_in, L";DATABASE=");
mbstowcs(dummy, (char *)my_schema, sizeof(dummy)/sizeof(wchar_t));
wcscat(conn_in, dummy);
Expand All @@ -1217,7 +1217,7 @@ ODBC_TEST(t_bug28168)
CHECK_DBC_RC(hdbc2, SQLDisconnect(hdbc2));

/* we change the password in the connection string to test the error msg */
wstr= wcsstr(conn_in, L" pwd}") - 4;
wstr= wcsstr(conn_in, L" pWd@2019}") - 4;
*wstr++= 'x';

FAIL_IF(SQLDriverConnectW(hdbc2, NULL, W(conn_in), SQL_NTS,
Expand Down

0 comments on commit 8bbcd0e

Please sign in to comment.