CoreSettings and CoreStatus are missing the terminating "\r\n". Also, some

miscellaneous spacing and initialization issues.
(closes issue #11909)
 Reported by: srt
 Patches: 
       patch-11909-2.diff uploaded by srt (license 378)
 Tested by: srt


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@102190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Tilghman Lesher 18 years ago
parent 7ca0fa1cae
commit fa4c9a958b

@ -1294,10 +1294,12 @@ static int action_waitevent(struct mansession *s, const struct message *m)
int x;
int needexit = 0;
const char *id = astman_get_header(m, "ActionID");
char idText[256] = "";
char idText[256];
if (!ast_strlen_zero(id))
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
else
idText[0] = '\0';
if (!ast_strlen_zero(timeouts)) {
sscanf(timeouts, "%i", &timeout);
@ -1582,10 +1584,12 @@ static int action_status(struct mansession *s, const struct message *m)
int channels = 0;
int all = ast_strlen_zero(name); /* set if we want all channels */
const char *id = astman_get_header(m, "ActionID");
char idText[256] = "";
char idText[256];
if (!ast_strlen_zero(id))
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
else
idText[0] = '\0';
if (all)
c = ast_channel_walk_locked(NULL);
@ -2203,10 +2207,12 @@ static char mandescr_coresettings[] =
static int action_coresettings(struct mansession *s, const struct message *m)
{
const char *actionid = astman_get_header(m, "ActionID");
char idText[150] = "";
char idText[150];
if (!ast_strlen_zero(actionid))
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", actionid);
else
idText[0] = '\0';
astman_append(s, "Response: Success\r\n"
"%s"
@ -2221,7 +2227,7 @@ static int action_coresettings(struct mansession *s, const struct message *m)
"CoreRealTimeEnabled: %s\r\n"
"CoreCDRenabled: %s\r\n"
"CoreHTTPenabled: %s\r\n"
,
"\r\n",
idText,
AMI_VERSION,
ast_get_version(),
@ -2254,6 +2260,8 @@ static int action_corestatus(struct mansession *s, const struct message *m)
if (!ast_strlen_zero(actionid))
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", actionid);
else
idText[0] = '\0';
ast_localtime(&ast_startuptime, &tm, NULL);
ast_strftime(startuptime, sizeof(startuptime), "%H:%M:%S", &tm);
@ -2265,7 +2273,7 @@ static int action_corestatus(struct mansession *s, const struct message *m)
"CoreStartupTime: %s\r\n"
"CoreReloadTime: %s\r\n"
"CoreCurrentCalls: %d\r\n"
"",
"\r\n",
idText,
startuptime,
reloadtime,
@ -2283,15 +2291,11 @@ static char mandescr_reload[] =
/*! \brief Send a reload event */
static int action_reload(struct mansession *s, const struct message *m)
{
const char *actionid = astman_get_header(m, "ActionID");
const char *module = astman_get_header(m, "Module");
int res = ast_module_reload(S_OR(module, NULL));
char idText[80] = "";
if (!ast_strlen_zero(actionid))
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", actionid);
if (res == 2)
astman_append(s, "Response: Success\r\n%s", idText);
astman_send_ack(s, m, "Module Reloaded");
else
astman_send_error(s, m, s == 0 ? "No such module" : "Module does not support reload");
return 0;
@ -2308,13 +2312,15 @@ static char mandescr_coreshowchannels[] =
static int action_coreshowchannels(struct mansession *s, const struct message *m)
{
const char *actionid = astman_get_header(m, "ActionID");
char actionidtext[256] = "";
char actionidtext[256];
struct ast_channel *c = NULL;
int numchans = 0;
int duration, durh, durm, durs;
if (!ast_strlen_zero(actionid))
snprintf(actionidtext, sizeof(actionidtext), "ActionID: %s\r\n", actionid);
else
actionidtext[0] = '\0';
astman_send_listack(s, m, "Channels will follow", "start");
@ -2401,6 +2407,8 @@ static int manager_modulecheck(struct mansession *s, const struct message *m)
if (!ast_strlen_zero(id))
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
else
idText[0] = '\0';
astman_append(s, "Response: Success\r\n%s", idText);
astman_append(s, "Version: %s\r\n\r\n", version ? version : "");
return 0;

Loading…
Cancel
Save