]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remember the libraries we dlopen'd. CID #1445213
authorAlan T. DeKok <aland@freeradius.org>
Fri, 19 Jul 2019 01:10:48 +0000 (21:10 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 19 Jul 2019 01:10:48 +0000 (21:10 -0400)
src/lib/server/main_config.c

index 9bbed01504d1b5542a4dfe928f191262ad80cdee..278363157213361a6ad0709a35e6de1a8137e503 100644 (file)
@@ -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 */