[Asterisk-code-review] ami: Improve substring parsing for disabled events. (asterisk[master])

N A asteriskteam at digium.com
Thu Feb 24 10:58:59 CST 2022


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18074 )


Change subject: ami: Improve substring parsing for disabled events.
......................................................................

ami: Improve substring parsing for disabled events.

ASTERISK-29853 added the ability to selectively disable
AMI events on a global basis, but the logic for this uses
strstr which means that events with names which are the prefix
of another event, if disabled, could disable those events as
well.

Instead, we account for this possibility to prevent this
undesired behavior from occuring.

ASTERISK_29853

Change-Id: Icccd1872602889806740971e4adf932f92466959
---
M main/manager.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/74/18074/1

diff --git a/main/manager.c b/main/manager.c
index f6feb8e..76a6611 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -7234,7 +7234,7 @@
 	int res;
 
 	if (!ast_strlen_zero(manager_disabledevents)) {
-		if (strstr(manager_disabledevents, event)) {
+		if (ast_in_delimited_string(event, manager_disabledevents, ',')) {
 			ast_debug(3, "AMI Event '%s' is globally disabled, skipping\n", event);
 			/* Event is globally disabled */
 			ao2_cleanup(sessions);

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18074
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Icccd1872602889806740971e4adf932f92466959
Gerrit-Change-Number: 18074
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220224/d9801fdf/attachment.html>


More information about the asterisk-code-review mailing list