Print out section name for empty sections
[freeradius.git] / src / main / modules.c
index 6682ab7..e15ee76 100644 (file)
@@ -201,6 +201,31 @@ const char *lt_dlerror(void)
 }
 
 #endif /* WITH_DLOPEN */
+#else  /* WITHOUT_LIBLTDL */
+
+/*
+ *     Solve the issues of libraries linking to other libraries
+ *     by using a newer libltdl API.
+ */
+#ifndef HAVE_LT_DLADVISE_INIT
+#define fr_dlopenext lt_dlopenext
+#else
+static lt_dlhandle fr_dlopenext(const char *filename)
+{
+       lt_dlhandle handle = 0;
+       lt_dladvise advise;
+
+       if (!lt_dladvise_init (&advise) &&
+           !lt_dladvise_ext (&advise) &&
+           !lt_dladvise_global (&advise)) {
+               handle = lt_dlopenadvise (filename, advise);
+       }
+
+       lt_dladvise_destroy (&advise);
+
+       return handle;
+}
+#endif /* HAVE_LT_DLADVISE_INIT */
 #endif /* WITHOUT_LIBLTDL */
 
 static int virtual_server_idx(const char *name)
@@ -411,7 +436,7 @@ static module_entry_t *linkto_module(const char *module_name,
        /*
         *      Keep the handle around so we can dlclose() it.
         */
-       handle = lt_dlopenext(module_name);
+       handle = fr_dlopenext(module_name);
        if (handle == NULL) {
                cf_log_err(cf_sectiontoitem(cs),
                           "Failed to link to module '%s': %s\n",
@@ -666,13 +691,13 @@ int indexed_modcall(int comp, int idx, REQUEST *request)
        }
 
        if (!server) {
-               RDEBUG("No such virtual server %s", request->server);
+               RDEBUG("No such virtual server \"%s\"", request->server);
                return RLM_MODULE_FAIL;
        }
 
        if (idx == 0) {
                list = server->mc[comp];
-               if (!list) RDEBUG2("  WARNING: Empty section.  Using default return values.");
+               if (!list) RDEBUG2("  WARNING: Empty %s section.  Using default return values.", section_type_value[comp].section);
 
        } else {
                indexed_modcallable *this;
@@ -1319,7 +1344,9 @@ int setup_modules(int reload, CONF_SECTION *config)
                 *      It's like libtool and libltdl are some kind
                 *      of sick joke.
                 */
+#ifdef IE_LIBTOOL_DIE
 #define lt__PROGRAM__LTX_preloaded_symbols lt_libltdl_LTX_preloaded_symbols
+#endif
 
                /*
                 *      Set the default list of preloaded symbols.
@@ -1425,7 +1452,9 @@ int setup_modules(int reload, CONF_SECTION *config)
             listener = listener->next) {
                char buffer[256];
 
+#ifdef WITH_PROXY
                if (listener->type == RAD_LISTEN_PROXY) continue;
+#endif
 
                cs = cf_section_sub_find_name2(config,
                                               "server", listener->server);