`verifyCallback` not being called
jdmarshall90 opened this issue · 0 comments
jdmarshall90 commented
I am using SSLService
like so:
let listeningSocket = try Socket.create(family: .inet)
let configuration = ...
let sslService = try SSLService(usingConfiguration: configuration)
sslService?.skipVerification = true
sslService?.verifyCallback = { service in
return (false, "invalid client cert")
}
listeningSocket.delegate = sslService
let newConnectionSocket = try socketConnection.acceptClientConnection()
Debugging led me to notice that neither skipVerification
nor verifyCallback
is being copied onto the new socket created by the last line.
This diff seems to fix it. I can open a PR but first wanted to make sure that a) I am not missing something and b) this won't have any unintended side effects.
diff --git a/Sources/SSLService/SSLService.swift b/Sources/SSLService/SSLService.swift
index f64f6fe..644a7ae 100644
--- a/Sources/SSLService/SSLService.swift
+++ b/Sources/SSLService/SSLService.swift
@@ -404,6 +404,8 @@ public class SSLService: SSLServiceDelegate {
private init?(with source: SSLService) throws {
self.configuration = source.configuration
+ self.skipVerification = source.skipVerification
+ self.verifyCallback = source.verifyCallback
// Validate the config...
try self.validate(configuration: source.configuration)