Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YWFPr-0004bP-4S for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Mar 2015 02:33:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YWFPp-0000Ly-S0 for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Mar 2015 02:33:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YWFPn-0000Lp-Fh for pgsql-hackers@postgresql.org; Fri, 13 Mar 2015 02:33:31 +0000 Received: from mout.gmx.net ([212.227.17.22]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YWFPe-00084M-9e for pgsql-hackers@postgresql.org; Fri, 13 Mar 2015 02:33:29 +0000 Received: from auth1-smtp.messagingengine.com ([66.111.4.227]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0Lyj4F-1ZbBhQ1vnz-0168Nr for ; Fri, 13 Mar 2015 03:33:19 +0100 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailauth.nyi.internal (Postfix) with ESMTP id 5D18E2086E for ; Thu, 12 Mar 2015 22:33:16 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Thu, 12 Mar 2015 22:33:18 -0400 X-Sasl-enc: NC8iG+1/QB/z9mYBHTo2Q3RqAHeopsL4anOORXY3ShuO 1426213997 Received: from [10.0.0.13] (unknown [67.165.24.246]) by mail.messagingengine.com (Postfix) with ESMTPA id 8071DC002A3; Thu, 12 Mar 2015 22:33:17 -0400 (EDT) Message-ID: <55024C6C.6000207@gmx.net> Date: Thu, 12 Mar 2015 22:33:16 -0400 From: Peter Eisentraut User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Haribabu Kommi , Greg Stark CC: Jim Nasby , Abhijit Menon-Sen , PostgreSQL-development , Stephen Frost Subject: Re: Providing catalog view to pg_hba.conf file - Patch submission References: <82897A1301080E4B8E461DDAA0FFCF14DDE1@SYD1216> <82897A1301080E4B8E461DDAA0FFCF14FD6E@SYD1216> <20140629165554.GA5984@toroid.org> <20140630070646.GY31357@toroid.org> <54F5F7DD.8020501@BlueTreble.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:07+QQCABfY9b5AUnWNT3v2P1HLfr+Mp3m00dS284BxdviZ1dxii /K68P9GMyba3/EfZhTz3JzK8eIthry8mkzvHRtd5qp25At/46hCvTlRDdxrZjIH5tx1kp/x hHDh6oqeMfK9WRjZ+ebORo2Go7XuVUHP2To8KPT0ObSOS0UhUNYfUSRMEC0dyeVhhc6cCuG pt1+M5VaiGDIIu2l+cOlA== X-UI-Out-Filterresults: notjunk:1; X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 3/4/15 1:34 AM, Haribabu Kommi wrote: > On Wed, Mar 4, 2015 at 12:35 PM, Haribabu Kommi > wrote: >> + foreach(line, parsed_hba_lines) >> >> In the above for loop it is better to add "check_for_interrupts" to >> avoid it looping >> if the parsed_hba_lines are more. > > Updated patch is attached with the addition of check_for_interrupts in > the for loop. I tried out your latest patch. I like that it updates even in running sessions when the file is reloaded. The permission checking is faulty, because unprivileged users can execute pg_hba_settings() directly. Check the error messages against the style guide (especially capitalization). I don't like that there is a hard-coded limit of 16 options 5 pages away from where it is actually used. That could be done better. I'm not sure about the name "pg_hba_settings". Why not just "pg_hba" or "pg_hba_conf" if you're going for a representation that is close to the file (as opposed to pg_settings, which is really a lot more abstract than any particular file). I would put the line_number column first. I continue to think that it is a serious mistake to stick special values like 'all' and 'replication' into the arrays without additional decoration. That makes this view useless or at least dangerous for editing tools or tools that want to reassemble the original file. Clearly at least one of those has to be a use case. Otherwise we can just print out the physical lines without interpretation. The "mask" field can go, because address is of type inet, which can represent masks itself. (Or should it be cidr then? Who knows.) The preferred visual representation of masks in pg_hba.conf has been "address/mask" for a while now, so we should preserve that. Additionally, you can then use the existing inet/cidr operations to do things like checking whether some IP address is contained in an address specification. I can't tell from the documentation what the "compare_method" field is supposed to do. I see it on the code, but that is not a natural representation of pg_hba.conf. In fact, this just supports my earlier statement. Why are special values in the address field special, but not in the user or database fields? uaImplicitReject is not a user-facing authentication method, so it shouldn't be shown (or showable). I would have expected options to be split into keys and values. All that code to reassemble the options from the parsed struct representation seems crazy to me. Surely, we could save the strings as we parse them? I can't make sense of the log message "pg_hba.conf not reloaded, pg_hba_settings may show stale information". If load_hba() failed, the information isn't stale, is it? In any case, printing this to the server log seems kind of pointless, because someone using the view is presumably doing so because they can't or don't want to read the server log. The proper place might be a warning when the view is actually called. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers