1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Introduce variables for initial and max nesting depth on configuration files

The code has been assuming already in a few places that the initial
recursion nesting depth is 0, and the recent changes in hba.c (mainly
783e8c6) have relies on this assumption in more places.  The maximum
recursion nesting level is assumed to be 10 for hba.c and GUCs.

Author: Julien Rouhaud
Discussion: https://postgr.es/m/20221124090724.n7amf5kpdhx6vb76@jrouhaud
This commit is contained in:
Michael Paquier
2022-11-25 07:40:12 +09:00
parent 2d1f3bce97
commit d13b684117
5 changed files with 20 additions and 11 deletions

View File

@ -44,6 +44,7 @@
#include "utils/acl.h"
#include "utils/backend_status.h"
#include "utils/builtins.h"
#include "utils/conffiles.h"
#include "utils/float.h"
#include "utils/guc_tables.h"
#include "utils/memutils.h"
@ -287,7 +288,7 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
head = tail = NULL;
if (!ParseConfigFile(ConfigFileName, true,
NULL, 0, 0, elevel,
NULL, 0, CONF_FILE_START_DEPTH, elevel,
&head, &tail))
{
/* Syntax error(s) detected in the file, so bail out */
@ -304,7 +305,7 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
if (DataDir)
{
if (!ParseConfigFile(PG_AUTOCONF_FILENAME, false,
NULL, 0, 0, elevel,
NULL, 0, CONF_FILE_START_DEPTH, elevel,
&head, &tail))
{
/* Syntax error(s) detected in the file, so bail out */
@ -4582,7 +4583,8 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
AutoConfFileName)));
/* parse it */
if (!ParseConfigFp(infile, AutoConfFileName, 0, LOG, &head, &tail))
if (!ParseConfigFp(infile, AutoConfFileName, CONF_FILE_START_DEPTH,
LOG, &head, &tail))
ereport(ERROR,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("could not parse contents of file \"%s\"",