From: Alec L Davis Date: Tue, 16 Apr 2013 23:27:51 +0000 (+0000) Subject: Distributed Device State broken at sites using res_xmpp or res_jabber where Secuity... X-Git-Tag: 11.5.0-rc1~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f49c09b8e5201e672fb747f3925127fdcfc98788;p=thirdparty%2Fasterisk.git Distributed Device State broken at sites using res_xmpp or res_jabber where Secuity Advisory AST-2012-015 is inplace res_xmpp was 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/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@385938 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_xmpp.c b/res/res_xmpp.c index ea73a51aa7..8f0f8b5a14 100644 --- a/res/res_xmpp.c +++ b/res/res_xmpp.c @@ -1328,14 +1328,15 @@ static int xmpp_pubsub_handle_event(void *data, ikspak *pak) return IKS_FILTER_EAT; } if (!strcasecmp(iks_name(item_content), "state")) { - device_state = iks_find_cdata(item, "state"); - if ((cachable_str = iks_find_cdata(item, "cachable"))) { + if ((cachable_str = iks_find_attrib(item_content, "cachable"))) { sscanf(cachable_str, "%30d", &cachable); } + device_state = iks_find_cdata(item, "state"); 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; }