Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verifyCallback not being called #99

Open
jdmarshall90 opened this issue Sep 8, 2022 · 0 comments
Open

verifyCallback not being called #99

jdmarshall90 opened this issue Sep 8, 2022 · 0 comments

Comments

@jdmarshall90
Copy link

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant