[asterisk-commits] file: branch file/pimp_sip_media r381609 - in /team/file/pimp_sip_media: ./ f...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Feb 16 09:55:09 CST 2013
Author: file
Date: Sat Feb 16 09:55:06 2013
New Revision: 381609
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381609
Log:
Merged revisions 381595 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk
................
r381595 | mjordan | 2013-02-15 17:29:28 -0600 (Fri, 15 Feb 2013) | 15 lines
Fix crash in PresenceState AMI action when specifying an invalid provider
This patch fixes a crash in Asterisk that could be caused by using the
PresenceState AMI action while providing an invalid provider. This patch
also adds some additional warnings when a user attempts to provide the
PresenceState action with invalid data, and removes some NOTICE statements
that were still lurking in the code from testing.
(closes issue AST-1084)
Reported by: John Bigelow
Tested by: John Bigelow
........
Merged revisions 381594 from http://svn.asterisk.org/svn/asterisk/branches/11
................
........
Merged revisions 381598 from http://svn.asterisk.org/svn/asterisk/team/group/pimp_my_sip
Modified:
team/file/pimp_sip_media/ (props changed)
team/file/pimp_sip_media/funcs/func_presencestate.c
team/file/pimp_sip_media/main/manager.c
team/file/pimp_sip_media/main/presencestate.c
Propchange: team/file/pimp_sip_media/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Propchange: team/file/pimp_sip_media/
------------------------------------------------------------------------------
--- pimp-integrated (original)
+++ pimp-integrated Sat Feb 16 09:55:06 2013
@@ -1,1 +1,1 @@
-/team/group/pimp_my_sip:1-381579
+/team/group/pimp_my_sip:1-381608
Modified: team/file/pimp_sip_media/funcs/func_presencestate.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_media/funcs/func_presencestate.c?view=diff&rev=381609&r1=381608&r2=381609
==============================================================================
--- team/file/pimp_sip_media/funcs/func_presencestate.c (original)
+++ team/file/pimp_sip_media/funcs/func_presencestate.c Sat Feb 16 09:55:06 2013
@@ -243,7 +243,7 @@
ast_db_get(astdb_family, data, buf, sizeof(buf));
if (parse_data(buf, &state, &_subtype, &_message, &_options)) {
- return -1;
+ return AST_PRESENCE_INVALID;
}
if ((strchr(_options, 'e'))) {
@@ -252,7 +252,6 @@
*subtype = NULL;
} else {
memset(tmp, 0, sizeof(tmp));
- ast_log(LOG_NOTICE, "Hey there, I'm doing some base64 decoding\n");
ast_base64decode((unsigned char *) tmp, _subtype, sizeof(tmp) - 1);
*subtype = ast_strdup(tmp);
}
@@ -261,12 +260,10 @@
*message = NULL;
} else {
memset(tmp, 0, sizeof(tmp));
- ast_log(LOG_NOTICE, "Hey there, I'm doing some more base64 decoding\n");
ast_base64decode((unsigned char *) tmp, _message, sizeof(tmp) - 1);
*message = ast_strdup(tmp);
}
} else {
- ast_log(LOG_NOTICE, "Not doing any base64 decoding\n");
*subtype = ast_strlen_zero(_subtype) ? NULL : ast_strdup(_subtype);
*message = ast_strlen_zero(_message) ? NULL : ast_strdup(_message);
}
Modified: team/file/pimp_sip_media/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_media/main/manager.c?view=diff&rev=381609&r1=381608&r2=381609
==============================================================================
--- team/file/pimp_sip_media/main/manager.c (original)
+++ team/file/pimp_sip_media/main/manager.c Sat Feb 16 09:55:06 2013
@@ -2280,6 +2280,7 @@
{
va_list ap;
struct ast_str *buf;
+ char *msg;
if (!(buf = ast_str_thread_get(&astman_append_buf, ASTMAN_APPEND_BUF_INITSIZE))) {
return;
@@ -2289,8 +2290,13 @@
ast_str_set_va(&buf, 0, fmt, ap);
va_end(ap);
- astman_send_response_full(s, m, "Error", ast_str_buffer(buf), NULL);
- ast_free(buf);
+ /* astman_append will use the same underlying buffer, so copy the message out
+ * before sending the response */
+ msg = ast_str_buffer(buf);
+ if (msg) {
+ msg = ast_strdupa(msg);
+ }
+ astman_send_response_full(s, m, "Error", msg, NULL);
}
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
@@ -3378,7 +3384,7 @@
/* if regex compilation fails, hangup fails */
if (regcomp(®exbuf, ast_str_buffer(regex_string), REG_EXTENDED | REG_NOSUB)) {
- astman_send_error_va(s, m, "Regex compile failed on: %s\n", name_or_regex);
+ astman_send_error_va(s, m, "Regex compile failed on: %s", name_or_regex);
ast_free(regex_string);
return 0;
}
@@ -4610,6 +4616,10 @@
}
state = ast_presence_state(provider, &subtype, &message);
+ if (state == AST_PRESENCE_INVALID) {
+ astman_send_error_va(s, m, "Invalid provider %s or provider in invalid state", provider);
+ return 0;
+ }
if (!ast_strlen_zero(subtype)) {
snprintf(subtype_header, sizeof(subtype_header),
Modified: team/file/pimp_sip_media/main/presencestate.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_media/main/presencestate.c?view=diff&rev=381609&r1=381608&r2=381609
==============================================================================
--- team/file/pimp_sip_media/main/presencestate.c (original)
+++ team/file/pimp_sip_media/main/presencestate.c Sat Feb 16 09:55:06 2013
@@ -159,6 +159,9 @@
}
AST_RWLIST_UNLOCK(&presence_state_providers);
+ if (!provider) {
+ ast_log(LOG_WARNING, "No provider found for label %s\n", label);
+ }
return res;
}
More information about the asterisk-commits
mailing list