diff --git a/UPGRADE.txt b/UPGRADE.txt index 5e5931114cd2edff4a9e49f230b56288d6d8c134..bf4366a7410f384345290e86a3c17d84b58b72e2 100644 --- a/UPGRADE.txt +++ b/UPGRADE.txt @@ -47,5 +47,8 @@ Configuration Files: again set the root console verbose level and affect the verbose level logged. + - The manager.conf 'eventfilter' now takes an "extended" regular expression + instead of a "basic" one. + =========================================================== =========================================================== diff --git a/configs/manager.conf.sample b/configs/manager.conf.sample index fd54b81b93ecff129915e27ad3e3f72af9b30723..f31c6d39758e201919e85452edb356366307d3f1 100644 --- a/configs/manager.conf.sample +++ b/configs/manager.conf.sample @@ -94,13 +94,14 @@ bindaddr = 0.0.0.0 ; user. ; ;eventfilter=Event: Newchannel -;eventfilter=!Channel: DAHDI.* +;eventfilter=Channel: (PJ)?SIP/(james|jim|john)- +;eventfilter=!Channel: DAHDI/ ; The eventfilter option is used to whitelist or blacklist events per user. -; A filter consists of a (basic/old-style and unanchored) regular expression -; that is run on the entire event data. If the first character of the filter -; is an exclamation mark (!), the filter is appended to the blacklist instead -; of the whitelist. After first checking the read access below, the regular -; expression filters are processed as follows: +; A filter consists of an (unanchored) regular expression that is run on the +; entire event data. If the first character of the filter is an exclamation +; mark (!), the filter is appended to the blacklist instead of the whitelist. +; After first checking the read access below, the regular expression filters +; are processed as follows: ; - If no filters are configured all events are reported as normal. ; - If there are white filters only: implied black all filter processed first, ; then white filters. diff --git a/main/manager.c b/main/manager.c index 9e88628aabf3c78d05621c71693a4e6ba927efe0..ef569aa4a5bd085c2e8db5a52321f6a9a1d53877 100644 --- a/main/manager.c +++ b/main/manager.c @@ -5121,7 +5121,7 @@ static enum add_filter_result manager_add_filter(const char *filter_pattern, str is_blackfilter = 0; } - if (regcomp(new_filter, filter_pattern, 0)) { /* XXX: the only place we use non-REG_EXTENDED */ + if (regcomp(new_filter, filter_pattern, REG_EXTENDED | REG_NOSUB)) { ao2_t_ref(new_filter, -1, "failed to make regex"); return FILTER_COMPILE_FAIL; }