]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/radius/radius.cpp
Fix occasional crash on second and more reload in SMUX plugin
[stg.git] / projects / stargazer / plugins / other / radius / radius.cpp
index 6a02ce4f3d7ff328779d41dee45a2df41eb676f3..480e6f16252aaab31d279a02e5e0ce43971294cf 100644 (file)
@@ -239,25 +239,20 @@ if (isRunning)
         struct timespec ts = {0, 200000000};
         nanosleep(&ts, NULL);
         }
         struct timespec ts = {0, 200000000};
         nanosleep(&ts, NULL);
         }
-
-    //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");
-        }
     }
 
     }
 
+if (isRunning)
+    return -1;
+
 return 0;
 }
 //-----------------------------------------------------------------------------
 void * RADIUS::Run(void * d)
 {
 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;
 
 RADIUS * rad = (RADIUS *)d;
 RAD_PACKET packet;
 
@@ -468,7 +463,7 @@ if (CanAcctService((char *)packet->service))
         return -1;
         }
     USER_IPS ips = ui->GetProperty().ips;
         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;
         {
         printfd(__FILE__, "RADIUS::ProcessAcctStartPacket cannot authorize user '%s'\n", packet->login);
         packet->packetType = RAD_REJECT_PACKET;