[Asterisk-code-review] loader: Process dependencies for built-in modules. (asterisk[16])
Corey Farrell
asteriskteam at digium.com
Thu Jul 26 12:55:46 CDT 2018
Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/9717
Change subject: loader: Process dependencies for built-in modules.
......................................................................
loader: Process dependencies for built-in modules.
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.
Change-Id: I482ed6bca6c1064b05bb538d7861cd7a4f02d9fc
---
M main/loader.c
M main/manager.c
2 files changed, 19 insertions(+), 6 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/17/9717/1
diff --git a/main/loader.c b/main/loader.c
index d6837f8..eb345b5 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -569,6 +569,18 @@
*((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 @@
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 @@
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;
diff --git a/main/manager.c b/main/manager.c
index ab42432..37c49fd 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -9600,5 +9600,5 @@
.unload = unload_module,
.reload = reload_module,
.load_pri = AST_MODPRI_CORE,
- .requires = "http",
+ .requires = "acl,http",
);
--
To view, visit https://gerrit.asterisk.org/9717
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-MessageType: newchange
Gerrit-Change-Id: I482ed6bca6c1064b05bb538d7861cd7a4f02d9fc
Gerrit-Change-Number: 9717
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180726/9cc04ec5/attachment.html>
More information about the asterisk-code-review
mailing list