Re: Audit of logout - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Audit of logout
Date
Msg-id CAA4eK1+ZKJYu_JYiJ+3kttHgEKykhutTc4w-KAF1hmmtuYGYbw@mail.gmail.com
Whole thread Raw
In response to Re: Audit of logout  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: Audit of logout
List pgsql-hackers
On Tue, Aug 5, 2014 at 8:04 PM, Fujii Masao <masao.fujii@gmail.com> wrote:
>
> Yep, the attached patch introduces PGC_SU_BACKEND and
> changes the contexts of log_connections and log_disconnections
> to PGC_SU_BACKEND. Review?
>

1.
! else if (context != PGC_POSTMASTER && context != PGC_SU_BACKEND &&
! context != PGC_SU_BACKEND && source != PGC_S_CLIENT)

In the above check for PGC_SU_BACKEND is repeated, here
one of the check should be PGC_SU_BACKEND  and other
should be PGC_BACKEND.

2.
+ case PGC_SU_BACKEND:
+ if (context == PGC_BACKEND)
+ {
..
..
+ return 0;
+ }
  case PGC_BACKEND:
  if (context == PGC_SIGHUP)

Changing PGC_SU_BACKEND parameter (log_connections) is
visible even with a non-super user client due to above code.
Shouldn't it be only visible for super-user logins?

Simple steps to reproduce the problem:
a. start Server (default configuration)
b. connect with superuser
c. change in log_connections to on in postgresql.conf
d. perform select pg_reload_conf();
e. connect with non-super-user 
f.  show log_connections;  --This step shows the value as on,
                                       --whereas I think it should have been off

This test has been performed on *Windows*.


With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Support for N synchronous standby servers
Next
From: Michael Paquier
Date:
Subject: Re: [GSoC2014] Patch ALTER TABLE ... SET LOGGED