[sr-dev] git:master: userblacklist(k): fix error in check_user_blacklist DB code

Henning Westerholt henning.westerholt at 1und1.de
Fri Sep 4 17:58:24 CEST 2009


Module: sip-router
Branch: master
Commit: 9566b04be793c5a4219cd0ebb55f95b7659d2e41
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9566b04be793c5a4219cd0ebb55f95b7659d2e41

Author: Henning Westerholt <henning.westerholt at 1und1.de>
Committer: Henning Westerholt <henning.westerholt at 1und1.de>
Date:   Fri Sep  4 17:56:31 2009 +0200

userblacklist(k): fix error in check_user_blacklist DB code

- fix an error in the check_user_blacklist DB code, we need to return
  the WHITELIST node when we found a value != zero
- reported from Alexandr Dubovikov, Alexandr dot Dubovikov at qsc dot de

---

 modules_k/userblacklist/db.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/modules_k/userblacklist/db.c b/modules_k/userblacklist/db.c
index c2613c1..fc8c915 100644
--- a/modules_k/userblacklist/db.c
+++ b/modules_k/userblacklist/db.c
@@ -78,7 +78,11 @@ int db_build_userbl_tree(const str *username, const str *domain, const str *tabl
 					/* LM_DBG("insert into tree prefix %s, whitelist %d",
 						RES_ROWS(res)[i].values[0].val.string_val,
 						RES_ROWS(res)[i].values[1].val.int_val); */
-					if (RES_ROWS(res)[i].values[1].val.int_val == 0) nodeflags=(void *)MARK_BLACKLIST;
+					if (RES_ROWS(res)[i].values[1].val.int_val == 0) {
+						nodeflags=(void *)MARK_BLACKLIST;
+					} else {
+						nodeflags=(void *)MARK_WHITELIST;
+					}
 					if (dtrie_insert(root, RES_ROWS(res)[i].values[0].val.string_val, strlen(RES_ROWS(res)[i].values[0].val.string_val),
 						nodeflags, 10) < 0) LM_ERR("could not insert values into trie.\n");
 					n++;




More information about the sr-dev mailing list