Subject: | Net::SIP::SocketPool does not pass certificate to 'receive' callback |
Date: | Mon, 30 Jan 2017 11:21:40 +0000 |
To: | "bug-Net-SIP [...] rt.cpan.org" <bug-Net-SIP [...] rt.cpan.org> |
From: | Richard Carver <richard.carver [...] cloudmont.co.uk> |
When clients authenticate with a certificate then Net::SIP::SocketPool and IO::Socket::SSL check that it is valid but do not pass it up the chain to the application to use for further logic.
This patch adds the peer certificate into the 'from' hash so that it can be used by the 'receive' callback.
*** /usr/local/share/perl5/Net/SIP/SocketPool.pm.orig Mon Jan 30 06:03:53 2017
--- /usr/local/share/perl5/Net/SIP/SocketPool.pm Mon Jan 30 05:48:10 2017
*************** sub _handle_read_tcp_co {
*** 540,545 ****
--- 540,546 ----
invoke_callback($self->{cb},$pkt, {
%{ ip_sockaddr2parts($from) },
proto => $self->{tls} ? 'tls' : 'tcp',
+ $self->{tls} ? (cert => $fo->{fd}->peer_certificate) : (),
});
# continue with processing any remaining data in the buffer