Re: \conninfo and SSL

From: Alastair Turner <bell(at)ctrlf5(dot)co(dot)za>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: \conninfo and SSL
Date: 2012-06-03 09:30:31
Message-ID: CAFgq2fWYH_QpE+Qgg9Xx+zzNXZx2Gx+x+sv76jVEgzPuVfao4w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 31, 2012 at 9:11 PM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> On Thu, May 31, 2012 at 9:04 PM, Bruce Momjian <bruce(at)momjian(dot)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();
+ }
}
}

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2012-06-03 10:22:39 Re: Visual Studio 2012 RC
Previous Message Brar Piening 2012-06-02 21:26:14 Visual Studio 2012 RC