]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
loader: Process dependencies for built-in modules.
authorCorey Farrell <git@cfware.com>
Thu, 26 Jul 2018 17:52:46 +0000 (13:52 -0400)
committerCorey Farrell <git@cfware.com>
Thu, 26 Jul 2018 19:29:14 +0000 (14:29 -0500)
With the new module loader it was missed that built-in modules never
parsed dependencies from mod->info into vectors of mod.  This caused
manager to be initialized before acl (named_acl).  If manager.conf
used any named ACL's they would not be found and result in no ACL being
applied to the AMI user.

In addition to the manager ACL fix this adds "extconfig" to all builtin
modules which support realtime configuration.  This only matters if one
of the builtin modules is configured with 'preload', depending on
"extconfig" will cause config.c to automatically be initialize during
the preload stage.

Change-Id: I482ed6bca6c1064b05bb538d7861cd7a4f02d9fc

15 files changed:
main/cdr.c
main/cel.c
main/dnsmgr.c
main/dsp.c
main/enum.c
main/features.c
main/http.c
main/indications.c
main/loader.c
main/logger.c
main/manager.c
main/named_acl.c
main/plc.c
main/sounds.c
main/udptl.c

index 62fcdf5dda7206dfc1bb5b53af00e88937967064..1c47e24173574185f678c393bee234a9208f6f1f 100644 (file)
@@ -4628,4 +4628,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_
        .unload = unload_module,
        .reload = reload_module,
        .load_pri = AST_MODPRI_CORE,
+       .requires = "extconfig",
 );
index 91c625a3c268ce892723bc2997799458ae7ef968..0ec728e558336ae199247b15c567b8cc272dccef 100644 (file)
@@ -1753,4 +1753,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_
        .unload = unload_module,
        .reload = reload_module,
        .load_pri = AST_MODPRI_CORE,
+       .requires = "extconfig",
 );
index c25b601b335e34a0fc699c62774e41009e651612..db13b1d23e7e980f8985b79e89dc722131dbebb5 100644 (file)
@@ -523,4 +523,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_
        .unload = unload_module,
        .reload = reload_module,
        .load_pri = AST_MODPRI_CORE,
+       .requires = "extconfig",
 );
index ea653d857b3737a75736627f76acc8f5d7774fe3..433e61a4b84ec4cbe2615fe26cc2c805e5e89cb8 100644 (file)
@@ -2425,4 +2425,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_
        .unload = unload_module,
        .reload = reload_module,
        .load_pri = AST_MODPRI_CORE,
+       .requires = "extconfig",
 );
index 8b6d3fe75953ec73b892d7791ce7888a860e1ece..344ae404d56414ff1febcb3bf4216e99d878f360 100644 (file)
@@ -1023,4 +1023,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_
        .unload = unload_module,
        .reload = reload_module,
        .load_pri = AST_MODPRI_CORE,
+       .requires = "extconfig",
 );
index 3db6d397b44cffeb5dc5b046535cd75d52e6f852..8c2d9bc7dc09e1039fc0e1564a7321f49f4499d0 100644 (file)
@@ -1174,4 +1174,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_
        .unload = unload_module,
        .reload = reload_features_config,
        .load_pri = AST_MODPRI_CORE,
+       .requires = "extconfig",
 );
index 55d10290bac3a26849b925f49a207e478edba000..d7ec60a961ee2a3b8344068c71a20f9a89e5a9e0 100644 (file)
@@ -2314,4 +2314,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_
        .unload = unload_module,
        .reload = reload_module,
        .load_pri = AST_MODPRI_CORE,
+       .requires = "extconfig",
 );
index c9f02416f9813321178709f4a5e8f61368752191..6a7414dcc475cdf7bb805e8089539b9728f150e8 100644 (file)
@@ -1158,4 +1158,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_
        .unload = unload_module,
        .reload = reload_module,
        .load_pri = AST_MODPRI_CORE,
+       .requires = "extconfig",
 );
index d6837f860196f8e640d5db7c5391f156a901020b..eb345b5eb586927fb2899b7a45ab3c7fff8ef1da 100644 (file)
@@ -569,6 +569,18 @@ void ast_module_register(const struct ast_module_info *info)
        *((struct ast_module **) &(info->self)) = mod;
 }
 
