#endif
#include <pthread.h>
+
#include <csignal>
#include <cassert>
#include <algorithm>
users.push_front(u);
AddUserIntoIndexes(users.begin());
-SetUserNotifiers(users.begin());
{
// Fire all "on add" notifiers
utd.delTime = stgTime;
usersToDelete.push_back(utd);
- UnSetUserNotifiers(u);
DelUserFromIndexes(u);
WriteServLog("%s User \'%s\' deleted.",
return false;
}
-if (iter->Authorize(ip, enabledDirs, auth))
- return false;
-
if (FindByIPIdx(ip, iter))
{
if (iter->GetLogin() != login)
iter->GetLogin().c_str());
return false;
}
+ if (iter->Authorize(ip, enabledDirs, auth))
+ return false;
return true;
}
+if (iter->Authorize(ip, enabledDirs, auth))
+ return false;
+
AddToIPIdx(iter);
return true;
}
ui = users.begin();
AddUserIntoIndexes(ui);
- SetUserNotifiers(ui);
if (ui->ReadConf() < 0)
return -1;
//-----------------------------------------------------------------------------
void * USERS_IMPL::Run(void * d)
{
+sigset_t signalSet;
+sigfillset(&signalSet);
+pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
+
printfd(__FILE__, "=====================| pid: %d |===================== \n", getpid());
USERS_IMPL * us = (USERS_IMPL*) d;
user_iter ui = us->users.begin();
while (ui != us->users.end())
{
- us->UnSetUserNotifiers(ui);
us->DelUserFromIndexes(ui);
++ui;
}
return -1;
}
//-----------------------------------------------------------------------------
-void USERS_IMPL::SetUserNotifiers(user_iter user)
-{
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
-
-/*PROPERTY_NOTIFER_IP_BEFORE nb(*this, user);
-PROPERTY_NOTIFER_IP_AFTER na(*this, user);
-
-userIPNotifiersBefore.push_front(nb);
-userIPNotifiersAfter.push_front(na);
-
-user->AddCurrIPBeforeNotifier(&(*userIPNotifiersBefore.begin()));
-user->AddCurrIPAfterNotifier(&(*userIPNotifiersAfter.begin()));*/
-}
-//-----------------------------------------------------------------------------
-void USERS_IMPL::UnSetUserNotifiers(user_iter user)
-{
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
-
-/*list<PROPERTY_NOTIFER_IP_BEFORE>::iterator bi;
-list<PROPERTY_NOTIFER_IP_AFTER>::iterator ai;
-
-bi = userIPNotifiersBefore.begin();
-while (bi != userIPNotifiersBefore.end())
- {
- if (bi->GetUser() == user)
- {
- bi->GetUser()->DelCurrIPBeforeNotifier(&(*bi));
- userIPNotifiersBefore.erase(bi);
- //printfd(__FILE__, "Notifier Before removed. User %s\n", bi->GetUser()->GetLogin().c_str());
- break;
- }
- ++bi;
- }
-
-ai = userIPNotifiersAfter.begin();
-while (ai != userIPNotifiersAfter.end())
- {
- if (ai->GetUser() == user)
- {
- ai->GetUser()->DelCurrIPAfterNotifier(&(*ai));
- userIPNotifiersAfter.erase(ai);
- //printfd(__FILE__, "Notifier After removed. User %s\n", ai->GetUser()->GetLogin().c_str());
- break;
- }
- ++ai;
- }*/
-}
-//-----------------------------------------------------------------------------
void USERS_IMPL::AddUserIntoIndexes(user_iter user)
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);