Re: Allow file inclusion in pg_hba and pg_ident files - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Allow file inclusion in pg_hba and pg_ident files
Date
Msg-id Y1Y7L42Ln7HVMWM5@paquier.xyz
Whole thread Raw
In response to Re: Allow file inclusion in pg_hba and pg_ident files  (Julien Rouhaud <rjuju123@gmail.com>)
Responses Re: Allow file inclusion in pg_hba and pg_ident files
List pgsql-hackers
On Mon, Oct 24, 2022 at 01:33:12PM +0800, Julien Rouhaud wrote:
> v12 attached, fixing multiple conflicts with recent activity.

 typedef struct TokenizedAuthLine
 {
    List       *fields;         /* List of lists of AuthTokens */
+   char       *file_name;      /* File name *

Hmm.  While putting my eyes on this patch set for the first time in a
few months (sorry!), the addition of file_name to TokenizedAuthLine in
0002 stands out.  This impacts all the macros used for the validation
of the ident and HBA lines, leading as well to a lot of bloat in the
patch with patterns like that in 20~25 places:
                 errcontext("line %d of configuration file \"%s\"", \
-                           line_num, IdentFileName))); \
+                           line_num, file_name))); \
[...]
                         errcontext("line %d of configuration file \"%s\"",
-                                   line_num, HbaFileName)));
+                                   line_num, file_name)));

Do you think that it would make sense to split that into its own
patch?  That would move the code toward less references to HbaFileName
and IdentFileName, which is one step toward what we want for this
thread.  This tokenization of HBA and ident files is already shared,
so moving this knowledge into TokenizedAuthLine looks helpful
independently of the rest.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Frédéric Yhuel
Date:
Subject: Re: [PATCH] minor bug fix for pg_dump --clean
Next
From: Michael Paquier
Date:
Subject: Re: Move backup-related code to xlogbackup.c/.h