From: Alan T. DeKok Date: Fri, 19 Jul 2019 01:10:48 +0000 (-0400) Subject: remember the libraries we dlopen'd. CID #1445213 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a15cd29ba596e3ca1a8ff83bf81d168eb63a2192;p=thirdparty%2Ffreeradius-server.git remember the libraries we dlopen'd. CID #1445213 --- diff --git a/src/lib/server/main_config.c b/src/lib/server/main_config.c index 9bbed01504d..27836315721 100644 --- a/src/lib/server/main_config.c +++ b/src/lib/server/main_config.c @@ -1060,6 +1060,8 @@ do {\ goto failure; } } else { + void *handle; + if (setenv(attr, value, 1) < 0) { cf_log_err(ci, "Failed setting environment variable %s: %s", attr, fr_syserror(errno)); @@ -1069,11 +1071,15 @@ do {\ /* * Hacks for LD_PRELOAD. */ - if ((strcmp(attr, "LD_PRELOAD") == 0) && - (dlopen(value, RTLD_NOW | RTLD_GLOBAL) == NULL)) { + if (strcmp(attr, "LD_PRELOAD") != 0) continue; + + handle = dlopen(value, RTLD_NOW | RTLD_GLOBAL); + if (!handle) { cf_log_err(ci, "Failed loading library %s: %s", value, dlerror()); goto failure; } + + (void) cf_data_add(subcs, handle, value, dlclose); } } /* loop over pairs in ENV */ } /* there's an ENV subsection */