Skip site navigation (1) Skip section navigation (2)

Re: [psqlODBC 08.02.0402] OpenSSL libraries

From: Rainer Bauer <usenet(at)munnin(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Re: [psqlODBC 08.02.0402] OpenSSL libraries
Date: 2007-06-06 12:15:50
Message-ID: 8k8d63tai4higfh38i6cvmruv42f7lq8bk@4ax.com (view raw or flat)
Thread:
Lists: pgsql-odbc
Hiroshi Inoue wrote:
>> According to the FAQ <http://www.openssl.org/support/faq.html#PROG2>, psqlODBC
>> should contain the code for OPENSSL_Applink() (see also
>
>Shouldn't it be added to the EXE project not to the DLL one ?

Seems so [see replay from Andy Polyakov]:
<http://groups.google.com/group/mailing.openssl.users/browse_thread/thread/2c53d4dbd7545255/875519825b7dea09>

"... in the [export] symbol table of the *application*. The applink.c 
module has to be linked into *application,* not some other dll, even if 
it's dll that links with openssl dll and not application itself."

>> Why is psqlODBC build with /MT and not /MD?
>
>Because it has been so without problems.
>
>I'm pretty confused. Is it realistic to expect all the relevant dlls
>and the exe itself are compiled with the same option settings and
>compiler ? For example, if we build it with /MD otpion using vc8.0,
>the driver would link msvcr(p)80.dll. OTOH ssleay32.dll downloaded
>from http://www.slproweb.com/products/Win32OpenSSL.html seems to
>be linking msvcr71.dll. Is there no problem with it ?

There shouldn't, as long as there is no memory allocated/freed across modules
compiled with different runtimes.

Time to test this:
I have activated SSL in my local Postgres 8.2.4 installation
[postgresql.conf]. After creating and installing the server certificate,
restarting Postgres and specifying "SSLmode=require" in the ODBC connection
string I was able to establish a SSL connection through ODBC.

So SSL is working, *but* then happened what I had expected: at program exit
the program core dumps while freeing memory. I can see that this happens in
libeay32.dll.

What I did next was adding the OPENSSL_Applink() code snippet to my
application code. It still crashed.

I tried linking the psqlODBC driver with all four different OpenSSL libs found
in the C:\OpenSSL\lib\VC folder. It still crashed.

Next I replaced the OpenSSL DLLs [0.9.8.4] in the psqlODBC installation with
the ones shipped with my OpenSSL installation [0.9.8.5]. It still crashed.

Before investigating this any further I must ask if anybody has ever used an
SSL connection with psqlODBC?

>> Why are SSL connections working at all (I assume they are, since I cannot test
>> it here), if the OpenSSL DLLs and psqlODBC are linked to different runtimes?
>
>It's not that easy to crash programs with the mixed options and
>I don't know definite problems to mix the options.
>OPENSSL_Applink() may be the hint.

Do you have a Win32 program that establishes a SSL connection and does NOT
crash? If so could you send me the source so that I can verify it here?

Rainer

PS: psqlODBC only calls SSL_read(), SSL_write() and SSL_get_error(). As I
understand it all the real SSL handling happens in libpq. So maybe I am
looking at the wrong place to find the error?

In response to

Responses

pgsql-odbc by date

Next:From: Hiroshi InoueDate: 2007-06-06 15:20:12
Subject: Re: [psqlODBC 08.02.0402] OpenSSL libraries
Previous:From: Hiroshi InoueDate: 2007-06-06 04:12:37
Subject: Re: psqlodbc-07.03.0100

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group