diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2019-08-27 14:44:26 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2019-08-27 14:44:26 -0400 |
commit | ef47d284dbfbd31a1c179f608942699be8b495df (patch) | |
tree | 1eed499e91b281b748bfaaf50dbdeb3a6af5e9ca /src/backend/utils/misc/postgresql.conf.sample | |
parent | 4ed3bda49d5ed4616bfca80dcb3b409be9720aff (diff) | |
download | postgresql-ef47d284dbfbd31a1c179f608942699be8b495df.tar.gz postgresql-ef47d284dbfbd31a1c179f608942699be8b495df.zip |
Reject empty names and recursion in config-file include directives.
An empty file name or subdirectory name leads join_path_components() to
just produce the parent directory name, which leads to weird failures or
recursive inclusions. Let's throw a specific error for that. It takes
only slightly more code to detect all-blank names, so do so.
Also, detect direct recursion, ie a file calling itself. As coded
this will also detect recursion via "include_dir '.'", which is
perhaps more likely than explicitly including the file itself.
Detecting indirect recursion would require API changes for guc-file.l
functions, which seems not worth it since extensions might call them.
The nesting depth limit will catch such cases eventually, just not
with such an on-point error message.
In passing, adjust the example usages in postgresql.conf.sample
to perhaps eliminate the problem at the source: there's no reason
for the examples to suggest that an empty value is valid.
Per a trouble report from Brent Bates. Back-patch to 9.5; the
issue is old, but the code in 9.4 is enough different that the
patch doesn't apply easily, and it doesn't seem worth the trouble
to fix there.
Ian Barwick and Tom Lane
Discussion: https://postgr.es/m/8c8bcbca-3bd9-dc6e-8986-04a5abdef142@2ndquadrant.com
Diffstat (limited to 'src/backend/utils/misc/postgresql.conf.sample')
-rw-r--r-- | src/backend/utils/misc/postgresql.conf.sample | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index e2100cf26d8..c7b1721b335 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -612,12 +612,13 @@ #------------------------------------------------------------------------------ # These options allow settings to be loaded from files other than the -# default postgresql.conf. +# default postgresql.conf. Note that these are directives, not variable +# assignments, so they can usefully be given more than once. -#include_dir = '' # include files ending in '.conf' from +#include_dir = '...' # include files ending in '.conf' from # a directory, e.g., 'conf.d' -#include_if_exists = '' # include file only if it exists -#include = '' # include file +#include_if_exists = '...' # include file only if it exists +#include = '...' # include file #------------------------------------------------------------------------------ |