added security check

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2251 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-02-09 13:13:50 +00:00
parent a84d1e37fc
commit a8cdbfbde1

View File

@ -238,6 +238,7 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, uint32_t f
int FileIndexStore::SearchHash(std::string hash, std::list<FileDetail> &results) const int FileIndexStore::SearchHash(std::string hash, std::list<FileDetail> &results) const
{ {
lockData(); lockData();
results.clear() ;
std::map<RsPeerId, FileIndex *>::const_iterator pit; std::map<RsPeerId, FileIndex *>::const_iterator pit;
std::list<FileEntry *>::iterator rit; std::list<FileEntry *>::iterator rit;
std::list<FileEntry *> firesults; std::list<FileEntry *> firesults;
@ -291,6 +292,7 @@ int FileIndexStore::SearchKeywords(std::list<std::string> keywords, std::list<Di
std::list<FileEntry *>::iterator rit; std::list<FileEntry *>::iterator rit;
std::list<FileEntry *> firesults; std::list<FileEntry *> firesults;
results.clear() ;
time_t now = time(NULL); time_t now = time(NULL);
#ifdef FIS_DEBUG #ifdef FIS_DEBUG
@ -306,7 +308,10 @@ int FileIndexStore::SearchKeywords(std::list<std::string> keywords, std::list<Di
for(rit = firesults.begin(); rit != firesults.end(); rit++) for(rit = firesults.begin(); rit != firesults.end(); rit++)
{ {
DirDetails dd; DirDetails dd;
FileIndex::extractData(*rit, dd);
if(!FileIndex::extractData(*rit, dd))
continue ;
results.push_back(dd); results.push_back(dd);
} }
} }
@ -321,7 +326,10 @@ int FileIndexStore::SearchKeywords(std::list<std::string> keywords, std::list<Di
for(rit = firesults.begin(); rit != firesults.end(); rit++) for(rit = firesults.begin(); rit != firesults.end(); rit++)
{ {
DirDetails dd; DirDetails dd;
FileIndex::extractData(*rit, dd);
if(!FileIndex::extractData(*rit, dd))
continue ;
dd.id = "Local"; dd.id = "Local";
results.push_back(dd); results.push_back(dd);
} }