[Asterisk-code-review] manager: Fix incomplete filtering of AMI events. (asterisk[master])
N A
asteriskteam at digium.com
Tue Jul 12 16:40:46 CDT 2022
N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18821 )
Change subject: manager: Fix incomplete filtering of AMI events.
......................................................................
manager: Fix incomplete filtering of AMI events.
The global event filtering code was only in one
possible execution path, so not all events were
being properly filtered out if requested. This moves
that into the universal AMI handling code so all
events are properly handled.
Additionally, the CLI listing of disabled events can
also get truncated, so we now print out everything.
ASTERISK-30137 #close
Change-Id: If8c42edcb2abc5158552da7eba2a8ff6b20e1959
---
M main/manager.c
1 file changed, 13 insertions(+), 11 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/21/18821/1
diff --git a/main/manager.c b/main/manager.c
index d834f04..cc23f23 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -7128,6 +7128,15 @@
struct ast_str *buf;
int i;
+ if (!ast_strlen_zero(manager_disabledevents)) {
+ 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);
+ return 0;
+ }
+ }
+
buf = ast_str_thread_get(&manager_event_buf, MANAGER_EVENT_BUF_INITSIZE);
if (!buf) {
return -1;
@@ -7239,15 +7248,6 @@
va_list ap;
int res;
- if (!ast_strlen_zero(manager_disabledevents)) {
- 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);
- return 0;
- }
- }
-
if (!any_manager_listeners(sessions)) {
/* Nobody is listening */
ao2_cleanup(sessions);
@@ -8694,6 +8694,7 @@
}
#define FORMAT " %-25.25s %-15.55s\n"
#define FORMAT2 " %-25.25s %-15d\n"
+#define FORMAT3 " %-25.25s %s\n"
if (a->argc != 3) {
return CLI_SHOWUSAGE;
}
@@ -8711,11 +8712,12 @@
ast_cli(a->fd, FORMAT, "Allow multiple login:", AST_CLI_YESNO(allowmultiplelogin));
ast_cli(a->fd, FORMAT, "Display connects:", AST_CLI_YESNO(displayconnects));
ast_cli(a->fd, FORMAT, "Timestamp events:", AST_CLI_YESNO(timestampevents));
- ast_cli(a->fd, FORMAT, "Channel vars:", S_OR(manager_channelvars, ""));
- ast_cli(a->fd, FORMAT, "Disabled events:", S_OR(manager_disabledevents, ""));
+ ast_cli(a->fd, FORMAT3, "Channel vars:", S_OR(manager_channelvars, ""));
+ ast_cli(a->fd, FORMAT3, "Disabled events:", S_OR(manager_disabledevents, ""));
ast_cli(a->fd, FORMAT, "Debug:", AST_CLI_YESNO(manager_debug));
#undef FORMAT
#undef FORMAT2
+#undef FORMAT3
return CLI_SUCCESS;
}
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18821
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: If8c42edcb2abc5158552da7eba2a8ff6b20e1959
Gerrit-Change-Number: 18821
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/20220712/dd4b7fd9/attachment.html>
More information about the asterisk-code-review
mailing list