diff --git a/libretroshare/src/file_sharing/hash_cache.cc b/libretroshare/src/file_sharing/hash_cache.cc index 9e27b9dd5..03ee9f991 100644 --- a/libretroshare/src/file_sharing/hash_cache.cc +++ b/libretroshare/src/file_sharing/hash_cache.cc @@ -191,9 +191,9 @@ void HashStorage::data_tick() #endif RS_STACK_MUTEX(mHashMtx) ; - HashStorageInfo& info(mFiles[job.full_path]); + HashStorageInfo& info(mFiles[job.real_path]); - info.filename = job.full_path ; + info.filename = job.real_path ; info.size = size ; info.modf_stamp = job.ts ; info.time_stamp = time(NULL); @@ -219,7 +219,7 @@ bool HashStorage::requestHash(const std::string& full_path,uint64_t size,time_t // check if the hash is up to date w.r.t. cache. #ifdef HASHSTORAGE_DEBUG - std::cerr << "HASH Requested for file " << full_path << ": "; + std::cerr << "HASH Requested for file " << full_path << ": mod_time: " << mod_time << ", size: " << size << " :" ; #endif RS_STACK_MUTEX(mHashMtx) ; @@ -272,6 +272,7 @@ bool HashStorage::requestHash(const std::string& full_path,uint64_t size,time_t job.size = size ; job.client_param = client_param ; job.full_path = full_path ; + job.real_path = real_path ; job.ts = mod_time ; // We store the files indexed by their real path, so that we allow to not re-hash files that are pointed multiple times through the directory links @@ -443,7 +444,7 @@ bool HashStorage::writeHashStorageInfo(unsigned char *& data,uint32_t& total_si std::ostream& operator<<(std::ostream& o,const HashStorage::HashStorageInfo& info) { - return o << info.hash << " " << info.size << " " << info.filename ; + return o << info.hash << " " << info.modf_stamp << " " << info.size << " " << info.filename ; } /********************************************************************************************************************************/ diff --git a/libretroshare/src/file_sharing/hash_cache.h b/libretroshare/src/file_sharing/hash_cache.h index 7ca12c10b..7a235dc9a 100644 --- a/libretroshare/src/file_sharing/hash_cache.h +++ b/libretroshare/src/file_sharing/hash_cache.h @@ -118,7 +118,8 @@ private: struct FileHashJob { - std::string full_path; + std::string full_path; // canonicalized file name (means: symlinks removed, loops removed, etc) + std::string real_path; // path supplied by the client. uint64_t size ; HashStorageClient *client; uint32_t client_param ; diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index 5c2018ce1..1a93f4350 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -494,7 +494,8 @@ bool p3FileDatabase::loadList(std::list& load) for(uint32_t i=0;ivalue.size();++i) if(kit->value[i] == ';') { - ignored_suffixes.push_back(b) ; + if(!b.empty()) // security! + ignored_suffixes.push_back(b) ; b.clear(); } else