add use_antispam_mechanism_for_not_logged_users config option
This commit is contained in:
@@ -499,19 +499,19 @@ void Functions::MakeFunction()
|
||||
|
||||
void Functions::CheckGetPostTimes(time_t difference)
|
||||
{
|
||||
time_t now = std::time(0);
|
||||
if( !cur->session->puser && config->use_antispam_mechanism_for_not_logged_users )
|
||||
{
|
||||
time_t now = std::time(0);
|
||||
|
||||
if( cur->session->puser )
|
||||
return;
|
||||
if( cur->request->method != Request::post )
|
||||
return;
|
||||
|
||||
if( now - cur->session->last_time_get >= (time_t)difference )
|
||||
return;
|
||||
|
||||
if( cur->request->method != Request::post )
|
||||
return;
|
||||
|
||||
if( now - cur->session->last_time_get >= (time_t)difference )
|
||||
return;
|
||||
|
||||
cur->session->spam_score += 1;
|
||||
log << log1 << "Functions: spam +1: POST after GET sent too fast" << logend;
|
||||
cur->session->spam_score += 1;
|
||||
log << log1 << "Functions: spam +1: POST after GET sent too fast" << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -519,7 +519,7 @@ void Functions::CheckGetPostTimes(time_t difference)
|
||||
|
||||
bool Functions::CheckAntispamCounter()
|
||||
{
|
||||
if( !cur->session->puser )
|
||||
if( !cur->session->puser && config->use_antispam_mechanism_for_not_logged_users )
|
||||
{
|
||||
long form_id = Tol(cur->request->PostVar(L"winix_form_id"));
|
||||
long counter_id = Tol(cur->request->PostVar(L"winix_form_counter"));
|
||||
|
@@ -193,19 +193,22 @@ void Upload::UploadFile(Item & item, const std::wstring & tmp_filename)
|
||||
|
||||
bool Upload::FunUploadCheckAbuse()
|
||||
{
|
||||
if( !system->rebus.CheckRebus() )
|
||||
if( config->use_antispam_mechanism_for_not_logged_users )
|
||||
{
|
||||
cur->request->status = WINIX_ERR_INCORRECT_REBUS;
|
||||
return false;
|
||||
}
|
||||
if( !system->rebus.CheckRebus() )
|
||||
{
|
||||
cur->request->status = WINIX_ERR_INCORRECT_REBUS;
|
||||
return false;
|
||||
}
|
||||
|
||||
functions->CheckGetPostTimes(4);
|
||||
functions->CheckGetPostTimes(4);
|
||||
|
||||
if( cur->session->spam_score > 0 )
|
||||
{
|
||||
cur->request->status = WINIX_ERR_SPAM;
|
||||
log << log1 << "Content: ignoring due to suspected spamming" << logend;
|
||||
return false;
|
||||
if( cur->session->spam_score > 0 )
|
||||
{
|
||||
cur->request->status = WINIX_ERR_SPAM;
|
||||
log << log1 << "Content: ignoring due to suspected spamming" << logend;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user