|
1 |
| -using System; |
| 1 | +using System; |
2 | 2 | using System.Diagnostics;
|
3 | 3 | using System.Globalization;
|
4 | 4 | using System.IO;
|
@@ -242,18 +242,8 @@ public async Task ConnectAsync(ConnectionSettings cs, IOBehavior ioBehavior, Can
|
242 | 242 | // if server doesn't support the authentication fast path, it will send a new challenge
|
243 | 243 | if (payload.HeaderByte == AuthenticationMethodSwitchRequestPayload.Signature)
|
244 | 244 | {
|
245 |
| - if (payload.ArraySegment.Count == 1) |
246 |
| - { |
247 |
| - // Single 0xfe byte of the payload means it's an Old Authentication Method Switch Request Packet. |
248 |
| - // See http://imysql.com/mysql-internal-manual/connection-phase-packets.html |
249 |
| - // It's old protocol so MySqlConnector doesn't support it. |
250 |
| - throw new NotSupportedException("Old Authentication Method Switch is not supported. Use new password hash format of 41-byte in MySQL server, not old format of 16-byte."); |
251 |
| - } |
252 |
| - else |
253 |
| - { |
254 |
| - await SwitchAuthenticationAsync(cs, payload, ioBehavior, cancellationToken).ConfigureAwait(false); |
255 |
| - payload = await ReceiveReplyAsync(ioBehavior, cancellationToken).ConfigureAwait(false); |
256 |
| - } |
| 245 | + await SwitchAuthenticationAsync(cs, payload, ioBehavior, cancellationToken).ConfigureAwait(false); |
| 246 | + payload = await ReceiveReplyAsync(ioBehavior, cancellationToken).ConfigureAwait(false); |
257 | 247 | }
|
258 | 248 |
|
259 | 249 | OkPayload.Create(payload);
|
@@ -381,6 +371,9 @@ private async Task SwitchAuthenticationAsync(ConnectionSettings cs, PayloadData
|
381 | 371 | }
|
382 | 372 | break;
|
383 | 373 |
|
| 374 | + case "mysql_old_password": |
| 375 | + throw new NotSupportedException("'MySQL Server is requesting the insecure pre-4.1 auth mechanism (mysql_old_password). The user password must be upgraded; see https://dev.mysql.com/doc/refman/5.7/en/account-upgrades.html."); |
| 376 | + |
384 | 377 | default:
|
385 | 378 | throw new NotSupportedException("Authentication method '{0}' is not supported.".FormatInvariant(switchRequest.Name));
|
386 | 379 | }
|
|
0 commit comments