Re: Allow continuations in "pg_hba.conf" files

2020-09-04 Thread Tom Lane
Fabien COELHO writes: > I notice that buf.data is not freed. I guess that the server memory > management will recover it. Yeah, it's in the transient context holding all of the results of reading the file. I considered pfree'ing it at the end of the function, but I concluded there's no point.

Re: Allow continuations in "pg_hba.conf" files

2020-09-04 Thread Fabien COELHO
Hello Tom, Accordingly, I borrowed some code from that thread and present the attached revision. I also added some test coverage, since that was lacking before, and wordsmithed docs and comments slightly. Hearing no comments, pushed that way. Thanks for the fixes and improvements! I

Re: Allow continuations in "pg_hba.conf" files

2020-09-03 Thread Tom Lane
I wrote: > Accordingly, I borrowed some code from that thread and present > the attached revision. I also added some test coverage, since > that was lacking before, and wordsmithed docs and comments slightly. Hearing no comments, pushed that way. regards, tom lane

Re: Allow continuations in "pg_hba.conf" files

2020-09-02 Thread Tom Lane
Fabien COELHO writes: > [ pg-hba-cont-4.patch ] I looked this over and I think it seems reasonable, but there's something else we should do. If people are writing lines long enough that they need to continue them, how long will it be before they overrun the line length limit? Admittedly,

Re: Allow continuations in "pg_hba.conf" files

2020-07-06 Thread Fabien COELHO
In the attached v3, I've tried to clarify comments and doc about tokenization rules relating to comments, strings and continuations. Attached v4 improves comments & doc as suggested by Justin. -- Fabien.diff --git a/doc/src/sgml/client-auth.sgml b/doc/src/sgml/client-auth.sgml index

Re: Allow continuations in "pg_hba.conf" files

2020-04-02 Thread Fabien COELHO
Hello David, +Agree. However, it would nice to update the sentence below if I understand it correctly. "+   Comments, whitespace and continuations are handled in the same way as in" pg_hba.conf In the attached v3, I've tried to clarify comments and doc about tokenization rules relating

Re: Allow continuations in "pg_hba.conf" files

2020-04-02 Thread David Zhang
On 2020-04-01 10:25 p.m., Fabien COELHO wrote: Hello, FWIW, I don't think so. Generally a trailing backspace is an escape character for the following newline.  And '\ ' is a escaped space, which is usualy menas a space itself. In this case escape character doesn't work generally and I think

Re: Allow continuations in "pg_hba.conf" files

2020-04-02 Thread Fabien COELHO
Hi Justin, There are no assumption about backslash escaping, quotes and such, which seems reasonable given the lexing structure of the files, i.e. records of space-separated words, and # line comments. Quoting does allow words containing spaces: Ok. I meant that the continuation handling

Re: Allow continuations in "pg_hba.conf" files

2020-04-01 Thread Justin Pryzby
On Thu, Apr 02, 2020 at 07:25:36AM +0200, Fabien COELHO wrote: > > Hello, > > > FWIW, I don't think so. Generally a trailing backspace is an escape > > character for the following newline. And '\ ' is a escaped space, > > which is usualy menas a space itself. > > > > In this case escape

Re: Allow continuations in "pg_hba.conf" files

2020-04-01 Thread Fabien COELHO
Hello, FWIW, I don't think so. Generally a trailing backspace is an escape character for the following newline. And '\ ' is a escaped space, which is usualy menas a space itself. In this case escape character doesn't work generally and I think it is natural that a backslash in the middle

Re: Allow continuations in "pg_hba.conf" files

2020-04-01 Thread Kyotaro Horiguchi
At Thu, 02 Apr 2020 00:20:12 +, David Zhang wrote in > Hi Fabien, > Should we consider the case "\ ", i.e. one or more spaces after the backslash? > For example, if I replace a user map > "mymap /^(.*)@mydomain\.com$ \1" with > "mymap /^(.*)@mydomain\.com$ \ " > "\1" > by

Re: Allow continuations in "pg_hba.conf" files

2020-04-01 Thread David Zhang
Hi Fabien, Should we consider the case "\ ", i.e. one or more spaces after the backslash? For example, if I replace a user map "mymap /^(.*)@mydomain\.com$ \1" with "mymap /^(.*)@mydomain\.com$ \ " "\1" by adding one extra space after the backslash, then I got the pg_role="\\" but

Re: Allow continuations in "pg_hba.conf" files

2020-03-25 Thread Fabien COELHO
Hello Justin, thanks for the feedback. - 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. I tried to change it along that. Since it puts a

Re: Allow continuations in "pg_hba.conf" files

2020-03-25 Thread Justin Pryzby
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

Allow continuations in "pg_hba.conf" files

2020-03-25 Thread Fabien COELHO
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. Patch attached. -- Fabien.diff --git a/doc/src/sgml/client-auth.sgml