[Asterisk-code-review] ami: Improve substring parsing for disabled events. (asterisk[master])
Friendly Automation
asteriskteam at digium.com
Mon Mar 7 14:23:22 CST 2022
Friendly Automation has submitted this change. ( 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(-)
Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, but someone else must approve
Benjamin Keith Ford: Looks good to me, approved
Friendly Automation: Approved for Submit
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: 3
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220307/19e090b0/attachment.html>
More information about the asterisk-code-review
mailing list