[asterisk-commits] alecdavis: branch 11 r385917 - in /branches/11: ./ main/ res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Apr 16 18:14:02 CDT 2013
Author: alecdavis
Date: Tue Apr 16 18:13:58 2013
New Revision: 385917
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385917
Log:
Distributed Device State broken at sites using res_xmpp or res_jabber where Secuity Advisory AST-2012-015 is inplace
res_jabber/res_xmpp were not adding AST_EVENT_IE_CACHABLE to the event as each message came in,
then devstate_change_collector_cb() was unable to find AST_EVENT_IE_CACHABLE in the event,
so defaulted incorrectly to AST_DEVSTATE_NOT_CACHABLE.
(issue ASTERISK-20175)
(closes issue ASTERISK-21429)
(closes issue ASTERISK-21069)
(closes issue ASTERISK-21164)
Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)
Review https://reviewboard.asterisk.org/r/2452/
........
Merged revisions 385916 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Modified:
branches/11/ (props changed)
branches/11/main/devicestate.c
branches/11/res/res_jabber.c
Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/11/main/devicestate.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/devicestate.c?view=diff&rev=385917&r1=385916&r2=385917
==============================================================================
--- branches/11/main/devicestate.c (original)
+++ branches/11/main/devicestate.c Tue Apr 16 18:13:58 2013
@@ -705,7 +705,7 @@
static void devstate_change_collector_cb(const struct ast_event *event, void *data)
{
struct devstate_change *sc;
- const char *device;
+ const char *device, *cachable_str;
const struct ast_eid *eid;
uint32_t state;
enum ast_devstate_cache cachable = AST_DEVSTATE_CACHABLE;
@@ -713,7 +713,6 @@
device = ast_event_get_ie_str(event, AST_EVENT_IE_DEVICE);
eid = ast_event_get_ie_raw(event, AST_EVENT_IE_EID);
state = ast_event_get_ie_uint(event, AST_EVENT_IE_STATE);
- cachable = ast_event_get_ie_uint(event, AST_EVENT_IE_CACHABLE);
if (ast_strlen_zero(device) || !eid) {
ast_log(LOG_ERROR, "Invalid device state change event received\n");
@@ -726,6 +725,16 @@
strcpy(sc->device, device);
sc->eid = *eid;
sc->state = state;
+
+ /* For 'cachable' we cannot use ast_event_get_ie_uint(), it overwrites the default of AST_DEVSTATE_CACHABLE we
+ * have already setup for 'cachable', if for whatever reason the AST_EVENT_IE_CACHABLE wasn't
+ * posted in the event ast_event_get_ie_uint() is going will return 0,
+ * which equates to AST_DEVSTATE_NOT_CACHABLE the first enumeration in 'ast_devstate_cache'.
+ */
+
+ if ((cachable_str = ast_event_get_ie_str(event, AST_EVENT_IE_CACHABLE))) {
+ sscanf(cachable_str, "%30u", &cachable);
+ }
sc->cachable = cachable;
ast_mutex_lock(&devstate_collector.lock);
Modified: branches/11/res/res_jabber.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/res_jabber.c?view=diff&rev=385917&r1=385916&r2=385917
==============================================================================
--- branches/11/res/res_jabber.c (original)
+++ branches/11/res/res_jabber.c Tue Apr 16 18:13:58 2013
@@ -3339,14 +3339,15 @@
return IKS_FILTER_EAT;
}
if (!strcasecmp(iks_name(item_content), "state")) {
+ if ((cachable_str = iks_find_attrib(item_content, "cachable"))) {
+ sscanf(cachable_str, "%30d", &cachable);
+ }
device_state = iks_find_cdata(item, "state");
- if ((cachable_str = iks_find_cdata(item, "cachable"))) {
- sscanf(cachable_str, "%30d", &cachable);
- }
if (!(event = ast_event_new(AST_EVENT_DEVICE_STATE_CHANGE,
AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, item_id, AST_EVENT_IE_STATE,
AST_EVENT_IE_PLTYPE_UINT, ast_devstate_val(device_state), AST_EVENT_IE_EID,
AST_EVENT_IE_PLTYPE_RAW, &pubsub_eid, sizeof(pubsub_eid),
+ AST_EVENT_IE_CACHABLE, AST_EVENT_IE_PLTYPE_UINT, cachable,
AST_EVENT_IE_END))) {
return IKS_FILTER_EAT;
}
More information about the asterisk-commits
mailing list