Skip to content

Commit 301a1a1

Browse files
author
Roberto E. Garcia
committed
Merge branch '6.8' into 6.9
2 parents 03d4a7d + cd7a6bd commit 301a1a1

File tree

4 files changed

+40
-3
lines changed

4 files changed

+40
-3
lines changed

CHANGES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
6.9.7
2+
- Changed default SSL mode to Preferred in connection string. Now the server connections will be using SSL if server allows it by default but it's possible to override this configuration.
3+
4+
15
6.9.6
26
- Fix for Incorrect query result with Entity Framework 6 (MySql bug #74918, Oracle bug #20129927).
37
- Fix for GetTimeZoneOffset to use date and time to calculate timediff (MySQL Bug #74905, Oracle Bug #20065691).

Source/MySql.Data/MySqlConnectionStringBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2013, 2014, Oracle and/or its affiliates. All rights reserved.
1+
// Copyright © 2013, 2015, Oracle and/or its affiliates. All rights reserved.
22
//
33
// MySQL Connector/NET is licensed under the terms of the GPLv2
44
// <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -185,7 +185,7 @@ static MySqlConnectionStringBuilder()
185185
options.Add(new MySqlConnectionStringOption("blobasutf8includepattern", null, typeof(string), "", false));
186186
options.Add(new MySqlConnectionStringOption("blobasutf8excludepattern", null, typeof(string), "", false));
187187
#if !CF
188-
options.Add(new MySqlConnectionStringOption("sslmode", "ssl mode", typeof(MySqlSslMode), MySqlSslMode.None, false));
188+
options.Add(new MySqlConnectionStringOption("sslmode", "ssl mode", typeof(MySqlSslMode), MySqlSslMode.Preferred, false));
189189
#endif
190190
}
191191

Source/MySql.Data/NativeDriver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ private void StartSSL()
377377
new RemoteCertificateValidationCallback(ServerCheckValidation);
378378
SslStream ss = new SslStream(baseStream, true, sslValidateCallback, null);
379379
X509CertificateCollection certs = GetClientCertificates();
380-
ss.AuthenticateAsClient(Settings.Server, certs, SslProtocols.Default, false);
380+
ss.AuthenticateAsClient(Settings.Server, certs, SslProtocols.Tls, false);
381381
baseStream = ss;
382382
stream = new MySqlStream(ss, Encoding, false);
383383
stream.SequenceByte = 2;

Tests/MySql.Data.Tests/MySqlConnectionTests.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,5 +1325,38 @@ public async Task GetSchemaCollectionAsync()
13251325
}
13261326
#endregion
13271327
#endif
1328+
1329+
[Fact]
1330+
public void SslPreferredByDefault()
1331+
{
1332+
string connectionString = st.GetConnectionString(true);
1333+
Assert.DoesNotContain("ssl", connectionString, StringComparison.OrdinalIgnoreCase);
1334+
using (MySqlConnection connection = new MySqlConnection(connectionString))
1335+
{
1336+
connection.Open();
1337+
MySqlCommand command = new MySqlCommand("SHOW SESSION STATUS LIKE 'Ssl_version';", connection);
1338+
using (MySqlDataReader reader = command.ExecuteReader())
1339+
{
1340+
Assert.True(reader.Read());
1341+
Assert.Equal("TLSv1", reader.GetString(1));
1342+
}
1343+
}
1344+
}
1345+
1346+
[Fact]
1347+
public void SslOverrided()
1348+
{
1349+
string connectionString = st.GetConnectionString(true) + ";Ssl mode=None";
1350+
using (MySqlConnection connection = new MySqlConnection(connectionString))
1351+
{
1352+
connection.Open();
1353+
MySqlCommand command = new MySqlCommand("SHOW SESSION STATUS LIKE 'Ssl_version';", connection);
1354+
using (MySqlDataReader reader = command.ExecuteReader())
1355+
{
1356+
Assert.True(reader.Read());
1357+
Assert.Equal(string.Empty, reader.GetString(1));
1358+
}
1359+
}
1360+
}
13281361
}
13291362
}

0 commit comments

Comments
 (0)