[Home]

Summary:ASTERISK-17827: [patch] Manager eventfilter blacklisting does not filter blacklisted events
Reporter:Dwayne Hubbard (dhubbard)Labels:
Date Opened:2011-05-10 09:03:11Date Closed:2011-05-10 13:46:27
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/ManagerInterface
Versions:1.8.4 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) dw-mantis19260-1.8.4.patch
Description:The following AMI account should not receive AMI Setvar and Newexten events, but the events are sent to the 'dwayne' AMI connection anyway.

[dwayne]
eventfilter=!Event: VarSet*
eventfilter=!Event: Newexten*
secret = blah
read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
write = system,call,agent,user,config,command,reporting,originate


****** STEPS TO REPRODUCE ******

1.  Create AMI account w/ blacklist entries
2.  Connect to AMI
3.  Make a call
4.  Frown
Comments:By: Dwayne Hubbard (dhubbard) 2011-05-10 09:29:49

Updated Asterisk Version to 1.8.4

By: Dwayne Hubbard (dhubbard) 2011-05-10 13:06:45

Uploaded fix for this issue: dw-mantis19260-1.8.4.patch

The current implementation of match_filter() is to:
1.  Initialize result to 0
2.  Execute the filter compare functions against the event

and to set result to:
1 : to send the event
0 : to filter the event out

The current blackfilter_cmp_fn() will set result to 1 and stop the ao2_t_callback_data() algorithm as soon as a non-match is found.

This does not work when there are multiple blacklist entries because there will always be a non-match which will result in the event being sent, even when a match is found.

This patch does two things:
1.  Set the default 'result' value in match_filter() to 1 inside the 'blacklist-only' block before calling ao2_t_callback_data(), which make the default behavior to send the event (as in the comment 'implied whitelist all')

2.  Set the result to 0 when a filter match is found.

By: Dwayne Hubbard (dhubbard) 2011-05-10 13:26:26

I just realized that this issue was also fixed in revision 306432.  This revision should be merged into the 1.8 branch.

------------------------------------------------------------------------
r306432 | jpeeler | 2011-02-04 16:37:11 -0600 (Fri, 04 Feb 2011) | 10 lines

Send manager event for blackfilter only if it DOES NOT match.

The logic got reversed, oops. Works properly now when multiple blackfilters are
present.

(closes issue ASTERISK-16936)
Reported by: telecos82
Patches:
     ast_managereventfilter.patch uploaded by telecos82 (license 687)

------------------------------------------------------------------------

By: Digium Subversion (svnbot) 2011-05-10 13:46:26

Repository: asterisk
Revision: 318485

U   branches/1.8/main/manager.c

------------------------------------------------------------------------
r318485 | lmadsen | 2011-05-10 13:46:26 -0500 (Tue, 10 May 2011) | 7 lines

Filter out blacklisted manager events when using eventfilter.

Merging change from trunk in revision 306432.

(closes issue ASTERISK-17827)
Reported by: dhubbard
Tested by: dhubbard
------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=318485