diff --git a/exec/load/ircd/config.js b/exec/load/ircd/config.js index 02a92f9d9f9370450a111e66ef066fe6be7f880e..22692429a57a156c071cc723c1ec965ca8b24c2b 100644 --- a/exec/load/ircd/config.js +++ b/exec/load/ircd/config.js @@ -548,7 +548,7 @@ function ini_RBL(arg, ini) { )); return; } - RBL.push(ini.Hostname); + RBL.push(new RBL_Config_Object(ini.Hostname, ini.GoodResponses, ini.BadResponses)); } function load_config_defaults() { @@ -865,3 +865,9 @@ function ZLine(ipmask,reason) { this.ipmask = ipmask; this.reason = reason; } + +function RBL_Config_Object(hostname, good, bad) { + this.hostname = hostname; + this.good = this.good ? good.split(",") : ""; + this.bad = this.bad ? bad.split(",") : ""; +} diff --git a/exec/load/ircd/core.js b/exec/load/ircd/core.js index 783b2fb0301eff0f3ce4fd0400e69648af03d701..81c5cf67544a088b4974b1c26852665cdcffdfe5 100644 --- a/exec/load/ircd/core.js +++ b/exec/load/ircd/core.js @@ -2803,6 +2803,27 @@ function IRCClient_finalize_server_connect(states) { this.synchronize(); } +function RBL_Listed_According_to_Config(rbl_object, dns_reply) { + var i; + + if (rbl_object.good) { + for (i in rbl_object.good) { + if (dns_reply == rbl_object.good[i]) + return false; + } + } else if (rbl_object.bad) { + for (i in rbl_object.bad) { + if (dns_reply == rbl_object.bad[i]) + return true; + } + } else if (dns_reply) { + return true; + } + + /* not listed by default */ + return false; +} + function accept_new_socket() { var unreg_obj, id, sock, num_rbls, count, i, dnsbl_result; @@ -2860,8 +2881,8 @@ function accept_new_socket() { count, num_rbls )); - dnsbl_result = check_dnsbl(sock.remote_ip_address, RBL[i]); - if (dnsbl_result) { + dnsbl_result = check_dnsbl(sock.remote_ip_address, RBL[i].hostname); + if (RBL_Listed_According_to_Config(RBL[i], dnsbl_result)) { sock.send(format( ":%s 463 * :Your IP address is on an RBL. Connection denied.\r\n", ServerName @@ -2870,7 +2891,7 @@ function accept_new_socket() { "DNS-Blocked IP address %s resolves to %s from RBL %s", sock.remote_ip_address, dnsbl_result, - RBL[i] + RBL[i].hostname )); sock.close(); return false;