Compare commits

..

No commits in common. "cc8c9c58dcff3ac97c7e34c12e741d51d5555cb2" and "e2ac9fd1b94fe015cce75853ddaa36c7e946edd9" have entirely different histories.

3 changed files with 451 additions and 789 deletions

File diff suppressed because it is too large Load diff

View file

@ -108,6 +108,17 @@ void Configfile::validateConfig()
throw Exception("Directory "+chroot+" doesn't exist, can't chroot to it.",__FILE__,__LINE__); throw Exception("Directory "+chroot+" doesn't exist, can't chroot to it.",__FILE__,__LINE__);
#endif //WIN32 #endif //WIN32
//check if we have submit_stats on but no user and password
if(getSubmitStats()&&(""==getSubmitStatsUsername()||""==getSubmitStatsPassword()))
throw Exception("You have configured hermes to send stats, but have not configured a username or password.\n"
"If you don't have one, go to http://www.hermes-project.com and register there",__FILE__,__LINE__);
#ifndef HAVE_SSL
//check if we have activated submit_stats_ssl not having ssl activated
if(getSubmitStatsSsl())
throw Exception("You have configured stats submission through SSL, but hermes was compiled without SSL support",__FILE__,__LINE__);
#endif //HAVE_SSL
} }
string Configfile::parseAsString(string str) string Configfile::parseAsString(string str)

View file

@ -332,6 +332,38 @@ void *cleaner_thread_run(void *)
{ {
LERR("Error cleaning the database: " + string(e)); LERR("Error cleaning the database: " + string(e));
} }
if(spamcount>0&&cfg.getSubmitStats())
{
try
{
Socket s;
string server_response;
s.init();
s.connect("stats.hermes-project.com",11125);
#ifdef HAVE_SSL
if(cfg.getSubmitStatsSsl())
{
s.writeLine("ssl");
s.prepareSSL(false);
s.startSSL(false);
}
else
#endif //HAVE_SSL
s.writeLine("non-ssl");
s.writeLine(cfg.getSubmitStatsUsername());
s.writeLine(cfg.getSubmitStatsPassword());
s.writeLine(Utils::inttostr(spamcount));
server_response=s.readLine();
s.close();
if("OK"!=server_response)
throw Exception(server_response,__FILE__,__LINE__);
}
catch(Exception &e)
{
LDEB("Exception sending stats: "+string(e));
}
}
} }
#ifndef WIN32 #ifndef WIN32
if(false==cfg.getBackground()) if(false==cfg.getBackground())