Re: BUG #4869: No proper initialization of OpenSSL-Engine in libpq

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Lars Kanis <kanis(at)comcard(dot)de>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #4869: No proper initialization of OpenSSL-Engine in libpq
Date: 2009-06-23 12:17:15
Message-ID: 4A40C7CB.1050209@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:
> Magnus Hagander <magnus(at)hagander(dot)net> writes:
>> On 22 jun 2009, at 18.05, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> I'm also a bit concerned about wrapping a struct
>>> field inside such an #if, as that's likely to cause hard-to-debug
>>> problems if two compilations read libpq-int.h with different #define
>>> environments.
>
>> Since it's a pointer we could just declare it as void, no? Or even #if
>> between void and "real" pointer. Wouldn't that be safe?
>
> Yeah, on reflection I think it'd be safe to do
>
> #if (SSLEAY_VERSION_NUMBER >= 0x00907000L) && !defined(OPENSSL_NO_ENGINE)
> ENGINE *ptr;
> #else
> /* dummy field to keep struct the same if OpenSSL version changes */
> void *ptr;
> #endif
>
> (probably that #if should get wrapped up in an additional #define
> instead of being duplicated in several places...)

Attached is an updated patch that does both of these.

>> (we already have a similar issue with the whole #ifdef use_ssl, don't
>> we? But having one isn't an excuse to create another of course…)
>
> That's controlled by an entry in pg_config.h, though, and won't change
> if someone happens to update their openssl install and then recompile
> only parts of libpq.

True, agreed.

--
Magnus Hagander
Self: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

Attachment Content-Type Size
sslengine.patch text/x-diff 4.5 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Fetter 2009-06-23 12:38:42 Re: [BUGS] Integrity check
Previous Message Magnus Hagander 2009-06-23 12:07:22 Re: BUG #4869: No proper initialization of OpenSSL-Engine in libpq