Skip to content

Commit

Permalink
Fix for ConnectionRegressionTest.testSha256PasswordPlugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
fjssilva committed Nov 16, 2017
1 parent b5d483e commit 0537c86
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/testsuite/regression/ConnectionRegressionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4033,11 +4033,10 @@ public void testAuthCleartextPlugin() throws Exception {

/**
* This test requires two server instances:
* 1) main test server pointed by com.mysql.jdbc.testsuite.url variable
* configured without RSA encryption support
* 2) additional server instance pointed by com.mysql.jdbc.testsuite.url.sha256default
* variable configured with default-authentication-plugin=sha256_password
* and RSA encryption enabled.
* 1) main test server pointed by com.mysql.jdbc.testsuite.url variable configured without RSA encryption support (with sha256_password_private_key_path,
* sha256_password_public_key_path config options unset).
* 2) additional server instance pointed by com.mysql.jdbc.testsuite.url.sha256default variable configured with
* default-authentication-plugin=sha256_password and RSA encryption enabled.
*
* To run this test please add this variable to ant call:
* -Dcom.mysql.jdbc.testsuite.url.sha256default=jdbc:mysql://localhost:3307/test?user=root&password=pwd
Expand All @@ -4059,9 +4058,9 @@ public void testSha256PasswordPlugin() throws Exception {
if (!pluginIsActive(this.stmt, "sha256_password")) {
fail("sha256_password required to run this test");
}
if (allowsRsa(this.stmt)) {
fail("RSA encryption must be disabled on " + System.getProperty("com.mysql.jdbc.testsuite.url") + " to run this test");
}

// newer GPL servers, like 8.0.4+, are using OpenSSL and can use RSA encryption, while old ones compiled with yaSSL cannot
boolean gplWithRSA = allowsRsa(this.stmt);

try {
this.stmt.executeUpdate("SET @current_old_passwords = @@global.old_passwords");
Expand Down Expand Up @@ -4110,13 +4109,17 @@ public Void call() throws Exception {
}
}
});
assertThrows(SQLException.class, "Access denied for user 'wl5602user'.*", new Callable<Void>() {
public Void call() throws Exception {
getConnectionWithProps(propsAllowRetrieval);
return null;
}
});

if (gplWithRSA) {
assertCurrentUser(null, propsAllowRetrieval, "wl5602user", false);
} else {
assertThrows(SQLException.class, "Access denied for user 'wl5602user'.*", new Callable<Void>() {
public Void call() throws Exception {
getConnectionWithProps(propsAllowRetrieval);
return null;
}
});
}
assertCurrentUser(null, propsNoRetrievalNoPassword, "wl5602nopassword", false);
assertCurrentUser(null, propsAllowRetrievalNoPassword, "wl5602nopassword", false);

Expand Down

0 comments on commit 0537c86

Please sign in to comment.