Added local-only auto-authorize for API

This commit is contained in:
Thulinma 2017-04-15 14:00:04 +02:00
parent 5e2b29466b
commit a82be2775f
3 changed files with 43 additions and 6 deletions

View file

@ -174,6 +174,11 @@ int Controller::handleAPIConnection(Socket::Connection & conn){
}
{//lock the config mutex here - do not unlock until done processing
tthread::lock_guard<tthread::mutex> guard(configMutex);
//Are we local and not forwarded? Instant-authorized.
if (!authorized && !H.hasHeader("X-Real-IP") && conn.isLocal()){
INFO_MSG("Local API access automatically authorized");
authorized = true;
}
//if already authorized, do not re-check for authorization
if (authorized){
Response["authorize"]["status"] = "OK";