From: Brett Bryant Date: Thu, 2 Sep 2010 20:25:03 +0000 (+0000) Subject: Fixes a bug in manager.c where the default configuration values weren't reset when... X-Git-Tag: 1.4.37-rc1~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a02ffb0a61c7380ea5db02ecd545c66e8a6b36cc;p=thirdparty%2Fasterisk.git Fixes a bug in manager.c where the default configuration values weren't reset when the manager configuration was reloaded. (closes issue #17917) Reported by: lmadsen Review: https://reviewboard.asterisk.org/r/883/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@284777 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/manager.c b/main/manager.c index 42bac53cd6..fb4c8139e3 100644 --- a/main/manager.c +++ b/main/manager.c @@ -97,13 +97,22 @@ struct eventqent { char eventdata[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 enabled; static int portno = DEFAULT_MANAGER_PORT; static int asock = -1; -static int displayconnects = 1; +static int displayconnects; static int timestampevents; -static int httptimeout = 60; -static int broken_events_action = 0; +static int httptimeout; +static int broken_events_action; static pthread_t t; static int block_sockets; @@ -3053,8 +3062,8 @@ int init_manager(void) static struct sockaddr_in ba; int x = 1; int flags; - int webenabled = 0; - int newhttptimeout = 60; + int webenabled = DEFAULT_WEBENABLED; + int newhttptimeout = DEFAULT_HTTPTIMEOUT; struct ast_manager_user *user = NULL; if (!registered) { @@ -3085,9 +3094,14 @@ int init_manager(void) /* Append placeholder event so master_eventq never runs dry */ append_event("Event: Placeholder\r\n\r\n", 0); } + portno = DEFAULT_MANAGER_PORT; - displayconnects = 1; - broken_events_action = 0; + displayconnects = DEFAULT_DISPLAYCONNECTS; + broken_events_action = DEFAULT_BROKENEVENTSACTION; + block_sockets = DEFAULT_BLOCKSOCKETS; + timestampevents = DEFAULT_TIMESTAMPEVENTS; + httptimeout = DEFAULT_HTTPTIMEOUT; + cfg = ast_config_load("manager.conf"); if (!cfg) { ast_log(LOG_NOTICE, "Unable to open management configuration manager.conf. Call management disabled.\n");