OpenSSL Applink

Lists: pgsql-patches
From: Dave Page <dpage(at)postgresql(dot)org>
To: pgsql-patches(at)postgresql(dot)org
Subject: OpenSSL Applink
Date: 2007-09-28 14:27:44
Message-ID: 46FD0F60.2050805@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Windows the OpenSSL guys have included code with 0.9.8 and above to
allow OpenSSL to work correctly regardless of the MSVC runtime libraries
that have been used with the host application. This has become noticable
with the MSVC++ build in which any client apps that connect using libpq
with a client certificate will bail out with an error such as:

C:\pgsql-8.3>bin\psql -p 5433 postgres
OPENSSL_Uplink(00314010,05): no OPENSSL_Applink

The server doesn't seem to be affected, but the attached patch fixes the
problem for the client apps. Unfortunately it must be included in the
app itself, and not libpq.

I'm not sure what the OpenSSL guys were thinking here - apps like
pgAdmin which previously didn't use OpenSSL directly now need the source
code to build. I've also seen reports on the -odbc list that psqlODBC is
similarly affected, though how on earth we're meant to get the AppLink
code into apps such as MS Access or Crystal Reports is beyond me.

Regards, Dave

Attachment Content-Type Size
openssl-applink.patch text/x-diff 9.3 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dave Page <dpage(at)postgresql(dot)org>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 14:46:26
Message-ID: 1490.1190990786@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Dave Page <dpage(at)postgresql(dot)org> writes:
> The server doesn't seem to be affected, but the attached patch fixes the
> problem for the client apps. Unfortunately it must be included in the
> app itself, and not libpq.

This is pretty much in the category of "they've got to be kidding".
I recommend sitting on the prior version until upstream fixes their
mistake.

