Ignore:
Timestamp:
29/03/2009 14:51:24 (3 years ago)
Author:
chris
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/backupclient/BackupStoreFilename.cpp

    r217 r2481  
    3838// -------------------------------------------------------------------------- 
    3939BackupStoreFilename::BackupStoreFilename(const BackupStoreFilename &rToCopy) 
    40         : BackupStoreFilename_base(rToCopy) 
     40        : mEncryptedName(rToCopy.mEncryptedName) 
    4141{ 
    4242} 
     
    6666        bool ok = true; 
    6767         
    68         if(size() < 2) 
     68        if(mEncryptedName.size() < 2) 
    6969        { 
    7070                // Isn't long enough to have a header 
     
    7474        { 
    7575                // Check size is consistent 
    76                 unsigned int dsize = BACKUPSTOREFILENAME_GET_SIZE(*this); 
    77                 if(dsize != size()) 
     76                unsigned int dsize = BACKUPSTOREFILENAME_GET_SIZE(this->mEncryptedName); 
     77                if(dsize != mEncryptedName.size()) 
    7878                { 
    7979                        ok = false; 
     
    8181                 
    8282                // And encoding is an accepted value 
    83                 unsigned int encoding = BACKUPSTOREFILENAME_GET_ENCODING(*this); 
     83                unsigned int encoding = BACKUPSTOREFILENAME_GET_ENCODING(this->mEncryptedName); 
    8484                if(encoding < Encoding_Min || encoding > Encoding_Max) 
    8585                { 
     
    120120         
    121121        // assign to this string, storing the header and the extra data 
    122         assign(hdr, 2); 
    123         append(data.c_str(), data.size()); 
     122        mEncryptedName.assign(hdr, 2); 
     123        mEncryptedName.append(data.c_str(), data.size()); 
    124124         
    125125        // Check it 
     
    142142        CheckValid(); 
    143143         
    144         rProtocol.Write(c_str(), size()); 
     144        rProtocol.Write(mEncryptedName.c_str(), mEncryptedName.size()); 
    145145} 
    146146 
     
    178178 
    179179                // assign to this string, storing the header and the extra data 
    180                 assign(buf, dsize); 
     180                mEncryptedName.assign(buf, dsize); 
    181181        } 
    182182        else 
     
    195195 
    196196                // assign to this string, storing the header and the extra data 
    197                 assign(data, dsize); 
     197                mEncryptedName.assign(data, dsize); 
    198198        } 
    199199         
     
    217217        CheckValid(); 
    218218         
    219         rStream.Write(c_str(), size()); 
     219        rStream.Write(mEncryptedName.c_str(), mEncryptedName.size()); 
    220220} 
    221221 
     
    243243bool BackupStoreFilename::IsEncrypted() const 
    244244{ 
    245         return BACKUPSTOREFILENAME_GET_ENCODING(*this) != Encoding_Clear; 
     245        return BACKUPSTOREFILENAME_GET_ENCODING(this->mEncryptedName) != 
     246                Encoding_Clear; 
    246247} 
    247248 
     
    251252// Function 
    252253//              Name:    BackupStoreFilename::SetAsClearFilename(const char *) 
    253 //              Purpose: Sets this object to be a valid filename, but with a filename in the clear. 
    254 //                               Used on the server to create filenames when there's no way of encrypting it. 
     254//              Purpose: Sets this object to be a valid filename, but with a 
     255//                       filename in the clear. Used on the server to create 
     256//                       filenames when there's no way of encrypting it. 
    255257//              Created: 22/4/04 
    256258// 
     
    269271         
    270272        // Store the encoded string 
    271         assign(encoded); 
     273        mEncryptedName.assign(encoded); 
    272274         
    273275        // Stuff which must be done 
Note: See TracChangeset for help on using the changeset viewer.