1
0
Fork 0
forked from svrjs/svrjs

Remove listenerEmitted flag from HTTP authentication message callback

This commit is contained in:
Dorian Niemiec 2024-08-26 17:13:48 +02:00
parent 5672c4a3d5
commit d92fc14991

View file

@ -406,14 +406,10 @@ module.exports = (req, res, logFacilities, config, next) => {
logFacilities.errmessage("Brute force limit reached!"); logFacilities.errmessage("Brute force limit reached!");
} }
} else { } else {
var listenerEmitted = false;
// Listen for brute-force protection response // Listen for brute-force protection response
const authMessageListener = (message) => { const authMessageListener = (message) => {
if (listenerEmitted) return;
if (message == "\x14AUTHA" + reqip || message == "\x14AUTHD" + reqip) { if (message == "\x14AUTHA" + reqip || message == "\x14AUTHD" + reqip) {
process.removeListener("message", authMessageListener); process.removeListener("message", authMessageListener);
listenerEmitted = true;
} }
if (message == "\x14AUTHD" + reqip) { if (message == "\x14AUTHD" + reqip) {
res.error(429); res.error(429);