X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ffreenet%2Fintroductionpuzzlerequester.cpp;h=1b5c166ae5404fec77ea8ed509dee864745f5e05;hb=9ae3b1434e51788e6feb72e1415ec800d05c535a;hp=9f1ee76c416604278d1702f4cd58a3737e8ffa8d;hpb=59a5414ec47a2932a7802fcd1d98c4d80166564f;p=fms.git diff --git a/src/freenet/introductionpuzzlerequester.cpp b/src/freenet/introductionpuzzlerequester.cpp index 9f1ee76..1b5c166 100644 --- a/src/freenet/introductionpuzzlerequester.cpp +++ b/src/freenet/introductionpuzzlerequester.cpp @@ -14,6 +14,8 @@ #include #endif +std::string IntroductionPuzzleRequester::m_validuuidchars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890~@_-"; + IntroductionPuzzleRequester::IntroductionPuzzleRequester(SQLite3DB::DB *db):IIndexRequester(db) { Initialize(); @@ -73,7 +75,7 @@ const bool IntroductionPuzzleRequester::HandleAllData(FCPv2::Message &message) StringFunctions::SplitMultiple(publickey,"@,",keyparts); StringFunctions::SplitMultiple(xml.GetUUID(),"@",uuidparts); - if(uuidparts.size()>1 && keyparts.size()>1) + if(uuidparts.size()>1 && keyparts.size()>1 && xml.GetUUID().find_first_not_of(m_validuuidchars)==std::string::npos) { keypart=StringFunctions::Replace(StringFunctions::Replace(keyparts[1],"-",""),"~",""); if(keypart!=uuidparts[1]) @@ -215,7 +217,7 @@ void IntroductionPuzzleRequester::PopulateIDList() st.Finalize(); // select identities that aren't single use, are publishing a trust list, and have been seen today ( order by trust DESC and limit to limitnum ) - st=m_db->Prepare("SELECT IdentityID FROM tblIdentity WHERE PublishTrustList='true' AND PublicKey IS NOT NULL AND PublicKey <> '' AND SingleUse='false' AND (LocalTrustListTrust IS NULL OR LocalTrustListTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalTrustListTrust')) AND LastSeen>='"+Poco::DateTimeFormatter::format(now,"%Y-%m-%d")+"' ORDER BY LocalMessageTrust DESC LIMIT 0,"+limitnum+";"); + st=m_db->Prepare("SELECT IdentityID FROM tblIdentity WHERE PublishTrustList='true' AND PublicKey IS NOT NULL AND PublicKey <> '' AND SingleUse='false' AND (LocalTrustListTrust IS NULL OR LocalTrustListTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalTrustListTrust')) AND LastSeen>='"+Poco::DateTimeFormatter::format(now,"%Y-%m-%d")+"' AND FailureCount<=(SELECT OptionValue FROM tblOption WHERE Option='MaxFailureCount') ORDER BY LocalMessageTrust DESC LIMIT 0,"+limitnum+";"); st.Step(); m_ids.clear();