1
0
mirror of http://git.haproxy.org/git/haproxy.git/ synced 2025-03-05 02:49:01 +00:00

MINOR: ssl: ckch_store_new_load_files_conf() loads filenames from ckch_conf

ckch_store_new_load_files_conf() is the equivalent of
new_ckch_store_load_files_path() but instead of trying to find the files
using a base filename, it will load them from a list of files.
This commit is contained in:
William Lallemand 2024-04-11 18:33:35 +02:00
parent 2fc9e6fa39
commit 8526d666d2
2 changed files with 30 additions and 0 deletions
include/haproxy
src

View File

@ -38,6 +38,7 @@ int ssl_sock_load_issuer_file_into_ckch(const char *path, char *buf, struct ckch
/* ckch_store functions */
struct ckch_store *ckch_store_new_load_files_path(char *path, char **err);
struct ckch_store *ckch_store_new_load_files_conf(char *name, struct ckch_conf *conf, char **err);
struct ckch_store *ckchs_lookup(char *path);
struct ckch_store *ckchs_dup(const struct ckch_store *src);
struct ckch_store *ckch_store_new(const char *filename);

View File

@ -1019,6 +1019,35 @@ end:
return NULL;
}
/*
* This function allocate a ckch_store and populate it with certificates using
* the ckch_conf structure.
*/
struct ckch_store *ckch_store_new_load_files_conf(char *name, struct ckch_conf *conf, char **err)
{
struct ckch_store *ckchs;
int cfgerr = ERR_NONE;
ckchs = ckch_store_new(name);
if (!ckchs) {
memprintf(err, "%sunable to allocate memory.\n", err && *err ? *err : "");
goto end;
}
cfgerr = ckch_store_load_files(conf, ckchs, err);
if (cfgerr & ERR_FATAL)
goto end;
/* insert into the ckchs tree */
memcpy(ckchs->path, name, strlen(name) + 1);
ebst_insert(&ckchs_tree, &ckchs->node);
return ckchs;
end:
ckch_store_free(ckchs);
return NULL;
}
/******************** ckch_inst functions ******************************/