Revert "BUG/MINOR: acme: key not restored upon error in acme_res_certificate()"

This reverts commit 7a43094f8d8fe3c435ecc003f07453dd9de8134a.

Part of another incomplete patch was accidentally squash into the patch.
This commit is contained in:
William Lallemand 2025-04-16 14:03:08 +02:00
parent bea6235629
commit e21a165af6

View File

@ -638,7 +638,7 @@ int acme_res_certificate(struct task *task, struct acme_ctx *ctx, char **errmsg)
struct http_hdr *hdrs, *hdr;
struct buffer *t1 = NULL, *t2 = NULL;
int ret = 1;
EVP_PKEY *key = NULL;
EVP_PKEY *key;
hc = ctx->hc;
if (!hc)
@ -681,7 +681,6 @@ int acme_res_certificate(struct task *task, struct acme_ctx *ctx, char **errmsg)
/* restore the key */
ctx->store->data->key = key;
key = NULL;
if (acme_update_certificate(task, ctx, errmsg) != 0)
goto error;
@ -690,8 +689,6 @@ out:
ret = 0;
error:
if (key)
ctx->store->data->key = key;
free_trash_chunk(t1);
free_trash_chunk(t2);
httpclient_destroy(hc);
@ -1679,9 +1676,9 @@ retry:
int i;
for (i = 0; i < ACME_RETRY - ctx->retries; i++)
delay *= 3;
delay *= 3000;
ha_notice("acme: %s, retrying in %dms (%d/%d)...\n", errmsg ? errmsg : "", delay, ACME_RETRY-ctx->retries, ACME_RETRY);
task->expire = tick_add(now_ms, delay * 1000);
task->expire = tick_add(now_ms, delay);
} else {
ha_notice("acme: %s, aborting. (%d/%d)\n", errmsg ? errmsg : "", ACME_RETRY-ctx->retries, ACME_RETRY);