regards, tom lane


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dave Page <dpage(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 14:58:59
Message-ID: 46FD16B3.5040202@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Tom Lane wrote:
> Dave Page <dpage(at)postgresql(dot)org> writes:
>
>> The server doesn't seem to be affected, but the attached patch fixes the
>> problem for the client apps. Unfortunately it must be included in the
>> app itself, and not libpq.
>>
>
> This is pretty much in the category of "they've got to be kidding".
> I recommend sitting on the prior version until upstream fixes their
> mistake.
>
>
>

That was my reaction.

cheers

andrew


From: Dave Page <dpage(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 15:05:49
Message-ID: 46FD184D.2050405@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Tom Lane wrote:
> Dave Page <dpage(at)postgresql(dot)org> writes:
>> The server doesn't seem to be affected, but the attached patch fixes the
>> problem for the client apps. Unfortunately it must be included in the
>> app itself, and not libpq.
>
> This is pretty much in the category of "they've got to be kidding".

Agreed. Unless I've completely missed the point this does seem *really*
dumb.

> I recommend sitting on the prior version until upstream fixes their
> mistake.

Unfortunately from what I've seen it doesn't look like thats on their
agenda... and this has been around in release versions now since July 2005.

I believe we just didn't notice it until now because the older Mingw
builds use the MSVC 6.0 runtimes which just happened to be compatible
with the OpenSSL binary builds (we're now using 8.0), in addition to
which there are relatively few people using client-side certs I'd wager.

/D


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Dave Page <dpage(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 15:14:23
Message-ID: 46FD1A4F.9010108@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Dave Page wrote:
>
> I believe we just didn't notice it until now because the older Mingw
> builds use the MSVC 6.0 runtimes which just happened to be compatible
> with the OpenSSL binary builds (we're now using 8.0), in addition to
> which there are relatively few people using client-side certs I'd wager.
>
>

So SSL works without this wart if you don't have a client cert?

cheers

andrew


From: Dave Page <dpage(at)postgresql(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 15:15:26
Message-ID: 46FD1A8E.2070501@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg사설 토토SQL

Andrew Dunstan wrote:
>
>
> Dave Page wrote:
>>
>> I believe we just didn't notice it until now because the older Mingw
>> builds use the MSVC 6.0 runtimes which just happened to be compatible
>> with the OpenSSL binary builds (we're now using 8.0), in addition to
>> which there are relatively few people using client-side certs I'd wager.
>>
>>
>
> So SSL works without this wart if you don't have a client cert?

Yep.

/D


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Dave Page <dpage(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 15:20:57
Message-ID: 46FD1BD9.4070202@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Dave Page wrote:
> Andrew Dunstan wrote:
>>
>>
>> Dave Page wrote:
>>>
>>> I believe we just didn't notice it until now because the older Mingw
>>> builds use the MSVC 6.0 runtimes which just happened to be
>>> compatible with the OpenSSL binary builds (we're now using 8.0), in
>>> addition to which there are relatively few people using client-side
>>> certs I'd wager.
>>>
>>>
>>
>> So SSL works without this wart if you don't have a client cert?
>
> Yep.
>
>

Then I think I'd rather disable use of client certs for the offending
openssl versions in libpq, or let the apps die and refer the customers
to the openssl people to lobby them for a sane solution.

cheers

andrew


From: Dave Page <dpage(at)postgresql(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 15:24:55
Message-ID: 46FD1CC7.5040300@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Andrew Dunstan wrote:
> Then I think I'd rather disable use of client certs for the offending
> openssl versions in libpq, or let the apps die and refer the customers
> to the openssl people to lobby them for a sane solution.

If this were 8.0 I'd agree, but thats not a nice solution for those
already using client certs (such as the pgAdmin user who brought this to
my attention).

:-(

/D


From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)postgresql(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 15:50:17
Message-ID: 46FD22B9.4080004@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 503 토토 사이트 페치

Dave Page wrote:
> Andrew Dunstan wrote:
>> Dave Page wrote:
>>> I believe we just didn't notice it until now because the older Mingw
>>> builds use the MSVC 6.0 runtimes which just happened to be compatible
>>> with the OpenSSL binary builds (we're now using 8.0), in addition to
>>> which there are relatively few people using client-side certs I'd wager.
>>
>> So SSL works without this wart if you don't have a client cert?
>
> Yep.

According to the OpenSSL FAQ, the purpose of the applink is to allow
mixing release and debug versions or multi-threaded and
non-multithreaded versions of libraries:

http://www.openssl.org/support/faq.html#PROG2

How come we only bump into the crash with client certs?

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Dave Page <dpage(at)postgresql(dot)org>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 16:09:24
Message-ID: 46FD2734.8070303@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg와이즈 토토SQL

Heikki Linnakangas wrote:
> Dave Page wrote:
>> Andrew Dunstan wrote:
>>> Dave Page wrote:
>>>> I believe we just didn't notice it until now because the older Mingw
>>>> builds use the MSVC 6.0 runtimes which just happened to be compatible
>>>> with the OpenSSL binary builds (we're now using 8.0), in addition to
>>>> which there are relatively few people using client-side certs I'd wager.
>>> So SSL works without this wart if you don't have a client cert?
>> Yep.
>
> According to the OpenSSL FAQ, the purpose of the applink is to allow
> mixing release and debug versions or multi-threaded and
> non-multithreaded versions of libraries:
>
> http://www.openssl.org/support/faq.html#PROG2

Yeah - which in itself is a pita because with their 'workaround' we now
need to ensure we use a debug libpq with a debug pgadmin whereas
previously mixing 'n' matching wasn't an issue.

> How come we only bump into the crash with client certs?
>

I assume it uses fopen() or one of the other functions it does a
GetProcAddress() on in that situation.

/D


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dave Page <dpage(at)postgresql(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 16:13:32
Message-ID: 3018.1190996012@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Dave Page <dpage(at)postgresql(dot)org> writes:
> Andrew Dunstan wrote:
>> Then I think I'd rather disable use of client certs for the offending
>> openssl versions in libpq, or let the apps die and refer the customers
>> to the openssl people to lobby them for a sane solution.

> If this were 8.0 I'd agree, but thats not a nice solution for those
> already using client certs (such as the pgAdmin user who brought this to
> my attention).

Doesn't really matter. Even if we were willing to hack our own client
apps like that (which I'm not), we can *not* transfer such a requirement
onto every libpq-using application. It's just not acceptable.

regards, tom lane


From: Dave Page <dpage(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 16:26:35
Message-ID: 46FD2B3B.3000605@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Tom Lane wrote:
> Dave Page <dpage(at)postgresql(dot)org> writes:
>> Andrew Dunstan wrote:
>>> Then I think I'd rather disable use of client certs for the offending
>>> openssl versions in libpq, or let the apps die and refer the customers
>>> to the openssl people to lobby them for a sane solution.
>
>> If this were 8.0 I'd agree, but thats not a nice solution for those
>> already using client certs (such as the pgAdmin user who brought this to
>> my attention).
>
> Doesn't really matter. Even if we were willing to hack our own client
> apps like that (which I'm not), we can *not* transfer such a requirement
> onto every libpq-using application. It's just not acceptable.

*We're* not transfering any requirement. I've fixed pgAdmin for example
without any need to touch any Postgres code. If you don't want to
include the fix (which I can quite understand) it'll just mean that the
PG utilities won't work with client certs.

/D


From: "Marko Kreen" <markokr(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Dave Page" <dpage(at)postgresql(dot)org>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 16:26:46
Message-ID: e51f66da0709280926o4d8a4a1cn4148598bea723217@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On 9/28/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Dave Page <dpage(at)postgresql(dot)org> writes:
> > Andrew Dunstan wrote:
> >> Then I think I'd rather disable use of client certs for the offending
> >> openssl versions in libpq, or let the apps die and refer the customers
> >> to the openssl people to lobby them for a sane solution.
>
> > If this were 8.0 I'd agree, but thats not a nice solution for those
> > already using client certs (such as the pgAdmin user who brought this to
> > my attention).
>
> Doesn't really matter. Even if we were willing to hack our own client
> apps like that (which I'm not), we can *not* transfer such a requirement
> onto every libpq-using application. It's just not acceptable.

Is it possible to use GNUTLS on Windows?

--
marko


From: Dave Page <dpage(at)postgresql(dot)org>
To: Marko Kreen <markokr(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 16:30:29
Message-ID: 46FD2C25.60106@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토 꽁 머니SQL

Marko Kreen wrote:
> On 9/28/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Dave Page <dpage(at)postgresql(dot)org> writes:
>>> Andrew Dunstan wrote:
>>>> Then I think I'd rather disable use of client certs for the offending
>>>> openssl versions in libpq, or let the apps die and refer the customers
>>>> to the openssl people to lobby them for a sane solution.
>>> If this were 8.0 I'd agree, but thats not a nice solution for those
>>> already using client certs (such as the pgAdmin user who brought this to
>>> my attention).
>> Doesn't really matter. Even if we were willing to hack our own client
>> apps like that (which I'm not), we can *not* transfer such a requirement
>> onto every libpq-using application. It's just not acceptable.
>
> Is it possible to use GNUTLS on Windows?
>

No, I don't think so. I didn't think we accepted Martijn's(?) patch for
it anyway?

Regards, Dave


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Dave Page <dpage(at)postgresql(dot)org>
Cc: Marko Kreen <markokr(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 16:40:25
Message-ID: 46FD2E79.4040908@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Dave Page wrote:
>>
>> Is it possible to use GNUTLS on Windows?
>>
>
> No, I don't think so. I didn't think we accepted Martijn's(?) patch
> for it anyway?
>
>

This mess might make that worth revisiting, if it can be used on
Windows. See http://josefsson.org/gnutls4win/

cheers

andrew


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dave Page <dpage(at)postgresql(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 16:55:37
Message-ID: 3763.1190998537@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Dave Page <dpage(at)postgresql(dot)org> writes:
> Tom Lane wrote:
>> Doesn't really matter. Even if we were willing to hack our own client
>> apps like that (which I'm not), we can *not* transfer such a requirement
>> onto every libpq-using application. It's just not acceptable.

> *We're* not transfering any requirement. I've fixed pgAdmin for example
> without any need to touch any Postgres code.

Well, yeah, we are, as evidenced by the fact that you had to do
something to pgAdmin. Every other application that uses libpq would
also be facing source code changes to make it work.

Is there really no way to solve this within libpq?

regards, tom lane


From: Dave Page <dpage(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 18:24:01
Message-ID: 46FD46C1.2070504@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Tom Lane wrote:
> Dave Page <dpage(at)postgresql(dot)org> writes:
>> Tom Lane wrote:
>>> Doesn't really matter. Even if we were willing to hack our own client
>>> apps like that (which I'm not), we can *not* transfer such a requirement
>>> onto every libpq-using application. It's just not acceptable.
>
>> *We're* not transfering any requirement. I've fixed pgAdmin for example
>> without any need to touch any Postgres code.
>
> Well, yeah, we are, as evidenced by the fact that you had to do
> something to pgAdmin. Every other application that uses libpq would
> also be facing source code changes to make it work.

Yes, but it's not us requiring it (except in as much as we provide some
level of SSL support) but the OpenSSL crew.

> Is there really no way to solve this within libpq?

Including the applink code in libpq was the first think I tried but it
doesn't work (apparently because there is no way to ensure that any
random module containing it isn't unloaded before it's needed which
sorta makes sense).

I did stumble across this text on a mailing list in response to someone
with a similar problem in some JNI code. I know little of the OpenSSL
API, but perhaps it rings bells with you before I spend my evening
trying to figure it out?

-----
But for new and evolving code [I suppose JNI would be rather
new and evolving] applink should not be preferable option, as there is a
way around it, namely avoid passing FILE* to BIO, but instead let BIO
open files for you, i.e. avoid BIO_new_fp and stick to BIO_new_filename.
Note that applink is engaged purely on demand and it doesn't have to be
present in application if application doesn't pass FILE* to BIO.
-----

/D


From: Dave Page <dpage(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 19:20:52
Message-ID: 46FD5414.4050000@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Dave Page wrote:
> I did stumble across this text on a mailing list in response to someone
> with a similar problem in some JNI code. I know little of the OpenSSL
> API, but perhaps it rings bells with you before I spend my evening
> trying to figure it out?

OK, I think I've figured out a fix. Working up a patch now...

/D


From: Dave Page <dpage(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 20:22:33
Message-ID: 46FD6289.6070806@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Dave Page wrote:
> Dave Page wrote:
>> I did stumble across this text on a mailing list in response to someone
>> with a similar problem in some JNI code. I know little of the OpenSSL
>> API, but perhaps it rings bells with you before I spend my evening
>> trying to figure it out?
>
> OK, I think I've figured out a fix. Working up a patch now...

Patch attached.

It appears to work fine except that if the client certificate is
missing, instead of:

could not open certificate file "C:\Documents and
Settings\Dave\Application Data/postgresql/postgresql.crt": No such file
or directory

I get:

Error connecting to the server: SSL SYSCALL error: Operation would block
(0x00002733/10035)

for reasons that are not clear to me. Any ideas?

Regards, Dave

Attachment Content-Type Size
openssl-msvc-runtimes.patch text/x-diff 4.4 KB

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Dave Page <dpage(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 20:48:59
Message-ID: 46FD68BB.6020804@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 503 토토 핫 페치 실패

Dave Page wrote:
> Dave Page wrote:
>> Dave Page wrote:
>>> I did stumble across this text on a mailing list in response to someone
>>> with a similar problem in some JNI code. I know little of the OpenSSL
>>> API, but perhaps it rings bells with you before I spend my evening
>>> trying to figure it out?
>> OK, I think I've figured out a fix. Working up a patch now...
>
> Patch attached.

(sorry, been offline for the day)

Is there any reason not to just do this on *all* platforms, and get rid
of all the #ifdefs?

The new code actually seems cleaner to me than what we did before,
really... Since it lets OpenSSL do all the work for it.

> It appears to work fine except that if the client certificate is
> missing, instead of:
>
> could not open certificate file "C:\Documents and
> Settings\Dave\Application Data/postgresql/postgresql.crt": No such file
> or directory
>
> I get:
>
> Error connecting to the server: SSL SYSCALL error: Operation would block
> (0x00002733/10035)
>
> for reasons that are not clear to me. Any ideas?

I wonder if it might be related to our socket/signal emulation stuff.
I'd be interested to see what happens with the same code on Unix, but
sorry, don't have time to test myself - will be offline again tomorrow :-(

//Magnus


From: Dave Page <dpage(at)postgresql(dot)org>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 21:00:59
Message-ID: 46FD6B8B.8040308@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 503 사설 토토 페치 실패

Magnus Hagander wrote:
> Dave Page wrote:
>> Dave Page wrote:
>>> Dave Page wrote:
>>>> I did stumble across this text on a mailing list in response to someone
>>>> with a similar problem in some JNI code. I know little of the OpenSSL
>>>> API, but perhaps it rings bells with you before I spend my evening
>>>> trying to figure it out?
>>> OK, I think I've figured out a fix. Working up a patch now...
>> Patch attached.
>
> (sorry, been offline for the day)
>
> Is there any reason not to just do this on *all* platforms, and get rid
> of all the #ifdefs?

Yes, (see the comment in the code). We stat the private key on *nix to
ensure it hasn't changed underneath us which can't be done using the BIO
functions... though I wonder if we can get the FILE pointer from BIO and
do it that way. Should be as safe on *nix as what we currently do.

> I wonder if it might be related to our socket/signal emulation stuff.
> I'd be interested to see what happens with the same code on Unix, but
> sorry, don't have time to test myself - will be offline again tomorrow :-(

NP.

/D


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Dave Page <dpage(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 21:08:46
Message-ID: 46FD6D5E.7010501@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토 캔SQL :

Dave Page wrote:
> Magnus Hagander wrote:
>> Dave Page wrote:
>>> Dave Page wrote:
>>>> Dave Page wrote:
>>>>> I did stumble across this text on a mailing list in response to someone
>>>>> with a similar problem in some JNI code. I know little of the OpenSSL
>>>>> API, but perhaps it rings bells with you before I spend my evening
>>>>> trying to figure it out?
>>>> OK, I think I've figured out a fix. Working up a patch now...
>>> Patch attached.
>> (sorry, been offline for the day)
>>
>> Is there any reason not to just do this on *all* platforms, and get rid
>> of all the #ifdefs?
>
> Yes, (see the comment in the code). We stat the private key on *nix to
> ensure it hasn't changed underneath us which can't be done using the BIO
> functions... though I wonder if we can get the FILE pointer from BIO and
> do it that way. Should be as safe on *nix as what we currently do.

Hrrm. Obviously, I need to go sleep now. Sorry about that.

But it'd be nice to get rid of all those #ifdef blocks..

//Magnus


From: Dave Page <dpage(at)postgresql(dot)org>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 21:22:03
Message-ID: 46FD707B.9060405@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Magnus Hagander wrote:
> Hrrm. Obviously, I need to go sleep now. Sorry about that.
>
> But it'd be nice to get rid of all those #ifdef blocks..

See the attached revision. This is untested as I don't have a linux box
to hand, but I believe it's right.

/D

Attachment Content-Type Size
openssl-msvc-runtimes2.patch text/x-diff 4.6 KB

From: Dave Page <dpage(at)postgresql(dot)org>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-28 21:38:11
Message-ID: 46FD7443.4080805@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Dave Page wrote:
> Magnus Hagander wrote:
>> Hrrm. Obviously, I need to go sleep now. Sorry about that.
>>
>> But it'd be nice to get rid of all those #ifdef blocks..
>
> See the attached revision. This is untested as I don't have a linux box
> to hand, but I believe it's right.

Ignore that - I managed to break it :-(. Here's a corrected version.

/D

Attachment Content-Type Size
openssl-msvc-runtimes3.patch text/x-diff 4.6 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dave Page <dpage(at)postgresql(dot)org>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: OpenSSL Applink
Date: 2007-09-29 00:28:09
Message-ID: 22154.1191025689@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Dave Page <dpage(at)postgresql(dot)org> writes:
> Magnus Hagander wrote:
>> Is there any reason not to just do this on *all* platforms, and get rid
>> of all the #ifdefs?

> Yes, (see the comment in the code). We stat the private key on *nix to
> ensure it hasn't changed underneath us which can't be done using the BIO
> functions... though I wonder if we can get the FILE pointer from BIO and
> do it that way. Should be as safe on *nix as what we currently do.

Perhaps you could still open the file yourself, and use BIO_new_fp()
instead of BIO_new_file()? I'm not getting responses from openssl.org
at the moment, but here's another copy of the relevant man page:

http://developer.apple.com/documentation/Darwin/Reference/Manpages/man3/BIO_s_file.3ssl.html

I concur with Magnus that it'll be better if there's not two code paths
here. It's not entirely clear whether BIO_new_fp() would avoid the
problematic calls, but it doesn't look like it'd be hard to try.

regards, tom lane