MINOR: acme: split the CLI wait from the resolve wait

Add a new state ACME_CLI_WAIT which allows to split the CLI wait logic
from the resolve wait logic.
This commit is contained in:
William Lallemand 2026-04-02 15:16:29 +02:00
parent 2457701299
commit 6228ec6a81
2 changed files with 23 additions and 2 deletions

View File

@ -51,6 +51,7 @@ enum acme_st {
ACME_NEWACCOUNT,
ACME_NEWORDER,
ACME_AUTH,
ACME_CLI_WAIT, /* wait for the ACME_RDY_CLI */
ACME_RSLV_WAIT,
ACME_RSLV_TRIGGER,
ACME_RSLV_READY,

View File

@ -121,6 +121,7 @@ static void acme_trace(enum trace_level level, uint64_t mask, const struct trace
case ACME_NEWACCOUNT: chunk_appendf(&trace_buf, "ACME_NEWACCOUNT"); break;
case ACME_NEWORDER: chunk_appendf(&trace_buf, "ACME_NEWORDER"); break;
case ACME_AUTH: chunk_appendf(&trace_buf, "ACME_AUTH"); break;
case ACME_CLI_WAIT : chunk_appendf(&trace_buf, "ACME_CLI_WAIT"); break;
case ACME_RSLV_WAIT: chunk_appendf(&trace_buf, "ACME_RSLV_WAIT"); break;
case ACME_RSLV_TRIGGER: chunk_appendf(&trace_buf, "ACME_RSLV_TRIGGER"); break;
case ACME_RSLV_READY: chunk_appendf(&trace_buf, "ACME_RSLV_READY"); break;
@ -2386,7 +2387,7 @@ re:
}
if ((ctx->next_auth = ctx->next_auth->next) == NULL) {
if (strcasecmp(ctx->cfg->challenge, "dns-01") == 0 && ctx->cfg->cond_ready)
st = ACME_RSLV_WAIT;
st = ACME_CLI_WAIT;
else
st = ACME_CHALLENGE;
ctx->next_auth = ctx->auths;
@ -2395,7 +2396,7 @@ re:
goto nextreq;
}
break;
case ACME_RSLV_WAIT: {
case ACME_CLI_WAIT: {
struct acme_auth *auth;
int all_cond_ready = ctx->cfg->cond_ready;
@ -2415,6 +2416,25 @@ re:
if ((ctx->cfg->cond_ready & ACME_RDY_CLI) && !(all_cond_ready & ACME_RDY_CLI))
goto wait;
/* next step */
st = ACME_RSLV_WAIT;
goto nextreq;
}
break;
case ACME_RSLV_WAIT: {
struct acme_auth *auth;
int all_cond_ready = ctx->cfg->cond_ready;
for (auth = ctx->auths; auth != NULL; auth = auth->next) {
all_cond_ready &= auth->ready;
}
/* if everything is ready, let's do the challenge request */
if ((all_cond_ready & ctx->cfg->cond_ready) == ctx->cfg->cond_ready) {
st = ACME_CHALLENGE;
goto nextreq;
}
/* set the start time of the DNS checks so we can apply
* the timeout */
if (ctx->dnsstarttime == 0)