[Asterisk-code-review] manager: Fix incomplete filtering of AMI events. (asterisk[20])
Friendly Automation
asteriskteam at digium.com
Wed Jul 20 12:35:39 CDT 2022
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/18852 )
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(-)
Approvals:
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/main/manager.c b/main/manager.c
index d834f04..9645bd6 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -7128,6 +7128,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;
@@ -7239,15 +7247,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 +8693,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 +8711,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/+/18852
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 20
Gerrit-Change-Id: If8c42edcb2abc5158552da7eba2a8ff6b20e1959
Gerrit-Change-Number: 18852
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-CC: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220720/fb71ebe1/attachment-0001.html>
More information about the asterisk-code-review
mailing list