Fix anti-bruteforcing sleep to be outside of any locking
This commit is contained in:
parent
5b1521c5c8
commit
a71e81eee2
1 changed files with 7 additions and 4 deletions
|
@ -409,12 +409,15 @@ int Controller::handleAPIConnection(Socket::Connection &conn){
|
||||||
}
|
}
|
||||||
if (authorized){
|
if (authorized){
|
||||||
handleAPICommands(Request, Response);
|
handleAPICommands(Request, Response);
|
||||||
}else{// unauthorized
|
Controller::checkServerLimits(); /*LTS*/
|
||||||
Util::sleep(1000); // sleep a second to prevent bruteforcing
|
}
|
||||||
|
}// config mutex lock
|
||||||
|
if (!authorized){
|
||||||
|
// sleep a second to prevent bruteforcing.
|
||||||
|
// We need to make sure this happens _after_ unlocking the mutex!
|
||||||
|
Util::sleep(1000);
|
||||||
logins++;
|
logins++;
|
||||||
}
|
}
|
||||||
Controller::checkServerLimits(); /*LTS*/
|
|
||||||
}// config mutex lock
|
|
||||||
// send the response, either normally or through JSONP callback.
|
// send the response, either normally or through JSONP callback.
|
||||||
std::string jsonp = "";
|
std::string jsonp = "";
|
||||||
if (H.GetVar("callback") != ""){jsonp = H.GetVar("callback");}
|
if (H.GetVar("callback") != ""){jsonp = H.GetVar("callback");}
|
||||||
|
|
Loading…
Add table
Reference in a new issue