]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
Revert "BUG/MINOR: acme: key not restored upon error in acme_res_certificate()"
authorWilliam Lallemand <wlallemand@haproxy.com>
Wed, 16 Apr 2025 12:03:08 +0000 (14:03 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Wed, 16 Apr 2025 12:03:08 +0000 (14:03 +0200)
This reverts commit 7a43094f8d8fe3c435ecc003f07453dd9de8134a.

Part of another incomplete patch was accidentally squash into the patch.

src/acme.c

index 044a8d6a06419194a5f572efb21c8ea3059c706e..2e427ebe5e5907ae58b5d451bd0d7337e269740d 100644 (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);