\r
// receive the file\r
data.resize(datalength);\r
- m_fcp->ReceiveRaw(&data[0],datalength);\r
+ if(data.size()>0)\r
+ {\r
+ m_fcp->ReceiveRaw(&data[0],datalength);\r
+ }\r
\r
// parse file into xml and update the database\r
- if(xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
+ if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true)\r
{\r
\r
ssk.SetPublicKey(xml.GetIdentity());\r
\r
void IdentityIntroductionRequester::Initialize()\r
{\r
- std::string tempval="";\r
- Option::Instance()->Get("MaxIdentityIntroductionRequests",tempval);\r
- StringFunctions::Convert(tempval,m_maxrequests);\r
+ m_maxrequests=0;\r
+ Option::Instance()->GetInt("MaxIdentityIntroductionRequests",m_maxrequests);\r
if(m_maxrequests<1)\r
{\r
m_maxrequests=1;\r
- m_log->error("Option MaxIdentityIntroductionRequests is currently set at "+tempval+". It must be 1 or greater.");\r
+ m_log->error("Option MaxIdentityIntroductionRequests is currently less than 1. It must be 1 or greater.");\r
}\r
if(m_maxrequests>100)\r
{\r
- m_log->warning("Option MaxIdentityIntroductionRequests is currently set at "+tempval+". This value might be incorrectly configured.");\r
+ m_log->warning("Option MaxIdentityIntroductionRequests is currently set at more than 100. This value might be incorrectly configured.");\r
}\r
Option::Instance()->Get("MessageBase",m_messagebase);\r
m_tempdate=Poco::Timestamp();\r
{\r
std::string day;\r
std::string solution;\r
-// std::vector<unsigned char> solutionhash;\r
std::string encodedhash;\r
FCPMessage message;\r
SQLite3DB::Statement st=m_db->Prepare("SELECT Day, PuzzleSolution FROM tblIntroductionPuzzleInserts WHERE FoundSolution='false' AND UUID=?;");\r
st.ResultText(0,day);\r
st.ResultText(1,solution);\r
\r
+ // get the hash of the solution\r
Poco::SHA1Engine sha1;\r
sha1.update(solution);\r
encodedhash=Poco::DigestEngine::digestToHex(sha1.digest());\r
StringFunctions::UpperCase(encodedhash,encodedhash);\r
\r
- // get the hash of the solution\r
-// solutionhash.resize(20);\r
-// sha1((unsigned char *)solution.c_str(),solution.size(),&solutionhash[0]);\r
-// Hex::Encode(solutionhash,encodedhash);\r
-\r
//start request for the solution\r
message.SetName("ClientGet");\r
message["URI"]="KSK@"+m_messagebase+"|"+day+"|"+UUID+"|"+encodedhash+".xml";\r