Skip to content

Commit 367a755

Browse files
committed
Add support for AllowPublicKeyRetrieval.
1 parent e778243 commit 367a755

File tree

3 files changed

+3
-19
lines changed

3 files changed

+3
-19
lines changed

tests/MySqlConnector.Tests/MySqlConnectionStringBuilderTests.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ public class MySqlConnectionStringBuilderTests
1010
public void Defaults()
1111
{
1212
var csb = new MySqlConnectionStringBuilder();
13-
#if !BASELINE
1413
Assert.False(csb.AllowPublicKeyRetrieval);
15-
#endif
1614
Assert.False(csb.AllowUserVariables);
1715
Assert.True(csb.AutoEnlist);
1816
Assert.Null(csb.CertificateFile);
@@ -73,6 +71,7 @@ public void ParseConnectionString()
7371
{
7472
ConnectionString = "Data Source=db-server;" +
7573
"Initial Catalog=schema_name;" +
74+
"allowpublickeyretrieval = true;" +
7675
"Allow User Variables=true;" +
7776
"auto enlist=False;" +
7877
"certificate file=file.pfx;" +
@@ -93,7 +92,6 @@ public void ParseConnectionString()
9392
"forcesynchronous=true;" +
9493
"ignore command transaction=true;" +
9594
"ca certificate file=ca.pem;" +
96-
"allow public key retrieval = true;" +
9795
"server rsa public key file=rsa.pem;" +
9896
"load balance=random;" +
9997
#endif
@@ -110,6 +108,7 @@ public void ParseConnectionString()
110108
"Uid=username;" +
111109
"useaffectedrows=false"
112110
};
111+
Assert.True(csb.AllowPublicKeyRetrieval);
113112
Assert.True(csb.AllowUserVariables);
114113
Assert.False(csb.AutoEnlist);
115114
Assert.Equal("file.pfx", csb.CertificateFile);
@@ -130,7 +129,6 @@ public void ParseConnectionString()
130129
Assert.True(csb.ForceSynchronous);
131130
Assert.True(csb.IgnoreCommandTransaction);
132131
Assert.Equal("ca.pem", csb.CACertificateFile);
133-
Assert.True(csb.AllowPublicKeyRetrieval);
134132
Assert.Equal("rsa.pem", csb.ServerRsaPublicKeyFile);
135133
Assert.Equal(MySqlLoadBalance.Random, csb.LoadBalance);
136134
#endif

tests/SideBySide/ConnectAsync.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -270,19 +270,13 @@ public async Task Sha256WithoutSecureConnection()
270270
{
271271
var csb = AppConfig.CreateSha256ConnectionStringBuilder();
272272
csb.SslMode = MySqlSslMode.None;
273-
#if !BASELINE
274273
csb.AllowPublicKeyRetrieval = true;
275-
#endif
276274
using (var connection = new MySqlConnection(csb.ConnectionString))
277275
{
278-
#if BASELINE
279-
await Assert.ThrowsAsync<NotImplementedException>(() => connection.OpenAsync());
280-
#else
281276
if (AppConfig.SupportedFeatures.HasFlag(ServerFeatures.RsaEncryption))
282277
await connection.OpenAsync();
283278
else
284279
await Assert.ThrowsAsync<MySqlException>(() => connection.OpenAsync());
285-
#endif
286280
}
287281
}
288282

@@ -299,16 +293,10 @@ public async Task CachingSha2WithoutSecureConnection()
299293
{
300294
var csb = AppConfig.CreateCachingSha2ConnectionStringBuilder();
301295
csb.SslMode = MySqlSslMode.None;
302-
#if !BASELINE
303296
csb.AllowPublicKeyRetrieval = true;
304-
#endif
305297
using (var connection = new MySqlConnection(csb.ConnectionString))
306298
{
307-
#if BASELINE
308-
await Assert.ThrowsAsync<NotImplementedException>(() => connection.OpenAsync());
309-
#else
310299
await connection.OpenAsync();
311-
#endif
312300
}
313301
}
314302

tests/SideBySide/ConnectSync.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,10 @@ public void Sha256WithoutSecureConnection()
367367
{
368368
var csb = AppConfig.CreateSha256ConnectionStringBuilder();
369369
csb.SslMode = MySqlSslMode.None;
370-
#if !BASELINE
371370
csb.AllowPublicKeyRetrieval = true;
372-
#endif
373371
using (var connection = new MySqlConnection(csb.ConnectionString))
374372
{
375-
#if BASELINE || NET45
373+
#if NET45
376374
Assert.Throws<NotImplementedException>(() => connection.Open());
377375
#else
378376
if (AppConfig.SupportedFeatures.HasFlag(ServerFeatures.RsaEncryption))

0 commit comments

Comments
 (0)