From 4854888fcf1d5f022aa4a4a3dc1390a7bdb9e1f3 Mon Sep 17 00:00:00 2001 From: Dr Luke Angel Date: Fri, 27 Oct 2017 22:16:01 -0700 Subject: [PATCH 1/2] update blacklist.js to strip ports from v4 Blacklist.test in blacklist.js to strip port from ipv4. my site was passing in 24.18.192.75:52506 and nodebb was giving 28/10 04:34:41 [6680] - error: /login Error: ipaddr: the address has neither IPv6 nor IPv4 format So i updated the client Ip to strip the port number if its a v4 IP --- src/meta/blacklist.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/meta/blacklist.js b/src/meta/blacklist.js index 6fa657c5e8..9fe0737b54 100644 --- a/src/meta/blacklist.js +++ b/src/meta/blacklist.js @@ -65,6 +65,9 @@ Blacklist.test = function (clientIp, callback) { // Some handy test addresses // clientIp = '2001:db8:85a3:0:0:8a2e:370:7334'; // IPv6 // clientIp = '127.0.15.1'; // IPv4 + // clientIp = '127.0.15.1:3443'; // IPv4 with port strip port to not fail + clientIp = clientIp.split(":").length == 2 ? clientIp.split(":")[0] : clientIp; + var addr = ipaddr.parse(clientIp); if ( From 999a7abc5d3fe34f849e3a82225533bab2ef9065 Mon Sep 17 00:00:00 2001 From: Dr Luke Angel Date: Fri, 27 Oct 2017 22:21:48 -0700 Subject: [PATCH 2/2] updated equality operator small update to equality operator --- src/meta/blacklist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/meta/blacklist.js b/src/meta/blacklist.js index 9fe0737b54..995a9e4488 100644 --- a/src/meta/blacklist.js +++ b/src/meta/blacklist.js @@ -66,7 +66,7 @@ Blacklist.test = function (clientIp, callback) { // clientIp = '2001:db8:85a3:0:0:8a2e:370:7334'; // IPv6 // clientIp = '127.0.15.1'; // IPv4 // clientIp = '127.0.15.1:3443'; // IPv4 with port strip port to not fail - clientIp = clientIp.split(":").length == 2 ? clientIp.split(":")[0] : clientIp; + clientIp = clientIp.split(":").length === 2 ? clientIp.split(":")[0] : clientIp; var addr = ipaddr.parse(clientIp);