]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: acme: copy the original ckch_store
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 11 Apr 2025 21:52:07 +0000 (23:52 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Fri, 11 Apr 2025 23:39:03 +0000 (01:39 +0200)
Copy the original ckch_store instead of creating a new one. This allows
to inherit the ckch_conf from the previous structure when doing a
ckchs_dup(). The ckch_conf contains the SAN for ACME.

Free the previous PKEY since it a new one is generated.

src/acme.c

index 5e1ea927cf7c7083289e52f24f6767c2daa1248b..5519ae25e7366640480a47dc634a43092b1ce2d9 100644 (file)
@@ -1723,7 +1723,7 @@ static int cli_acme_renew_parse(char **args, char *payload, struct appctx *appct
                goto err;
        }
 
-       newstore = ckch_store_new(store->path);
+       newstore = ckchs_dup(store);
        if (!newstore) {
                memprintf(&err, "Out of memory.\n");
                goto err;
@@ -1769,6 +1769,7 @@ static int cli_acme_renew_parse(char **args, char *payload, struct appctx *appct
 
        EVP_PKEY_CTX_free(pkey_ctx);
 
+       EVP_PKEY_free(newstore->data->key);
        newstore->data->key = pkey;
 
        ctx->req = acme_x509_req(pkey, store->conf.acme.domains);
@@ -1777,8 +1778,6 @@ static int cli_acme_renew_parse(char **args, char *payload, struct appctx *appct
                goto err;
        }
 
-       /* XXX: must implement a real copy */
-       newstore->conf = store->conf;
 
        ctx->store = newstore;
        ctx->cfg = cfg;