aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-27 21:27:35 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-27 21:27:35 +0000
commit8cb2e5259a76970df3772ce8b2a78deab9a65010 (patch)
treec9aac47060eb403f0754785ace086a54c5356e81 /main
parent47e42796803877a102a88b72d5ab9d54d09d256a (diff)
Merged revisions 214514 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r214514 | tilghman | 2009-08-27 16:26:37 -0500 (Thu, 27 Aug 2009) | 7 lines Ensure that we check for the special value CONFIG_STATUS_FILEINVALID. (closes issue #15786) Reported by: a_villacis Patches: asterisk-1.6.2.0-beta4-manager-fix-crash-on-include-nonexistent-file.patch uploaded by a villacis (license 660) (Plus a few of my own, to catch the remaining places within manager.c where it could have been a problem) ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@214515 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/manager.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/main/manager.c b/main/manager.c
index 054bd80ab..008506072 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1169,9 +1169,12 @@ static int action_getconfig(struct mansession *s, const struct message *m)
return 0;
}
cfg = ast_config_load2(fn, "manager", config_flags);
- if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEINVALID) {
+ if (cfg == CONFIG_STATUS_FILEMISSING) {
astman_send_error(s, m, "Config file not found");
return 0;
+ } else if (cfg == CONFIG_STATUS_FILEINVALID) {
+ astman_send_error(s, m, "Config file has invalid format");
+ return 0;
}
astman_start_ack(s, m);
@@ -1211,7 +1214,10 @@ static int action_listcategories(struct mansession *s, const struct message *m)
return 0;
}
if (!(cfg = ast_config_load2(fn, "manager", config_flags))) {
- astman_send_error(s, m, "Config file not found or file has invalid syntax");
+ astman_send_error(s, m, "Config file not found");
+ return 0;
+ } else if (cfg == CONFIG_STATUS_FILEINVALID) {
+ astman_send_error(s, m, "Config file has invalid format");
return 0;
}
astman_start_ack(s, m);
@@ -1267,6 +1273,9 @@ static int action_getconfigjson(struct mansession *s, const struct message *m)
if (!(cfg = ast_config_load2(fn, "manager", config_flags))) {
astman_send_error(s, m, "Config file not found");
return 0;
+ } else if (cfg == CONFIG_STATUS_FILEINVALID) {
+ astman_send_error(s, m, "Config file has invalid format");
+ return 0;
}
buf_len = 512;
@@ -1486,6 +1495,9 @@ static int action_updateconfig(struct mansession *s, const struct message *m)
if (!(cfg = ast_config_load2(sfn, "manager", config_flags))) {
astman_send_error(s, m, "Config file not found");
return 0;
+ } else if (cfg == CONFIG_STATUS_FILEINVALID) {
+ astman_send_error(s, m, "Config file has invalid format");
+ return 0;
}
result = handle_updates(s, m, cfg, dfn);
if (!result) {
@@ -4091,8 +4103,8 @@ static int __init_manager(int reload)
return 0;
displayconnects = 1;
- if (!cfg) {
- ast_log(LOG_NOTICE, "Unable to open AMI configuration manager.conf. Asterisk management interface (AMI) disabled.\n");
+ if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) {
+ ast_log(LOG_NOTICE, "Unable to open AMI configuration manager.conf, or configuration is invalid. Asterisk management interface (AMI) disabled.\n");
return 0;
}
@@ -4170,7 +4182,7 @@ static int __init_manager(int reload)
/* First, get users from users.conf */
ucfg = ast_config_load2("users.conf", "manager", config_flags);
- if (ucfg && (ucfg != CONFIG_STATUS_FILEUNCHANGED)) {
+ if (ucfg && (ucfg != CONFIG_STATUS_FILEUNCHANGED) && ucfg != CONFIG_STATUS_FILEINVALID) {
const char *hasmanager;
int genhasmanager = ast_true(ast_variable_retrieve(ucfg, "general", "hasmanager"));