version 0.3.20
authorSomeDude <SomeDude@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw>
Wed, 24 Sep 2008 09:19:00 +0000 (11:19 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Wed, 24 Sep 2008 09:19:00 +0000 (11:19 +0200)
15 files changed:
include/freenet/freenetmasterthread.h
include/global.h
src/bitmapvalidator.cpp
src/board.cpp
src/freenet/boardlistrequester.cpp
src/freenet/fmsversionrequester.cpp
src/freenet/freenetmasterthread.cpp
src/freenet/identityintroductionrequester.cpp
src/freenet/identityrequester.cpp
src/freenet/introductionpuzzleinserter.cpp
src/freenet/introductionpuzzlerequester.cpp
src/freenet/messagelistrequester.cpp
src/freenet/messagerequester.cpp
src/freenet/trustlistrequester.cpp
src/http/pages/createidentitypage.cpp

index 76d6102..f604fde 100644 (file)
@@ -22,7 +22,7 @@ public:
 \r
        void run();\r
 \r
-       // registration methods for children objects\r
+       // registration methods for child objects\r
        void RegisterPeriodicProcessor(IPeriodicProcessor *obj);\r
        void RegisterFCPConnected(IFCPConnected *obj);\r
        void RegisterFCPMessageHandler(IFCPMessageHandler *obj);\r
index 6dd1730..f07da9c 100644 (file)
@@ -7,10 +7,10 @@
 \r
 #define VERSION_MAJOR          "0"\r
 #define VERSION_MINOR          "3"\r
-#define VERSION_RELEASE                "19"\r
+#define VERSION_RELEASE                "20"\r
 #define FMS_VERSION                    VERSION_MAJOR"."VERSION_MINOR"."VERSION_RELEASE\r
-#define FMS_FREESITE_USK       "USK@0npnMrqZNKRCRoGojZV93UNHCMN-6UU3rRSAmP6jNLE,~BG-edFtdCC1cSH4O3BWdeIYa8Sw5DfyrSV-TKdO5ec,AQACAAE/fms/79/"\r
-#define FMS_VERSION_EDITION    "20"\r
+#define FMS_FREESITE_USK       "USK@0npnMrqZNKRCRoGojZV93UNHCMN-6UU3rRSAmP6jNLE,~BG-edFtdCC1cSH4O3BWdeIYa8Sw5DfyrSV-TKdO5ec,AQACAAE/fms/80/"\r
+#define FMS_VERSION_EDITION    "21"\r
 \r
 typedef Poco::ScopedLock<Poco::FastMutex> Guard;\r
 \r
index c2a4a3c..12ba6de 100644 (file)
@@ -21,6 +21,11 @@ const bool BitmapValidator::Validate(const std::vector<unsigned char> &data)
        bool validated=false;\r
        std::string tempname=Poco::TemporaryFile::tempName();\r
 \r
+       if(data.size()==0)\r
+       {\r
+               return false;\r
+       }\r
+\r
        FILE *outfile=fopen(tempname.c_str(),"w+b");\r
        if(outfile)\r
        {\r
index 2d05fed..ed8e869 100644 (file)
@@ -107,21 +107,6 @@ const bool Board::Load(const long boardid)
 \r
 const bool Board::Load(const std::string &boardname)           // same as loading form boardid - but using name\r
 {\r
-       /*\r
-       SQLite3DB::Statement st=m_db->Prepare("SELECT BoardID FROM tblBoard WHERE BoardName=?;");\r
-       st.Bind(0,boardname);\r
-       st.Step();\r
-       if(st.RowReturned())\r
-       {\r
-               int tempint;\r
-               st.ResultInt(0,tempint);\r
-               return Load(tempint);\r
-       }\r
-       else\r
-       {\r
-               return false;\r
-       }\r
-       */\r
 \r
        // clear current values\r
        m_boardid=-1;\r
@@ -185,7 +170,6 @@ const bool Board::Load(const std::string &boardname)                // same as loading form bo
 \r
 void Board::SetDateFromString(const std::string &datestring)\r
 {\r
-       // break out date created  - date should be in format yyyy-mm-dd HH:MM:SS, so we split on "-", " " (space), and ":"\r
        int tzdiff=0;\r
        if(Poco::DateTimeParser::tryParse(datestring,m_datecreated,tzdiff)==false)\r
        {\r
index eb95e91..abcc473 100644 (file)
@@ -81,10 +81,13 @@ const bool BoardListRequester::HandleAllData(FCPMessage &message)
 \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
                SQLite3DB::Statement brd=m_db->Prepare("SELECT BoardID,BoardName,BoardDescription FROM tblBoard WHERE BoardName=?;");\r
index 027d530..7632998 100644 (file)
@@ -38,7 +38,10 @@ const bool FMSVersionRequester::HandleAllData(FCPMessage &message)
 \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
        // update latest edition #\r
        std::vector<std::string> parts;\r
@@ -50,7 +53,7 @@ const bool FMSVersionRequester::HandleAllData(FCPMessage &message)
        }\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
                SQLite3DB::Statement st=m_db->Prepare("REPLACE INTO tblFMSVersion(Major,Minor,Release,Notes,Changes,PageKey,SourceKey) VALUES(?,?,?,?,?,?,?);");\r
index c23ee27..01db50c 100644 (file)
@@ -123,6 +123,7 @@ const bool FreenetMasterThread::HandleMessage(FCPMessage &message)
        if(m_receivednodehello==true)\r
        {\r
                bool handled=false;\r
+\r
                std::vector<IFCPMessageHandler *>::iterator i=m_fcpmessagehandlers.begin();\r
                while(handled==false && i!=m_fcpmessagehandlers.end())\r
                {\r
index 843ed0a..951e12d 100644 (file)
@@ -61,10 +61,13 @@ const bool IdentityIntroductionRequester::HandleAllData(FCPMessage &message)
 \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
index 9e055e0..af52a59 100644 (file)
@@ -54,10 +54,13 @@ const bool IdentityRequester::HandleAllData(FCPMessage &message)
 \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
                st=m_db->Prepare("UPDATE tblIdentity SET Name=?, SingleUse=?, LastSeen=?, PublishTrustList=?, PublishBoardList=?, FreesiteEdition=? WHERE IdentityID=?");\r
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
index dabe818..88fd483 100644 (file)
@@ -66,10 +66,13 @@ const bool IntroductionPuzzleRequester::HandleAllData(FCPMessage &message)
 \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
                // check if last part of UUID matches first part of public key of identity who inserted it\r
index 1d42675..41f7d85 100644 (file)
@@ -110,10 +110,13 @@ const bool MessageListRequester::HandleAllData(FCPMessage &message)
 \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
                SQLite3DB::Statement st=m_db->Prepare("SELECT IdentityID FROM tblMessageRequests WHERE IdentityID=? AND Day=? AND RequestIndex=?;");\r
index 4ea393a..c5361ec 100644 (file)
@@ -117,7 +117,10 @@ const bool MessageRequester::HandleAllData(FCPMessage &message)
 \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
        // mark this index as received\r
        st=m_db->Prepare("UPDATE tblMessageRequests SET Found='true' WHERE IdentityID=? AND Day=? AND RequestIndex=?;");\r
@@ -128,7 +131,7 @@ const bool MessageRequester::HandleAllData(FCPMessage &message)
        st.Finalize();\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
                std::vector<std::string> boards=xml.GetBoards();\r
                std::map<long,std::string> replyto=xml.GetInReplyTo();\r
index 78ec556..77f4f4e 100644 (file)
@@ -54,7 +54,10 @@ const bool TrustListRequester::HandleAllData(FCPMessage &message)
 \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
        // get count of identities added in last 24 hours\r
        st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity WHERE DateAdded>=?;");\r
@@ -92,7 +95,7 @@ const bool TrustListRequester::HandleAllData(FCPMessage &message)
        now=Poco::DateTime();\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
                // find the identity name and public key of the identity publishing the trust list\r
                std::string publisherid="";\r
index 10152ba..0e4d411 100644 (file)
@@ -31,6 +31,7 @@ const std::string CreateIdentityPage::GeneratePage(const std::string &method, co
                m_db->Execute("INSERT INTO tblIdentityTrust(LocalIdentityID,IdentityID) SELECT LocalIdentityID,IdentityID FROM tblLocalIdentity,tblIdentity WHERE LocalIdentityID || '_' || IdentityID NOT IN (SELECT LocalIdentityID || '_' || IdentityID FROM tblIdentityTrust);");\r
 \r
                content+="<h2>Created Identity</h2>";\r
+               content+="You must have at least 1 local identity that has set explicit trust list trust for one or more peers who are publishing trust lists or you will not be able to learn about other identities.";\r
        }\r
        else\r
        {\r