From ef3d1642c083a9c69eb48c6ab8ecc9be43dfbcfc Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 29 Mar 2009 13:51:24 +0000 Subject: Change type of BackupStoreFilename not to derive from std::string, so it can't accidentally be used as one. Fix use of encrypted filename in deleted file message, thanks to Kenny Millington for reporting. --- bin/bbackupd/BackupClientDirectoryRecord.cpp | 3 ++- bin/bbstored/HousekeepStoreAccount.cpp | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/bbackupd/BackupClientDirectoryRecord.cpp b/bin/bbackupd/BackupClientDirectoryRecord.cpp index 4ecb81d9..b8d42d47 100644 --- a/bin/bbackupd/BackupClientDirectoryRecord.cpp +++ b/bin/bbackupd/BackupClientDirectoryRecord.cpp @@ -1386,8 +1386,9 @@ bool BackupClientDirectoryRecord::UpdateItems( // aren't actually deleted, as the whole state will be reset anyway. BackupClientDeleteList &rdel(rContext.GetDeleteList()); + BackupStoreFilenameClear clear(en->GetName()); std::string localName = MakeFullPath(rLocalPath, - en->GetName()); + clear.GetClearFilename()); // Delete this entry -- file or directory? if((en->GetFlags() & BackupStoreDirectory::Entry::Flags_File) != 0) diff --git a/bin/bbstored/HousekeepStoreAccount.cpp b/bin/bbstored/HousekeepStoreAccount.cpp index 84765209..dbb9b544 100644 --- a/bin/bbstored/HousekeepStoreAccount.cpp +++ b/bin/bbstored/HousekeepStoreAccount.cpp @@ -349,7 +349,8 @@ bool HousekeepStoreAccount::ScanDirectory(int64_t ObjectID) // Add files to the list of potential deletions // map to count the distance from the mark - std::map, int32_t> markVersionAges; + typedef std::pair version_t; + std::map markVersionAges; // map of pair (filename, mark number) -> version age // NOTE: use a reverse iterator to allow the distance from mark stuff to work @@ -367,7 +368,10 @@ bool HousekeepStoreAccount::ScanDirectory(int64_t ObjectID) // Work out ages of this version from the last mark int32_t enVersionAge = 0; - std::map, int32_t>::iterator enVersionAgeI(markVersionAges.find(std::pair(en->GetName(), en->GetMarkNumber()))); + std::map::iterator enVersionAgeI( + markVersionAges.find( + version_t(en->GetName().GetEncodedFilename(), + en->GetMarkNumber()))); if(enVersionAgeI != markVersionAges.end()) { enVersionAge = enVersionAgeI->second + 1; @@ -375,7 +379,7 @@ bool HousekeepStoreAccount::ScanDirectory(int64_t ObjectID) } else { - markVersionAges[std::pair(en->GetName(), en->GetMarkNumber())] = enVersionAge; + markVersionAges[version_t(en->GetName().GetEncodedFilename(), en->GetMarkNumber())] = enVersionAge; } // enVersionAge is now the age of this version. -- cgit v1.2.3