Changeset 1784
- Timestamp:
- 01/08/2007 00:18:50 (18 months ago)
- Location:
- box/chris/general
- Files:
-
- 21 modified
-
bin/bbackupctl/bbackupctl.cpp (modified) (6 diffs)
-
bin/bbackupd/BackupClientContext.cpp (modified) (5 diffs)
-
bin/bbackupd/Win32ServiceFunctions.cpp (modified) (14 diffs)
-
bin/bbackupquery/BackupQueries.cpp (modified) (1 diff)
-
bin/bbstored/BBStoreDHousekeeping.cpp (modified) (6 diffs)
-
bin/bbstored/BackupCommands.cpp (modified) (6 diffs)
-
bin/bbstored/BackupStoreDaemon.cpp (modified) (4 diffs)
-
bin/bbstored/HousekeepStoreAccount.cpp (modified) (4 diffs)
-
lib/backupclient/BackupClientFileAttributes.cpp (modified) (3 diffs)
-
lib/backupclient/BackupClientRestore.cpp (modified) (13 diffs)
-
lib/backupclient/BackupStoreFile.cpp (modified) (2 diffs)
-
lib/common/BoxTime.cpp (modified) (2 diffs)
-
lib/common/DebugPrintf.cpp (modified) (1 diff)
-
lib/common/Logging.h (modified) (2 diffs)
-
lib/raidfile/RaidFileRead.cpp (modified) (8 diffs)
-
lib/server/Daemon.cpp (modified) (2 diffs)
-
lib/server/LocalProcessStream.cpp (modified) (2 diffs)
-
lib/server/SSLLib.cpp (modified) (2 diffs)
-
lib/server/ServerStream.h (modified) (5 diffs)
-
lib/server/Socket.cpp (modified) (3 diffs)
-
lib/server/WinNamedPipeStream.cpp (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/chris/general/bin/bbackupctl/bbackupctl.cpp
r1690 r1784 163 163 164 164 #if defined WIN32 && ! defined NDEBUG 165 syslog(LOG_ERR,"Failed to connect to the command socket");165 BOX_ERROR("Failed to connect to the command socket"); 166 166 #endif 167 167 … … 176 176 if(!getLine.GetLine(configSummary)) 177 177 { 178 #if defined WIN32 && ! defined NDEBUG 179 syslog(LOG_ERR, "Failed to receive configuration summary " 178 BOX_ERROR("Failed to receive configuration summary " 180 179 "from daemon"); 181 #else182 printf("Failed to receive configuration summary from daemon\n");183 #endif184 185 180 return 1; 186 181 } … … 189 184 if(getLine.IsEOF()) 190 185 { 191 #if defined WIN32 && ! defined NDEBUG 192 syslog(LOG_ERR, "Server rejected the connection. " 193 "Are you running bbackupctl as the same user " 194 "as the daemon?"); 195 #else 196 printf("Server rejected the connection. " 197 "Are you running bbackupctl as the same user " 198 "as the daemon?\n"); 199 #endif 200 186 BOX_ERROR("Server rejected the connection. Are you running " 187 "bbackupctl as the same user as the daemon?"); 201 188 return 1; 202 189 } … … 225 212 if(!getLine.GetLine(stateLine) || getLine.IsEOF()) 226 213 { 227 #if defined WIN32 && ! defined NDEBUG 228 syslog(LOG_ERR, "Failed to receive state line from daemon"); 229 #else 230 printf("Failed to receive state line from daemon\n"); 231 #endif 214 BOX_ERROR("Failed to receive state line from daemon"); 232 215 return 1; 233 216 } … … 237 220 if(::sscanf(stateLine.c_str(), "state %d", ¤tState) != 1) 238 221 { 239 printf("State line didn't decode\n");222 BOX_ERROR("Received invalid state line from daemon"); 240 223 return 1; 241 224 } … … 267 250 if(!autoBackup) 268 251 { 269 printf("ERROR: Daemon is not in automatic mode --"270 "sync will never start! \n");252 BOX_ERROR("Daemon is not in automatic mode, " 253 "sync will never start!"); 271 254 return 1; 272 255 } -
box/chris/general/bin/bbackupd/BackupClientContext.cpp
r1659 r1784 10 10 #include "Box.h" 11 11 12 #ifdef HAVE_SYSLOG_H13 #include <syslog.h>14 #endif15 12 #ifdef HAVE_SIGNAL_H 16 13 #include <signal.h> 17 14 #endif 15 18 16 #ifdef HAVE_SYS_TIME_H 19 17 #include <sys/time.h> … … 128 126 129 127 // Log intention 130 ::syslog(LOG_INFO, "Opening connection to server %s...", mHostname.c_str()); 128 BOX_INFO("Opening connection to server '" << 129 mHostname << "'..."); 131 130 132 131 // Connect! … … 148 147 if (!mpExtendedLogFileHandle) 149 148 { 150 ::syslog(LOG_ERR, "Failed to open extended"151 " log file: %s",strerror(errno));149 BOX_ERROR("Failed to open extended log " 150 "file: " << strerror(errno)); 152 151 } 153 152 else … … 195 194 196 195 // Log success 197 ::syslog(LOG_INFO,"Connection made, login successful");196 BOX_INFO("Connection made, login successful"); 198 197 199 198 // Check to see if there is any space available on the server … … 203 202 mStorageLimitExceeded = true; 204 203 // Log 205 ::syslog(LOG_WARNING, "Exceeded storage hard-limit on server -- not uploading changes to files"); 204 BOX_WARNING("Exceeded storage hard-limit on server, " 205 "not uploading changes to files"); 206 206 } 207 207 } -
box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp
r1033 r1784 45 45 memset(buf, 0, sizeof(buf)); 46 46 _snprintf(buf, sizeof(buf)-1, "%s (%d)", s, err); 47 ::syslog(LOG_ERR, "%s",buf);47 BOX_ERROR(buf); 48 48 MessageBox(0, buf, "Error", 49 49 MB_OK | MB_SETFOREGROUND | MB_DEFAULT_DESKTOP_ONLY); … … 192 192 if (emu_stat(pConfigFileName, &st) != 0) 193 193 { 194 syslog(LOG_ERR, "Failed to open configuration file: "195 "%s: %s", pConfigFileName,strerror(errno));194 BOX_ERROR("Failed to open configuration file '" << 195 pConfigFileName << "': " << strerror(errno)); 196 196 return 1; 197 197 } … … 200 200 { 201 201 202 syslog(LOG_ERR, "Failed to open configuration file: "203 "%s: not a file", pConfigFileName);202 BOX_ERROR("Failed to open configuration file '" << 203 pConfigFileName << "': not a file"); 204 204 return 1; 205 205 } … … 210 210 if (!scm) 211 211 { 212 syslog(LOG_ERR, "Failed to open service control manager: "213 "error %d", GetLastError());212 BOX_ERROR("Failed to open service control manager: " << 213 GetErrorMessage(GetLastError())); 214 214 return 1; 215 215 } … … 249 249 case ERROR_SERVICE_EXISTS: 250 250 { 251 ::syslog(LOG_ERR,"Failed to create Box Backup "251 BOX_ERROR("Failed to create Box Backup " 252 252 "service: it already exists"); 253 253 } … … 256 256 case ERROR_SERVICE_MARKED_FOR_DELETE: 257 257 { 258 ::syslog(LOG_ERR,"Failed to create Box Backup "258 BOX_ERROR("Failed to create Box Backup " 259 259 "service: it is waiting to be deleted"); 260 260 } … … 263 263 case ERROR_DUPLICATE_SERVICE_NAME: 264 264 { 265 ::syslog(LOG_ERR,"Failed to create Box Backup "265 BOX_ERROR("Failed to create Box Backup " 266 266 "service: a service with this name " 267 267 "already exists"); … … 271 271 default: 272 272 { 273 ::syslog(LOG_ERR, "Failed to create Box Backup " 274 "service: error %d", err); 273 BOX_ERROR("Failed to create Box Backup " 274 "service: error " << 275 GetErrorMessage(GetLastError())); 275 276 } 276 277 } … … 279 280 } 280 281 281 ::syslog(LOG_INFO,"Created Box Backup service");282 BOX_INFO("Created Box Backup service"); 282 283 283 284 SERVICE_DESCRIPTION desc; … … 287 288 &desc)) 288 289 { 289 ::syslog(LOG_WARNING, "Failed to set description for"290 " Box Backup service: error %d", GetLastError());290 BOX_WARNING("Failed to set description for Box Backup " 291 "service: " << GetErrorMessage(GetLastError())); 291 292 } 292 293 … … 302 303 if (!scm) 303 304 { 304 syslog(LOG_ERR, "Failed to open service control manager: "305 "error %d", GetLastError());305 BOX_ERROR("Failed to open service control manager: " << 306 GetErrorMessage(GetLastError())); 306 307 return 1; 307 308 } … … 318 319 // hello microsoft? anyone home? 319 320 { 320 syslog(LOG_ERR,"Failed to open Box Backup service: "321 BOX_ERROR("Failed to open Box Backup service: " 321 322 "not installed or not found"); 322 323 } 323 324 else 324 325 { 325 syslog(LOG_ERR, "Failed to open Box Backup service: "326 "error %d", err);326 BOX_ERROR("Failed to open Box Backup service: " << 327 GetErrorMessage(err)); 327 328 } 328 329 return 1; … … 335 336 if (err != ERROR_SERVICE_NOT_ACTIVE) 336 337 { 337 syslog(LOG_WARNING, "Failed to stop Box Backup "338 "service: error %d", err);338 BOX_WARNING("Failed to stop Box Backup service: " << 339 GetErrorMessage(err)); 339 340 } 340 341 } … … 346 347 if (deleted) 347 348 { 348 syslog(LOG_INFO,"Box Backup service deleted");349 BOX_INFO("Box Backup service deleted"); 349 350 return 0; 350 351 } 351 352 else if (err == ERROR_SERVICE_MARKED_FOR_DELETE) 352 353 { 353 syslog(LOG_ERR,"Failed to remove Box Backup service: "354 BOX_ERROR("Failed to remove Box Backup service: " 354 355 "it is already being deleted"); 355 356 } 356 357 else 357 358 { 358 syslog(LOG_ERR, "Failed to remove Box Backup service: "359 "error %d", err);359 BOX_ERROR("Failed to remove Box Backup service: " << 360 GetErrorMessage(err)); 360 361 } 361 362 -
box/chris/general/bin/bbackupquery/BackupQueries.cpp
r1639 r1784 2010 2010 opts['r'] /* resume? */); 2011 2011 } 2012 catch (BoxException &e)2013 {2014 ::syslog(LOG_ERR, "Failed to restore: %s", e.what());2015 return;2016 }2017 2012 catch(std::exception &e) 2018 2013 { 2019 ::syslog(LOG_ERR, "Failed to restore: %s",e.what());2014 BOX_ERROR("Failed to restore: " << e.what()); 2020 2015 return; 2021 2016 } 2022 2017 catch(...) 2023 2018 { 2024 ::syslog(LOG_ERR, "Failed to restore: unknown error");2019 BOX_ERROR("Failed to restore: unknown exception"); 2025 2020 return; 2026 2021 } -
box/chris/general/bin/bbstored/BBStoreDHousekeeping.cpp
r1382 r1784 11 11 12 12 #include <stdio.h> 13 14 #ifdef HAVE_SYSLOG_H15 #include <syslog.h>16 #endif17 13 18 14 #include "BackupStoreDaemon.h" … … 83 79 // Store the time 84 80 mLastHousekeepingRun = timeNow; 85 ::syslog(LOG_INFO,"Starting housekeeping");81 BOX_INFO("Starting housekeeping"); 86 82 87 83 // Get the list of accounts … … 113 109 catch(BoxException &e) 114 110 { 115 ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s (%d/%d) -- aborting housekeeping run for this account", 116 *i, e.what(), e.GetType(), e.GetSubType()); 111 BOX_ERROR("Housekeeping on account " << 112 BOX_FORMAT_ACCOUNT(*i) << " threw exception, " 113 "aborting run for this account: " << 114 e.what() << " (" << 115 e.GetType() << "/" << e.GetSubType() << ")"); 117 116 } 118 117 catch(std::exception &e) 119 118 { 120 ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s -- aborting housekeeping run for this account", 121 *i, e.what()); 119 BOX_ERROR("Housekeeping on account " << 120 BOX_FORMAT_ACCOUNT(*i) << " threw exception, " 121 "aborting run for this account: " << 122 e.what()); 122 123 } 123 124 catch(...) 124 125 { 125 ::syslog(LOG_ERR, "while housekeeping account %08X, unknown exception -- aborting housekeeping run for this account", 126 *i); 126 BOX_ERROR("Housekeeping on account " << 127 BOX_FORMAT_ACCOUNT(*i) << " threw exception, " 128 "aborting run for this account: " 129 "unknown exception"); 127 130 } 128 131 … … 145 148 } 146 149 147 ::syslog(LOG_INFO,"Finished housekeeping");150 BOX_INFO("Finished housekeeping"); 148 151 149 152 // Placed here for accuracy, if StopRun() is true, for example. … … 191 194 if(mInterProcessComms.GetLine(line, false /* no pre-processing */, MaximumWaitTime)) 192 195 { 193 TRACE1(" housekeeping received command '%s' over interprocess comms\n", line.c_str());196 TRACE1("Housekeeping received command '%s' over interprocess comms\n", line.c_str()); 194 197 195 198 int account = 0; … … 213 216 { 214 217 // Yes! -- need to stop now so when it retries to get the lock, it will succeed 215 ::syslog(LOG_INFO, "Housekeeping giving way to connection for account 0x%08x", AccountNum); 218 BOX_INFO("Housekeeping on account " << 219 BOX_FORMAT_ACCOUNT(AccountNum) << 220 "giving way to client connection"); 216 221 return true; 217 222 } -
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. -
box/chris/general/bin/bbstored/BackupStoreDaemon.cpp
r1691 r1784 209 209 ::openlog("bbstored/hk", LOG_PID, LOG_LOCAL6); 210 210 // Log that housekeeping started 211 ::syslog(LOG_INFO,"Housekeeping process started");211 BOX_INFO("Housekeeping process started"); 212 212 // Ignore term and hup 213 213 // Parent will handle these and alert the child via the socket, don't want to randomly die … … 282 282 catch(BoxException &e) 283 283 { 284 ::syslog(LOG_ERR, "%s: disconnecting due to "285 "exception %s (%d/%d)", DaemonName(),286 e. what(), e.GetType(), e.GetSubType());284 &n
