diff --git a/include/types/ssl_sock.h b/include/types/ssl_sock.h index 2f366fc355..9f3e93a6d0 100644 --- a/include/types/ssl_sock.h +++ b/include/types/ssl_sock.h @@ -123,6 +123,7 @@ struct ckch_store { struct cert_key_and_chain *ckch; unsigned int multi:1; /* is it a multi-cert bundle ? */ struct list ckch_inst; /* list of ckch_inst which uses this ckch_node */ + struct list crtlist_entry; /* list of entries which use this store */ struct ebmb_node node; char path[0]; }; @@ -168,6 +169,7 @@ struct crtlist_entry { char **filters; struct list ckch_inst; /* list of instances of this entry, there is 1 ckch_inst per instance of the crt-list */ struct list by_crtlist; /* ordered entries */ + struct list by_ckch_store; /* linked in ckch_store list of crtlist_entries */ struct ebpt_node node; /* key is a ptr to a ckch_store */ }; diff --git a/src/ssl_sock.c b/src/ssl_sock.c index f799ca8af0..39e63151e4 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -3781,6 +3781,7 @@ static struct ckch_store *ckchs_dup(const struct ckch_store *src) memcpy(dst->path, src->path, pathlen + 1); dst->multi = src->multi; LIST_INIT(&dst->ckch_inst); + LIST_INIT(&dst->crtlist_entry); dst->ckch = calloc((src->multi ? SSL_SOCK_NUM_KEYTYPES : 1), sizeof(*dst->ckch)); if (!dst->ckch) @@ -3845,6 +3846,7 @@ static struct ckch_store *ckchs_load_cert_file(char *path, int multi, char **err } LIST_INIT(&ckchs->ckch_inst); + LIST_INIT(&ckchs->crtlist_entry); if (!multi) { @@ -4643,6 +4645,7 @@ static int crtlist_load_cert_dir(char *path, struct bind_conf *bind_conf, struct goto end; } entry->node.key = ckchs; + LIST_ADDQ(&ckchs->crtlist_entry, &entry->by_ckch_store); LIST_ADDQ(&dir->ord_entries, &entry->by_crtlist); ebpt_insert(&dir->entries, &entry->node); @@ -4662,6 +4665,7 @@ static int crtlist_load_cert_dir(char *path, struct bind_conf *bind_conf, struct goto end; } entry->node.key = ckchs; + LIST_ADDQ(&ckchs->crtlist_entry, &entry->by_ckch_store); LIST_ADDQ(&dir->ord_entries, &entry->by_crtlist); ebpt_insert(&dir->entries, &entry->node); @@ -4860,6 +4864,7 @@ static int crtlist_parse_file(char *file, struct bind_conf *bind_conf, struct pr entry->fcount = arg - cur_arg - 1; ebpt_insert(&newlist->entries, &entry->node); LIST_ADDQ(&newlist->ord_entries, &entry->by_crtlist); + LIST_ADDQ(&ckchs->crtlist_entry, &entry->by_ckch_store); } if (cfgerr & ERR_CODE) goto error; @@ -12023,6 +12028,7 @@ static int cli_parse_new_cert(char **args, char *payload, struct appctx *appctx, } /* we won't create any instance */ LIST_INIT(&store->ckch_inst); + LIST_INIT(&store->crtlist_entry); /* we won't support multi-certificate bundle here */ store->multi = 0;