[Kamailio-Users] check_user_blacklist function

Henning Westerholt henning.westerholt at 1und1.de
Wed Feb 10 17:04:59 CET 2010


On Wednesday 10 February 2010, Antonio Reale wrote:
> the function check_user_blacklist in kamailio 1.4 returns -1 (FALSE
> based on the doc) "if a match is found and it is not set to
> whitelist", otherwise it returns 1 (TRUE). So the function returns the
> same value if a match is found and is set to whitelist and if there
> are no matches.
> I need to differentiate the two situations.
> The userblacklist module in kamailio 3.0 has a new function
> "check_user_whitelist" that can solve my problem, but at this time I
> can't upgrade.
> I solved the problem, changing only the return value in case of
> whitelisted entry (userblacklist.c file), but I don't know if it is a
> safe (and suffice) modification. Below the piece of code in the
> userblacklist.c:
> 
>         if (dt_longest_match(dt_root, ptr, &whitelist) >= 0) {
>                 if (whitelist) {
>                         /* LM_ERR("whitelisted"); */
>                         return 2; /* found, but is whitelisted */
> <===== CHANGED HERE. IT WAS return 1
>                 }
>         } else {
>                 /* LM_ERR("not found"); */
>                 return 1; /* not found is ok */
>         }

Hi Antonio,

changing the return value should be fine in this case, i think.
If you want to port the check_whitelist function to 1.4, you find
the diff from the git at this URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=9a0b182593cd4709cc73c463a916de6a78aa7ccc

The patch should apply to the 1.4 code as well, maybe after a little bit
of reworking.

Regards,

Henning



More information about the Users mailing list