Mike,
test4.pl is taken directly from test included in the patch from ticket
91297, with the addition of:
shutdown(S, 2);
Net::SSLeay::free($ssl);
Net::SSLeay::CTX_free($ctx);
close S;
$ ./test4.pl
1..3
ok 1 - get_peer_cert_chain returns some elements
ok 2 - X509_get_subject_name
ok 3 - X509_NAME_oneline
Segmentation fault (core dumped)
test3.pl is simplified version of the above, with only
Net::SSLeay::free($ssl);
$ ./test3.pl
Segmentation fault (core dumped)
replacing get_peer_cert_chain with get_peer_certificate in either of these,
the seg fault does not occur.
removing Net::SSLeay::free($ssl); also eliminates the seg fault, and
get_peer_cert_chain works as expected. I haven't looked at the internals
enough to know if the free routine is really needed or not, my script is
very similar to the test4 case.
Environment is an ubuntu 12.04 LTS.
$ uname -a
Linux lindsey 3.2.0-39-generic #62-Ubuntu SMP Thu Feb 28 00:28:53 UTC 2013
x86_64 x86_64 x86_64 GNU/Linux
$ openssl version
OpenSSL 1.0.1 14 Mar 2012
$ perl -v
This is perl 5, version 14, subversion 2 (v5.14.2) built for
x86_64-linux-gnu-thread-multi
(with 56 registered patches, see perl -V for more detail)
...
Net::SSleay Net-SSLeay-1.57.tar.gz
Note that perl, openssl and openssl dev headers come directly from ubuntu
12.04 LTS updates resource, current installed package is: openssl
(1.0.1-4ubuntu5.11), perl (5.14.2-6ubuntu2.3). I believe the README in
Net-SSLeay recommended against using binary packages with Net::SSLeay, so
that could be the source of the issue.
-dana
On Mon, Jan 13, 2014 at 5:59 PM, Mike McCauley via RT <
bug-Net-SSLeay@rt.cpan.org> wrote:
Show quoted text> <URL:
https://rt.cpan.org/Ticket/Display.html?id=92117 >
>
> Hello Dana,
>
>
> Hmmm, I dont see that problem here.
> Can you pls send an example program that demonstrates the problem?
> What OS/perl are you using?
>
> Cheers.
>
> On Monday, January 13, 2014 04:31:35 PM you wrote:
> > Mon Jan 13 16:31:34 2014: Request 92117 was acted upon.
> > Transaction: Ticket created by djburd@gmail.com
> > Queue: Net-SSLeay
> > Subject: get_peer_cert_chain leads to seg fault with
> Net::SSLeay::free
> > Broken in: (no value)
> > Severity: (no value)
> > Owner: Nobody
> > Requestors: djburd@gmail.com
> > Status: new
> > Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=92117 >
> >
> >
> > thanks for adding the get_peer_cert_chain recently. noticed though:
> >
> > my @chain = Net::SSLeay::get_peer_cert_chain($ssl);
> > Net::SSLeay::free($ssl);
> >
> > ->causes seg fault.
> >
> >
> > replacing with get_peer_certificate does not:
> >
> > my @chain = Net::SSLeay::get_peer_certificate($ssl);
> > Net::SSLeay::free($ssl);
> >
> > no seg fault.
> --
> Mike McCauley VK4AMM mikem@airspayce.com
> Airspayce Pty Ltd 9 Bulbul Place Currumbin Waters QLD 4223 Australia
>
http://www.airspayce.com
> Phone +61 7 5598-7474 Fax +61 7 5598-7070
>
>
>