[asterisk-commits] tilghman: branch 1.6.2 r214515 - in /branches/1.6.2: ./ main/manager.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 27 16:27:39 CDT 2009


Author: tilghman
Date: Thu Aug 27 16:27:35 2009
New Revision: 214515

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=214515
Log:
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)
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/main/manager.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/main/manager.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/main/manager.c?view=diff&rev=214515&r1=214514&r2=214515
==============================================================================
--- branches/1.6.2/main/manager.c (original)
+++ branches/1.6.2/main/manager.c Thu Aug 27 16:27:35 2009
@@ -1169,8 +1169,11 @@
 		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;
 	}
 
@@ -1211,7 +1214,10 @@
 		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);
@@ -1266,6 +1272,9 @@
 
 	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;
 	}
 
@@ -1486,6 +1495,9 @@
 	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 @@
 		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 @@
 
 	/* 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"));
 




More information about the asterisk-commits mailing list