Re: PQconnectdb SSL (sslmode)

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: vishal saberwal <vishalsaberwal(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: PQconnectdb SSL (sslmode)
Date: 2005-08-26 01:56:26
Message-ID: 20050826015626.GA89218@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Aug 25, 2005 at 06:20:52PM -0700, vishal saberwal wrote:
>
> I am not sure if this is a bug.

If you're not sure then it would be better to post to another mailing
list like pgsql-general or one of the more specific lists. That
would expose your question to a larger pool of expertise, and it
would minimize the number of false bug reports.

> int ret=PQconnectdb("hostaddr=192.168.200.10 dbname=dbm user=postgres
> sslmode=prefer");
>
> ' ret' prints -1.

PQconnectdb() returns a PGconn * -- why are you assigning the return
value to an int? After PQconnectdb() you should be calling PQstatus()
and checking its return value. If the status isn't CONNECTION_OK
then PQerrorMessage() should return a string saying why. See the
libpq documentation for more information:

http://www.postgresql.org/docs/8.0/static/libpq.html#LIBPQ-CONNECT
http://www.postgresql.org/docs/8.0/static/libpq-status.html

--
Michael Fuhr

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Fuhr 2005-08-26 04:24:07 Re: BUG #1848: Segfault with pg_dump when database name omitted
Previous Message vishal saberwal 2005-08-26 01:30:18 Re: Ref: BUG#1321: SSL error: sslv3 alert handshake failure