X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/3cab79a5d05e024d1b413b307c5b7a3cdddb6746..bbdaa9a6451f7057a587b5a8e7a9acd54e6462c1:/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp diff --git a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp index 99e0a091..3aec35ae 100644 --- a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp +++ b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp @@ -480,7 +480,7 @@ while (ia->nonstop) { touchTime = stgTime; std::string monFile = ia->stgSettings->GetMonitorDir() + "/inetaccess_r"; - TouchFile(monFile.c_str()); + TouchFile(monFile); } } @@ -508,7 +508,7 @@ while (ia->nonstop) // TODO change counter to timer and MONITOR_TIME_DELAY_SEC if (++a % (50 * 60) == 0 && ia->stgSettings->GetMonitoring()) { - TouchFile(monFile.c_str()); + TouchFile(monFile); } } @@ -706,7 +706,7 @@ while (it != ip2user.end()) && (currTime - it->second.phase.GetTime()) > iaSettings.GetUserDelay()) { if (iaSettings.LogProtocolErrors()) - logger("User '%s'. Protocol version: %d. Phase 2: connect request timeout (%f > %d).", it->second.login.c_str(), it->second.protoVer, (currTime - it->second.phase.GetTime()).AsDouble(), iaSettings.GetUserDelay()); + logger("User '%s'. Protocol version: %d. Phase 2: connect request timeout (%f > %d).", it->second.login.c_str(), it->second.protoVer, (currTime - it->second.phase.GetTime()).AsDouble(), iaSettings.GetUserDelay().GetSec()); it->second.phase.SetPhase1(); printfd(__FILE__, "Phase changed from 2 to 1. Reason: timeout\n"); ip2user.erase(it++); @@ -750,7 +750,7 @@ while (it != ip2user.end()) if ((currTime - it->second.phase.GetTime()) > iaSettings.GetUserTimeout()) { if (iaSettings.LogProtocolErrors()) - logger("User '%s'. Protocol version: %d. Phase 3: alive timeout (%f > %d).", it->second.login.c_str(), it->second.protoVer, (currTime - it->second.phase.GetTime()).AsDouble(), iaSettings.GetUserTimeout()); + logger("User '%s'. Protocol version: %d. Phase 3: alive timeout (%f > %d).", it->second.login.c_str(), it->second.protoVer, (currTime - it->second.phase.GetTime()).AsDouble(), iaSettings.GetUserTimeout().GetSec()); users->Unauthorize(it->second.user->GetLogin(), this); ip2user.erase(it++); continue; @@ -761,7 +761,7 @@ while (it != ip2user.end()) && ((currTime - it->second.phase.GetTime()) > iaSettings.GetUserDelay())) { if (iaSettings.LogProtocolErrors()) - logger("User '%s'. Protocol version: %d. Phase 4: disconnect request timeout (%f > %d).", it->second.login.c_str(), it->second.protoVer, (currTime - it->second.phase.GetTime()).AsDouble(), iaSettings.GetUserDelay()); + logger("User '%s'. Protocol version: %d. Phase 4: disconnect request timeout (%f > %d).", it->second.login.c_str(), it->second.protoVer, (currTime - it->second.phase.GetTime()).AsDouble(), iaSettings.GetUserDelay().GetSec()); it->second.phase.SetPhase3(); printfd(__FILE__, "Phase changed from 4 to 3. Reason: timeout\n"); } @@ -1203,7 +1203,7 @@ if ((iaUser->phase.GetPhase() == 2) && (connAck->rnd == iaUser->rnd + 1)) return -1; } } -printfd(__FILE__, "Invalid phase or control number. Phase: %d. Control number: %d\n", iaUser->phase.GetPhase(), connAck->rnd); +printfd(__FILE__, "Invalid phase or control number. Phase: %d. Control number: %d, expected: %d\n", iaUser->phase.GetPhase(), connAck->rnd, iaUser->rnd + 1); if (iaSettings.LogProtocolErrors()) { if (iaUser->phase.GetPhase() != 2) @@ -1248,7 +1248,7 @@ if ((iaUser->phase.GetPhase() == 2) && (connAck->rnd == iaUser->rnd + 1)) return -1; } } -printfd(__FILE__, "Invalid phase or control number. Phase: %d. Control number: %d\n", iaUser->phase.GetPhase(), connAck->rnd); +printfd(__FILE__, "Invalid phase or control number. Phase: %d. Control number: %d, expected: %d\n", iaUser->phase.GetPhase(), connAck->rnd, iaUser->rnd + 1); if (iaSettings.LogProtocolErrors()) { if (iaUser->phase.GetPhase() != 2) @@ -1411,8 +1411,10 @@ for (int j = 0; j < DIR_NUM; j++) iaUser->rnd = static_cast(random()); connSynAck6.rnd = iaUser->rnd; -connSynAck6.userTimeOut = iaSettings.GetUserTimeout(); -connSynAck6.aliveDelay = iaSettings.GetUserDelay(); +printfd(__FILE__, "Sending CONN_SYN_ACK with control number %d.\n", iaUser->rnd); + +connSynAck6.userTimeOut = iaSettings.GetUserTimeout().GetSec(); +connSynAck6.aliveDelay = iaSettings.GetUserDelay().GetSec(); #ifdef ARCH_BE SwapBytes(connSynAck6.len); @@ -1453,8 +1455,10 @@ for (int j = 0; j < DIR_NUM; j++) iaUser->rnd = static_cast(random()); connSynAck8.rnd = iaUser->rnd; -connSynAck8.userTimeOut = iaSettings.GetUserTimeout(); -connSynAck8.aliveDelay = iaSettings.GetUserDelay(); +printfd(__FILE__, "Sending CONN_SYN_ACK with control number %d.\n", iaUser->rnd); + +connSynAck8.userTimeOut = iaSettings.GetUserTimeout().GetSec(); +connSynAck8.aliveDelay = iaSettings.GetUserDelay().GetSec(); #ifdef ARCH_BE SwapBytes(connSynAck8.len);