From acdb77f9ceab6655fc13025f5d5c2668dc93f644 Mon Sep 17 00:00:00 2001 From: SciLor Date: Thu, 3 Oct 2024 13:16:35 +0000 Subject: [PATCH] set all certs in subdir for new overlay --- src/settings.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/settings.c b/src/settings.c index 6a6086d9..c6935a9d 100644 --- a/src/settings.c +++ b/src/settings.c @@ -402,13 +402,24 @@ settings_t *get_settings_cn(const char *commonName) settings_set_string_id("boxModel", "", i); settings_get_by_name_id("toniebox.api_access", i)->overlayed = true; settings_get_by_name_id("core.certdir", i)->overlayed = true; + settings_get_by_name_id("core.client_cert.file.ca", i)->overlayed = true; + settings_get_by_name_id("core.client_cert.file.crt", i)->overlayed = true; + settings_get_by_name_id("core.client_cert.file.key", i)->overlayed = true; const char *certDir = settings_get_string_id("core.certdir", i); osStringToLower(boxId); - char *customCertDir = osAllocMem(osStrlen(boxId) + osStrlen(certDir) + 2); - osSnprintf(customCertDir, osStrlen(boxId) + osStrlen(certDir) + 2, "%s%c%s", certDir, PATH_SEPARATOR, boxId); + char *customCertDir = custom_asprintf("%s%c%s", certDir, PATH_SEPARATOR, boxId); + char *ca = custom_asprintf("%s%c%s", customCertDir, PATH_SEPARATOR, "ca.der"); + char *crt = custom_asprintf("%s%c%s", customCertDir, PATH_SEPARATOR, "client.der"); + char *key = custom_asprintf("%s%c%s", customCertDir, PATH_SEPARATOR, "private.der"); settings_set_string_id("core.certdir", customCertDir, i); + settings_set_string_id("core.client_cert.file.ca", ca, i); + settings_set_string_id("core.client_cert.file.crt", crt, i); + settings_set_string_id("core.client_cert.file.key", key, i); osFreeMem(customCertDir); + osFreeMem(ca); + osFreeMem(crt); + osFreeMem(key); Settings_Overlay[i].internal.config_used = true; settings_save_ovl(true);