From c0ebc7b53a977885ebc2d3a679c586ae20c0bc4a Mon Sep 17 00:00:00 2001 From: SomeDude Date: Wed, 24 Sep 2008 11:19:00 +0200 Subject: [PATCH] version 0.3.20 --- include/freenet/freenetmasterthread.h | 2 +- include/global.h | 6 +++--- src/bitmapvalidator.cpp | 5 +++++ src/board.cpp | 16 ---------------- src/freenet/boardlistrequester.cpp | 7 +++++-- src/freenet/fmsversionrequester.cpp | 7 +++++-- src/freenet/freenetmasterthread.cpp | 1 + src/freenet/identityintroductionrequester.cpp | 7 +++++-- src/freenet/identityrequester.cpp | 7 +++++-- src/freenet/introductionpuzzleinserter.cpp | 20 ++++++++++++-------- src/freenet/introductionpuzzlerequester.cpp | 7 +++++-- src/freenet/messagelistrequester.cpp | 7 +++++-- src/freenet/messagerequester.cpp | 7 +++++-- src/freenet/trustlistrequester.cpp | 7 +++++-- src/http/pages/createidentitypage.cpp | 1 + 15 files changed, 63 insertions(+), 44 deletions(-) diff --git a/include/freenet/freenetmasterthread.h b/include/freenet/freenetmasterthread.h index 76d6102..f604fde 100644 --- a/include/freenet/freenetmasterthread.h +++ b/include/freenet/freenetmasterthread.h @@ -22,7 +22,7 @@ public: void run(); - // registration methods for children objects + // registration methods for child objects void RegisterPeriodicProcessor(IPeriodicProcessor *obj); void RegisterFCPConnected(IFCPConnected *obj); void RegisterFCPMessageHandler(IFCPMessageHandler *obj); diff --git a/include/global.h b/include/global.h index 6dd1730..f07da9c 100644 --- a/include/global.h +++ b/include/global.h @@ -7,10 +7,10 @@ #define VERSION_MAJOR "0" #define VERSION_MINOR "3" -#define VERSION_RELEASE "19" +#define VERSION_RELEASE "20" #define FMS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_RELEASE -#define FMS_FREESITE_USK "USK@0npnMrqZNKRCRoGojZV93UNHCMN-6UU3rRSAmP6jNLE,~BG-edFtdCC1cSH4O3BWdeIYa8Sw5DfyrSV-TKdO5ec,AQACAAE/fms/79/" -#define FMS_VERSION_EDITION "20" +#define FMS_FREESITE_USK "USK@0npnMrqZNKRCRoGojZV93UNHCMN-6UU3rRSAmP6jNLE,~BG-edFtdCC1cSH4O3BWdeIYa8Sw5DfyrSV-TKdO5ec,AQACAAE/fms/80/" +#define FMS_VERSION_EDITION "21" typedef Poco::ScopedLock Guard; diff --git a/src/bitmapvalidator.cpp b/src/bitmapvalidator.cpp index c2a4a3c..12ba6de 100644 --- a/src/bitmapvalidator.cpp +++ b/src/bitmapvalidator.cpp @@ -21,6 +21,11 @@ const bool BitmapValidator::Validate(const std::vector &data) bool validated=false; std::string tempname=Poco::TemporaryFile::tempName(); + if(data.size()==0) + { + return false; + } + FILE *outfile=fopen(tempname.c_str(),"w+b"); if(outfile) { diff --git a/src/board.cpp b/src/board.cpp index 2d05fed..ed8e869 100644 --- a/src/board.cpp +++ b/src/board.cpp @@ -107,21 +107,6 @@ const bool Board::Load(const long boardid) const bool Board::Load(const std::string &boardname) // same as loading form boardid - but using name { - /* - SQLite3DB::Statement st=m_db->Prepare("SELECT BoardID FROM tblBoard WHERE BoardName=?;"); - st.Bind(0,boardname); - st.Step(); - if(st.RowReturned()) - { - int tempint; - st.ResultInt(0,tempint); - return Load(tempint); - } - else - { - return false; - } - */ // clear current values m_boardid=-1; @@ -185,7 +170,6 @@ const bool Board::Load(const std::string &boardname) // same as loading form bo void Board::SetDateFromString(const std::string &datestring) { - // break out date created - date should be in format yyyy-mm-dd HH:MM:SS, so we split on "-", " " (space), and ":" int tzdiff=0; if(Poco::DateTimeParser::tryParse(datestring,m_datecreated,tzdiff)==false) { diff --git a/src/freenet/boardlistrequester.cpp b/src/freenet/boardlistrequester.cpp index eb95e91..abcc473 100644 --- a/src/freenet/boardlistrequester.cpp +++ b/src/freenet/boardlistrequester.cpp @@ -81,10 +81,13 @@ const bool BoardListRequester::HandleAllData(FCPMessage &message) // receive the file data.resize(datalength); - m_fcp->ReceiveRaw(&data[0],datalength); + if(data.size()>0) + { + m_fcp->ReceiveRaw(&data[0],datalength); + } // parse file into xml and update the database - if(xml.ParseXML(std::string(data.begin(),data.end()))==true) + if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true) { SQLite3DB::Statement brd=m_db->Prepare("SELECT BoardID,BoardName,BoardDescription FROM tblBoard WHERE BoardName=?;"); diff --git a/src/freenet/fmsversionrequester.cpp b/src/freenet/fmsversionrequester.cpp index 027d530..7632998 100644 --- a/src/freenet/fmsversionrequester.cpp +++ b/src/freenet/fmsversionrequester.cpp @@ -38,7 +38,10 @@ const bool FMSVersionRequester::HandleAllData(FCPMessage &message) // receive the file data.resize(datalength); - m_fcp->ReceiveRaw(&data[0],datalength); + if(data.size()>0) + { + m_fcp->ReceiveRaw(&data[0],datalength); + } // update latest edition # std::vector parts; @@ -50,7 +53,7 @@ const bool FMSVersionRequester::HandleAllData(FCPMessage &message) } // parse file into xml and update the database - if(xml.ParseXML(std::string(data.begin(),data.end()))==true) + if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true) { SQLite3DB::Statement st=m_db->Prepare("REPLACE INTO tblFMSVersion(Major,Minor,Release,Notes,Changes,PageKey,SourceKey) VALUES(?,?,?,?,?,?,?);"); diff --git a/src/freenet/freenetmasterthread.cpp b/src/freenet/freenetmasterthread.cpp index c23ee27..01db50c 100644 --- a/src/freenet/freenetmasterthread.cpp +++ b/src/freenet/freenetmasterthread.cpp @@ -123,6 +123,7 @@ const bool FreenetMasterThread::HandleMessage(FCPMessage &message) if(m_receivednodehello==true) { bool handled=false; + std::vector::iterator i=m_fcpmessagehandlers.begin(); while(handled==false && i!=m_fcpmessagehandlers.end()) { diff --git a/src/freenet/identityintroductionrequester.cpp b/src/freenet/identityintroductionrequester.cpp index 843ed0a..951e12d 100644 --- a/src/freenet/identityintroductionrequester.cpp +++ b/src/freenet/identityintroductionrequester.cpp @@ -61,10 +61,13 @@ const bool IdentityIntroductionRequester::HandleAllData(FCPMessage &message) // receive the file data.resize(datalength); - m_fcp->ReceiveRaw(&data[0],datalength); + if(data.size()>0) + { + m_fcp->ReceiveRaw(&data[0],datalength); + } // parse file into xml and update the database - if(xml.ParseXML(std::string(data.begin(),data.end()))==true) + if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true) { ssk.SetPublicKey(xml.GetIdentity()); diff --git a/src/freenet/identityrequester.cpp b/src/freenet/identityrequester.cpp index 9e055e0..af52a59 100644 --- a/src/freenet/identityrequester.cpp +++ b/src/freenet/identityrequester.cpp @@ -54,10 +54,13 @@ const bool IdentityRequester::HandleAllData(FCPMessage &message) // receive the file data.resize(datalength); - m_fcp->ReceiveRaw(&data[0],datalength); + if(data.size()>0) + { + m_fcp->ReceiveRaw(&data[0],datalength); + } // parse file into xml and update the database - if(xml.ParseXML(std::string(data.begin(),data.end()))==true) + if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true) { st=m_db->Prepare("UPDATE tblIdentity SET Name=?, SingleUse=?, LastSeen=?, PublishTrustList=?, PublishBoardList=?, FreesiteEdition=? WHERE IdentityID=?"); diff --git a/src/freenet/introductionpuzzleinserter.cpp b/src/freenet/introductionpuzzleinserter.cpp index cac3879..defa0cb 100644 --- a/src/freenet/introductionpuzzleinserter.cpp +++ b/src/freenet/introductionpuzzleinserter.cpp @@ -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 if(m_lastinserted.find(rs.GetInt(0))==m_lastinserted.end() || m_lastinserted[rs.GetInt(0)]<=lastinsert || m_lastinserted[rs.GetInt(0)].day()!=now.day()) { - StartInsert(rs.GetInt(0)); m_lastinserted[rs.GetInt(0)]=now; } else @@ -178,18 +177,18 @@ void IntroductionPuzzleInserter::Initialize() const bool IntroductionPuzzleInserter::StartInsert(const long &localidentityid) { Poco::DateTime now; - std::string idstring; + std::string idstring=""; long index=0; - std::string indexstr; + std::string indexstr=""; Poco::UUIDGenerator uuidgen; Poco::UUID uuid; - std::string messagebase; + std::string messagebase=""; IntroductionPuzzleXML xml; - std::string encodedpuzzle; - std::string solutionstring; + std::string encodedpuzzle=""; + std::string solutionstring=""; FCPMessage message; - std::string xmldata; - std::string xmldatasizestr; + std::string xmldata=""; + std::string xmldatasizestr=""; std::string privatekey=""; std::string publickey=""; std::string keypart=""; @@ -227,6 +226,11 @@ const bool IntroductionPuzzleInserter::StartInsert(const long &localidentityid) Option::Instance()->Get("MessageBase",messagebase); GenerateCaptcha(encodedpuzzle,solutionstring); + if(encodedpuzzle.size()==0) + { + m_log->fatal("IntroductionPuzzleInserter::StartInsert could not create introduction puzzle"); + return false; + } try { diff --git a/src/freenet/introductionpuzzlerequester.cpp b/src/freenet/introductionpuzzlerequester.cpp index dabe818..88fd483 100644 --- a/src/freenet/introductionpuzzlerequester.cpp +++ b/src/freenet/introductionpuzzlerequester.cpp @@ -66,10 +66,13 @@ const bool IntroductionPuzzleRequester::HandleAllData(FCPMessage &message) // receive the file data.resize(datalength); - m_fcp->ReceiveRaw(&data[0],datalength); + if(data.size()>0) + { + m_fcp->ReceiveRaw(&data[0],datalength); + } // parse file into xml and update the database - if(xml.ParseXML(std::string(data.begin(),data.end()))==true) + if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true) { // check if last part of UUID matches first part of public key of identity who inserted it diff --git a/src/freenet/messagelistrequester.cpp b/src/freenet/messagelistrequester.cpp index 1d42675..41f7d85 100644 --- a/src/freenet/messagelistrequester.cpp +++ b/src/freenet/messagelistrequester.cpp @@ -110,10 +110,13 @@ const bool MessageListRequester::HandleAllData(FCPMessage &message) // receive the file data.resize(datalength); - m_fcp->ReceiveRaw(&data[0],datalength); + if(data.size()>0) + { + m_fcp->ReceiveRaw(&data[0],datalength); + } // parse file into xml and update the database - if(xml.ParseXML(std::string(data.begin(),data.end()))==true) + if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true) { SQLite3DB::Statement st=m_db->Prepare("SELECT IdentityID FROM tblMessageRequests WHERE IdentityID=? AND Day=? AND RequestIndex=?;"); diff --git a/src/freenet/messagerequester.cpp b/src/freenet/messagerequester.cpp index 4ea393a..c5361ec 100644 --- a/src/freenet/messagerequester.cpp +++ b/src/freenet/messagerequester.cpp @@ -117,7 +117,10 @@ const bool MessageRequester::HandleAllData(FCPMessage &message) // receive the file data.resize(datalength); - m_fcp->ReceiveRaw(&data[0],datalength); + if(data.size()>0) + { + m_fcp->ReceiveRaw(&data[0],datalength); + } // mark this index as received st=m_db->Prepare("UPDATE tblMessageRequests SET Found='true' WHERE IdentityID=? AND Day=? AND RequestIndex=?;"); @@ -128,7 +131,7 @@ const bool MessageRequester::HandleAllData(FCPMessage &message) st.Finalize(); // parse file into xml and update the database - if(xml.ParseXML(std::string(data.begin(),data.end()))==true) + if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true) { std::vector boards=xml.GetBoards(); std::map replyto=xml.GetInReplyTo(); diff --git a/src/freenet/trustlistrequester.cpp b/src/freenet/trustlistrequester.cpp index 78ec556..77f4f4e 100644 --- a/src/freenet/trustlistrequester.cpp +++ b/src/freenet/trustlistrequester.cpp @@ -54,7 +54,10 @@ const bool TrustListRequester::HandleAllData(FCPMessage &message) // receive the file data.resize(datalength); - m_fcp->ReceiveRaw(&data[0],datalength); + if(data.size()>0) + { + m_fcp->ReceiveRaw(&data[0],datalength); + } // get count of identities added in last 24 hours st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity WHERE DateAdded>=?;"); @@ -92,7 +95,7 @@ const bool TrustListRequester::HandleAllData(FCPMessage &message) now=Poco::DateTime(); // parse file into xml and update the database - if(xml.ParseXML(std::string(data.begin(),data.end()))==true) + if(data.size()>0 && xml.ParseXML(std::string(data.begin(),data.end()))==true) { // find the identity name and public key of the identity publishing the trust list std::string publisherid=""; diff --git a/src/http/pages/createidentitypage.cpp b/src/http/pages/createidentitypage.cpp index 10152ba..0e4d411 100644 --- a/src/http/pages/createidentitypage.cpp +++ b/src/http/pages/createidentitypage.cpp @@ -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);"); content+="

Created Identity

"; + 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."; } else { -- 2.7.4