Skip to content

Commit

Permalink
set all certs in subdir for new overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
SciLor committed Oct 3, 2024
1 parent cad9df5 commit acdb77f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit acdb77f

Please sign in to comment.