X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/291779a4a9998e89dfada3c6b9d69db050dfe016..e337600f4c621ccd847d2e852ee5e2b6a0cd8dd6:/projects/stargazer/users_impl.cpp diff --git a/projects/stargazer/users_impl.cpp b/projects/stargazer/users_impl.cpp index 7b110431..61ee90ff 100644 --- a/projects/stargazer/users_impl.cpp +++ b/projects/stargazer/users_impl.cpp @@ -33,6 +33,7 @@ #endif #include + #include #include #include @@ -180,7 +181,6 @@ u.OnAdd(); users.push_front(u); AddUserIntoIndexes(users.begin()); -SetUserNotifiers(users.begin()); { // Fire all "on add" notifiers @@ -260,7 +260,6 @@ if (!priv->userAddDel) utd.delTime = stgTime; usersToDelete.push_back(utd); - UnSetUserNotifiers(u); DelUserFromIndexes(u); WriteServLog("%s User \'%s\' deleted.", @@ -280,9 +279,6 @@ if (FindByNameNonLock(login, &iter)) return false; } -if (iter->Authorize(ip, enabledDirs, auth)) - return false; - if (FindByIPIdx(ip, iter)) { if (iter->GetLogin() != login) @@ -292,9 +288,14 @@ if (FindByIPIdx(ip, iter)) 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; } @@ -340,7 +341,6 @@ for (unsigned int i = 0; i < usersList.size(); i++) ui = users.begin(); AddUserIntoIndexes(ui); - SetUserNotifiers(ui); if (ui->ReadConf() < 0) return -1; @@ -354,6 +354,10 @@ return 0; //----------------------------------------------------------------------------- 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; @@ -411,7 +415,6 @@ while (us->nonstop) user_iter ui = us->users.begin(); while (ui != us->users.end()) { - us->UnSetUserNotifiers(ui); us->DelUserFromIndexes(ui); ++ui; } @@ -801,54 +804,6 @@ WriteServLog("USERS. Incorrect search handle."); 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::iterator bi; -list::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__);