+static int module_post_register(struct ast_module *mod)
+{
+       int res;
+
+       /* Split lists from mod->info. */
+       res  = ast_vector_string_split(&mod->requires, mod->info->requires, ",", 0, strcasecmp);
+       res |= ast_vector_string_split(&mod->optional_modules, mod->info->optional_modules, ",", 0, strcasecmp);
+       res |= ast_vector_string_split(&mod->enhances, mod->info->enhances, ",", 0, strcasecmp);
+
+       return res;
+}
+
 static void module_destroy(struct ast_module *mod)
 {
        AST_VECTOR_CALLBACK_VOID(&mod->requires, ast_free);
@@ -1526,11 +1538,7 @@ static enum ast_module_load_result load_resource(const char *resource_name, unsi
                        return required ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_DECLINE;
                }
 
-               /* Split lists from mod->info. */
-               res  = ast_vector_string_split(&mod->requires, mod->info->requires, ",", 0, strcasecmp);
-               res |= ast_vector_string_split(&mod->optional_modules, mod->info->optional_modules, ",", 0, strcasecmp);
-               res |= ast_vector_string_split(&mod->enhances, mod->info->enhances, ",", 0, strcasecmp);
-               if (res) {
+               if (module_post_register(mod)) {
                        goto prestart_error;
                }
        }
@@ -1846,6 +1854,11 @@ static int loader_builtin_init(struct load_order *load_order)
                        continue;
                }
 
+               /* Parse dependendencies from mod->info. */
+               if (module_post_register(mod)) {
+                       return -1;
+               }
+
                /* Built-in modules are not preloaded, most have an early load priority. */
                if (!add_to_load_order(mod->resource, load_order, 0, 0, 1)) {
                        return -1;
index 46d61ed33606d3563a694d821bdf9697b0ecac12..8b4f678ca775738ac6d2d4c158518cc8c2a01950 100644 (file)
@@ -2381,6 +2381,7 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_
        .support_level = AST_MODULE_SUPPORT_CORE,
        .load = load_module,
        .unload = unload_module,
+       /* This reload does not support realtime so it does not require "extconfig". */
        .reload = reload_module,
        .load_pri = 0,
 );
index ab4243244679ed2d37bd7cf5ac9e4e2f6ac0dbcc..a0dcf6c8612f79eddfe5e4220a2132c93efe0c32 100644 (file)
@@ -9600,5 +9600,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_
        .unload = unload_module,
        .reload = reload_module,
        .load_pri = AST_MODPRI_CORE,
-       .requires = "http",
+       .requires = "extconfig,acl,http",
 );
index c4628216fdc796d39b832465e51290d901333529..8cf09c2a07a812ebee650d4e5824d333a988228f 100644 (file)
@@ -591,4 +591,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_
        .unload = unload_module,
        .reload = reload_module,
        .load_pri = AST_MODPRI_CORE,
+       .requires = "extconfig",
 );
index 369d285a585101580654673a018e557c980fb0c7..20d512220360c650605e29021b416ebefef3c9c1 100644 (file)
@@ -296,4 +296,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_
        .unload = unload_module,
        .reload = reload_module,
        .load_pri = AST_MODPRI_CORE,
+       .requires = "extconfig",
 );
index 745b628051951b91e23e7958b48f7f4be98b428b..e0cb33a53f93c480f7737d2d1fc93fa8d51a43f6 100644 (file)
@@ -340,6 +340,7 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_
        .support_level = AST_MODULE_SUPPORT_CORE,
        .load = load_module,
        .unload = unload_module,
+       /* This reload doesn't use config so this module doesn't require "extconfig". */
        .reload = reload_module,
        /* Load after the format modules to reduce processing during startup. */
        .load_pri = AST_MODPRI_APP_DEPEND + 1,
index f6cd3b90a1df0a8411c6f3cab391695dec3967e6..7349d6aa4cd85f55f3caa072a8d2ec7bab78de62 100644 (file)
@@ -1420,4 +1420,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_
        .unload = unload_module,
        .reload = reload_module,
        .load_pri = AST_MODPRI_CORE,
+       .requires = "extconfig",
 );