Fix for uniqueness of IP range bans

This commit is contained in:
Calvin Montgomery 2015-11-23 18:22:51 -08:00
parent 5c50e93458
commit b241a210f3

View file

@ -374,12 +374,21 @@ KickBanModule.prototype.banAll = function (actor, name, range, reason, cb) {
if (err) { if (err) {
return error(err); return error(err);
} }
var seenIPs = {};
var all = ips.map(function (ip) { var all = ips.map(function (ip) {
if (range === "range") { if (range === "range") {
ip = util.getIPRange(ip); ip = util.getIPRange(ip);
} else if (range === "wrange") { } else if (range === "wrange") {
ip = util.getWideIPRange(ip); ip = util.getWideIPRange(ip);
} }
if (seenIPs.hasOwnProperty(ip)) {
return;
} else {
seenIPs[ip] = true;
}
return Q.nfcall(self.banIP.bind(self), actor, ip, name, reason); return Q.nfcall(self.banIP.bind(self), actor, ip, name, reason);
}); });