Re: BUG #4869: No proper initialization of OpenSSL-Engine in libpq - Mailing list pgsql-bugs

From Lars Kanis
Subject Re: BUG #4869: No proper initialization of OpenSSL-Engine in libpq
Date
Msg-id 200906221648.00617.kanis@comcard.de
Whole thread Raw
In response to Re: BUG #4869: No proper initialization of OpenSSL-Engine in libpq  (Magnus Hagander <magnus@hagander.net>)
List pgsql-bugs
Am Montag, 22. Juni 2009 15:55:58 schrieben Sie:
> Lars Kanis wrote:
> >> Should we not also call ENGINE_finish() and ENGINE_free() in the succe=
ss
> >> path of this code? Your patch adds it to the case where we didn't get
> >> the private key, but what if we did? I assume they should also go
> >> outside the error path, per the attached patch - or will that break
> >> their usage?
> >
> > That's right. I thought about it, but I don't know where the right place
> > is.
> >
> >> Can you test that and verify that it doesn't break for you?
> >
> > It breaks with Segmentation fault in my smartcard-based setup. The
> > pkey-handle is all we have from the engine, when client_cert_cb() is
> > finished. Obviously the ref-counting of openssl does not take the
> > pkey-handle into account, so we need to keep the engine_ptr for later
> > freeing.
>
> So we need to keep the engine initialized during this time? Ugh. We
> don't currently carry around the engine pointer. I guess we have to.
>
> > close_SSL() should be the right place for ENGINE_finish() and
> > ENGINE_free() ?
>
> Yup.
>
> How about the attached patch? Does it work for you?
Yes, it works perfect. Now, if I close the connection, the engine is closed=
=20
too, so I have to type the PIN another time for a next connection. That=20
should be the correct behaviour.=20

>
> A question from that then, for others, is it Ok to add a field to the
> PGconn structure during RC? :-) It's only in libpq-int.h, but? Comments?
> Tom, perhaps?

pgsql-bugs by date:

Previous
From: Lars Kanis
Date:
Subject: Re: BUG #4869: No proper initialization of OpenSSL-Engine in libpq
Next
From: Lars Kanis
Date:
Subject: Re: BUG #4869: No proper initialization of OpenSSL-Engine in libpq