X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/06938e336ea07128682fe074740a8f930c503caf..8e8c6cdddc6af0a1e7ebcd7fa947395b66bf1103:/projects/stargazer/plugins/other/radius/radius.cpp diff --git a/projects/stargazer/plugins/other/radius/radius.cpp b/projects/stargazer/plugins/other/radius/radius.cpp index 62c9305c..480e6f16 100644 --- a/projects/stargazer/plugins/other/radius/radius.cpp +++ b/projects/stargazer/plugins/other/radius/radius.cpp @@ -236,27 +236,23 @@ if (isRunning) //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; @@ -467,7 +463,7 @@ if (CanAcctService((char *)packet->service)) return -1; } USER_IPS ips = ui->GetProperty().ips; - if (users->Authorize(ui->GetLogin(), ips[0].ip, 0xffFFffFF, this)) + if (!users->Authorize(ui->GetLogin(), ips[0].ip, 0xffFFffFF, this)) { printfd(__FILE__, "RADIUS::ProcessAcctStartPacket cannot authorize user '%s'\n", packet->login); packet->packetType = RAD_REJECT_PACKET;