[asterisk-bugs] [Asterisk 0019260]: [patch] Manager eventfilter blacklisting does not filter blacklisted events

Asterisk Bug Tracker noreply at bugs.digium.com
Tue May 10 13:06:45 CDT 2011


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=19260 
====================================================================== 
Reported By:                dhubbard
Assigned To:                dhubbard
====================================================================== 
Project:                    Asterisk
Issue ID:                   19260
Category:                   Core/ManagerInterface
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
Asterisk Version:           1.8.4 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2011-05-10 09:03 CDT
Last Modified:              2011-05-10 13:06 CDT
====================================================================== 
Summary:                    [patch] Manager eventfilter blacklisting does not
filter blacklisted events
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

====================================================================== 

---------------------------------------------------------------------- 
 (0134720) dhubbard (manager) - 2011-05-10 13:06
 https://issues.asterisk.org/view.php?id=19260#c134720 
---------------------------------------------------------------------- 
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. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-05-10 13:06 dhubbard       Note Added: 0134720                          
======================================================================




More information about the asterisk-bugs mailing list