From 2aaeff3774bfc6e656f4a35c3b7e6df03be5bf33 Mon Sep 17 00:00:00 2001 From: Mark Gregory Date: Wed, 21 Oct 2026 10:30:18 +0100 Subject: [PATCH] row editing --- DBSyn/MySQLProtocol.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/DBSyn/MySQLProtocol.swift b/DBSyn/MySQLProtocol.swift index 2bf5e5d..51b0a8f 100644 --- a/DBSyn/MySQLProtocol.swift +++ b/DBSyn/MySQLProtocol.swift @@ -262,6 +262,7 @@ private final class MySQLSocketTransport { } func startTLS(host: String, verify: Bool) throws { + NSLog("DBSyn TLS: host=%@ verify=%@", host, verify ? "ON" : "OFF") guard let context = SSLCreateContext(nil, .clientSide, .streamType) else { throw MySQLWireError(message: "Unable to create MySQL TLS context") } @@ -407,6 +408,13 @@ final class MySQLWireConnection { _ = try c.take(10) let salt2 = try c.take(max(13, authLen - 8)) let salt = salt1 + salt2.prefix(max(0, authLen - 9)) + + // MySQL authentication uses the 20-byte server challenge. + guard salt.count == 20 else { + throw MySQLWireError( + message: "Invalid MySQL authentication challenge length: \(salt.count)" + ) + } let plugin = (try? c.nulString()) ?? "mysql_native_password" if requireTLS { let clientSSL = 0x00000800