mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-21 20:56:39 +00:00
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. 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
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user