version 0.3.20
[fms.git] / src / freenet / introductionpuzzleinserter.cpp
index cac3879..defa0cb 100644 (file)
@@ -59,7 +59,6 @@ void IntroductionPuzzleInserter::CheckForNeededInsert()
                                // make sure we are on the next day or the appropriate amount of time has elapsed since the last insert\r
                                if(m_lastinserted.find(rs.GetInt(0))==m_lastinserted.end() || m_lastinserted[rs.GetInt(0)]<=lastinsert || m_lastinserted[rs.GetInt(0)].day()!=now.day())\r
                                {\r
-                                       StartInsert(rs.GetInt(0));\r
                                        m_lastinserted[rs.GetInt(0)]=now;\r
                                }\r
                                else\r
@@ -178,18 +177,18 @@ void IntroductionPuzzleInserter::Initialize()
 const bool IntroductionPuzzleInserter::StartInsert(const long &localidentityid)\r
 {\r
        Poco::DateTime now;\r
-       std::string idstring;\r
+       std::string idstring="";\r
        long index=0;\r
-       std::string indexstr;\r
+       std::string indexstr="";\r
        Poco::UUIDGenerator uuidgen;\r
        Poco::UUID uuid;\r
-       std::string messagebase;\r
+       std::string messagebase="";\r
        IntroductionPuzzleXML xml;\r
-       std::string encodedpuzzle;\r
-       std::string solutionstring;\r
+       std::string encodedpuzzle="";\r
+       std::string solutionstring="";\r
        FCPMessage message;\r
-       std::string xmldata;\r
-       std::string xmldatasizestr;\r
+       std::string xmldata="";\r
+       std::string xmldatasizestr="";\r
        std::string privatekey="";\r
        std::string publickey="";\r
        std::string keypart="";\r
@@ -227,6 +226,11 @@ const bool IntroductionPuzzleInserter::StartInsert(const long &localidentityid)
                Option::Instance()->Get("MessageBase",messagebase);\r
 \r
                GenerateCaptcha(encodedpuzzle,solutionstring);\r
+               if(encodedpuzzle.size()==0)\r
+               {\r
+                       m_log->fatal("IntroductionPuzzleInserter::StartInsert could not create introduction puzzle");\r
+                       return false;\r
+               }\r
 \r
                try\r
                {\r