mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-30 15:21:04 +01:00
BUG/MINOR: acme: can't override the default resolver
httpclient_acme_init() was called in cfg_parse_acme() which is at section parsing. httpclient_acme_init() also calls httpclient_create_proxy() which could create a "default" resolvers section if it doesn't exists. If one tries to override the default resolvers section after an ACME section, the resolvers section parsing will fail because the section was already created by httpclient_create_proxy(). This patch fixes the issue by moving the initialization of the ACME proxy to a pre_check callback, which is called just before check_config_validity(). Must be backported in 3.2.
This commit is contained in:
parent
2bdf5a7937
commit
b9b158ea4c
23
src/acme.c
23
src/acme.c
@ -282,14 +282,6 @@ static int cfg_parse_acme(const char *file, int linenum, char **args, int kwm)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (httpclient_acme_px == NULL) {
|
|
||||||
if (httpclient_acme_init() & ERR_FATAL) {
|
|
||||||
err_code |= ERR_ALERT | ERR_FATAL;
|
|
||||||
ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_acme = new_acme_cfg(args[1]);
|
cur_acme = new_acme_cfg(args[1]);
|
||||||
if (!cur_acme) {
|
if (!cur_acme) {
|
||||||
err_code |= ERR_ALERT | ERR_FATAL;
|
err_code |= ERR_ALERT | ERR_FATAL;
|
||||||
@ -754,6 +746,21 @@ out:
|
|||||||
return err_code;
|
return err_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* initialize the httpclient just before check_config_validity() because it could create a defaults resolver if it
|
||||||
|
* doesn't exist. */
|
||||||
|
static int cfg_precheck_acme()
|
||||||
|
{
|
||||||
|
if (acme_cfgs) {
|
||||||
|
if (httpclient_acme_init() & ERR_FATAL) {
|
||||||
|
ha_alert("couldn't initialize the httpclient for ACME.\n");
|
||||||
|
return ERR_ABORT;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ERR_NONE;
|
||||||
|
}
|
||||||
|
REGISTER_PRE_CHECK(cfg_precheck_acme);
|
||||||
|
|
||||||
/* postparser function checks if the ACME section was declared */
|
/* postparser function checks if the ACME section was declared */
|
||||||
static int cfg_postparser_acme()
|
static int cfg_postparser_acme()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user