Re: \conninfo and SSL - Mailing list pgsql-hackers

From Alastair Turner
Subject Re: \conninfo and SSL
Date
Msg-id CAFgq2fWYH_QpE+Qgg9Xx+zzNXZx2Gx+x+sv76jVEgzPuVfao4w@mail.gmail.com
Whole thread Raw
In response to Re: \conninfo and SSL  (Magnus Hagander <magnus@hagander.net>)
Responses Re: \conninfo and SSL
Re: \conninfo and SSL
List pgsql-hackers
On Thu, May 31, 2012 at 9:11 PM, Magnus Hagander <magnus@hagander.net> wrote:
> On Thu, May 31, 2012 at 9:04 PM, Bruce Momjian <bruce@momjian.us> wrote:
>> On startup, psql shows the SSL information:
>>
>>        $ psql 'sslmode=require host=localhost'
>>        psql (9.2beta1)
>>        SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
>>
>> However, \conninfo does not mention SSL:
>>
>>        postgres=> \conninfo
>>        You are connected to database "postgres" as user "postgres" on
>>        host "localhost" at port "5432".
>>
>> Should \conninfo mention SSL?  Fortunately \c shows SSL information:
>>
>>        postgres=> \c
>>        SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
>>        You are now connected to database "postgres" as user "postgres".
>
> Well, \c creates a new connection, so that's not really an information
> command. It might not connect that trivially, depending on what
> authentication method you use.
>
> Including ssl info in \conninfo would be useful, I think.
>
> //Magnus
>

A one-line change adds the SSL info on its own line like

------
You are connected to database "scratch" as user "scratch" on host
"127.0.0.1" at port "5432".
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
------

Does this need a more integrated presentation, and therefore a broader
change to make it translatable?

Regards,
Alastair.


*** a/src/bin/psql/command.c
--- b/src/bin/psql/command.c
*************** exec_command(const char *cmd,
*** 312,319 ****
--- 312,322 ----                               printf(_("You are connected to
database \"%s\" as user \"%s\" via socket in \"%s\" at port
\"%s\".\n"),                                          db, PQuser(pset.db), host,
PQport(pset.db));                       else
+                       {                               printf(_("You are connected to
database \"%s\" as user \"%s\" on host \"%s\" at port \"%s\".\n"),                                          db,
PQuser(pset.db),host, 
PQport(pset.db));
+                               printSSLInfo();
+                       }               }       }


pgsql-hackers by date:

Previous
From: Brar Piening
Date:
Subject: Visual Studio 2012 RC
Next
From: Magnus Hagander
Date:
Subject: Re: Visual Studio 2012 RC