///////////////////////////
pv.param = "Port";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'Port\' not found.";
printfd(__FILE__, "Parameter 'Port' not found\n");
///////////////////////////
pv.param = "UserDelay";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'UserDelay\' not found.";
printfd(__FILE__, "Parameter 'UserDelay' not found\n");
///////////////////////////
pv.param = "UserTimeout";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'UserTimeout\' not found.";
printfd(__FILE__, "Parameter 'UserTimeout' not found\n");
///////////////////////////
pv.param = "LogProtocolErrors";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
logProtocolErrors = false;
else if (ParseYesNo(pvi->value[0], &logProtocolErrors))
{
printfd(__FILE__, "Cannot parse parameter 'LogProtocolErrors'\n");
return -1;
}
-if (logProtocolErrors)
- printfd(__FILE__, "LogProtocolErrors: true\n");
-else
- printfd(__FILE__, "LogProtocolErrors: false\n");
/////////////////////////////////////////////////////////////
std::string freeMbType;
int n = 0;
pv.param = "FreeMb";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'FreeMb\' not found.";
printfd(__FILE__, "Parameter 'FreeMb' not found\n");
#ifdef IA_PHASE_DEBUG
IA_PHASE::IA_PHASE()
: phase(1),
- phaseTime(),
flog(NULL)
{
gettimeofday(&phaseTime, NULL);
}
#else
IA_PHASE::IA_PHASE()
- : phase(1),
- phaseTime()
+ : phase(1)
{
gettimeofday(&phaseTime, NULL);
}
{
touchTime = stgTime;
std::string monFile = ia->stgSettings->GetMonitorDir() + "/inetaccess_r";
- TouchFile(monFile.c_str());
+ TouchFile(monFile);
}
}
// TODO change counter to timer and MONITOR_TIME_DELAY_SEC
if (++a % (50 * 60) == 0 && ia->stgSettings->GetMonitoring())
{
- TouchFile(monFile.c_str());
+ TouchFile(monFile);
}
}
AUTH_IA_SETTINGS newIaSettings;
if (newIaSettings.ParseSettings(ms))
{
- STG_LOGGER & WriteServLog = GetStgLogger();
printfd(__FILE__, "AUTH_IA::Reload() - Failed to reload InetAccess.\n");
- WriteServLog("AUTH_IA: Cannot reload InetAccess. Errors found.");
+ logger("AUTH_IA: Cannot reload InetAccess. Errors found.");
return -1;
}
-STG_LOGGER & WriteServLog = GetStgLogger();
printfd(__FILE__, "AUTH_IA::Reload() - Reloaded InetAccess successfully.\n");
-WriteServLog("AUTH_IA: Reloaded InetAccess successfully.");
+logger("AUTH_IA: Reloaded InetAccess successfully.");
+iaSettings = newIaSettings;
return 0;
}
//-----------------------------------------------------------------------------
&& (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++);
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;
&& ((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");
}
iaUser->rnd = static_cast<uint32_t>(random());
connSynAck6.rnd = iaUser->rnd;
-connSynAck6.userTimeOut = iaSettings.GetUserTimeout();
-connSynAck6.aliveDelay = iaSettings.GetUserDelay();
+connSynAck6.userTimeOut = iaSettings.GetUserTimeout().GetSec();
+connSynAck6.aliveDelay = iaSettings.GetUserDelay().GetSec();
#ifdef ARCH_BE
SwapBytes(connSynAck6.len);
iaUser->rnd = static_cast<uint32_t>(random());
connSynAck8.rnd = iaUser->rnd;
-connSynAck8.userTimeOut = iaSettings.GetUserTimeout();
-connSynAck8.aliveDelay = iaSettings.GetUserDelay();
+connSynAck8.userTimeOut = iaSettings.GetUserTimeout().GetSec();
+connSynAck8.aliveDelay = iaSettings.GetUserDelay().GetSec();
#ifdef ARCH_BE
SwapBytes(connSynAck8.len);