[Asterisk-code-review] manager: Fix incomplete filtering of AMI events. (asterisk[16])
N A
asteriskteam at digium.com
Mon Jul 18 12:35:53 CDT 2022
N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18844 )
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, 12 insertions(+), 11 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/44/18844/1
diff --git a/main/manager.c b/main/manager.c
index 35647f0..2cc7c85 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -7133,6 +7133,14 @@
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 */
+ return -1;
+ }
+ }
+
buf = ast_str_thread_get(&manager_event_buf, MANAGER_EVENT_BUF_INITSIZE);
if (!buf) {
return -1;
@@ -7244,15 +7252,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);
@@ -8699,6 +8698,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;
}
@@ -8716,11 +8716,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/+/18844
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: If8c42edcb2abc5158552da7eba2a8ff6b20e1959
Gerrit-Change-Number: 18844
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/20220718/37b784ef/attachment-0001.html>
More information about the asterisk-code-review
mailing list