- Timestamp:
- 28/03/2008 22:59:28 (4 years ago)
- Location:
- box/trunk
- Files:
-
- 1 added
- 32 edited
-
. (modified) (1 prop)
-
.hgignore (added)
-
bin/bbackupd (modified) (1 prop)
-
bin/bbackupd/BackupClientContext.cpp (modified) (3 diffs)
-
bin/bbackupd/BackupClientContext.h (modified) (2 diffs)
-
bin/bbackupd/BackupDaemon.cpp (modified) (1 diff)
-
bin/bbackupquery (modified) (1 prop)
-
bin/bbackupquery/bbackupquery.cpp (modified) (1 diff)
-
bin/bbstored (modified) (1 prop)
-
infrastructure (modified) (1 prop)
-
lib/backupclient (modified) (1 prop)
-
lib/backupclient/BackupDaemonConfigVerify.cpp (modified) (2 diffs)
-
lib/backupstore/BackupStoreConfigVerify.cpp (modified) (2 diffs)
-
lib/common (modified) (1 prop)
-
lib/common/Configuration.cpp (modified) (22 diffs)
-
lib/common/Configuration.h (modified) (3 diffs)
-
lib/compress (modified) (1 prop)
-
lib/crypto (modified) (1 prop)
-
lib/intercept (modified) (1 prop)
-
lib/raidfile (modified) (1 prop)
-
lib/raidfile/RaidFileController.cpp (modified) (1 diff)
-
lib/server (modified) (1 prop)
-
lib/server/Daemon.h (modified) (1 diff)
-
lib/server/ServerStream.h (modified) (1 diff)
-
lib/server/ServerTLS.h (modified) (1 diff)
-
test/basicserver (modified) (1 prop)
-
test/basicserver/testbasicserver.cpp (modified) (2 diffs)
-
test/bbackupd/testbbackupd.cpp (modified) (4 diffs)
-
test/bbackupd/testfiles (modified) (1 prop)
-
test/bbackupd/testfiles/bbackupd-temploc.conf (modified) (1 diff)
-
test/bbackupd/testfiles/bbackupd.conf.in (modified) (1 diff)
-
test/bbackupd/testfiles/bbstored.conf (modified) (1 diff)
-
test/common/testcommon.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk
- Property svn:ignore
-
old new 11 11 release 12 12 runtest.pl 13 .hg
-
- Property svn:ignore
-
box/trunk/bin/bbackupd
- Property svn:ignore
-
old new 1 1 Makefile 2 2 bbackupd-config 3 autogen_*
-
- Property svn:ignore
-
box/trunk/bin/bbackupd/BackupClientContext.cpp
r2115 r2116 45 45 TLSContext &rTLSContext, 46 46 const std::string &rHostname, 47 int Port, 47 48 int32_t AccountNumber, 48 49 bool ExtendedLogging, … … 53 54 mrTLSContext(rTLSContext), 54 55 mHostname(rHostname), 56 mPort(Port), 55 57 mAccountNumber(AccountNumber), 56 58 mpSocket(0), … … 130 132 131 133 // Connect! 132 mpSocket->Open(mrTLSContext, Socket::TypeINET, mHostname.c_str(), BOX_PORT_BBSTORED); 134 mpSocket->Open(mrTLSContext, Socket::TypeINET, 135 mHostname.c_str(), mPort); 133 136 134 137 // And create a procotol object -
box/trunk/bin/bbackupd/BackupClientContext.h
r1191 r2116 42 42 TLSContext &rTLSContext, 43 43 const std::string &rHostname, 44 int32_t Port, 44 45 int32_t AccountNumber, 45 46 bool ExtendedLogging, … … 202 203 TLSContext &mrTLSContext; 203 204 std::string mHostname; 205 int mPort; 204 206 int32_t mAccountNumber; 205 207 SocketStreamTLS *mpSocket; -
box/trunk/bin/bbackupd/BackupDaemon.cpp
r2115 r2116 959 959 tlsContext, 960 960 conf.GetKeyValue("StoreHostname"), 961 conf.GetKeyValueInt("StorePort"), 961 962 conf.GetKeyValueInt("AccountNumber"), 962 963 conf.GetKeyValueBool("ExtendedLogging"), -
box/trunk/bin/bbackupquery
- Property svn:ignore
-
old new 1 autogen_ Documentation.cpp1 autogen_* 2 2 Makefile 3 3 makedocumentation.pl
-
- Property svn:ignore
-
box/trunk/bin/bbackupquery/bbackupquery.cpp
r2115 r2116 261 261 if(!quiet) BOX_INFO("Connecting to store..."); 262 262 SocketStreamTLS socket; 263 socket.Open(tlsContext, Socket::TypeINET, conf.GetKeyValue("StoreHostname").c_str(), BOX_PORT_BBSTORED); 263 socket.Open(tlsContext, Socket::TypeINET, 264 conf.GetKeyValue("StoreHostname").c_str(), 265 conf.GetKeyValueInt("StorePort")); 264 266 265 267 // 3. Make a protocol, and handshake -
box/trunk/bin/bbstored
- Property svn:ignore
-
old new 1 autogen_BackupProtocolServer.cpp 2 autogen_BackupProtocolServer.h 1 autogen_* 3 2 Makefile 4 3 bbstored-certs
-
- Property svn:ignore
-
box/trunk/infrastructure
- Property svn:ignore
-
old new 2 2 makebuildenv.pl 3 3 makeparcels.pl 4 makedistribution.pl
-
- Property svn:ignore
-
box/trunk/lib/backupclient
- Property svn:ignore
-
old new 1 autogen_BackupProtocolClient.cpp 2 autogen_BackupProtocolClient.h 3 autogen_BackupStoreException.cpp 4 autogen_BackupStoreException.h 1 autogen_* 5 2 Makefile
-
- Property svn:ignore
-
box/trunk/lib/backupclient/BackupDaemonConfigVerify.cpp
r1863 r2116 18 18 static const ConfigurationVerifyKey backuplocationkeys[] = 19 19 { 20 {"ExcludeFile", 0, ConfigTest_MultiValueAllowed, 0},21 {"ExcludeFilesRegex", 0, ConfigTest_MultiValueAllowed, 0},22 {"ExcludeDir", 0, ConfigTest_MultiValueAllowed, 0},23 {"ExcludeDirsRegex", 0, ConfigTest_MultiValueAllowed, 0},24 {"AlwaysIncludeFile", 0, ConfigTest_MultiValueAllowed, 0},25 {"AlwaysIncludeFilesRegex", 0, ConfigTest_MultiValueAllowed, 0},26 {"AlwaysIncludeDir", 0, ConfigTest_MultiValueAllowed, 0},27 {"AlwaysIncludeDirsRegex", 0, ConfigTest_MultiValueAllowed, 0},28 {"Path", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0}20 ConfigurationVerifyKey("ExcludeFile", ConfigTest_MultiValueAllowed), 21 ConfigurationVerifyKey("ExcludeFilesRegex", ConfigTest_MultiValueAllowed), 22 ConfigurationVerifyKey("ExcludeDir", ConfigTest_MultiValueAllowed), 23 ConfigurationVerifyKey("ExcludeDirsRegex", ConfigTest_MultiValueAllowed), 24 ConfigurationVerifyKey("AlwaysIncludeFile", ConfigTest_MultiValueAllowed), 25 ConfigurationVerifyKey("AlwaysIncludeFilesRegex", ConfigTest_MultiValueAllowed), 26 ConfigurationVerifyKey("AlwaysIncludeDir", ConfigTest_MultiValueAllowed), 27 ConfigurationVerifyKey("AlwaysIncludeDirsRegex", ConfigTest_MultiValueAllowed), 28 ConfigurationVerifyKey("Path", ConfigTest_Exists | ConfigTest_LastEntry) 29 29 }; 30 30 … … 65 65 static const ConfigurationVerifyKey verifyrootkeys[] = 66 66 { 67 {"AccountNumber", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 67 ConfigurationVerifyKey("AccountNumber", 68 ConfigTest_Exists | ConfigTest_IsInt), 69 ConfigurationVerifyKey("UpdateStoreInterval", 70 ConfigTest_Exists | ConfigTest_IsInt), 71 ConfigurationVerifyKey("MinimumFileAge", 72 ConfigTest_Exists | ConfigTest_IsInt), 73 ConfigurationVerifyKey("MaxUploadWait", 74 ConfigTest_Exists | ConfigTest_IsInt), 75 ConfigurationVerifyKey("MaxFileTimeInFuture", ConfigTest_IsInt, 172800), 76 // file is uploaded if the file is this much in the future 77 // (2 days default) 78 ConfigurationVerifyKey("AutomaticBackup", ConfigTest_IsBool, true), 79 80 ConfigurationVerifyKey("SyncAllowScript", 0), 81 // script that returns "now" if backup is allowed now, or a number 82 // of seconds to wait before trying again if not 68 83 69 {"UpdateStoreInterval", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 70 {"MinimumFileAge", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 71 {"MaxUploadWait", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 72 {"MaxFileTimeInFuture", "172800", ConfigTest_IsInt, 0}, // file is uploaded if the file is this much in the future (2 days default) 84 ConfigurationVerifyKey("MaximumDiffingTime", ConfigTest_IsInt), 85 ConfigurationVerifyKey("DeleteRedundantLocationsAfter", 86 ConfigTest_IsInt, 172800), 73 87 74 {"AutomaticBackup", "yes", ConfigTest_IsBool, 0}, 88 ConfigurationVerifyKey("FileTrackingSizeThreshold", 89 ConfigTest_Exists | ConfigTest_IsInt), 90 ConfigurationVerifyKey("DiffingUploadSizeThreshold", 91 ConfigTest_Exists | ConfigTest_IsInt), 92 ConfigurationVerifyKey("StoreHostname", ConfigTest_Exists), 93 ConfigurationVerifyKey("StorePort", ConfigTest_IsInt, 94 BOX_PORT_BBSTORED), 95 ConfigurationVerifyKey("ExtendedLogging", ConfigTest_IsBool, false), 96 // extended log to syslog 97 ConfigurationVerifyKey("ExtendedLogFile", 0), 98 // extended log to a file 99 ConfigurationVerifyKey("LogAllFileAccess", ConfigTest_IsBool, false), 100 ConfigurationVerifyKey("CommandSocket", 0), 101 // not compulsory to have this 102 ConfigurationVerifyKey("KeepAliveTime", ConfigTest_IsInt), 103 ConfigurationVerifyKey("StoreObjectInfoFile", 0), 104 // optional 105 106 ConfigurationVerifyKey("NotifyScript", 0), 107 // optional script to run when backup needs attention, eg store full 75 108 76 {"SyncAllowScript", 0, 0, 0}, // optional script to run to see if the sync should be started now 77 // return "now" if it's allowed, or a number of seconds if it's not 78 79 {"MaximumDiffingTime", 0, ConfigTest_IsInt, 0}, 80 {"DeleteRedundantLocationsAfter", "172800", ConfigTest_IsInt, 0}, 81 82 {"FileTrackingSizeThreshold", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 83 {"DiffingUploadSizeThreshold", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 84 {"StoreHostname", 0, ConfigTest_Exists, 0}, 85 {"ExtendedLogging", "no", ConfigTest_IsBool, 0}, // extended log to syslog 86 {"ExtendedLogFile", NULL, 0, 0}, // extended log to a file 87 {"LogAllFileAccess", "no", ConfigTest_IsBool, 0}, 88 89 {"CommandSocket", 0, 0, 0}, // not compulsory to have this 90 {"KeepAliveTime", 0, ConfigTest_IsInt, 0}, // optional 91 {"StoreObjectInfoFile", 0, 0, 0}, // optional 92 93 {"NotifyScript", 0, 0, 0}, // optional script to run when backup needs attention, eg store full 94 95 {"CertificateFile", 0, ConfigTest_Exists, 0}, 96 {"PrivateKeyFile", 0, ConfigTest_Exists, 0}, 97 {"TrustedCAsFile", 0, ConfigTest_Exists, 0}, 98 {"KeysFile", 0, ConfigTest_Exists, 0}, 99 {"DataDirectory", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0} 109 ConfigurationVerifyKey("CertificateFile", ConfigTest_Exists), 110 ConfigurationVerifyKey("PrivateKeyFile", ConfigTest_Exists), 111 ConfigurationVerifyKey("TrustedCAsFile", ConfigTest_Exists), 112 ConfigurationVerifyKey("KeysFile", ConfigTest_Exists), 113 ConfigurationVerifyKey("DataDirectory", 114 ConfigTest_Exists | ConfigTest_LastEntry), 100 115 }; 101 116 -
box/trunk/lib/backupstore/BackupStoreConfigVerify.cpp
r1777 r2116 17 17 static const ConfigurationVerifyKey verifyserverkeys[] = 18 18 { 19 SERVERTLS_VERIFY_SERVER_KEYS(0) // no default listen addresses 19 SERVERTLS_VERIFY_SERVER_KEYS(ConfigurationVerifyKey::NoDefaultValue) 20 // no default listen addresses 20 21 }; 21 22 … … 33 34 static const ConfigurationVerifyKey verifyrootkeys[] = 34 35 { 35 {"AccountDatabase", 0, ConfigTest_Exists, 0}, 36 {"TimeBetweenHousekeeping", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 37 {"ExtendedLogging", "no", ConfigTest_IsBool, 0}, // make value "yes" to enable in config file 36 ConfigurationVerifyKey("AccountDatabase", ConfigTest_Exists), 37 ConfigurationVerifyKey("TimeBetweenHousekeeping", 38 ConfigTest_Exists | ConfigTest_IsInt), 39 ConfigurationVerifyKey("ExtendedLogging", ConfigTest_IsBool, false), 40 // make value "yes" to enable in config file 38 41 39 42 #ifdef WIN32 40 {"RaidFileConf", "", ConfigTest_LastEntry, 0}43 ConfigurationVerifyKey("RaidFileConf", ConfigTest_LastEntry) 41 44 #else 42 {"RaidFileConf", BOX_FILE_RAIDFILE_DEFAULT_CONFIG, ConfigTest_LastEntry, 0} 45 ConfigurationVerifyKey("RaidFileConf", ConfigTest_LastEntry, 46 BOX_FILE_RAIDFILE_DEFAULT_CONFIG) 43 47 #endif 44 45 48 }; 46 49 -
box/trunk/lib/common
- Property svn:ignore
-
old new 1 autogen_CommonException.cpp 2 autogen_CommonException.h 3 autogen_ConversionException.cpp 4 autogen_ConversionException.h 1 autogen_* 5 2 BoxConfig.h 6 3 BoxConfig.h.in 7 4 Makefile 8 5 makeexception.pl 6 BoxPortsAndFiles.h
-
- Property svn:ignore
-
box/trunk/lib/common/Configuration.cpp
r1865 r2116 12 12 #include <stdlib.h> 13 13 #include <limits.h> 14 15 #include <sstream> 14 16 15 17 #include "Configuration.h" … … 30 32 static const bool sValueBooleanValue[] = {true, true, false, false}; 31 33 32 34 ConfigurationVerifyKey::ConfigurationVerifyKey 35 ( 36 std::string name, 37 int flags, 38 void *testFunction 39 ) 40 : mName(name), 41 mHasDefaultValue(false), 42 mFlags(flags), 43 mTestFunction(testFunction) 44 { } 45 46 // to allow passing NULL for default ListenAddresses 47 48 ConfigurationVerifyKey::ConfigurationVerifyKey 49 ( 50 std::string name, 51 int flags, 52 NoDefaultValue_t t, 53 void *testFunction 54 ) 55 : mName(name), 56 mHasDefaultValue(false), 57 mFlags(flags), 58 mTestFunction(testFunction) 59 { } 60 61 ConfigurationVerifyKey::ConfigurationVerifyKey 62 ( 63 std::string name, 64 int flags, 65 std::string defaultValue, 66 void *testFunction 67 ) 68 : mName(name), 69 mDefaultValue(defaultValue), 70 mHasDefaultValue(true), 71 mFlags(flags), 72 mTestFunction(testFunction) 73 { } 74 75 ConfigurationVerifyKey::ConfigurationVerifyKey 76 ( 77 std::string name, 78 int flags, 79 const char *defaultValue, 80 void *testFunction 81 ) 82 : mName(name), 83 mDefaultValue(defaultValue), 84 mHasDefaultValue(true), 85 mFlags(flags), 86 mTestFunction(testFunction) 87 { } 88 89 ConfigurationVerifyKey::ConfigurationVerifyKey 90 ( 91 std::string name, 92 int flags, 93 int defaultValue, 94 void *testFunction 95 ) 96 : mName(name), 97 mHasDefaultValue(true), 98 mFlags(flags), 99 mTestFunction(testFunction) 100 { 101 ASSERT(flags & ConfigTest_IsInt); 102 std::ostringstream val; 103 val << defaultValue; 104 mDefaultValue = val.str(); 105 } 106 107 ConfigurationVerifyKey::ConfigurationVerifyKey 108 ( 109 std::string name, 110 int flags, 111 bool defaultValue, 112 void *testFunction 113 ) 114 : mName(name), 115 mHasDefaultValue(true), 116 mFlags(flags), 117 mTestFunction(testFunction) 118 { 119 ASSERT(flags & ConfigTest_IsBool); 120 mDefaultValue = defaultValue ? "yes" : "no"; 121 } 122 123 ConfigurationVerifyKey::ConfigurationVerifyKey 124 ( 125 const ConfigurationVerifyKey& rToCopy 126 ) 127 : mName(rToCopy.mName), 128 mDefaultValue(rToCopy.mDefaultValue), 129 mHasDefaultValue(rToCopy.mHasDefaultValue), 130 mFlags(rToCopy.mFlags), 131 mTestFunction(rToCopy.mTestFunction) 132 { } 33 133 34 134 // -------------------------------------------------------------------------- … … 121 221 if(!Verify(*pconfig, *pVerify, std::string(), rErrorMsg)) 122 222 { 123 //TRACE1("Error message from Verify: %s", rErrorMsg.c_str());124 TRACE0("Error at Configuration::Verify\n");223 BOX_ERROR("Error verifying configuration: " << 224 rErrorMsg); 125 225 delete pconfig; 126 226 pconfig = 0; … … 190 290 else 191 291 { 192 rErrorMsg += "Unexpected start block in " + rConfig.mName + "\n"; 292 rErrorMsg += "Unexpected start block in " + 293 rConfig.mName + "\n"; 193 294 } 194 295 } … … 291 392 // 292 393 // Function 293 // Name: Configuration::KeyExists(const char *)394 // Name: Configuration::KeyExists(const std::string&) 294 395 // Purpose: Checks to see if a key exists 295 396 // Created: 2003/07/23 296 397 // 297 398 // -------------------------------------------------------------------------- 298 bool Configuration::KeyExists(const char *pKeyName) const 299 { 300 if(pKeyName == 0) {THROW_EXCEPTION(CommonException, BadArguments)} 301 302 return mKeys.find(pKeyName) != mKeys.end(); 303 } 304 305 306 // -------------------------------------------------------------------------- 307 // 308 // Function 309 // Name: Configuration::GetKeyValue(const char *) 399 bool Configuration::KeyExists(const std::string& rKeyName) const 400 { 401 return mKeys.find(rKeyName) != mKeys.end(); 402 } 403 404 405 // -------------------------------------------------------------------------- 406 // 407 // Function 408 // Name: Configuration::GetKeyValue(const std::string&) 310 409 // Purpose: Returns the value of a configuration variable 311 410 // Created: 2003/07/23 312 411 // 313 412 // -------------------------------------------------------------------------- 314 const std::string &Configuration::GetKeyValue(const char *pKeyName) const 315 { 316 if(pKeyName == 0) {THROW_EXCEPTION(CommonException, BadArguments)} 317 318 std::map<std::string, std::string>::const_iterator i(mKeys.find(pKeyName)); 413 const std::string &Configuration::GetKeyValue(const std::string& rKeyName) const 414 { 415 std::map<std::string, std::string>::const_iterator i(mKeys.find(rKeyName)); 319 416 320 417 if(i == mKeys.end()) 321 418 { 322 BOX_ERROR("Missing configuration key: " << pKeyName);419 BOX_ERROR("Missing configuration key: " << rKeyName); 323 420 THROW_EXCEPTION(CommonException, ConfigNoKey) 324 421 } … … 333 430 // 334 431 // Function 335 // Name: Configuration::GetKeyValueInt(const char *)432 // Name: Configuration::GetKeyValueInt(const std::string& rKeyName) 336 433 // Purpose: Gets a key value as an integer 337 434 // Created: 2003/07/23 338 435 // 339 436 // -------------------------------------------------------------------------- 340 int Configuration::GetKeyValueInt(const char *pKeyName) const 341 { 342 if(pKeyName == 0) {THROW_EXCEPTION(CommonException, BadArguments)} 343 344 std::map<std::string, std::string>::const_iterator i(mKeys.find(pKeyName)); 437 int Configuration::GetKeyValueInt(const std::string& rKeyName) const 438 { 439 std::map<std::string, std::string>::const_iterator i(mKeys.find(rKeyName)); 345 440 346 441 if(i == mKeys.end()) … … 363 458 // 364 459 // Function 365 // Name: Configuration::GetKeyValueBool(const char *) const460 // Name: Configuration::GetKeyValueBool(const std::string&) 366 461 // Purpose: Gets a key value as a boolean 367 462 // Created: 17/2/04 368 463 // 369 464 // -------------------------------------------------------------------------- 370 bool Configuration::GetKeyValueBool(const char *pKeyName) const 371 { 372 if(pKeyName == 0) {THROW_EXCEPTION(CommonException, BadArguments)} 373 374 std::map<std::string, std::string>::const_iterator i(mKeys.find(pKeyName)); 465 bool Configuration::GetKeyValueBool(const std::string& rKeyName) const 466 { 467 std::map<std::string, std::string>::const_iterator i(mKeys.find(rKeyName)); 375 468 376 469 if(i == mKeys.end()) … … 429 522 // 430 523 // Function 431 // Name: Configuration::SubConfigurationExists(const char *) 524 // Name: Configuration::SubConfigurationExists(const 525 // std::string&) 432 526 // Purpose: Checks to see if a sub configuration exists 433 527 // Created: 2003/07/23 434 528 // 435 529 // -------------------------------------------------------------------------- 436 bool Configuration::SubConfigurationExists(const char *pSubName) const 437 { 438 if(pSubName == 0) {THROW_EXCEPTION(CommonException, BadArguments)} 439 530 bool Configuration::SubConfigurationExists(const std::string& rSubName) const 531 { 440 532 // Attempt to find it... 441 533 std::list<std::pair<std::string, Configuration> >::const_iterator i(mSubConfigurations.begin()); … … 444 536 { 445 537 // This the one? 446 if(i->first == pSubName)538 if(i->first == rSubName) 447 539 { 448 540 // Yes. … … 459 551 // 460 552 // Function 461 // Name: Configuration::GetSubConfiguration(const char *) 553 // Name: Configuration::GetSubConfiguration(const 554 // std::string&) 462 555 // Purpose: Gets a sub configuration 463 556 // Created: 2003/07/23 464 557 // 465 558 // -------------------------------------------------------------------------- 466 const Configuration &Configuration::GetSubConfiguration(const char *pSubName) const 467 { 468 if(pSubName == 0) {THROW_EXCEPTION(CommonException, BadArguments)} 469 559 const Configuration &Configuration::GetSubConfiguration(const std::string& 560 rSubName) const 561 { 470 562 // Attempt to find it... 471 563 std::list<std::pair<std::string, Configuration> >::const_iterator i(mSubConfigurations.begin()); … … 474 566 { 475 567 // This the one? 476 if(i->first == pSubName)568 if(i->first == rSubName) 477 569 { 478 570 // Yes. … … 529 621 { 530 622 // Can the key be found? 531 ASSERT(pvkey->mpName); 532 if(rConfig.KeyExists(pvkey->mpName)) 623 if(rConfig.KeyExists(pvkey->Name())) 533 624 { 534 625 // Get value 535 const std::string &rval = rConfig.GetKeyValue(pvkey-> mpName);626 const std::string &rval = rConfig.GetKeyValue(pvkey->Name()); 536 627 const char *val = rval.c_str(); 537 628 538 629 // Check it's a number? 539 if((pvkey-> Tests& ConfigTest_IsInt) == ConfigTest_IsInt)630 if((pvkey->Flags() & ConfigTest_IsInt) == ConfigTest_IsInt) 540 631 { 541 632 // Test it... … … 546 637 // not a good value 547 638 ok = false; 548 rErrorMsg += rLevel + rConfig.mName + "." + pvkey->mpName+ " (key) is not a valid integer.\n";639 rErrorMsg += rLevel + rConfig.mName + "." + pvkey->Name() + " (key) is not a valid integer.\n"; 549 640 } 550 641 } 551 642 552 643 // Check it's a bool? 553 if((pvkey-> Tests& ConfigTest_IsBool) == ConfigTest_IsBool)644 if((pvkey->Flags() & ConfigTest_IsBool) == ConfigTest_IsBool) 554 645 { 555 646 // See if it's one of the allowed strings. … … 569 660 { 570 661 ok = false; 571 rErrorMsg += rLevel + rConfig.mName + "." + pvkey->mpName+ " (key) is not a valid boolean value.\n";662 rErrorMsg += rLevel + rConfig.mName + "." + pvkey->Name() + " (key) is not a valid boolean value.\n"; 572 663 } 573 664 } 574 665 575 666 // Check for multi valued statments where they're not allowed 576 if((pvkey-> Tests& ConfigTest_MultiValueAllowed) == 0)667 if((pvkey->Flags() & ConfigTest_MultiValueAllowed) == 0) 577 668 { 578 669 // Check to see if this key is a multi-value -- it shouldn't be … … 580 671 { 581 672 ok = false; 582 rErrorMsg += rLevel + rConfig.mName +"." + pvkey-> mpName+ " (key) multi value not allowed (duplicated key?).\n";673 rErrorMsg += rLevel + rConfig.mName +"." + pvkey->Name() + " (key) multi value not allowed (duplicated key?).\n"; 583 674 } 584 675 } … … 587 678 { 588 679 // Is it required to exist? 589 if((pvkey-> Tests& ConfigTest_Exists) == ConfigTest_Exists)680 if((pvkey->Flags() & ConfigTest_Exists) == ConfigTest_Exists) 590 681 { 591 682 // Should exist, but doesn't. 592 683 ok = false; 593 rErrorMsg += rLevel + rConfig.mName + "." + pvkey->mpName + " (key) is missing.\n"; 594 } 595 else if(pvkey->mpDefaultValue) 596 { 597 rConfig.mKeys[std::string(pvkey->mpName)] = std::string(pvkey->mpDefaultValue); 684 rErrorMsg += rLevel + rConfig.mName + "." + pvkey->Name() + " (key) is missing.\n"; 685 } 686 else if(pvkey->HasDefaultValue()) 687 { 688 rConfig.mKeys[pvkey->Name()] = 689 pvkey->DefaultValue(); 598 690 } 599 691 } 600 692 601 if((pvkey-> Tests& ConfigTest_LastEntry) == ConfigTest_LastEntry)693 if((pvkey->Flags() & ConfigTest_LastEntry) == ConfigTest_LastEntry) 602 694 { 603 695 // No more! … … 619 711 while(scan) 620 712 { 621 if(scan-> mpName== i->first)713 if(scan->Name() == i->first) 622 714 { 623 715 found = true; … … 626 718 627 719 // Next? 628 if((scan-> Tests& ConfigTest_LastEntry) == ConfigTest_LastEntry)720 if((scan->Flags() & ConfigTest_LastEntry) == ConfigTest_LastEntry) 629 721 { 630 722 break; … … 651 743 while(scan) 652 744 { 653 ASSERT(scan->mpName); 654 if(scan->mpName[0] == '*') 745 if(scan->mName.length() > 0 && scan->mName[0] == '*') 655 746 { 656 747 wildcardverify = scan; … … 660 751 if((scan->Tests & ConfigTest_Exists) == ConfigTest_Exists) 661 752 { 662 if(scan->mpName[0] == '*') 753 if(scan->mName.length() > 0 && 754 scan->mName[0] == '*') 663 755 { 664 756 // Check something exists … … 673 765 { 674 766 // Check real thing exists 675 if(!rConfig.SubConfigurationExists(scan->m pName))767 if(!rConfig.SubConfigurationExists(scan->mName)) 676 768 { 677 769 // Should exist, but doesn't. 678 770 ok = false; 679 rErrorMsg += rLevel + rConfig.mName + "." + scan->m pName + " (block) is missing.\n";771 rErrorMsg += rLevel + rConfig.mName + "." + scan->mName + " (block) is missing.\n"; 680 772 } 681 773 } … … 702 794 while(scan) 703 795 { 704 if(s trcmp(scan->mpName, name) == 0)796 if(scan->mName == name) 705 797 { 706 798 // found it! -
box/trunk/lib/common/Configuration.h
r1776 r2116 30 30 { 31 31 public: 32 const char *mpName; // "*" for all other keys (not implemented yet) 33 const char *mpDefaultValue; // default for when it's not present 34 int Tests; 35 void *TestFunction; // set to zero for now, will implement later 32 typedef enum 33 { 34 NoDefaultValue = 1 35 } NoDefaultValue_t; 36 37 ConfigurationVerifyKey(std::string name, int flags, 38 void *testFunction = NULL); 39 // to allow passing ConfigurationVerifyKey::NoDefaultValue 40 // for default ListenAddresses 41 ConfigurationVerifyKey(std::string name, int flags, 42 NoDefaultValue_t t, void *testFunction = NULL); 43 ConfigurationVerifyKey(std::string name, int flags, 44 std::string defaultValue, void *testFunction = NULL); 45 ConfigurationVerifyKey(std::string name, int flags, 46 const char* defaultValue, void *testFunction = NULL); 47 ConfigurationVerifyKey(std::string name, int flags, 48 int defaultValue, void *testFunction = NULL); 49 ConfigurationVerifyKey(std::string name, int flags, 50 bool defaultValue, void *testFunction = NULL); 51 const std::string& Name() const { return mName; } 52 const std::string& DefaultValue() const { return mDefaultValue; } 53 const bool HasDefaultValue() const { return mHasDefaultValue; } 54 const int Flags() const { return mFlags; } 55 const void* TestFunction() const { return mTestFunction; } 56 ConfigurationVerifyKey(const ConfigurationVerifyKey& rToCopy); 57 58 private: 59 ConfigurationVerifyKey& operator=(const ConfigurationVerifyKey& 60 noAssign); 61 62 std::string mName; // "*" for all other keys (not implemented yet) 63 std::string mDefaultValue; // default for when it's not present 64 bool mHasDefaultValue; 65 int mFlags; 66 void *mTestFunction; // set to zero for now, will implement later 36 67 }; 37 68 … … 39 70 { 40 71 public: 41 const char *mpName;// "*" for all other sub config names72 std::string mName; // "*" for all other sub config names 42 73 const ConfigurationVerify *mpSubConfigurations; 43 74 const ConfigurationVerifyKey *mpKeys; 44 75 int Tests; 45 void *TestFunction; // set to zero for now, will implement later76 void *TestFunction; // set to zero for now, will implement later 46 77 }; 47 78 … … 80 111 { return LoadAndVerify(rFilename, 0, rErrorMsg); } 81 112 82 bool KeyExists(const char *pKeyName) const;83 const std::string &GetKeyValue(const char *pKeyName) const;84 int GetKeyValueInt(const char *pKeyName) const;85 bool GetKeyValueBool(const char *pKeyName) const;113 bool KeyExists(const std::string& rKeyName) const; 114 const std::string &GetKeyValue(const std::string& rKeyName) const; 115 int GetKeyValueInt(const std::string& rKeyName) const; 116 bool GetKeyValueBool(const std::string& rKeyName) const; 86 117 std::vector<std::string> GetKeyNames() const; 87 118 88 bool SubConfigurationExists(const char *pSubName) const;89 const Configuration &GetSubConfiguration(const char *pSubName) const;119 bool SubConfigurationExists(const std::string& rSubName) const; 120 const Configuration &GetSubConfiguration(const std::string& rSubName) const; 90 121 std::vector<std::string> GetSubConfigurationNames() const; 91 122 -
box/trunk/lib/compress
- Property svn:ignore
-
old new 1 autogen_CompressException.cpp 2 autogen_CompressException.h 1 autogen_* 3 2 Makefile
-
- Property svn:ignore
-
box/trunk/lib/crypto
- Property svn:ignore
-
old new 1 autogen_CipherException.cpp 2 autogen_CipherException.h 1 autogen_* 3 2 Makefile
-
- Property svn:ignore
-
box/trunk/lib/intercept
-
Property
svn:ignore
set to
Makefile
-
Property
svn:ignore
set to
-
box/trunk/lib/raidfile
- Property svn:ignore
-
old new 1 autogen_RaidFileException.cpp 2 autogen_RaidFileException.h 1 autogen_* 3 2 Makefile 4 3 raidfile-config
-
- Property svn:ignore
-
box/trunk/lib/raidfile/RaidFileController.cpp
r1789 r2116 71 71 static const ConfigurationVerifyKey verifykeys[] = 72 72 { 73 {"SetNumber", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 74 {"BlockSize", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, 75 {"Dir0", 0, ConfigTest_Exists, 0}, 76 {"Dir1", 0, ConfigTest_Exists, 0}, 77 {"Dir2", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0} 73 ConfigurationVerifyKey("SetNumber", 74 ConfigTest_Exists | ConfigTest_IsInt), 75 ConfigurationVerifyKey("BlockSize", 76 ConfigTest_Exists | ConfigTest_IsInt), 77 ConfigurationVerifyKey("Dir0", ConfigTest_Exists), 78 ConfigurationVerifyKey("Dir1", ConfigTest_Exists), 79 ConfigurationVerifyKey("Dir2", 80 ConfigTest_Exists | ConfigTest_LastEntry) 78 81 }; 79 82 -
box/trunk/lib/server
- Property svn:ignore
-
old new 1 autogen_ConnectionException.cpp 2 autogen_ConnectionException.h 3 autogen_ServerException.cpp 4 autogen_ServerException.h 1 autogen_* 5 2 Makefile 6 3 makeprotocol.pl
-
- Property svn:ignore
-
box/trunk/lib/server/Daemon.h
r2099 r2116 93 93 }; 94 94 95 #define DAEMON_VERIFY_SERVER_KEYS {"PidFile", 0, ConfigTest_Exists, 0}, \ 96 {"User", 0, ConfigTest_LastEntry, 0} 95 #define DAEMON_VERIFY_SERVER_KEYS \ 96 ConfigurationVerifyKey("PidFile", ConfigTest_Exists), \ 97 ConfigurationVerifyKey("User", ConfigTest_LastEntry) 97 98 98 99 #endif // DAEMON__H -
box/trunk/lib/server/ServerStream.h
r2114 r2116 366 366 367 367 #define SERVERSTREAM_VERIFY_SERVER_KEYS(DEFAULT_ADDRESSES) \ 368 {"ListenAddresses", DEFAULT_ADDRESSES, 0, 0}, \369 DAEMON_VERIFY_SERVER_KEYS368 ConfigurationVerifyKey("ListenAddresses", 0, DEFAULT_ADDRESSES), \ 369 DAEMON_VERIFY_SERVER_KEYS 370 370 371 371 #include "MemLeakFindOff.h" -
box/trunk/lib/server/ServerTLS.h
r217 r2116 71 71 72 72 #define SERVERTLS_VERIFY_SERVER_KEYS(DEFAULT_ADDRESSES) \ 73 {"CertificateFile", 0, ConfigTest_Exists, 0}, \ 74 {"PrivateKeyFile", 0, ConfigTest_Exists, 0}, \ 75 {"TrustedCAsFile", 0, ConfigTest_Exists, 0}, \ 76 SERVERSTREAM_VERIFY_SERVER_KEYS(DEFAULT_ADDRESSES) 77 73 ConfigurationVerifyKey("CertificateFile", ConfigTest_Exists), \ 74 ConfigurationVerifyKey("PrivateKeyFile", ConfigTest_Exists), \ 75 ConfigurationVerifyKey("TrustedCAsFile", ConfigTest_Exists), \ 76 SERVERSTREAM_VERIFY_SERVER_KEYS(DEFAULT_ADDRESSES) 78 77 79 78 #endif // SERVERTLS__H -
box/trunk/test/basicserver
- Property svn:ignore
-
old new 1 autogen_TestProtocolClient.cpp 2 autogen_TestProtocolClient.h 3 autogen_TestProtocolServer.cpp 4 autogen_TestProtocolServer.h 1 autogen_* 5 2 _main.cpp 6 3 Makefile
-
- Property svn:ignore
-
box/trunk/test/basicserver/testbasicserver.cpp
r2014 r2116 186 186 static ConfigurationVerifyKey verifyserverkeys[] = 187 187 { 188 SERVERSTREAM_VERIFY_SERVER_KEYS( 0) // no defaultaddresses188 SERVERSTREAM_VERIFY_SERVER_KEYS(ConfigurationVerifyKey::NoDefaultValue) // no default listen addresses 189 189 }; 190 190 … … 259 259 static ConfigurationVerifyKey verifyserverkeys[] = 260 260 { 261 SERVERTLS_VERIFY_SERVER_KEYS( 0)// no default listen addresses261 SERVERTLS_VERIFY_SERVER_KEYS(ConfigurationVerifyKey::NoDefaultValue) // no default listen addresses 262 262 }; 263 263 -
box/trunk/test/bbackupd/testbbackupd.cpp
r2107 r2116 515 515 // connect and log in 516 516 SocketStreamTLS conn; 517 conn.Open(context, Socket::TypeINET, "localhost", BOX_PORT_BBSTORED); 517 conn.Open(context, Socket::TypeINET, "localhost", 518 22011); 518 519 BackupProtocolClient protocol(conn); 519 520 protocol.QueryVersion(BACKUP_STORE_SERVER_VERSION); … … 608 609 { 609 610 sSocket.Open(rContext, Socket::TypeINET, 610 "localhost", BOX_PORT_BBSTORED);611 "localhost", 22011); 611 612 std::auto_ptr<BackupProtocolClient> connection; 612 613 connection.reset(new BackupProtocolClient(sSocket)); … … 2560 2561 == Restore_TargetExists); 2561 2562 2562 // Make sure you can't restore to a nonexistant path2563 printf("Try to restore to a path that doesn't exist\n");2564 TEST_THAT(BackupClientRestore(*client, restoredirid,2565 "testfiles/no-such-path/subdir",2566 true /* print progress dots */)2567 == Restore_TargetPathNotFound);2568 2569 2563 // Find ID of the deleted directory 2570 2564 deldirid = GetDirID(*client, "x1", restoredirid); … … 2578 2572 true /* deleted files */) 2579 2573 == Restore_Complete); 2574 2575 // Make sure you can't restore to a nonexistant path 2576 printf("\n\n==== Try to restore to a path " 2577 "that doesn't exist\n"); 2578 fflush(stdout); 2579 TEST_THAT(BackupClientRestore(*client, restoredirid, 2580 "testfiles/no-such-path/subdir", 2581 true /* print progress dots */) 2582 == Restore_TargetPathNotFound); 2580 2583 2581 2584 // Log out -
box/trunk/test/bbackupd/testfiles
- Property svn:ignore
-
old new 2 2 extcheck2.pl 3 3 notifyscript.pl 4 bbackupd.conf 5 syncallowscript.pl
-
- Property svn:ignore
-
box/trunk/test/bbackupd/testfiles/bbackupd-temploc.conf
r1867 r2116 9 9 10 10 StoreHostname = localhost 11 StorePort = 22011 11 12 AccountNumber = 0x01234567 12 13 -
box/trunk/test/bbackupd/testfiles/bbackupd.conf.in
r1867 r2116 9 9 10 10 StoreHostname = localhost 11 StorePort = 22011 11 12 AccountNumber = 0x01234567 12 13 -
box/trunk/test/bbackupd/testfiles/bbstored.conf
r217 r2116 10 10 { 11 11 PidFile = testfiles/bbstored.pid 12 ListenAddresses = inet:localhost 12 ListenAddresses = inet:localhost:22011 13 13 CertificateFile = testfiles/serverCerts.pem 14 14 PrivateKeyFile = testfiles/serverPrivKey.pem -
box/trunk/test/common/testcommon.cpp
r1774 r2116 58 58 ConfigurationVerifyKey verifykeys1_1_1[] = 59 59 { 60 {"bing", 0, ConfigTest_Exists, 0},61 {"carrots", 0, ConfigTest_Exists | ConfigTest_IsInt, 0},62 {"terrible", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0}60 ConfigurationVerifyKey("bing", ConfigTest_Exists), 61 ConfigurationVerifyKey("carrots", ConfigTest_Exists | ConfigTest_IsInt), 62 ConfigurationVerifyKey("terrible", ConfigTest_Exists | ConfigTest_LastEntry) 63 63 }; 64 64 65 65 ConfigurationVerifyKey verifykeys1_1_2[] = 66 66 { 67 {"fish", 0, ConfigTest_Exists | ConfigTest_IsInt, 0},68 {"string", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0}67 ConfigurationVerifyKey("fish", ConfigTest_Exists | ConfigTest_IsInt), 68 ConfigurationVerifyKey("string", ConfigTest_Exists | ConfigTest_LastEntry) 69 69 }; 70 70 … … 90 90 ConfigurationVerifyKey verifykeys1_1[] = 91 91 { 92 {"value", 0, ConfigTest_Exists | ConfigTest_IsInt, 0},93 {"string1", 0, ConfigTest_Exists, 0},94 {"string2", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0}92 ConfigurationVerifyKey("value", ConfigTest_Exists | ConfigTest_IsInt), 93 ConfigurationVerifyKey("string1", ConfigTest_Exists), 94 ConfigurationVerifyKey("string2", ConfigTest_Exists | ConfigTest_LastEntry) 95 95 }; 96 96 97 97 ConfigurationVerifyKey verifykeys1_2[] = 98 98 { 99 {"carrots", 0, ConfigTest_Exists | ConfigTest_IsInt, 0},100 {"string", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0}99 ConfigurationVerifyKey("carrots", ConfigTest_Exists | ConfigTest_IsInt), 100 ConfigurationVerifyKey("string", ConfigTest_Exists | ConfigTest_LastEntry) 101 101 }; 102 102 … … 121 121 ConfigurationVerifyKey verifykeys1[] = 122 122 { 123 {"notExpected", 0, 0, 0}, 124 {"HasDefaultValue", "Lovely default value", 0, 0}, 125 {"MultiValue", 0, ConfigTest_MultiValueAllowed, 0}, 126 {"BoolTrue1", 0, ConfigTest_IsBool, 0}, 127 {"BoolTrue2", 0, ConfigTest_IsBool, 0}, 128 {"BoolFalse1", 0, ConfigTest_IsBool, 0}, 129 {"BoolFalse2", 0, ConfigTest_IsBool, 0}, 130 {"TOPlevel", 0, ConfigTest_LastEntry | ConfigTest_Exists, 0} 123 ConfigurationVerifyKey("notExpected", 0), 124 ConfigurationVerifyKey("HasDefaultValue", 0, "Lovely default value"), 125 ConfigurationVerifyKey("MultiValue", ConfigTest_MultiValueAllowed), 126 ConfigurationVerifyKey("BoolTrue1", ConfigTest_IsBool), 127 ConfigurationVerifyKey("BoolTrue2", ConfigTest_IsBool), 128 ConfigurationVerifyKey("BoolFalse1", ConfigTest_IsBool), 129 ConfigurationVerifyKey("BoolFalse2", ConfigTest_IsBool), 130 ConfigurationVerifyKey("TOPlevel", 131 ConfigTest_LastEntry | ConfigTest_Exists) 131 132 }; 132 133
Note: See TracChangeset
for help on using the changeset viewer.
