mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 07:06:30 +00:00
configuration: reject direct recursion
Ensure a configuration file can't include itself. This is the same behaviour as core PostgreSQL.
This commit is contained in:
@@ -132,7 +132,15 @@ ProcessConfigFile(const char *base_dir, const char *config_file, const char *cal
|
|||||||
|
|
||||||
abs_path = AbsoluteConfigLocation(base_dir, config_file, calling_file);
|
abs_path = AbsoluteConfigLocation(base_dir, config_file, calling_file);
|
||||||
|
|
||||||
// XXX reject direct recursion.
|
/* Reject direct recursion */
|
||||||
|
if (calling_file && strcmp(abs_path, calling_file) == 0)
|
||||||
|
{
|
||||||
|
item_list_append_format(error_list,
|
||||||
|
_("configuration file recursion in \"%s\""),
|
||||||
|
calling_file);
|
||||||
|
pfree(abs_path);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
fp = fopen(abs_path, "r");
|
fp = fopen(abs_path, "r");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
@@ -188,7 +196,8 @@ ProcessConfigFp(FILE *fp, const char *config_file, const char *calling_file, con
|
|||||||
OK = false;
|
OK = false;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
printf("ProcessConfigFp(): base: '%s' file: '%s'; calling: '%s'\n", base_dir, config_file, calling_file);
|
|
||||||
|
//printf("ProcessConfigFp(): base: '%s' file: '%s'; calling: '%s'\n", base_dir, config_file, calling_file);
|
||||||
/*
|
/*
|
||||||
* Parse
|
* Parse
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user