//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
RADIUS::RADIUS()
- : nonstop(false),
+ : ctx(),
+ errorStr(),
+ radSettings(),
+ settings(),
+ authServices(),
+ acctServices(),
+ sessions(),
+ nonstop(false),
isRunning(false),
users(NULL),
stgSettings(NULL),
store(NULL),
- sock(-1)
+ thread(),
+ mutex(),
+ sock(-1),
+ packet()
{
InitEncrypt(&ctx, "");
}
//-----------------------------------------------------------------------------
-void RADIUS::SetUsers(USERS * u)
-{
-users = u;
-}
-//-----------------------------------------------------------------------------
-void RADIUS::SetStgSettings(const SETTINGS * s)
-{
-stgSettings = s;
-}
-//-----------------------------------------------------------------------------
-void RADIUS::SetSettings(const MODULE_SETTINGS & s)
-{
-settings = s;
-}
-//-----------------------------------------------------------------------------
-void RADIUS::SetStore(STORE * s)
-{
-store = s;
-}
-//-----------------------------------------------------------------------------
int RADIUS::ParseSettings()
{
int ret = radSettings.ParseSettings(settings);
return ret;
}
//-----------------------------------------------------------------------------
-bool RADIUS::IsRunning()
-{
-return isRunning;
-}
-//-----------------------------------------------------------------------------
-const std::string RADIUS::GetVersion() const
-{
-return "RADIUS data access plugin v 0.6";
-}
-//-----------------------------------------------------------------------------
-uint16_t RADIUS::GetStartPosition() const
-{
-// Start before any authorizers!!!
-return 20;
-}
-//-----------------------------------------------------------------------------
-uint16_t RADIUS::GetStopPosition() const
-{
-return 20;
-}
-//-----------------------------------------------------------------------------
int RADIUS::PrepareNet()
{
sock = socket(AF_INET, SOCK_DGRAM, 0);
//5 seconds to thread stops itself
for (int i = 0; i < 25 && isRunning; i++)
{
- usleep(200000);
- }
-
- //after 5 seconds waiting thread still running. now killing it
- if (isRunning)
- {
- if (pthread_kill(thread, SIGINT))
- {
- errorStr = "Cannot kill thread.";
- printfd(__FILE__, "Cannot kill thread\n");
- return -1;
- }
- printfd(__FILE__, "RADIUS::Stop killed Run\n");
+ struct timespec ts = {0, 200000000};
+ nanosleep(&ts, NULL);
}
}
+if (isRunning)
+ return -1;
+
return 0;
}
//-----------------------------------------------------------------------------
void * RADIUS::Run(void * d)
{
+sigset_t signalSet;
+sigfillset(&signalSet);
+pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
+
RADIUS * rad = (RADIUS *)d;
RAD_PACKET packet;