Changeset 1784 for box/chris/general/bin/bbstored/BackupCommands.cpp
- Timestamp:
- 01/08/2007 00:18:50 (5 years ago)
- File:
-
- 1 edited
-
box/chris/general/bin/bbstored/BackupCommands.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/chris/general/bin/bbstored/BackupCommands.cpp
r1333 r1784 9 9 10 10 #include "Box.h" 11 12 #ifdef HAVE_SYSLOG_H13 #include <syslog.h>14 #endif15 11 16 12 #include <set> … … 89 85 // Check given client ID against the ID in the certificate certificate 90 86 // and that the client actually has an account on this machine 91 if(mClientID != rContext.GetClientID() || !rContext.GetClientHasAccount()) 92 { 93 ::syslog(LOG_INFO, "Failed login: Client ID presented was %08X", mClientID); 94 return std::auto_ptr<ProtocolObject>(new BackupProtocolServerError( 95 BackupProtocolServerError::ErrorType, BackupProtocolServerError::Err_BadLogin)); 87 if(mClientID != rContext.GetClientID()) 88 { 89 BOX_WARNING("Failed login from client ID " << 90 BOX_FORMAT_ACCOUNT(mClientID) << 91 ": wrong certificate for this account"); 92 return std::auto_ptr<ProtocolObject>( 93 new BackupProtocolServerError( 94 BackupProtocolServerError::ErrorType, 95 BackupProtocolServerError::Err_BadLogin)); 96 } 97 98 if(!rContext.GetClientHasAccount()) 99 { 100 BOX_WARNING("Failed login from client ID " << 101 BOX_FORMAT_ACCOUNT(mClientID) << 102 ": no such account on this server"); 103 return std::auto_ptr<ProtocolObject>( 104 new BackupProtocolServerError( 105 BackupProtocolServerError::ErrorType, 106 BackupProtocolServerError::Err_BadLogin)); 96 107 } 97 108 … … 102 113 if(!rContext.AttemptToGetWriteLock()) 103 114 { 104 ::syslog(LOG_INFO, "Failed to get write lock (for Client ID %08X)", mClientID); 105 return std::auto_ptr<ProtocolObject>(new BackupProtocolServerError( 106 BackupProtocolServerError::ErrorType, BackupProtocolServerError::Err_CannotLockStoreForWriting)); 115 BOX_WARNING("Failed to get write lock for Client ID " << 116 BOX_FORMAT_ACCOUNT(mClientID)); 117 return std::auto_ptr<ProtocolObject>( 118 new BackupProtocolServerError( 119 BackupProtocolServerError::ErrorType, 120 BackupProtocolServerError::Err_CannotLockStoreForWriting)); 107 121 } 108 122 … … 121 135 122 136 // Log login 123 ::syslog(LOG_INFO, "Login: Client ID %08X, %s", mClientID, ((mFlags & Flags_ReadOnly) != Flags_ReadOnly)?"Read/Write":"Read-only"); 137 BOX_NOTICE("Login from Client ID " << 138 BOX_FORMAT_ACCOUNT(mClientID) << 139 " " << 140 (((mFlags & Flags_ReadOnly) != Flags_ReadOnly) 141 ?"Read/Write":"Read-only")); 124 142 125 143 // Get the usage info for reporting to the client … … 141 159 std::auto_ptr<ProtocolObject> BackupProtocolServerFinished::DoCommand(BackupProtocolServer &rProtocol, BackupContext &rContext) 142 160 { 143 ::syslog(LOG_INFO, "Session finished"); 161 BOX_NOTICE("Session finished for Client ID " << 162 BOX_FORMAT_ACCOUNT(rContext.GetClientID())); 144 163 145 164 // Let the context know about it … … 312 331 if(en == 0) 313 332 { 314 ::syslog(LOG_ERR, "Object %llx in dir %llx for account %x references object %llx which does not exist in dir", 315 mObjectID, mInDirectory, rContext.GetClientID(), id); 316 return std::auto_ptr<ProtocolObject>(new BackupProtocolServerError( 317 BackupProtocolServerError::ErrorType, BackupProtocolServerError::Err_PatchConsistencyError)); 333 BOX_ERROR("Object " << 334 BOX_FORMAT_OBJECTID(mObjectID) << 335 " in dir " << 336 BOX_FORMAT_OBJECTID(mInDirectory) << 337 " for account " << 338 BOX_FORMAT_ACCOUNT(rContext.GetClientID()) << 339 " references object " << 340 BOX_FORMAT_OBJECTID(id) << 341 " which does not exist in dir"); 342 return std::auto_ptr<ProtocolObject>( 343 new BackupProtocolServerError( 344 BackupProtocolServerError::ErrorType, 345 BackupProtocolServerError::Err_PatchConsistencyError)); 318 346 } 319 347 id = en->GetDependsNewer(); 320 } while(en != 0 && id != 0); 348 } 349 while(en != 0 && id != 0); 321 350 322 351 // OK! The last entry in the chain is the full file, the others are patches back from it.
Note: See TracChangeset
for help on using the changeset viewer.
