Skip to content

Commit 39ad0a0

Browse files
committed
Fix wrong ci configs. Restore ServerRsaPublicKeyFile for caching_sha2_password.
1 parent bde7eff commit 39ad0a0

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ env:
88
FEATURES=StoredProcedures
99
- IMAGE=mysql:5.7
1010
NAME=mysql
11-
FEATURES=Json,StoredProcedures,Sha256Password,LargePackets,CachingSha2Password
11+
FEATURES=Json,StoredProcedures,Sha256Password,LargePackets
1212
- IMAGE=mysql:8.0
1313
NAME=mysql
1414
FEATURES=Json,StoredProcedures,Sha256Password,LargePackets,CachingSha2Password
1515
- IMAGE=percona:5.7
1616
NAME=percona
17-
FEATURES=Json,StoredProcedures,Sha256Password,OpenSsl,LargePackets,CachingSha2Password
17+
FEATURES=Json,StoredProcedures,Sha256Password,OpenSsl,LargePackets
1818
- IMAGE=mariadb:10.2
1919
NAME=mariadb
2020
FEATURES=StoredProcedures,OpenSsl,LargePackets

appveyor.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ before_test:
77
- cmd: |-
88
"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" -u root --password=Password12! < .ci\server\init.sql
99
"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" -u root --password=Password12! < .ci\server\init_sha256.sql
10-
"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" -u root --password=Password12! < .ci\server\init_caching_sha2.sql
1110
test_script:
1211
- ps: .\.ci\test.ps1
1312
after_test:

src/MySqlConnector/Serialization/MySqlSession.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,19 @@ private async Task<string> GetRsaPublicKeyForCachingSha2PasswordAsync(
461461
IOBehavior ioBehavior,
462462
CancellationToken cancellationToken)
463463
{
464+
if (!string.IsNullOrEmpty(cs.ServerRsaPublicKeyFile))
465+
{
466+
try
467+
{
468+
return File.ReadAllText(cs.ServerRsaPublicKeyFile);
469+
}
470+
catch (IOException ex)
471+
{
472+
throw new MySqlException(
473+
"Couldn't load server's RSA public key from '{0}'".FormatInvariant(cs.ServerRsaPublicKeyFile), ex);
474+
}
475+
}
476+
464477
if (cs.AllowPublicKeyRetrieval)
465478
{
466479
// request the RSA public key

tests/SideBySide/ConnectAsync.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ public async Task Sha256WithoutSecureConnection()
257257
#endif
258258
using (var connection = new MySqlConnection(csb.ConnectionString))
259259
{
260-
#if BASELINE || NET45
261-
await Assert.ThrowsAsync<MySqlException>(() => connection.OpenAsync());
260+
#if BASELINE
261+
await Assert.ThrowsAsync<NotImplementedException>(() => connection.OpenAsync());
262262
#else
263263
if (AppConfig.SupportedFeatures.HasFlag(ServerFeatures.OpenSsl))
264264
await connection.OpenAsync();
@@ -281,14 +281,13 @@ public async Task CachingSha2WithoutSecureConnection()
281281
{
282282
var csb = AppConfig.CreateCachingSha2ConnectionStringBuilder();
283283
csb.SslMode = MySqlSslMode.None;
284-
//csb.ServerRsaPublicKeyFile = @"C:\NewCerts\public_key.pem";
285284
#if !BASELINE
286285
csb.AllowPublicKeyRetrieval = true;
287286
#endif
288287
using (var connection = new MySqlConnection(csb.ConnectionString))
289288
{
290-
#if BASELINE || NET45
291-
await Assert.ThrowsAsync<MySqlException>(() => connection.OpenAsync());
289+
#if BASELINE
290+
await Assert.ThrowsAsync<NotImplementedException>(() => connection.OpenAsync());
292291
#else
293292
await connection.OpenAsync();
294293
#endif

0 commit comments

Comments
 (0)