mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-17 07:18:15 +00:00
Various: backport of bugfixes found via chaos
Using DEBUG_CHAOS several instances of a null pointer crash, and one uninitialized variable were uncovered and fixed. Also added details on why Asterisk failed to initialize. This is a backport of the fixes from Asterisk 13. Review: https://reviewboard.asterisk.org/r/4468/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@433086 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -4145,39 +4145,39 @@ int main(int argc, char *argv[])
|
|||||||
ast_builtins_init();
|
ast_builtins_init();
|
||||||
|
|
||||||
if (ast_utils_init()) {
|
if (ast_utils_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_utils_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_tps_init()) {
|
if (ast_tps_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_tps_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_fd_init()) {
|
if (ast_fd_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_fd_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_pbx_init()) {
|
if (ast_pbx_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_pbx_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_event_init()) {
|
if (ast_event_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_event_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TEST_FRAMEWORK
|
#ifdef TEST_FRAMEWORK
|
||||||
if (ast_test_init()) {
|
if (ast_test_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_test_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ast_translate_init()) {
|
if (ast_translate_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_translate_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4204,7 +4204,7 @@ int main(int argc, char *argv[])
|
|||||||
initstate((unsigned int) getpid() * 65536 + (unsigned int) time(NULL), randompool, sizeof(randompool));
|
initstate((unsigned int) getpid() * 65536 + (unsigned int) time(NULL), randompool, sizeof(randompool));
|
||||||
|
|
||||||
if (init_logger()) { /* Start logging subsystem */
|
if (init_logger()) { /* Start logging subsystem */
|
||||||
printf("%s", term_quit());
|
printf("Failed: init_logger\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4217,12 +4217,12 @@ int main(int argc, char *argv[])
|
|||||||
ast_autoservice_init();
|
ast_autoservice_init();
|
||||||
|
|
||||||
if (ast_timing_init()) {
|
if (ast_timing_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_timing_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_ssl_init()) {
|
if (ast_ssl_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_ssl_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4232,62 +4232,62 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (astdb_init()) {
|
if (astdb_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: astdb_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_msg_init()) {
|
if (ast_msg_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_msg_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize the data retrieval API */
|
/* initialize the data retrieval API */
|
||||||
if (ast_data_init()) {
|
if (ast_data_init()) {
|
||||||
printf ("%s", term_quit());
|
printf ("Failed: ast_data_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_channels_init();
|
ast_channels_init();
|
||||||
|
|
||||||
if ((moduleresult = load_modules(1))) { /* Load modules, pre-load only */
|
if ((moduleresult = load_modules(1))) { /* Load modules, pre-load only */
|
||||||
printf("%s", term_quit());
|
printf("Failed: load_modules(1)\n%s", term_quit());
|
||||||
exit(moduleresult == -2 ? 2 : 1);
|
exit(moduleresult == -2 ? 2 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dnsmgr_init()) { /* Initialize the DNS manager */
|
if (dnsmgr_init()) { /* Initialize the DNS manager */
|
||||||
printf("%s", term_quit());
|
printf("Failed: dnsmgr_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_named_acl_init()) { /* Initialize the Named ACL system */
|
if (ast_named_acl_init()) { /* Initialize the Named ACL system */
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_named_acl_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_http_init(); /* Start the HTTP server, if needed */
|
ast_http_init(); /* Start the HTTP server, if needed */
|
||||||
|
|
||||||
if (init_manager()) {
|
if (init_manager()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: init_manager\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_cdr_engine_init()) {
|
if (ast_cdr_engine_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_cdr_engine_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_cel_engine_init()) {
|
if (ast_cel_engine_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_cel_engine_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_device_state_engine_init()) {
|
if (ast_device_state_engine_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_device_state_engine_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_presence_state_engine_init()) {
|
if (ast_presence_state_engine_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_presence_state_engine_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4295,47 +4295,47 @@ int main(int argc, char *argv[])
|
|||||||
ast_udptl_init();
|
ast_udptl_init();
|
||||||
|
|
||||||
if (ast_image_init()) {
|
if (ast_image_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_image_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_file_init()) {
|
if (ast_file_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_file_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (load_pbx()) {
|
if (load_pbx()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: load_pbx\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_indications_init()) {
|
if (ast_indications_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_indications_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_features_init()) {
|
if (ast_features_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_features_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (init_framer()) {
|
if (init_framer()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: init_framer\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_enum_init()) {
|
if (ast_enum_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_enum_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_cc_init()) {
|
if (ast_cc_init()) {
|
||||||
printf("%s", term_quit());
|
printf("Failed: ast_cc_init\n%s", term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((moduleresult = load_modules(0))) { /* Load modules */
|
if ((moduleresult = load_modules(0))) { /* Load modules */
|
||||||
printf("%s", term_quit());
|
printf("Failed: load_modules(0)\n%s", term_quit());
|
||||||
exit(moduleresult == -2 ? 2 : 1);
|
exit(moduleresult == -2 ? 2 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -622,7 +622,7 @@ const char *ast_inet_ntoa(struct in_addr ia)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DEV_URANDOM
|
#ifdef HAVE_DEV_URANDOM
|
||||||
static int dev_urandom_fd;
|
static int dev_urandom_fd = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __linux__
|
#ifndef __linux__
|
||||||
|
|||||||
@@ -1974,6 +1974,9 @@ static struct ast_str *xmldoc_get_formatted(struct ast_xml_node *node, int raw_o
|
|||||||
ast_xml_free_text(tmpstr);
|
ast_xml_free_text(tmpstr);
|
||||||
} else {
|
} else {
|
||||||
ret = ast_str_create(128);
|
ret = ast_str_create(128);
|
||||||
|
if (!ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
for (tmp = ast_xml_node_get_children(node); tmp; tmp = ast_xml_node_get_next(tmp)) {
|
for (tmp = ast_xml_node_get_children(node); tmp; tmp = ast_xml_node_get_next(tmp)) {
|
||||||
/* if found, parse a <para> element. */
|
/* if found, parse a <para> element. */
|
||||||
if (xmldoc_parse_common_elements(tmp, "", "\n", &ret)) {
|
if (xmldoc_parse_common_elements(tmp, "", "\n", &ret)) {
|
||||||
@@ -2014,7 +2017,7 @@ static char *_xmldoc_build_field(struct ast_xml_node *node, const char *var, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
formatted = xmldoc_get_formatted(node, raw, raw);
|
formatted = xmldoc_get_formatted(node, raw, raw);
|
||||||
if (ast_str_strlen(formatted) > 0) {
|
if (formatted && ast_str_strlen(formatted) > 0) {
|
||||||
ret = ast_strdup(ast_str_buffer(formatted));
|
ret = ast_strdup(ast_str_buffer(formatted));
|
||||||
}
|
}
|
||||||
ast_free(formatted);
|
ast_free(formatted);
|
||||||
|
|||||||
Reference in New Issue
Block a user