Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 69BAD6504E3 for ; Tue, 11 Nov 2008 09:23:23 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 22437-06-5 for ; Tue, 11 Nov 2008 09:23:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from svr2.hagander.net (svr2.hagander.net [88.198.128.226]) by mail.postgresql.org (Postfix) with ESMTP id 8F1EF650476 for ; Tue, 11 Nov 2008 09:23:17 -0400 (AST) Received: from dynamic.hagander.net ([127.0.0.1]) (encrypted and authenticated) by svr2.hagander.net (Postfix) with ESMTP id F196EDCCE7C for ; Tue, 11 Nov 2008 14:23:14 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by mha-laptop.hagander.net (Postfix) with ESMTP id 72BC51240A0 for ; Tue, 11 Nov 2008 14:23:14 +0100 (CET) Message-ID: <49198742.2060906@hagander.net> Date: Tue, 11 Nov 2008 14:23:14 +0100 From: Magnus Hagander User-Agent: Thunderbird 2.0.0.17 (X11/20080925) MIME-Version: 1.0 To: PG Hackers Subject: libpq with ssl vs psql without X-Enigmail-Version: 0.95.0 Content-Type: multipart/mixed; boundary="------------080401030801000601050801" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200811/772 X-Sequence-Number: 127484 This is a multi-part message in MIME format. --------------080401030801000601050801 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I just noticed that if you have libpq with SSL support, but psql without, we don't print any SSL information at all. Would it be worthwhile to have it print that SSL is in use, even if we can't print the details about the connection? It's not something that's very common outside development scenarios, but it would be trivial to implement. And the net would probably be a code-win, since we could remove a number of #ifdef USE_SSL and replace them with one - see attached (untested so may have typos) patch. //Magnus --------------080401030801000601050801 Content-Type: text/x-diff; name="psql_ssl.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="psql_ssl.patch" diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 84d3725..b8e18cb 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -64,9 +64,7 @@ static bool lookup_function_oid(PGconn *conn, const char *desc, Oid *foid); static bool get_create_function_cmd(PGconn *conn, Oid oid, PQExpBuffer buf); static void minimal_error_message(PGresult *res); -#ifdef USE_SSL static void printSSLInfo(void); -#endif #ifdef WIN32 static void checkWin32Codepage(void); @@ -1327,9 +1325,7 @@ connection_warnings(void) #ifdef WIN32 checkWin32Codepage(); #endif -#ifdef USE_SSL printSSLInfo(); -#endif } } @@ -1339,10 +1335,10 @@ connection_warnings(void) * * Prints information about the current SSL connection, if SSL is in use */ -#ifdef USE_SSL static void printSSLInfo(void) { +#ifdef USE_SSL int sslbits = -1; SSL *ssl; @@ -1353,8 +1349,11 @@ printSSLInfo(void) SSL_get_cipher_bits(ssl, &sslbits); printf(_("SSL connection (cipher: %s, bits: %i)\n"), SSL_get_cipher(ssl), sslbits); -} +#else + if (PQgetssl(pset.db)) + printf(_("SSL connection\n")); #endif +} /* --------------080401030801000601050801--