From 16a63027c0d1e354ba627c8644ec93edcf8e6d6b Mon Sep 17 00:00:00 2001 From: Steve Davies <steve@one47.co.uk> Date: Wed, 15 Dec 2021 12:23:45 +0000 Subject: [PATCH] app_queue: Fix hint updates, allow dup. hints A previous patch for ASTERISK_29578 caused a 'leak' of extension state information across queues, causing the state of the first member of unrelated queues to be updated in addition to the correct member. Which queues and members depended on the order of queues in the iterator. Additionally, it is possible to use the same 'hint:' on multiple queue members, so the update cannot break out of the update loop early when a match is found. ASTERISK-29806 #close Change-Id: If2c1d1cc2a752afd9286d79710fc818596e7a7ad --- apps/app_queue.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/app_queue.c b/apps/app_queue.c index d03d9f0630..ddfa7292b2 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -2708,16 +2708,11 @@ static int extension_state_cb(const char *context, const char *exten, struct ast miter = ao2_iterator_init(q->members, 0); for (; (m = ao2_iterator_next(&miter)); ao2_ref(m, -1)) { - if (!strcmp(m->state_context, context) && !strcmp(m->state_exten, exten)) { - found = 1; - } else if (!strcmp(m->state_exten, exten) && context_included(m->state_context, context)) { + if (!strcmp(m->state_exten, exten) && + (!strcmp(m->state_context, context) || context_included(m->state_context, context))) { /* context could be included in m->state_context. We need to check. */ found = 1; - } - if (found) { update_status(q, m, device_state); - ao2_ref(m, -1); - break; } } ao2_iterator_destroy(&miter); -- GitLab