Package: asterisk / 1:1.6.2.9-2+squeeze12

manager_bugfix_reload Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
From: Brett Bryant <bbryant@digium.com>
Date: Thu, 2 Sep 2010 20:54:33 +0000
Origin: http://svnview.digium.com/svn/asterisk?view=rev&rev=284778
Bug: https://issues.asterisk.org/view.php?id=17917
Subject: Properly reset default manager.conf values on reload

Fixes a bug in manager.c where the default configuration values weren't
reset when the manager configuration was reloaded.

This is a simple bugfix required for cleanly applying AST-2011-005

---
 main/manager.c |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

--- a/main/manager.c
+++ b/main/manager.c
@@ -119,11 +119,19 @@ struct eventqent {
 
 static AST_LIST_HEAD_STATIC(all_events, eventqent);
 
-static int displayconnects = 1;
+static const int DEFAULT_ENABLED			= 0;	/*!< Default setting for manager to be enabled */
+static const int DEFAULT_WEBENABLED			= 0;	/*!< Default setting for the web interface to be enabled */
+static const int DEFAULT_BLOCKSOCKETS		= 0;	/*!< Default setting for block-sockets */
+static const int DEFAULT_DISPLAYCONNECTS	= 1;	/*!< Default setting for displaying manager connections */
+static const int DEFAULT_TIMESTAMPEVENTS	= 0;	/*!< Default setting for timestampevents */	
+static const int DEFAULT_HTTPTIMEOUT 		= 60;	/*!< Default manager http timeout */
+static const int DEFAULT_BROKENEVENTSACTION	= 0;	/*!< Default setting for brokeneventsaction */
+
+static int displayconnects;
 static int allowmultiplelogin = 1;
 static int timestampevents;
-static int httptimeout = 60;
-static int broken_events_action = 0;
+static int httptimeout;
+static int broken_events_action;
 static int manager_enabled = 0;
 static int webmanager_enabled = 0;
 
@@ -4088,16 +4096,14 @@ static int __init_manager(int reload)
 	struct ast_config *ucfg = NULL, *cfg = NULL;
 	const char *val;
 	char *cat = NULL;
-	int newhttptimeout = 60;
+	int newhttptimeout = DEFAULT_HTTPTIMEOUT;
 	int have_sslbindaddr = 0;
 	struct hostent *hp;
 	struct ast_hostent ahp;
 	struct ast_manager_user *user = NULL;
 	struct ast_variable *var;
 	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
-
-	manager_enabled = 0;
-
+	
 	if (!registered) {
 		/* Register default actions */
 		ast_manager_register2("Ping", 0, action_ping, "Keepalive command", mandescr_ping);
@@ -4142,8 +4148,14 @@ static int __init_manager(int reload)
 	if ((cfg = ast_config_load2("manager.conf", "manager", config_flags)) == CONFIG_STATUS_FILEUNCHANGED)
 		return 0;
 
-	displayconnects = 1;
-	broken_events_action = 0;
+	manager_enabled = DEFAULT_ENABLED;
+	webmanager_enabled = DEFAULT_WEBENABLED;
+	displayconnects = DEFAULT_DISPLAYCONNECTS;
+	broken_events_action = DEFAULT_BROKENEVENTSACTION;
+	block_sockets = DEFAULT_BLOCKSOCKETS;
+	timestampevents = DEFAULT_TIMESTAMPEVENTS;
+	httptimeout = DEFAULT_HTTPTIMEOUT;
+
 	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;