diff options
| author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2026-05-25 14:52:21 +0200 |
|---|---|---|
| committer | Sander Vrijders <sander@ouroboros.rocks> | 2026-05-27 15:55:08 +0200 |
| commit | b2dc1d7ec76d86a640b70dea0e92a81e1990f019 (patch) | |
| tree | 67cfe5f6488f7c92838b1bd1c1a7644a3527ad3e /src/irmd | |
| parent | a5ab03c956dce6df3148bb2df0cf8f5cf759f28a (diff) | |
| download | ouroboros-b2dc1d7ec76d86a640b70dea0e92a81e1990f019.tar.gz ouroboros-b2dc1d7ec76d86a640b70dea0e92a81e1990f019.zip | |
irmd: Reorder init/fini
Application-level OpenSSL objects (X509_STORE held by irm/OAP) must be
released before OPENSSL_cleanup() tears down libcrypto's globals,
otherwise their destructors run against half-finalised state.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/irmd')
| -rw-r--r-- | src/irmd/main.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c index 4808934f..f91e23fc 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -2394,26 +2394,31 @@ int main(int argc, goto fail_irm_init; } - if (irm_init() < 0) + if (crypt_secure_malloc_init(IRMD_SECMEM_MAX) < 0) { + log_err("Failed to initialize secure memory allocation."); + goto fail_secmem; + } + + if (irm_init() < 0) { + log_err("Failed to initialize IRMd."); goto fail_irm_init; + } if (reg_init() < 0) { log_err("Failed to initialize registry."); goto fail_reg; } - if (crypt_secure_malloc_init(IRMD_SECMEM_MAX) < 0) { - log_err("Failed to initialize secure memory allocation."); - goto fail_reg; - } - pthread_sigmask(SIG_BLOCK, &sigset, NULL); - if (irm_start() < 0) + if (irm_start() < 0) { + log_err("Failed to start IRMd."); goto fail_irm_start; + } #ifdef HAVE_TOML if (irm_configure(irmd.cfg_file) < 0) { + log_err("Failed to load IRMd configuration."); irmd_set_state(IRMD_SHUTDOWN); ret = EXIT_FAILURE; } @@ -2426,15 +2431,16 @@ int main(int argc, pthread_sigmask(SIG_UNBLOCK, &sigset, NULL); - crypt_secure_malloc_fini(); - crypt_cleanup(); - reg_clear(); reg_fini(); irm_fini(); + crypt_secure_malloc_fini(); + + crypt_cleanup(); + log_info("Ouroboros IPC Resource Manager daemon exited. Bye."); log_fini(); @@ -2446,5 +2452,8 @@ int main(int argc, fail_reg: irm_fini(); fail_irm_init: + crypt_secure_malloc_fini(); + crypt_cleanup(); + fail_secmem: exit(EXIT_FAILURE); } |
