row editing
This commit is contained in:
@@ -136,8 +136,14 @@ private func authResponse(password: String, salt: [UInt8], plugin: String) throw
|
|||||||
return zip(first, last).map { $0 ^ $1 }
|
return zip(first, last).map { $0 ^ $1 }
|
||||||
}
|
}
|
||||||
if plugin == "caching_sha2_password" {
|
if plugin == "caching_sha2_password" {
|
||||||
let first = sha256(pwd), second = sha256(sha256(pwd))
|
// MySQL caching_sha2_password authentication:
|
||||||
let last = sha256(second + salt)
|
// XOR(SHA256(password),
|
||||||
|
// SHA256(SHA256(SHA256(password)) + challenge))
|
||||||
|
let first = sha256(pwd)
|
||||||
|
let second = sha256(first)
|
||||||
|
let third = sha256(second)
|
||||||
|
let last = sha256(third + salt)
|
||||||
|
|
||||||
return zip(first, last).map { $0 ^ $1 }
|
return zip(first, last).map { $0 ^ $1 }
|
||||||
}
|
}
|
||||||
throw MySQLWireError(message: "Authentication plugin \(plugin) is not yet supported")
|
throw MySQLWireError(message: "Authentication plugin \(plugin) is not yet supported")
|
||||||
@@ -314,7 +320,7 @@ private final class MySQLSocketTransport {
|
|||||||
|
|
||||||
guard SecTrustEvaluateWithError(trust, &trustError) else {
|
guard SecTrustEvaluateWithError(trust, &trustError) else {
|
||||||
throw MySQLWireError(
|
throw MySQLWireError(
|
||||||
message: "MySQL server verification failed: \(trustError?.localizedDescription ?? "untrusted server")"
|
message: "MySQL server verification failed (verifyTLS=\(verify)): \(trustError?.localizedDescription ?? "untrusted server")"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user