Changeset 2946


Ignore:
Timestamp:
26/04/2011 19:48:00 (13 months ago)
Author:
chris
Message:

Add a method to BackupStoreFilenameClear? to get the clear filename only if
it's available or crypto has been configured to decrypt it. This allows
client and server to share the same definition of protocol objects that
use Filenames, instead of using BackupStoreFilename? on the server and
BackupStoreFilenameClear? on the client.

Location:
box/trunk/lib/backupstore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/backupstore/BackupStoreFilenameClear.cpp

    r2945 r2946  
    6060// -------------------------------------------------------------------------- 
    6161BackupStoreFilenameClear::BackupStoreFilenameClear(const BackupStoreFilenameClear &rToCopy) 
    62         : BackupStoreFilename(rToCopy), 
    63           mClearFilename(rToCopy.mClearFilename) 
     62: BackupStoreFilename(rToCopy), 
     63  mClearFilename(rToCopy.mClearFilename) 
    6464{ 
    6565} 
     
    7474// -------------------------------------------------------------------------- 
    7575BackupStoreFilenameClear::BackupStoreFilenameClear(const BackupStoreFilename &rToCopy) 
    76         : BackupStoreFilename(rToCopy) 
     76: BackupStoreFilename(rToCopy) 
    7777{ 
    7878        // Will get a clear filename when it's required 
     
    112112        MakeClearAvailable(); 
    113113        return mClearFilename; 
     114} 
     115const std::string &BackupStoreFilenameClear::GetClearFilenameIfPossible(const std::string& alternative) const 
     116{ 
     117        if(mClearFilename.empty() && !(sBlowfishDecrypt.IsInitialised())) 
     118        { 
     119                // encrypted and cannot decrypt 
     120                return alternative; 
     121        } 
     122        else 
     123        { 
     124                return GetClearFilename(); 
     125        } 
    114126} 
    115127#endif 
     
    168180        { 
    169181        case Encoding_Clear: 
    170                 BOX_TRACE("**** BackupStoreFilename encoded with " 
     182                BOX_WARNING("**** BackupStoreFilename encoded with " 
    171183                        "Clear encoding ****"); 
    172184                mClearFilename.assign(GetEncodedFilename().c_str() + 2, 
  • box/trunk/lib/backupstore/BackupStoreFilenameClear.h

    r2945 r2946  
    3939#else 
    4040        const std::string &GetClearFilename() const; 
     41        const std::string &GetClearFilenameIfPossible(const std::string& alternative) const; 
    4142#endif 
    4243        void SetClearFilename(const std::string &rToEncode); 
Note: See TracChangeset for help on using the changeset viewer.