]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
main: Initialize dialplan providing core components prior to module pre-load
authorMatthew Jordan <mjordan@digium.com>
Sat, 22 Feb 2014 19:56:23 +0000 (19:56 +0000)
committerMatthew Jordan <mjordan@digium.com>
Sat, 22 Feb 2014 19:56:23 +0000 (19:56 +0000)
It is possible to pre-load pbx_config. As a result, pbx_config - which will
load and parse the dialplan - will attempt to use various dialplan components,
such as device state providers and presence state providers, prior to them
being initialized by the core. This would lead to a crash, as the components
had not created their Stasis cache entries.

This patch moves a number of core component initializations before the module
pre-load. This guarantees that if someone does pre-load pbx_config - or other
pbx modules - that the Stasis caches for the various core components are
created.

(closes issue ASTERISK-23320)
Reported by: xrobau

(closes issue ASTERISK-23265)
Reported by: Andrew Nagy
Tested by: Andrew Nagy, Rusty Newton

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@408855 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/asterisk.c

index 63843490bcee1c542ddd504a7a22185e4a8e846c..267ad82bd48a88a1b87d7369818a42ae25795e8e 100644 (file)
@@ -4427,64 +4427,64 @@ int main(int argc, char *argv[])
                exit(1);
        }
 
-       if ((moduleresult = load_modules(1))) {         /* Load modules, pre-load only */
+       if (ast_features_init()) {
                printf("%s", term_quit());
-               exit(moduleresult == -2 ? 2 : 1);
+               exit(1);
        }
 
-       if (dnsmgr_init()) {            /* Initialize the DNS manager */
+       if (ast_pickup_init()) {
                printf("%s", term_quit());
                exit(1);
        }
 
-       if (ast_security_stasis_init()) {               /* Initialize Security Stasis Topic and Events */
+       if (ast_bridging_init()) {
                printf("%s", term_quit());
                exit(1);
        }
 
-       if (ast_named_acl_init()) { /* Initialize the Named ACL system */
+       if (ast_parking_stasis_init()) {
                printf("%s", term_quit());
                exit(1);
        }
 
-       ast_http_init();                /* Start the HTTP server, if needed */
-
-       if (ast_indications_init()) {
+       if (ast_device_state_engine_init()) {
                printf("%s", term_quit());
                exit(1);
        }
 
-       if (ast_features_init()) {
+       if (ast_presence_state_engine_init()) {
                printf("%s", term_quit());
                exit(1);
        }
 
-       if (ast_pickup_init()) {
+       if ((moduleresult = load_modules(1))) {         /* Load modules, pre-load only */
                printf("%s", term_quit());
-               exit(1);
+               exit(moduleresult == -2 ? 2 : 1);
        }
 
-       if (ast_bridging_init()) {
+       if (dnsmgr_init()) {            /* Initialize the DNS manager */
                printf("%s", term_quit());
                exit(1);
        }
 
-       if (ast_parking_stasis_init()) {
+       if (ast_security_stasis_init()) {               /* Initialize Security Stasis Topic and Events */
                printf("%s", term_quit());
                exit(1);
        }
 
-       if (ast_cdr_engine_init()) {
+       if (ast_named_acl_init()) { /* Initialize the Named ACL system */
                printf("%s", term_quit());
                exit(1);
        }
 
-       if (ast_device_state_engine_init()) {
+       ast_http_init();                /* Start the HTTP server, if needed */
+
+       if (ast_indications_init()) {
                printf("%s", term_quit());
                exit(1);
        }
 
-       if (ast_presence_state_engine_init()) {
+       if (ast_cdr_engine_init()) {
                printf("%s", term_quit());
                exit(1);
        }