static int mod_child(int rank) { if (tls_disable || (tls_domains_cfg==0)) return 0; /* fix tls config only from the main proc/PROC_INIT., when we know * the exact process number and before any other process starts*/ if (rank == PROC_INIT){ if (cfg_get(tls, tls_cfg, config_file).s){ if (tls_fix_domains_cfg(*tls_domains_cfg, &srv_defaults, &cli_defaults) < 0) return -1; }else{ if (tls_fix_domains_cfg(*tls_domains_cfg, &mod_params, &mod_params) < 0) return -1; } } return 0; }
static void tls_reload(rpc_t* rpc, void* ctx) { tls_domains_cfg_t* cfg; str tls_domains_cfg_file; tls_domains_cfg_file = cfg_get(tls, tls_cfg, config_file); if (!tls_domains_cfg_file.s) { rpc->fault(ctx, 500, "No TLS configuration file configured"); return; } /* Try to delete old configurations first */ collect_garbage(); cfg = tls_load_config(&tls_domains_cfg_file); if (!cfg) { rpc->fault(ctx, 500, "Error while loading TLS configuration file" " (consult server log)"); return; } if (tls_fix_domains_cfg(cfg, &srv_defaults, &cli_defaults) < 0) { rpc->fault(ctx, 500, "Error while fixing TLS configuration" " (consult server log)"); goto error; } if (tls_check_sockets(cfg) < 0) { rpc->fault(ctx, 500, "No server listening socket found for one of" " TLS domains (consult server log)"); goto error; } DBG("TLS configuration successfuly loaded"); cfg->next = (*tls_domains_cfg); *tls_domains_cfg = cfg; return; error: tls_free_cfg(cfg); }