From: Justin Pryzby <pryzby@telsasoft.com>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Allow continuations in "pg_hba.conf" files
Date: Wed, 25 Mar 2020 14:39:23 -0500
Message-ID: <20200325193923.GD21443@telsasoft.com> (raw)
In-Reply-To: <alpine.DEB.2.21.2003251906140.15243@pseudo>
References: <alpine.DEB.2.21.2003251906140.15243@pseudo>
Hi,
On Wed, Mar 25, 2020 at 07:09:38PM +0100, Fabien COELHO wrote:
>
> Hello,
>
> After writing an unreadable and stupidly long line for ldap authentification
> in a "pg_hba.conf" file, I figured out that allowing continuations looked
> simple enough and should just be done.
I tried this briefly.
> - Records cannot be continued across lines.
> + Records can be backslash-continued across lines.
Maybe say: "lines ending with a backslash are logically continued on the next
line", or similar.
> + /* else we have a continuation, just blank it and loop */
> + continuations++;
> + *curend++ = ' ';
Since it puts a blank there, it creates a "word" boundary, which I gather
worked for your use case. But I wonder whether it's needed to add a space (or
otherwise, document that lines cannot be split beween words?).
You might compare this behavior with that of makefiles (or find a better
example) which I happen to recall *don't* add a space; if you want that, you
have to end the line with: " \" not just "\".
Anyway, I checked that the current patch handles users split across lines, like:
alice,\
bob,\
carol
As written, that depends on the parser's behavior of ignoring commas and
blanks, since it sees:
"alice,[SPACE]bob,[SPACE]carol"
Maybe it'd be nice to avoid depending on that.
I tried with a username called "alice,bob", split across lines:
"alice,\
bob",\
But then your patch makes it look for a user called "alice, bob" (with a
space). I realize that's not a compelling argument :)
Note, that also appears to affect the "username maps" file. So mention in that
chapter, too.
https://www.postgresql.org/docs/current/auth-username-maps.html
Cheers,
--
Justin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: pryzby@telsasoft.com, coelho@cri.ensmp.fr
Subject: Re: Allow continuations in "pg_hba.conf" files
In-Reply-To: <20200325193923.GD21443@telsasoft.com>
References: <alpine.DEB.2.21.2003251906140.15243@pseudo> <20200325193923.GD21443@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox