Use AbsoluteConfigLocation() when building an included path in hba.c
authorMichael Paquier <michael@paquier.xyz>
Tue, 8 Nov 2022 23:47:02 +0000 (08:47 +0900)
committerMichael Paquier <michael@paquier.xyz>
Tue, 8 Nov 2022 23:47:02 +0000 (08:47 +0900)
commit6bbd8b73857a337e3aba2f6cdcaca6355b4c2b51
treef55d739c6c333db84d17bfa2c22386957f182634
parentf05a5e0003edfec027ee10d09082667036862e1c
Use AbsoluteConfigLocation() when building an included path in hba.c

The code building an absolute path to a file included, as prefixed by
'@' in authentication files, for user and database lists uses the same
logic as for GUCs, except that it has no need to know about DataDir as
there is always a calling file to rely to build the base directory path.
The refactoring done in a1a7bb8 makes this move straight-forward, and
unifies the code used for GUCs and authentication files, and the
intention is to rely also on that for the upcoming patch to be able to
include full files from HBA or ident files.

Note that this gets rid of an inconsistency introduced in 370f909, that
copied the logic coming from GUCs but applied it for files included in
authentication files, where the result buffer given to
join_path_components() must have a size of MAXPGPATH.  Based on a
double-check of the existing code, all the other callers of
join_path_components() already do that, except the code path changed
here.

Discussion: https://postgr.es/m/Y2igk7q8OMpg+Yta@paquier.xyz
src/backend/libpq/hba.c
src/backend/utils/misc/conffiles.c