[Kamailio-Users] check_user_blacklist function

Antonio Reale ant.reale at gmail.com
Wed Feb 10 15:54:09 CET 2010


Hi all,
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 */
        }

Thanks. Regards.

-- 
Antonio




More information about the sr-users mailing list