Skip to content

verifyCallback not being called #99

@jdmarshall90

Description

@jdmarshall90

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions