From 2b31dad40026d8078ea30d0da0656a4078d0f5b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20N=C3=A6sbye=20Christensen?= Date: Fri, 9 Feb 2024 22:26:02 +0100 Subject: miscellaneous: BOOL (int) to real bool --- indra/newview/tests/lllogininstance_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 696fe3536c..f0479f07b2 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -204,7 +204,7 @@ F32 LLControlGroup::getF32(const std::string& name) { return 0.0f; } U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only) { return 1; } void LLControlGroup::setString(const std::string& name, const std::string& val) {} std::string LLControlGroup::getString(const std::string& name) { return "test_string"; } -LLControlVariable* LLControlGroup::declareBOOL(const std::string& name, BOOL initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } +LLControlVariable* LLControlGroup::declareBOOL(const std::string& name, bool initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string &initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } #include "lluicolortable.h" -- cgit v1.2.3 From c285f59ce2a05703e3a1232fcaf3ee3aea714b3f Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sun, 18 Feb 2024 12:52:19 +0100 Subject: Replace BOOL with bool in llwindow and dependent classes --- indra/newview/tests/llviewercontrollistener_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/llviewercontrollistener_test.cpp b/indra/newview/tests/llviewercontrollistener_test.cpp index 8aed2a8043..bb005e997b 100644 --- a/indra/newview/tests/llviewercontrollistener_test.cpp +++ b/indra/newview/tests/llviewercontrollistener_test.cpp @@ -167,7 +167,7 @@ namespace tut "boolvar", llsd::map("name", "boolvar", "type", "Boolean", - "value", TRUE, + "value", true, "comment", "bool variable"))); } } // namespace tut -- cgit v1.2.3 From c2e00c0403b95ef10264807bdbfc3b1e4fdf0921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20N=C3=A6sbye=20Christensen?= Date: Sun, 18 Feb 2024 19:15:07 +0100 Subject: fix some tests --- indra/newview/tests/llviewercontrollistener_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/llviewercontrollistener_test.cpp b/indra/newview/tests/llviewercontrollistener_test.cpp index bb005e997b..175c442dc5 100644 --- a/indra/newview/tests/llviewercontrollistener_test.cpp +++ b/indra/newview/tests/llviewercontrollistener_test.cpp @@ -40,7 +40,7 @@ namespace tut { Global.declareString("strvar", "woof", "string variable"); // together we will stroll the boolvar, ma cherie - Global.declareBOOL("boolvar", TRUE, "bool variable"); + Global.declareBOOL("boolvar", true, "bool variable"); } }; typedef test_group llviewercontrollistener_group; -- cgit v1.2.3 From 8c16ec2b53153a10f40181e0e8108d24331451d4 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 20 Feb 2024 13:57:07 +0100 Subject: Convert BOOL to bool in LLControlGroup and related classes --- indra/newview/tests/lllogininstance_test.cpp | 6 +++--- indra/newview/tests/llsechandler_basic_test.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index f0479f07b2..e9e9caa9bd 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -198,10 +198,10 @@ LLControlGroup gSavedSettings("Global"); LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker(name){} LLControlGroup::~LLControlGroup() {} -void LLControlGroup::setBOOL(const std::string& name, BOOL val) {} -BOOL LLControlGroup::getBOOL(const std::string& name) { return FALSE; } +void LLControlGroup::setBOOL(const std::string& name, bool val) {} +bool LLControlGroup::getBOOL(const std::string& name) { return false; } F32 LLControlGroup::getF32(const std::string& name) { return 0.0f; } -U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only) { return 1; } +U32 LLControlGroup::saveToFile(const std::string& filename, bool nondefault_only) { return 1; } void LLControlGroup::setString(const std::string& name, const std::string& val) {} std::string LLControlGroup::getString(const std::string& name) { return "test_string"; } LLControlVariable* LLControlGroup::declareBOOL(const std::string& name, bool initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp index da742370fc..b720e60d21 100644 --- a/indra/newview/tests/llsechandler_basic_test.cpp +++ b/indra/newview/tests/llsechandler_basic_test.cpp @@ -90,7 +90,7 @@ std::string LLControlGroup::getString(const std::string& name) } // Stub for --no-verify-ssl-cert -BOOL LLControlGroup::getBOOL(const std::string& name) { return FALSE; } +bool LLControlGroup::getBOOL(const std::string& name) { return false; } LLSD LLCredential::getLoginParams() { -- cgit v1.2.3 From a5261a5fa8fad810ecb5c260d92c3e771822bf58 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 20 Feb 2024 23:46:23 +0100 Subject: Convert BOOL to bool in llui --- indra/newview/tests/lllogininstance_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index e9e9caa9bd..6d3e226011 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -235,7 +235,7 @@ static LLEventPump * gTOSReplyPump = NULL; LLPointer gSecAPIHandler; //static -LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, BOOL focus) +LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, bool focus) { gTOSType = name; gTOSReplyPump = &LLEventPumps::instance().obtain(key["reply_pump"]); -- cgit v1.2.3 From 3ffe63b8a4e8a3ceda3f6d204e4b5bb0c80d0870 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 21 Feb 2024 16:49:48 +0100 Subject: Convert remaining BOOLs in llxml and introduce std::string_view --- indra/newview/tests/llagentaccess_test.cpp | 4 ++-- indra/newview/tests/lllogininstance_test.cpp | 10 +++++----- indra/newview/tests/llsecapi_test.cpp | 4 ++-- indra/newview/tests/llsechandler_basic_test.cpp | 6 +++--- indra/newview/tests/llslurl_test.cpp | 10 +++++----- indra/newview/tests/llviewerhelputil_test.cpp | 4 ++-- indra/newview/tests/llviewernetwork_test.cpp | 10 +++++----- indra/newview/tests/llworldmipmap_test.cpp | 2 +- 8 files changed, 25 insertions(+), 25 deletions(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/llagentaccess_test.cpp b/indra/newview/tests/llagentaccess_test.cpp index 45ce1ba62f..7d1071e98a 100644 --- a/indra/newview/tests/llagentaccess_test.cpp +++ b/indra/newview/tests/llagentaccess_test.cpp @@ -55,12 +55,12 @@ LLControlVariable* LLControlGroup::declareU32(const std::string& name, U32 initi return NULL; } -void LLControlGroup::setU32(const std::string& name, U32 val) +void LLControlGroup::setU32(std::string_view name, U32 val) { test_preferred_maturity = val; } -U32 LLControlGroup::getU32(const std::string& name) +U32 LLControlGroup::getU32(std::string_view name) { return test_preferred_maturity; } diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 6d3e226011..21e6f77178 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -198,12 +198,12 @@ LLControlGroup gSavedSettings("Global"); LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker(name){} LLControlGroup::~LLControlGroup() {} -void LLControlGroup::setBOOL(const std::string& name, bool val) {} -bool LLControlGroup::getBOOL(const std::string& name) { return false; } -F32 LLControlGroup::getF32(const std::string& name) { return 0.0f; } +void LLControlGroup::setBOOL(std::string_view name, bool val) {} +bool LLControlGroup::getBOOL(std::string_view name) { return false; } +F32 LLControlGroup::getF32(std::string_view name) { return 0.0f; } U32 LLControlGroup::saveToFile(const std::string& filename, bool nondefault_only) { return 1; } -void LLControlGroup::setString(const std::string& name, const std::string& val) {} -std::string LLControlGroup::getString(const std::string& name) { return "test_string"; } +void LLControlGroup::setString(std::string_view name, const std::string& val) {} +std::string LLControlGroup::getString(std::string_view name) { return "test_string"; } LLControlVariable* LLControlGroup::declareBOOL(const std::string& name, bool initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string &initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp index 7d2a9a436f..689b6c43f9 100644 --- a/indra/newview/tests/llsecapi_test.cpp +++ b/indra/newview/tests/llsecapi_test.cpp @@ -43,8 +43,8 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} -std::string LLControlGroup::getString(const std::string& name) +void LLControlGroup::setString(std::string_view name, const std::string& val){} +std::string LLControlGroup::getString(std::string_view name) { return ""; } diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp index b720e60d21..18b424c95b 100644 --- a/indra/newview/tests/llsechandler_basic_test.cpp +++ b/indra/newview/tests/llsechandler_basic_test.cpp @@ -78,8 +78,8 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} -std::string LLControlGroup::getString(const std::string& name) +void LLControlGroup::setString(std::string_view name, const std::string& val){} +std::string LLControlGroup::getString(std::string_view name) { if (name == "FirstName") @@ -90,7 +90,7 @@ std::string LLControlGroup::getString(const std::string& name) } // Stub for --no-verify-ssl-cert -bool LLControlGroup::getBOOL(const std::string& name) { return false; } +bool LLControlGroup::getBOOL(std::string_view name) { return false; } LLSD LLCredential::getLoginParams() { diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp index eabf922875..1e59dec03b 100644 --- a/indra/newview/tests/llslurl_test.cpp +++ b/indra/newview/tests/llslurl_test.cpp @@ -64,14 +64,14 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} +void LLControlGroup::setString(std::string_view name, const std::string& val){} std::string gCmdLineLoginURI; std::string gCmdLineGridChoice; std::string gCmdLineHelperURI; std::string gLoginPage; std::string gCurrentGrid; -std::string LLControlGroup::getString(const std::string& name) +std::string LLControlGroup::getString(std::string_view name) { if (name == "CmdLineGridChoice") return gCmdLineGridChoice; @@ -84,7 +84,7 @@ std::string LLControlGroup::getString(const std::string& name) return ""; } -LLSD LLControlGroup::getLLSD(const std::string& name) +LLSD LLControlGroup::getLLSD(std::string_view name) { if (name == "CmdLineLoginURI") { @@ -96,9 +96,9 @@ LLSD LLControlGroup::getLLSD(const std::string& name) return LLSD(); } -LLPointer LLControlGroup::getControl(const std::string& name) +LLPointer LLControlGroup::getControl(std::string_view name) { - ctrl_name_table_t::iterator iter = mNameTable.find(name); + ctrl_name_table_t::iterator iter = mNameTable.find(name.data()); return iter == mNameTable.end() ? LLPointer() : iter->second; } diff --git a/indra/newview/tests/llviewerhelputil_test.cpp b/indra/newview/tests/llviewerhelputil_test.cpp index f6456a2839..ddcc4d8f7a 100644 --- a/indra/newview/tests/llviewerhelputil_test.cpp +++ b/indra/newview/tests/llviewerhelputil_test.cpp @@ -53,8 +53,8 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} -std::string LLControlGroup::getString(const std::string& name) +void LLControlGroup::setString(std::string_view name, const std::string& val){} +std::string LLControlGroup::getString(std::string_view name) { if (name == "HelpURLFormat") return gHelpURL; diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp index fe81fd63ea..4e5caf2ffe 100644 --- a/indra/newview/tests/llviewernetwork_test.cpp +++ b/indra/newview/tests/llviewernetwork_test.cpp @@ -73,14 +73,14 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(const std::string& name, const std::string& val){} +void LLControlGroup::setString(std::string_view name, const std::string& val){} std::string gCmdLineLoginURI; std::string gCmdLineGridChoice; std::string gCmdLineHelperURI; std::string gLoginPage; std::string gCurrentGrid; -std::string LLControlGroup::getString(const std::string& name) +std::string LLControlGroup::getString(std::string_view name) { if (name == "CmdLineGridChoice") return gCmdLineGridChoice; @@ -93,7 +93,7 @@ std::string LLControlGroup::getString(const std::string& name) return ""; } -LLSD LLControlGroup::getLLSD(const std::string& name) +LLSD LLControlGroup::getLLSD(std::string_view name) { if (name == "CmdLineLoginURI") { @@ -105,9 +105,9 @@ LLSD LLControlGroup::getLLSD(const std::string& name) return LLSD(); } -LLPointer LLControlGroup::getControl(const std::string& name) +LLPointer LLControlGroup::getControl(std::string_view name) { - ctrl_name_table_t::iterator iter = mNameTable.find(name); + ctrl_name_table_t::iterator iter = mNameTable.find(name.data()); return iter == mNameTable.end() ? LLPointer() : iter->second; } diff --git a/indra/newview/tests/llworldmipmap_test.cpp b/indra/newview/tests/llworldmipmap_test.cpp index 142d75bcfd..5f585116f7 100644 --- a/indra/newview/tests/llworldmipmap_test.cpp +++ b/indra/newview/tests/llworldmipmap_test.cpp @@ -48,7 +48,7 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const s LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker(name) { } LLControlGroup::~LLControlGroup() { } -std::string LLControlGroup::getString(const std::string& ) { return std::string("test_url"); } +std::string LLControlGroup::getString(std::string_view) { return std::string("test_url"); } LLControlGroup gSavedSettings("test_settings"); // End Stubbing -- cgit v1.2.3 From 60d3dd98a44230c21803c1606552ee098ed9fa7c Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 21 Feb 2024 21:05:14 +0100 Subject: Convert remaining BOOL to bool --- indra/newview/tests/lllogininstance_test.cpp | 2 +- indra/newview/tests/llsecapi_test.cpp | 6 +++--- indra/newview/tests/llworldmap_test.cpp | 2 +- indra/newview/tests/llworldmipmap_test.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 21e6f77178..2afa6a1b2a 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -74,7 +74,7 @@ static LLSD gLoginCreds; static bool gDisconnectCalled = false; #include "../llviewerwindow.h" -void LLViewerWindow::setShowProgress(BOOL show) {} +void LLViewerWindow::setShowProgress(bool show) {} LLProgressView * LLViewerWindow::getProgressView(void) const { return 0; } LLViewerWindow* gViewerWindow; diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp index 689b6c43f9..169a3ab1a2 100644 --- a/indra/newview/tests/llsecapi_test.cpp +++ b/indra/newview/tests/llsecapi_test.cpp @@ -109,10 +109,10 @@ namespace tut { // retrieve an unknown handler - ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown")); + ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr); LLPointer test1_handler = new LLSecAPIBasicHandler(); registerSecHandler("sectest1", test1_handler); - ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown")); + ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr); LLPointer retrieved_test1_handler = getSecHandler("sectest1"); ensure("Retrieved sectest1 handler should be the same", retrieved_test1_handler == test1_handler); @@ -120,7 +120,7 @@ namespace tut // insert a second handler LLPointer test2_handler = new LLSecAPIBasicHandler(); registerSecHandler("sectest2", test2_handler); - ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown")); + ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr); retrieved_test1_handler = getSecHandler("sectest1"); ensure("Retrieved sectest1 handler should be the same", retrieved_test1_handler == test1_handler); diff --git a/indra/newview/tests/llworldmap_test.cpp b/indra/newview/tests/llworldmap_test.cpp index f1dd8acccf..1f5a838e2a 100644 --- a/indra/newview/tests/llworldmap_test.cpp +++ b/indra/newview/tests/llworldmap_test.cpp @@ -49,7 +49,7 @@ // Stub image calls void LLGLTexture::setBoostLevel(S32 ) { } void LLGLTexture::setAddressMode(LLTexUnit::eTextureAddressMode ) { } -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, FTType, BOOL, LLGLTexture::EBoostLevel, S8, +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, FTType, bool, LLGLTexture::EBoostLevel, S8, LLGLint, LLGLenum, LLHost ) { return NULL; } // Stub related map calls diff --git a/indra/newview/tests/llworldmipmap_test.cpp b/indra/newview/tests/llworldmipmap_test.cpp index 5f585116f7..5f86968463 100644 --- a/indra/newview/tests/llworldmipmap_test.cpp +++ b/indra/newview/tests/llworldmipmap_test.cpp @@ -43,7 +43,7 @@ // * A simulator for a class can be implemented here. Please comment and document thoroughly. void LLGLTexture::setBoostLevel(S32 ) { } -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, FTType, BOOL, LLGLTexture::EBoostLevel, S8, +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, FTType, bool, LLGLTexture::EBoostLevel, S8, LLGLint, LLGLenum, const LLUUID& ) { return NULL; } LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker(name) { } -- cgit v1.2.3 From e160758b5c32f7b4b9622a5c25c7c53070395c7d Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 1 Mar 2024 13:48:46 +0100 Subject: Convert remaining TRUE/FALSE to true/false --- indra/newview/tests/lllogininstance_test.cpp | 10 +++++----- indra/newview/tests/llsechandler_basic_test.cpp | 2 +- indra/newview/tests/llviewerhelputil_test.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 2afa6a1b2a..70a73b9ca8 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -345,13 +345,13 @@ namespace tut gTOSReplyPump = 0; // clear the callback. - gSavedSettings.declareBOOL("NoInventoryLibrary", FALSE, "", LLControlVariable::PERSIST_NO); - gSavedSettings.declareBOOL("ConnectAsGod", FALSE, "", LLControlVariable::PERSIST_NO); - gSavedSettings.declareBOOL("UseDebugMenus", FALSE, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("NoInventoryLibrary", false, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("ConnectAsGod", false, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("UseDebugMenus", false, "", LLControlVariable::PERSIST_NO); gSavedSettings.declareString("ClientSettingsFile", "test_settings.xml", "", LLControlVariable::PERSIST_NO); gSavedSettings.declareString("NextLoginLocation", "", "", LLControlVariable::PERSIST_NO); - gSavedSettings.declareBOOL("LoginLastLocation", FALSE, "", LLControlVariable::PERSIST_NO); - gSavedSettings.declareBOOL("CmdLineSkipUpdater", TRUE, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("LoginLastLocation", false, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("CmdLineSkipUpdater", true, "", LLControlVariable::PERSIST_NO); LLSD authenticator = LLSD::emptyMap(); LLSD identifier = LLSD::emptyMap(); diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp index 18b424c95b..c04d8cdc35 100644 --- a/indra/newview/tests/llsechandler_basic_test.cpp +++ b/indra/newview/tests/llsechandler_basic_test.cpp @@ -964,7 +964,7 @@ namespace tut // test creation of credentials my_cred = handler->createCredential("mysavedgrid", my_id, my_authenticator); // test save without saving authenticator. - handler->saveCredential(my_cred, FALSE); + handler->saveCredential(my_cred, false); my_new_cred = handler->loadCredential("mysavedgrid"); ensure_equals("saved credential without auth", (const std::string)my_new_cred->getIdentifier()["type"], "test_type"); diff --git a/indra/newview/tests/llviewerhelputil_test.cpp b/indra/newview/tests/llviewerhelputil_test.cpp index ddcc4d8f7a..828c0da96c 100644 --- a/indra/newview/tests/llviewerhelputil_test.cpp +++ b/indra/newview/tests/llviewerhelputil_test.cpp @@ -75,7 +75,7 @@ static void substitute_string(std::string &input, const std::string &search, con #include "../llagent.h" LLAgent::LLAgent() : mAgentAccess(NULL) { } LLAgent::~LLAgent() { } -bool LLAgent::isGodlike() const { return FALSE; } +bool LLAgent::isGodlike() const { return false; } LLAgent gAgent; -- cgit v1.2.3 From 5f4d312c8d2b6ba0fd13279ccfc569acd4f37c82 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 24 Apr 2024 19:49:27 +0200 Subject: Fix BOOL vs bool issues after merge --- indra/newview/tests/llviewerassetstats_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index e2e7f09c3b..bdf91d0f07 100644 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -43,7 +43,7 @@ namespace LLStatViewer LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample"); } -void LLVOAvatar::getNearbyRezzedStats(std::vector& counts) +void LLVOAvatar::getNearbyRezzedStats(std::vector& counts, F32& avg_cloud_time, S32& cloud_avatars) { counts.resize(3); counts[0] = 0; -- cgit v1.2.3 From e2e37cced861b98de8c1a7c9c0d3a50d2d90e433 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 22 May 2024 21:25:21 +0200 Subject: Fix line endlings --- indra/newview/tests/llagentaccess_test.cpp | 582 ++--- indra/newview/tests/lllogininstance_test.cpp | 978 ++++---- indra/newview/tests/llsecapi_test.cpp | 266 +-- indra/newview/tests/llsechandler_basic_test.cpp | 2836 +++++++++++------------ indra/newview/tests/llslurl_test.cpp | 680 +++--- indra/newview/tests/llviewerassetstats_test.cpp | 1150 ++++----- indra/newview/tests/llviewerhelputil_test.cpp | 320 +-- indra/newview/tests/llviewernetwork_test.cpp | 900 +++---- indra/newview/tests/llworldmap_test.cpp | 1030 ++++---- indra/newview/tests/llworldmipmap_test.cpp | 330 +-- 10 files changed, 4536 insertions(+), 4536 deletions(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/llagentaccess_test.cpp b/indra/newview/tests/llagentaccess_test.cpp index 2c6d8b9724..6f5b3a9721 100644 --- a/indra/newview/tests/llagentaccess_test.cpp +++ b/indra/newview/tests/llagentaccess_test.cpp @@ -1,291 +1,291 @@ -/** - * @file llagentaccess_test.cpp - * @brief LLAgentAccess tests - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" -#include "../test/lltut.h" - -#include "../llagentaccess.h" - -#include "llcontrol.h" -#include "indra_constants.h" - -#include - -//---------------------------------------------------------------------------- -// Implementation of enough of LLControlGroup to support the tests: - -static U32 test_preferred_maturity = SIM_ACCESS_PG; - -LLControlGroup::LLControlGroup(const std::string& name) -: LLInstanceTracker(name) -{ -} - -LLControlGroup::~LLControlGroup() -{ -} - -// Implementation of just the LLControlGroup methods we requre -LLControlVariable* LLControlGroup::declareU32(const std::string& name, U32 initial_val, const std::string& comment, LLControlVariable::ePersist persist) -{ - test_preferred_maturity = initial_val; - return NULL; -} - -void LLControlGroup::setU32(std::string_view name, U32 val) -{ - test_preferred_maturity = val; -} - -U32 LLControlGroup::getU32(std::string_view name) -{ - return test_preferred_maturity; -} -//---------------------------------------------------------------------------- - -namespace tut -{ - struct agentaccess - { - }; - - typedef test_group agentaccess_t; - typedef agentaccess_t::object agentaccess_object_t; - tut::agentaccess_t tut_agentaccess("LLAgentAccess"); - - template<> template<> - void agentaccess_object_t::test<1>() - { - LLControlGroup cgr("test"); - cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); - LLAgentAccess aa(cgr); - - cgr.setU32("PreferredMaturity", SIM_ACCESS_PG); -#ifndef HACKED_GODLIKE_VIEWER - ensure("1 prefersPG", aa.prefersPG()); - ensure("1 prefersMature", !aa.prefersMature()); - ensure("1 prefersAdult", !aa.prefersAdult()); -#endif // HACKED_GODLIKE_VIEWER - - cgr.setU32("PreferredMaturity", SIM_ACCESS_MATURE); -#ifndef HACKED_GODLIKE_VIEWER - ensure("2 prefersPG", !aa.prefersPG()); - ensure("2 prefersMature", aa.prefersMature()); - ensure("2 prefersAdult", !aa.prefersAdult()); -#endif // HACKED_GODLIKE_VIEWER - - cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT); -#ifndef HACKED_GODLIKE_VIEWER - ensure("3 prefersPG", !aa.prefersPG()); - ensure("3 prefersMature", aa.prefersMature()); - ensure("3 prefersAdult", aa.prefersAdult()); -#endif // HACKED_GODLIKE_VIEWER - } - - template<> template<> - void agentaccess_object_t::test<2>() - { - LLControlGroup cgr("test"); - cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); - LLAgentAccess aa(cgr); - - // make sure default is PG -#ifndef HACKED_GODLIKE_VIEWER - ensure("1 isTeen", aa.isTeen()); - ensure("1 isMature", !aa.isMature()); - ensure("1 isAdult", !aa.isAdult()); -#endif // HACKED_GODLIKE_VIEWER - - // check the conversion routine -#ifndef HACKED_GODLIKE_VIEWER - ensure_equals("1 conversion", SIM_ACCESS_PG, aa.convertTextToMaturity('P')); - ensure_equals("2 conversion", SIM_ACCESS_MATURE, aa.convertTextToMaturity('M')); - ensure_equals("3 conversion", SIM_ACCESS_ADULT, aa.convertTextToMaturity('A')); - ensure_equals("4 conversion", SIM_ACCESS_MIN, aa.convertTextToMaturity('Q')); -#endif // HACKED_GODLIKE_VIEWER - - // now try the other method of setting it - PG - aa.setMaturity('P'); - ensure("2 isTeen", aa.isTeen()); -#ifndef HACKED_GODLIKE_VIEWER - ensure("2 isMature", !aa.isMature()); - ensure("2 isAdult", !aa.isAdult()); -#endif // HACKED_GODLIKE_VIEWER - - // Mature - aa.setMaturity('M'); -#ifndef HACKED_GODLIKE_VIEWER - ensure("3 isTeen", !aa.isTeen()); - ensure("3 isMature", aa.isMature()); - ensure("3 isAdult", !aa.isAdult()); -#endif // HACKED_GODLIKE_VIEWER - - // Adult - aa.setMaturity('A'); -#ifndef HACKED_GODLIKE_VIEWER - ensure("4 isTeen", !aa.isTeen()); - ensure("4 isMature", aa.isMature()); - ensure("4 isAdult", aa.isAdult()); -#endif // HACKED_GODLIKE_VIEWER - - } - - template<> template<> - void agentaccess_object_t::test<3>() - { - LLControlGroup cgr("test"); - cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); - LLAgentAccess aa(cgr); - -#ifndef HACKED_GODLIKE_VIEWER - ensure("starts normal", !aa.isGodlike()); -#endif // HACKED_GODLIKE_VIEWER - aa.setGodLevel(GOD_NOT); -#ifndef HACKED_GODLIKE_VIEWER - ensure("stays normal", !aa.isGodlike()); -#endif // HACKED_GODLIKE_VIEWER - aa.setGodLevel(GOD_FULL); -#ifndef HACKED_GODLIKE_VIEWER - ensure("sets full", aa.isGodlike()); -#endif // HACKED_GODLIKE_VIEWER - aa.setGodLevel(GOD_NOT); -#ifndef HACKED_GODLIKE_VIEWER - ensure("resets normal", !aa.isGodlike()); -#endif // HACKED_GODLIKE_VIEWER - aa.setAdminOverride(true); -#ifndef HACKED_GODLIKE_VIEWER - ensure("admin true", aa.getAdminOverride()); - ensure("overrides 1", aa.isGodlike()); -#endif // HACKED_GODLIKE_VIEWER - aa.setGodLevel(GOD_FULL); -#ifndef HACKED_GODLIKE_VIEWER - ensure("overrides 2", aa.isGodlike()); -#endif // HACKED_GODLIKE_VIEWER - aa.setAdminOverride(false); -#ifndef HACKED_GODLIKE_VIEWER - ensure("admin false", !aa.getAdminOverride()); - ensure("overrides 3", aa.isGodlike()); -#endif // HACKED_GODLIKE_VIEWER - } - - template<> template<> - void agentaccess_object_t::test<4>() - { - LLControlGroup cgr("test"); - cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); - LLAgentAccess aa(cgr); - -#ifndef HACKED_GODLIKE_VIEWER - ensure("1 pg to start", aa.wantsPGOnly()); - ensure("2 pg to start", !aa.canAccessMature()); - ensure("3 pg to start", !aa.canAccessAdult()); -#endif // HACKED_GODLIKE_VIEWER - - aa.setGodLevel(GOD_FULL); -#ifndef HACKED_GODLIKE_VIEWER - ensure("1 full god", !aa.wantsPGOnly()); - ensure("2 full god", aa.canAccessMature()); - ensure("3 full god", aa.canAccessAdult()); -#endif // HACKED_GODLIKE_VIEWER - - aa.setGodLevel(GOD_NOT); - aa.setAdminOverride(true); -#ifndef HACKED_GODLIKE_VIEWER - ensure("1 admin mode", !aa.wantsPGOnly()); - ensure("2 admin mode", aa.canAccessMature()); - ensure("3 admin mode", aa.canAccessAdult()); -#endif // HACKED_GODLIKE_VIEWER - - aa.setAdminOverride(false); - aa.setMaturity('M'); - // preferred is still pg by default -#ifndef HACKED_GODLIKE_VIEWER - ensure("1 mature pref pg", aa.wantsPGOnly()); - ensure("2 mature pref pg", !aa.canAccessMature()); - ensure("3 mature pref pg", !aa.canAccessAdult()); -#endif // HACKED_GODLIKE_VIEWER - - cgr.setU32("PreferredMaturity", SIM_ACCESS_MATURE); -#ifndef HACKED_GODLIKE_VIEWER - ensure("1 mature", !aa.wantsPGOnly()); - ensure("2 mature", aa.canAccessMature()); - ensure("3 mature", !aa.canAccessAdult()); -#endif // HACKED_GODLIKE_VIEWER - - cgr.setU32("PreferredMaturity", SIM_ACCESS_PG); -#ifndef HACKED_GODLIKE_VIEWER - ensure("1 mature pref pg", aa.wantsPGOnly()); - ensure("2 mature pref pg", !aa.canAccessMature()); - ensure("3 mature pref pg", !aa.canAccessAdult()); -#endif // HACKED_GODLIKE_VIEWER - - aa.setMaturity('A'); -#ifndef HACKED_GODLIKE_VIEWER - ensure("1 adult pref pg", aa.wantsPGOnly()); - ensure("2 adult pref pg", !aa.canAccessMature()); - ensure("3 adult pref pg", !aa.canAccessAdult()); -#endif // HACKED_GODLIKE_VIEWER - - cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT); -#ifndef HACKED_GODLIKE_VIEWER - ensure("1 adult", !aa.wantsPGOnly()); - ensure("2 adult", aa.canAccessMature()); - ensure("3 adult", aa.canAccessAdult()); -#endif // HACKED_GODLIKE_VIEWER - - // make sure that even if pref is high, if access is low we block access - // this shouldn't occur in real life but we want to be safe - cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT); - aa.setMaturity('P'); -#ifndef HACKED_GODLIKE_VIEWER - ensure("1 pref adult, actual pg", aa.wantsPGOnly()); - ensure("2 pref adult, actual pg", !aa.canAccessMature()); - ensure("3 pref adult, actual pg", !aa.canAccessAdult()); -#endif // HACKED_GODLIKE_VIEWER - - } - - template<> template<> - void agentaccess_object_t::test<5>() - { - LLControlGroup cgr("test"); - cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); - LLAgentAccess aa(cgr); - - cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT); - aa.setMaturity('M'); -#ifndef HACKED_GODLIKE_VIEWER - ensure("1 preferred maturity pegged to M when maturity is M", cgr.getU32("PreferredMaturity") == SIM_ACCESS_MATURE); -#endif // HACKED_GODLIKE_VIEWER - - aa.setMaturity('P'); -#ifndef HACKED_GODLIKE_VIEWER - ensure("1 preferred maturity pegged to P when maturity is P", cgr.getU32("PreferredMaturity") == SIM_ACCESS_PG); -#endif // HACKED_GODLIKE_VIEWER - } -} - - +/** + * @file llagentaccess_test.cpp + * @brief LLAgentAccess tests + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "../test/lltut.h" + +#include "../llagentaccess.h" + +#include "llcontrol.h" +#include "indra_constants.h" + +#include + +//---------------------------------------------------------------------------- +// Implementation of enough of LLControlGroup to support the tests: + +static U32 test_preferred_maturity = SIM_ACCESS_PG; + +LLControlGroup::LLControlGroup(const std::string& name) +: LLInstanceTracker(name) +{ +} + +LLControlGroup::~LLControlGroup() +{ +} + +// Implementation of just the LLControlGroup methods we requre +LLControlVariable* LLControlGroup::declareU32(const std::string& name, U32 initial_val, const std::string& comment, LLControlVariable::ePersist persist) +{ + test_preferred_maturity = initial_val; + return NULL; +} + +void LLControlGroup::setU32(std::string_view name, U32 val) +{ + test_preferred_maturity = val; +} + +U32 LLControlGroup::getU32(std::string_view name) +{ + return test_preferred_maturity; +} +//---------------------------------------------------------------------------- + +namespace tut +{ + struct agentaccess + { + }; + + typedef test_group agentaccess_t; + typedef agentaccess_t::object agentaccess_object_t; + tut::agentaccess_t tut_agentaccess("LLAgentAccess"); + + template<> template<> + void agentaccess_object_t::test<1>() + { + LLControlGroup cgr("test"); + cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); + LLAgentAccess aa(cgr); + + cgr.setU32("PreferredMaturity", SIM_ACCESS_PG); +#ifndef HACKED_GODLIKE_VIEWER + ensure("1 prefersPG", aa.prefersPG()); + ensure("1 prefersMature", !aa.prefersMature()); + ensure("1 prefersAdult", !aa.prefersAdult()); +#endif // HACKED_GODLIKE_VIEWER + + cgr.setU32("PreferredMaturity", SIM_ACCESS_MATURE); +#ifndef HACKED_GODLIKE_VIEWER + ensure("2 prefersPG", !aa.prefersPG()); + ensure("2 prefersMature", aa.prefersMature()); + ensure("2 prefersAdult", !aa.prefersAdult()); +#endif // HACKED_GODLIKE_VIEWER + + cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT); +#ifndef HACKED_GODLIKE_VIEWER + ensure("3 prefersPG", !aa.prefersPG()); + ensure("3 prefersMature", aa.prefersMature()); + ensure("3 prefersAdult", aa.prefersAdult()); +#endif // HACKED_GODLIKE_VIEWER + } + + template<> template<> + void agentaccess_object_t::test<2>() + { + LLControlGroup cgr("test"); + cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); + LLAgentAccess aa(cgr); + + // make sure default is PG +#ifndef HACKED_GODLIKE_VIEWER + ensure("1 isTeen", aa.isTeen()); + ensure("1 isMature", !aa.isMature()); + ensure("1 isAdult", !aa.isAdult()); +#endif // HACKED_GODLIKE_VIEWER + + // check the conversion routine +#ifndef HACKED_GODLIKE_VIEWER + ensure_equals("1 conversion", SIM_ACCESS_PG, aa.convertTextToMaturity('P')); + ensure_equals("2 conversion", SIM_ACCESS_MATURE, aa.convertTextToMaturity('M')); + ensure_equals("3 conversion", SIM_ACCESS_ADULT, aa.convertTextToMaturity('A')); + ensure_equals("4 conversion", SIM_ACCESS_MIN, aa.convertTextToMaturity('Q')); +#endif // HACKED_GODLIKE_VIEWER + + // now try the other method of setting it - PG + aa.setMaturity('P'); + ensure("2 isTeen", aa.isTeen()); +#ifndef HACKED_GODLIKE_VIEWER + ensure("2 isMature", !aa.isMature()); + ensure("2 isAdult", !aa.isAdult()); +#endif // HACKED_GODLIKE_VIEWER + + // Mature + aa.setMaturity('M'); +#ifndef HACKED_GODLIKE_VIEWER + ensure("3 isTeen", !aa.isTeen()); + ensure("3 isMature", aa.isMature()); + ensure("3 isAdult", !aa.isAdult()); +#endif // HACKED_GODLIKE_VIEWER + + // Adult + aa.setMaturity('A'); +#ifndef HACKED_GODLIKE_VIEWER + ensure("4 isTeen", !aa.isTeen()); + ensure("4 isMature", aa.isMature()); + ensure("4 isAdult", aa.isAdult()); +#endif // HACKED_GODLIKE_VIEWER + + } + + template<> template<> + void agentaccess_object_t::test<3>() + { + LLControlGroup cgr("test"); + cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); + LLAgentAccess aa(cgr); + +#ifndef HACKED_GODLIKE_VIEWER + ensure("starts normal", !aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER + aa.setGodLevel(GOD_NOT); +#ifndef HACKED_GODLIKE_VIEWER + ensure("stays normal", !aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER + aa.setGodLevel(GOD_FULL); +#ifndef HACKED_GODLIKE_VIEWER + ensure("sets full", aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER + aa.setGodLevel(GOD_NOT); +#ifndef HACKED_GODLIKE_VIEWER + ensure("resets normal", !aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER + aa.setAdminOverride(true); +#ifndef HACKED_GODLIKE_VIEWER + ensure("admin true", aa.getAdminOverride()); + ensure("overrides 1", aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER + aa.setGodLevel(GOD_FULL); +#ifndef HACKED_GODLIKE_VIEWER + ensure("overrides 2", aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER + aa.setAdminOverride(false); +#ifndef HACKED_GODLIKE_VIEWER + ensure("admin false", !aa.getAdminOverride()); + ensure("overrides 3", aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER + } + + template<> template<> + void agentaccess_object_t::test<4>() + { + LLControlGroup cgr("test"); + cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); + LLAgentAccess aa(cgr); + +#ifndef HACKED_GODLIKE_VIEWER + ensure("1 pg to start", aa.wantsPGOnly()); + ensure("2 pg to start", !aa.canAccessMature()); + ensure("3 pg to start", !aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER + + aa.setGodLevel(GOD_FULL); +#ifndef HACKED_GODLIKE_VIEWER + ensure("1 full god", !aa.wantsPGOnly()); + ensure("2 full god", aa.canAccessMature()); + ensure("3 full god", aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER + + aa.setGodLevel(GOD_NOT); + aa.setAdminOverride(true); +#ifndef HACKED_GODLIKE_VIEWER + ensure("1 admin mode", !aa.wantsPGOnly()); + ensure("2 admin mode", aa.canAccessMature()); + ensure("3 admin mode", aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER + + aa.setAdminOverride(false); + aa.setMaturity('M'); + // preferred is still pg by default +#ifndef HACKED_GODLIKE_VIEWER + ensure("1 mature pref pg", aa.wantsPGOnly()); + ensure("2 mature pref pg", !aa.canAccessMature()); + ensure("3 mature pref pg", !aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER + + cgr.setU32("PreferredMaturity", SIM_ACCESS_MATURE); +#ifndef HACKED_GODLIKE_VIEWER + ensure("1 mature", !aa.wantsPGOnly()); + ensure("2 mature", aa.canAccessMature()); + ensure("3 mature", !aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER + + cgr.setU32("PreferredMaturity", SIM_ACCESS_PG); +#ifndef HACKED_GODLIKE_VIEWER + ensure("1 mature pref pg", aa.wantsPGOnly()); + ensure("2 mature pref pg", !aa.canAccessMature()); + ensure("3 mature pref pg", !aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER + + aa.setMaturity('A'); +#ifndef HACKED_GODLIKE_VIEWER + ensure("1 adult pref pg", aa.wantsPGOnly()); + ensure("2 adult pref pg", !aa.canAccessMature()); + ensure("3 adult pref pg", !aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER + + cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT); +#ifndef HACKED_GODLIKE_VIEWER + ensure("1 adult", !aa.wantsPGOnly()); + ensure("2 adult", aa.canAccessMature()); + ensure("3 adult", aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER + + // make sure that even if pref is high, if access is low we block access + // this shouldn't occur in real life but we want to be safe + cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT); + aa.setMaturity('P'); +#ifndef HACKED_GODLIKE_VIEWER + ensure("1 pref adult, actual pg", aa.wantsPGOnly()); + ensure("2 pref adult, actual pg", !aa.canAccessMature()); + ensure("3 pref adult, actual pg", !aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER + + } + + template<> template<> + void agentaccess_object_t::test<5>() + { + LLControlGroup cgr("test"); + cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); + LLAgentAccess aa(cgr); + + cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT); + aa.setMaturity('M'); +#ifndef HACKED_GODLIKE_VIEWER + ensure("1 preferred maturity pegged to M when maturity is M", cgr.getU32("PreferredMaturity") == SIM_ACCESS_MATURE); +#endif // HACKED_GODLIKE_VIEWER + + aa.setMaturity('P'); +#ifndef HACKED_GODLIKE_VIEWER + ensure("1 preferred maturity pegged to P when maturity is P", cgr.getU32("PreferredMaturity") == SIM_ACCESS_PG); +#endif // HACKED_GODLIKE_VIEWER + } +} + + diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index a7184534c5..df0f006d02 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -1,489 +1,489 @@ -/** - * @file lllogininstance_test.cpp - * @brief Test for lllogininstance.cpp. - * - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -// Precompiled header -#include "../llviewerprecompiledheaders.h" -// Own header -#include "../llsecapi.h" -#include "../llviewernetwork.h" -#include "../lllogininstance.h" - - // Needed for Auth Test - #include "../llhasheduniqueid.h" - -// STL headers -// std headers -// external library headers -// other Linden headers -#include "../test/lltut.h" -#include "llevents.h" -#include "llnotificationsutil.h" -#include "lltrans.h" - -#if defined(LL_WINDOWS) -#pragma warning(disable: 4355) // using 'this' in base-class ctor initializer expr -#pragma warning(disable: 4702) // disable 'unreachable code' so we can safely use skip(). -#endif - -// Constants -const std::string VIEWERLOGIN_URI("viewerlogin_uri"); -const std::string VIEWERLOGIN_GRIDLABEL("viewerlogin_grid"); - -const std::string APPVIEWER_SERIALNUMBER("appviewer_serialno"); - -const std::string VIEWERLOGIN_CHANNEL("invalid_channel"); -const std::string VIEWERLOGIN_VERSION("invalid_version"); - -// Link seams. - -//----------------------------------------------------------------------------- -static LLEventStream gTestPump("test_pump"); - -#include "../llslurl.h" -#include "../llstartup.h" -LLSLURL LLStartUp::sStartSLURL; -LLSLURL& LLStartUp::getStartSLURL() { return sStartSLURL; } - -#include "lllogin.h" - -static std::string gLoginURI; -static LLSD gLoginCreds; -static bool gDisconnectCalled = false; - -#include "../llviewerwindow.h" -void LLViewerWindow::setShowProgress(bool show) {} -LLProgressView * LLViewerWindow::getProgressView(void) const { return 0; } - -LLViewerWindow* gViewerWindow; - -std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string) -{ - return std::string("test_trans"); -} - -class LLLogin::Impl -{ -}; -LLLogin::LLLogin() {} -LLLogin::~LLLogin() {} -LLEventPump& LLLogin::getEventPump() { return gTestPump; } -void LLLogin::connect(const std::string& uri, const LLSD& credentials) -{ - gLoginURI = uri; - gLoginCreds = credentials; -} - -void LLLogin::disconnect() -{ - gDisconnectCalled = true; -} - -LLSD LLCredential::getLoginParams() -{ - LLSD result = LLSD::emptyMap(); - - // legacy credential - result["passwd"] = "$1$testpasssd"; - result["first"] = "myfirst"; - result["last"] ="mylast"; - return result; -} -void LLCredential::identifierType(std::string &idType) -{ -} - -void LLCredential::authenticatorType(std::string &idType) -{ -} - -LLNotificationPtr LLNotificationsUtil::add(const std::string& name, - const LLSD& substitutions, - const LLSD& payload, - boost::function functor) -{ - return LLNotificationPtr((LLNotification*)NULL); -} - -LLNotificationPtr LLNotificationsUtil::add(const std::string& name, const LLSD& args) -{ - return LLNotificationPtr((LLNotification*)NULL); -} - -//----------------------------------------------------------------------------- -#include "../llviewernetwork.h" -LLGridManager::~LLGridManager() -{ -} - -bool LLGridManager::addGrid(LLSD& grid_data) -{ - return true; -} -LLGridManager::LLGridManager() -: - mIsInProductionGrid(false) -{ -} - -void LLGridManager::getLoginURIs(std::vector& uris) -{ - uris.push_back(VIEWERLOGIN_URI); -} - -void LLGridManager::addSystemGrid(const std::string& label, - const std::string& name, - const std::string& login, - const std::string& helper, - const std::string& login_page, - const std::string& update_url_base, - const std::string& web_profile_url, - const std::string& login_id) -{ -} -std::map LLGridManager::getKnownGrids() -{ - std::map result; - return result; -} - -void LLGridManager::setGridChoice(const std::string& grid_name) -{ -} - -bool LLGridManager::isInProductionGrid() -{ - return false; -} - -std::string LLGridManager::getSLURLBase(const std::string& grid_name) -{ - return "myslurl"; -} -std::string LLGridManager::getAppSLURLBase(const std::string& grid_name) -{ - return "myappslurl"; -} -std::string LLGridManager::getGridId(const std::string& grid) -{ - return std::string(); -} - -//----------------------------------------------------------------------------- -#include "../llviewercontrol.h" -LLControlGroup gSavedSettings("Global"); - -LLControlGroup::LLControlGroup(const std::string& name) : - LLInstanceTracker(name){} -LLControlGroup::~LLControlGroup() {} -void LLControlGroup::setBOOL(std::string_view name, bool val) {} -bool LLControlGroup::getBOOL(std::string_view name) { return false; } -F32 LLControlGroup::getF32(std::string_view name) { return 0.0f; } -U32 LLControlGroup::saveToFile(const std::string& filename, bool nondefault_only) { return 1; } -void LLControlGroup::setString(std::string_view name, const std::string& val) {} -std::string LLControlGroup::getString(std::string_view name) { return "test_string"; } -LLControlVariable* LLControlGroup::declareBOOL(const std::string& name, bool initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } -LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string &initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } - -#include "lluicolortable.h" -void LLUIColorTable::saveUserSettings(void)const {} - -//----------------------------------------------------------------------------- -#include "../llversioninfo.h" - -bool llHashedUniqueID(unsigned char* id) -{ - memcpy( id, "66666666666666666666666666666666", MD5HEX_STR_SIZE ); - return true; -} - -//----------------------------------------------------------------------------- -#include "../llappviewer.h" -void LLAppViewer::forceQuit(void) {} -bool LLAppViewer::isUpdaterMissing() { return true; } -bool LLAppViewer::waitForUpdater() { return false; } -LLAppViewer * LLAppViewer::sInstance = 0; - -//----------------------------------------------------------------------------- -#include "llnotifications.h" -#include "llfloaterreg.h" -static std::string gTOSType; -static LLEventPump * gTOSReplyPump = NULL; - -LLPointer gSecAPIHandler; - -//static -LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, bool focus) -{ - gTOSType = name; - gTOSReplyPump = &LLEventPumps::instance().obtain(key["reply_pump"]); - return NULL; -} - -//---------------------------------------------------------------------------- -#include "../llprogressview.h" -void LLProgressView::setText(std::string const &){} -void LLProgressView::setPercent(float){} -void LLProgressView::setMessage(std::string const &){} - -//----------------------------------------------------------------------------- -// LLNotifications -class MockNotifications : public LLNotificationsInterface -{ - boost::function mResponder; - int mAddedCount; - -public: - MockNotifications() : - mResponder(0), - mAddedCount(0) - { - } - - virtual ~MockNotifications() {} - - /* virtual */ LLNotificationPtr add( - const std::string& name, - const LLSD& substitutions, - const LLSD& payload, - LLNotificationFunctorRegistry::ResponseFunctor functor) - { - mResponder = functor; - mAddedCount++; - return LLNotificationPtr((LLNotification*)NULL); - } - - void sendYesResponse() - { - LLSD notification; - LLSD response; - response = 1; - mResponder(notification, response); - } - - void sendNoResponse() - { - LLSD notification; - LLSD response; - response = 2; - mResponder(notification, response); - } - - void sendBogusResponse() - { - LLSD notification; - LLSD response; - response = 666; - mResponder(notification, response); - } - - int addedCount() { return mAddedCount; } -}; - -S32 LLNotification::getSelectedOption(const LLSD& notification, const LLSD& response) -{ - return response.asInteger(); -} - -//----------------------------------------------------------------------------- -#include "../llmachineid.h" -unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {77,21,46,31,89,2}; - -S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len) -{ - memcpy(unique_id, gMACAddress, len); - return 1; -} -S32 LLMachineID::getLegacyID(unsigned char *unique_id, size_t len) -{ - return 0; -} -//----------------------------------------------------------------------------- -// misc -std::string xml_escape_string(const std::string& in) -{ - return in; -} - -/***************************************************************************** -* TUT -*****************************************************************************/ -namespace tut -{ - struct lllogininstance_data - { - lllogininstance_data() : logininstance(LLLoginInstance::getInstance()) - { - // Global initialization - gLoginURI.clear(); - gLoginCreds.clear(); - gDisconnectCalled = false; - - gTOSType = ""; // Set to invalid value. - gTOSReplyPump = 0; // clear the callback. - - - gSavedSettings.declareBOOL("NoInventoryLibrary", false, "", LLControlVariable::PERSIST_NO); - gSavedSettings.declareBOOL("ConnectAsGod", false, "", LLControlVariable::PERSIST_NO); - gSavedSettings.declareBOOL("UseDebugMenus", false, "", LLControlVariable::PERSIST_NO); - gSavedSettings.declareString("ClientSettingsFile", "test_settings.xml", "", LLControlVariable::PERSIST_NO); - gSavedSettings.declareString("NextLoginLocation", "", "", LLControlVariable::PERSIST_NO); - gSavedSettings.declareBOOL("LoginLastLocation", false, "", LLControlVariable::PERSIST_NO); - gSavedSettings.declareBOOL("CmdLineSkipUpdater", true, "", LLControlVariable::PERSIST_NO); - - LLSD authenticator = LLSD::emptyMap(); - LLSD identifier = LLSD::emptyMap(); - identifier["type"] = "agent"; - identifier["first_name"] = "testfirst"; - identifier["last_name"] = "testlast"; - authenticator["passwd"] = "testpass"; - agentCredential = new LLCredential(); - agentCredential->setCredentialData(identifier, authenticator); - - authenticator = LLSD::emptyMap(); - identifier = LLSD::emptyMap(); - identifier["type"] = "account"; - identifier["username"] = "testuser"; - authenticator["secret"] = "testsecret"; - accountCredential = new LLCredential(); - accountCredential->setCredentialData(identifier, authenticator); - - logininstance->setNotificationsInterface(¬ifications); - logininstance->setPlatformInfo("win", "1.3.5", "Windows Bogus Version 100.6.6.6"); - } - - LLLoginInstance* logininstance; - LLPointer agentCredential; - LLPointer accountCredential; - MockNotifications notifications; - }; - - typedef test_group lllogininstance_group; - typedef lllogininstance_group::object lllogininstance_object; - lllogininstance_group llsdmgr("LLLoginInstance"); - - template<> template<> - void lllogininstance_object::test<1>() - { - set_test_name("Test Simple Success And Disconnect"); - - // Test default connect. - logininstance->connect(agentCredential); - - ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); - - // Dummy success response. - LLSD response; - response["state"] = "online"; - response["change"] = "connect"; - response["progress"] = 1.0; - response["transfer_rate"] = 7; - response["data"] = "test_data"; - - gTestPump.post(response); - - ensure("Success response", logininstance->authSuccess()); - ensure_equals("Test Response Data", logininstance->getResponse().asString(), "test_data"); - - logininstance->disconnect(); - - ensure_equals("Called Login Module Disconnect", gDisconnectCalled, true); - - response.clear(); - response["state"] = "offline"; - response["change"] = "disconnect"; - response["progress"] = 0.0; - response["transfer_rate"] = 0; - response["data"] = "test_data"; - - gTestPump.post(response); - - ensure("Disconnected", !(logininstance->authSuccess())); - } - - template<> template<> - void lllogininstance_object::test<2>() - { - set_test_name("Test User TOS/Critical message Interaction"); - - const std::string test_uri = "testing-uri"; - - // Test default connect. - logininstance->connect(test_uri, agentCredential); - - // connect should call LLLogin::connect to init gLoginURI and gLoginCreds. - ensure_equals("Default connect uri", gLoginURI, "testing-uri"); - ensure_equals("Default for agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), false); - ensure_equals("Default for read critical", gLoginCreds["params"]["read_critical"].asBoolean(), false); - - // TOS failure response. - LLSD response; - response["state"] = "offline"; - response["change"] = "fail.login"; - response["progress"] = 0.0; - response["transfer_rate"] = 7; - response["data"]["reason"] = "tos"; - gTestPump.post(response); - - ensure_equals("TOS Dialog type", gTOSType, "message_tos"); - ensure("TOS callback given", gTOSReplyPump != 0); - gTOSReplyPump->post(false); // Call callback denying TOS. - ensure("No TOS, failed auth", logininstance->authFailure()); - - // Start again. - logininstance->connect(test_uri, agentCredential); - gTestPump.post(response); // Fail for tos again. - gTOSReplyPump->post(true); // Accept tos, should reconnect w/ agree_to_tos. - ensure_equals("Accepted agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), true); - ensure("Incomplete login status", !logininstance->authFailure() && !logininstance->authSuccess()); - - // Fail connection, attempt connect again. - // The new request should have reset agree to tos to default. - response["data"]["reason"] = "key"; // bad creds. - gTestPump.post(response); - ensure("TOS auth failure", logininstance->authFailure()); - - logininstance->connect(test_uri, agentCredential); - ensure_equals("Reset to default for agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), false); - - // Critical Message failure response. - logininstance->connect(test_uri, agentCredential); - response["data"]["reason"] = "critical"; // Change response to "critical message" - gTestPump.post(response); - - ensure_equals("TOS Dialog type", gTOSType, "message_critical"); - ensure("TOS callback given", gTOSReplyPump != 0); - gTOSReplyPump->post(true); - ensure_equals("Accepted read critical message", gLoginCreds["params"]["read_critical"].asBoolean(), true); - ensure("Incomplete login status", !logininstance->authFailure() && !logininstance->authSuccess()); - - // Fail then attempt new connection - response["data"]["reason"] = "key"; // bad creds. - gTestPump.post(response); - ensure("TOS auth failure", logininstance->authFailure()); - logininstance->connect(test_uri, agentCredential); - ensure_equals("Default for agree to tos", gLoginCreds["params"]["read_critical"].asBoolean(), false); - } -} +/** + * @file lllogininstance_test.cpp + * @brief Test for lllogininstance.cpp. + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +// Precompiled header +#include "../llviewerprecompiledheaders.h" +// Own header +#include "../llsecapi.h" +#include "../llviewernetwork.h" +#include "../lllogininstance.h" + + // Needed for Auth Test + #include "../llhasheduniqueid.h" + +// STL headers +// std headers +// external library headers +// other Linden headers +#include "../test/lltut.h" +#include "llevents.h" +#include "llnotificationsutil.h" +#include "lltrans.h" + +#if defined(LL_WINDOWS) +#pragma warning(disable: 4355) // using 'this' in base-class ctor initializer expr +#pragma warning(disable: 4702) // disable 'unreachable code' so we can safely use skip(). +#endif + +// Constants +const std::string VIEWERLOGIN_URI("viewerlogin_uri"); +const std::string VIEWERLOGIN_GRIDLABEL("viewerlogin_grid"); + +const std::string APPVIEWER_SERIALNUMBER("appviewer_serialno"); + +const std::string VIEWERLOGIN_CHANNEL("invalid_channel"); +const std::string VIEWERLOGIN_VERSION("invalid_version"); + +// Link seams. + +//----------------------------------------------------------------------------- +static LLEventStream gTestPump("test_pump"); + +#include "../llslurl.h" +#include "../llstartup.h" +LLSLURL LLStartUp::sStartSLURL; +LLSLURL& LLStartUp::getStartSLURL() { return sStartSLURL; } + +#include "lllogin.h" + +static std::string gLoginURI; +static LLSD gLoginCreds; +static bool gDisconnectCalled = false; + +#include "../llviewerwindow.h" +void LLViewerWindow::setShowProgress(bool show) {} +LLProgressView * LLViewerWindow::getProgressView(void) const { return 0; } + +LLViewerWindow* gViewerWindow; + +std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string) +{ + return std::string("test_trans"); +} + +class LLLogin::Impl +{ +}; +LLLogin::LLLogin() {} +LLLogin::~LLLogin() {} +LLEventPump& LLLogin::getEventPump() { return gTestPump; } +void LLLogin::connect(const std::string& uri, const LLSD& credentials) +{ + gLoginURI = uri; + gLoginCreds = credentials; +} + +void LLLogin::disconnect() +{ + gDisconnectCalled = true; +} + +LLSD LLCredential::getLoginParams() +{ + LLSD result = LLSD::emptyMap(); + + // legacy credential + result["passwd"] = "$1$testpasssd"; + result["first"] = "myfirst"; + result["last"] ="mylast"; + return result; +} +void LLCredential::identifierType(std::string &idType) +{ +} + +void LLCredential::authenticatorType(std::string &idType) +{ +} + +LLNotificationPtr LLNotificationsUtil::add(const std::string& name, + const LLSD& substitutions, + const LLSD& payload, + boost::function functor) +{ + return LLNotificationPtr((LLNotification*)NULL); +} + +LLNotificationPtr LLNotificationsUtil::add(const std::string& name, const LLSD& args) +{ + return LLNotificationPtr((LLNotification*)NULL); +} + +//----------------------------------------------------------------------------- +#include "../llviewernetwork.h" +LLGridManager::~LLGridManager() +{ +} + +bool LLGridManager::addGrid(LLSD& grid_data) +{ + return true; +} +LLGridManager::LLGridManager() +: + mIsInProductionGrid(false) +{ +} + +void LLGridManager::getLoginURIs(std::vector& uris) +{ + uris.push_back(VIEWERLOGIN_URI); +} + +void LLGridManager::addSystemGrid(const std::string& label, + const std::string& name, + const std::string& login, + const std::string& helper, + const std::string& login_page, + const std::string& update_url_base, + const std::string& web_profile_url, + const std::string& login_id) +{ +} +std::map LLGridManager::getKnownGrids() +{ + std::map result; + return result; +} + +void LLGridManager::setGridChoice(const std::string& grid_name) +{ +} + +bool LLGridManager::isInProductionGrid() +{ + return false; +} + +std::string LLGridManager::getSLURLBase(const std::string& grid_name) +{ + return "myslurl"; +} +std::string LLGridManager::getAppSLURLBase(const std::string& grid_name) +{ + return "myappslurl"; +} +std::string LLGridManager::getGridId(const std::string& grid) +{ + return std::string(); +} + +//----------------------------------------------------------------------------- +#include "../llviewercontrol.h" +LLControlGroup gSavedSettings("Global"); + +LLControlGroup::LLControlGroup(const std::string& name) : + LLInstanceTracker(name){} +LLControlGroup::~LLControlGroup() {} +void LLControlGroup::setBOOL(std::string_view name, bool val) {} +bool LLControlGroup::getBOOL(std::string_view name) { return false; } +F32 LLControlGroup::getF32(std::string_view name) { return 0.0f; } +U32 LLControlGroup::saveToFile(const std::string& filename, bool nondefault_only) { return 1; } +void LLControlGroup::setString(std::string_view name, const std::string& val) {} +std::string LLControlGroup::getString(std::string_view name) { return "test_string"; } +LLControlVariable* LLControlGroup::declareBOOL(const std::string& name, bool initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } +LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string &initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } + +#include "lluicolortable.h" +void LLUIColorTable::saveUserSettings(void)const {} + +//----------------------------------------------------------------------------- +#include "../llversioninfo.h" + +bool llHashedUniqueID(unsigned char* id) +{ + memcpy( id, "66666666666666666666666666666666", MD5HEX_STR_SIZE ); + return true; +} + +//----------------------------------------------------------------------------- +#include "../llappviewer.h" +void LLAppViewer::forceQuit(void) {} +bool LLAppViewer::isUpdaterMissing() { return true; } +bool LLAppViewer::waitForUpdater() { return false; } +LLAppViewer * LLAppViewer::sInstance = 0; + +//----------------------------------------------------------------------------- +#include "llnotifications.h" +#include "llfloaterreg.h" +static std::string gTOSType; +static LLEventPump * gTOSReplyPump = NULL; + +LLPointer gSecAPIHandler; + +//static +LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, bool focus) +{ + gTOSType = name; + gTOSReplyPump = &LLEventPumps::instance().obtain(key["reply_pump"]); + return NULL; +} + +//---------------------------------------------------------------------------- +#include "../llprogressview.h" +void LLProgressView::setText(std::string const &){} +void LLProgressView::setPercent(float){} +void LLProgressView::setMessage(std::string const &){} + +//----------------------------------------------------------------------------- +// LLNotifications +class MockNotifications : public LLNotificationsInterface +{ + boost::function mResponder; + int mAddedCount; + +public: + MockNotifications() : + mResponder(0), + mAddedCount(0) + { + } + + virtual ~MockNotifications() {} + + /* virtual */ LLNotificationPtr add( + const std::string& name, + const LLSD& substitutions, + const LLSD& payload, + LLNotificationFunctorRegistry::ResponseFunctor functor) + { + mResponder = functor; + mAddedCount++; + return LLNotificationPtr((LLNotification*)NULL); + } + + void sendYesResponse() + { + LLSD notification; + LLSD response; + response = 1; + mResponder(notification, response); + } + + void sendNoResponse() + { + LLSD notification; + LLSD response; + response = 2; + mResponder(notification, response); + } + + void sendBogusResponse() + { + LLSD notification; + LLSD response; + response = 666; + mResponder(notification, response); + } + + int addedCount() { return mAddedCount; } +}; + +S32 LLNotification::getSelectedOption(const LLSD& notification, const LLSD& response) +{ + return response.asInteger(); +} + +//----------------------------------------------------------------------------- +#include "../llmachineid.h" +unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {77,21,46,31,89,2}; + +S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len) +{ + memcpy(unique_id, gMACAddress, len); + return 1; +} +S32 LLMachineID::getLegacyID(unsigned char *unique_id, size_t len) +{ + return 0; +} +//----------------------------------------------------------------------------- +// misc +std::string xml_escape_string(const std::string& in) +{ + return in; +} + +/***************************************************************************** +* TUT +*****************************************************************************/ +namespace tut +{ + struct lllogininstance_data + { + lllogininstance_data() : logininstance(LLLoginInstance::getInstance()) + { + // Global initialization + gLoginURI.clear(); + gLoginCreds.clear(); + gDisconnectCalled = false; + + gTOSType = ""; // Set to invalid value. + gTOSReplyPump = 0; // clear the callback. + + + gSavedSettings.declareBOOL("NoInventoryLibrary", false, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("ConnectAsGod", false, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("UseDebugMenus", false, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareString("ClientSettingsFile", "test_settings.xml", "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareString("NextLoginLocation", "", "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("LoginLastLocation", false, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("CmdLineSkipUpdater", true, "", LLControlVariable::PERSIST_NO); + + LLSD authenticator = LLSD::emptyMap(); + LLSD identifier = LLSD::emptyMap(); + identifier["type"] = "agent"; + identifier["first_name"] = "testfirst"; + identifier["last_name"] = "testlast"; + authenticator["passwd"] = "testpass"; + agentCredential = new LLCredential(); + agentCredential->setCredentialData(identifier, authenticator); + + authenticator = LLSD::emptyMap(); + identifier = LLSD::emptyMap(); + identifier["type"] = "account"; + identifier["username"] = "testuser"; + authenticator["secret"] = "testsecret"; + accountCredential = new LLCredential(); + accountCredential->setCredentialData(identifier, authenticator); + + logininstance->setNotificationsInterface(¬ifications); + logininstance->setPlatformInfo("win", "1.3.5", "Windows Bogus Version 100.6.6.6"); + } + + LLLoginInstance* logininstance; + LLPointer agentCredential; + LLPointer accountCredential; + MockNotifications notifications; + }; + + typedef test_group lllogininstance_group; + typedef lllogininstance_group::object lllogininstance_object; + lllogininstance_group llsdmgr("LLLoginInstance"); + + template<> template<> + void lllogininstance_object::test<1>() + { + set_test_name("Test Simple Success And Disconnect"); + + // Test default connect. + logininstance->connect(agentCredential); + + ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); + + // Dummy success response. + LLSD response; + response["state"] = "online"; + response["change"] = "connect"; + response["progress"] = 1.0; + response["transfer_rate"] = 7; + response["data"] = "test_data"; + + gTestPump.post(response); + + ensure("Success response", logininstance->authSuccess()); + ensure_equals("Test Response Data", logininstance->getResponse().asString(), "test_data"); + + logininstance->disconnect(); + + ensure_equals("Called Login Module Disconnect", gDisconnectCalled, true); + + response.clear(); + response["state"] = "offline"; + response["change"] = "disconnect"; + response["progress"] = 0.0; + response["transfer_rate"] = 0; + response["data"] = "test_data"; + + gTestPump.post(response); + + ensure("Disconnected", !(logininstance->authSuccess())); + } + + template<> template<> + void lllogininstance_object::test<2>() + { + set_test_name("Test User TOS/Critical message Interaction"); + + const std::string test_uri = "testing-uri"; + + // Test default connect. + logininstance->connect(test_uri, agentCredential); + + // connect should call LLLogin::connect to init gLoginURI and gLoginCreds. + ensure_equals("Default connect uri", gLoginURI, "testing-uri"); + ensure_equals("Default for agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), false); + ensure_equals("Default for read critical", gLoginCreds["params"]["read_critical"].asBoolean(), false); + + // TOS failure response. + LLSD response; + response["state"] = "offline"; + response["change"] = "fail.login"; + response["progress"] = 0.0; + response["transfer_rate"] = 7; + response["data"]["reason"] = "tos"; + gTestPump.post(response); + + ensure_equals("TOS Dialog type", gTOSType, "message_tos"); + ensure("TOS callback given", gTOSReplyPump != 0); + gTOSReplyPump->post(false); // Call callback denying TOS. + ensure("No TOS, failed auth", logininstance->authFailure()); + + // Start again. + logininstance->connect(test_uri, agentCredential); + gTestPump.post(response); // Fail for tos again. + gTOSReplyPump->post(true); // Accept tos, should reconnect w/ agree_to_tos. + ensure_equals("Accepted agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), true); + ensure("Incomplete login status", !logininstance->authFailure() && !logininstance->authSuccess()); + + // Fail connection, attempt connect again. + // The new request should have reset agree to tos to default. + response["data"]["reason"] = "key"; // bad creds. + gTestPump.post(response); + ensure("TOS auth failure", logininstance->authFailure()); + + logininstance->connect(test_uri, agentCredential); + ensure_equals("Reset to default for agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), false); + + // Critical Message failure response. + logininstance->connect(test_uri, agentCredential); + response["data"]["reason"] = "critical"; // Change response to "critical message" + gTestPump.post(response); + + ensure_equals("TOS Dialog type", gTOSType, "message_critical"); + ensure("TOS callback given", gTOSReplyPump != 0); + gTOSReplyPump->post(true); + ensure_equals("Accepted read critical message", gLoginCreds["params"]["read_critical"].asBoolean(), true); + ensure("Incomplete login status", !logininstance->authFailure() && !logininstance->authSuccess()); + + // Fail then attempt new connection + response["data"]["reason"] = "key"; // bad creds. + gTestPump.post(response); + ensure("TOS auth failure", logininstance->authFailure()); + logininstance->connect(test_uri, agentCredential); + ensure_equals("Default for agree to tos", gLoginCreds["params"]["read_critical"].asBoolean(), false); + } +} diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp index 7a09b1198c..1a2fa7d8f6 100644 --- a/indra/newview/tests/llsecapi_test.cpp +++ b/indra/newview/tests/llsecapi_test.cpp @@ -1,133 +1,133 @@ -/** - * @file llsecapi_test.cpp - * @author Roxie - * @date 2009-02-10 - * @brief Test the sec api functionality - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#include "../llviewerprecompiledheaders.h" -#include "../llviewernetwork.h" -#include "../test/lltut.h" -#include "../llsecapi.h" -#include "../llsechandler_basic.h" -#include "../../llxml/llcontrol.h" - - -//---------------------------------------------------------------------------- -// Mock objects for the dependencies of the code we're testing - -LLControlGroup::LLControlGroup(const std::string& name) -: LLInstanceTracker(name) {} -LLControlGroup::~LLControlGroup() {} -LLControlVariable* LLControlGroup::declareString(const std::string& name, - const std::string& initial_val, - const std::string& comment, - LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(std::string_view name, const std::string& val){} -std::string LLControlGroup::getString(std::string_view name) -{ - return ""; -} - - -LLControlGroup gSavedSettings("test"); - -LLSecAPIBasicHandler::LLSecAPIBasicHandler() {} -void LLSecAPIBasicHandler::init() {} -LLSecAPIBasicHandler::~LLSecAPIBasicHandler() {} -LLPointer LLSecAPIBasicHandler::getCertificate(const std::string& pem_cert) { return NULL; } -LLPointer LLSecAPIBasicHandler::getCertificate(X509* openssl_cert) { return NULL; } -LLPointer LLSecAPIBasicHandler::getCertificateChain(X509_STORE_CTX* chain) { return NULL; } -LLPointer LLSecAPIBasicHandler::getCertificateStore(const std::string& store_id) { return NULL; } -void LLSecAPIBasicHandler::setProtectedData(const std::string& data_type, const std::string& data_id, const LLSD& data) {} -void LLSecAPIBasicHandler::addToProtectedMap(const std::string& data_type, const std::string& data_id, const std::string& map_elem, const LLSD& data) {} -void LLSecAPIBasicHandler::removeFromProtectedMap(const std::string& data_type, const std::string& data_id, const std::string& map_elem) {} -void LLSecAPIBasicHandler::syncProtectedMap() {} -LLSD LLSecAPIBasicHandler::getProtectedData(const std::string& data_type, const std::string& data_id) { return LLSD(); } -void LLSecAPIBasicHandler::deleteProtectedData(const std::string& data_type, const std::string& data_id) {} -LLPointer LLSecAPIBasicHandler::createCredential(const std::string& grid, const LLSD& identifier, const LLSD& authenticator) { return NULL; } -LLPointer LLSecAPIBasicHandler::loadCredential(const std::string& grid) { return NULL; } -void LLSecAPIBasicHandler::saveCredential(LLPointer cred, bool save_authenticator) {} -void LLSecAPIBasicHandler::deleteCredential(LLPointer cred) {} -bool LLSecAPIBasicHandler::hasCredentialMap(const std::string& storage, const std::string& grid) { return false; } -bool LLSecAPIBasicHandler::emptyCredentialMap(const std::string& storage, const std::string& grid) { return false; } -void LLSecAPIBasicHandler::loadCredentialMap(const std::string& storage, const std::string& grid, credential_map_t& credential_map) {} -LLPointer LLSecAPIBasicHandler::loadFromCredentialMap(const std::string& storage, const std::string& grid, const std::string& userkey) { return NULL; } -void LLSecAPIBasicHandler::addToCredentialMap(const std::string& storage, LLPointer cred, bool save_authenticator) {} -void LLSecAPIBasicHandler::removeFromCredentialMap(const std::string& storage, LLPointer cred) {} -void LLSecAPIBasicHandler::removeFromCredentialMap(const std::string& storage, const std::string& grid, const std::string& userkey) {} -void LLSecAPIBasicHandler::removeCredentialMap(const std::string& storage, const std::string& grid) {} - -// ------------------------------------------------------------------------------------------- -// TUT -// ------------------------------------------------------------------------------------------- -namespace tut -{ - // Test wrapper declaration : wrapping nothing for the moment - struct secapiTest - { - - secapiTest() - { - } - ~secapiTest() - { - } - }; - - // Tut templating thingamagic: test group, object and test instance - typedef test_group secapiTestFactory; - typedef secapiTestFactory::object secapiTestObject; - tut::secapiTestFactory tut_test("LLSecAPI"); - - // --------------------------------------------------------------------------------------- - // Test functions - // --------------------------------------------------------------------------------------- - // registration - template<> template<> - void secapiTestObject::test<1>() - { - // retrieve an unknown handler - - ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr); - LLPointer test1_handler = new LLSecAPIBasicHandler(); - registerSecHandler("sectest1", test1_handler); - ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr); - LLPointer retrieved_test1_handler = getSecHandler("sectest1"); - ensure("Retrieved sectest1 handler should be the same", - retrieved_test1_handler == test1_handler); - - // insert a second handler - LLPointer test2_handler = new LLSecAPIBasicHandler(); - registerSecHandler("sectest2", test2_handler); - ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr); - retrieved_test1_handler = getSecHandler("sectest1"); - ensure("Retrieved sectest1 handler should be the same", - retrieved_test1_handler == test1_handler); - - LLPointer retrieved_test2_handler = getSecHandler("sectest2"); - ensure("Retrieved sectest1 handler should be the same", - retrieved_test2_handler == test2_handler); - - } -} +/** + * @file llsecapi_test.cpp + * @author Roxie + * @date 2009-02-10 + * @brief Test the sec api functionality + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "../llviewerprecompiledheaders.h" +#include "../llviewernetwork.h" +#include "../test/lltut.h" +#include "../llsecapi.h" +#include "../llsechandler_basic.h" +#include "../../llxml/llcontrol.h" + + +//---------------------------------------------------------------------------- +// Mock objects for the dependencies of the code we're testing + +LLControlGroup::LLControlGroup(const std::string& name) +: LLInstanceTracker(name) {} +LLControlGroup::~LLControlGroup() {} +LLControlVariable* LLControlGroup::declareString(const std::string& name, + const std::string& initial_val, + const std::string& comment, + LLControlVariable::ePersist persist) {return NULL;} +void LLControlGroup::setString(std::string_view name, const std::string& val){} +std::string LLControlGroup::getString(std::string_view name) +{ + return ""; +} + + +LLControlGroup gSavedSettings("test"); + +LLSecAPIBasicHandler::LLSecAPIBasicHandler() {} +void LLSecAPIBasicHandler::init() {} +LLSecAPIBasicHandler::~LLSecAPIBasicHandler() {} +LLPointer LLSecAPIBasicHandler::getCertificate(const std::string& pem_cert) { return NULL; } +LLPointer LLSecAPIBasicHandler::getCertificate(X509* openssl_cert) { return NULL; } +LLPointer LLSecAPIBasicHandler::getCertificateChain(X509_STORE_CTX* chain) { return NULL; } +LLPointer LLSecAPIBasicHandler::getCertificateStore(const std::string& store_id) { return NULL; } +void LLSecAPIBasicHandler::setProtectedData(const std::string& data_type, const std::string& data_id, const LLSD& data) {} +void LLSecAPIBasicHandler::addToProtectedMap(const std::string& data_type, const std::string& data_id, const std::string& map_elem, const LLSD& data) {} +void LLSecAPIBasicHandler::removeFromProtectedMap(const std::string& data_type, const std::string& data_id, const std::string& map_elem) {} +void LLSecAPIBasicHandler::syncProtectedMap() {} +LLSD LLSecAPIBasicHandler::getProtectedData(const std::string& data_type, const std::string& data_id) { return LLSD(); } +void LLSecAPIBasicHandler::deleteProtectedData(const std::string& data_type, const std::string& data_id) {} +LLPointer LLSecAPIBasicHandler::createCredential(const std::string& grid, const LLSD& identifier, const LLSD& authenticator) { return NULL; } +LLPointer LLSecAPIBasicHandler::loadCredential(const std::string& grid) { return NULL; } +void LLSecAPIBasicHandler::saveCredential(LLPointer cred, bool save_authenticator) {} +void LLSecAPIBasicHandler::deleteCredential(LLPointer cred) {} +bool LLSecAPIBasicHandler::hasCredentialMap(const std::string& storage, const std::string& grid) { return false; } +bool LLSecAPIBasicHandler::emptyCredentialMap(const std::string& storage, const std::string& grid) { return false; } +void LLSecAPIBasicHandler::loadCredentialMap(const std::string& storage, const std::string& grid, credential_map_t& credential_map) {} +LLPointer LLSecAPIBasicHandler::loadFromCredentialMap(const std::string& storage, const std::string& grid, const std::string& userkey) { return NULL; } +void LLSecAPIBasicHandler::addToCredentialMap(const std::string& storage, LLPointer cred, bool save_authenticator) {} +void LLSecAPIBasicHandler::removeFromCredentialMap(const std::string& storage, LLPointer cred) {} +void LLSecAPIBasicHandler::removeFromCredentialMap(const std::string& storage, const std::string& grid, const std::string& userkey) {} +void LLSecAPIBasicHandler::removeCredentialMap(const std::string& storage, const std::string& grid) {} + +// ------------------------------------------------------------------------------------------- +// TUT +// ------------------------------------------------------------------------------------------- +namespace tut +{ + // Test wrapper declaration : wrapping nothing for the moment + struct secapiTest + { + + secapiTest() + { + } + ~secapiTest() + { + } + }; + + // Tut templating thingamagic: test group, object and test instance + typedef test_group secapiTestFactory; + typedef secapiTestFactory::object secapiTestObject; + tut::secapiTestFactory tut_test("LLSecAPI"); + + // --------------------------------------------------------------------------------------- + // Test functions + // --------------------------------------------------------------------------------------- + // registration + template<> template<> + void secapiTestObject::test<1>() + { + // retrieve an unknown handler + + ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr); + LLPointer test1_handler = new LLSecAPIBasicHandler(); + registerSecHandler("sectest1", test1_handler); + ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr); + LLPointer retrieved_test1_handler = getSecHandler("sectest1"); + ensure("Retrieved sectest1 handler should be the same", + retrieved_test1_handler == test1_handler); + + // insert a second handler + LLPointer test2_handler = new LLSecAPIBasicHandler(); + registerSecHandler("sectest2", test2_handler); + ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr); + retrieved_test1_handler = getSecHandler("sectest1"); + ensure("Retrieved sectest1 handler should be the same", + retrieved_test1_handler == test1_handler); + + LLPointer retrieved_test2_handler = getSecHandler("sectest2"); + ensure("Retrieved sectest1 handler should be the same", + retrieved_test2_handler == test2_handler); + + } +} diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp index b1eccddff8..4f32299b0d 100644 --- a/indra/newview/tests/llsechandler_basic_test.cpp +++ b/indra/newview/tests/llsechandler_basic_test.cpp @@ -1,1418 +1,1418 @@ -/** - * @file llsechandler_basic_test.cpp - * @author Roxie - * @date 2009-02-10 - * @brief Test the 'basic' sec handler functions - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#include "../llviewerprecompiledheaders.h" -#include "../test/lltut.h" -#include "../llsecapi.h" -#include "../llsechandler_basic.h" -#include "../../llxml/llcontrol.h" -#include "../llviewernetwork.h" -#include "lluuid.h" -#include "lldate.h" -#include "llxorcipher.h" -#include "apr_base64.h" -#include -#include -#include -#include -#include -#include -#include "llxorcipher.h" -#include -#include -#include -#include -#include -#include -#include -#include "../llmachineid.h" - -#define ensure_throws(str, exc_type, cert, func, ...) \ -try \ -{ \ -func(__VA_ARGS__); \ -fail("throws, " str); \ -} \ -catch(exc_type& except) \ -{ \ -LLSD cert_data; \ -cert->getLLSD(cert_data); \ -ensure("Exception cert is incorrect for " str, valueCompareLLSD(except.getCertData(), cert_data)); \ -} - -extern bool _cert_hostname_wildcard_match(const std::string& hostname, const std::string& wildcard_string); - -//---------------------------------------------------------------------------- -// Mock objects for the dependencies of the code we're testing - -std::string gFirstName; -std::string gLastName; -LLControlGroup::LLControlGroup(const std::string& name) -: LLInstanceTracker(name) {} -LLControlGroup::~LLControlGroup() {} -LLControlVariable* LLControlGroup::declareString(const std::string& name, - const std::string& initial_val, - const std::string& comment, - LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(std::string_view name, const std::string& val){} -std::string LLControlGroup::getString(std::string_view name) -{ - - if (name == "FirstName") - return gFirstName; - else if (name == "LastName") - return gLastName; - return ""; -} - -// Stub for --no-verify-ssl-cert -bool LLControlGroup::getBOOL(std::string_view name) { return false; } - -LLSD LLCredential::getLoginParams() -{ - LLSD result = LLSD::emptyMap(); - - // legacy credential - result["passwd"] = "$1$testpasssd"; - result["first"] = "myfirst"; - result["last"] ="mylast"; - return result; -} - -void LLCredential::identifierType(std::string &idType) -{ -} - -void LLCredential::authenticatorType(std::string &idType) -{ -} - - -LLControlGroup gSavedSettings("test"); -unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {77,21,46,31,89,2}; - - -S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len) -{ - memcpy(unique_id, gMACAddress, len); - return 1; -} -S32 LLMachineID::getLegacyID(unsigned char *unique_id, size_t len) -{ - return 0; -} -S32 LLMachineID::init() { return 1; } - - -LLCertException::LLCertException(const LLSD& cert_data, const std::string& msg) - : LLException(msg), - mCertData(cert_data) -{ - LL_WARNS("SECAPI") << "Certificate Error: " << msg << LL_ENDL; -} - - -// ------------------------------------------------------------------------------------------- -// TUT -// ------------------------------------------------------------------------------------------- -namespace tut -{ - const std::string mPemTestCert( - "Certificate:\n" - " Data:\n" - " Version: 3 (0x2)\n" - " Serial Number:\n" - " 04:00:00:00:00:01:15:4b:5a:c3:94\n" - " Signature Algorithm: sha1WithRSAEncryption\n" - " Issuer: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA\n" - " Validity\n" - " Not Before: Sep 1 12:00:00 1998 GMT\n" - " Not After : Jan 28 12:00:00 2028 GMT\n" - " Subject: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA\n" - " Subject Public Key Info:\n" - " Public Key Algorithm: rsaEncryption\n" - " Public-Key: (2048 bit)\n" - " Modulus:\n" - " 00:da:0e:e6:99:8d:ce:a3:e3:4f:8a:7e:fb:f1:8b:\n" - " 83:25:6b:ea:48:1f:f1:2a:b0:b9:95:11:04:bd:f0:\n" - " 63:d1:e2:67:66:cf:1c:dd:cf:1b:48:2b:ee:8d:89:\n" - " 8e:9a:af:29:80:65:ab:e9:c7:2d:12:cb:ab:1c:4c:\n" - " 70:07:a1:3d:0a:30:cd:15:8d:4f:f8:dd:d4:8c:50:\n" - " 15:1c:ef:50:ee:c4:2e:f7:fc:e9:52:f2:91:7d:e0:\n" - " 6d:d5:35:30:8e:5e:43:73:f2:41:e9:d5:6a:e3:b2:\n" - " 89:3a:56:39:38:6f:06:3c:88:69:5b:2a:4d:c5:a7:\n" - " 54:b8:6c:89:cc:9b:f9:3c:ca:e5:fd:89:f5:12:3c:\n" - " 92:78:96:d6:dc:74:6e:93:44:61:d1:8d:c7:46:b2:\n" - " 75:0e:86:e8:19:8a:d5:6d:6c:d5:78:16:95:a2:e9:\n" - " c8:0a:38:eb:f2:24:13:4f:73:54:93:13:85:3a:1b:\n" - " bc:1e:34:b5:8b:05:8c:b9:77:8b:b1:db:1f:20:91:\n" - " ab:09:53:6e:90:ce:7b:37:74:b9:70:47:91:22:51:\n" - " 63:16:79:ae:b1:ae:41:26:08:c8:19:2b:d1:46:aa:\n" - " 48:d6:64:2a:d7:83:34:ff:2c:2a:c1:6c:19:43:4a:\n" - " 07:85:e7:d3:7c:f6:21:68:ef:ea:f2:52:9f:7f:93:\n" - " 90:cf\n" - " Exponent: 65537 (0x10001)\n" - " X509v3 extensions:\n" - " X509v3 Key Usage: critical\n" - " Certificate Sign, CRL Sign\n" - " X509v3 Basic Constraints: critical\n" - " CA:TRUE\n" - " X509v3 Subject Key Identifier: \n" - " 60:7B:66:1A:45:0D:97:CA:89:50:2F:7D:04:CD:34:A8:FF:FC:FD:4B\n" - " Signature Algorithm: sha1WithRSAEncryption\n" - " d6:73:e7:7c:4f:76:d0:8d:bf:ec:ba:a2:be:34:c5:28:32:b5:\n" - " 7c:fc:6c:9c:2c:2b:bd:09:9e:53:bf:6b:5e:aa:11:48:b6:e5:\n" - " 08:a3:b3:ca:3d:61:4d:d3:46:09:b3:3e:c3:a0:e3:63:55:1b:\n" - " f2:ba:ef:ad:39:e1:43:b9:38:a3:e6:2f:8a:26:3b:ef:a0:50:\n" - " 56:f9:c6:0a:fd:38:cd:c4:0b:70:51:94:97:98:04:df:c3:5f:\n" - " 94:d5:15:c9:14:41:9c:c4:5d:75:64:15:0d:ff:55:30:ec:86:\n" - " 8f:ff:0d:ef:2c:b9:63:46:f6:aa:fc:df:bc:69:fd:2e:12:48:\n" - " 64:9a:e0:95:f0:a6:ef:29:8f:01:b1:15:b5:0c:1d:a5:fe:69:\n" - " 2c:69:24:78:1e:b3:a7:1c:71:62:ee:ca:c8:97:ac:17:5d:8a:\n" - " c2:f8:47:86:6e:2a:c4:56:31:95:d0:67:89:85:2b:f9:6c:a6:\n" - " 5d:46:9d:0c:aa:82:e4:99:51:dd:70:b7:db:56:3d:61:e4:6a:\n" - " e1:5c:d6:f6:fe:3d:de:41:cc:07:ae:63:52:bf:53:53:f4:2b:\n" - " e9:c7:fd:b6:f7:82:5f:85:d2:41:18:db:81:b3:04:1c:c5:1f:\n" - " a4:80:6f:15:20:c9:de:0c:88:0a:1d:d6:66:55:e2:fc:48:c9:\n" - " 29:26:69:e0\n" - "-----BEGIN CERTIFICATE-----\n" - "MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG\n" - "A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv\n" - "b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw\n" - "MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i\n" - "YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT\n" - "aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ\n" - "jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp\n" - "xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp\n" - "1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG\n" - "snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ\n" - "U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8\n" - "9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E\n" - "BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B\n" - "AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz\n" - "yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE\n" - "38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP\n" - "AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad\n" - "DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME\n" - "HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==\n" - "-----END CERTIFICATE-----\n" - ); - - /* - * The following certificates were generated using the instructions at - * https://jamielinux.com/docs/openssl-certificate-authority/sign-server-and-client-certificates.html - * with the exception that the server certificate has a longer expiration time, and the full text - * expansion was included in the certificates. - */ - const std::string mPemRootCert( - "Certificate:\n" - " Data:\n" - " Version: 3 (0x2)\n" - " Serial Number:\n" - " 82:2f:8f:eb:8d:06:24:b0\n" - " Signature Algorithm: sha256WithRSAEncryption\n" - " Issuer: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" - " Validity\n" - " Not Before: May 22 22:19:45 2018 GMT\n" - " Not After : May 17 22:19:45 2038 GMT\n" - " Subject: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" - " Subject Public Key Info:\n" - " Public Key Algorithm: rsaEncryption\n" - " Public-Key: (4096 bit)\n" - " Modulus:\n" - " 00:bd:e0:79:dd:3b:a6:ac:87:d0:39:f0:58:c7:a4:\n" - " 42:42:f6:5f:93:b0:36:04:b5:e2:d5:f7:2a:c0:6c:\n" - " a0:13:d2:1e:02:81:57:02:50:4c:57:b7:ef:27:9e:\n" - " f6:f1:f1:30:30:72:1e:57:34:e5:3f:82:3c:21:c4:\n" - " 66:d2:73:63:6c:91:e6:dd:49:9e:9c:b1:34:6a:81:\n" - " 45:a1:6e:c4:50:28:f2:d8:e3:fe:80:2f:83:aa:28:\n" - " 91:b4:8c:57:c9:f1:16:d9:0c:87:3c:25:80:a0:81:\n" - " 8d:71:f2:96:e2:16:f1:97:c4:b0:d8:53:bb:13:6c:\n" - " 73:54:2f:29:94:85:cf:86:6e:75:71:ad:39:e3:fc:\n" - " 39:12:53:93:1c:ce:39:e0:33:da:49:b7:3d:af:b0:\n" - " 37:ce:77:09:03:27:32:70:c0:9c:7f:9c:89:ce:90:\n" - " 45:b0:7d:94:8b:ff:13:27:ba:88:7f:ae:c4:aa:73:\n" - " d5:47:b8:87:69:89:80:0c:c1:22:18:78:c2:0d:47:\n" - " d9:10:ff:80:79:0d:46:71:ec:d9:ba:c9:f3:77:fd:\n" - " 92:6d:1f:0f:d9:54:18:6d:f6:72:24:5c:5c:3d:43:\n" - " 49:35:3e:1c:28:de:7e:44:dc:29:c3:9f:62:04:46:\n" - " aa:c4:e6:69:6a:15:f8:e3:74:1c:14:e9:f4:97:7c:\n" - " 30:6c:d4:28:fc:2a:0e:1d:6d:39:2e:1d:f9:17:43:\n" - " 35:5d:23:e7:ba:e3:a8:e9:97:6b:3c:3e:23:ef:d8:\n" - " bc:fb:7a:57:37:39:93:59:03:fc:78:ca:b1:31:ef:\n" - " 26:19:ed:56:e1:63:c3:ad:99:80:5b:47:b5:03:35:\n" - " 5f:fe:6a:a6:21:63:ec:50:fb:4e:c9:f9:ae:a5:66:\n" - " d0:55:33:8d:e6:c5:50:5a:c6:8f:5c:34:45:a7:72:\n" - " da:50:f6:66:4c:19:f5:d1:e4:fb:11:8b:a1:b5:4e:\n" - " 09:43:81:3d:39:28:86:3b:fe:07:28:97:02:b5:3a:\n" - " 07:5f:4a:20:80:1a:7d:a4:8c:f7:6c:f6:c5:9b:f6:\n" - " 61:e5:c7:b0:c3:d5:58:38:7b:bb:47:1e:34:d6:16:\n" - " 55:c5:d2:6c:b0:93:77:b1:90:69:06:b1:53:cb:1b:\n" - " 84:71:cf:b8:87:1b:1e:44:35:b4:2b:bb:04:59:58:\n" - " 0b:e8:93:d8:ae:21:9b:b1:1c:89:30:ae:11:80:77:\n" - " cc:16:f3:d6:35:ed:a1:b3:70:b3:4f:cd:a1:56:99:\n" - " ee:0e:c0:00:a4:09:70:c3:5b:0b:be:a1:07:18:dd:\n" - " c6:f4:6d:8b:58:bc:f9:bb:4b:01:2c:f6:cc:2c:9b:\n" - " 87:0e:b1:4f:9c:10:be:fc:45:e2:a4:ec:7e:fc:ff:\n" - " 45:b8:53\n" - " Exponent: 65537 (0x10001)\n" - " X509v3 extensions:\n" - " X509v3 Subject Key Identifier: \n" - " 8A:22:C6:9C:2E:11:F3:40:0C:CE:82:0C:22:59:FF:F8:7F:D0:B9:13\n" - " X509v3 Authority Key Identifier: \n" - " keyid:8A:22:C6:9C:2E:11:F3:40:0C:CE:82:0C:22:59:FF:F8:7F:D0:B9:13\n" - "\n" - " X509v3 Basic Constraints: critical\n" - " CA:TRUE\n" - " X509v3 Key Usage: critical\n" - " Digital Signature, Certificate Sign, CRL Sign\n" - " Signature Algorithm: sha256WithRSAEncryption\n" - " b3:cb:33:eb:0e:02:64:f4:55:9a:3d:03:9a:cf:6a:4c:18:43:\n" - " f7:42:cb:65:dc:61:52:e5:9f:2f:42:97:3c:93:16:22:d4:af:\n" - " ae:b2:0f:c3:9b:ef:e0:cc:ee:b6:b1:69:a3:d8:da:26:c3:ad:\n" - " 3b:c5:64:dc:9f:d4:c2:53:4b:91:6d:c4:92:09:0b:ac:f0:99:\n" - " be:6f:b9:3c:03:4a:6d:9f:01:5d:ec:5a:9a:f3:a7:e5:3b:2c:\n" - " 99:57:7d:7e:25:15:68:20:12:30:96:16:86:f5:db:74:90:60:\n" - " fe:8b:df:99:f6:f7:62:49:9f:bc:8d:45:23:0a:c8:73:b8:79:\n" - " 80:3c:b9:e5:72:85:4b:b3:81:66:74:a2:72:92:4c:44:fd:7b:\n" - " 46:2e:21:a2:a9:81:a2:f3:26:4d:e3:89:7d:78:b0:c6:6f:b5:\n" - " 87:cb:ee:25:ed:27:1f:75:13:fa:6d:e9:37:73:ad:07:bb:af:\n" - " d3:6c:87:ea:02:01:70:bd:53:aa:ce:39:2c:d4:66:39:33:aa:\n" - " d1:9c:ee:67:e3:a9:45:d2:7b:2e:54:09:af:70:5f:3f:5a:67:\n" - " 2e:6c:72:ef:e0:9d:92:28:4a:df:ba:0b:b7:23:ca:5b:04:11:\n" - " 45:d1:51:e9:ea:c9:ec:54:fa:34:46:ae:fc:dc:6c:f8:1e:2c:\n" - " 9e:f4:71:51:8d:b5:a1:26:9a:13:30:be:1e:41:25:59:58:05:\n" - " 2c:64:c8:f9:5e:38:ae:dc:93:b0:8a:d6:38:74:02:cb:ce:ce:\n" - " 95:31:76:f6:7c:bf:a4:a1:8e:27:fd:ca:74:82:d1:e1:4d:b6:\n" - " 48:51:fa:c5:17:59:22:a3:84:be:82:c8:83:ec:61:a0:f4:ee:\n" - " 2c:e3:a3:ea:e5:51:c9:d3:4f:db:85:bd:ba:7a:52:14:b6:03:\n" - " ed:43:17:d8:d7:1c:22:5e:c9:56:d9:d6:81:96:11:e3:5e:01:\n" - " 40:91:30:09:da:a3:5f:d3:27:60:e5:9d:6c:da:d0:f0:39:01:\n" - " 23:4a:a6:15:7a:4a:82:eb:ec:72:4a:1d:36:dc:6f:83:c4:85:\n" - " 84:b5:8d:cd:09:e5:12:63:f3:21:56:c8:64:6b:db:b8:cf:d4:\n" - " df:ca:a8:24:8e:df:8d:63:a5:96:84:bf:ff:8b:7e:46:7a:f0:\n" - " c7:73:7c:70:8a:f5:17:d0:ac:c8:89:1e:d7:89:42:0f:4d:66:\n" - " c4:d8:bb:36:a8:ae:ca:e1:cf:e2:88:f6:cf:b0:44:4a:5f:81:\n" - " 50:4b:d6:28:81:cd:6c:f0:ec:e6:09:08:f2:59:91:a2:69:ac:\n" - " c7:81:fa:ab:61:3e:db:6f:f6:7f:db:1a:9e:b9:5d:cc:cc:33:\n" - " fa:95:c6:f7:8d:4b:30:f3\n" - "-----BEGIN CERTIFICATE-----\n" - "MIIGXDCCBESgAwIBAgIJAIIvj+uNBiSwMA0GCSqGSIb3DQEBCwUAMIG6MQswCQYD\n" - "VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5j\n" - "aXNjbzETMBEGA1UECgwKTGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25kIExpZmUg\n" - "RW5naW5lZXJpbmcxITAfBgNVBAMMGEludGVncmF0aW9uIFRlc3QgUm9vdCBDQTEk\n" - "MCIGCSqGSIb3DQEJARYVbm9yZXBseUBsaW5kZW5sYWIuY29tMB4XDTE4MDUyMjIy\n" - "MTk0NVoXDTM4MDUxNzIyMTk0NVowgboxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApD\n" - "YWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMRMwEQYDVQQKDApMaW5k\n" - "ZW4gTGFiMSAwHgYDVQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVlcmluZzEhMB8GA1UE\n" - "AwwYSW50ZWdyYXRpb24gVGVzdCBSb290IENBMSQwIgYJKoZIhvcNAQkBFhVub3Jl\n" - "cGx5QGxpbmRlbmxhYi5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC\n" - "AQC94HndO6ash9A58FjHpEJC9l+TsDYEteLV9yrAbKAT0h4CgVcCUExXt+8nnvbx\n" - "8TAwch5XNOU/gjwhxGbSc2NskebdSZ6csTRqgUWhbsRQKPLY4/6AL4OqKJG0jFfJ\n" - "8RbZDIc8JYCggY1x8pbiFvGXxLDYU7sTbHNULymUhc+GbnVxrTnj/DkSU5Mczjng\n" - "M9pJtz2vsDfOdwkDJzJwwJx/nInOkEWwfZSL/xMnuoh/rsSqc9VHuIdpiYAMwSIY\n" - "eMINR9kQ/4B5DUZx7Nm6yfN3/ZJtHw/ZVBht9nIkXFw9Q0k1Phwo3n5E3CnDn2IE\n" - "RqrE5mlqFfjjdBwU6fSXfDBs1Cj8Kg4dbTkuHfkXQzVdI+e646jpl2s8PiPv2Lz7\n" - "elc3OZNZA/x4yrEx7yYZ7VbhY8OtmYBbR7UDNV/+aqYhY+xQ+07J+a6lZtBVM43m\n" - "xVBaxo9cNEWnctpQ9mZMGfXR5PsRi6G1TglDgT05KIY7/gcolwK1OgdfSiCAGn2k\n" - "jPds9sWb9mHlx7DD1Vg4e7tHHjTWFlXF0mywk3exkGkGsVPLG4Rxz7iHGx5ENbQr\n" - "uwRZWAvok9iuIZuxHIkwrhGAd8wW89Y17aGzcLNPzaFWme4OwACkCXDDWwu+oQcY\n" - "3cb0bYtYvPm7SwEs9swsm4cOsU+cEL78ReKk7H78/0W4UwIDAQABo2MwYTAdBgNV\n" - "HQ4EFgQUiiLGnC4R80AMzoIMIln/+H/QuRMwHwYDVR0jBBgwFoAUiiLGnC4R80AM\n" - "zoIMIln/+H/QuRMwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJ\n" - "KoZIhvcNAQELBQADggIBALPLM+sOAmT0VZo9A5rPakwYQ/dCy2XcYVLlny9ClzyT\n" - "FiLUr66yD8Ob7+DM7raxaaPY2ibDrTvFZNyf1MJTS5FtxJIJC6zwmb5vuTwDSm2f\n" - "AV3sWprzp+U7LJlXfX4lFWggEjCWFob123SQYP6L35n292JJn7yNRSMKyHO4eYA8\n" - "ueVyhUuzgWZ0onKSTET9e0YuIaKpgaLzJk3jiX14sMZvtYfL7iXtJx91E/pt6Tdz\n" - "rQe7r9Nsh+oCAXC9U6rOOSzUZjkzqtGc7mfjqUXSey5UCa9wXz9aZy5scu/gnZIo\n" - "St+6C7cjylsEEUXRUenqyexU+jRGrvzcbPgeLJ70cVGNtaEmmhMwvh5BJVlYBSxk\n" - "yPleOK7ck7CK1jh0AsvOzpUxdvZ8v6Shjif9ynSC0eFNtkhR+sUXWSKjhL6CyIPs\n" - "YaD07izjo+rlUcnTT9uFvbp6UhS2A+1DF9jXHCJeyVbZ1oGWEeNeAUCRMAnao1/T\n" - "J2DlnWza0PA5ASNKphV6SoLr7HJKHTbcb4PEhYS1jc0J5RJj8yFWyGRr27jP1N/K\n" - "qCSO341jpZaEv/+LfkZ68MdzfHCK9RfQrMiJHteJQg9NZsTYuzaorsrhz+KI9s+w\n" - "REpfgVBL1iiBzWzw7OYJCPJZkaJprMeB+qthPttv9n/bGp65XczMM/qVxveNSzDz\n" - "-----END CERTIFICATE-----\n" - ); - - const std::string mPemIntermediateCert( - "Certificate:\n" - " Data:\n" - " Version: 3 (0x2)\n" - " Serial Number: 4096 (0x1000)\n" - " Signature Algorithm: sha256WithRSAEncryption\n" - " Issuer: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" - " Validity\n" - " Not Before: May 22 22:39:08 2018 GMT\n" - " Not After : May 19 22:39:08 2028 GMT\n" - " Subject: C=US, ST=California, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Intermediate CA/emailAddress=noreply@lindenlab.com\n" - " Subject Public Key Info:\n" - " Public Key Algorithm: rsaEncryption\n" - " Public-Key: (4096 bit)\n" - " Modulus:\n" - " 00:ce:a3:70:e2:c4:fb:4b:97:90:a1:30:bb:c1:1b:\n" - " 13:b9:aa:7e:46:17:a3:26:8d:69:3f:5e:73:95:e8:\n" - " 6a:b1:0a:b4:8f:50:65:e3:c6:5c:39:24:34:df:0b:\n" - " b7:cc:ce:62:0c:36:5a:12:2c:fe:35:4c:e9:1c:ac:\n" - " 80:5e:24:99:d7:aa:bd:be:48:c0:62:64:77:36:88:\n" - " 66:ce:f4:a8:dd:d2:76:24:62:90:55:41:fc:1d:13:\n" - " 4e:a7:4e:57:bc:a8:a4:59:4b:2c:5a:1c:d8:cc:16:\n" - " de:e8:88:30:c9:95:df:2f:a6:14:28:0f:eb:34:46:\n" - " 12:58:ba:da:0e:e6:de:9c:15:f6:f4:e3:9f:74:aa:\n" - " 70:89:79:8b:e9:5a:7b:18:54:15:94:3a:23:0a:65:\n" - " 78:05:d9:33:90:2a:ce:15:18:0d:52:fc:5c:31:65:\n" - " 20:d0:12:37:8c:11:80:ba:d4:b0:82:73:00:4b:49:\n" - " be:cb:d6:bc:e7:cd:61:f3:00:98:99:74:5a:37:81:\n" - " 49:96:7e:14:01:1b:86:d2:d0:06:94:40:63:63:46:\n" - " 11:fc:33:5c:bd:3a:5e:d4:e5:44:47:64:50:bd:a6:\n" - " 97:55:70:64:9b:26:cc:de:20:82:90:6a:83:41:9c:\n" - " 6f:71:47:14:be:cb:68:7c:85:be:ef:2e:76:12:19:\n" - " d3:c9:87:32:b4:ac:60:20:16:28:2d:af:bc:e8:01:\n" - " c6:7f:fb:d8:11:d5:f4:b7:14:bd:27:08:5b:72:be:\n" - " 09:e0:91:c8:9c:7b:b4:b3:12:ef:32:36:be:b1:b9:\n" - " a2:b7:e3:69:47:30:76:ba:9c:9b:19:99:4d:53:dd:\n" - " 5c:e8:2c:f1:b2:64:69:cf:15:bd:f8:bb:58:95:73:\n" - " 58:38:95:b4:7a:cf:84:29:a6:c2:db:f0:bd:ef:97:\n" - " 26:d4:99:ac:d7:c7:be:b0:0d:11:f4:26:86:2d:77:\n" - " 42:52:25:d7:56:c7:e3:97:b1:36:5c:97:71:d0:9b:\n" - " f5:b5:50:8d:f9:ff:fb:10:77:3c:b5:53:6d:a1:43:\n" - " 35:a9:03:32:05:ab:d7:f5:d1:19:bd:5f:92:a3:00:\n" - " 2a:79:37:a4:76:4f:e9:32:0d:e4:86:bb:ea:c3:1a:\n" - " c5:33:e8:16:d4:a5:d8:e0:e8:bb:c2:f0:22:15:e2:\n" - " d9:8c:ae:ac:7d:2b:bf:eb:a3:4c:3b:29:1d:94:ac:\n" - " a3:bb:6d:ba:6d:03:91:03:cf:46:12:c4:66:21:c5:\n" - " c6:67:d8:11:19:79:01:0e:6e:84:1c:76:6f:11:3d:\n" - " eb:94:89:c5:6a:26:1f:cd:e0:11:8b:51:ee:99:35:\n" - " 69:e5:7f:0b:77:2a:94:e4:4b:64:b9:83:04:30:05:\n" - " e4:a2:e3\n" - " Exponent: 65537 (0x10001)\n" - " X509v3 extensions:\n" - " X509v3 Subject Key Identifier: \n" - " 83:21:DE:EC:C0:79:03:6D:1E:83:F3:E5:97:29:D5:5A:C0:96:40:FA\n" - " X509v3 Authority Key Identifier: \n" - " keyid:8A:22:C6:9C:2E:11:F3:40:0C:CE:82:0C:22:59:FF:F8:7F:D0:B9:13\n" - "\n" - " X509v3 Basic Constraints: critical\n" - " CA:TRUE, pathlen:0\n" - " X509v3 Key Usage: critical\n" - " Digital Signature, Certificate Sign, CRL Sign\n" - " Signature Algorithm: sha256WithRSAEncryption\n" - " a3:6c:85:9a:2e:4e:7e:5d:83:63:0f:f5:4f:a9:7d:ec:0e:6f:\n" - " ae:d7:ba:df:64:e0:46:0e:3d:da:18:15:2c:f3:73:ca:81:b1:\n" - " 10:d9:53:14:21:7d:72:5c:94:88:a5:9d:ad:ab:45:42:c6:64:\n" - " a9:d9:2e:4e:29:47:2c:b1:95:07:b7:62:48:68:1f:68:13:1c:\n" - " d2:a0:fb:5e:38:24:4a:82:0a:87:c9:93:20:43:7e:e9:f9:79:\n" - " ef:03:a2:bd:9e:24:6b:0a:01:5e:4a:36:c5:7d:7a:fe:d6:aa:\n" - " 2f:c2:8c:38:8a:99:3c:b0:6a:e5:60:be:56:d6:eb:60:03:55:\n" - " 24:42:a0:1a:fa:91:24:a3:53:15:75:5d:c8:eb:7c:1e:68:5a:\n" - " 7e:13:34:e3:85:37:1c:76:3f:77:67:1b:ed:1b:52:17:fc:4a:\n" - " a3:e2:74:84:80:2c:69:fc:dd:7d:26:97:c4:2a:69:7d:9c:dc:\n" - " 61:97:70:29:a7:3f:2b:5b:2b:22:51:fd:fe:6a:5d:f9:e7:14:\n" - " 48:b7:2d:c8:33:58:fc:f2:5f:27:f7:26:16:be:be:b5:aa:a2:\n" - " 64:53:3c:69:e8:b5:61:eb:ab:91:a5:b4:09:9b:f6:98:b8:5c:\n" - " 5b:24:2f:93:f5:2b:9c:8c:58:fb:26:3f:67:53:d7:42:64:e8:\n" - " 79:77:73:41:4e:e3:02:39:0b:b6:68:97:8b:84:e8:1d:83:a8:\n" - " 15:f1:06:46:47:80:42:5e:14:e2:61:8a:76:84:d5:d4:71:7f:\n" - " 4e:ff:d9:74:87:ff:32:c5:87:20:0a:d4:59:40:3e:d8:17:ef:\n" - " da:65:e9:0a:51:fe:1e:c3:46:91:d2:ee:e4:23:57:97:87:d4:\n" - " a6:a5:eb:ef:81:6a:d8:8c:d6:1f:8e:b1:18:4c:6b:89:32:55:\n" - " 53:68:26:9e:bb:03:be:2c:e9:8b:ff:97:9c:1c:ac:28:c3:9f:\n" - " 0b:b7:93:23:24:31:63:e4:19:13:f2:bb:08:71:b7:c5:c5:c4:\n" - " 10:ff:dc:fc:33:54:a4:5e:ec:a3:fe:0a:80:ca:9c:bc:95:6f:\n" - " 5f:39:91:3b:61:69:16:94:0f:57:4b:fc:4b:b1:be:72:98:5d:\n" - " 10:f9:08:a7:d6:e0:e8:3d:5d:54:7d:fa:4b:6a:dd:98:41:ed:\n" - " 84:a1:39:67:5c:6c:7f:0c:b0:e1:98:c1:14:ed:fe:1e:e8:05:\n" - " 8d:7f:6a:24:cb:1b:05:42:0d:7f:13:ba:ca:b5:91:db:a5:f0:\n" - " 40:2b:70:7a:2a:a5:5d:ed:56:0c:f0:c2:72:ee:63:dd:cb:5d:\n" - " 76:f6:08:e6:e6:30:ef:3a:b2:16:34:41:a4:e1:30:14:bc:c7:\n" - " f9:23:3a:1a:70:df:b8:cc\n" - "-----BEGIN CERTIFICATE-----\n" - "MIIGSDCCBDCgAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwgboxCzAJBgNVBAYTAlVT\n" - "MRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMRMw\n" - "EQYDVQQKDApMaW5kZW4gTGFiMSAwHgYDVQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVl\n" - "cmluZzEhMB8GA1UEAwwYSW50ZWdyYXRpb24gVGVzdCBSb290IENBMSQwIgYJKoZI\n" - "hvcNAQkBFhVub3JlcGx5QGxpbmRlbmxhYi5jb20wHhcNMTgwNTIyMjIzOTA4WhcN\n" - "MjgwNTE5MjIzOTA4WjCBqjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3Ju\n" - "aWExEzARBgNVBAoMCkxpbmRlbiBMYWIxIDAeBgNVBAsMF1NlY29uZCBMaWZlIEVu\n" - "Z2luZWVyaW5nMSkwJwYDVQQDDCBJbnRlZ3JhdGlvbiBUZXN0IEludGVybWVkaWF0\n" - "ZSBDQTEkMCIGCSqGSIb3DQEJARYVbm9yZXBseUBsaW5kZW5sYWIuY29tMIICIjAN\n" - "BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAzqNw4sT7S5eQoTC7wRsTuap+Rhej\n" - "Jo1pP15zlehqsQq0j1Bl48ZcOSQ03wu3zM5iDDZaEiz+NUzpHKyAXiSZ16q9vkjA\n" - "YmR3NohmzvSo3dJ2JGKQVUH8HRNOp05XvKikWUssWhzYzBbe6IgwyZXfL6YUKA/r\n" - "NEYSWLraDubenBX29OOfdKpwiXmL6Vp7GFQVlDojCmV4BdkzkCrOFRgNUvxcMWUg\n" - "0BI3jBGAutSwgnMAS0m+y9a8581h8wCYmXRaN4FJln4UARuG0tAGlEBjY0YR/DNc\n" - "vTpe1OVER2RQvaaXVXBkmybM3iCCkGqDQZxvcUcUvstofIW+7y52EhnTyYcytKxg\n" - "IBYoLa+86AHGf/vYEdX0txS9Jwhbcr4J4JHInHu0sxLvMja+sbmit+NpRzB2upyb\n" - "GZlNU91c6CzxsmRpzxW9+LtYlXNYOJW0es+EKabC2/C975cm1Jms18e+sA0R9CaG\n" - "LXdCUiXXVsfjl7E2XJdx0Jv1tVCN+f/7EHc8tVNtoUM1qQMyBavX9dEZvV+SowAq\n" - "eTekdk/pMg3khrvqwxrFM+gW1KXY4Oi7wvAiFeLZjK6sfSu/66NMOykdlKyju226\n" - "bQORA89GEsRmIcXGZ9gRGXkBDm6EHHZvET3rlInFaiYfzeARi1HumTVp5X8LdyqU\n" - "5EtkuYMEMAXkouMCAwEAAaNmMGQwHQYDVR0OBBYEFIMh3uzAeQNtHoPz5Zcp1VrA\n" - "lkD6MB8GA1UdIwQYMBaAFIoixpwuEfNADM6CDCJZ//h/0LkTMBIGA1UdEwEB/wQI\n" - "MAYBAf8CAQAwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQCjbIWa\n" - "Lk5+XYNjD/VPqX3sDm+u17rfZOBGDj3aGBUs83PKgbEQ2VMUIX1yXJSIpZ2tq0VC\n" - "xmSp2S5OKUcssZUHt2JIaB9oExzSoPteOCRKggqHyZMgQ37p+XnvA6K9niRrCgFe\n" - "SjbFfXr+1qovwow4ipk8sGrlYL5W1utgA1UkQqAa+pEko1MVdV3I63weaFp+EzTj\n" - "hTccdj93ZxvtG1IX/Eqj4nSEgCxp/N19JpfEKml9nNxhl3Appz8rWysiUf3+al35\n" - "5xRIty3IM1j88l8n9yYWvr61qqJkUzxp6LVh66uRpbQJm/aYuFxbJC+T9SucjFj7\n" - "Jj9nU9dCZOh5d3NBTuMCOQu2aJeLhOgdg6gV8QZGR4BCXhTiYYp2hNXUcX9O/9l0\n" - "h/8yxYcgCtRZQD7YF+/aZekKUf4ew0aR0u7kI1eXh9SmpevvgWrYjNYfjrEYTGuJ\n" - "MlVTaCaeuwO+LOmL/5ecHKwow58Lt5MjJDFj5BkT8rsIcbfFxcQQ/9z8M1SkXuyj\n" - "/gqAypy8lW9fOZE7YWkWlA9XS/xLsb5ymF0Q+Qin1uDoPV1UffpLat2YQe2EoTln\n" - "XGx/DLDhmMEU7f4e6AWNf2okyxsFQg1/E7rKtZHbpfBAK3B6KqVd7VYM8MJy7mPd\n" - "y1129gjm5jDvOrIWNEGk4TAUvMf5IzoacN+4zA==\n" - "-----END CERTIFICATE-----\n" - ); - - const std::string mPemChildCert( - "Certificate:\n" - " Data:\n" - " Version: 3 (0x2)\n" - " Serial Number: 4096 (0x1000)\n" - " Signature Algorithm: sha256WithRSAEncryption\n" - " Issuer: C=US, ST=California, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Intermediate CA/emailAddress=noreply@lindenlab.com\n" - " Validity\n" - " Not Before: May 22 22:58:15 2018 GMT\n" - " Not After : Jul 19 22:58:15 2024 GMT\n" - " Subject: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Server Cert/emailAddress=noreply@lindenlab.com\n" - " Subject Public Key Info:\n" - " Public Key Algorithm: rsaEncryption\n" - " Public-Key: (2048 bit)\n" - " Modulus:\n" - " 00:bf:a1:1c:76:82:4a:10:1d:25:0e:02:e2:7a:64:\n" - " 54:c7:94:c5:c0:98:d5:35:f3:cb:cb:30:ba:31:9c:\n" - " bd:4c:2f:4a:4e:24:03:4b:87:5c:c1:5c:fe:d9:89:\n" - " 3b:cb:01:bc:eb:a5:b7:78:dc:b3:58:e5:78:a7:15:\n" - " 34:50:30:aa:16:3a:b2:94:17:6d:1e:7f:b2:70:1e:\n" - " 96:41:bb:1d:e3:22:80:fa:dc:00:6a:fb:34:3e:67:\n" - " e7:c2:21:2f:1b:d3:af:04:49:91:eb:bb:60:e0:26:\n" - " 52:75:28:8a:08:5b:91:56:4e:51:50:40:51:70:af:\n" - " cb:80:66:c8:59:e9:e2:48:a8:62:d0:26:67:80:0a:\n" - " 12:16:d1:f6:15:9e:1f:f5:92:37:f3:c9:2f:03:9e:\n" - " 22:f6:60:5a:76:45:8c:01:2c:99:54:72:19:db:b7:\n" - " 72:e6:5a:69:f3:e9:31:65:5d:0f:c7:5c:9c:17:29:\n" - " 71:14:7f:db:47:c9:1e:65:a2:41:b0:2f:14:17:ec:\n" - " 4b:25:f2:43:8f:b4:a3:8d:37:1a:07:34:b3:29:bb:\n" - " 8a:44:8e:84:08:a2:1b:76:7a:cb:c2:39:2f:6e:e3:\n" - " fc:d6:91:b5:1f:ce:58:91:57:70:35:6e:25:a9:48:\n" - " 0e:07:cf:4e:dd:16:42:65:cf:8a:42:b3:27:e6:fe:\n" - " 6a:e3\n" - " Exponent: 65537 (0x10001)\n" - " X509v3 extensions:\n" - " X509v3 Basic Constraints: \n" - " CA:FALSE\n" - " Netscape Cert Type: \n" - " SSL Server\n" - " Netscape Comment: \n" - " OpenSSL Generated Server Certificate\n" - " X509v3 Subject Key Identifier: \n" - " BB:59:9F:DE:6B:51:A7:6C:B3:6D:5B:8B:42:F7:B1:65:77:17:A4:E4\n" - " X509v3 Authority Key Identifier: \n" - " keyid:83:21:DE:EC:C0:79:03:6D:1E:83:F3:E5:97:29:D5:5A:C0:96:40:FA\n" - " DirName:/C=US/ST=California/L=San Francisco/O=Linden Lab/OU=Second Life Engineering/CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" - " serial:10:00\n" - "\n" - " X509v3 Key Usage: critical\n" - " Digital Signature, Key Encipherment\n" - " X509v3 Extended Key Usage: \n" - " TLS Web Server Authentication\n" - " Signature Algorithm: sha256WithRSAEncryption\n" - " 18:a6:58:55:9b:d4:af:7d:8a:27:d3:28:3a:4c:4b:42:4e:f0:\n" - " 30:d6:d9:95:11:48:12:0a:96:40:d9:2b:21:39:c5:d4:8d:e5:\n" - " 10:bc:68:78:69:0b:9f:15:4a:0b:f1:ab:99:45:0c:20:5f:27:\n" - " df:e7:14:2d:4a:30:f2:c2:8d:37:73:36:1a:27:55:5a:08:5f:\n" - " 71:a1:5e:05:83:b2:59:fe:02:5e:d7:4a:30:15:23:58:04:cf:\n" - " 48:cc:b0:71:88:9c:6b:57:f0:04:0a:d3:a0:64:6b:ee:f3:5f:\n" - " ea:ac:e1:2b:b9:7f:79:b8:db:ce:72:48:72:db:c8:5c:38:72:\n" - " 31:55:d0:ff:6b:bd:73:23:a7:30:18:5d:ed:47:18:0a:67:8e:\n" - " 53:32:0e:99:9b:96:72:45:7f:c6:00:2c:5d:1a:97:53:75:3a:\n" - " 0b:49:3d:3a:00:37:14:67:0c:28:97:34:87:aa:c5:32:e4:ae:\n" - " 34:83:12:4a:10:f7:0e:74:d4:5f:73:bd:ef:0c:b7:d8:0a:7d:\n" - " 8e:8d:5a:48:bd:f4:8e:7b:f9:4a:15:3b:61:c9:5e:40:59:6e:\n" - " c7:a8:a4:02:28:72:c5:54:8c:77:f4:55:a7:86:c0:38:a0:68:\n" - " 19:da:0f:72:5a:a9:7e:69:9f:9c:3a:d6:66:aa:e1:f4:fd:f9:\n" - " b8:4b:6c:71:9e:f0:38:02:c7:6a:9e:dc:e6:fb:ef:23:59:4f:\n" - " 5c:84:0a:df:ea:86:1f:fd:0e:5c:fa:c4:e5:50:1c:10:cf:89:\n" - " 4e:08:0e:4c:4b:61:1a:49:12:f7:e9:4b:17:71:43:7b:6d:b6:\n" - " b5:9f:d4:3b:c7:88:53:48:63:b6:00:80:8f:49:0a:c5:7e:58:\n" - " ac:78:d8:b9:06:b0:bc:86:e2:2e:48:5b:c3:24:fa:aa:72:d8:\n" - " ec:f6:c7:91:9f:0f:c8:b5:fd:2b:b2:a7:bc:2f:40:20:2b:47:\n" - " e0:d1:1d:94:52:6f:6b:be:12:b6:8c:dc:11:db:71:e6:19:ef:\n" - " a8:71:8b:ad:d3:32:c0:1c:a4:3f:b3:0f:af:e5:50:e1:ff:41:\n" - " a4:b7:6f:57:71:af:fd:16:4c:e8:24:b3:99:1b:cf:12:8f:43:\n" - " 05:80:ba:18:19:0a:a5:ec:49:81:41:4c:7e:28:b2:21:f2:59:\n" - " 6e:4a:ed:de:f9:fa:99:85:60:1f:e6:c2:42:5c:08:00:3c:84:\n" - " 06:a9:24:d4:cf:7b:6e:1b:59:1d:f4:70:16:03:a1:e0:0b:00:\n" - " 95:5c:39:03:fc:9d:1c:8e:f7:59:0c:61:47:f6:7f:07:22:48:\n" - " 83:40:ac:e1:98:5f:c7:be:05:d5:29:2b:bf:0d:03:0e:e9:5e:\n" - " 2b:dd:09:18:fe:5e:30:61\n" - "-----BEGIN CERTIFICATE-----\n" - "MIIGbjCCBFagAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwgaoxCzAJBgNVBAYTAlVT\n" - "MRMwEQYDVQQIDApDYWxpZm9ybmlhMRMwEQYDVQQKDApMaW5kZW4gTGFiMSAwHgYD\n" - "VQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVlcmluZzEpMCcGA1UEAwwgSW50ZWdyYXRp\n" - "b24gVGVzdCBJbnRlcm1lZGlhdGUgQ0ExJDAiBgkqhkiG9w0BCQEWFW5vcmVwbHlA\n" - "bGluZGVubGFiLmNvbTAeFw0xODA1MjIyMjU4MTVaFw0yNDA3MTkyMjU4MTVaMIG+\n" - "MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2Fu\n" - "IEZyYW5jaXNjbzETMBEGA1UECgwKTGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25k\n" - "IExpZmUgRW5naW5lZXJpbmcxJTAjBgNVBAMMHEludGVncmF0aW9uIFRlc3QgU2Vy\n" - "dmVyIENlcnQxJDAiBgkqhkiG9w0BCQEWFW5vcmVwbHlAbGluZGVubGFiLmNvbTCC\n" - "ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL+hHHaCShAdJQ4C4npkVMeU\n" - "xcCY1TXzy8swujGcvUwvSk4kA0uHXMFc/tmJO8sBvOult3jcs1jleKcVNFAwqhY6\n" - "spQXbR5/snAelkG7HeMigPrcAGr7ND5n58IhLxvTrwRJkeu7YOAmUnUoighbkVZO\n" - "UVBAUXCvy4BmyFnp4kioYtAmZ4AKEhbR9hWeH/WSN/PJLwOeIvZgWnZFjAEsmVRy\n" - "Gdu3cuZaafPpMWVdD8dcnBcpcRR/20fJHmWiQbAvFBfsSyXyQ4+0o403Ggc0sym7\n" - "ikSOhAiiG3Z6y8I5L27j/NaRtR/OWJFXcDVuJalIDgfPTt0WQmXPikKzJ+b+auMC\n" - "AwEAAaOCAYYwggGCMAkGA1UdEwQCMAAwEQYJYIZIAYb4QgEBBAQDAgZAMDMGCWCG\n" - "SAGG+EIBDQQmFiRPcGVuU1NMIEdlbmVyYXRlZCBTZXJ2ZXIgQ2VydGlmaWNhdGUw\n" - "HQYDVR0OBBYEFLtZn95rUadss21bi0L3sWV3F6TkMIHoBgNVHSMEgeAwgd2AFIMh\n" - "3uzAeQNtHoPz5Zcp1VrAlkD6oYHApIG9MIG6MQswCQYDVQQGEwJVUzETMBEGA1UE\n" - "CAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzETMBEGA1UECgwK\n" - "TGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25kIExpZmUgRW5naW5lZXJpbmcxITAf\n" - "BgNVBAMMGEludGVncmF0aW9uIFRlc3QgUm9vdCBDQTEkMCIGCSqGSIb3DQEJARYV\n" - "bm9yZXBseUBsaW5kZW5sYWIuY29tggIQADAOBgNVHQ8BAf8EBAMCBaAwEwYDVR0l\n" - "BAwwCgYIKwYBBQUHAwEwDQYJKoZIhvcNAQELBQADggIBABimWFWb1K99iifTKDpM\n" - "S0JO8DDW2ZURSBIKlkDZKyE5xdSN5RC8aHhpC58VSgvxq5lFDCBfJ9/nFC1KMPLC\n" - "jTdzNhonVVoIX3GhXgWDsln+Al7XSjAVI1gEz0jMsHGInGtX8AQK06Bka+7zX+qs\n" - "4Su5f3m4285ySHLbyFw4cjFV0P9rvXMjpzAYXe1HGApnjlMyDpmblnJFf8YALF0a\n" - "l1N1OgtJPToANxRnDCiXNIeqxTLkrjSDEkoQ9w501F9zve8Mt9gKfY6NWki99I57\n" - "+UoVO2HJXkBZbseopAIocsVUjHf0VaeGwDigaBnaD3JaqX5pn5w61maq4fT9+bhL\n" - "bHGe8DgCx2qe3Ob77yNZT1yECt/qhh/9Dlz6xOVQHBDPiU4IDkxLYRpJEvfpSxdx\n" - "Q3tttrWf1DvHiFNIY7YAgI9JCsV+WKx42LkGsLyG4i5IW8Mk+qpy2Oz2x5GfD8i1\n" - "/Suyp7wvQCArR+DRHZRSb2u+EraM3BHbceYZ76hxi63TMsAcpD+zD6/lUOH/QaS3\n" - "b1dxr/0WTOgks5kbzxKPQwWAuhgZCqXsSYFBTH4osiHyWW5K7d75+pmFYB/mwkJc\n" - "CAA8hAapJNTPe24bWR30cBYDoeALAJVcOQP8nRyO91kMYUf2fwciSINArOGYX8e+\n" - "BdUpK78NAw7pXivdCRj+XjBh\n" - "-----END CERTIFICATE-----\n" - ); - - // Test wrapper declaration : wrapping nothing for the moment - struct sechandler_basic_test - { - X509 *mX509TestCert, *mX509RootCert, *mX509IntermediateCert, *mX509ChildCert; - LLSD mValidationDate; - - sechandler_basic_test() - { - LLMachineID::init(); - OpenSSL_add_all_algorithms(); - OpenSSL_add_all_ciphers(); - OpenSSL_add_all_digests(); - ERR_load_crypto_strings(); - gFirstName = ""; - gLastName = ""; - mValidationDate[CERT_VALIDATION_DATE] = LLDate("2017-04-11T00:00:00.00Z"); - LLFile::remove("test_password.dat"); - LLFile::remove("sechandler_settings.tmp"); - - mX509TestCert = NULL; - mX509RootCert = NULL; - mX509IntermediateCert = NULL; - mX509ChildCert = NULL; - - // Read each of the 4 Pem certs and store in mX509*Cert pointers - BIO * validation_bio; - validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), mPemTestCert.length()); - PEM_read_bio_X509(validation_bio, &mX509TestCert, 0, NULL); - BIO_free(validation_bio); - - validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), mPemRootCert.length()); - PEM_read_bio_X509(validation_bio, &mX509RootCert, 0, NULL); - BIO_free(validation_bio); - - validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), mPemIntermediateCert.length()); - PEM_read_bio_X509(validation_bio, &mX509IntermediateCert, 0, NULL); - BIO_free(validation_bio); - - validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), mPemChildCert.length()); - PEM_read_bio_X509(validation_bio, &mX509ChildCert, 0, NULL); - BIO_free(validation_bio); - } - ~sechandler_basic_test() - { - LLFile::remove("test_password.dat"); - LLFile::remove("sechandler_settings.tmp"); - LLFile::remove("mycertstore.pem"); - X509_free(mX509TestCert); - X509_free(mX509RootCert); - X509_free(mX509IntermediateCert); - X509_free(mX509ChildCert); - } - }; - - // Tut templating thingamagic: test group, object and test instance - typedef test_group sechandler_basic_test_factory; - typedef sechandler_basic_test_factory::object sechandler_basic_test_object; - tut::sechandler_basic_test_factory tut_test("LLSecHandler"); - - // --------------------------------------------------------------------------------------- - // Test functions - // --------------------------------------------------------------------------------------- - // test cert data retrieval - template<> template<> - void sechandler_basic_test_object::test<1>() - { - try - { - LLPointer test_cert(new LLBasicCertificate(mPemTestCert, &mValidationDate)); - LL_INFOS() << "ok" << LL_ENDL; - } - catch (LLCertException& cert_exception) - { - LL_INFOS() << "cert ex: " << cert_exception.getCertData() << LL_ENDL; - fail("cert exception"); - } - catch (...) - { - LOG_UNHANDLED_EXCEPTION("test 1"); - fail("other exception"); - } - } - - template<> template<> - void sechandler_basic_test_object::test<2>() - { - LLPointer test_cert(new LLBasicCertificate(mPemChildCert, &mValidationDate)); - - LLSD llsd_cert; - test_cert->getLLSD(llsd_cert); - //std::ostringstream llsd_value; - //llsd_value << LLSDOStreamer(llsd_cert) << std::endl; - LL_DEBUGS() << "test 1 cert " << llsd_cert << LL_ENDL; - - ensure_equals("Issuer Name/commonName", (std::string)llsd_cert["issuer_name"]["commonName"], "Integration Test Intermediate CA"); - ensure_equals("Issuer Name/countryName", (std::string)llsd_cert["issuer_name"]["countryName"], "US"); - ensure_equals("Issuer Name/state", (std::string)llsd_cert["issuer_name"]["stateOrProvinceName"], "California"); - ensure_equals("Issuer Name/org name", (std::string)llsd_cert["issuer_name"]["organizationName"], "Linden Lab"); - ensure_equals("Issuer Name/org unit", (std::string)llsd_cert["issuer_name"]["organizationalUnitName"], "Second Life Engineering"); - ensure_equals("Issuer name string", (std::string)llsd_cert["issuer_name_string"], - "emailAddress=noreply@lindenlab.com,CN=Integration Test Intermediate CA,OU=Second Life Engineering,O=Linden Lab,ST=California,C=US"); - ensure_equals("subject Name/commonName", (std::string)llsd_cert["subject_name"]["commonName"], - "Integration Test Server Cert"); - ensure_equals("subject Name/countryName", (std::string)llsd_cert["subject_name"]["countryName"], "US"); - ensure_equals("subject Name/state", (std::string)llsd_cert["subject_name"]["stateOrProvinceName"], "California"); - ensure_equals("subject Name/localityName", (std::string)llsd_cert["subject_name"]["localityName"], "San Francisco"); - ensure_equals("subject Name/org name", (std::string)llsd_cert["subject_name"]["organizationName"], "Linden Lab"); - ensure_equals("subjectName/org unit", - (std::string)llsd_cert["subject_name"]["organizationalUnitName"], "Second Life Engineering"); - - ensure_equals("subject name string", - (std::string)llsd_cert["subject_name_string"], - "emailAddress=noreply@lindenlab.com,CN=Integration Test Server Cert,OU=Second Life Engineering,O=Linden Lab,L=San Francisco,ST=California,C=US"); - ensure_equals("serial number", (std::string)llsd_cert["serial_number"], "1000"); - ensure_equals("valid from", (std::string)llsd_cert["valid_from"], "2018-05-22T22:58:15Z"); - ensure_equals("valid to", (std::string)llsd_cert["valid_to"], "2024-07-19T22:58:15Z"); - LLSD expectedKeyUsage = LLSD::emptyArray(); - expectedKeyUsage.append(LLSD((std::string)"digitalSignature")); - expectedKeyUsage.append(LLSD((std::string)"keyEncipherment")); - ensure("key usage", valueCompareLLSD(llsd_cert["keyUsage"], expectedKeyUsage)); - ensure_equals("basic constraints", llsd_cert["basicConstraints"]["CA"].asInteger(), 0); - - ensure("x509 is equal", !X509_cmp(mX509ChildCert, test_cert->getOpenSSLX509())); - } - - - // test protected data - template<> template<> - void sechandler_basic_test_object::test<3>() - { - std::string protected_data = "sUSh3wj77NG9oAMyt3XIhaej3KLZhLZWFZvI6rIGmwUUOmmelrRg0NI9rkOj8ZDpTPxpwToaBT5u" - "GQhakdaGLJznr9bHr4/6HIC1bouKj4n2rs4TL6j2WSjto114QdlNfLsE8cbbE+ghww58g8SeyLQO" - "nyzXoz+/PBz0HD5SMFDuObccoPW24gmqYySz8YoEWhSwO0pUtEEqOjVRsAJgF5wLAtJZDeuilGsq" - "4ZT9Y4wZ9Rh8nnF3fDUL6IGamHe1ClXM1jgBu10F6UMhZbnH4C3aJ2E9+LiOntU+l3iCb2MpkEpr" - "82r2ZAMwIrpnirL/xoYoyz7MJQYwUuMvBPToZJrxNSsjI+S2Z+I3iEJAELMAAA=="; - - std::vector binary_data(apr_base64_decode_len(protected_data.c_str())); - apr_base64_decode_binary(&binary_data[0], protected_data.c_str()); - - LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES); - cipher.decrypt(&binary_data[0], 16); - unsigned char unique_id[MAC_ADDRESS_BYTES]; - LLMachineID::getUniqueID(unique_id, sizeof(unique_id)); - LLXORCipher cipher2(unique_id, sizeof(unique_id)); - cipher2.encrypt(&binary_data[0], 16); - std::ofstream temp_file("sechandler_settings.tmp", std::ofstream::binary); - temp_file.write((const char *)&binary_data[0], binary_data.size()); - temp_file.close(); - - LLPointer handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", - "test_password.dat"); - handler->init(); - // data retrieval for existing data - LLSD data = handler->getProtectedData("test_data_type", "test_data_id"); - - - ensure_equals("retrieve existing data1", (std::string)data["data1"], "test_data_1"); - ensure_equals("retrieve existing data2", (std::string)data["data2"], "test_data_2"); - ensure_equals("retrieve existing data3", (std::string)data["data3"]["elem1"], "test element1"); - - // data storage - LLSD store_data = LLSD::emptyMap(); - store_data["store_data1"] = "test_store_data1"; - store_data["store_data2"] = 27; - store_data["store_data3"] = LLSD::emptyMap(); - store_data["store_data3"]["subelem1"] = "test_subelem1"; - - handler->setProtectedData("test_data_type", "test_data_id1", store_data); - data = handler->getProtectedData("test_data_type", "test_data_id"); - - data = handler->getProtectedData("test_data_type", "test_data_id"); - // verify no overwrite of existing data - ensure_equals("verify no overwrite 1", (std::string)data["data1"], "test_data_1"); - ensure_equals("verify no overwrite 2", (std::string)data["data2"], "test_data_2"); - ensure_equals("verify no overwrite 3", (std::string)data["data3"]["elem1"], "test element1"); - - // verify written data is good - data = handler->getProtectedData("test_data_type", "test_data_id1"); - ensure_equals("verify stored data1", (std::string)data["store_data1"], "test_store_data1"); - ensure_equals("verify stored data2", (int)data["store_data2"], 27); - ensure_equals("verify stored data3", (std::string)data["store_data3"]["subelem1"], "test_subelem1"); - - // verify overwrite works - handler->setProtectedData("test_data_type", "test_data_id", store_data); - data = handler->getProtectedData("test_data_type", "test_data_id"); - ensure_equals("verify overwrite stored data1", (std::string)data["store_data1"], "test_store_data1"); - ensure_equals("verify overwrite stored data2", (int)data["store_data2"], 27); - ensure_equals("verify overwrite stored data3", (std::string)data["store_data3"]["subelem1"], "test_subelem1"); - - // verify other datatype doesn't conflict - store_data["store_data3"] = "test_store_data3"; - store_data["store_data4"] = 28; - store_data["store_data5"] = LLSD::emptyMap(); - store_data["store_data5"]["subelem2"] = "test_subelem2"; - - handler->setProtectedData("test_data_type1", "test_data_id", store_data); - data = handler->getProtectedData("test_data_type1", "test_data_id"); - ensure_equals("verify datatype stored data3", (std::string)data["store_data3"], "test_store_data3"); - ensure_equals("verify datatype stored data4", (int)data["store_data4"], 28); - ensure_equals("verify datatype stored data5", (std::string)data["store_data5"]["subelem2"], "test_subelem2"); - - // test data not found - - data = handler->getProtectedData("test_data_type1", "test_data_not_found"); - ensure("not found", data.isUndefined()); - - // cause a 'write' by using 'LLPointer' to delete then instantiate a handler - handler = NULL; - handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat"); - handler->init(); - - data = handler->getProtectedData("test_data_type1", "test_data_id"); - ensure_equals("verify datatype stored data3a", (std::string)data["store_data3"], "test_store_data3"); - ensure_equals("verify datatype stored data4a", (int)data["store_data4"], 28); - ensure_equals("verify datatype stored data5a", (std::string)data["store_data5"]["subelem2"], "test_subelem2"); - - // rewrite the initial file to verify reloads - handler = NULL; - std::ofstream temp_file2("sechandler_settings.tmp", std::ofstream::binary); - temp_file2.write((const char *)&binary_data[0], binary_data.size()); - temp_file2.close(); - - // cause a 'write' - handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat"); - handler->init(); - data = handler->getProtectedData("test_data_type1", "test_data_id"); - ensure("not found", data.isUndefined()); - - handler->deleteProtectedData("test_data_type", "test_data_id"); - ensure("Deleted data not found", handler->getProtectedData("test_data_type", "test_data_id").isUndefined()); - - LLFile::remove("sechandler_settings.tmp"); - handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat"); - handler->init(); - data = handler->getProtectedData("test_data_type1", "test_data_id"); - ensure("not found", data.isUndefined()); - handler = NULL; - - ensure(LLFile::isfile("sechandler_settings.tmp")); - } - - // test credenitals - template<> template<> - void sechandler_basic_test_object::test<4>() - { - LLPointer handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat"); - handler->init(); - - LLSD my_id = LLSD::emptyMap(); - LLSD my_authenticator = LLSD::emptyMap(); - my_id["type"] = "test_type"; - my_id["username"] = "testuser@lindenlab.com"; - my_authenticator["type"] = "test_auth"; - my_authenticator["creds"] = "12345"; - - // test creation of credentials - LLPointer my_cred = handler->createCredential("my_grid", my_id, my_authenticator); - - // test retrieval of credential components - ensure_equals("basic credential creation: identifier", my_id, my_cred->getIdentifier()); - ensure_equals("basic credential creation: authenticator", my_authenticator, my_cred->getAuthenticator()); - ensure_equals("basic credential creation: grid", "my_grid", my_cred->getGrid()); - - // test setting/overwriting of credential components - my_id["first_name"] = "firstname"; - my_id.erase("username"); - my_authenticator.erase("creds"); - my_authenticator["hash"] = "6563245"; - - my_cred->setCredentialData(my_id, my_authenticator); - ensure_equals("set credential data: identifier", my_id, my_cred->getIdentifier()); - ensure_equals("set credential data: authenticator", my_authenticator, my_cred->getAuthenticator()); - ensure_equals("set credential data: grid", "my_grid", my_cred->getGrid()); - - // test loading of a credential, that hasn't been saved, without - // any legacy saved credential data - LLPointer my_new_cred = handler->loadCredential("my_grid2"); - ensure("unknown credential load test", my_new_cred->getIdentifier().isMap()); - ensure("unknown credential load test", !my_new_cred->getIdentifier().has("type")); - ensure("unknown credential load test", my_new_cred->getAuthenticator().isMap()); - ensure("unknown credential load test", !my_new_cred->getAuthenticator().has("type")); - // test saving of a credential - handler->saveCredential(my_cred, true); - - // test loading of a known credential - my_new_cred = handler->loadCredential("my_grid"); - ensure_equals("load a known credential: identifier", my_id, my_new_cred->getIdentifier()); - ensure_equals("load a known credential: authenticator",my_authenticator, my_new_cred->getAuthenticator()); - ensure_equals("load a known credential: grid", "my_grid", my_cred->getGrid()); - - // test deletion of a credential - handler->deleteCredential(my_new_cred); - - ensure("delete credential: identifier", my_new_cred->getIdentifier().isUndefined()); - ensure("delete credentialt: authenticator", my_new_cred->getIdentifier().isUndefined()); - ensure_equals("delete credential: grid", "my_grid", my_cred->getGrid()); - // load unknown cred - - my_new_cred = handler->loadCredential("my_grid"); - ensure("deleted credential load test", my_new_cred->getIdentifier().isMap()); - ensure("deleted credential load test", !my_new_cred->getIdentifier().has("type")); - ensure("deleted credential load test", my_new_cred->getAuthenticator().isMap()); - ensure("deleted credential load test", !my_new_cred->getAuthenticator().has("type")); - - // test loading of an unknown credential with legacy saved username, but without - // saved password - gFirstName = "myfirstname"; - gLastName = "mylastname"; - my_new_cred = handler->loadCredential("my_legacy_grid"); - ensure_equals("legacy credential with no password: type", - (const std::string)my_new_cred->getIdentifier()["type"], "agent"); - ensure_equals("legacy credential with no password: first_name", - (const std::string)my_new_cred->getIdentifier()["first_name"], "myfirstname"); - ensure_equals("legacy credential with no password: last_name", - (const std::string)my_new_cred->getIdentifier()["last_name"], "mylastname"); - - ensure("legacy credential with no password: no authenticator", my_new_cred->getAuthenticator().isUndefined()); - - // test loading of an unknown credential with legacy saved password and username - - std::string hashed_password = "fSQcLG03eyIWJmkzfyYaKm81dSweLmsxeSAYKGE7fSQ="; - int length = apr_base64_decode_len(hashed_password.c_str()); - std::vector decoded_password(length); - apr_base64_decode(&decoded_password[0], hashed_password.c_str()); - LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES); - cipher.decrypt((U8*)&decoded_password[0], length); - unsigned char unique_id[MAC_ADDRESS_BYTES]; - LLMachineID::getUniqueID(unique_id, sizeof(unique_id)); - LLXORCipher cipher2(unique_id, sizeof(unique_id)); - cipher2.encrypt((U8*)&decoded_password[0], length); - llofstream password_file("test_password.dat", std::ofstream::binary); - password_file.write(&decoded_password[0], length); - password_file.close(); - - my_new_cred = handler->loadCredential("my_legacy_grid2"); - ensure_equals("legacy credential with password: type", - (const std::string)my_new_cred->getIdentifier()["type"], "agent"); - ensure_equals("legacy credential with password: first_name", - (const std::string)my_new_cred->getIdentifier()["first_name"], "myfirstname"); - ensure_equals("legacy credential with password: last_name", - (const std::string)my_new_cred->getIdentifier()["last_name"], "mylastname"); - - LLSD legacy_authenticator = my_new_cred->getAuthenticator(); - ensure_equals("legacy credential with password: type", - (std::string)legacy_authenticator["type"], - "hash"); - ensure_equals("legacy credential with password: algorithm", - (std::string)legacy_authenticator["algorithm"], - "md5"); - ensure_equals("legacy credential with password: algorithm", - (std::string)legacy_authenticator["secret"], - "01234567890123456789012345678901"); - - // test creation of credentials - my_cred = handler->createCredential("mysavedgrid", my_id, my_authenticator); - // test save without saving authenticator. - handler->saveCredential(my_cred, false); - my_new_cred = handler->loadCredential("mysavedgrid"); - ensure_equals("saved credential without auth", - (const std::string)my_new_cred->getIdentifier()["type"], "test_type"); - ensure("no authenticator values were saved", my_new_cred->getAuthenticator().isUndefined()); - } - - // test cert vector - template<> template<> - void sechandler_basic_test_object::test<5>() - { - // validate create from empty vector - LLPointer test_vector = new LLBasicCertificateVector(); - ensure_equals("when loading with nothing, we should result in no certs in vector", test_vector->size(), 0); - - test_vector->add(new LLBasicCertificate(mPemTestCert, &mValidationDate)); - ensure_equals("one element in vector", test_vector->size(), 1); - test_vector->add(new LLBasicCertificate(mPemChildCert, &mValidationDate)); - ensure_equals("two elements in vector after add", test_vector->size(), 2); - - // add duplicate; should be a no-op (and log at DEBUG level) - test_vector->add(new LLBasicCertificate(mPemChildCert, &mValidationDate)); - ensure_equals("two elements in vector after re-add", test_vector->size(), 2); - - // validate order - X509* test_cert = (*test_vector)[0]->getOpenSSLX509(); - ensure("first cert added remains first cert", !X509_cmp(test_cert, mX509TestCert)); - X509_free(test_cert); - - test_cert = (*test_vector)[1]->getOpenSSLX509(); - ensure("second cert is second cert", !X509_cmp(test_cert, mX509ChildCert)); - X509_free(test_cert); - - // - // validate iterator - // - LLBasicCertificateVector::iterator current_cert = test_vector->begin(); - LLBasicCertificateVector::iterator copy_current_cert = current_cert; - // operator++(int) - ensure("validate iterator++ element in vector is expected cert", *current_cert++ == (*test_vector)[0]); - ensure("validate 2nd iterator++ element in vector is expected cert", *current_cert++ == (*test_vector)[1]); - ensure("validate end iterator++", current_cert == test_vector->end()); - - // copy - ensure("validate copy iterator element in vector is expected cert", *copy_current_cert == (*test_vector)[0]); - - // operator--(int) - current_cert--; - ensure("validate iterator-- element in vector is expected cert", *current_cert-- == (*test_vector)[1]); - ensure("validate iterator-- element in vector is expected cert", *current_cert == (*test_vector)[0]); - - ensure("begin iterator is equal", current_cert == test_vector->begin()); - - // operator++ - ensure("validate ++iterator element in vector is expected cert", *++current_cert == (*test_vector)[1]); - ensure("end of cert vector after ++iterator", ++current_cert == test_vector->end()); - // operator-- - ensure("validate --iterator element in vector is expected cert", *--current_cert == (*test_vector)[1]); - ensure("validate 2nd --iterator element in vector is expected cert", *--current_cert == (*test_vector)[0]); - - test_vector->erase(test_vector->begin()); - ensure_equals("one element in store after remove", test_vector->size(), 1); - test_cert = (*test_vector)[0]->getOpenSSLX509(); - ensure("Child cert remains", !X509_cmp(test_cert, mX509ChildCert)); - X509_free(test_cert); - - // validate insert - test_vector->insert(test_vector->begin(), new LLBasicCertificate(mPemIntermediateCert, &mValidationDate)); - test_cert = (*test_vector)[0]->getOpenSSLX509(); - ensure_equals("two elements in store after insert", test_vector->size(), 2); - ensure("validate intermediate cert was inserted at first position", !X509_cmp(test_cert, mX509IntermediateCert)); - X509_free(test_cert); - test_cert = (*test_vector)[1]->getOpenSSLX509(); - ensure("validate child cert still there", !X509_cmp(test_cert, mX509ChildCert)); - X509_free(test_cert); - - //validate find - LLSD find_info = LLSD::emptyMap(); - find_info["subjectKeyIdentifier"] = "bb:59:9f:de:6b:51:a7:6c:b3:6d:5b:8b:42:f7:b1:65:77:17:a4:e4"; - LLBasicCertificateVector::iterator found_cert = test_vector->find(find_info); - ensure("found some cert", found_cert != test_vector->end()); - X509* found_x509 = (*found_cert).get()->getOpenSSLX509(); - ensure("child cert was found", !X509_cmp(found_x509, mX509ChildCert)); - X509_free(found_x509); - - find_info["subjectKeyIdentifier"] = "00:00:00:00"; // bogus - current_cert =test_vector->find(find_info); - ensure("didn't find cert", current_cert == test_vector->end()); - } - - // test cert store - template<> template<> - void sechandler_basic_test_object::test<6>() - { - // validate load with nothing - LLFile::remove("mycertstore.pem"); - LLPointer test_store = new LLBasicCertificateStore("mycertstore.pem"); - ensure_equals("when loading with nothing, we should result in no certs in store", test_store->size(), 0); - - // validate load with empty file - test_store->save(); - test_store = NULL; - test_store = new LLBasicCertificateStore("mycertstore.pem"); - ensure_equals("when loading with nothing, we should result in no certs in store", test_store->size(), 0); - test_store=NULL; - - // instantiate a cert store from a file - llofstream certstorefile("mycertstore.pem", std::ios::out); - certstorefile << mPemChildCert << std::endl << mPemTestCert << std::endl; - certstorefile.close(); - // validate loaded certs - test_store = new LLBasicCertificateStore("mycertstore.pem"); - ensure_equals("two elements in store", test_store->size(), 2); - - // operator[] - X509* test_cert = (*test_store)[0]->getOpenSSLX509(); - - ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); - X509_free(test_cert); - test_cert = (*test_store)[1]->getOpenSSLX509(); - ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509TestCert)); - X509_free(test_cert); - - - // validate save - LLFile::remove("mycertstore.pem"); - test_store->save(); - test_store = NULL; - test_store = new LLBasicCertificateStore("mycertstore.pem"); - ensure_equals("two elements in store after save", test_store->size(), 2); - LLCertificateStore::iterator current_cert = test_store->begin(); - test_cert = (*current_cert)->getOpenSSLX509(); - ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); - current_cert++; - X509_free(test_cert); - test_cert = (*current_cert)->getOpenSSLX509(); - ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509TestCert)); - X509_free(test_cert); - current_cert++; - ensure("end of cert store", current_cert == test_store->end()); - - } - - // cert name wildcard matching - template<> template<> - void sechandler_basic_test_object::test<7>() - { - ensure("simple name match", - _cert_hostname_wildcard_match("foo", "foo")); - - ensure("simple name match, with end period", - _cert_hostname_wildcard_match("foo.", "foo.")); - - ensure("simple name match, with begin period", - _cert_hostname_wildcard_match(".foo", ".foo")); - - ensure("simple name match, with mismatched period cn", - _cert_hostname_wildcard_match("foo.", "foo")); - - ensure("simple name match, with mismatched period hostname", - _cert_hostname_wildcard_match("foo", "foo.")); - - ensure("simple name match, with subdomain", - _cert_hostname_wildcard_match("foo.bar", "foo.bar")); - - ensure("stutter name match", - _cert_hostname_wildcard_match("foobbbbfoo", "foo*bbbfoo")); - - ensure("simple name match, with beginning wildcard", - _cert_hostname_wildcard_match("foobar", "*bar")); - - ensure("simple name match, with ending wildcard", - _cert_hostname_wildcard_match("foobar", "foo*")); - - ensure("simple name match, with beginning null wildcard", - _cert_hostname_wildcard_match("foobar", "*foobar")); - - ensure("simple name match, with ending null wildcard", - _cert_hostname_wildcard_match("foobar", "foobar*")); - - ensure("simple name match, with embedded wildcard", - _cert_hostname_wildcard_match("foobar", "f*r")); - - ensure("simple name match, with embedded null wildcard", - _cert_hostname_wildcard_match("foobar", "foo*bar")); - - ensure("simple name match, with dual embedded wildcard", - _cert_hostname_wildcard_match("foobar", "f*o*ar")); - - ensure("simple name mismatch", - !_cert_hostname_wildcard_match("bar", "foo")); - - ensure("simple name mismatch, with end period", - !_cert_hostname_wildcard_match("foobar.", "foo.")); - - ensure("simple name mismatch, with begin period", - !_cert_hostname_wildcard_match(".foobar", ".foo")); - - ensure("simple name mismatch, with subdomain", - !_cert_hostname_wildcard_match("foobar.bar", "foo.bar")); - - ensure("simple name mismatch, with beginning wildcard", - !_cert_hostname_wildcard_match("foobara", "*bar")); - - ensure("simple name mismatch, with ending wildcard", - !_cert_hostname_wildcard_match("oobar", "foo*")); - - ensure("simple name mismatch, with embedded wildcard", - !_cert_hostname_wildcard_match("oobar", "f*r")); - - ensure("simple name mismatch, with dual embedded wildcard", - !_cert_hostname_wildcard_match("foobar", "f*d*ar")); - - ensure("simple wildcard", - _cert_hostname_wildcard_match("foobar", "*")); - - ensure("long domain", - _cert_hostname_wildcard_match("foo.bar.com", "foo.bar.com")); - - ensure("long domain with multiple wildcards", - _cert_hostname_wildcard_match("foo.bar.com", "*.b*r.com")); - - ensure("end periods", - _cert_hostname_wildcard_match("foo.bar.com.", "*.b*r.com.")); - - ensure("match end period", - _cert_hostname_wildcard_match("foo.bar.com.", "*.b*r.com")); - - ensure("match end period2", - _cert_hostname_wildcard_match("foo.bar.com", "*.b*r.com.")); - - ensure("wildcard mismatch", - !_cert_hostname_wildcard_match("bar.com", "*.bar.com")); - - ensure("wildcard match", - _cert_hostname_wildcard_match("foo.bar.com", "*.bar.com")); - - ensure("wildcard match", - _cert_hostname_wildcard_match("foo.foo.bar.com", "*.bar.com")); - - ensure("wildcard match", - _cert_hostname_wildcard_match("foo.foo.bar.com", "*.*.com")); - - ensure("wildcard mismatch", - !_cert_hostname_wildcard_match("foo.foo.bar.com", "*.foo.com")); - } - - // test cert chain - template<> template<> - void sechandler_basic_test_object::test<8>() - { - // validate create from empty chain - LLPointer test_chain = new LLBasicCertificateChain(NULL); - ensure_equals("when loading with nothing, we should result in no certs in chain", test_chain->size(), 0); - - // Single cert in the chain. - X509_STORE_CTX *test_store = X509_STORE_CTX_new(); - X509_STORE_CTX_set_cert(test_store, mX509ChildCert); - X509_STORE_CTX_set0_untrusted(test_store, NULL); - test_chain = new LLBasicCertificateChain(test_store); - X509_STORE_CTX_free(test_store); - ensure_equals("two elements in store", test_chain->size(), 1); - X509* test_cert = (*test_chain)[0]->getOpenSSLX509(); - ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); - X509_free(test_cert); - - // cert + CA - - test_store = X509_STORE_CTX_new(); - X509_STORE_CTX_set_cert(test_store, mX509ChildCert); - X509_STORE_CTX_set0_untrusted(test_store, sk_X509_new_null()); - sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509IntermediateCert); - test_chain = new LLBasicCertificateChain(test_store); - X509_STORE_CTX_free(test_store); - ensure_equals("two elements in store", test_chain->size(), 2); - test_cert = (*test_chain)[0]->getOpenSSLX509(); - ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); - X509_free(test_cert); - test_cert = (*test_chain)[1]->getOpenSSLX509(); - ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert)); - X509_free(test_cert); - - // cert + nonrelated - - test_store = X509_STORE_CTX_new(); - X509_STORE_CTX_set_cert(test_store, mX509ChildCert); - X509_STORE_CTX_set0_untrusted(test_store, sk_X509_new_null()); - sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509TestCert); - test_chain = new LLBasicCertificateChain(test_store); - X509_STORE_CTX_free(test_store); - ensure_equals("two elements in store", test_chain->size(), 1); - test_cert = (*test_chain)[0]->getOpenSSLX509(); - ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); - X509_free(test_cert); - - // cert + CA + nonrelated - test_store = X509_STORE_CTX_new(); - X509_STORE_CTX_set_cert(test_store, mX509ChildCert); - X509_STORE_CTX_set0_untrusted(test_store, sk_X509_new_null()); - sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509IntermediateCert); - sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509TestCert); - test_chain = new LLBasicCertificateChain(test_store); - X509_STORE_CTX_free(test_store); - ensure_equals("two elements in store", test_chain->size(), 2); - test_cert = (*test_chain)[0]->getOpenSSLX509(); - ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); - X509_free(test_cert); - test_cert = (*test_chain)[1]->getOpenSSLX509(); - ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert)); - X509_free(test_cert); - - // cert + intermediate + CA - test_store = X509_STORE_CTX_new(); - X509_STORE_CTX_set_cert(test_store, mX509ChildCert); - X509_STORE_CTX_set0_untrusted(test_store, sk_X509_new_null()); - sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509IntermediateCert); - sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509RootCert); - test_chain = new LLBasicCertificateChain(test_store); - X509_STORE_CTX_free(test_store); - ensure_equals("three elements in store", test_chain->size(), 3); - test_cert = (*test_chain)[0]->getOpenSSLX509(); - ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); - X509_free(test_cert); - test_cert = (*test_chain)[1]->getOpenSSLX509(); - ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert)); - X509_free(test_cert); - - test_cert = (*test_chain)[2]->getOpenSSLX509(); - ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509RootCert)); - X509_free(test_cert); - } - - // test cert validation - template<> template<> - void sechandler_basic_test_object::test<9>() - { - // start with a trusted store with our known root cert - LLFile::remove("mycertstore.pem"); - LLPointer test_store = new LLBasicCertificateStore("mycertstore.pem"); - test_store->add(new LLBasicCertificate(mX509RootCert, &mValidationDate)); - LLSD validation_params; - - // validate basic trust for a chain containing only the intermediate cert. (1 deep) - LLPointer test_chain = new LLBasicCertificateChain(NULL); - - test_chain->add(new LLBasicCertificate(mX509IntermediateCert, &mValidationDate)); - - test_store->validate(0, test_chain, validation_params); - - // add the root certificate to the chain and revalidate - test_chain->add(new LLBasicCertificate(mX509RootCert, &mValidationDate)); - test_store->validate(0, test_chain, validation_params); - - // add the child cert at the head of the chain, and revalidate (3 deep chain) - test_chain->insert(test_chain->begin(), new LLBasicCertificate(mX509ChildCert, &mValidationDate)); - test_store->validate(0, test_chain, validation_params); - - // basic failure cases - test_chain = new LLBasicCertificateChain(NULL); - //validate with only the child cert in chain, but child cert was previously - // trusted - test_chain->add(new LLBasicCertificate(mX509ChildCert, &mValidationDate)); - - // validate without the trust flag. - test_store->validate(VALIDATION_POLICY_TRUSTED, test_chain, validation_params); - - // Validate with child cert but no parent, and no parent in CA store - test_store = new LLBasicCertificateStore("mycertstore.pem"); - ensure_throws("no CA, with only a child cert", - LLCertValidationTrustException, - (*test_chain)[0], - test_store->validate, - VALIDATION_POLICY_TRUSTED, - test_chain, - validation_params); - - - // validate without the trust flag. - test_store->validate(0, test_chain, validation_params); - - // clear out the store - test_store = new LLBasicCertificateStore("mycertstore.pem"); - // append the intermediate cert - test_chain->add(new LLBasicCertificate(mX509IntermediateCert, &mValidationDate)); - ensure_throws("no CA, with child and intermediate certs", - LLCertValidationTrustException, - (*test_chain)[1], - test_store->validate, - VALIDATION_POLICY_TRUSTED | VALIDATION_POLICY_TRUSTED, - test_chain, - validation_params); - // validate without the trust flag - test_store->validate(0, test_chain, validation_params); - - // Test time validity - LLSD child_info; - ((*test_chain)[0])->getLLSD(child_info); - validation_params = LLSD::emptyMap(); - validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_FROM].asDate().secondsSinceEpoch() + 1.0); - test_store->validate(VALIDATION_POLICY_TIME | VALIDATION_POLICY_TRUSTED, - test_chain, validation_params); - - validation_params = LLSD::emptyMap(); - validation_params[CERT_VALIDATION_DATE] = child_info[CERT_VALID_FROM].asDate(); - - validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_FROM].asDate().secondsSinceEpoch() - 1.0); - - // test not yet valid - ensure_throws("Child cert not yet valid" , - LLCertValidationExpirationException, - (*test_chain)[0], - test_store->validate, - VALIDATION_POLICY_TIME | VALIDATION_POLICY_TRUSTED, - test_chain, - validation_params); - validation_params = LLSD::emptyMap(); - validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_TO].asDate().secondsSinceEpoch() + 1.0); - - // test cert expired - ensure_throws("Child cert expired", - LLCertValidationExpirationException, - (*test_chain)[0], - test_store->validate, - VALIDATION_POLICY_TIME | VALIDATION_POLICY_TRUSTED, - test_chain, - validation_params); - - // test SSL KU - // validate basic trust for a chain containing child and intermediate. - test_chain = new LLBasicCertificateChain(NULL); - test_chain->add(new LLBasicCertificate(mX509ChildCert, &mValidationDate)); - test_chain->add(new LLBasicCertificate(mX509IntermediateCert, &mValidationDate)); - test_store->validate(VALIDATION_POLICY_SSL_KU | VALIDATION_POLICY_TRUSTED, - test_chain, validation_params); - - test_chain = new LLBasicCertificateChain(NULL); - test_chain->add(new LLBasicCertificate(mX509TestCert, &mValidationDate)); - - test_store = new LLBasicCertificateStore("mycertstore.pem"); - ensure_throws("Cert doesn't have ku", - LLCertKeyUsageValidationException, - (*test_chain)[0], - test_store->validate, - VALIDATION_POLICY_SSL_KU | VALIDATION_POLICY_TRUSTED, - test_chain, - validation_params); - - test_store->validate(0, test_chain, validation_params); - } - -}; - +/** + * @file llsechandler_basic_test.cpp + * @author Roxie + * @date 2009-02-10 + * @brief Test the 'basic' sec handler functions + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "../llviewerprecompiledheaders.h" +#include "../test/lltut.h" +#include "../llsecapi.h" +#include "../llsechandler_basic.h" +#include "../../llxml/llcontrol.h" +#include "../llviewernetwork.h" +#include "lluuid.h" +#include "lldate.h" +#include "llxorcipher.h" +#include "apr_base64.h" +#include +#include +#include +#include +#include +#include +#include "llxorcipher.h" +#include +#include +#include +#include +#include +#include +#include +#include "../llmachineid.h" + +#define ensure_throws(str, exc_type, cert, func, ...) \ +try \ +{ \ +func(__VA_ARGS__); \ +fail("throws, " str); \ +} \ +catch(exc_type& except) \ +{ \ +LLSD cert_data; \ +cert->getLLSD(cert_data); \ +ensure("Exception cert is incorrect for " str, valueCompareLLSD(except.getCertData(), cert_data)); \ +} + +extern bool _cert_hostname_wildcard_match(const std::string& hostname, const std::string& wildcard_string); + +//---------------------------------------------------------------------------- +// Mock objects for the dependencies of the code we're testing + +std::string gFirstName; +std::string gLastName; +LLControlGroup::LLControlGroup(const std::string& name) +: LLInstanceTracker(name) {} +LLControlGroup::~LLControlGroup() {} +LLControlVariable* LLControlGroup::declareString(const std::string& name, + const std::string& initial_val, + const std::string& comment, + LLControlVariable::ePersist persist) {return NULL;} +void LLControlGroup::setString(std::string_view name, const std::string& val){} +std::string LLControlGroup::getString(std::string_view name) +{ + + if (name == "FirstName") + return gFirstName; + else if (name == "LastName") + return gLastName; + return ""; +} + +// Stub for --no-verify-ssl-cert +bool LLControlGroup::getBOOL(std::string_view name) { return false; } + +LLSD LLCredential::getLoginParams() +{ + LLSD result = LLSD::emptyMap(); + + // legacy credential + result["passwd"] = "$1$testpasssd"; + result["first"] = "myfirst"; + result["last"] ="mylast"; + return result; +} + +void LLCredential::identifierType(std::string &idType) +{ +} + +void LLCredential::authenticatorType(std::string &idType) +{ +} + + +LLControlGroup gSavedSettings("test"); +unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {77,21,46,31,89,2}; + + +S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len) +{ + memcpy(unique_id, gMACAddress, len); + return 1; +} +S32 LLMachineID::getLegacyID(unsigned char *unique_id, size_t len) +{ + return 0; +} +S32 LLMachineID::init() { return 1; } + + +LLCertException::LLCertException(const LLSD& cert_data, const std::string& msg) + : LLException(msg), + mCertData(cert_data) +{ + LL_WARNS("SECAPI") << "Certificate Error: " << msg << LL_ENDL; +} + + +// ------------------------------------------------------------------------------------------- +// TUT +// ------------------------------------------------------------------------------------------- +namespace tut +{ + const std::string mPemTestCert( + "Certificate:\n" + " Data:\n" + " Version: 3 (0x2)\n" + " Serial Number:\n" + " 04:00:00:00:00:01:15:4b:5a:c3:94\n" + " Signature Algorithm: sha1WithRSAEncryption\n" + " Issuer: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA\n" + " Validity\n" + " Not Before: Sep 1 12:00:00 1998 GMT\n" + " Not After : Jan 28 12:00:00 2028 GMT\n" + " Subject: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA\n" + " Subject Public Key Info:\n" + " Public Key Algorithm: rsaEncryption\n" + " Public-Key: (2048 bit)\n" + " Modulus:\n" + " 00:da:0e:e6:99:8d:ce:a3:e3:4f:8a:7e:fb:f1:8b:\n" + " 83:25:6b:ea:48:1f:f1:2a:b0:b9:95:11:04:bd:f0:\n" + " 63:d1:e2:67:66:cf:1c:dd:cf:1b:48:2b:ee:8d:89:\n" + " 8e:9a:af:29:80:65:ab:e9:c7:2d:12:cb:ab:1c:4c:\n" + " 70:07:a1:3d:0a:30:cd:15:8d:4f:f8:dd:d4:8c:50:\n" + " 15:1c:ef:50:ee:c4:2e:f7:fc:e9:52:f2:91:7d:e0:\n" + " 6d:d5:35:30:8e:5e:43:73:f2:41:e9:d5:6a:e3:b2:\n" + " 89:3a:56:39:38:6f:06:3c:88:69:5b:2a:4d:c5:a7:\n" + " 54:b8:6c:89:cc:9b:f9:3c:ca:e5:fd:89:f5:12:3c:\n" + " 92:78:96:d6:dc:74:6e:93:44:61:d1:8d:c7:46:b2:\n" + " 75:0e:86:e8:19:8a:d5:6d:6c:d5:78:16:95:a2:e9:\n" + " c8:0a:38:eb:f2:24:13:4f:73:54:93:13:85:3a:1b:\n" + " bc:1e:34:b5:8b:05:8c:b9:77:8b:b1:db:1f:20:91:\n" + " ab:09:53:6e:90:ce:7b:37:74:b9:70:47:91:22:51:\n" + " 63:16:79:ae:b1:ae:41:26:08:c8:19:2b:d1:46:aa:\n" + " 48:d6:64:2a:d7:83:34:ff:2c:2a:c1:6c:19:43:4a:\n" + " 07:85:e7:d3:7c:f6:21:68:ef:ea:f2:52:9f:7f:93:\n" + " 90:cf\n" + " Exponent: 65537 (0x10001)\n" + " X509v3 extensions:\n" + " X509v3 Key Usage: critical\n" + " Certificate Sign, CRL Sign\n" + " X509v3 Basic Constraints: critical\n" + " CA:TRUE\n" + " X509v3 Subject Key Identifier: \n" + " 60:7B:66:1A:45:0D:97:CA:89:50:2F:7D:04:CD:34:A8:FF:FC:FD:4B\n" + " Signature Algorithm: sha1WithRSAEncryption\n" + " d6:73:e7:7c:4f:76:d0:8d:bf:ec:ba:a2:be:34:c5:28:32:b5:\n" + " 7c:fc:6c:9c:2c:2b:bd:09:9e:53:bf:6b:5e:aa:11:48:b6:e5:\n" + " 08:a3:b3:ca:3d:61:4d:d3:46:09:b3:3e:c3:a0:e3:63:55:1b:\n" + " f2:ba:ef:ad:39:e1:43:b9:38:a3:e6:2f:8a:26:3b:ef:a0:50:\n" + " 56:f9:c6:0a:fd:38:cd:c4:0b:70:51:94:97:98:04:df:c3:5f:\n" + " 94:d5:15:c9:14:41:9c:c4:5d:75:64:15:0d:ff:55:30:ec:86:\n" + " 8f:ff:0d:ef:2c:b9:63:46:f6:aa:fc:df:bc:69:fd:2e:12:48:\n" + " 64:9a:e0:95:f0:a6:ef:29:8f:01:b1:15:b5:0c:1d:a5:fe:69:\n" + " 2c:69:24:78:1e:b3:a7:1c:71:62:ee:ca:c8:97:ac:17:5d:8a:\n" + " c2:f8:47:86:6e:2a:c4:56:31:95:d0:67:89:85:2b:f9:6c:a6:\n" + " 5d:46:9d:0c:aa:82:e4:99:51:dd:70:b7:db:56:3d:61:e4:6a:\n" + " e1:5c:d6:f6:fe:3d:de:41:cc:07:ae:63:52:bf:53:53:f4:2b:\n" + " e9:c7:fd:b6:f7:82:5f:85:d2:41:18:db:81:b3:04:1c:c5:1f:\n" + " a4:80:6f:15:20:c9:de:0c:88:0a:1d:d6:66:55:e2:fc:48:c9:\n" + " 29:26:69:e0\n" + "-----BEGIN CERTIFICATE-----\n" + "MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG\n" + "A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv\n" + "b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw\n" + "MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i\n" + "YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT\n" + "aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ\n" + "jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp\n" + "xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp\n" + "1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG\n" + "snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ\n" + "U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8\n" + "9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E\n" + "BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B\n" + "AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz\n" + "yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE\n" + "38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP\n" + "AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad\n" + "DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME\n" + "HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==\n" + "-----END CERTIFICATE-----\n" + ); + + /* + * The following certificates were generated using the instructions at + * https://jamielinux.com/docs/openssl-certificate-authority/sign-server-and-client-certificates.html + * with the exception that the server certificate has a longer expiration time, and the full text + * expansion was included in the certificates. + */ + const std::string mPemRootCert( + "Certificate:\n" + " Data:\n" + " Version: 3 (0x2)\n" + " Serial Number:\n" + " 82:2f:8f:eb:8d:06:24:b0\n" + " Signature Algorithm: sha256WithRSAEncryption\n" + " Issuer: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" + " Validity\n" + " Not Before: May 22 22:19:45 2018 GMT\n" + " Not After : May 17 22:19:45 2038 GMT\n" + " Subject: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" + " Subject Public Key Info:\n" + " Public Key Algorithm: rsaEncryption\n" + " Public-Key: (4096 bit)\n" + " Modulus:\n" + " 00:bd:e0:79:dd:3b:a6:ac:87:d0:39:f0:58:c7:a4:\n" + " 42:42:f6:5f:93:b0:36:04:b5:e2:d5:f7:2a:c0:6c:\n" + " a0:13:d2:1e:02:81:57:02:50:4c:57:b7:ef:27:9e:\n" + " f6:f1:f1:30:30:72:1e:57:34:e5:3f:82:3c:21:c4:\n" + " 66:d2:73:63:6c:91:e6:dd:49:9e:9c:b1:34:6a:81:\n" + " 45:a1:6e:c4:50:28:f2:d8:e3:fe:80:2f:83:aa:28:\n" + " 91:b4:8c:57:c9:f1:16:d9:0c:87:3c:25:80:a0:81:\n" + " 8d:71:f2:96:e2:16:f1:97:c4:b0:d8:53:bb:13:6c:\n" + " 73:54:2f:29:94:85:cf:86:6e:75:71:ad:39:e3:fc:\n" + " 39:12:53:93:1c:ce:39:e0:33:da:49:b7:3d:af:b0:\n" + " 37:ce:77:09:03:27:32:70:c0:9c:7f:9c:89:ce:90:\n" + " 45:b0:7d:94:8b:ff:13:27:ba:88:7f:ae:c4:aa:73:\n" + " d5:47:b8:87:69:89:80:0c:c1:22:18:78:c2:0d:47:\n" + " d9:10:ff:80:79:0d:46:71:ec:d9:ba:c9:f3:77:fd:\n" + " 92:6d:1f:0f:d9:54:18:6d:f6:72:24:5c:5c:3d:43:\n" + " 49:35:3e:1c:28:de:7e:44:dc:29:c3:9f:62:04:46:\n" + " aa:c4:e6:69:6a:15:f8:e3:74:1c:14:e9:f4:97:7c:\n" + " 30:6c:d4:28:fc:2a:0e:1d:6d:39:2e:1d:f9:17:43:\n" + " 35:5d:23:e7:ba:e3:a8:e9:97:6b:3c:3e:23:ef:d8:\n" + " bc:fb:7a:57:37:39:93:59:03:fc:78:ca:b1:31:ef:\n" + " 26:19:ed:56:e1:63:c3:ad:99:80:5b:47:b5:03:35:\n" + " 5f:fe:6a:a6:21:63:ec:50:fb:4e:c9:f9:ae:a5:66:\n" + " d0:55:33:8d:e6:c5:50:5a:c6:8f:5c:34:45:a7:72:\n" + " da:50:f6:66:4c:19:f5:d1:e4:fb:11:8b:a1:b5:4e:\n" + " 09:43:81:3d:39:28:86:3b:fe:07:28:97:02:b5:3a:\n" + " 07:5f:4a:20:80:1a:7d:a4:8c:f7:6c:f6:c5:9b:f6:\n" + " 61:e5:c7:b0:c3:d5:58:38:7b:bb:47:1e:34:d6:16:\n" + " 55:c5:d2:6c:b0:93:77:b1:90:69:06:b1:53:cb:1b:\n" + " 84:71:cf:b8:87:1b:1e:44:35:b4:2b:bb:04:59:58:\n" + " 0b:e8:93:d8:ae:21:9b:b1:1c:89:30:ae:11:80:77:\n" + " cc:16:f3:d6:35:ed:a1:b3:70:b3:4f:cd:a1:56:99:\n" + " ee:0e:c0:00:a4:09:70:c3:5b:0b:be:a1:07:18:dd:\n" + " c6:f4:6d:8b:58:bc:f9:bb:4b:01:2c:f6:cc:2c:9b:\n" + " 87:0e:b1:4f:9c:10:be:fc:45:e2:a4:ec:7e:fc:ff:\n" + " 45:b8:53\n" + " Exponent: 65537 (0x10001)\n" + " X509v3 extensions:\n" + " X509v3 Subject Key Identifier: \n" + " 8A:22:C6:9C:2E:11:F3:40:0C:CE:82:0C:22:59:FF:F8:7F:D0:B9:13\n" + " X509v3 Authority Key Identifier: \n" + " keyid:8A:22:C6:9C:2E:11:F3:40:0C:CE:82:0C:22:59:FF:F8:7F:D0:B9:13\n" + "\n" + " X509v3 Basic Constraints: critical\n" + " CA:TRUE\n" + " X509v3 Key Usage: critical\n" + " Digital Signature, Certificate Sign, CRL Sign\n" + " Signature Algorithm: sha256WithRSAEncryption\n" + " b3:cb:33:eb:0e:02:64:f4:55:9a:3d:03:9a:cf:6a:4c:18:43:\n" + " f7:42:cb:65:dc:61:52:e5:9f:2f:42:97:3c:93:16:22:d4:af:\n" + " ae:b2:0f:c3:9b:ef:e0:cc:ee:b6:b1:69:a3:d8:da:26:c3:ad:\n" + " 3b:c5:64:dc:9f:d4:c2:53:4b:91:6d:c4:92:09:0b:ac:f0:99:\n" + " be:6f:b9:3c:03:4a:6d:9f:01:5d:ec:5a:9a:f3:a7:e5:3b:2c:\n" + " 99:57:7d:7e:25:15:68:20:12:30:96:16:86:f5:db:74:90:60:\n" + " fe:8b:df:99:f6:f7:62:49:9f:bc:8d:45:23:0a:c8:73:b8:79:\n" + " 80:3c:b9:e5:72:85:4b:b3:81:66:74:a2:72:92:4c:44:fd:7b:\n" + " 46:2e:21:a2:a9:81:a2:f3:26:4d:e3:89:7d:78:b0:c6:6f:b5:\n" + " 87:cb:ee:25:ed:27:1f:75:13:fa:6d:e9:37:73:ad:07:bb:af:\n" + " d3:6c:87:ea:02:01:70:bd:53:aa:ce:39:2c:d4:66:39:33:aa:\n" + " d1:9c:ee:67:e3:a9:45:d2:7b:2e:54:09:af:70:5f:3f:5a:67:\n" + " 2e:6c:72:ef:e0:9d:92:28:4a:df:ba:0b:b7:23:ca:5b:04:11:\n" + " 45:d1:51:e9:ea:c9:ec:54:fa:34:46:ae:fc:dc:6c:f8:1e:2c:\n" + " 9e:f4:71:51:8d:b5:a1:26:9a:13:30:be:1e:41:25:59:58:05:\n" + " 2c:64:c8:f9:5e:38:ae:dc:93:b0:8a:d6:38:74:02:cb:ce:ce:\n" + " 95:31:76:f6:7c:bf:a4:a1:8e:27:fd:ca:74:82:d1:e1:4d:b6:\n" + " 48:51:fa:c5:17:59:22:a3:84:be:82:c8:83:ec:61:a0:f4:ee:\n" + " 2c:e3:a3:ea:e5:51:c9:d3:4f:db:85:bd:ba:7a:52:14:b6:03:\n" + " ed:43:17:d8:d7:1c:22:5e:c9:56:d9:d6:81:96:11:e3:5e:01:\n" + " 40:91:30:09:da:a3:5f:d3:27:60:e5:9d:6c:da:d0:f0:39:01:\n" + " 23:4a:a6:15:7a:4a:82:eb:ec:72:4a:1d:36:dc:6f:83:c4:85:\n" + " 84:b5:8d:cd:09:e5:12:63:f3:21:56:c8:64:6b:db:b8:cf:d4:\n" + " df:ca:a8:24:8e:df:8d:63:a5:96:84:bf:ff:8b:7e:46:7a:f0:\n" + " c7:73:7c:70:8a:f5:17:d0:ac:c8:89:1e:d7:89:42:0f:4d:66:\n" + " c4:d8:bb:36:a8:ae:ca:e1:cf:e2:88:f6:cf:b0:44:4a:5f:81:\n" + " 50:4b:d6:28:81:cd:6c:f0:ec:e6:09:08:f2:59:91:a2:69:ac:\n" + " c7:81:fa:ab:61:3e:db:6f:f6:7f:db:1a:9e:b9:5d:cc:cc:33:\n" + " fa:95:c6:f7:8d:4b:30:f3\n" + "-----BEGIN CERTIFICATE-----\n" + "MIIGXDCCBESgAwIBAgIJAIIvj+uNBiSwMA0GCSqGSIb3DQEBCwUAMIG6MQswCQYD\n" + "VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5j\n" + "aXNjbzETMBEGA1UECgwKTGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25kIExpZmUg\n" + "RW5naW5lZXJpbmcxITAfBgNVBAMMGEludGVncmF0aW9uIFRlc3QgUm9vdCBDQTEk\n" + "MCIGCSqGSIb3DQEJARYVbm9yZXBseUBsaW5kZW5sYWIuY29tMB4XDTE4MDUyMjIy\n" + "MTk0NVoXDTM4MDUxNzIyMTk0NVowgboxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApD\n" + "YWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMRMwEQYDVQQKDApMaW5k\n" + "ZW4gTGFiMSAwHgYDVQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVlcmluZzEhMB8GA1UE\n" + "AwwYSW50ZWdyYXRpb24gVGVzdCBSb290IENBMSQwIgYJKoZIhvcNAQkBFhVub3Jl\n" + "cGx5QGxpbmRlbmxhYi5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC\n" + "AQC94HndO6ash9A58FjHpEJC9l+TsDYEteLV9yrAbKAT0h4CgVcCUExXt+8nnvbx\n" + "8TAwch5XNOU/gjwhxGbSc2NskebdSZ6csTRqgUWhbsRQKPLY4/6AL4OqKJG0jFfJ\n" + "8RbZDIc8JYCggY1x8pbiFvGXxLDYU7sTbHNULymUhc+GbnVxrTnj/DkSU5Mczjng\n" + "M9pJtz2vsDfOdwkDJzJwwJx/nInOkEWwfZSL/xMnuoh/rsSqc9VHuIdpiYAMwSIY\n" + "eMINR9kQ/4B5DUZx7Nm6yfN3/ZJtHw/ZVBht9nIkXFw9Q0k1Phwo3n5E3CnDn2IE\n" + "RqrE5mlqFfjjdBwU6fSXfDBs1Cj8Kg4dbTkuHfkXQzVdI+e646jpl2s8PiPv2Lz7\n" + "elc3OZNZA/x4yrEx7yYZ7VbhY8OtmYBbR7UDNV/+aqYhY+xQ+07J+a6lZtBVM43m\n" + "xVBaxo9cNEWnctpQ9mZMGfXR5PsRi6G1TglDgT05KIY7/gcolwK1OgdfSiCAGn2k\n" + "jPds9sWb9mHlx7DD1Vg4e7tHHjTWFlXF0mywk3exkGkGsVPLG4Rxz7iHGx5ENbQr\n" + "uwRZWAvok9iuIZuxHIkwrhGAd8wW89Y17aGzcLNPzaFWme4OwACkCXDDWwu+oQcY\n" + "3cb0bYtYvPm7SwEs9swsm4cOsU+cEL78ReKk7H78/0W4UwIDAQABo2MwYTAdBgNV\n" + "HQ4EFgQUiiLGnC4R80AMzoIMIln/+H/QuRMwHwYDVR0jBBgwFoAUiiLGnC4R80AM\n" + "zoIMIln/+H/QuRMwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJ\n" + "KoZIhvcNAQELBQADggIBALPLM+sOAmT0VZo9A5rPakwYQ/dCy2XcYVLlny9ClzyT\n" + "FiLUr66yD8Ob7+DM7raxaaPY2ibDrTvFZNyf1MJTS5FtxJIJC6zwmb5vuTwDSm2f\n" + "AV3sWprzp+U7LJlXfX4lFWggEjCWFob123SQYP6L35n292JJn7yNRSMKyHO4eYA8\n" + "ueVyhUuzgWZ0onKSTET9e0YuIaKpgaLzJk3jiX14sMZvtYfL7iXtJx91E/pt6Tdz\n" + "rQe7r9Nsh+oCAXC9U6rOOSzUZjkzqtGc7mfjqUXSey5UCa9wXz9aZy5scu/gnZIo\n" + "St+6C7cjylsEEUXRUenqyexU+jRGrvzcbPgeLJ70cVGNtaEmmhMwvh5BJVlYBSxk\n" + "yPleOK7ck7CK1jh0AsvOzpUxdvZ8v6Shjif9ynSC0eFNtkhR+sUXWSKjhL6CyIPs\n" + "YaD07izjo+rlUcnTT9uFvbp6UhS2A+1DF9jXHCJeyVbZ1oGWEeNeAUCRMAnao1/T\n" + "J2DlnWza0PA5ASNKphV6SoLr7HJKHTbcb4PEhYS1jc0J5RJj8yFWyGRr27jP1N/K\n" + "qCSO341jpZaEv/+LfkZ68MdzfHCK9RfQrMiJHteJQg9NZsTYuzaorsrhz+KI9s+w\n" + "REpfgVBL1iiBzWzw7OYJCPJZkaJprMeB+qthPttv9n/bGp65XczMM/qVxveNSzDz\n" + "-----END CERTIFICATE-----\n" + ); + + const std::string mPemIntermediateCert( + "Certificate:\n" + " Data:\n" + " Version: 3 (0x2)\n" + " Serial Number: 4096 (0x1000)\n" + " Signature Algorithm: sha256WithRSAEncryption\n" + " Issuer: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" + " Validity\n" + " Not Before: May 22 22:39:08 2018 GMT\n" + " Not After : May 19 22:39:08 2028 GMT\n" + " Subject: C=US, ST=California, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Intermediate CA/emailAddress=noreply@lindenlab.com\n" + " Subject Public Key Info:\n" + " Public Key Algorithm: rsaEncryption\n" + " Public-Key: (4096 bit)\n" + " Modulus:\n" + " 00:ce:a3:70:e2:c4:fb:4b:97:90:a1:30:bb:c1:1b:\n" + " 13:b9:aa:7e:46:17:a3:26:8d:69:3f:5e:73:95:e8:\n" + " 6a:b1:0a:b4:8f:50:65:e3:c6:5c:39:24:34:df:0b:\n" + " b7:cc:ce:62:0c:36:5a:12:2c:fe:35:4c:e9:1c:ac:\n" + " 80:5e:24:99:d7:aa:bd:be:48:c0:62:64:77:36:88:\n" + " 66:ce:f4:a8:dd:d2:76:24:62:90:55:41:fc:1d:13:\n" + " 4e:a7:4e:57:bc:a8:a4:59:4b:2c:5a:1c:d8:cc:16:\n" + " de:e8:88:30:c9:95:df:2f:a6:14:28:0f:eb:34:46:\n" + " 12:58:ba:da:0e:e6:de:9c:15:f6:f4:e3:9f:74:aa:\n" + " 70:89:79:8b:e9:5a:7b:18:54:15:94:3a:23:0a:65:\n" + " 78:05:d9:33:90:2a:ce:15:18:0d:52:fc:5c:31:65:\n" + " 20:d0:12:37:8c:11:80:ba:d4:b0:82:73:00:4b:49:\n" + " be:cb:d6:bc:e7:cd:61:f3:00:98:99:74:5a:37:81:\n" + " 49:96:7e:14:01:1b:86:d2:d0:06:94:40:63:63:46:\n" + " 11:fc:33:5c:bd:3a:5e:d4:e5:44:47:64:50:bd:a6:\n" + " 97:55:70:64:9b:26:cc:de:20:82:90:6a:83:41:9c:\n" + " 6f:71:47:14:be:cb:68:7c:85:be:ef:2e:76:12:19:\n" + " d3:c9:87:32:b4:ac:60:20:16:28:2d:af:bc:e8:01:\n" + " c6:7f:fb:d8:11:d5:f4:b7:14:bd:27:08:5b:72:be:\n" + " 09:e0:91:c8:9c:7b:b4:b3:12:ef:32:36:be:b1:b9:\n" + " a2:b7:e3:69:47:30:76:ba:9c:9b:19:99:4d:53:dd:\n" + " 5c:e8:2c:f1:b2:64:69:cf:15:bd:f8:bb:58:95:73:\n" + " 58:38:95:b4:7a:cf:84:29:a6:c2:db:f0:bd:ef:97:\n" + " 26:d4:99:ac:d7:c7:be:b0:0d:11:f4:26:86:2d:77:\n" + " 42:52:25:d7:56:c7:e3:97:b1:36:5c:97:71:d0:9b:\n" + " f5:b5:50:8d:f9:ff:fb:10:77:3c:b5:53:6d:a1:43:\n" + " 35:a9:03:32:05:ab:d7:f5:d1:19:bd:5f:92:a3:00:\n" + " 2a:79:37:a4:76:4f:e9:32:0d:e4:86:bb:ea:c3:1a:\n" + " c5:33:e8:16:d4:a5:d8:e0:e8:bb:c2:f0:22:15:e2:\n" + " d9:8c:ae:ac:7d:2b:bf:eb:a3:4c:3b:29:1d:94:ac:\n" + " a3:bb:6d:ba:6d:03:91:03:cf:46:12:c4:66:21:c5:\n" + " c6:67:d8:11:19:79:01:0e:6e:84:1c:76:6f:11:3d:\n" + " eb:94:89:c5:6a:26:1f:cd:e0:11:8b:51:ee:99:35:\n" + " 69:e5:7f:0b:77:2a:94:e4:4b:64:b9:83:04:30:05:\n" + " e4:a2:e3\n" + " Exponent: 65537 (0x10001)\n" + " X509v3 extensions:\n" + " X509v3 Subject Key Identifier: \n" + " 83:21:DE:EC:C0:79:03:6D:1E:83:F3:E5:97:29:D5:5A:C0:96:40:FA\n" + " X509v3 Authority Key Identifier: \n" + " keyid:8A:22:C6:9C:2E:11:F3:40:0C:CE:82:0C:22:59:FF:F8:7F:D0:B9:13\n" + "\n" + " X509v3 Basic Constraints: critical\n" + " CA:TRUE, pathlen:0\n" + " X509v3 Key Usage: critical\n" + " Digital Signature, Certificate Sign, CRL Sign\n" + " Signature Algorithm: sha256WithRSAEncryption\n" + " a3:6c:85:9a:2e:4e:7e:5d:83:63:0f:f5:4f:a9:7d:ec:0e:6f:\n" + " ae:d7:ba:df:64:e0:46:0e:3d:da:18:15:2c:f3:73:ca:81:b1:\n" + " 10:d9:53:14:21:7d:72:5c:94:88:a5:9d:ad:ab:45:42:c6:64:\n" + " a9:d9:2e:4e:29:47:2c:b1:95:07:b7:62:48:68:1f:68:13:1c:\n" + " d2:a0:fb:5e:38:24:4a:82:0a:87:c9:93:20:43:7e:e9:f9:79:\n" + " ef:03:a2:bd:9e:24:6b:0a:01:5e:4a:36:c5:7d:7a:fe:d6:aa:\n" + " 2f:c2:8c:38:8a:99:3c:b0:6a:e5:60:be:56:d6:eb:60:03:55:\n" + " 24:42:a0:1a:fa:91:24:a3:53:15:75:5d:c8:eb:7c:1e:68:5a:\n" + " 7e:13:34:e3:85:37:1c:76:3f:77:67:1b:ed:1b:52:17:fc:4a:\n" + " a3:e2:74:84:80:2c:69:fc:dd:7d:26:97:c4:2a:69:7d:9c:dc:\n" + " 61:97:70:29:a7:3f:2b:5b:2b:22:51:fd:fe:6a:5d:f9:e7:14:\n" + " 48:b7:2d:c8:33:58:fc:f2:5f:27:f7:26:16:be:be:b5:aa:a2:\n" + " 64:53:3c:69:e8:b5:61:eb:ab:91:a5:b4:09:9b:f6:98:b8:5c:\n" + " 5b:24:2f:93:f5:2b:9c:8c:58:fb:26:3f:67:53:d7:42:64:e8:\n" + " 79:77:73:41:4e:e3:02:39:0b:b6:68:97:8b:84:e8:1d:83:a8:\n" + " 15:f1:06:46:47:80:42:5e:14:e2:61:8a:76:84:d5:d4:71:7f:\n" + " 4e:ff:d9:74:87:ff:32:c5:87:20:0a:d4:59:40:3e:d8:17:ef:\n" + " da:65:e9:0a:51:fe:1e:c3:46:91:d2:ee:e4:23:57:97:87:d4:\n" + " a6:a5:eb:ef:81:6a:d8:8c:d6:1f:8e:b1:18:4c:6b:89:32:55:\n" + " 53:68:26:9e:bb:03:be:2c:e9:8b:ff:97:9c:1c:ac:28:c3:9f:\n" + " 0b:b7:93:23:24:31:63:e4:19:13:f2:bb:08:71:b7:c5:c5:c4:\n" + " 10:ff:dc:fc:33:54:a4:5e:ec:a3:fe:0a:80:ca:9c:bc:95:6f:\n" + " 5f:39:91:3b:61:69:16:94:0f:57:4b:fc:4b:b1:be:72:98:5d:\n" + " 10:f9:08:a7:d6:e0:e8:3d:5d:54:7d:fa:4b:6a:dd:98:41:ed:\n" + " 84:a1:39:67:5c:6c:7f:0c:b0:e1:98:c1:14:ed:fe:1e:e8:05:\n" + " 8d:7f:6a:24:cb:1b:05:42:0d:7f:13:ba:ca:b5:91:db:a5:f0:\n" + " 40:2b:70:7a:2a:a5:5d:ed:56:0c:f0:c2:72:ee:63:dd:cb:5d:\n" + " 76:f6:08:e6:e6:30:ef:3a:b2:16:34:41:a4:e1:30:14:bc:c7:\n" + " f9:23:3a:1a:70:df:b8:cc\n" + "-----BEGIN CERTIFICATE-----\n" + "MIIGSDCCBDCgAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwgboxCzAJBgNVBAYTAlVT\n" + "MRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMRMw\n" + "EQYDVQQKDApMaW5kZW4gTGFiMSAwHgYDVQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVl\n" + "cmluZzEhMB8GA1UEAwwYSW50ZWdyYXRpb24gVGVzdCBSb290IENBMSQwIgYJKoZI\n" + "hvcNAQkBFhVub3JlcGx5QGxpbmRlbmxhYi5jb20wHhcNMTgwNTIyMjIzOTA4WhcN\n" + "MjgwNTE5MjIzOTA4WjCBqjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3Ju\n" + "aWExEzARBgNVBAoMCkxpbmRlbiBMYWIxIDAeBgNVBAsMF1NlY29uZCBMaWZlIEVu\n" + "Z2luZWVyaW5nMSkwJwYDVQQDDCBJbnRlZ3JhdGlvbiBUZXN0IEludGVybWVkaWF0\n" + "ZSBDQTEkMCIGCSqGSIb3DQEJARYVbm9yZXBseUBsaW5kZW5sYWIuY29tMIICIjAN\n" + "BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAzqNw4sT7S5eQoTC7wRsTuap+Rhej\n" + "Jo1pP15zlehqsQq0j1Bl48ZcOSQ03wu3zM5iDDZaEiz+NUzpHKyAXiSZ16q9vkjA\n" + "YmR3NohmzvSo3dJ2JGKQVUH8HRNOp05XvKikWUssWhzYzBbe6IgwyZXfL6YUKA/r\n" + "NEYSWLraDubenBX29OOfdKpwiXmL6Vp7GFQVlDojCmV4BdkzkCrOFRgNUvxcMWUg\n" + "0BI3jBGAutSwgnMAS0m+y9a8581h8wCYmXRaN4FJln4UARuG0tAGlEBjY0YR/DNc\n" + "vTpe1OVER2RQvaaXVXBkmybM3iCCkGqDQZxvcUcUvstofIW+7y52EhnTyYcytKxg\n" + "IBYoLa+86AHGf/vYEdX0txS9Jwhbcr4J4JHInHu0sxLvMja+sbmit+NpRzB2upyb\n" + "GZlNU91c6CzxsmRpzxW9+LtYlXNYOJW0es+EKabC2/C975cm1Jms18e+sA0R9CaG\n" + "LXdCUiXXVsfjl7E2XJdx0Jv1tVCN+f/7EHc8tVNtoUM1qQMyBavX9dEZvV+SowAq\n" + "eTekdk/pMg3khrvqwxrFM+gW1KXY4Oi7wvAiFeLZjK6sfSu/66NMOykdlKyju226\n" + "bQORA89GEsRmIcXGZ9gRGXkBDm6EHHZvET3rlInFaiYfzeARi1HumTVp5X8LdyqU\n" + "5EtkuYMEMAXkouMCAwEAAaNmMGQwHQYDVR0OBBYEFIMh3uzAeQNtHoPz5Zcp1VrA\n" + "lkD6MB8GA1UdIwQYMBaAFIoixpwuEfNADM6CDCJZ//h/0LkTMBIGA1UdEwEB/wQI\n" + "MAYBAf8CAQAwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQCjbIWa\n" + "Lk5+XYNjD/VPqX3sDm+u17rfZOBGDj3aGBUs83PKgbEQ2VMUIX1yXJSIpZ2tq0VC\n" + "xmSp2S5OKUcssZUHt2JIaB9oExzSoPteOCRKggqHyZMgQ37p+XnvA6K9niRrCgFe\n" + "SjbFfXr+1qovwow4ipk8sGrlYL5W1utgA1UkQqAa+pEko1MVdV3I63weaFp+EzTj\n" + "hTccdj93ZxvtG1IX/Eqj4nSEgCxp/N19JpfEKml9nNxhl3Appz8rWysiUf3+al35\n" + "5xRIty3IM1j88l8n9yYWvr61qqJkUzxp6LVh66uRpbQJm/aYuFxbJC+T9SucjFj7\n" + "Jj9nU9dCZOh5d3NBTuMCOQu2aJeLhOgdg6gV8QZGR4BCXhTiYYp2hNXUcX9O/9l0\n" + "h/8yxYcgCtRZQD7YF+/aZekKUf4ew0aR0u7kI1eXh9SmpevvgWrYjNYfjrEYTGuJ\n" + "MlVTaCaeuwO+LOmL/5ecHKwow58Lt5MjJDFj5BkT8rsIcbfFxcQQ/9z8M1SkXuyj\n" + "/gqAypy8lW9fOZE7YWkWlA9XS/xLsb5ymF0Q+Qin1uDoPV1UffpLat2YQe2EoTln\n" + "XGx/DLDhmMEU7f4e6AWNf2okyxsFQg1/E7rKtZHbpfBAK3B6KqVd7VYM8MJy7mPd\n" + "y1129gjm5jDvOrIWNEGk4TAUvMf5IzoacN+4zA==\n" + "-----END CERTIFICATE-----\n" + ); + + const std::string mPemChildCert( + "Certificate:\n" + " Data:\n" + " Version: 3 (0x2)\n" + " Serial Number: 4096 (0x1000)\n" + " Signature Algorithm: sha256WithRSAEncryption\n" + " Issuer: C=US, ST=California, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Intermediate CA/emailAddress=noreply@lindenlab.com\n" + " Validity\n" + " Not Before: May 22 22:58:15 2018 GMT\n" + " Not After : Jul 19 22:58:15 2024 GMT\n" + " Subject: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Server Cert/emailAddress=noreply@lindenlab.com\n" + " Subject Public Key Info:\n" + " Public Key Algorithm: rsaEncryption\n" + " Public-Key: (2048 bit)\n" + " Modulus:\n" + " 00:bf:a1:1c:76:82:4a:10:1d:25:0e:02:e2:7a:64:\n" + " 54:c7:94:c5:c0:98:d5:35:f3:cb:cb:30:ba:31:9c:\n" + " bd:4c:2f:4a:4e:24:03:4b:87:5c:c1:5c:fe:d9:89:\n" + " 3b:cb:01:bc:eb:a5:b7:78:dc:b3:58:e5:78:a7:15:\n" + " 34:50:30:aa:16:3a:b2:94:17:6d:1e:7f:b2:70:1e:\n" + " 96:41:bb:1d:e3:22:80:fa:dc:00:6a:fb:34:3e:67:\n" + " e7:c2:21:2f:1b:d3:af:04:49:91:eb:bb:60:e0:26:\n" + " 52:75:28:8a:08:5b:91:56:4e:51:50:40:51:70:af:\n" + " cb:80:66:c8:59:e9:e2:48:a8:62:d0:26:67:80:0a:\n" + " 12:16:d1:f6:15:9e:1f:f5:92:37:f3:c9:2f:03:9e:\n" + " 22:f6:60:5a:76:45:8c:01:2c:99:54:72:19:db:b7:\n" + " 72:e6:5a:69:f3:e9:31:65:5d:0f:c7:5c:9c:17:29:\n" + " 71:14:7f:db:47:c9:1e:65:a2:41:b0:2f:14:17:ec:\n" + " 4b:25:f2:43:8f:b4:a3:8d:37:1a:07:34:b3:29:bb:\n" + " 8a:44:8e:84:08:a2:1b:76:7a:cb:c2:39:2f:6e:e3:\n" + " fc:d6:91:b5:1f:ce:58:91:57:70:35:6e:25:a9:48:\n" + " 0e:07:cf:4e:dd:16:42:65:cf:8a:42:b3:27:e6:fe:\n" + " 6a:e3\n" + " Exponent: 65537 (0x10001)\n" + " X509v3 extensions:\n" + " X509v3 Basic Constraints: \n" + " CA:FALSE\n" + " Netscape Cert Type: \n" + " SSL Server\n" + " Netscape Comment: \n" + " OpenSSL Generated Server Certificate\n" + " X509v3 Subject Key Identifier: \n" + " BB:59:9F:DE:6B:51:A7:6C:B3:6D:5B:8B:42:F7:B1:65:77:17:A4:E4\n" + " X509v3 Authority Key Identifier: \n" + " keyid:83:21:DE:EC:C0:79:03:6D:1E:83:F3:E5:97:29:D5:5A:C0:96:40:FA\n" + " DirName:/C=US/ST=California/L=San Francisco/O=Linden Lab/OU=Second Life Engineering/CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" + " serial:10:00\n" + "\n" + " X509v3 Key Usage: critical\n" + " Digital Signature, Key Encipherment\n" + " X509v3 Extended Key Usage: \n" + " TLS Web Server Authentication\n" + " Signature Algorithm: sha256WithRSAEncryption\n" + " 18:a6:58:55:9b:d4:af:7d:8a:27:d3:28:3a:4c:4b:42:4e:f0:\n" + " 30:d6:d9:95:11:48:12:0a:96:40:d9:2b:21:39:c5:d4:8d:e5:\n" + " 10:bc:68:78:69:0b:9f:15:4a:0b:f1:ab:99:45:0c:20:5f:27:\n" + " df:e7:14:2d:4a:30:f2:c2:8d:37:73:36:1a:27:55:5a:08:5f:\n" + " 71:a1:5e:05:83:b2:59:fe:02:5e:d7:4a:30:15:23:58:04:cf:\n" + " 48:cc:b0:71:88:9c:6b:57:f0:04:0a:d3:a0:64:6b:ee:f3:5f:\n" + " ea:ac:e1:2b:b9:7f:79:b8:db:ce:72:48:72:db:c8:5c:38:72:\n" + " 31:55:d0:ff:6b:bd:73:23:a7:30:18:5d:ed:47:18:0a:67:8e:\n" + " 53:32:0e:99:9b:96:72:45:7f:c6:00:2c:5d:1a:97:53:75:3a:\n" + " 0b:49:3d:3a:00:37:14:67:0c:28:97:34:87:aa:c5:32:e4:ae:\n" + " 34:83:12:4a:10:f7:0e:74:d4:5f:73:bd:ef:0c:b7:d8:0a:7d:\n" + " 8e:8d:5a:48:bd:f4:8e:7b:f9:4a:15:3b:61:c9:5e:40:59:6e:\n" + " c7:a8:a4:02:28:72:c5:54:8c:77:f4:55:a7:86:c0:38:a0:68:\n" + " 19:da:0f:72:5a:a9:7e:69:9f:9c:3a:d6:66:aa:e1:f4:fd:f9:\n" + " b8:4b:6c:71:9e:f0:38:02:c7:6a:9e:dc:e6:fb:ef:23:59:4f:\n" + " 5c:84:0a:df:ea:86:1f:fd:0e:5c:fa:c4:e5:50:1c:10:cf:89:\n" + " 4e:08:0e:4c:4b:61:1a:49:12:f7:e9:4b:17:71:43:7b:6d:b6:\n" + " b5:9f:d4:3b:c7:88:53:48:63:b6:00:80:8f:49:0a:c5:7e:58:\n" + " ac:78:d8:b9:06:b0:bc:86:e2:2e:48:5b:c3:24:fa:aa:72:d8:\n" + " ec:f6:c7:91:9f:0f:c8:b5:fd:2b:b2:a7:bc:2f:40:20:2b:47:\n" + " e0:d1:1d:94:52:6f:6b:be:12:b6:8c:dc:11:db:71:e6:19:ef:\n" + " a8:71:8b:ad:d3:32:c0:1c:a4:3f:b3:0f:af:e5:50:e1:ff:41:\n" + " a4:b7:6f:57:71:af:fd:16:4c:e8:24:b3:99:1b:cf:12:8f:43:\n" + " 05:80:ba:18:19:0a:a5:ec:49:81:41:4c:7e:28:b2:21:f2:59:\n" + " 6e:4a:ed:de:f9:fa:99:85:60:1f:e6:c2:42:5c:08:00:3c:84:\n" + " 06:a9:24:d4:cf:7b:6e:1b:59:1d:f4:70:16:03:a1:e0:0b:00:\n" + " 95:5c:39:03:fc:9d:1c:8e:f7:59:0c:61:47:f6:7f:07:22:48:\n" + " 83:40:ac:e1:98:5f:c7:be:05:d5:29:2b:bf:0d:03:0e:e9:5e:\n" + " 2b:dd:09:18:fe:5e:30:61\n" + "-----BEGIN CERTIFICATE-----\n" + "MIIGbjCCBFagAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwgaoxCzAJBgNVBAYTAlVT\n" + "MRMwEQYDVQQIDApDYWxpZm9ybmlhMRMwEQYDVQQKDApMaW5kZW4gTGFiMSAwHgYD\n" + "VQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVlcmluZzEpMCcGA1UEAwwgSW50ZWdyYXRp\n" + "b24gVGVzdCBJbnRlcm1lZGlhdGUgQ0ExJDAiBgkqhkiG9w0BCQEWFW5vcmVwbHlA\n" + "bGluZGVubGFiLmNvbTAeFw0xODA1MjIyMjU4MTVaFw0yNDA3MTkyMjU4MTVaMIG+\n" + "MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2Fu\n" + "IEZyYW5jaXNjbzETMBEGA1UECgwKTGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25k\n" + "IExpZmUgRW5naW5lZXJpbmcxJTAjBgNVBAMMHEludGVncmF0aW9uIFRlc3QgU2Vy\n" + "dmVyIENlcnQxJDAiBgkqhkiG9w0BCQEWFW5vcmVwbHlAbGluZGVubGFiLmNvbTCC\n" + "ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL+hHHaCShAdJQ4C4npkVMeU\n" + "xcCY1TXzy8swujGcvUwvSk4kA0uHXMFc/tmJO8sBvOult3jcs1jleKcVNFAwqhY6\n" + "spQXbR5/snAelkG7HeMigPrcAGr7ND5n58IhLxvTrwRJkeu7YOAmUnUoighbkVZO\n" + "UVBAUXCvy4BmyFnp4kioYtAmZ4AKEhbR9hWeH/WSN/PJLwOeIvZgWnZFjAEsmVRy\n" + "Gdu3cuZaafPpMWVdD8dcnBcpcRR/20fJHmWiQbAvFBfsSyXyQ4+0o403Ggc0sym7\n" + "ikSOhAiiG3Z6y8I5L27j/NaRtR/OWJFXcDVuJalIDgfPTt0WQmXPikKzJ+b+auMC\n" + "AwEAAaOCAYYwggGCMAkGA1UdEwQCMAAwEQYJYIZIAYb4QgEBBAQDAgZAMDMGCWCG\n" + "SAGG+EIBDQQmFiRPcGVuU1NMIEdlbmVyYXRlZCBTZXJ2ZXIgQ2VydGlmaWNhdGUw\n" + "HQYDVR0OBBYEFLtZn95rUadss21bi0L3sWV3F6TkMIHoBgNVHSMEgeAwgd2AFIMh\n" + "3uzAeQNtHoPz5Zcp1VrAlkD6oYHApIG9MIG6MQswCQYDVQQGEwJVUzETMBEGA1UE\n" + "CAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzETMBEGA1UECgwK\n" + "TGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25kIExpZmUgRW5naW5lZXJpbmcxITAf\n" + "BgNVBAMMGEludGVncmF0aW9uIFRlc3QgUm9vdCBDQTEkMCIGCSqGSIb3DQEJARYV\n" + "bm9yZXBseUBsaW5kZW5sYWIuY29tggIQADAOBgNVHQ8BAf8EBAMCBaAwEwYDVR0l\n" + "BAwwCgYIKwYBBQUHAwEwDQYJKoZIhvcNAQELBQADggIBABimWFWb1K99iifTKDpM\n" + "S0JO8DDW2ZURSBIKlkDZKyE5xdSN5RC8aHhpC58VSgvxq5lFDCBfJ9/nFC1KMPLC\n" + "jTdzNhonVVoIX3GhXgWDsln+Al7XSjAVI1gEz0jMsHGInGtX8AQK06Bka+7zX+qs\n" + "4Su5f3m4285ySHLbyFw4cjFV0P9rvXMjpzAYXe1HGApnjlMyDpmblnJFf8YALF0a\n" + "l1N1OgtJPToANxRnDCiXNIeqxTLkrjSDEkoQ9w501F9zve8Mt9gKfY6NWki99I57\n" + "+UoVO2HJXkBZbseopAIocsVUjHf0VaeGwDigaBnaD3JaqX5pn5w61maq4fT9+bhL\n" + "bHGe8DgCx2qe3Ob77yNZT1yECt/qhh/9Dlz6xOVQHBDPiU4IDkxLYRpJEvfpSxdx\n" + "Q3tttrWf1DvHiFNIY7YAgI9JCsV+WKx42LkGsLyG4i5IW8Mk+qpy2Oz2x5GfD8i1\n" + "/Suyp7wvQCArR+DRHZRSb2u+EraM3BHbceYZ76hxi63TMsAcpD+zD6/lUOH/QaS3\n" + "b1dxr/0WTOgks5kbzxKPQwWAuhgZCqXsSYFBTH4osiHyWW5K7d75+pmFYB/mwkJc\n" + "CAA8hAapJNTPe24bWR30cBYDoeALAJVcOQP8nRyO91kMYUf2fwciSINArOGYX8e+\n" + "BdUpK78NAw7pXivdCRj+XjBh\n" + "-----END CERTIFICATE-----\n" + ); + + // Test wrapper declaration : wrapping nothing for the moment + struct sechandler_basic_test + { + X509 *mX509TestCert, *mX509RootCert, *mX509IntermediateCert, *mX509ChildCert; + LLSD mValidationDate; + + sechandler_basic_test() + { + LLMachineID::init(); + OpenSSL_add_all_algorithms(); + OpenSSL_add_all_ciphers(); + OpenSSL_add_all_digests(); + ERR_load_crypto_strings(); + gFirstName = ""; + gLastName = ""; + mValidationDate[CERT_VALIDATION_DATE] = LLDate("2017-04-11T00:00:00.00Z"); + LLFile::remove("test_password.dat"); + LLFile::remove("sechandler_settings.tmp"); + + mX509TestCert = NULL; + mX509RootCert = NULL; + mX509IntermediateCert = NULL; + mX509ChildCert = NULL; + + // Read each of the 4 Pem certs and store in mX509*Cert pointers + BIO * validation_bio; + validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), mPemTestCert.length()); + PEM_read_bio_X509(validation_bio, &mX509TestCert, 0, NULL); + BIO_free(validation_bio); + + validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), mPemRootCert.length()); + PEM_read_bio_X509(validation_bio, &mX509RootCert, 0, NULL); + BIO_free(validation_bio); + + validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), mPemIntermediateCert.length()); + PEM_read_bio_X509(validation_bio, &mX509IntermediateCert, 0, NULL); + BIO_free(validation_bio); + + validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), mPemChildCert.length()); + PEM_read_bio_X509(validation_bio, &mX509ChildCert, 0, NULL); + BIO_free(validation_bio); + } + ~sechandler_basic_test() + { + LLFile::remove("test_password.dat"); + LLFile::remove("sechandler_settings.tmp"); + LLFile::remove("mycertstore.pem"); + X509_free(mX509TestCert); + X509_free(mX509RootCert); + X509_free(mX509IntermediateCert); + X509_free(mX509ChildCert); + } + }; + + // Tut templating thingamagic: test group, object and test instance + typedef test_group sechandler_basic_test_factory; + typedef sechandler_basic_test_factory::object sechandler_basic_test_object; + tut::sechandler_basic_test_factory tut_test("LLSecHandler"); + + // --------------------------------------------------------------------------------------- + // Test functions + // --------------------------------------------------------------------------------------- + // test cert data retrieval + template<> template<> + void sechandler_basic_test_object::test<1>() + { + try + { + LLPointer test_cert(new LLBasicCertificate(mPemTestCert, &mValidationDate)); + LL_INFOS() << "ok" << LL_ENDL; + } + catch (LLCertException& cert_exception) + { + LL_INFOS() << "cert ex: " << cert_exception.getCertData() << LL_ENDL; + fail("cert exception"); + } + catch (...) + { + LOG_UNHANDLED_EXCEPTION("test 1"); + fail("other exception"); + } + } + + template<> template<> + void sechandler_basic_test_object::test<2>() + { + LLPointer test_cert(new LLBasicCertificate(mPemChildCert, &mValidationDate)); + + LLSD llsd_cert; + test_cert->getLLSD(llsd_cert); + //std::ostringstream llsd_value; + //llsd_value << LLSDOStreamer(llsd_cert) << std::endl; + LL_DEBUGS() << "test 1 cert " << llsd_cert << LL_ENDL; + + ensure_equals("Issuer Name/commonName", (std::string)llsd_cert["issuer_name"]["commonName"], "Integration Test Intermediate CA"); + ensure_equals("Issuer Name/countryName", (std::string)llsd_cert["issuer_name"]["countryName"], "US"); + ensure_equals("Issuer Name/state", (std::string)llsd_cert["issuer_name"]["stateOrProvinceName"], "California"); + ensure_equals("Issuer Name/org name", (std::string)llsd_cert["issuer_name"]["organizationName"], "Linden Lab"); + ensure_equals("Issuer Name/org unit", (std::string)llsd_cert["issuer_name"]["organizationalUnitName"], "Second Life Engineering"); + ensure_equals("Issuer name string", (std::string)llsd_cert["issuer_name_string"], + "emailAddress=noreply@lindenlab.com,CN=Integration Test Intermediate CA,OU=Second Life Engineering,O=Linden Lab,ST=California,C=US"); + ensure_equals("subject Name/commonName", (std::string)llsd_cert["subject_name"]["commonName"], + "Integration Test Server Cert"); + ensure_equals("subject Name/countryName", (std::string)llsd_cert["subject_name"]["countryName"], "US"); + ensure_equals("subject Name/state", (std::string)llsd_cert["subject_name"]["stateOrProvinceName"], "California"); + ensure_equals("subject Name/localityName", (std::string)llsd_cert["subject_name"]["localityName"], "San Francisco"); + ensure_equals("subject Name/org name", (std::string)llsd_cert["subject_name"]["organizationName"], "Linden Lab"); + ensure_equals("subjectName/org unit", + (std::string)llsd_cert["subject_name"]["organizationalUnitName"], "Second Life Engineering"); + + ensure_equals("subject name string", + (std::string)llsd_cert["subject_name_string"], + "emailAddress=noreply@lindenlab.com,CN=Integration Test Server Cert,OU=Second Life Engineering,O=Linden Lab,L=San Francisco,ST=California,C=US"); + ensure_equals("serial number", (std::string)llsd_cert["serial_number"], "1000"); + ensure_equals("valid from", (std::string)llsd_cert["valid_from"], "2018-05-22T22:58:15Z"); + ensure_equals("valid to", (std::string)llsd_cert["valid_to"], "2024-07-19T22:58:15Z"); + LLSD expectedKeyUsage = LLSD::emptyArray(); + expectedKeyUsage.append(LLSD((std::string)"digitalSignature")); + expectedKeyUsage.append(LLSD((std::string)"keyEncipherment")); + ensure("key usage", valueCompareLLSD(llsd_cert["keyUsage"], expectedKeyUsage)); + ensure_equals("basic constraints", llsd_cert["basicConstraints"]["CA"].asInteger(), 0); + + ensure("x509 is equal", !X509_cmp(mX509ChildCert, test_cert->getOpenSSLX509())); + } + + + // test protected data + template<> template<> + void sechandler_basic_test_object::test<3>() + { + std::string protected_data = "sUSh3wj77NG9oAMyt3XIhaej3KLZhLZWFZvI6rIGmwUUOmmelrRg0NI9rkOj8ZDpTPxpwToaBT5u" + "GQhakdaGLJznr9bHr4/6HIC1bouKj4n2rs4TL6j2WSjto114QdlNfLsE8cbbE+ghww58g8SeyLQO" + "nyzXoz+/PBz0HD5SMFDuObccoPW24gmqYySz8YoEWhSwO0pUtEEqOjVRsAJgF5wLAtJZDeuilGsq" + "4ZT9Y4wZ9Rh8nnF3fDUL6IGamHe1ClXM1jgBu10F6UMhZbnH4C3aJ2E9+LiOntU+l3iCb2MpkEpr" + "82r2ZAMwIrpnirL/xoYoyz7MJQYwUuMvBPToZJrxNSsjI+S2Z+I3iEJAELMAAA=="; + + std::vector binary_data(apr_base64_decode_len(protected_data.c_str())); + apr_base64_decode_binary(&binary_data[0], protected_data.c_str()); + + LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES); + cipher.decrypt(&binary_data[0], 16); + unsigned char unique_id[MAC_ADDRESS_BYTES]; + LLMachineID::getUniqueID(unique_id, sizeof(unique_id)); + LLXORCipher cipher2(unique_id, sizeof(unique_id)); + cipher2.encrypt(&binary_data[0], 16); + std::ofstream temp_file("sechandler_settings.tmp", std::ofstream::binary); + temp_file.write((const char *)&binary_data[0], binary_data.size()); + temp_file.close(); + + LLPointer handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", + "test_password.dat"); + handler->init(); + // data retrieval for existing data + LLSD data = handler->getProtectedData("test_data_type", "test_data_id"); + + + ensure_equals("retrieve existing data1", (std::string)data["data1"], "test_data_1"); + ensure_equals("retrieve existing data2", (std::string)data["data2"], "test_data_2"); + ensure_equals("retrieve existing data3", (std::string)data["data3"]["elem1"], "test element1"); + + // data storage + LLSD store_data = LLSD::emptyMap(); + store_data["store_data1"] = "test_store_data1"; + store_data["store_data2"] = 27; + store_data["store_data3"] = LLSD::emptyMap(); + store_data["store_data3"]["subelem1"] = "test_subelem1"; + + handler->setProtectedData("test_data_type", "test_data_id1", store_data); + data = handler->getProtectedData("test_data_type", "test_data_id"); + + data = handler->getProtectedData("test_data_type", "test_data_id"); + // verify no overwrite of existing data + ensure_equals("verify no overwrite 1", (std::string)data["data1"], "test_data_1"); + ensure_equals("verify no overwrite 2", (std::string)data["data2"], "test_data_2"); + ensure_equals("verify no overwrite 3", (std::string)data["data3"]["elem1"], "test element1"); + + // verify written data is good + data = handler->getProtectedData("test_data_type", "test_data_id1"); + ensure_equals("verify stored data1", (std::string)data["store_data1"], "test_store_data1"); + ensure_equals("verify stored data2", (int)data["store_data2"], 27); + ensure_equals("verify stored data3", (std::string)data["store_data3"]["subelem1"], "test_subelem1"); + + // verify overwrite works + handler->setProtectedData("test_data_type", "test_data_id", store_data); + data = handler->getProtectedData("test_data_type", "test_data_id"); + ensure_equals("verify overwrite stored data1", (std::string)data["store_data1"], "test_store_data1"); + ensure_equals("verify overwrite stored data2", (int)data["store_data2"], 27); + ensure_equals("verify overwrite stored data3", (std::string)data["store_data3"]["subelem1"], "test_subelem1"); + + // verify other datatype doesn't conflict + store_data["store_data3"] = "test_store_data3"; + store_data["store_data4"] = 28; + store_data["store_data5"] = LLSD::emptyMap(); + store_data["store_data5"]["subelem2"] = "test_subelem2"; + + handler->setProtectedData("test_data_type1", "test_data_id", store_data); + data = handler->getProtectedData("test_data_type1", "test_data_id"); + ensure_equals("verify datatype stored data3", (std::string)data["store_data3"], "test_store_data3"); + ensure_equals("verify datatype stored data4", (int)data["store_data4"], 28); + ensure_equals("verify datatype stored data5", (std::string)data["store_data5"]["subelem2"], "test_subelem2"); + + // test data not found + + data = handler->getProtectedData("test_data_type1", "test_data_not_found"); + ensure("not found", data.isUndefined()); + + // cause a 'write' by using 'LLPointer' to delete then instantiate a handler + handler = NULL; + handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat"); + handler->init(); + + data = handler->getProtectedData("test_data_type1", "test_data_id"); + ensure_equals("verify datatype stored data3a", (std::string)data["store_data3"], "test_store_data3"); + ensure_equals("verify datatype stored data4a", (int)data["store_data4"], 28); + ensure_equals("verify datatype stored data5a", (std::string)data["store_data5"]["subelem2"], "test_subelem2"); + + // rewrite the initial file to verify reloads + handler = NULL; + std::ofstream temp_file2("sechandler_settings.tmp", std::ofstream::binary); + temp_file2.write((const char *)&binary_data[0], binary_data.size()); + temp_file2.close(); + + // cause a 'write' + handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat"); + handler->init(); + data = handler->getProtectedData("test_data_type1", "test_data_id"); + ensure("not found", data.isUndefined()); + + handler->deleteProtectedData("test_data_type", "test_data_id"); + ensure("Deleted data not found", handler->getProtectedData("test_data_type", "test_data_id").isUndefined()); + + LLFile::remove("sechandler_settings.tmp"); + handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat"); + handler->init(); + data = handler->getProtectedData("test_data_type1", "test_data_id"); + ensure("not found", data.isUndefined()); + handler = NULL; + + ensure(LLFile::isfile("sechandler_settings.tmp")); + } + + // test credenitals + template<> template<> + void sechandler_basic_test_object::test<4>() + { + LLPointer handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat"); + handler->init(); + + LLSD my_id = LLSD::emptyMap(); + LLSD my_authenticator = LLSD::emptyMap(); + my_id["type"] = "test_type"; + my_id["username"] = "testuser@lindenlab.com"; + my_authenticator["type"] = "test_auth"; + my_authenticator["creds"] = "12345"; + + // test creation of credentials + LLPointer my_cred = handler->createCredential("my_grid", my_id, my_authenticator); + + // test retrieval of credential components + ensure_equals("basic credential creation: identifier", my_id, my_cred->getIdentifier()); + ensure_equals("basic credential creation: authenticator", my_authenticator, my_cred->getAuthenticator()); + ensure_equals("basic credential creation: grid", "my_grid", my_cred->getGrid()); + + // test setting/overwriting of credential components + my_id["first_name"] = "firstname"; + my_id.erase("username"); + my_authenticator.erase("creds"); + my_authenticator["hash"] = "6563245"; + + my_cred->setCredentialData(my_id, my_authenticator); + ensure_equals("set credential data: identifier", my_id, my_cred->getIdentifier()); + ensure_equals("set credential data: authenticator", my_authenticator, my_cred->getAuthenticator()); + ensure_equals("set credential data: grid", "my_grid", my_cred->getGrid()); + + // test loading of a credential, that hasn't been saved, without + // any legacy saved credential data + LLPointer my_new_cred = handler->loadCredential("my_grid2"); + ensure("unknown credential load test", my_new_cred->getIdentifier().isMap()); + ensure("unknown credential load test", !my_new_cred->getIdentifier().has("type")); + ensure("unknown credential load test", my_new_cred->getAuthenticator().isMap()); + ensure("unknown credential load test", !my_new_cred->getAuthenticator().has("type")); + // test saving of a credential + handler->saveCredential(my_cred, true); + + // test loading of a known credential + my_new_cred = handler->loadCredential("my_grid"); + ensure_equals("load a known credential: identifier", my_id, my_new_cred->getIdentifier()); + ensure_equals("load a known credential: authenticator",my_authenticator, my_new_cred->getAuthenticator()); + ensure_equals("load a known credential: grid", "my_grid", my_cred->getGrid()); + + // test deletion of a credential + handler->deleteCredential(my_new_cred); + + ensure("delete credential: identifier", my_new_cred->getIdentifier().isUndefined()); + ensure("delete credentialt: authenticator", my_new_cred->getIdentifier().isUndefined()); + ensure_equals("delete credential: grid", "my_grid", my_cred->getGrid()); + // load unknown cred + + my_new_cred = handler->loadCredential("my_grid"); + ensure("deleted credential load test", my_new_cred->getIdentifier().isMap()); + ensure("deleted credential load test", !my_new_cred->getIdentifier().has("type")); + ensure("deleted credential load test", my_new_cred->getAuthenticator().isMap()); + ensure("deleted credential load test", !my_new_cred->getAuthenticator().has("type")); + + // test loading of an unknown credential with legacy saved username, but without + // saved password + gFirstName = "myfirstname"; + gLastName = "mylastname"; + my_new_cred = handler->loadCredential("my_legacy_grid"); + ensure_equals("legacy credential with no password: type", + (const std::string)my_new_cred->getIdentifier()["type"], "agent"); + ensure_equals("legacy credential with no password: first_name", + (const std::string)my_new_cred->getIdentifier()["first_name"], "myfirstname"); + ensure_equals("legacy credential with no password: last_name", + (const std::string)my_new_cred->getIdentifier()["last_name"], "mylastname"); + + ensure("legacy credential with no password: no authenticator", my_new_cred->getAuthenticator().isUndefined()); + + // test loading of an unknown credential with legacy saved password and username + + std::string hashed_password = "fSQcLG03eyIWJmkzfyYaKm81dSweLmsxeSAYKGE7fSQ="; + int length = apr_base64_decode_len(hashed_password.c_str()); + std::vector decoded_password(length); + apr_base64_decode(&decoded_password[0], hashed_password.c_str()); + LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES); + cipher.decrypt((U8*)&decoded_password[0], length); + unsigned char unique_id[MAC_ADDRESS_BYTES]; + LLMachineID::getUniqueID(unique_id, sizeof(unique_id)); + LLXORCipher cipher2(unique_id, sizeof(unique_id)); + cipher2.encrypt((U8*)&decoded_password[0], length); + llofstream password_file("test_password.dat", std::ofstream::binary); + password_file.write(&decoded_password[0], length); + password_file.close(); + + my_new_cred = handler->loadCredential("my_legacy_grid2"); + ensure_equals("legacy credential with password: type", + (const std::string)my_new_cred->getIdentifier()["type"], "agent"); + ensure_equals("legacy credential with password: first_name", + (const std::string)my_new_cred->getIdentifier()["first_name"], "myfirstname"); + ensure_equals("legacy credential with password: last_name", + (const std::string)my_new_cred->getIdentifier()["last_name"], "mylastname"); + + LLSD legacy_authenticator = my_new_cred->getAuthenticator(); + ensure_equals("legacy credential with password: type", + (std::string)legacy_authenticator["type"], + "hash"); + ensure_equals("legacy credential with password: algorithm", + (std::string)legacy_authenticator["algorithm"], + "md5"); + ensure_equals("legacy credential with password: algorithm", + (std::string)legacy_authenticator["secret"], + "01234567890123456789012345678901"); + + // test creation of credentials + my_cred = handler->createCredential("mysavedgrid", my_id, my_authenticator); + // test save without saving authenticator. + handler->saveCredential(my_cred, false); + my_new_cred = handler->loadCredential("mysavedgrid"); + ensure_equals("saved credential without auth", + (const std::string)my_new_cred->getIdentifier()["type"], "test_type"); + ensure("no authenticator values were saved", my_new_cred->getAuthenticator().isUndefined()); + } + + // test cert vector + template<> template<> + void sechandler_basic_test_object::test<5>() + { + // validate create from empty vector + LLPointer test_vector = new LLBasicCertificateVector(); + ensure_equals("when loading with nothing, we should result in no certs in vector", test_vector->size(), 0); + + test_vector->add(new LLBasicCertificate(mPemTestCert, &mValidationDate)); + ensure_equals("one element in vector", test_vector->size(), 1); + test_vector->add(new LLBasicCertificate(mPemChildCert, &mValidationDate)); + ensure_equals("two elements in vector after add", test_vector->size(), 2); + + // add duplicate; should be a no-op (and log at DEBUG level) + test_vector->add(new LLBasicCertificate(mPemChildCert, &mValidationDate)); + ensure_equals("two elements in vector after re-add", test_vector->size(), 2); + + // validate order + X509* test_cert = (*test_vector)[0]->getOpenSSLX509(); + ensure("first cert added remains first cert", !X509_cmp(test_cert, mX509TestCert)); + X509_free(test_cert); + + test_cert = (*test_vector)[1]->getOpenSSLX509(); + ensure("second cert is second cert", !X509_cmp(test_cert, mX509ChildCert)); + X509_free(test_cert); + + // + // validate iterator + // + LLBasicCertificateVector::iterator current_cert = test_vector->begin(); + LLBasicCertificateVector::iterator copy_current_cert = current_cert; + // operator++(int) + ensure("validate iterator++ element in vector is expected cert", *current_cert++ == (*test_vector)[0]); + ensure("validate 2nd iterator++ element in vector is expected cert", *current_cert++ == (*test_vector)[1]); + ensure("validate end iterator++", current_cert == test_vector->end()); + + // copy + ensure("validate copy iterator element in vector is expected cert", *copy_current_cert == (*test_vector)[0]); + + // operator--(int) + current_cert--; + ensure("validate iterator-- element in vector is expected cert", *current_cert-- == (*test_vector)[1]); + ensure("validate iterator-- element in vector is expected cert", *current_cert == (*test_vector)[0]); + + ensure("begin iterator is equal", current_cert == test_vector->begin()); + + // operator++ + ensure("validate ++iterator element in vector is expected cert", *++current_cert == (*test_vector)[1]); + ensure("end of cert vector after ++iterator", ++current_cert == test_vector->end()); + // operator-- + ensure("validate --iterator element in vector is expected cert", *--current_cert == (*test_vector)[1]); + ensure("validate 2nd --iterator element in vector is expected cert", *--current_cert == (*test_vector)[0]); + + test_vector->erase(test_vector->begin()); + ensure_equals("one element in store after remove", test_vector->size(), 1); + test_cert = (*test_vector)[0]->getOpenSSLX509(); + ensure("Child cert remains", !X509_cmp(test_cert, mX509ChildCert)); + X509_free(test_cert); + + // validate insert + test_vector->insert(test_vector->begin(), new LLBasicCertificate(mPemIntermediateCert, &mValidationDate)); + test_cert = (*test_vector)[0]->getOpenSSLX509(); + ensure_equals("two elements in store after insert", test_vector->size(), 2); + ensure("validate intermediate cert was inserted at first position", !X509_cmp(test_cert, mX509IntermediateCert)); + X509_free(test_cert); + test_cert = (*test_vector)[1]->getOpenSSLX509(); + ensure("validate child cert still there", !X509_cmp(test_cert, mX509ChildCert)); + X509_free(test_cert); + + //validate find + LLSD find_info = LLSD::emptyMap(); + find_info["subjectKeyIdentifier"] = "bb:59:9f:de:6b:51:a7:6c:b3:6d:5b:8b:42:f7:b1:65:77:17:a4:e4"; + LLBasicCertificateVector::iterator found_cert = test_vector->find(find_info); + ensure("found some cert", found_cert != test_vector->end()); + X509* found_x509 = (*found_cert).get()->getOpenSSLX509(); + ensure("child cert was found", !X509_cmp(found_x509, mX509ChildCert)); + X509_free(found_x509); + + find_info["subjectKeyIdentifier"] = "00:00:00:00"; // bogus + current_cert =test_vector->find(find_info); + ensure("didn't find cert", current_cert == test_vector->end()); + } + + // test cert store + template<> template<> + void sechandler_basic_test_object::test<6>() + { + // validate load with nothing + LLFile::remove("mycertstore.pem"); + LLPointer test_store = new LLBasicCertificateStore("mycertstore.pem"); + ensure_equals("when loading with nothing, we should result in no certs in store", test_store->size(), 0); + + // validate load with empty file + test_store->save(); + test_store = NULL; + test_store = new LLBasicCertificateStore("mycertstore.pem"); + ensure_equals("when loading with nothing, we should result in no certs in store", test_store->size(), 0); + test_store=NULL; + + // instantiate a cert store from a file + llofstream certstorefile("mycertstore.pem", std::ios::out); + certstorefile << mPemChildCert << std::endl << mPemTestCert << std::endl; + certstorefile.close(); + // validate loaded certs + test_store = new LLBasicCertificateStore("mycertstore.pem"); + ensure_equals("two elements in store", test_store->size(), 2); + + // operator[] + X509* test_cert = (*test_store)[0]->getOpenSSLX509(); + + ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); + X509_free(test_cert); + test_cert = (*test_store)[1]->getOpenSSLX509(); + ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509TestCert)); + X509_free(test_cert); + + + // validate save + LLFile::remove("mycertstore.pem"); + test_store->save(); + test_store = NULL; + test_store = new LLBasicCertificateStore("mycertstore.pem"); + ensure_equals("two elements in store after save", test_store->size(), 2); + LLCertificateStore::iterator current_cert = test_store->begin(); + test_cert = (*current_cert)->getOpenSSLX509(); + ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); + current_cert++; + X509_free(test_cert); + test_cert = (*current_cert)->getOpenSSLX509(); + ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509TestCert)); + X509_free(test_cert); + current_cert++; + ensure("end of cert store", current_cert == test_store->end()); + + } + + // cert name wildcard matching + template<> template<> + void sechandler_basic_test_object::test<7>() + { + ensure("simple name match", + _cert_hostname_wildcard_match("foo", "foo")); + + ensure("simple name match, with end period", + _cert_hostname_wildcard_match("foo.", "foo.")); + + ensure("simple name match, with begin period", + _cert_hostname_wildcard_match(".foo", ".foo")); + + ensure("simple name match, with mismatched period cn", + _cert_hostname_wildcard_match("foo.", "foo")); + + ensure("simple name match, with mismatched period hostname", + _cert_hostname_wildcard_match("foo", "foo.")); + + ensure("simple name match, with subdomain", + _cert_hostname_wildcard_match("foo.bar", "foo.bar")); + + ensure("stutter name match", + _cert_hostname_wildcard_match("foobbbbfoo", "foo*bbbfoo")); + + ensure("simple name match, with beginning wildcard", + _cert_hostname_wildcard_match("foobar", "*bar")); + + ensure("simple name match, with ending wildcard", + _cert_hostname_wildcard_match("foobar", "foo*")); + + ensure("simple name match, with beginning null wildcard", + _cert_hostname_wildcard_match("foobar", "*foobar")); + + ensure("simple name match, with ending null wildcard", + _cert_hostname_wildcard_match("foobar", "foobar*")); + + ensure("simple name match, with embedded wildcard", + _cert_hostname_wildcard_match("foobar", "f*r")); + + ensure("simple name match, with embedded null wildcard", + _cert_hostname_wildcard_match("foobar", "foo*bar")); + + ensure("simple name match, with dual embedded wildcard", + _cert_hostname_wildcard_match("foobar", "f*o*ar")); + + ensure("simple name mismatch", + !_cert_hostname_wildcard_match("bar", "foo")); + + ensure("simple name mismatch, with end period", + !_cert_hostname_wildcard_match("foobar.", "foo.")); + + ensure("simple name mismatch, with begin period", + !_cert_hostname_wildcard_match(".foobar", ".foo")); + + ensure("simple name mismatch, with subdomain", + !_cert_hostname_wildcard_match("foobar.bar", "foo.bar")); + + ensure("simple name mismatch, with beginning wildcard", + !_cert_hostname_wildcard_match("foobara", "*bar")); + + ensure("simple name mismatch, with ending wildcard", + !_cert_hostname_wildcard_match("oobar", "foo*")); + + ensure("simple name mismatch, with embedded wildcard", + !_cert_hostname_wildcard_match("oobar", "f*r")); + + ensure("simple name mismatch, with dual embedded wildcard", + !_cert_hostname_wildcard_match("foobar", "f*d*ar")); + + ensure("simple wildcard", + _cert_hostname_wildcard_match("foobar", "*")); + + ensure("long domain", + _cert_hostname_wildcard_match("foo.bar.com", "foo.bar.com")); + + ensure("long domain with multiple wildcards", + _cert_hostname_wildcard_match("foo.bar.com", "*.b*r.com")); + + ensure("end periods", + _cert_hostname_wildcard_match("foo.bar.com.", "*.b*r.com.")); + + ensure("match end period", + _cert_hostname_wildcard_match("foo.bar.com.", "*.b*r.com")); + + ensure("match end period2", + _cert_hostname_wildcard_match("foo.bar.com", "*.b*r.com.")); + + ensure("wildcard mismatch", + !_cert_hostname_wildcard_match("bar.com", "*.bar.com")); + + ensure("wildcard match", + _cert_hostname_wildcard_match("foo.bar.com", "*.bar.com")); + + ensure("wildcard match", + _cert_hostname_wildcard_match("foo.foo.bar.com", "*.bar.com")); + + ensure("wildcard match", + _cert_hostname_wildcard_match("foo.foo.bar.com", "*.*.com")); + + ensure("wildcard mismatch", + !_cert_hostname_wildcard_match("foo.foo.bar.com", "*.foo.com")); + } + + // test cert chain + template<> template<> + void sechandler_basic_test_object::test<8>() + { + // validate create from empty chain + LLPointer test_chain = new LLBasicCertificateChain(NULL); + ensure_equals("when loading with nothing, we should result in no certs in chain", test_chain->size(), 0); + + // Single cert in the chain. + X509_STORE_CTX *test_store = X509_STORE_CTX_new(); + X509_STORE_CTX_set_cert(test_store, mX509ChildCert); + X509_STORE_CTX_set0_untrusted(test_store, NULL); + test_chain = new LLBasicCertificateChain(test_store); + X509_STORE_CTX_free(test_store); + ensure_equals("two elements in store", test_chain->size(), 1); + X509* test_cert = (*test_chain)[0]->getOpenSSLX509(); + ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); + X509_free(test_cert); + + // cert + CA + + test_store = X509_STORE_CTX_new(); + X509_STORE_CTX_set_cert(test_store, mX509ChildCert); + X509_STORE_CTX_set0_untrusted(test_store, sk_X509_new_null()); + sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509IntermediateCert); + test_chain = new LLBasicCertificateChain(test_store); + X509_STORE_CTX_free(test_store); + ensure_equals("two elements in store", test_chain->size(), 2); + test_cert = (*test_chain)[0]->getOpenSSLX509(); + ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); + X509_free(test_cert); + test_cert = (*test_chain)[1]->getOpenSSLX509(); + ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert)); + X509_free(test_cert); + + // cert + nonrelated + + test_store = X509_STORE_CTX_new(); + X509_STORE_CTX_set_cert(test_store, mX509ChildCert); + X509_STORE_CTX_set0_untrusted(test_store, sk_X509_new_null()); + sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509TestCert); + test_chain = new LLBasicCertificateChain(test_store); + X509_STORE_CTX_free(test_store); + ensure_equals("two elements in store", test_chain->size(), 1); + test_cert = (*test_chain)[0]->getOpenSSLX509(); + ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); + X509_free(test_cert); + + // cert + CA + nonrelated + test_store = X509_STORE_CTX_new(); + X509_STORE_CTX_set_cert(test_store, mX509ChildCert); + X509_STORE_CTX_set0_untrusted(test_store, sk_X509_new_null()); + sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509IntermediateCert); + sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509TestCert); + test_chain = new LLBasicCertificateChain(test_store); + X509_STORE_CTX_free(test_store); + ensure_equals("two elements in store", test_chain->size(), 2); + test_cert = (*test_chain)[0]->getOpenSSLX509(); + ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); + X509_free(test_cert); + test_cert = (*test_chain)[1]->getOpenSSLX509(); + ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert)); + X509_free(test_cert); + + // cert + intermediate + CA + test_store = X509_STORE_CTX_new(); + X509_STORE_CTX_set_cert(test_store, mX509ChildCert); + X509_STORE_CTX_set0_untrusted(test_store, sk_X509_new_null()); + sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509IntermediateCert); + sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509RootCert); + test_chain = new LLBasicCertificateChain(test_store); + X509_STORE_CTX_free(test_store); + ensure_equals("three elements in store", test_chain->size(), 3); + test_cert = (*test_chain)[0]->getOpenSSLX509(); + ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); + X509_free(test_cert); + test_cert = (*test_chain)[1]->getOpenSSLX509(); + ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert)); + X509_free(test_cert); + + test_cert = (*test_chain)[2]->getOpenSSLX509(); + ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509RootCert)); + X509_free(test_cert); + } + + // test cert validation + template<> template<> + void sechandler_basic_test_object::test<9>() + { + // start with a trusted store with our known root cert + LLFile::remove("mycertstore.pem"); + LLPointer test_store = new LLBasicCertificateStore("mycertstore.pem"); + test_store->add(new LLBasicCertificate(mX509RootCert, &mValidationDate)); + LLSD validation_params; + + // validate basic trust for a chain containing only the intermediate cert. (1 deep) + LLPointer test_chain = new LLBasicCertificateChain(NULL); + + test_chain->add(new LLBasicCertificate(mX509IntermediateCert, &mValidationDate)); + + test_store->validate(0, test_chain, validation_params); + + // add the root certificate to the chain and revalidate + test_chain->add(new LLBasicCertificate(mX509RootCert, &mValidationDate)); + test_store->validate(0, test_chain, validation_params); + + // add the child cert at the head of the chain, and revalidate (3 deep chain) + test_chain->insert(test_chain->begin(), new LLBasicCertificate(mX509ChildCert, &mValidationDate)); + test_store->validate(0, test_chain, validation_params); + + // basic failure cases + test_chain = new LLBasicCertificateChain(NULL); + //validate with only the child cert in chain, but child cert was previously + // trusted + test_chain->add(new LLBasicCertificate(mX509ChildCert, &mValidationDate)); + + // validate without the trust flag. + test_store->validate(VALIDATION_POLICY_TRUSTED, test_chain, validation_params); + + // Validate with child cert but no parent, and no parent in CA store + test_store = new LLBasicCertificateStore("mycertstore.pem"); + ensure_throws("no CA, with only a child cert", + LLCertValidationTrustException, + (*test_chain)[0], + test_store->validate, + VALIDATION_POLICY_TRUSTED, + test_chain, + validation_params); + + + // validate without the trust flag. + test_store->validate(0, test_chain, validation_params); + + // clear out the store + test_store = new LLBasicCertificateStore("mycertstore.pem"); + // append the intermediate cert + test_chain->add(new LLBasicCertificate(mX509IntermediateCert, &mValidationDate)); + ensure_throws("no CA, with child and intermediate certs", + LLCertValidationTrustException, + (*test_chain)[1], + test_store->validate, + VALIDATION_POLICY_TRUSTED | VALIDATION_POLICY_TRUSTED, + test_chain, + validation_params); + // validate without the trust flag + test_store->validate(0, test_chain, validation_params); + + // Test time validity + LLSD child_info; + ((*test_chain)[0])->getLLSD(child_info); + validation_params = LLSD::emptyMap(); + validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_FROM].asDate().secondsSinceEpoch() + 1.0); + test_store->validate(VALIDATION_POLICY_TIME | VALIDATION_POLICY_TRUSTED, + test_chain, validation_params); + + validation_params = LLSD::emptyMap(); + validation_params[CERT_VALIDATION_DATE] = child_info[CERT_VALID_FROM].asDate(); + + validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_FROM].asDate().secondsSinceEpoch() - 1.0); + + // test not yet valid + ensure_throws("Child cert not yet valid" , + LLCertValidationExpirationException, + (*test_chain)[0], + test_store->validate, + VALIDATION_POLICY_TIME | VALIDATION_POLICY_TRUSTED, + test_chain, + validation_params); + validation_params = LLSD::emptyMap(); + validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_TO].asDate().secondsSinceEpoch() + 1.0); + + // test cert expired + ensure_throws("Child cert expired", + LLCertValidationExpirationException, + (*test_chain)[0], + test_store->validate, + VALIDATION_POLICY_TIME | VALIDATION_POLICY_TRUSTED, + test_chain, + validation_params); + + // test SSL KU + // validate basic trust for a chain containing child and intermediate. + test_chain = new LLBasicCertificateChain(NULL); + test_chain->add(new LLBasicCertificate(mX509ChildCert, &mValidationDate)); + test_chain->add(new LLBasicCertificate(mX509IntermediateCert, &mValidationDate)); + test_store->validate(VALIDATION_POLICY_SSL_KU | VALIDATION_POLICY_TRUSTED, + test_chain, validation_params); + + test_chain = new LLBasicCertificateChain(NULL); + test_chain->add(new LLBasicCertificate(mX509TestCert, &mValidationDate)); + + test_store = new LLBasicCertificateStore("mycertstore.pem"); + ensure_throws("Cert doesn't have ku", + LLCertKeyUsageValidationException, + (*test_chain)[0], + test_store->validate, + VALIDATION_POLICY_SSL_KU | VALIDATION_POLICY_TRUSTED, + test_chain, + validation_params); + + test_store->validate(0, test_chain, validation_params); + } + +}; + diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp index b96560b09d..3be44a9bd5 100644 --- a/indra/newview/tests/llslurl_test.cpp +++ b/indra/newview/tests/llslurl_test.cpp @@ -1,340 +1,340 @@ -/** - * @file llsecapi_test.cpp - * @author Roxie - * @date 2009-02-10 - * @brief Test the sec api functionality - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2014, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#include "../llviewerprecompiledheaders.h" -#include "../llviewernetwork.h" -#include "../test/lltut.h" -#include "../llslurl.h" -#include "../../llxml/llcontrol.h" -#include "llsdserialize.h" - -namespace -{ - -// Should not collide with other test programs creating temp files. -static const char * const TEST_FILENAME("llslurl_test.xml"); - -} - -// -// Stub implementation for LLTrans -// -class LLTrans -{ -public: - static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false); -}; - -std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string) -{ - return std::string(); -} - -//---------------------------------------------------------------------------- -// Mock objects for the dependencies of the code we're testing - -LLControlGroup::LLControlGroup(const std::string& name) -: LLInstanceTracker(name) {} -LLControlGroup::~LLControlGroup() {} -LLControlVariable* LLControlGroup::declareString(const std::string& name, - const std::string& initial_val, - const std::string& comment, - LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(std::string_view name, const std::string& val){} - -std::string gCmdLineLoginURI; -std::string gCmdLineGridChoice; -std::string gCmdLineHelperURI; -std::string gLoginPage; -std::string gCurrentGrid; -std::string LLControlGroup::getString(std::string_view name) -{ - if (name == "CmdLineGridChoice") - return gCmdLineGridChoice; - else if (name == "CmdLineHelperURI") - return gCmdLineHelperURI; - else if (name == "LoginPage") - return gLoginPage; - else if (name == "CurrentGrid") - return gCurrentGrid; - return ""; -} - -LLSD LLControlGroup::getLLSD(std::string_view name) -{ - if (name == "CmdLineLoginURI") - { - if(!gCmdLineLoginURI.empty()) - { - return LLSD(gCmdLineLoginURI); - } - } - return LLSD(); -} - -LLPointer LLControlGroup::getControl(std::string_view name) -{ - ctrl_name_table_t::iterator iter = mNameTable.find(name.data()); - return iter == mNameTable.end() ? LLPointer() : iter->second; -} - -LLControlGroup gSavedSettings("test"); -const char *gSampleGridFile = - "" - "" - " " - " foo.bar.com" - " " - " helper_urihttps://foobar/helpers/" - " labelFoobar Grid" - " login_pagefoobar/loginpage" - " login_uri" - " " - " foobar/loginuri" - " " - " keynamefoo.bar.com" - " credential_typeagent" - " grid_login_idFooBar" - " " - " my.grid.com" - " " - " helper_urihttps://mygrid/helpers/" - " labelMy Grid" - " login_pagemygrid/loginpage" - " login_uri" - " " - " mygrid/loginuri" - " " - " keynamemy.grid.com" - " credential_typeagent" - " grid_login_idMyGrid" - " " - " " - "" - ; - -// ------------------------------------------------------------------------------------------- -// TUT -// ------------------------------------------------------------------------------------------- -namespace tut -{ - // Test wrapper declaration : wrapping nothing for the moment - struct slurlTest - { - slurlTest() - { - LLGridManager::getInstance()->initialize(std::string("")); - } - ~slurlTest() - { - } - }; - - // Tut templating thingamagic: test group, object and test instance - typedef test_group slurlTestFactory; - typedef slurlTestFactory::object slurlTestObject; - tut::slurlTestFactory tut_test("LLSlurl"); - - // --------------------------------------------------------------------------------------- - // Test functions - // --------------------------------------------------------------------------------------- - // construction from slurl string - template<> template<> - void slurlTestObject::test<1>() - { - llofstream gridfile(TEST_FILENAME); - gridfile << gSampleGridFile; - gridfile.close(); - - LLGridManager::getInstance()->initialize(TEST_FILENAME); - - LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com"); - - LLSLURL slurl = LLSLURL(""); - ensure_equals("null slurl", (int)slurl.getType(), LLSLURL::LAST_LOCATION); - - slurl = LLSLURL("http://slurl.com/secondlife/myregion"); - ensure_equals("slurl.com slurl, region only - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("slurl.com slurl, region only", slurl.getSLURLString(), - "http://maps.secondlife.com/secondlife/myregion/128/128/0"); - - slurl = LLSLURL("http://maps.secondlife.com/secondlife/myregion/1/2/3"); - ensure_equals("maps.secondlife.com slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("maps.secondlife.com slurl, region + coords", slurl.getSLURLString(), - "http://maps.secondlife.com/secondlife/myregion/1/2/3"); - - slurl = LLSLURL("secondlife://"); - ensure_equals("secondlife: slurl, empty - type", slurl.getType(), LLSLURL::EMPTY); - - slurl = LLSLURL("secondlife:///"); - ensure_equals("secondlife: slurl, root - type", slurl.getType(), LLSLURL::EMPTY); - - slurl = LLSLURL("secondlife://myregion"); - ensure_equals("secondlife: slurl, region only - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("secondlife: slurl, region only", slurl.getSLURLString(), - "http://maps.secondlife.com/secondlife/myregion/128/128/0"); - - slurl = LLSLURL("secondlife://myregion/1/2/3"); - ensure_equals("secondlife: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("secondlife slurl, region + coords", slurl.getSLURLString(), - "http://maps.secondlife.com/secondlife/myregion/1/2/3"); - - slurl = LLSLURL("/myregion"); - ensure_equals("/region slurl, region- type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("/region slurl, region ", slurl.getSLURLString(), - "http://maps.secondlife.com/secondlife/myregion/128/128/0"); - - slurl = LLSLURL("/myregion/1/2/3"); - ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("/ slurl, region + coords", slurl.getSLURLString(), - "http://maps.secondlife.com/secondlife/myregion/1/2/3"); - - slurl = LLSLURL("my region/1/2/3"); - ensure_equals(" slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals(" slurl, region + coords", slurl.getSLURLString(), - "http://maps.secondlife.com/secondlife/my%20region/1/2/3"); - - LLGridManager::getInstance()->setGridChoice("my.grid.com"); - slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3"); - ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("grid slurl, region + coords", slurl.getSLURLString(), - "https://my.grid.com/region/my%20region/1/2/3"); - - slurl = LLSLURL("https://my.grid.com/region/my region"); - ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("grid slurl, region + coords", slurl.getSLURLString(), - "https://my.grid.com/region/my%20region/128/128/0"); - - LLGridManager::getInstance()->setGridChoice("foo.bar.com"); - slurl = LLSLURL("/myregion/1/2/3"); - ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("/ slurl, region + coords", slurl.getSLURLString(), - "https://foo.bar.com/region/myregion/1/2/3"); - - slurl = LLSLURL("myregion/1/2/3"); - ensure_equals(": slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals(" slurl, region + coords", slurl.getSLURLString(), - "https://foo.bar.com/region/myregion/1/2/3"); - - slurl = LLSLURL(LLSLURL::SIM_LOCATION_HOME); - ensure_equals("home", slurl.getType(), LLSLURL::HOME_LOCATION); - - slurl = LLSLURL(LLSLURL::SIM_LOCATION_LAST); - ensure_equals("last", slurl.getType(), LLSLURL::LAST_LOCATION); - - slurl = LLSLURL("secondlife:///app/foo/bar?12345"); - ensure_equals("app", slurl.getType(), LLSLURL::APP); - ensure_equals("appcmd", slurl.getAppCmd(), "foo"); - ensure_equals("apppath", slurl.getAppPath().size(), 1); - ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar"); - ensure_equals("appquery", slurl.getAppQuery(), "12345"); - ensure_equals("grid1", slurl.getGrid(), "FooBar"); - - slurl = LLSLURL("secondlife://Aditi/app/foo/bar?12345"); - ensure_equals("app", slurl.getType(), LLSLURL::APP); - ensure_equals("appcmd", slurl.getAppCmd(), "foo"); - ensure_equals("apppath", slurl.getAppPath().size(), 1); - ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar"); - ensure_equals("appquery", slurl.getAppQuery(), "12345"); - ensure_equals("grid2", slurl.getGrid(), "Aditi"); - - LLGridManager::getInstance()->setGridChoice("foo.bar.com"); - slurl = LLSLURL("secondlife:///secondlife/myregion/1/2/3"); - ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("location", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("region" , "myregion", slurl.getRegion()); - ensure_equals("grid3", slurl.getGrid(), "util.agni.lindenlab.com"); - - slurl = LLSLURL("secondlife://Aditi/secondlife/myregion/1/2/3"); - ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("location", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("region" , "myregion", slurl.getRegion()); - ensure_equals("grid4", slurl.getGrid(), "Aditi" ); - - LLGridManager::getInstance()->setGridChoice("my.grid.com"); - slurl = LLSLURL("https://my.grid.com/app/foo/bar?12345"); - ensure_equals("app", slurl.getType(), LLSLURL::APP); - ensure_equals("appcmd", slurl.getAppCmd(), "foo"); - ensure_equals("apppath", slurl.getAppPath().size(), 1); - ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar"); - ensure_equals("appquery", slurl.getAppQuery(), "12345"); - - } - - // construction from grid/region/vector combos - template<> template<> - void slurlTestObject::test<2>() - { - llofstream gridfile(TEST_FILENAME); - gridfile << gSampleGridFile; - gridfile.close(); - - LLGridManager::getInstance()->initialize(TEST_FILENAME); - - LLSLURL slurl = LLSLURL("my.grid.com", "my region"); - ensure_equals("grid/region - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("grid/region", slurl.getSLURLString(), - "https://my.grid.com/region/my%20region/128/128/0"); - - slurl = LLSLURL("my.grid.com", "my region", LLVector3(1,2,3)); - ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals(" grid/region/vector", slurl.getSLURLString(), - "https://my.grid.com/region/my%20region/1/2/3"); - - LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com"); - slurl = LLSLURL("my region", LLVector3(1,2,3)); - ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals(" default grid/region/vector", slurl.getSLURLString(), - "http://maps.secondlife.com/secondlife/my%20region/1/2/3"); - - LLGridManager::getInstance()->setGridChoice("MyGrid"); - slurl = LLSLURL("my region", LLVector3(1,2,3)); - ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals(" default grid/region/vector", slurl.getSLURLString(), - "https://my.grid.com/region/my%20region/1/2/3"); - - } - // Accessors - template<> template<> - void slurlTestObject::test<3>() - { - llofstream gridfile(TEST_FILENAME); - gridfile << gSampleGridFile; - gridfile.close(); - - LLGridManager::getInstance()->initialize(TEST_FILENAME); - - LLGridManager::getInstance()->setGridChoice("my.grid.com"); - LLSLURL slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3"); - ensure_equals("login string", slurl.getLoginString(), "uri:my region&1&2&3"); - ensure_equals("location string", slurl.getLocationString(), "my region/1/2/3"); - ensure_equals("grid", slurl.getGrid(), "my.grid.com"); - ensure_equals("region", slurl.getRegion(), "my region"); - ensure_equals("position", slurl.getPosition(), LLVector3(1, 2, 3)); - - } -} +/** + * @file llsecapi_test.cpp + * @author Roxie + * @date 2009-02-10 + * @brief Test the sec api functionality + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2014, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "../llviewerprecompiledheaders.h" +#include "../llviewernetwork.h" +#include "../test/lltut.h" +#include "../llslurl.h" +#include "../../llxml/llcontrol.h" +#include "llsdserialize.h" + +namespace +{ + +// Should not collide with other test programs creating temp files. +static const char * const TEST_FILENAME("llslurl_test.xml"); + +} + +// +// Stub implementation for LLTrans +// +class LLTrans +{ +public: + static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false); +}; + +std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string) +{ + return std::string(); +} + +//---------------------------------------------------------------------------- +// Mock objects for the dependencies of the code we're testing + +LLControlGroup::LLControlGroup(const std::string& name) +: LLInstanceTracker(name) {} +LLControlGroup::~LLControlGroup() {} +LLControlVariable* LLControlGroup::declareString(const std::string& name, + const std::string& initial_val, + const std::string& comment, + LLControlVariable::ePersist persist) {return NULL;} +void LLControlGroup::setString(std::string_view name, const std::string& val){} + +std::string gCmdLineLoginURI; +std::string gCmdLineGridChoice; +std::string gCmdLineHelperURI; +std::string gLoginPage; +std::string gCurrentGrid; +std::string LLControlGroup::getString(std::string_view name) +{ + if (name == "CmdLineGridChoice") + return gCmdLineGridChoice; + else if (name == "CmdLineHelperURI") + return gCmdLineHelperURI; + else if (name == "LoginPage") + return gLoginPage; + else if (name == "CurrentGrid") + return gCurrentGrid; + return ""; +} + +LLSD LLControlGroup::getLLSD(std::string_view name) +{ + if (name == "CmdLineLoginURI") + { + if(!gCmdLineLoginURI.empty()) + { + return LLSD(gCmdLineLoginURI); + } + } + return LLSD(); +} + +LLPointer LLControlGroup::getControl(std::string_view name) +{ + ctrl_name_table_t::iterator iter = mNameTable.find(name.data()); + return iter == mNameTable.end() ? LLPointer() : iter->second; +} + +LLControlGroup gSavedSettings("test"); +const char *gSampleGridFile = + "" + "" + " " + " foo.bar.com" + " " + " helper_urihttps://foobar/helpers/" + " labelFoobar Grid" + " login_pagefoobar/loginpage" + " login_uri" + " " + " foobar/loginuri" + " " + " keynamefoo.bar.com" + " credential_typeagent" + " grid_login_idFooBar" + " " + " my.grid.com" + " " + " helper_urihttps://mygrid/helpers/" + " labelMy Grid" + " login_pagemygrid/loginpage" + " login_uri" + " " + " mygrid/loginuri" + " " + " keynamemy.grid.com" + " credential_typeagent" + " grid_login_idMyGrid" + " " + " " + "" + ; + +// ------------------------------------------------------------------------------------------- +// TUT +// ------------------------------------------------------------------------------------------- +namespace tut +{ + // Test wrapper declaration : wrapping nothing for the moment + struct slurlTest + { + slurlTest() + { + LLGridManager::getInstance()->initialize(std::string("")); + } + ~slurlTest() + { + } + }; + + // Tut templating thingamagic: test group, object and test instance + typedef test_group slurlTestFactory; + typedef slurlTestFactory::object slurlTestObject; + tut::slurlTestFactory tut_test("LLSlurl"); + + // --------------------------------------------------------------------------------------- + // Test functions + // --------------------------------------------------------------------------------------- + // construction from slurl string + template<> template<> + void slurlTestObject::test<1>() + { + llofstream gridfile(TEST_FILENAME); + gridfile << gSampleGridFile; + gridfile.close(); + + LLGridManager::getInstance()->initialize(TEST_FILENAME); + + LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com"); + + LLSLURL slurl = LLSLURL(""); + ensure_equals("null slurl", (int)slurl.getType(), LLSLURL::LAST_LOCATION); + + slurl = LLSLURL("http://slurl.com/secondlife/myregion"); + ensure_equals("slurl.com slurl, region only - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals("slurl.com slurl, region only", slurl.getSLURLString(), + "http://maps.secondlife.com/secondlife/myregion/128/128/0"); + + slurl = LLSLURL("http://maps.secondlife.com/secondlife/myregion/1/2/3"); + ensure_equals("maps.secondlife.com slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals("maps.secondlife.com slurl, region + coords", slurl.getSLURLString(), + "http://maps.secondlife.com/secondlife/myregion/1/2/3"); + + slurl = LLSLURL("secondlife://"); + ensure_equals("secondlife: slurl, empty - type", slurl.getType(), LLSLURL::EMPTY); + + slurl = LLSLURL("secondlife:///"); + ensure_equals("secondlife: slurl, root - type", slurl.getType(), LLSLURL::EMPTY); + + slurl = LLSLURL("secondlife://myregion"); + ensure_equals("secondlife: slurl, region only - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals("secondlife: slurl, region only", slurl.getSLURLString(), + "http://maps.secondlife.com/secondlife/myregion/128/128/0"); + + slurl = LLSLURL("secondlife://myregion/1/2/3"); + ensure_equals("secondlife: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals("secondlife slurl, region + coords", slurl.getSLURLString(), + "http://maps.secondlife.com/secondlife/myregion/1/2/3"); + + slurl = LLSLURL("/myregion"); + ensure_equals("/region slurl, region- type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals("/region slurl, region ", slurl.getSLURLString(), + "http://maps.secondlife.com/secondlife/myregion/128/128/0"); + + slurl = LLSLURL("/myregion/1/2/3"); + ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals("/ slurl, region + coords", slurl.getSLURLString(), + "http://maps.secondlife.com/secondlife/myregion/1/2/3"); + + slurl = LLSLURL("my region/1/2/3"); + ensure_equals(" slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals(" slurl, region + coords", slurl.getSLURLString(), + "http://maps.secondlife.com/secondlife/my%20region/1/2/3"); + + LLGridManager::getInstance()->setGridChoice("my.grid.com"); + slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3"); + ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals("grid slurl, region + coords", slurl.getSLURLString(), + "https://my.grid.com/region/my%20region/1/2/3"); + + slurl = LLSLURL("https://my.grid.com/region/my region"); + ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals("grid slurl, region + coords", slurl.getSLURLString(), + "https://my.grid.com/region/my%20region/128/128/0"); + + LLGridManager::getInstance()->setGridChoice("foo.bar.com"); + slurl = LLSLURL("/myregion/1/2/3"); + ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals("/ slurl, region + coords", slurl.getSLURLString(), + "https://foo.bar.com/region/myregion/1/2/3"); + + slurl = LLSLURL("myregion/1/2/3"); + ensure_equals(": slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals(" slurl, region + coords", slurl.getSLURLString(), + "https://foo.bar.com/region/myregion/1/2/3"); + + slurl = LLSLURL(LLSLURL::SIM_LOCATION_HOME); + ensure_equals("home", slurl.getType(), LLSLURL::HOME_LOCATION); + + slurl = LLSLURL(LLSLURL::SIM_LOCATION_LAST); + ensure_equals("last", slurl.getType(), LLSLURL::LAST_LOCATION); + + slurl = LLSLURL("secondlife:///app/foo/bar?12345"); + ensure_equals("app", slurl.getType(), LLSLURL::APP); + ensure_equals("appcmd", slurl.getAppCmd(), "foo"); + ensure_equals("apppath", slurl.getAppPath().size(), 1); + ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar"); + ensure_equals("appquery", slurl.getAppQuery(), "12345"); + ensure_equals("grid1", slurl.getGrid(), "FooBar"); + + slurl = LLSLURL("secondlife://Aditi/app/foo/bar?12345"); + ensure_equals("app", slurl.getType(), LLSLURL::APP); + ensure_equals("appcmd", slurl.getAppCmd(), "foo"); + ensure_equals("apppath", slurl.getAppPath().size(), 1); + ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar"); + ensure_equals("appquery", slurl.getAppQuery(), "12345"); + ensure_equals("grid2", slurl.getGrid(), "Aditi"); + + LLGridManager::getInstance()->setGridChoice("foo.bar.com"); + slurl = LLSLURL("secondlife:///secondlife/myregion/1/2/3"); + ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals("location", slurl.getType(), LLSLURL::LOCATION); + ensure_equals("region" , "myregion", slurl.getRegion()); + ensure_equals("grid3", slurl.getGrid(), "util.agni.lindenlab.com"); + + slurl = LLSLURL("secondlife://Aditi/secondlife/myregion/1/2/3"); + ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals("location", slurl.getType(), LLSLURL::LOCATION); + ensure_equals("region" , "myregion", slurl.getRegion()); + ensure_equals("grid4", slurl.getGrid(), "Aditi" ); + + LLGridManager::getInstance()->setGridChoice("my.grid.com"); + slurl = LLSLURL("https://my.grid.com/app/foo/bar?12345"); + ensure_equals("app", slurl.getType(), LLSLURL::APP); + ensure_equals("appcmd", slurl.getAppCmd(), "foo"); + ensure_equals("apppath", slurl.getAppPath().size(), 1); + ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar"); + ensure_equals("appquery", slurl.getAppQuery(), "12345"); + + } + + // construction from grid/region/vector combos + template<> template<> + void slurlTestObject::test<2>() + { + llofstream gridfile(TEST_FILENAME); + gridfile << gSampleGridFile; + gridfile.close(); + + LLGridManager::getInstance()->initialize(TEST_FILENAME); + + LLSLURL slurl = LLSLURL("my.grid.com", "my region"); + ensure_equals("grid/region - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals("grid/region", slurl.getSLURLString(), + "https://my.grid.com/region/my%20region/128/128/0"); + + slurl = LLSLURL("my.grid.com", "my region", LLVector3(1,2,3)); + ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals(" grid/region/vector", slurl.getSLURLString(), + "https://my.grid.com/region/my%20region/1/2/3"); + + LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com"); + slurl = LLSLURL("my region", LLVector3(1,2,3)); + ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals(" default grid/region/vector", slurl.getSLURLString(), + "http://maps.secondlife.com/secondlife/my%20region/1/2/3"); + + LLGridManager::getInstance()->setGridChoice("MyGrid"); + slurl = LLSLURL("my region", LLVector3(1,2,3)); + ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals(" default grid/region/vector", slurl.getSLURLString(), + "https://my.grid.com/region/my%20region/1/2/3"); + + } + // Accessors + template<> template<> + void slurlTestObject::test<3>() + { + llofstream gridfile(TEST_FILENAME); + gridfile << gSampleGridFile; + gridfile.close(); + + LLGridManager::getInstance()->initialize(TEST_FILENAME); + + LLGridManager::getInstance()->setGridChoice("my.grid.com"); + LLSLURL slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3"); + ensure_equals("login string", slurl.getLoginString(), "uri:my region&1&2&3"); + ensure_equals("location string", slurl.getLocationString(), "my region/1/2/3"); + ensure_equals("grid", slurl.getGrid(), "my.grid.com"); + ensure_equals("region", slurl.getRegion(), "my region"); + ensure_equals("position", slurl.getPosition(), LLVector3(1, 2, 3)); + + } +} diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index 0671e02b90..d5e281bba8 100644 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -1,575 +1,575 @@ -/** - * @file llviewerassetstats_tut.cpp - * @date 2010-10-28 - * @brief Test cases for some of newview/llviewerassetstats.cpp - * - * $LicenseInfo:firstyear=2010&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include -#include - -#include "lltut.h" -#include "../llviewerassetstats.h" -#include "lluuid.h" -#include "llsdutil.h" -#include "llregionhandle.h" -#include "lltracethreadrecorder.h" -#include "../llvoavatar.h" - -namespace LLStatViewer -{ - LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample"); -} - -void LLVOAvatar::getNearbyRezzedStats(std::vector& counts, F32& avg_cloud_time, S32& cloud_avatars) -{ - counts.resize(3); - counts[0] = 0; - counts[1] = 0; - counts[2] = 1; -} - -// static -std::string LLVOAvatar::rezStatusToString(S32 rez_status) -{ - if (rez_status==0) return "cloud"; - if (rez_status==1) return "gray"; - if (rez_status==2) return "textured"; - return "unknown"; -} - -// static -LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name) -{ - static LLViewerStats::StatsAccumulator junk; - return junk; -} - -static const char * all_keys[] = -{ - "duration", - "fps", - "get_other_http", - "get_other_udp", - "get_texture_temp_http", - "get_texture_temp_udp", - "get_texture_non_temp_http", - "get_texture_non_temp_udp", - "get_wearable_http", - "get_wearable_udp", - "get_sound_http", - "get_sound_udp", - "get_gesture_http", - "get_gesture_udp" -}; - -static const char * resp_keys[] = -{ - "get_other_http", - "get_other_udp", - "get_texture_temp_http", - "get_texture_temp_udp", - "get_texture_non_temp_http", - "get_texture_non_temp_udp", - "get_wearable_http", - "get_wearable_udp", - "get_sound_http", - "get_sound_udp", - "get_gesture_http", - "get_gesture_udp" -}; - -static const char * sub_keys[] = -{ - "dequeued", - "enqueued", - "resp_count", - "resp_max", - "resp_min", - "resp_mean" -}; - -static const char * mmm_resp_keys[] = -{ - "fps" -}; - -static const char * mmm_sub_keys[] = -{ - "count", - "max", - "min", - "mean" -}; - -static const LLUUID region1("4e2d81a3-6263-6ffe-ad5c-8ce04bee07e8"); -static const LLUUID region2("68762cc8-b68b-4e45-854b-e830734f2d4a"); -static const U64 region1_handle(0x0000040000003f00ULL); -static const U64 region2_handle(0x0000030000004200ULL); -static const std::string region1_handle_str("0000040000003f00"); -static const std::string region2_handle_str("0000030000004200"); - -#if 0 -static bool -is_empty_map(const LLSD & sd) -{ - return sd.isMap() && 0 == sd.size(); -} -#endif - -#if 0 -static bool -is_single_key_map(const LLSD & sd, const std::string & key) -{ - return sd.isMap() && 1 == sd.size() && sd.has(key); -} -#endif - -static bool -is_double_key_map(const LLSD & sd, const std::string & key1, const std::string & key2) -{ - return sd.isMap() && 2 == sd.size() && sd.has(key1) && sd.has(key2); -} - -#if 0 -static bool -is_triple_key_map(const LLSD & sd, const std::string & key1, const std::string & key2, const std::string& key3) -{ - return sd.isMap() && 3 == sd.size() && sd.has(key1) && sd.has(key2) && sd.has(key3); -} -#endif - -static bool -is_no_stats_map(const LLSD & sd) -{ - return is_double_key_map(sd, "duration", "regions"); -} - -static bool -is_single_slot_array(const LLSD & sd, U64 region_handle) -{ - U32 grid_x(0), grid_y(0); - grid_from_region_handle(region_handle, &grid_x, &grid_y); - - return (sd.isArray() && - 1 == sd.size() && - sd[0].has("grid_x") && - sd[0].has("grid_y") && - sd[0]["grid_x"].isInteger() && - sd[0]["grid_y"].isInteger() && - grid_x == sd[0]["grid_x"].asInteger() && - grid_y == sd[0]["grid_y"].asInteger()); -} - -static bool -is_double_slot_array(const LLSD & sd, U64 region_handle1, U64 region_handle2) -{ - U32 grid_x1(0), grid_y1(0); - U32 grid_x2(0), grid_y2(0); - grid_from_region_handle(region_handle1, &grid_x1, &grid_y1); - grid_from_region_handle(region_handle2, &grid_x2, &grid_y2); - - return (sd.isArray() && - 2 == sd.size() && - sd[0].has("grid_x") && - sd[0].has("grid_y") && - sd[0]["grid_x"].isInteger() && - sd[0]["grid_y"].isInteger() && - sd[1].has("grid_x") && - sd[1].has("grid_y") && - sd[1]["grid_x"].isInteger() && - sd[1]["grid_y"].isInteger() && - ((grid_x1 == sd[0]["grid_x"].asInteger() && - grid_y1 == sd[0]["grid_y"].asInteger() && - grid_x2 == sd[1]["grid_x"].asInteger() && - grid_y2 == sd[1]["grid_y"].asInteger()) || - (grid_x1 == sd[1]["grid_x"].asInteger() && - grid_y1 == sd[1]["grid_y"].asInteger() && - grid_x2 == sd[0]["grid_x"].asInteger() && - grid_y2 == sd[0]["grid_y"].asInteger()))); -} - -static LLSD -get_region(const LLSD & sd, U64 region_handle1) -{ - U32 grid_x(0), grid_y(0); - grid_from_region_handle(region_handle1, &grid_x, &grid_y); - - for (LLSD::array_const_iterator it(sd["regions"].beginArray()); - sd["regions"].endArray() != it; - ++it) - { - if ((*it).has("grid_x") && - (*it).has("grid_y") && - (*it)["grid_x"].isInteger() && - (*it)["grid_y"].isInteger() && - (*it)["grid_x"].asInteger() == grid_x && - (*it)["grid_y"].asInteger() == grid_y) - { - return *it; - } - } - return LLSD(); -} - -namespace tut -{ - struct tst_viewerassetstats_index - { - tst_viewerassetstats_index() - { - LLTrace::set_master_thread_recorder(&mThreadRecorder); - } - - ~tst_viewerassetstats_index() - { - LLTrace::set_master_thread_recorder(NULL); - } - - LLTrace::ThreadRecorder mThreadRecorder; - }; - typedef test_group tst_viewerassetstats_index_t; - typedef tst_viewerassetstats_index_t::object tst_viewerassetstats_index_object_t; - tut::tst_viewerassetstats_index_t tut_tst_viewerassetstats_index("tst_viewerassetstats_test"); - - // Testing free functions without global stats allocated - template<> template<> - void tst_viewerassetstats_index_object_t::test<1>() - { - // Check that helpers aren't bothered by missing global stats - ensure("Global gViewerAssetStats should be NULL", (NULL == gViewerAssetStats)); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); - - LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - - LLViewerAssetStatsFF::record_response(LLViewerAssetType::AT_GESTURE, false, false, (U64Microseconds)12300000ULL); - } - - // Create a non-global instance and check the structure - template<> template<> - void tst_viewerassetstats_index_object_t::test<2>() - { - ensure("Global gViewerAssetStats should be NULL", (NULL == gViewerAssetStats)); - - LLViewerAssetStats * it = new LLViewerAssetStats(); - - ensure("Global gViewerAssetStats should still be NULL", (NULL == gViewerAssetStats)); - - LLSD sd_full = it->asLLSD(false); - - // Default (NULL) region ID doesn't produce LLSD results so should - // get an empty map back from output - ensure("Stat-less LLSD initially", is_no_stats_map(sd_full)); - - // Once the region is set, we will get a response even with no data collection - it->setRegion(region1_handle); - sd_full = it->asLLSD(false); - ensure("Correct single-key LLSD map root", is_double_key_map(sd_full, "duration", "regions")); - ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd_full["regions"], region1_handle)); - - LLSD sd = sd_full["regions"][0]; - - delete it; - - // Check the structure of the LLSD - for (int i = 0; i < LL_ARRAY_SIZE(all_keys); ++i) - { - std::string line = llformat("Has '%s' key", all_keys[i]); - ensure(line, sd.has(all_keys[i])); - } - - for (int i = 0; i < LL_ARRAY_SIZE(resp_keys); ++i) - { - for (int j = 0; j < LL_ARRAY_SIZE(sub_keys); ++j) - { - std::string line = llformat("Key '%s' has '%s' key", resp_keys[i], sub_keys[j]); - ensure(line, sd[resp_keys[i]].has(sub_keys[j])); - } - } - - for (int i = 0; i < LL_ARRAY_SIZE(mmm_resp_keys); ++i) - { - for (int j = 0; j < LL_ARRAY_SIZE(mmm_sub_keys); ++j) - { - std::string line = llformat("Key '%s' has '%s' key", mmm_resp_keys[i], mmm_sub_keys[j]); - ensure(line, sd[mmm_resp_keys[i]].has(mmm_sub_keys[j])); - } - } - } - - // Create a non-global instance and check some content - template<> template<> - void tst_viewerassetstats_index_object_t::test<3>() - { - LLViewerAssetStats * it = new LLViewerAssetStats(); - it->setRegion(region1_handle); - - LLSD sd = it->asLLSD(false); - ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); - ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); - sd = sd[0]; - - delete it; - - // Check a few points on the tree for content - ensure("sd[get_texture_temp_http][dequeued] is 0", (0 == sd["get_texture_temp_http"]["dequeued"].asInteger())); - ensure("sd[get_sound_udp][resp_min] is 0", (0.0 == sd["get_sound_udp"]["resp_min"].asReal())); - } - - // Create a global instance and verify free functions do something useful - template<> template<> - void tst_viewerassetstats_index_object_t::test<4>() - { - gViewerAssetStats = new LLViewerAssetStats(); - LLViewerAssetStatsFF::set_region(region1_handle); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - - LLSD sd = gViewerAssetStats->asLLSD(false); - ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); - ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); - sd = sd["regions"][0]; - - // Check a few points on the tree for content - ensure("sd[get_texture_non_temp_udp][enqueued] is 1", (1 == sd["get_texture_non_temp_udp"]["enqueued"].asInteger())); - ensure("sd[get_texture_temp_udp][enqueued] is 0", (0 == sd["get_texture_temp_udp"]["enqueued"].asInteger())); - ensure("sd[get_texture_non_temp_http][enqueued] is 0", (0 == sd["get_texture_non_temp_http"]["enqueued"].asInteger())); - ensure("sd[get_texture_temp_http][enqueued] is 0", (0 == sd["get_texture_temp_http"]["enqueued"].asInteger())); - ensure("sd[get_gesture_udp][dequeued] is 0", (0 == sd["get_gesture_udp"]["dequeued"].asInteger())); - - // Reset and check zeros... - // Reset leaves current region in place - gViewerAssetStats->reset(); - sd = gViewerAssetStats->asLLSD(false)["regions"][region1_handle_str]; - - delete gViewerAssetStats; - gViewerAssetStats = NULL; - - ensure("sd[get_texture_non_temp_udp][enqueued] is reset", (0 == sd["get_texture_non_temp_udp"]["enqueued"].asInteger())); - ensure("sd[get_gesture_udp][dequeued] is reset", (0 == sd["get_gesture_udp"]["dequeued"].asInteger())); - } - - // Check multiple region collection - template<> template<> - void tst_viewerassetstats_index_object_t::test<5>() - { - gViewerAssetStats = new LLViewerAssetStats(); - - LLViewerAssetStatsFF::set_region(region1_handle); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - - LLViewerAssetStatsFF::set_region(region2_handle); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - - LLSD sd = gViewerAssetStats->asLLSD(false); - - // std::cout << sd << std::endl; - - ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions")); - ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle)); - LLSD sd1 = get_region(sd, region1_handle); - LLSD sd2 = get_region(sd, region2_handle); - ensure("Region1 is present in results", sd1.isMap()); - ensure("Region2 is present in results", sd2.isMap()); - - // Check a few points on the tree for content - ensure_equals("sd1[get_texture_non_temp_udp][enqueued] is 1", sd1["get_texture_non_temp_udp"]["enqueued"].asInteger(), 1); - ensure_equals("sd1[get_texture_temp_udp][enqueued] is 0", sd1["get_texture_temp_udp"]["enqueued"].asInteger(), 0); - ensure_equals("sd1[get_texture_non_temp_http][enqueued] is 0", sd1["get_texture_non_temp_http"]["enqueued"].asInteger(), 0); - ensure_equals("sd1[get_texture_temp_http][enqueued] is 0", sd1["get_texture_temp_http"]["enqueued"].asInteger(), 0); - ensure_equals("sd1[get_gesture_udp][dequeued] is 0", sd1["get_gesture_udp"]["dequeued"].asInteger(), 0); - - // Check a few points on the tree for content - ensure("sd2[get_gesture_udp][enqueued] is 4", (4 == sd2["get_gesture_udp"]["enqueued"].asInteger())); - ensure("sd2[get_gesture_udp][dequeued] is 0", (0 == sd2["get_gesture_udp"]["dequeued"].asInteger())); - ensure("sd2[get_texture_non_temp_udp][enqueued] is 0", (0 == sd2["get_texture_non_temp_udp"]["enqueued"].asInteger())); - - // Reset and check zeros... - // Reset leaves current region in place - gViewerAssetStats->reset(); - sd = gViewerAssetStats->asLLSD(false); - ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); - ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle)); - sd2 = sd["regions"][0]; - - delete gViewerAssetStats; - gViewerAssetStats = NULL; - - ensure("sd2[get_texture_non_temp_udp][enqueued] is reset", (0 == sd2["get_texture_non_temp_udp"]["enqueued"].asInteger())); - ensure("sd2[get_gesture_udp][enqueued] is reset", (0 == sd2["get_gesture_udp"]["enqueued"].asInteger())); - } - - // Check multiple region collection jumping back-and-forth between regions - template<> template<> - void tst_viewerassetstats_index_object_t::test<6>() - { - gViewerAssetStats = new LLViewerAssetStats(); - - LLViewerAssetStatsFF::set_region(region1_handle); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - - LLViewerAssetStatsFF::set_region(region2_handle); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - - LLViewerAssetStatsFF::set_region(region1_handle); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, true, true); - LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, true, true); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - - LLViewerAssetStatsFF::set_region(region2_handle); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - - LLSD sd = gViewerAssetStats->asLLSD(false); - - ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions")); - ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle)); - LLSD sd1 = get_region(sd, region1_handle); - LLSD sd2 = get_region(sd, region2_handle); - ensure("Region1 is present in results", sd1.isMap()); - ensure("Region2 is present in results", sd2.isMap()); - - // Check a few points on the tree for content - ensure("sd1[get_texture_non_temp_udp][enqueued] is 1", (1 == sd1["get_texture_non_temp_udp"]["enqueued"].asInteger())); - ensure("sd1[get_texture_temp_udp][enqueued] is 0", (0 == sd1["get_texture_temp_udp"]["enqueued"].asInteger())); - ensure("sd1[get_texture_non_temp_http][enqueued] is 0", (0 == sd1["get_texture_non_temp_http"]["enqueued"].asInteger())); - ensure("sd1[get_texture_temp_http][enqueued] is 1", (1 == sd1["get_texture_temp_http"]["enqueued"].asInteger())); - ensure("sd1[get_gesture_udp][dequeued] is 0", (0 == sd1["get_gesture_udp"]["dequeued"].asInteger())); - - // Check a few points on the tree for content - ensure("sd2[get_gesture_udp][enqueued] is 8", (8 == sd2["get_gesture_udp"]["enqueued"].asInteger())); - ensure("sd2[get_gesture_udp][dequeued] is 0", (0 == sd2["get_gesture_udp"]["dequeued"].asInteger())); - ensure("sd2[get_texture_non_temp_udp][enqueued] is 0", (0 == sd2["get_texture_non_temp_udp"]["enqueued"].asInteger())); - - // Reset and check zeros... - // Reset leaves current region in place - gViewerAssetStats->reset(); - sd = gViewerAssetStats->asLLSD(false); - ensure("Correct single-key LLSD map root", is_double_key_map(sd, "duration", "regions")); - ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle)); - sd2 = get_region(sd, region2_handle); - ensure("Region2 is present in results", sd2.isMap()); - - delete gViewerAssetStats; - gViewerAssetStats = NULL; - - ensure_equals("sd2[get_texture_non_temp_udp][enqueued] is reset", sd2["get_texture_non_temp_udp"]["enqueued"].asInteger(), 0); - ensure_equals("sd2[get_gesture_udp][enqueued] is reset", sd2["get_gesture_udp"]["enqueued"].asInteger(), 0); - } - - // Non-texture assets ignore transport and persistence flags - template<> template<> - void tst_viewerassetstats_index_object_t::test<7>() - { - gViewerAssetStats = new LLViewerAssetStats(); - LLViewerAssetStatsFF::set_region(region1_handle); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, true); - LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, true); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, true, false); - LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, true, false); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, true, true); - LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, true, true); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, false, false); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, false, true); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, true, false); - - LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - LLSD sd = gViewerAssetStats->asLLSD(false); - ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); - ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); - sd = get_region(sd, region1_handle); - ensure("Region1 is present in results", sd.isMap()); - - // Check a few points on the tree for content - ensure("sd[get_gesture_udp][enqueued] is 0", (0 == sd["get_gesture_udp"]["enqueued"].asInteger())); - ensure("sd[get_gesture_udp][dequeued] is 0", (0 == sd["get_gesture_udp"]["dequeued"].asInteger())); - - ensure("sd[get_wearable_http][enqueued] is 2", (2 == sd["get_wearable_http"]["enqueued"].asInteger())); - ensure("sd[get_wearable_http][dequeued] is 2", (2 == sd["get_wearable_http"]["dequeued"].asInteger())); - - ensure("sd[get_wearable_udp][enqueued] is 2", (2 == sd["get_wearable_udp"]["enqueued"].asInteger())); - ensure("sd[get_wearable_udp][dequeued] is 2", (2 == sd["get_wearable_udp"]["dequeued"].asInteger())); - - ensure("sd[get_other_http][enqueued] is 2", (2 == sd["get_other_http"]["enqueued"].asInteger())); - ensure("sd[get_other_http][dequeued] is 0", (0 == sd["get_other_http"]["dequeued"].asInteger())); - - ensure("sd[get_other_udp][enqueued] is 2", (2 == sd["get_other_udp"]["enqueued"].asInteger())); - ensure("sd[get_other_udp][dequeued] is 0", (0 == sd["get_other_udp"]["dequeued"].asInteger())); - - // Reset and check zeros... - // Reset leaves current region in place - gViewerAssetStats->reset(); - sd = get_region(gViewerAssetStats->asLLSD(false), region1_handle); - ensure("Region1 is present in results", sd.isMap()); - - delete gViewerAssetStats; - gViewerAssetStats = NULL; - - ensure_equals("sd[get_texture_non_temp_udp][enqueued] is reset", sd["get_texture_non_temp_udp"]["enqueued"].asInteger(), 0); - ensure_equals("sd[get_gesture_udp][dequeued] is reset", sd["get_gesture_udp"]["dequeued"].asInteger(), 0); - } -} +/** + * @file llviewerassetstats_tut.cpp + * @date 2010-10-28 + * @brief Test cases for some of newview/llviewerassetstats.cpp + * + * $LicenseInfo:firstyear=2010&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include +#include + +#include "lltut.h" +#include "../llviewerassetstats.h" +#include "lluuid.h" +#include "llsdutil.h" +#include "llregionhandle.h" +#include "lltracethreadrecorder.h" +#include "../llvoavatar.h" + +namespace LLStatViewer +{ + LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample"); +} + +void LLVOAvatar::getNearbyRezzedStats(std::vector& counts, F32& avg_cloud_time, S32& cloud_avatars) +{ + counts.resize(3); + counts[0] = 0; + counts[1] = 0; + counts[2] = 1; +} + +// static +std::string LLVOAvatar::rezStatusToString(S32 rez_status) +{ + if (rez_status==0) return "cloud"; + if (rez_status==1) return "gray"; + if (rez_status==2) return "textured"; + return "unknown"; +} + +// static +LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name) +{ + static LLViewerStats::StatsAccumulator junk; + return junk; +} + +static const char * all_keys[] = +{ + "duration", + "fps", + "get_other_http", + "get_other_udp", + "get_texture_temp_http", + "get_texture_temp_udp", + "get_texture_non_temp_http", + "get_texture_non_temp_udp", + "get_wearable_http", + "get_wearable_udp", + "get_sound_http", + "get_sound_udp", + "get_gesture_http", + "get_gesture_udp" +}; + +static const char * resp_keys[] = +{ + "get_other_http", + "get_other_udp", + "get_texture_temp_http", + "get_texture_temp_udp", + "get_texture_non_temp_http", + "get_texture_non_temp_udp", + "get_wearable_http", + "get_wearable_udp", + "get_sound_http", + "get_sound_udp", + "get_gesture_http", + "get_gesture_udp" +}; + +static const char * sub_keys[] = +{ + "dequeued", + "enqueued", + "resp_count", + "resp_max", + "resp_min", + "resp_mean" +}; + +static const char * mmm_resp_keys[] = +{ + "fps" +}; + +static const char * mmm_sub_keys[] = +{ + "count", + "max", + "min", + "mean" +}; + +static const LLUUID region1("4e2d81a3-6263-6ffe-ad5c-8ce04bee07e8"); +static const LLUUID region2("68762cc8-b68b-4e45-854b-e830734f2d4a"); +static const U64 region1_handle(0x0000040000003f00ULL); +static const U64 region2_handle(0x0000030000004200ULL); +static const std::string region1_handle_str("0000040000003f00"); +static const std::string region2_handle_str("0000030000004200"); + +#if 0 +static bool +is_empty_map(const LLSD & sd) +{ + return sd.isMap() && 0 == sd.size(); +} +#endif + +#if 0 +static bool +is_single_key_map(const LLSD & sd, const std::string & key) +{ + return sd.isMap() && 1 == sd.size() && sd.has(key); +} +#endif + +static bool +is_double_key_map(const LLSD & sd, const std::string & key1, const std::string & key2) +{ + return sd.isMap() && 2 == sd.size() && sd.has(key1) && sd.has(key2); +} + +#if 0 +static bool +is_triple_key_map(const LLSD & sd, const std::string & key1, const std::string & key2, const std::string& key3) +{ + return sd.isMap() && 3 == sd.size() && sd.has(key1) && sd.has(key2) && sd.has(key3); +} +#endif + +static bool +is_no_stats_map(const LLSD & sd) +{ + return is_double_key_map(sd, "duration", "regions"); +} + +static bool +is_single_slot_array(const LLSD & sd, U64 region_handle) +{ + U32 grid_x(0), grid_y(0); + grid_from_region_handle(region_handle, &grid_x, &grid_y); + + return (sd.isArray() && + 1 == sd.size() && + sd[0].has("grid_x") && + sd[0].has("grid_y") && + sd[0]["grid_x"].isInteger() && + sd[0]["grid_y"].isInteger() && + grid_x == sd[0]["grid_x"].asInteger() && + grid_y == sd[0]["grid_y"].asInteger()); +} + +static bool +is_double_slot_array(const LLSD & sd, U64 region_handle1, U64 region_handle2) +{ + U32 grid_x1(0), grid_y1(0); + U32 grid_x2(0), grid_y2(0); + grid_from_region_handle(region_handle1, &grid_x1, &grid_y1); + grid_from_region_handle(region_handle2, &grid_x2, &grid_y2); + + return (sd.isArray() && + 2 == sd.size() && + sd[0].has("grid_x") && + sd[0].has("grid_y") && + sd[0]["grid_x"].isInteger() && + sd[0]["grid_y"].isInteger() && + sd[1].has("grid_x") && + sd[1].has("grid_y") && + sd[1]["grid_x"].isInteger() && + sd[1]["grid_y"].isInteger() && + ((grid_x1 == sd[0]["grid_x"].asInteger() && + grid_y1 == sd[0]["grid_y"].asInteger() && + grid_x2 == sd[1]["grid_x"].asInteger() && + grid_y2 == sd[1]["grid_y"].asInteger()) || + (grid_x1 == sd[1]["grid_x"].asInteger() && + grid_y1 == sd[1]["grid_y"].asInteger() && + grid_x2 == sd[0]["grid_x"].asInteger() && + grid_y2 == sd[0]["grid_y"].asInteger()))); +} + +static LLSD +get_region(const LLSD & sd, U64 region_handle1) +{ + U32 grid_x(0), grid_y(0); + grid_from_region_handle(region_handle1, &grid_x, &grid_y); + + for (LLSD::array_const_iterator it(sd["regions"].beginArray()); + sd["regions"].endArray() != it; + ++it) + { + if ((*it).has("grid_x") && + (*it).has("grid_y") && + (*it)["grid_x"].isInteger() && + (*it)["grid_y"].isInteger() && + (*it)["grid_x"].asInteger() == grid_x && + (*it)["grid_y"].asInteger() == grid_y) + { + return *it; + } + } + return LLSD(); +} + +namespace tut +{ + struct tst_viewerassetstats_index + { + tst_viewerassetstats_index() + { + LLTrace::set_master_thread_recorder(&mThreadRecorder); + } + + ~tst_viewerassetstats_index() + { + LLTrace::set_master_thread_recorder(NULL); + } + + LLTrace::ThreadRecorder mThreadRecorder; + }; + typedef test_group tst_viewerassetstats_index_t; + typedef tst_viewerassetstats_index_t::object tst_viewerassetstats_index_object_t; + tut::tst_viewerassetstats_index_t tut_tst_viewerassetstats_index("tst_viewerassetstats_test"); + + // Testing free functions without global stats allocated + template<> template<> + void tst_viewerassetstats_index_object_t::test<1>() + { + // Check that helpers aren't bothered by missing global stats + ensure("Global gViewerAssetStats should be NULL", (NULL == gViewerAssetStats)); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); + + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); + + LLViewerAssetStatsFF::record_response(LLViewerAssetType::AT_GESTURE, false, false, (U64Microseconds)12300000ULL); + } + + // Create a non-global instance and check the structure + template<> template<> + void tst_viewerassetstats_index_object_t::test<2>() + { + ensure("Global gViewerAssetStats should be NULL", (NULL == gViewerAssetStats)); + + LLViewerAssetStats * it = new LLViewerAssetStats(); + + ensure("Global gViewerAssetStats should still be NULL", (NULL == gViewerAssetStats)); + + LLSD sd_full = it->asLLSD(false); + + // Default (NULL) region ID doesn't produce LLSD results so should + // get an empty map back from output + ensure("Stat-less LLSD initially", is_no_stats_map(sd_full)); + + // Once the region is set, we will get a response even with no data collection + it->setRegion(region1_handle); + sd_full = it->asLLSD(false); + ensure("Correct single-key LLSD map root", is_double_key_map(sd_full, "duration", "regions")); + ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd_full["regions"], region1_handle)); + + LLSD sd = sd_full["regions"][0]; + + delete it; + + // Check the structure of the LLSD + for (int i = 0; i < LL_ARRAY_SIZE(all_keys); ++i) + { + std::string line = llformat("Has '%s' key", all_keys[i]); + ensure(line, sd.has(all_keys[i])); + } + + for (int i = 0; i < LL_ARRAY_SIZE(resp_keys); ++i) + { + for (int j = 0; j < LL_ARRAY_SIZE(sub_keys); ++j) + { + std::string line = llformat("Key '%s' has '%s' key", resp_keys[i], sub_keys[j]); + ensure(line, sd[resp_keys[i]].has(sub_keys[j])); + } + } + + for (int i = 0; i < LL_ARRAY_SIZE(mmm_resp_keys); ++i) + { + for (int j = 0; j < LL_ARRAY_SIZE(mmm_sub_keys); ++j) + { + std::string line = llformat("Key '%s' has '%s' key", mmm_resp_keys[i], mmm_sub_keys[j]); + ensure(line, sd[mmm_resp_keys[i]].has(mmm_sub_keys[j])); + } + } + } + + // Create a non-global instance and check some content + template<> template<> + void tst_viewerassetstats_index_object_t::test<3>() + { + LLViewerAssetStats * it = new LLViewerAssetStats(); + it->setRegion(region1_handle); + + LLSD sd = it->asLLSD(false); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); + ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); + sd = sd[0]; + + delete it; + + // Check a few points on the tree for content + ensure("sd[get_texture_temp_http][dequeued] is 0", (0 == sd["get_texture_temp_http"]["dequeued"].asInteger())); + ensure("sd[get_sound_udp][resp_min] is 0", (0.0 == sd["get_sound_udp"]["resp_min"].asReal())); + } + + // Create a global instance and verify free functions do something useful + template<> template<> + void tst_viewerassetstats_index_object_t::test<4>() + { + gViewerAssetStats = new LLViewerAssetStats(); + LLViewerAssetStatsFF::set_region(region1_handle); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); + + LLSD sd = gViewerAssetStats->asLLSD(false); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); + ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); + sd = sd["regions"][0]; + + // Check a few points on the tree for content + ensure("sd[get_texture_non_temp_udp][enqueued] is 1", (1 == sd["get_texture_non_temp_udp"]["enqueued"].asInteger())); + ensure("sd[get_texture_temp_udp][enqueued] is 0", (0 == sd["get_texture_temp_udp"]["enqueued"].asInteger())); + ensure("sd[get_texture_non_temp_http][enqueued] is 0", (0 == sd["get_texture_non_temp_http"]["enqueued"].asInteger())); + ensure("sd[get_texture_temp_http][enqueued] is 0", (0 == sd["get_texture_temp_http"]["enqueued"].asInteger())); + ensure("sd[get_gesture_udp][dequeued] is 0", (0 == sd["get_gesture_udp"]["dequeued"].asInteger())); + + // Reset and check zeros... + // Reset leaves current region in place + gViewerAssetStats->reset(); + sd = gViewerAssetStats->asLLSD(false)["regions"][region1_handle_str]; + + delete gViewerAssetStats; + gViewerAssetStats = NULL; + + ensure("sd[get_texture_non_temp_udp][enqueued] is reset", (0 == sd["get_texture_non_temp_udp"]["enqueued"].asInteger())); + ensure("sd[get_gesture_udp][dequeued] is reset", (0 == sd["get_gesture_udp"]["dequeued"].asInteger())); + } + + // Check multiple region collection + template<> template<> + void tst_viewerassetstats_index_object_t::test<5>() + { + gViewerAssetStats = new LLViewerAssetStats(); + + LLViewerAssetStatsFF::set_region(region1_handle); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); + + LLViewerAssetStatsFF::set_region(region2_handle); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + + LLSD sd = gViewerAssetStats->asLLSD(false); + + // std::cout << sd << std::endl; + + ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions")); + ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle)); + LLSD sd1 = get_region(sd, region1_handle); + LLSD sd2 = get_region(sd, region2_handle); + ensure("Region1 is present in results", sd1.isMap()); + ensure("Region2 is present in results", sd2.isMap()); + + // Check a few points on the tree for content + ensure_equals("sd1[get_texture_non_temp_udp][enqueued] is 1", sd1["get_texture_non_temp_udp"]["enqueued"].asInteger(), 1); + ensure_equals("sd1[get_texture_temp_udp][enqueued] is 0", sd1["get_texture_temp_udp"]["enqueued"].asInteger(), 0); + ensure_equals("sd1[get_texture_non_temp_http][enqueued] is 0", sd1["get_texture_non_temp_http"]["enqueued"].asInteger(), 0); + ensure_equals("sd1[get_texture_temp_http][enqueued] is 0", sd1["get_texture_temp_http"]["enqueued"].asInteger(), 0); + ensure_equals("sd1[get_gesture_udp][dequeued] is 0", sd1["get_gesture_udp"]["dequeued"].asInteger(), 0); + + // Check a few points on the tree for content + ensure("sd2[get_gesture_udp][enqueued] is 4", (4 == sd2["get_gesture_udp"]["enqueued"].asInteger())); + ensure("sd2[get_gesture_udp][dequeued] is 0", (0 == sd2["get_gesture_udp"]["dequeued"].asInteger())); + ensure("sd2[get_texture_non_temp_udp][enqueued] is 0", (0 == sd2["get_texture_non_temp_udp"]["enqueued"].asInteger())); + + // Reset and check zeros... + // Reset leaves current region in place + gViewerAssetStats->reset(); + sd = gViewerAssetStats->asLLSD(false); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); + ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle)); + sd2 = sd["regions"][0]; + + delete gViewerAssetStats; + gViewerAssetStats = NULL; + + ensure("sd2[get_texture_non_temp_udp][enqueued] is reset", (0 == sd2["get_texture_non_temp_udp"]["enqueued"].asInteger())); + ensure("sd2[get_gesture_udp][enqueued] is reset", (0 == sd2["get_gesture_udp"]["enqueued"].asInteger())); + } + + // Check multiple region collection jumping back-and-forth between regions + template<> template<> + void tst_viewerassetstats_index_object_t::test<6>() + { + gViewerAssetStats = new LLViewerAssetStats(); + + LLViewerAssetStatsFF::set_region(region1_handle); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); + + LLViewerAssetStatsFF::set_region(region2_handle); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + + LLViewerAssetStatsFF::set_region(region1_handle); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, true, true); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, true, true); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); + + LLViewerAssetStatsFF::set_region(region2_handle); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + + LLSD sd = gViewerAssetStats->asLLSD(false); + + ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions")); + ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle)); + LLSD sd1 = get_region(sd, region1_handle); + LLSD sd2 = get_region(sd, region2_handle); + ensure("Region1 is present in results", sd1.isMap()); + ensure("Region2 is present in results", sd2.isMap()); + + // Check a few points on the tree for content + ensure("sd1[get_texture_non_temp_udp][enqueued] is 1", (1 == sd1["get_texture_non_temp_udp"]["enqueued"].asInteger())); + ensure("sd1[get_texture_temp_udp][enqueued] is 0", (0 == sd1["get_texture_temp_udp"]["enqueued"].asInteger())); + ensure("sd1[get_texture_non_temp_http][enqueued] is 0", (0 == sd1["get_texture_non_temp_http"]["enqueued"].asInteger())); + ensure("sd1[get_texture_temp_http][enqueued] is 1", (1 == sd1["get_texture_temp_http"]["enqueued"].asInteger())); + ensure("sd1[get_gesture_udp][dequeued] is 0", (0 == sd1["get_gesture_udp"]["dequeued"].asInteger())); + + // Check a few points on the tree for content + ensure("sd2[get_gesture_udp][enqueued] is 8", (8 == sd2["get_gesture_udp"]["enqueued"].asInteger())); + ensure("sd2[get_gesture_udp][dequeued] is 0", (0 == sd2["get_gesture_udp"]["dequeued"].asInteger())); + ensure("sd2[get_texture_non_temp_udp][enqueued] is 0", (0 == sd2["get_texture_non_temp_udp"]["enqueued"].asInteger())); + + // Reset and check zeros... + // Reset leaves current region in place + gViewerAssetStats->reset(); + sd = gViewerAssetStats->asLLSD(false); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "duration", "regions")); + ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle)); + sd2 = get_region(sd, region2_handle); + ensure("Region2 is present in results", sd2.isMap()); + + delete gViewerAssetStats; + gViewerAssetStats = NULL; + + ensure_equals("sd2[get_texture_non_temp_udp][enqueued] is reset", sd2["get_texture_non_temp_udp"]["enqueued"].asInteger(), 0); + ensure_equals("sd2[get_gesture_udp][enqueued] is reset", sd2["get_gesture_udp"]["enqueued"].asInteger(), 0); + } + + // Non-texture assets ignore transport and persistence flags + template<> template<> + void tst_viewerassetstats_index_object_t::test<7>() + { + gViewerAssetStats = new LLViewerAssetStats(); + LLViewerAssetStatsFF::set_region(region1_handle); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, true); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, true); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, true, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, true, false); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, true, true); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, true, true); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, false, false); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, false, true); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, true, false); + + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, true, true); + + LLSD sd = gViewerAssetStats->asLLSD(false); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); + ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); + sd = get_region(sd, region1_handle); + ensure("Region1 is present in results", sd.isMap()); + + // Check a few points on the tree for content + ensure("sd[get_gesture_udp][enqueued] is 0", (0 == sd["get_gesture_udp"]["enqueued"].asInteger())); + ensure("sd[get_gesture_udp][dequeued] is 0", (0 == sd["get_gesture_udp"]["dequeued"].asInteger())); + + ensure("sd[get_wearable_http][enqueued] is 2", (2 == sd["get_wearable_http"]["enqueued"].asInteger())); + ensure("sd[get_wearable_http][dequeued] is 2", (2 == sd["get_wearable_http"]["dequeued"].asInteger())); + + ensure("sd[get_wearable_udp][enqueued] is 2", (2 == sd["get_wearable_udp"]["enqueued"].asInteger())); + ensure("sd[get_wearable_udp][dequeued] is 2", (2 == sd["get_wearable_udp"]["dequeued"].asInteger())); + + ensure("sd[get_other_http][enqueued] is 2", (2 == sd["get_other_http"]["enqueued"].asInteger())); + ensure("sd[get_other_http][dequeued] is 0", (0 == sd["get_other_http"]["dequeued"].asInteger())); + + ensure("sd[get_other_udp][enqueued] is 2", (2 == sd["get_other_udp"]["enqueued"].asInteger())); + ensure("sd[get_other_udp][dequeued] is 0", (0 == sd["get_other_udp"]["dequeued"].asInteger())); + + // Reset and check zeros... + // Reset leaves current region in place + gViewerAssetStats->reset(); + sd = get_region(gViewerAssetStats->asLLSD(false), region1_handle); + ensure("Region1 is present in results", sd.isMap()); + + delete gViewerAssetStats; + gViewerAssetStats = NULL; + + ensure_equals("sd[get_texture_non_temp_udp][enqueued] is reset", sd["get_texture_non_temp_udp"]["enqueued"].asInteger(), 0); + ensure_equals("sd[get_gesture_udp][dequeued] is reset", sd["get_gesture_udp"]["dequeued"].asInteger(), 0); + } +} diff --git a/indra/newview/tests/llviewerhelputil_test.cpp b/indra/newview/tests/llviewerhelputil_test.cpp index 16b796e6e7..9ee6625bf1 100644 --- a/indra/newview/tests/llviewerhelputil_test.cpp +++ b/indra/newview/tests/llviewerhelputil_test.cpp @@ -1,160 +1,160 @@ -/** - * @file llviewerhelputil_test.cpp - * @brief LLViewerHelpUtil tests - * @author Tofu Linden - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -// Precompiled header -#include "../llviewerprecompiledheaders.h" - -#include "../test/lltut.h" - -#include "../llviewerhelputil.h" -#include "../llweb.h" -#include "llcontrol.h" - -#include - -// values for all of the supported substitutions parameters -static std::string gHelpURL; -static std::string gVersion; -static std::string gChannel; -static std::string gLanguage; -static std::string gGrid; -static std::string gOS; - -//---------------------------------------------------------------------------- -// Mock objects for the dependencies of the code we're testing - -LLControlGroup::LLControlGroup(const std::string& name) - : LLInstanceTracker(name) {} -LLControlGroup::~LLControlGroup() {} -LLControlVariable* LLControlGroup::declareString(const std::string& name, - const std::string& initial_val, - const std::string& comment, - LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(std::string_view name, const std::string& val){} -std::string LLControlGroup::getString(std::string_view name) -{ - if (name == "HelpURLFormat") - return gHelpURL; - return ""; -} -LLControlGroup gSavedSettings("test"); - -static void substitute_string(std::string &input, const std::string &search, const std::string &replace) -{ - size_t pos = input.find(search); - while (pos != std::string::npos) - { - input = input.replace(pos, search.size(), replace); - pos = input.find(search); - } -} - -#include "../llagent.h" -LLAgent::LLAgent() : mAgentAccess(NULL) { } -LLAgent::~LLAgent() { } -bool LLAgent::isGodlike() const { return false; } - -LLAgent gAgent; - -std::string LLWeb::expandURLSubstitutions(const std::string &url, - const LLSD &default_subs) -{ - (void)gAgent.isGodlike(); // ref symbol to stop compiler from stripping it - std::string new_url = url; - substitute_string(new_url, "[TOPIC]", default_subs["TOPIC"].asString()); - substitute_string(new_url, "[VERSION]", gVersion); - substitute_string(new_url, "[CHANNEL]", gChannel); - substitute_string(new_url, "[LANGUAGE]", gLanguage); - substitute_string(new_url, "[GRID]", gGrid); - substitute_string(new_url, "[OS]", gOS); - return new_url; -} - - -//---------------------------------------------------------------------------- - -namespace tut -{ - struct viewerhelputil - { - }; - - typedef test_group viewerhelputil_t; - typedef viewerhelputil_t::object viewerhelputil_object_t; - tut::viewerhelputil_t tut_viewerhelputil("LLViewerHelpUtil"); - - template<> template<> - void viewerhelputil_object_t::test<1>() - { - std::string topic("test_topic"); - std::string subresult; - - gHelpURL = "fooformat"; - subresult = LLViewerHelpUtil::buildHelpURL(topic); - ensure_equals("no substitution tags", subresult, "fooformat"); - - gHelpURL = ""; - subresult = LLViewerHelpUtil::buildHelpURL(topic); - ensure_equals("blank substitution format", subresult, ""); - - gHelpURL = "[TOPIC]"; - subresult = LLViewerHelpUtil::buildHelpURL(topic); - ensure_equals("topic name", subresult, "test_topic"); - - gHelpURL = "[LANGUAGE]"; - gLanguage = ""; - subresult = LLViewerHelpUtil::buildHelpURL(topic); - ensure_equals("simple substitution with blank", subresult, ""); - - gHelpURL = "[LANGUAGE]"; - gLanguage = "Esperanto"; - subresult = LLViewerHelpUtil::buildHelpURL(topic); - ensure_equals("simple substitution", subresult, "Esperanto"); - - gHelpURL = "http://secondlife.com/[LANGUAGE]"; - gLanguage = "Gaelic"; - subresult = LLViewerHelpUtil::buildHelpURL(topic); - ensure_equals("simple substitution with url", subresult, "http://secondlife.com/Gaelic"); - - gHelpURL = "[XXX]"; - subresult = LLViewerHelpUtil::buildHelpURL(topic); - ensure_equals("unknown substitution", subresult, "[XXX]"); - - gHelpURL = "[LANGUAGE]/[LANGUAGE]"; - gLanguage = "Esperanto"; - subresult = LLViewerHelpUtil::buildHelpURL(topic); - ensure_equals("multiple substitution", subresult, "Esperanto/Esperanto"); - - gHelpURL = "http://[CHANNEL]/[VERSION]/[LANGUAGE]/[OS]/[GRID]/[XXX]"; - gChannel = "Second Life Test"; - gVersion = "2.0"; - gLanguage = "gaelic"; - gOS = "AmigaOS 2.1"; - gGrid = "mysim"; - subresult = LLViewerHelpUtil::buildHelpURL(topic); - ensure_equals("complex substitution", subresult, "http://Second Life Test/2.0/gaelic/AmigaOS 2.1/mysim/[XXX]"); - } -} +/** + * @file llviewerhelputil_test.cpp + * @brief LLViewerHelpUtil tests + * @author Tofu Linden + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +// Precompiled header +#include "../llviewerprecompiledheaders.h" + +#include "../test/lltut.h" + +#include "../llviewerhelputil.h" +#include "../llweb.h" +#include "llcontrol.h" + +#include + +// values for all of the supported substitutions parameters +static std::string gHelpURL; +static std::string gVersion; +static std::string gChannel; +static std::string gLanguage; +static std::string gGrid; +static std::string gOS; + +//---------------------------------------------------------------------------- +// Mock objects for the dependencies of the code we're testing + +LLControlGroup::LLControlGroup(const std::string& name) + : LLInstanceTracker(name) {} +LLControlGroup::~LLControlGroup() {} +LLControlVariable* LLControlGroup::declareString(const std::string& name, + const std::string& initial_val, + const std::string& comment, + LLControlVariable::ePersist persist) {return NULL;} +void LLControlGroup::setString(std::string_view name, const std::string& val){} +std::string LLControlGroup::getString(std::string_view name) +{ + if (name == "HelpURLFormat") + return gHelpURL; + return ""; +} +LLControlGroup gSavedSettings("test"); + +static void substitute_string(std::string &input, const std::string &search, const std::string &replace) +{ + size_t pos = input.find(search); + while (pos != std::string::npos) + { + input = input.replace(pos, search.size(), replace); + pos = input.find(search); + } +} + +#include "../llagent.h" +LLAgent::LLAgent() : mAgentAccess(NULL) { } +LLAgent::~LLAgent() { } +bool LLAgent::isGodlike() const { return false; } + +LLAgent gAgent; + +std::string LLWeb::expandURLSubstitutions(const std::string &url, + const LLSD &default_subs) +{ + (void)gAgent.isGodlike(); // ref symbol to stop compiler from stripping it + std::string new_url = url; + substitute_string(new_url, "[TOPIC]", default_subs["TOPIC"].asString()); + substitute_string(new_url, "[VERSION]", gVersion); + substitute_string(new_url, "[CHANNEL]", gChannel); + substitute_string(new_url, "[LANGUAGE]", gLanguage); + substitute_string(new_url, "[GRID]", gGrid); + substitute_string(new_url, "[OS]", gOS); + return new_url; +} + + +//---------------------------------------------------------------------------- + +namespace tut +{ + struct viewerhelputil + { + }; + + typedef test_group viewerhelputil_t; + typedef viewerhelputil_t::object viewerhelputil_object_t; + tut::viewerhelputil_t tut_viewerhelputil("LLViewerHelpUtil"); + + template<> template<> + void viewerhelputil_object_t::test<1>() + { + std::string topic("test_topic"); + std::string subresult; + + gHelpURL = "fooformat"; + subresult = LLViewerHelpUtil::buildHelpURL(topic); + ensure_equals("no substitution tags", subresult, "fooformat"); + + gHelpURL = ""; + subresult = LLViewerHelpUtil::buildHelpURL(topic); + ensure_equals("blank substitution format", subresult, ""); + + gHelpURL = "[TOPIC]"; + subresult = LLViewerHelpUtil::buildHelpURL(topic); + ensure_equals("topic name", subresult, "test_topic"); + + gHelpURL = "[LANGUAGE]"; + gLanguage = ""; + subresult = LLViewerHelpUtil::buildHelpURL(topic); + ensure_equals("simple substitution with blank", subresult, ""); + + gHelpURL = "[LANGUAGE]"; + gLanguage = "Esperanto"; + subresult = LLViewerHelpUtil::buildHelpURL(topic); + ensure_equals("simple substitution", subresult, "Esperanto"); + + gHelpURL = "http://secondlife.com/[LANGUAGE]"; + gLanguage = "Gaelic"; + subresult = LLViewerHelpUtil::buildHelpURL(topic); + ensure_equals("simple substitution with url", subresult, "http://secondlife.com/Gaelic"); + + gHelpURL = "[XXX]"; + subresult = LLViewerHelpUtil::buildHelpURL(topic); + ensure_equals("unknown substitution", subresult, "[XXX]"); + + gHelpURL = "[LANGUAGE]/[LANGUAGE]"; + gLanguage = "Esperanto"; + subresult = LLViewerHelpUtil::buildHelpURL(topic); + ensure_equals("multiple substitution", subresult, "Esperanto/Esperanto"); + + gHelpURL = "http://[CHANNEL]/[VERSION]/[LANGUAGE]/[OS]/[GRID]/[XXX]"; + gChannel = "Second Life Test"; + gVersion = "2.0"; + gLanguage = "gaelic"; + gOS = "AmigaOS 2.1"; + gGrid = "mysim"; + subresult = LLViewerHelpUtil::buildHelpURL(topic); + ensure_equals("complex substitution", subresult, "http://Second Life Test/2.0/gaelic/AmigaOS 2.1/mysim/[XXX]"); + } +} diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp index ddaa2a40da..40c2059d27 100644 --- a/indra/newview/tests/llviewernetwork_test.cpp +++ b/indra/newview/tests/llviewernetwork_test.cpp @@ -1,450 +1,450 @@ -/** - * @file llviewernetwork_test.cpp - * @author Roxie - * @date 2009-03-9 - * @brief Test the viewernetwork functionality - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2014, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#include "../llviewerprecompiledheaders.h" -#include "../llviewernetwork.h" -#include "../test/lltut.h" -#include "../../llxml/llcontrol.h" -#include "llfile.h" - -namespace -{ - -// Should not collide with other test programs creating temp files. -static const char * const TEST_FILENAME("llviewernetwork_test.xml"); - -} - -// -// Stub implementation for LLTrans -// -class LLTrans -{ -public: - static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false); -}; - -std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string) -{ - std::string grid_label = std::string(); - if(xml_desc == "AgniGridLabel") - { - grid_label = "Second Life Main Grid (Agni)"; - } - else if(xml_desc == "AditiGridLabel") - { - grid_label = "Second Life Beta Test Grid (Aditi)"; - } - - return grid_label; -} - -//---------------------------------------------------------------------------- -// Mock objects for the dependencies of the code we're testing - -LLControlGroup::LLControlGroup(const std::string& name) -: LLInstanceTracker(name) {} -LLControlGroup::~LLControlGroup() {} -LLControlVariable* LLControlGroup::declareString(const std::string& name, - const std::string& initial_val, - const std::string& comment, - LLControlVariable::ePersist persist) {return NULL;} -void LLControlGroup::setString(std::string_view name, const std::string& val){} - -std::string gCmdLineLoginURI; -std::string gCmdLineGridChoice; -std::string gCmdLineHelperURI; -std::string gLoginPage; -std::string gCurrentGrid; -std::string LLControlGroup::getString(std::string_view name) -{ - if (name == "CmdLineGridChoice") - return gCmdLineGridChoice; - else if (name == "CmdLineHelperURI") - return gCmdLineHelperURI; - else if (name == "LoginPage") - return gLoginPage; - else if (name == "CurrentGrid") - return gCurrentGrid; - return ""; -} - -LLSD LLControlGroup::getLLSD(std::string_view name) -{ - if (name == "CmdLineLoginURI") - { - if(!gCmdLineLoginURI.empty()) - { - return LLSD(gCmdLineLoginURI); - } - } - return LLSD(); -} - -LLPointer LLControlGroup::getControl(std::string_view name) -{ - ctrl_name_table_t::iterator iter = mNameTable.find(name.data()); - return iter == mNameTable.end() ? LLPointer() : iter->second; -} - -LLControlGroup gSavedSettings("test"); - -const char *gSampleGridFile = - "" - "" - " " - " altgrid.long.name" - " " - " helper_urihttps://helper1/helpers/" - " labelAlternative Grid" - " login_pagealtgrid/loginpage" - " login_uri" - " " - " altgrid/myloginuri1" - " altgrid/myloginuri2" - " " - " keynamealtgrid.long.name" - " credential_typeagent" - " grid_login_idAltGrid" - " " - " minimal.long.name" - " " - " keynameminimal.long.name" - " " - " " - " util.agni.lindenlab.com " - " " - " helper_urihttps://helper1/helpers/" - " grid_login_idmylabel" - " labelmylabel" - " login_pageloginpage" - " login_uri" - " " - " myloginuri" - " " - " keynameutil.agni.lindenlab.com " - " " - " util.foobar.lindenlab.com" - " " - " helper_urihttps://helper1/helpers/" - " grid_login_idAditi " - " labelmylabel" - " login_pageloginpage" - " login_uri" - " " - " myloginuri" - " " - " update_query_url_basehttps://update.secondlife.com/update" - " keynameutil.foobar.lindenlab.com" - " " - " " - "" - ; -// ------------------------------------------------------------------------------------------- -// TUT -// ------------------------------------------------------------------------------------------- -namespace tut -{ - // Test wrapper declaration : wrapping nothing for the moment - struct viewerNetworkTest - { - viewerNetworkTest() - { - LLFile::remove(TEST_FILENAME); - gCmdLineLoginURI.clear(); - gCmdLineGridChoice.clear(); - gCmdLineHelperURI.clear(); - gLoginPage.clear(); - gCurrentGrid.clear(); - } - ~viewerNetworkTest() - { - LLFile::remove(TEST_FILENAME); - } - }; - - // Tut templating thingamagic: test group, object and test instance - typedef test_group viewerNetworkTestFactory; - typedef viewerNetworkTestFactory::object viewerNetworkTestObject; - tut::viewerNetworkTestFactory tut_test("LLViewerNetwork"); - - // --------------------------------------------------------------------------------------- - // Test functions - // --------------------------------------------------------------------------------------- - // initialization without a grid file - template<> template<> - void viewerNetworkTestObject::test<1>() - { - LLGridManager *manager = LLGridManager::getInstance(); - // grid file doesn't exist - manager->initialize(TEST_FILENAME); - // validate that some of the defaults are available. - std::map known_grids = manager->getKnownGrids(); - ensure_equals("Known grids is a string-string map of size 2", known_grids.size(), 2); - ensure_equals("Agni has the right name and label", - known_grids[std::string("util.agni.lindenlab.com")], - std::string("Second Life Main Grid (Agni)")); - ensure_equals("Aditi has the right name and label", - known_grids[std::string("util.aditi.lindenlab.com")], - std::string("Second Life Beta Test Grid (Aditi)")); - ensure_equals("name for agni", - LLGridManager::getInstance()->getGrid("util.agni.lindenlab.com"), - std::string("util.agni.lindenlab.com")); - ensure_equals("id for agni", - std::string("Agni"), - LLGridManager::getInstance()->getGridId("util.agni.lindenlab.com")); - ensure_equals("update url base for Agni", // relies on agni being the default - std::string("https://update.secondlife.com/update"), - LLGridManager::getInstance()->getUpdateServiceURL()); - ensure_equals("label for agni", - LLGridManager::getInstance()->getGridLabel("util.agni.lindenlab.com"), - std::string("Second Life Main Grid (Agni)")); - - std::vector login_uris; - LLGridManager::getInstance()->getLoginURIs(std::string("util.agni.lindenlab.com"), login_uris); - ensure_equals("Number of login uris for agni", 1, login_uris.size()); - ensure_equals("Agni login uri", - login_uris[0], - std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi")); - ensure_equals("Agni helper uri", - LLGridManager::getInstance()->getHelperURI("util.agni.lindenlab.com"), - std::string("https://secondlife.com/helpers/")); - ensure_equals("Agni login page", - LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"), - std::string("https://viewer-splash.secondlife.com/")); - ensure("Agni is a system grid", - LLGridManager::getInstance()->isSystemGrid("util.agni.lindenlab.com")); - - ensure_equals("name for aditi", - LLGridManager::getInstance()->getGrid("util.aditi.lindenlab.com"), - std::string("util.aditi.lindenlab.com")); - ensure_equals("id for aditi", - LLGridManager::getInstance()->getGridId("util.aditi.lindenlab.com"), - std::string("Aditi")); - ensure_equals("label for aditi", - LLGridManager::getInstance()->getGridLabel("util.aditi.lindenlab.com"), - std::string("Second Life Beta Test Grid (Aditi)")); - - LLGridManager::getInstance()->getLoginURIs(std::string("util.aditi.lindenlab.com"), login_uris); - - ensure_equals("Number of login uris for aditi", 1, login_uris.size()); - ensure_equals("Aditi login uri", - login_uris[0], - std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi")); - ensure_equals("Aditi helper uri", - LLGridManager::getInstance()->getHelperURI("util.aditi.lindenlab.com"), - std::string("https://secondlife.aditi.lindenlab.com/helpers/")); - ensure_equals("Aditi login page", - LLGridManager::getInstance()->getLoginPage("util.aditi.lindenlab.com"), - std::string("https://viewer-splash.secondlife.com/")); - ensure("Aditi is a system grid", - LLGridManager::getInstance()->isSystemGrid("util.aditi.lindenlab.com")); - } - - // initialization with a grid file - template<> template<> - void viewerNetworkTestObject::test<2>() - { - llofstream gridfile(TEST_FILENAME); - gridfile << gSampleGridFile; - gridfile.close(); - - LLGridManager::getInstance()->initialize(TEST_FILENAME); - std::map known_grids = LLGridManager::getInstance()->getKnownGrids(); - ensure_equals("adding a grid via a grid file increases known grid size",4, - known_grids.size()); - - // Verify that Agni and Aditi were not overwritten - ensure_equals("Agni has the right name and label", - known_grids[std::string("util.agni.lindenlab.com")], - std::string("Second Life Main Grid (Agni)")); - ensure_equals("Aditi has the right name and label", - known_grids[std::string("util.aditi.lindenlab.com")], - std::string("Second Life Beta Test Grid (Aditi)")); - ensure_equals("name for agni", - LLGridManager::getInstance()->getGrid("util.agni.lindenlab.com"), - std::string("util.agni.lindenlab.com")); - ensure_equals("id for agni", - LLGridManager::getInstance()->getGridId("util.agni.lindenlab.com"), - std::string("Agni")); - ensure_equals("update url base for Agni", // relies on agni being the default - std::string("https://update.secondlife.com/update"), - LLGridManager::getInstance()->getUpdateServiceURL()); - ensure_equals("label for agni", - LLGridManager::getInstance()->getGridLabel("util.agni.lindenlab.com"), - std::string("Second Life Main Grid (Agni)")); - std::vector login_uris; - LLGridManager::getInstance()->getLoginURIs(std::string("util.agni.lindenlab.com"), login_uris); - ensure_equals("Number of login uris for agni", 1, login_uris.size()); - ensure_equals("Agni login uri", - login_uris[0], - std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi")); - ensure_equals("Agni helper uri", - LLGridManager::getInstance()->getHelperURI("util.agni.lindenlab.com"), - std::string("https://secondlife.com/helpers/")); - ensure_equals("Agni login page", - LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"), - std::string("https://viewer-splash.secondlife.com/")); - ensure("Agni is a system grid", - LLGridManager::getInstance()->isSystemGrid("util.agni.lindenlab.com")); - - ensure_equals("name for aditi", - LLGridManager::getInstance()->getGrid("util.aditi.lindenlab.com"), - std::string("util.aditi.lindenlab.com")); - ensure_equals("id for aditi", - LLGridManager::getInstance()->getGridId("util.aditi.lindenlab.com"), - std::string("Aditi")); - ensure_equals("label for aditi", - LLGridManager::getInstance()->getGridLabel("util.aditi.lindenlab.com"), - std::string("Second Life Beta Test Grid (Aditi)")); - - LLGridManager::getInstance()->getLoginURIs(std::string("util.aditi.lindenlab.com"), login_uris); - ensure_equals("Number of login uris for aditi", 1, login_uris.size()); - ensure_equals("Aditi login uri", - login_uris[0], - std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi")); - ensure_equals("Aditi helper uri", - LLGridManager::getInstance()->getHelperURI("util.aditi.lindenlab.com"), - std::string("https://secondlife.aditi.lindenlab.com/helpers/")); - ensure_equals("Aditi login page", - LLGridManager::getInstance()->getLoginPage("util.aditi.lindenlab.com"), - std::string("https://viewer-splash.secondlife.com/")); - ensure("Aditi is a system grid", - LLGridManager::getInstance()->isSystemGrid("util.aditi.lindenlab.com")); - - // Check the additional grid from the file - ensure_equals("alternative grid is in name<->label map", - known_grids["altgrid.long.name"], - std::string("Alternative Grid")); - ensure_equals("alternative grid name is set", - LLGridManager::getInstance()->getGrid("altgrid.long.name"), - std::string("altgrid.long.name")); - ensure_equals("alternative grid id", - LLGridManager::getInstance()->getGridId("altgrid.long.name"), - std::string("AltGrid")); - ensure_equals("alternative grid label", - LLGridManager::getInstance()->getGridLabel("altgrid.long.name"), - std::string("Alternative Grid")); - std::vector alt_login_uris; - LLGridManager::getInstance()->getLoginURIs(std::string("altgrid.long.name"), alt_login_uris); - ensure_equals("Number of login uris for altgrid", 2, alt_login_uris.size()); - ensure_equals("alternative grid first login uri", - alt_login_uris[0], - std::string("altgrid/myloginuri1")); - ensure_equals("alternative grid second login uri", - alt_login_uris[1], - std::string("altgrid/myloginuri2")); - ensure_equals("alternative grid helper uri", - LLGridManager::getInstance()->getHelperURI("altgrid.long.name"), - std::string("https://helper1/helpers/")); - ensure_equals("alternative grid login page", - LLGridManager::getInstance()->getLoginPage("altgrid.long.name"), - std::string("altgrid/loginpage")); - ensure("alternative grid is NOT a system grid", - ! LLGridManager::getInstance()->isSystemGrid("altgrid.long.name")); - - ensure_equals("minimal grid is in name<->label map", - known_grids["minimal.long.name"], - std::string("minimal.long.name")); - ensure_equals("minimal grid name is set", - LLGridManager::getInstance()->getGrid("minimal.long.name"), - std::string("minimal.long.name")); - ensure_equals("minimal grid id", - LLGridManager::getInstance()->getGridId("minimal.long.name"), - std::string("minimal.long.name")); - ensure_equals("minimal grid label", - LLGridManager::getInstance()->getGridLabel("minimal.long.name"), - std::string("minimal.long.name")); - - LLGridManager::getInstance()->getLoginURIs(std::string("minimal.long.name"), alt_login_uris); - ensure_equals("Number of login uris for altgrid", 1, alt_login_uris.size()); - ensure_equals("minimal grid login uri", - alt_login_uris[0], - std::string("https://minimal.long.name/cgi-bin/login.cgi")); - ensure_equals("minimal grid helper uri", - LLGridManager::getInstance()->getHelperURI("minimal.long.name"), - std::string("https://minimal.long.name/helpers/")); - ensure_equals("minimal grid login page", - LLGridManager::getInstance()->getLoginPage("minimal.long.name"), - std::string("http://minimal.long.name/app/login/")); - - } - - - // validate grid selection - template<> template<> - void viewerNetworkTestObject::test<7>() - { - // adding a grid with simply a name will populate the values. - llofstream gridfile(TEST_FILENAME); - gridfile << gSampleGridFile; - gridfile.close(); - - LLGridManager::getInstance()->initialize(TEST_FILENAME); - - LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com"); - ensure_equals("getGridLabel", - LLGridManager::getInstance()->getGridLabel(), - std::string("Second Life Main Grid (Agni)")); - ensure_equals("getGridId", - LLGridManager::getInstance()->getGridId(), - std::string("Agni")); - ensure_equals("getGrid", - LLGridManager::getInstance()->getGrid(), - std::string("util.agni.lindenlab.com")); - ensure_equals("getHelperURI", - LLGridManager::getInstance()->getHelperURI(), - std::string("https://secondlife.com/helpers/")); - ensure_equals("getLoginPage", - LLGridManager::getInstance()->getLoginPage(), - std::string("https://viewer-splash.secondlife.com/")); - ensure_equals("update url base for Agni", // relies on agni being the default - std::string("https://update.secondlife.com/update"), - LLGridManager::getInstance()->getUpdateServiceURL()); - ensure("Is Agni a production grid", LLGridManager::getInstance()->isInProductionGrid()); - std::vector uris; - LLGridManager::getInstance()->getLoginURIs(uris); - ensure_equals("getLoginURIs size", 1, uris.size()); - ensure_equals("getLoginURIs", - uris[0], - std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi")); - - LLGridManager::getInstance()->setGridChoice("altgrid.long.name"); - ensure_equals("getGridLabel", - LLGridManager::getInstance()->getGridLabel(), - std::string("Alternative Grid")); - ensure_equals("getGridId", - LLGridManager::getInstance()->getGridId(), - std::string("AltGrid")); - ensure("alternative grid is not a system grid", - !LLGridManager::getInstance()->isSystemGrid()); - ensure("alternative grid is not a production grid", - !LLGridManager::getInstance()->isInProductionGrid()); - } - -} +/** + * @file llviewernetwork_test.cpp + * @author Roxie + * @date 2009-03-9 + * @brief Test the viewernetwork functionality + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2014, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "../llviewerprecompiledheaders.h" +#include "../llviewernetwork.h" +#include "../test/lltut.h" +#include "../../llxml/llcontrol.h" +#include "llfile.h" + +namespace +{ + +// Should not collide with other test programs creating temp files. +static const char * const TEST_FILENAME("llviewernetwork_test.xml"); + +} + +// +// Stub implementation for LLTrans +// +class LLTrans +{ +public: + static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false); +}; + +std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string) +{ + std::string grid_label = std::string(); + if(xml_desc == "AgniGridLabel") + { + grid_label = "Second Life Main Grid (Agni)"; + } + else if(xml_desc == "AditiGridLabel") + { + grid_label = "Second Life Beta Test Grid (Aditi)"; + } + + return grid_label; +} + +//---------------------------------------------------------------------------- +// Mock objects for the dependencies of the code we're testing + +LLControlGroup::LLControlGroup(const std::string& name) +: LLInstanceTracker(name) {} +LLControlGroup::~LLControlGroup() {} +LLControlVariable* LLControlGroup::declareString(const std::string& name, + const std::string& initial_val, + const std::string& comment, + LLControlVariable::ePersist persist) {return NULL;} +void LLControlGroup::setString(std::string_view name, const std::string& val){} + +std::string gCmdLineLoginURI; +std::string gCmdLineGridChoice; +std::string gCmdLineHelperURI; +std::string gLoginPage; +std::string gCurrentGrid; +std::string LLControlGroup::getString(std::string_view name) +{ + if (name == "CmdLineGridChoice") + return gCmdLineGridChoice; + else if (name == "CmdLineHelperURI") + return gCmdLineHelperURI; + else if (name == "LoginPage") + return gLoginPage; + else if (name == "CurrentGrid") + return gCurrentGrid; + return ""; +} + +LLSD LLControlGroup::getLLSD(std::string_view name) +{ + if (name == "CmdLineLoginURI") + { + if(!gCmdLineLoginURI.empty()) + { + return LLSD(gCmdLineLoginURI); + } + } + return LLSD(); +} + +LLPointer LLControlGroup::getControl(std::string_view name) +{ + ctrl_name_table_t::iterator iter = mNameTable.find(name.data()); + return iter == mNameTable.end() ? LLPointer() : iter->second; +} + +LLControlGroup gSavedSettings("test"); + +const char *gSampleGridFile = + "" + "" + " " + " altgrid.long.name" + " " + " helper_urihttps://helper1/helpers/" + " labelAlternative Grid" + " login_pagealtgrid/loginpage" + " login_uri" + " " + " altgrid/myloginuri1" + " altgrid/myloginuri2" + " " + " keynamealtgrid.long.name" + " credential_typeagent" + " grid_login_idAltGrid" + " " + " minimal.long.name" + " " + " keynameminimal.long.name" + " " + " " + " util.agni.lindenlab.com " + " " + " helper_urihttps://helper1/helpers/" + " grid_login_idmylabel" + " labelmylabel" + " login_pageloginpage" + " login_uri" + " " + " myloginuri" + " " + " keynameutil.agni.lindenlab.com " + " " + " util.foobar.lindenlab.com" + " " + " helper_urihttps://helper1/helpers/" + " grid_login_idAditi " + " labelmylabel" + " login_pageloginpage" + " login_uri" + " " + " myloginuri" + " " + " update_query_url_basehttps://update.secondlife.com/update" + " keynameutil.foobar.lindenlab.com" + " " + " " + "" + ; +// ------------------------------------------------------------------------------------------- +// TUT +// ------------------------------------------------------------------------------------------- +namespace tut +{ + // Test wrapper declaration : wrapping nothing for the moment + struct viewerNetworkTest + { + viewerNetworkTest() + { + LLFile::remove(TEST_FILENAME); + gCmdLineLoginURI.clear(); + gCmdLineGridChoice.clear(); + gCmdLineHelperURI.clear(); + gLoginPage.clear(); + gCurrentGrid.clear(); + } + ~viewerNetworkTest() + { + LLFile::remove(TEST_FILENAME); + } + }; + + // Tut templating thingamagic: test group, object and test instance + typedef test_group viewerNetworkTestFactory; + typedef viewerNetworkTestFactory::object viewerNetworkTestObject; + tut::viewerNetworkTestFactory tut_test("LLViewerNetwork"); + + // --------------------------------------------------------------------------------------- + // Test functions + // --------------------------------------------------------------------------------------- + // initialization without a grid file + template<> template<> + void viewerNetworkTestObject::test<1>() + { + LLGridManager *manager = LLGridManager::getInstance(); + // grid file doesn't exist + manager->initialize(TEST_FILENAME); + // validate that some of the defaults are available. + std::map known_grids = manager->getKnownGrids(); + ensure_equals("Known grids is a string-string map of size 2", known_grids.size(), 2); + ensure_equals("Agni has the right name and label", + known_grids[std::string("util.agni.lindenlab.com")], + std::string("Second Life Main Grid (Agni)")); + ensure_equals("Aditi has the right name and label", + known_grids[std::string("util.aditi.lindenlab.com")], + std::string("Second Life Beta Test Grid (Aditi)")); + ensure_equals("name for agni", + LLGridManager::getInstance()->getGrid("util.agni.lindenlab.com"), + std::string("util.agni.lindenlab.com")); + ensure_equals("id for agni", + std::string("Agni"), + LLGridManager::getInstance()->getGridId("util.agni.lindenlab.com")); + ensure_equals("update url base for Agni", // relies on agni being the default + std::string("https://update.secondlife.com/update"), + LLGridManager::getInstance()->getUpdateServiceURL()); + ensure_equals("label for agni", + LLGridManager::getInstance()->getGridLabel("util.agni.lindenlab.com"), + std::string("Second Life Main Grid (Agni)")); + + std::vector login_uris; + LLGridManager::getInstance()->getLoginURIs(std::string("util.agni.lindenlab.com"), login_uris); + ensure_equals("Number of login uris for agni", 1, login_uris.size()); + ensure_equals("Agni login uri", + login_uris[0], + std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi")); + ensure_equals("Agni helper uri", + LLGridManager::getInstance()->getHelperURI("util.agni.lindenlab.com"), + std::string("https://secondlife.com/helpers/")); + ensure_equals("Agni login page", + LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"), + std::string("https://viewer-splash.secondlife.com/")); + ensure("Agni is a system grid", + LLGridManager::getInstance()->isSystemGrid("util.agni.lindenlab.com")); + + ensure_equals("name for aditi", + LLGridManager::getInstance()->getGrid("util.aditi.lindenlab.com"), + std::string("util.aditi.lindenlab.com")); + ensure_equals("id for aditi", + LLGridManager::getInstance()->getGridId("util.aditi.lindenlab.com"), + std::string("Aditi")); + ensure_equals("label for aditi", + LLGridManager::getInstance()->getGridLabel("util.aditi.lindenlab.com"), + std::string("Second Life Beta Test Grid (Aditi)")); + + LLGridManager::getInstance()->getLoginURIs(std::string("util.aditi.lindenlab.com"), login_uris); + + ensure_equals("Number of login uris for aditi", 1, login_uris.size()); + ensure_equals("Aditi login uri", + login_uris[0], + std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi")); + ensure_equals("Aditi helper uri", + LLGridManager::getInstance()->getHelperURI("util.aditi.lindenlab.com"), + std::string("https://secondlife.aditi.lindenlab.com/helpers/")); + ensure_equals("Aditi login page", + LLGridManager::getInstance()->getLoginPage("util.aditi.lindenlab.com"), + std::string("https://viewer-splash.secondlife.com/")); + ensure("Aditi is a system grid", + LLGridManager::getInstance()->isSystemGrid("util.aditi.lindenlab.com")); + } + + // initialization with a grid file + template<> template<> + void viewerNetworkTestObject::test<2>() + { + llofstream gridfile(TEST_FILENAME); + gridfile << gSampleGridFile; + gridfile.close(); + + LLGridManager::getInstance()->initialize(TEST_FILENAME); + std::map known_grids = LLGridManager::getInstance()->getKnownGrids(); + ensure_equals("adding a grid via a grid file increases known grid size",4, + known_grids.size()); + + // Verify that Agni and Aditi were not overwritten + ensure_equals("Agni has the right name and label", + known_grids[std::string("util.agni.lindenlab.com")], + std::string("Second Life Main Grid (Agni)")); + ensure_equals("Aditi has the right name and label", + known_grids[std::string("util.aditi.lindenlab.com")], + std::string("Second Life Beta Test Grid (Aditi)")); + ensure_equals("name for agni", + LLGridManager::getInstance()->getGrid("util.agni.lindenlab.com"), + std::string("util.agni.lindenlab.com")); + ensure_equals("id for agni", + LLGridManager::getInstance()->getGridId("util.agni.lindenlab.com"), + std::string("Agni")); + ensure_equals("update url base for Agni", // relies on agni being the default + std::string("https://update.secondlife.com/update"), + LLGridManager::getInstance()->getUpdateServiceURL()); + ensure_equals("label for agni", + LLGridManager::getInstance()->getGridLabel("util.agni.lindenlab.com"), + std::string("Second Life Main Grid (Agni)")); + std::vector login_uris; + LLGridManager::getInstance()->getLoginURIs(std::string("util.agni.lindenlab.com"), login_uris); + ensure_equals("Number of login uris for agni", 1, login_uris.size()); + ensure_equals("Agni login uri", + login_uris[0], + std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi")); + ensure_equals("Agni helper uri", + LLGridManager::getInstance()->getHelperURI("util.agni.lindenlab.com"), + std::string("https://secondlife.com/helpers/")); + ensure_equals("Agni login page", + LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"), + std::string("https://viewer-splash.secondlife.com/")); + ensure("Agni is a system grid", + LLGridManager::getInstance()->isSystemGrid("util.agni.lindenlab.com")); + + ensure_equals("name for aditi", + LLGridManager::getInstance()->getGrid("util.aditi.lindenlab.com"), + std::string("util.aditi.lindenlab.com")); + ensure_equals("id for aditi", + LLGridManager::getInstance()->getGridId("util.aditi.lindenlab.com"), + std::string("Aditi")); + ensure_equals("label for aditi", + LLGridManager::getInstance()->getGridLabel("util.aditi.lindenlab.com"), + std::string("Second Life Beta Test Grid (Aditi)")); + + LLGridManager::getInstance()->getLoginURIs(std::string("util.aditi.lindenlab.com"), login_uris); + ensure_equals("Number of login uris for aditi", 1, login_uris.size()); + ensure_equals("Aditi login uri", + login_uris[0], + std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi")); + ensure_equals("Aditi helper uri", + LLGridManager::getInstance()->getHelperURI("util.aditi.lindenlab.com"), + std::string("https://secondlife.aditi.lindenlab.com/helpers/")); + ensure_equals("Aditi login page", + LLGridManager::getInstance()->getLoginPage("util.aditi.lindenlab.com"), + std::string("https://viewer-splash.secondlife.com/")); + ensure("Aditi is a system grid", + LLGridManager::getInstance()->isSystemGrid("util.aditi.lindenlab.com")); + + // Check the additional grid from the file + ensure_equals("alternative grid is in name<->label map", + known_grids["altgrid.long.name"], + std::string("Alternative Grid")); + ensure_equals("alternative grid name is set", + LLGridManager::getInstance()->getGrid("altgrid.long.name"), + std::string("altgrid.long.name")); + ensure_equals("alternative grid id", + LLGridManager::getInstance()->getGridId("altgrid.long.name"), + std::string("AltGrid")); + ensure_equals("alternative grid label", + LLGridManager::getInstance()->getGridLabel("altgrid.long.name"), + std::string("Alternative Grid")); + std::vector alt_login_uris; + LLGridManager::getInstance()->getLoginURIs(std::string("altgrid.long.name"), alt_login_uris); + ensure_equals("Number of login uris for altgrid", 2, alt_login_uris.size()); + ensure_equals("alternative grid first login uri", + alt_login_uris[0], + std::string("altgrid/myloginuri1")); + ensure_equals("alternative grid second login uri", + alt_login_uris[1], + std::string("altgrid/myloginuri2")); + ensure_equals("alternative grid helper uri", + LLGridManager::getInstance()->getHelperURI("altgrid.long.name"), + std::string("https://helper1/helpers/")); + ensure_equals("alternative grid login page", + LLGridManager::getInstance()->getLoginPage("altgrid.long.name"), + std::string("altgrid/loginpage")); + ensure("alternative grid is NOT a system grid", + ! LLGridManager::getInstance()->isSystemGrid("altgrid.long.name")); + + ensure_equals("minimal grid is in name<->label map", + known_grids["minimal.long.name"], + std::string("minimal.long.name")); + ensure_equals("minimal grid name is set", + LLGridManager::getInstance()->getGrid("minimal.long.name"), + std::string("minimal.long.name")); + ensure_equals("minimal grid id", + LLGridManager::getInstance()->getGridId("minimal.long.name"), + std::string("minimal.long.name")); + ensure_equals("minimal grid label", + LLGridManager::getInstance()->getGridLabel("minimal.long.name"), + std::string("minimal.long.name")); + + LLGridManager::getInstance()->getLoginURIs(std::string("minimal.long.name"), alt_login_uris); + ensure_equals("Number of login uris for altgrid", 1, alt_login_uris.size()); + ensure_equals("minimal grid login uri", + alt_login_uris[0], + std::string("https://minimal.long.name/cgi-bin/login.cgi")); + ensure_equals("minimal grid helper uri", + LLGridManager::getInstance()->getHelperURI("minimal.long.name"), + std::string("https://minimal.long.name/helpers/")); + ensure_equals("minimal grid login page", + LLGridManager::getInstance()->getLoginPage("minimal.long.name"), + std::string("http://minimal.long.name/app/login/")); + + } + + + // validate grid selection + template<> template<> + void viewerNetworkTestObject::test<7>() + { + // adding a grid with simply a name will populate the values. + llofstream gridfile(TEST_FILENAME); + gridfile << gSampleGridFile; + gridfile.close(); + + LLGridManager::getInstance()->initialize(TEST_FILENAME); + + LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com"); + ensure_equals("getGridLabel", + LLGridManager::getInstance()->getGridLabel(), + std::string("Second Life Main Grid (Agni)")); + ensure_equals("getGridId", + LLGridManager::getInstance()->getGridId(), + std::string("Agni")); + ensure_equals("getGrid", + LLGridManager::getInstance()->getGrid(), + std::string("util.agni.lindenlab.com")); + ensure_equals("getHelperURI", + LLGridManager::getInstance()->getHelperURI(), + std::string("https://secondlife.com/helpers/")); + ensure_equals("getLoginPage", + LLGridManager::getInstance()->getLoginPage(), + std::string("https://viewer-splash.secondlife.com/")); + ensure_equals("update url base for Agni", // relies on agni being the default + std::string("https://update.secondlife.com/update"), + LLGridManager::getInstance()->getUpdateServiceURL()); + ensure("Is Agni a production grid", LLGridManager::getInstance()->isInProductionGrid()); + std::vector uris; + LLGridManager::getInstance()->getLoginURIs(uris); + ensure_equals("getLoginURIs size", 1, uris.size()); + ensure_equals("getLoginURIs", + uris[0], + std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi")); + + LLGridManager::getInstance()->setGridChoice("altgrid.long.name"); + ensure_equals("getGridLabel", + LLGridManager::getInstance()->getGridLabel(), + std::string("Alternative Grid")); + ensure_equals("getGridId", + LLGridManager::getInstance()->getGridId(), + std::string("AltGrid")); + ensure("alternative grid is not a system grid", + !LLGridManager::getInstance()->isSystemGrid()); + ensure("alternative grid is not a production grid", + !LLGridManager::getInstance()->isInProductionGrid()); + } + +} diff --git a/indra/newview/tests/llworldmap_test.cpp b/indra/newview/tests/llworldmap_test.cpp index 6245198888..8564dbeeb6 100644 --- a/indra/newview/tests/llworldmap_test.cpp +++ b/indra/newview/tests/llworldmap_test.cpp @@ -1,515 +1,515 @@ -/** - * @file llworldmap_test.cpp - * @author Merov Linden - * @date 2009-03-09 - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -// Dependencies -#include "linden_common.h" -#include "llapr.h" -#include "llsingleton.h" -#include "lltrans.h" -#include "lluistring.h" -#include "../llviewertexture.h" -#include "../llworldmapmessage.h" -// Class to test -#include "../llworldmap.h" -// Tut header -#include "../test/lltut.h" - -// ------------------------------------------------------------------------------------------- -// Stubbing: Declarations required to link and run the class being tested -// Notes: -// * Add here stubbed implementation of the few classes and methods used in the class to be tested -// * Add as little as possible (let the link errors guide you) -// * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code) -// * A simulator for a class can be implemented here. Please comment and document thoroughly. - -// Stub image calls -void LLGLTexture::setBoostLevel(S32 ) { } -void LLGLTexture::setAddressMode(LLTexUnit::eTextureAddressMode ) { } -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, FTType, bool, LLGLTexture::EBoostLevel, S8, - LLGLint, LLGLenum, LLHost ) { return NULL; } - -// Stub related map calls -LLWorldMapMessage::LLWorldMapMessage() { } -LLWorldMapMessage::~LLWorldMapMessage() { } -void LLWorldMapMessage::sendItemRequest(U32 type, U64 handle) { } -void LLWorldMapMessage::sendMapBlockRequest(U16 min_x, U16 min_y, U16 max_x, U16 max_y, bool return_nonexistent) { } - -LLWorldMipmap::LLWorldMipmap() { } -LLWorldMipmap::~LLWorldMipmap() { } -void LLWorldMipmap::reset() { } -void LLWorldMipmap::dropBoostLevels() { } -void LLWorldMipmap::equalizeBoostLevels() { } -LLPointer LLWorldMipmap::getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load) { return NULL; } - -// Stub other stuff -std::string LLTrans::getString(const std::string &, const LLStringUtil::format_map_t&, bool def_string) { return std::string("test_trans"); } -void LLUIString::updateResult() const { } -void LLUIString::setArg(const std::string& , const std::string& ) { } -void LLUIString::assign(const std::string& ) { } - -// End Stubbing -// ------------------------------------------------------------------------------------------- - -// ------------------------------------------------------------------------------------------- -// TUT -// ------------------------------------------------------------------------------------------- - -const F32 X_WORLD_TEST = 1000.0f * REGION_WIDTH_METERS; -const F32 Y_WORLD_TEST = 2000.0f * REGION_WIDTH_METERS; -const F32 Z_WORLD_TEST = 240.0f; -const std::string ITEM_NAME_TEST = "Item Foo"; -const std::string TOOLTIP_TEST = "Tooltip Foo"; - -const std::string SIM_NAME_TEST = "Sim Foo"; - -namespace tut -{ - // Test wrapper declarations - struct iteminfo_test - { - // Instance to be tested - LLItemInfo* mItem; - - // Constructor and destructor of the test wrapper - iteminfo_test() - { - LLUUID id; - mItem = new LLItemInfo(X_WORLD_TEST, Y_WORLD_TEST, ITEM_NAME_TEST, id); - } - ~iteminfo_test() - { - delete mItem; - } - }; - - struct siminfo_test - { - // Instance to be tested - LLSimInfo* mSim; - - // Constructor and destructor of the test wrapper - siminfo_test() - { - U64 handle = to_region_handle_global(X_WORLD_TEST, Y_WORLD_TEST); - mSim = new LLSimInfo(handle); - } - ~siminfo_test() - { - delete mSim; - } - }; - - struct worldmap_test - { - // Instance to be tested - LLWorldMap* mWorld; - - // Constructor and destructor of the test wrapper - worldmap_test() - { - mWorld = LLWorldMap::getInstance(); - } - ~worldmap_test() - { - mWorld = NULL; - } - }; - - // Tut templating thingamagic: test group, object and test instance - typedef test_group iteminfo_t; - typedef iteminfo_t::object iteminfo_object_t; - tut::iteminfo_t tut_iteminfo("LLItemInfo"); - - typedef test_group siminfo_t; - typedef siminfo_t::object siminfo_object_t; - tut::siminfo_t tut_siminfo("LLSimInfo"); - - typedef test_group worldmap_t; - typedef worldmap_t::object worldmap_object_t; - tut::worldmap_t tut_worldmap("LLWorldMap"); - - // --------------------------------------------------------------------------------------- - // Test functions - // Notes: - // * Test as many as you possibly can without requiring a full blown simulation of everything - // * The tests are executed in sequence so the test instance state may change between calls - // * Remember that you cannot test private methods with tut - // --------------------------------------------------------------------------------------- - - // --------------------------------------------------------------------------------------- - // Test the LLItemInfo interface - // --------------------------------------------------------------------------------------- - template<> template<> - void iteminfo_object_t::test<1>() - { - // Test 1 : setCount() / getCount() - mItem->setCount(10); - ensure("LLItemInfo::setCount() test failed", mItem->getCount() == 10); - // Test 2 : setTooltip() / getToolTip() - std::string tooltip = TOOLTIP_TEST; - mItem->setTooltip(tooltip); - ensure("LLItemInfo::setTooltip() test failed", mItem->getToolTip() == TOOLTIP_TEST); - // Test 3 : setElevation() / getGlobalPosition() - mItem->setElevation(Z_WORLD_TEST); - LLVector3d pos = mItem->getGlobalPosition(); - LLVector3d ref(X_WORLD_TEST, Y_WORLD_TEST, Z_WORLD_TEST); - ensure("LLItemInfo::getGlobalPosition() test failed", pos == ref); - // Test 4 : getName() - std::string name = mItem->getName(); - ensure("LLItemInfo::getName() test failed", name == ITEM_NAME_TEST); - // Test 5 : isName() - ensure("LLItemInfo::isName() test failed", mItem->isName(name)); - // Test 6 : getUUID() - LLUUID id; - ensure("LLItemInfo::getUUID() test failed", mItem->getUUID() == id); - // Test 7 : getRegionHandle() - U64 handle = to_region_handle_global(X_WORLD_TEST, Y_WORLD_TEST); - ensure("LLItemInfo::getRegionHandle() test failed", mItem->getRegionHandle() == handle); - } - // --------------------------------------------------------------------------------------- - // Test the LLSimInfo interface - // --------------------------------------------------------------------------------------- - // Test Setters and Accessors methods - template<> template<> - void siminfo_object_t::test<1>() - { - // Test 1 : setName() / getName() - std::string name = SIM_NAME_TEST; - mSim->setName(name); - ensure("LLSimInfo::setName() test failed", mSim->getName() == SIM_NAME_TEST); - // Test 2 : isName() - ensure("LLSimInfo::isName() test failed", mSim->isName(name)); - // Test 3 : getGlobalPos() - LLVector3 local; - LLVector3d ref(X_WORLD_TEST, Y_WORLD_TEST, 0.0f); - LLVector3d pos = mSim->getGlobalPos(local); - ensure("LLSimInfo::getGlobalPos() test failed", pos == ref); - // Test 4 : getGlobalOrigin() - pos = mSim->getGlobalOrigin(); - ensure("LLSimInfo::getGlobalOrigin() test failed", pos == ref); - // Test 5 : clearImage() - try { - mSim->clearImage(); - } catch (...) { - fail("LLSimInfo::clearImage() test failed"); - } - // Test 6 : dropImagePriority() - try { - mSim->dropImagePriority(); - } catch (...) { - fail("LLSimInfo::dropImagePriority() test failed"); - } - // Test 7 : updateAgentCount() - try { - mSim->updateAgentCount(0.0f); - } catch (...) { - fail("LLSimInfo::updateAgentCount() test failed"); - } - // Test 8 : getAgentCount() - S32 agents = mSim->getAgentCount(); - ensure("LLSimInfo::getAgentCount() test failed", agents == 0); - // Test 9 : setLandForSaleImage() / getLandForSaleImage() - LLUUID id; - mSim->setLandForSaleImage(id); - LLPointer image = mSim->getLandForSaleImage(); - ensure("LLSimInfo::getLandForSaleImage() test failed", image.isNull()); - // Test 10 : isPG() - mSim->setAccess(SIM_ACCESS_PG); - ensure("LLSimInfo::isPG() test failed", mSim->isPG()); - // Test 11 : isDown() - mSim->setAccess(SIM_ACCESS_DOWN); - ensure("LLSimInfo::isDown() test failed", mSim->isDown()); - // Test 12 : Access strings can't be accessed from unit test... - //ensure("LLSimInfo::getAccessString() test failed", mSim->getAccessString() == "Offline"); - // Test 13 : Region strings can't be accessed from unit test... - //mSim->setRegionFlags(REGION_FLAGS_SANDBOX); - //ensure("LLSimInfo::setRegionFlags() test failed", mSim->getFlagsString() == "Sandbox"); - } - // Test management of LLInfoItem lists - template<> template<> - void siminfo_object_t::test<2>() - { - // Test 14 : clearItems() - try { - mSim->clearItems(); - } catch (...) { - fail("LLSimInfo::clearItems() at init test failed"); - } - - // Test 15 : Verify that all the lists are empty - LLSimInfo::item_info_list_t list; - list = mSim->getTeleHub(); - ensure("LLSimInfo::getTeleHub() empty at init test failed", list.empty()); - list = mSim->getInfoHub(); - ensure("LLSimInfo::getInfoHub() empty at init test failed", list.empty()); - list = mSim->getPGEvent(); - ensure("LLSimInfo::getPGEvent() empty at init test failed", list.empty()); - list = mSim->getMatureEvent(); - ensure("LLSimInfo::getMatureEvent() empty at init test failed", list.empty()); - list = mSim->getLandForSale(); - ensure("LLSimInfo::getLandForSale() empty at init test failed", list.empty()); - list = mSim->getAgentLocation(); - ensure("LLSimInfo::getAgentLocation() empty at init test failed", list.empty()); - - // Create an item to be inserted - LLUUID id; - LLItemInfo item(X_WORLD_TEST, Y_WORLD_TEST, ITEM_NAME_TEST, id); - - // Insert the item in each list - mSim->insertTeleHub(item); - mSim->insertInfoHub(item); - mSim->insertPGEvent(item); - mSim->insertMatureEvent(item); - mSim->insertLandForSale(item); - mSim->insertAgentLocation(item); - - // Test 16 : Verify that the lists contain 1 item each - list = mSim->getTeleHub(); - ensure("LLSimInfo::insertTeleHub() test failed", list.size() == 1); - list = mSim->getInfoHub(); - ensure("LLSimInfo::insertInfoHub() test failed", list.size() == 1); - list = mSim->getPGEvent(); - ensure("LLSimInfo::insertPGEvent() test failed", list.size() == 1); - list = mSim->getMatureEvent(); - ensure("LLSimInfo::insertMatureEvent() test failed", list.size() == 1); - list = mSim->getLandForSale(); - ensure("LLSimInfo::insertLandForSale() test failed", list.size() == 1); - list = mSim->getAgentLocation(); - ensure("LLSimInfo::insertAgentLocation() test failed", list.size() == 1); - - // Test 17 : clearItems() - try { - mSim->clearItems(); - } catch (...) { - fail("LLSimInfo::clearItems() at end test failed"); - } - - // Test 18 : Verify that all the lists are empty again... *except* agent which is persisted!! (on purpose) - list = mSim->getTeleHub(); - ensure("LLSimInfo::getTeleHub() empty after clear test failed", list.empty()); - list = mSim->getInfoHub(); - ensure("LLSimInfo::getInfoHub() empty after clear test failed", list.empty()); - list = mSim->getPGEvent(); - ensure("LLSimInfo::getPGEvent() empty after clear test failed", list.empty()); - list = mSim->getMatureEvent(); - ensure("LLSimInfo::getMatureEvent() empty after clear test failed", list.empty()); - list = mSim->getLandForSale(); - ensure("LLSimInfo::getLandForSale() empty after clear test failed", list.empty()); - list = mSim->getAgentLocation(); - ensure("LLSimInfo::getAgentLocation() empty after clear test failed", list.size() == 1); - } - - // --------------------------------------------------------------------------------------- - // Test the LLWorldMap interface - // --------------------------------------------------------------------------------------- - // Test Setters and Accessors methods - template<> template<> - void worldmap_object_t::test<1>() - { - // Test 1 : reset() - try { - mWorld->reset(); - } catch (...) { - fail("LLWorldMap::reset() at init test failed"); - } - // Test 2 : clearImageRefs() - try { - mWorld->clearImageRefs(); - } catch (...) { - fail("LLWorldMap::clearImageRefs() test failed"); - } - // Test 3 : dropImagePriorities() - try { - mWorld->dropImagePriorities(); - } catch (...) { - fail("LLWorldMap::dropImagePriorities() test failed"); - } - // Test 4 : reloadItems() - try { - mWorld->reloadItems(true); - } catch (...) { - fail("LLWorldMap::reloadItems() test failed"); - } - // Test 5 : updateRegions() - try { - mWorld->updateRegions(1000, 1000, 1004, 1004); - } catch (...) { - fail("LLWorldMap::updateRegions() test failed"); - } - // Test 6 : equalizeBoostLevels() - try { - mWorld->equalizeBoostLevels(); - } catch (...) { - fail("LLWorldMap::equalizeBoostLevels() test failed"); - } - // Test 7 : getObjectsTile() - try { - LLPointer image = mWorld->getObjectsTile((U32)(X_WORLD_TEST/REGION_WIDTH_METERS), (U32)(Y_WORLD_TEST/REGION_WIDTH_METERS), 1); - ensure("LLWorldMap::getObjectsTile() failed", image.isNull()); - } catch (...) { - fail("LLWorldMap::getObjectsTile() test failed with exception"); - } - } - // Test management of LLSimInfo lists - template<> template<> - void worldmap_object_t::test<2>() - { - // Test 8 : reset() - try { - mWorld->reset(); - } catch (...) { - fail("LLWorldMap::reset() at init test failed"); - } - - // Test 9 : Verify that all the region list is empty - LLWorldMap::sim_info_map_t list; - list = mWorld->getRegionMap(); - ensure("LLWorldMap::getRegionMap() empty at init test failed", list.empty()); - - // Test 10 : Insert a region - bool success; - LLUUID id; - std::string name_sim = SIM_NAME_TEST; - success = mWorld->insertRegion( U32(X_WORLD_TEST), - U32(Y_WORLD_TEST), - name_sim, - id, - SIM_ACCESS_PG, - REGION_FLAGS_SANDBOX); - list = mWorld->getRegionMap(); - ensure("LLWorldMap::insertRegion() failed", success && (list.size() == 1)); - - // Test 11 : Insert an item in the same region -> number of regions doesn't increase - std::string name_item = ITEM_NAME_TEST; - success = mWorld->insertItem( U32(X_WORLD_TEST + REGION_WIDTH_METERS/2), - U32(Y_WORLD_TEST + REGION_WIDTH_METERS/2), - name_item, - id, - MAP_ITEM_LAND_FOR_SALE, - 0, 0); - list = mWorld->getRegionMap(); - ensure("LLWorldMap::insertItem() in existing region failed", success && (list.size() == 1)); - - // Test 12 : Insert an item in another region -> number of regions increases - success = mWorld->insertItem( U32(X_WORLD_TEST + REGION_WIDTH_METERS*2), - U32(Y_WORLD_TEST + REGION_WIDTH_METERS*2), - name_item, - id, - MAP_ITEM_LAND_FOR_SALE, - 0, 0); - list = mWorld->getRegionMap(); - ensure("LLWorldMap::insertItem() in unexisting region failed", success && (list.size() == 2)); - - // Test 13 : simInfoFromPosGlobal() in region - LLVector3d pos1( X_WORLD_TEST + REGION_WIDTH_METERS*2 + REGION_WIDTH_METERS/2, - Y_WORLD_TEST + REGION_WIDTH_METERS*2 + REGION_WIDTH_METERS/2, - 0.0f); - LLSimInfo* sim; - sim = mWorld->simInfoFromPosGlobal(pos1); - ensure("LLWorldMap::simInfoFromPosGlobal() test on existing region failed", sim != NULL); - - // Test 14 : simInfoFromPosGlobal() outside region - LLVector3d pos2( X_WORLD_TEST + REGION_WIDTH_METERS*4 + REGION_WIDTH_METERS/2, - Y_WORLD_TEST + REGION_WIDTH_METERS*4 + REGION_WIDTH_METERS/2, - 0.0f); - sim = mWorld->simInfoFromPosGlobal(pos2); - ensure("LLWorldMap::simInfoFromPosGlobal() test outside region failed", sim == NULL); - - // Test 15 : simInfoFromName() - sim = mWorld->simInfoFromName(name_sim); - ensure("LLWorldMap::simInfoFromName() test on existing region failed", sim != NULL); - - // Test 16 : simInfoFromHandle() - U64 handle = to_region_handle_global(X_WORLD_TEST, Y_WORLD_TEST); - sim = mWorld->simInfoFromHandle(handle); - ensure("LLWorldMap::simInfoFromHandle() test on existing region failed", sim != NULL); - - // Test 17 : simNameFromPosGlobal() - LLVector3d pos3( X_WORLD_TEST + REGION_WIDTH_METERS/2, - Y_WORLD_TEST + REGION_WIDTH_METERS/2, - 0.0f); - success = mWorld->simNameFromPosGlobal(pos3, name_sim); - ensure("LLWorldMap::simNameFromPosGlobal() test on existing region failed", success && (name_sim == SIM_NAME_TEST)); - - // Test 18 : reset() - try { - mWorld->reset(); - } catch (...) { - fail("LLWorldMap::reset() at end test failed"); - } - - // Test 19 : Verify that all the region list is empty - list = mWorld->getRegionMap(); - ensure("LLWorldMap::getRegionMap() empty at end test failed", list.empty()); - } - // Test tracking - template<> template<> - void worldmap_object_t::test<3>() - { - // Point to track - LLVector3d pos( X_WORLD_TEST + REGION_WIDTH_METERS/2, Y_WORLD_TEST + REGION_WIDTH_METERS/2, Z_WORLD_TEST); - - // Test 20 : no tracking - mWorld->cancelTracking(); - ensure("LLWorldMap::cancelTracking() at begin test failed", mWorld->isTracking() == false); - - // Test 21 : set tracking - mWorld->setTracking(pos); - ensure("LLWorldMap::setTracking() failed", mWorld->isTracking() && !mWorld->isTrackingValidLocation()); - - // Test 22 : set click and commit flags - mWorld->setTrackingDoubleClick(); - ensure("LLWorldMap::setTrackingDoubleClick() failed", mWorld->isTrackingDoubleClick()); - mWorld->setTrackingCommit(); - ensure("LLWorldMap::setTrackingCommit() failed", mWorld->isTrackingCommit()); - - // Test 23 : in rectangle test - bool inRect = mWorld->isTrackingInRectangle( X_WORLD_TEST, Y_WORLD_TEST, - X_WORLD_TEST + REGION_WIDTH_METERS, - Y_WORLD_TEST + REGION_WIDTH_METERS); - ensure("LLWorldMap::isTrackingInRectangle() in rectangle failed", inRect); - inRect = mWorld->isTrackingInRectangle( X_WORLD_TEST + REGION_WIDTH_METERS, - Y_WORLD_TEST + REGION_WIDTH_METERS, - X_WORLD_TEST + 2 * REGION_WIDTH_METERS, - Y_WORLD_TEST + 2 * REGION_WIDTH_METERS); - ensure("LLWorldMap::isTrackingInRectangle() outside rectangle failed", !inRect); - - // Test 24 : set tracking to valid and invalid - mWorld->setTrackingValid(); - ensure("LLWorldMap::setTrackingValid() failed", mWorld->isTrackingValidLocation() && !mWorld->isTrackingInvalidLocation()); - mWorld->setTrackingInvalid(); - ensure("LLWorldMap::setTrackingInvalid() failed", !mWorld->isTrackingValidLocation() && mWorld->isTrackingInvalidLocation()); - - // Test 25 : getTrackedPositionGlobal() - LLVector3d res = mWorld->getTrackedPositionGlobal(); - ensure("LLWorldMap::getTrackedPositionGlobal() failed", res == pos); - - // Test 26 : reset tracking - mWorld->cancelTracking(); - ensure("LLWorldMap::cancelTracking() at end test failed", mWorld->isTracking() == false); - } -} +/** + * @file llworldmap_test.cpp + * @author Merov Linden + * @date 2009-03-09 + * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +// Dependencies +#include "linden_common.h" +#include "llapr.h" +#include "llsingleton.h" +#include "lltrans.h" +#include "lluistring.h" +#include "../llviewertexture.h" +#include "../llworldmapmessage.h" +// Class to test +#include "../llworldmap.h" +// Tut header +#include "../test/lltut.h" + +// ------------------------------------------------------------------------------------------- +// Stubbing: Declarations required to link and run the class being tested +// Notes: +// * Add here stubbed implementation of the few classes and methods used in the class to be tested +// * Add as little as possible (let the link errors guide you) +// * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code) +// * A simulator for a class can be implemented here. Please comment and document thoroughly. + +// Stub image calls +void LLGLTexture::setBoostLevel(S32 ) { } +void LLGLTexture::setAddressMode(LLTexUnit::eTextureAddressMode ) { } +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, FTType, bool, LLGLTexture::EBoostLevel, S8, + LLGLint, LLGLenum, LLHost ) { return NULL; } + +// Stub related map calls +LLWorldMapMessage::LLWorldMapMessage() { } +LLWorldMapMessage::~LLWorldMapMessage() { } +void LLWorldMapMessage::sendItemRequest(U32 type, U64 handle) { } +void LLWorldMapMessage::sendMapBlockRequest(U16 min_x, U16 min_y, U16 max_x, U16 max_y, bool return_nonexistent) { } + +LLWorldMipmap::LLWorldMipmap() { } +LLWorldMipmap::~LLWorldMipmap() { } +void LLWorldMipmap::reset() { } +void LLWorldMipmap::dropBoostLevels() { } +void LLWorldMipmap::equalizeBoostLevels() { } +LLPointer LLWorldMipmap::getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load) { return NULL; } + +// Stub other stuff +std::string LLTrans::getString(const std::string &, const LLStringUtil::format_map_t&, bool def_string) { return std::string("test_trans"); } +void LLUIString::updateResult() const { } +void LLUIString::setArg(const std::string& , const std::string& ) { } +void LLUIString::assign(const std::string& ) { } + +// End Stubbing +// ------------------------------------------------------------------------------------------- + +// ------------------------------------------------------------------------------------------- +// TUT +// ------------------------------------------------------------------------------------------- + +const F32 X_WORLD_TEST = 1000.0f * REGION_WIDTH_METERS; +const F32 Y_WORLD_TEST = 2000.0f * REGION_WIDTH_METERS; +const F32 Z_WORLD_TEST = 240.0f; +const std::string ITEM_NAME_TEST = "Item Foo"; +const std::string TOOLTIP_TEST = "Tooltip Foo"; + +const std::string SIM_NAME_TEST = "Sim Foo"; + +namespace tut +{ + // Test wrapper declarations + struct iteminfo_test + { + // Instance to be tested + LLItemInfo* mItem; + + // Constructor and destructor of the test wrapper + iteminfo_test() + { + LLUUID id; + mItem = new LLItemInfo(X_WORLD_TEST, Y_WORLD_TEST, ITEM_NAME_TEST, id); + } + ~iteminfo_test() + { + delete mItem; + } + }; + + struct siminfo_test + { + // Instance to be tested + LLSimInfo* mSim; + + // Constructor and destructor of the test wrapper + siminfo_test() + { + U64 handle = to_region_handle_global(X_WORLD_TEST, Y_WORLD_TEST); + mSim = new LLSimInfo(handle); + } + ~siminfo_test() + { + delete mSim; + } + }; + + struct worldmap_test + { + // Instance to be tested + LLWorldMap* mWorld; + + // Constructor and destructor of the test wrapper + worldmap_test() + { + mWorld = LLWorldMap::getInstance(); + } + ~worldmap_test() + { + mWorld = NULL; + } + }; + + // Tut templating thingamagic: test group, object and test instance + typedef test_group iteminfo_t; + typedef iteminfo_t::object iteminfo_object_t; + tut::iteminfo_t tut_iteminfo("LLItemInfo"); + + typedef test_group siminfo_t; + typedef siminfo_t::object siminfo_object_t; + tut::siminfo_t tut_siminfo("LLSimInfo"); + + typedef test_group worldmap_t; + typedef worldmap_t::object worldmap_object_t; + tut::worldmap_t tut_worldmap("LLWorldMap"); + + // --------------------------------------------------------------------------------------- + // Test functions + // Notes: + // * Test as many as you possibly can without requiring a full blown simulation of everything + // * The tests are executed in sequence so the test instance state may change between calls + // * Remember that you cannot test private methods with tut + // --------------------------------------------------------------------------------------- + + // --------------------------------------------------------------------------------------- + // Test the LLItemInfo interface + // --------------------------------------------------------------------------------------- + template<> template<> + void iteminfo_object_t::test<1>() + { + // Test 1 : setCount() / getCount() + mItem->setCount(10); + ensure("LLItemInfo::setCount() test failed", mItem->getCount() == 10); + // Test 2 : setTooltip() / getToolTip() + std::string tooltip = TOOLTIP_TEST; + mItem->setTooltip(tooltip); + ensure("LLItemInfo::setTooltip() test failed", mItem->getToolTip() == TOOLTIP_TEST); + // Test 3 : setElevation() / getGlobalPosition() + mItem->setElevation(Z_WORLD_TEST); + LLVector3d pos = mItem->getGlobalPosition(); + LLVector3d ref(X_WORLD_TEST, Y_WORLD_TEST, Z_WORLD_TEST); + ensure("LLItemInfo::getGlobalPosition() test failed", pos == ref); + // Test 4 : getName() + std::string name = mItem->getName(); + ensure("LLItemInfo::getName() test failed", name == ITEM_NAME_TEST); + // Test 5 : isName() + ensure("LLItemInfo::isName() test failed", mItem->isName(name)); + // Test 6 : getUUID() + LLUUID id; + ensure("LLItemInfo::getUUID() test failed", mItem->getUUID() == id); + // Test 7 : getRegionHandle() + U64 handle = to_region_handle_global(X_WORLD_TEST, Y_WORLD_TEST); + ensure("LLItemInfo::getRegionHandle() test failed", mItem->getRegionHandle() == handle); + } + // --------------------------------------------------------------------------------------- + // Test the LLSimInfo interface + // --------------------------------------------------------------------------------------- + // Test Setters and Accessors methods + template<> template<> + void siminfo_object_t::test<1>() + { + // Test 1 : setName() / getName() + std::string name = SIM_NAME_TEST; + mSim->setName(name); + ensure("LLSimInfo::setName() test failed", mSim->getName() == SIM_NAME_TEST); + // Test 2 : isName() + ensure("LLSimInfo::isName() test failed", mSim->isName(name)); + // Test 3 : getGlobalPos() + LLVector3 local; + LLVector3d ref(X_WORLD_TEST, Y_WORLD_TEST, 0.0f); + LLVector3d pos = mSim->getGlobalPos(local); + ensure("LLSimInfo::getGlobalPos() test failed", pos == ref); + // Test 4 : getGlobalOrigin() + pos = mSim->getGlobalOrigin(); + ensure("LLSimInfo::getGlobalOrigin() test failed", pos == ref); + // Test 5 : clearImage() + try { + mSim->clearImage(); + } catch (...) { + fail("LLSimInfo::clearImage() test failed"); + } + // Test 6 : dropImagePriority() + try { + mSim->dropImagePriority(); + } catch (...) { + fail("LLSimInfo::dropImagePriority() test failed"); + } + // Test 7 : updateAgentCount() + try { + mSim->updateAgentCount(0.0f); + } catch (...) { + fail("LLSimInfo::updateAgentCount() test failed"); + } + // Test 8 : getAgentCount() + S32 agents = mSim->getAgentCount(); + ensure("LLSimInfo::getAgentCount() test failed", agents == 0); + // Test 9 : setLandForSaleImage() / getLandForSaleImage() + LLUUID id; + mSim->setLandForSaleImage(id); + LLPointer image = mSim->getLandForSaleImage(); + ensure("LLSimInfo::getLandForSaleImage() test failed", image.isNull()); + // Test 10 : isPG() + mSim->setAccess(SIM_ACCESS_PG); + ensure("LLSimInfo::isPG() test failed", mSim->isPG()); + // Test 11 : isDown() + mSim->setAccess(SIM_ACCESS_DOWN); + ensure("LLSimInfo::isDown() test failed", mSim->isDown()); + // Test 12 : Access strings can't be accessed from unit test... + //ensure("LLSimInfo::getAccessString() test failed", mSim->getAccessString() == "Offline"); + // Test 13 : Region strings can't be accessed from unit test... + //mSim->setRegionFlags(REGION_FLAGS_SANDBOX); + //ensure("LLSimInfo::setRegionFlags() test failed", mSim->getFlagsString() == "Sandbox"); + } + // Test management of LLInfoItem lists + template<> template<> + void siminfo_object_t::test<2>() + { + // Test 14 : clearItems() + try { + mSim->clearItems(); + } catch (...) { + fail("LLSimInfo::clearItems() at init test failed"); + } + + // Test 15 : Verify that all the lists are empty + LLSimInfo::item_info_list_t list; + list = mSim->getTeleHub(); + ensure("LLSimInfo::getTeleHub() empty at init test failed", list.empty()); + list = mSim->getInfoHub(); + ensure("LLSimInfo::getInfoHub() empty at init test failed", list.empty()); + list = mSim->getPGEvent(); + ensure("LLSimInfo::getPGEvent() empty at init test failed", list.empty()); + list = mSim->getMatureEvent(); + ensure("LLSimInfo::getMatureEvent() empty at init test failed", list.empty()); + list = mSim->getLandForSale(); + ensure("LLSimInfo::getLandForSale() empty at init test failed", list.empty()); + list = mSim->getAgentLocation(); + ensure("LLSimInfo::getAgentLocation() empty at init test failed", list.empty()); + + // Create an item to be inserted + LLUUID id; + LLItemInfo item(X_WORLD_TEST, Y_WORLD_TEST, ITEM_NAME_TEST, id); + + // Insert the item in each list + mSim->insertTeleHub(item); + mSim->insertInfoHub(item); + mSim->insertPGEvent(item); + mSim->insertMatureEvent(item); + mSim->insertLandForSale(item); + mSim->insertAgentLocation(item); + + // Test 16 : Verify that the lists contain 1 item each + list = mSim->getTeleHub(); + ensure("LLSimInfo::insertTeleHub() test failed", list.size() == 1); + list = mSim->getInfoHub(); + ensure("LLSimInfo::insertInfoHub() test failed", list.size() == 1); + list = mSim->getPGEvent(); + ensure("LLSimInfo::insertPGEvent() test failed", list.size() == 1); + list = mSim->getMatureEvent(); + ensure("LLSimInfo::insertMatureEvent() test failed", list.size() == 1); + list = mSim->getLandForSale(); + ensure("LLSimInfo::insertLandForSale() test failed", list.size() == 1); + list = mSim->getAgentLocation(); + ensure("LLSimInfo::insertAgentLocation() test failed", list.size() == 1); + + // Test 17 : clearItems() + try { + mSim->clearItems(); + } catch (...) { + fail("LLSimInfo::clearItems() at end test failed"); + } + + // Test 18 : Verify that all the lists are empty again... *except* agent which is persisted!! (on purpose) + list = mSim->getTeleHub(); + ensure("LLSimInfo::getTeleHub() empty after clear test failed", list.empty()); + list = mSim->getInfoHub(); + ensure("LLSimInfo::getInfoHub() empty after clear test failed", list.empty()); + list = mSim->getPGEvent(); + ensure("LLSimInfo::getPGEvent() empty after clear test failed", list.empty()); + list = mSim->getMatureEvent(); + ensure("LLSimInfo::getMatureEvent() empty after clear test failed", list.empty()); + list = mSim->getLandForSale(); + ensure("LLSimInfo::getLandForSale() empty after clear test failed", list.empty()); + list = mSim->getAgentLocation(); + ensure("LLSimInfo::getAgentLocation() empty after clear test failed", list.size() == 1); + } + + // --------------------------------------------------------------------------------------- + // Test the LLWorldMap interface + // --------------------------------------------------------------------------------------- + // Test Setters and Accessors methods + template<> template<> + void worldmap_object_t::test<1>() + { + // Test 1 : reset() + try { + mWorld->reset(); + } catch (...) { + fail("LLWorldMap::reset() at init test failed"); + } + // Test 2 : clearImageRefs() + try { + mWorld->clearImageRefs(); + } catch (...) { + fail("LLWorldMap::clearImageRefs() test failed"); + } + // Test 3 : dropImagePriorities() + try { + mWorld->dropImagePriorities(); + } catch (...) { + fail("LLWorldMap::dropImagePriorities() test failed"); + } + // Test 4 : reloadItems() + try { + mWorld->reloadItems(true); + } catch (...) { + fail("LLWorldMap::reloadItems() test failed"); + } + // Test 5 : updateRegions() + try { + mWorld->updateRegions(1000, 1000, 1004, 1004); + } catch (...) { + fail("LLWorldMap::updateRegions() test failed"); + } + // Test 6 : equalizeBoostLevels() + try { + mWorld->equalizeBoostLevels(); + } catch (...) { + fail("LLWorldMap::equalizeBoostLevels() test failed"); + } + // Test 7 : getObjectsTile() + try { + LLPointer image = mWorld->getObjectsTile((U32)(X_WORLD_TEST/REGION_WIDTH_METERS), (U32)(Y_WORLD_TEST/REGION_WIDTH_METERS), 1); + ensure("LLWorldMap::getObjectsTile() failed", image.isNull()); + } catch (...) { + fail("LLWorldMap::getObjectsTile() test failed with exception"); + } + } + // Test management of LLSimInfo lists + template<> template<> + void worldmap_object_t::test<2>() + { + // Test 8 : reset() + try { + mWorld->reset(); + } catch (...) { + fail("LLWorldMap::reset() at init test failed"); + } + + // Test 9 : Verify that all the region list is empty + LLWorldMap::sim_info_map_t list; + list = mWorld->getRegionMap(); + ensure("LLWorldMap::getRegionMap() empty at init test failed", list.empty()); + + // Test 10 : Insert a region + bool success; + LLUUID id; + std::string name_sim = SIM_NAME_TEST; + success = mWorld->insertRegion( U32(X_WORLD_TEST), + U32(Y_WORLD_TEST), + name_sim, + id, + SIM_ACCESS_PG, + REGION_FLAGS_SANDBOX); + list = mWorld->getRegionMap(); + ensure("LLWorldMap::insertRegion() failed", success && (list.size() == 1)); + + // Test 11 : Insert an item in the same region -> number of regions doesn't increase + std::string name_item = ITEM_NAME_TEST; + success = mWorld->insertItem( U32(X_WORLD_TEST + REGION_WIDTH_METERS/2), + U32(Y_WORLD_TEST + REGION_WIDTH_METERS/2), + name_item, + id, + MAP_ITEM_LAND_FOR_SALE, + 0, 0); + list = mWorld->getRegionMap(); + ensure("LLWorldMap::insertItem() in existing region failed", success && (list.size() == 1)); + + // Test 12 : Insert an item in another region -> number of regions increases + success = mWorld->insertItem( U32(X_WORLD_TEST + REGION_WIDTH_METERS*2), + U32(Y_WORLD_TEST + REGION_WIDTH_METERS*2), + name_item, + id, + MAP_ITEM_LAND_FOR_SALE, + 0, 0); + list = mWorld->getRegionMap(); + ensure("LLWorldMap::insertItem() in unexisting region failed", success && (list.size() == 2)); + + // Test 13 : simInfoFromPosGlobal() in region + LLVector3d pos1( X_WORLD_TEST + REGION_WIDTH_METERS*2 + REGION_WIDTH_METERS/2, + Y_WORLD_TEST + REGION_WIDTH_METERS*2 + REGION_WIDTH_METERS/2, + 0.0f); + LLSimInfo* sim; + sim = mWorld->simInfoFromPosGlobal(pos1); + ensure("LLWorldMap::simInfoFromPosGlobal() test on existing region failed", sim != NULL); + + // Test 14 : simInfoFromPosGlobal() outside region + LLVector3d pos2( X_WORLD_TEST + REGION_WIDTH_METERS*4 + REGION_WIDTH_METERS/2, + Y_WORLD_TEST + REGION_WIDTH_METERS*4 + REGION_WIDTH_METERS/2, + 0.0f); + sim = mWorld->simInfoFromPosGlobal(pos2); + ensure("LLWorldMap::simInfoFromPosGlobal() test outside region failed", sim == NULL); + + // Test 15 : simInfoFromName() + sim = mWorld->simInfoFromName(name_sim); + ensure("LLWorldMap::simInfoFromName() test on existing region failed", sim != NULL); + + // Test 16 : simInfoFromHandle() + U64 handle = to_region_handle_global(X_WORLD_TEST, Y_WORLD_TEST); + sim = mWorld->simInfoFromHandle(handle); + ensure("LLWorldMap::simInfoFromHandle() test on existing region failed", sim != NULL); + + // Test 17 : simNameFromPosGlobal() + LLVector3d pos3( X_WORLD_TEST + REGION_WIDTH_METERS/2, + Y_WORLD_TEST + REGION_WIDTH_METERS/2, + 0.0f); + success = mWorld->simNameFromPosGlobal(pos3, name_sim); + ensure("LLWorldMap::simNameFromPosGlobal() test on existing region failed", success && (name_sim == SIM_NAME_TEST)); + + // Test 18 : reset() + try { + mWorld->reset(); + } catch (...) { + fail("LLWorldMap::reset() at end test failed"); + } + + // Test 19 : Verify that all the region list is empty + list = mWorld->getRegionMap(); + ensure("LLWorldMap::getRegionMap() empty at end test failed", list.empty()); + } + // Test tracking + template<> template<> + void worldmap_object_t::test<3>() + { + // Point to track + LLVector3d pos( X_WORLD_TEST + REGION_WIDTH_METERS/2, Y_WORLD_TEST + REGION_WIDTH_METERS/2, Z_WORLD_TEST); + + // Test 20 : no tracking + mWorld->cancelTracking(); + ensure("LLWorldMap::cancelTracking() at begin test failed", mWorld->isTracking() == false); + + // Test 21 : set tracking + mWorld->setTracking(pos); + ensure("LLWorldMap::setTracking() failed", mWorld->isTracking() && !mWorld->isTrackingValidLocation()); + + // Test 22 : set click and commit flags + mWorld->setTrackingDoubleClick(); + ensure("LLWorldMap::setTrackingDoubleClick() failed", mWorld->isTrackingDoubleClick()); + mWorld->setTrackingCommit(); + ensure("LLWorldMap::setTrackingCommit() failed", mWorld->isTrackingCommit()); + + // Test 23 : in rectangle test + bool inRect = mWorld->isTrackingInRectangle( X_WORLD_TEST, Y_WORLD_TEST, + X_WORLD_TEST + REGION_WIDTH_METERS, + Y_WORLD_TEST + REGION_WIDTH_METERS); + ensure("LLWorldMap::isTrackingInRectangle() in rectangle failed", inRect); + inRect = mWorld->isTrackingInRectangle( X_WORLD_TEST + REGION_WIDTH_METERS, + Y_WORLD_TEST + REGION_WIDTH_METERS, + X_WORLD_TEST + 2 * REGION_WIDTH_METERS, + Y_WORLD_TEST + 2 * REGION_WIDTH_METERS); + ensure("LLWorldMap::isTrackingInRectangle() outside rectangle failed", !inRect); + + // Test 24 : set tracking to valid and invalid + mWorld->setTrackingValid(); + ensure("LLWorldMap::setTrackingValid() failed", mWorld->isTrackingValidLocation() && !mWorld->isTrackingInvalidLocation()); + mWorld->setTrackingInvalid(); + ensure("LLWorldMap::setTrackingInvalid() failed", !mWorld->isTrackingValidLocation() && mWorld->isTrackingInvalidLocation()); + + // Test 25 : getTrackedPositionGlobal() + LLVector3d res = mWorld->getTrackedPositionGlobal(); + ensure("LLWorldMap::getTrackedPositionGlobal() failed", res == pos); + + // Test 26 : reset tracking + mWorld->cancelTracking(); + ensure("LLWorldMap::cancelTracking() at end test failed", mWorld->isTracking() == false); + } +} diff --git a/indra/newview/tests/llworldmipmap_test.cpp b/indra/newview/tests/llworldmipmap_test.cpp index 7e1b432e1b..0a5de18e0f 100644 --- a/indra/newview/tests/llworldmipmap_test.cpp +++ b/indra/newview/tests/llworldmipmap_test.cpp @@ -1,165 +1,165 @@ -/** - * @file llworldmipmap_test.cpp - * @author Merov Linden - * @date 2009-02-03 - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -// Dependencies -#include "linden_common.h" -#include "../llviewertexture.h" -#include "../llviewercontrol.h" -// Class to test -#include "../llworldmipmap.h" -// Tut header -#include "../test/lltut.h" - -// ------------------------------------------------------------------------------------------- -// Stubbing: Declarations required to link and run the class being tested -// Notes: -// * Add here stubbed implementation of the few classes and methods used in the class to be tested -// * Add as little as possible (let the link errors guide you) -// * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code) -// * A simulator for a class can be implemented here. Please comment and document thoroughly. - -void LLGLTexture::setBoostLevel(S32 ) { } -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, FTType, bool, LLGLTexture::EBoostLevel, S8, - LLGLint, LLGLenum, const LLUUID& ) { return NULL; } - -LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker(name) { } -LLControlGroup::~LLControlGroup() { } -std::string LLControlGroup::getString(std::string_view) { return std::string("test_url"); } -LLControlGroup gSavedSettings("test_settings"); - -// End Stubbing -// ------------------------------------------------------------------------------------------- - -// ------------------------------------------------------------------------------------------- -// TUT -// ------------------------------------------------------------------------------------------- -namespace tut -{ - // Test wrapper declaration - struct worldmipmap_test - { - // Derived test class - class LLTestWorldMipmap : public LLWorldMipmap - { - // Put here stubbs of virtual methods we shouldn't call all the way down - }; - // Instance to be tested - LLTestWorldMipmap* mMap; - - // Constructor and destructor of the test wrapper - worldmipmap_test() - { - mMap = new LLTestWorldMipmap; - } - ~worldmipmap_test() - { - delete mMap; - } - }; - - // Tut templating thingamagic: test group, object and test instance - typedef test_group worldmipmap_t; - typedef worldmipmap_t::object worldmipmap_object_t; - tut::worldmipmap_t tut_worldmipmap("LLWorldMipmap"); - - // --------------------------------------------------------------------------------------- - // Test functions - // Notes: - // * Test as many as you possibly can without requiring a full blown simulation of everything - // * The tests are executed in sequence so the test instance state may change between calls - // * Remember that you cannot test private methods with tut - // --------------------------------------------------------------------------------------- - // Test static methods - // Test 1 : scaleToLevel() - template<> template<> - void worldmipmap_object_t::test<1>() - { - S32 level = mMap->scaleToLevel(0.0); - ensure("scaleToLevel() test 1 failed", level == LLWorldMipmap::MAP_LEVELS); - level = mMap->scaleToLevel((F32)LLWorldMipmap::MAP_TILE_SIZE); - ensure("scaleToLevel() test 2 failed", level == 1); - level = mMap->scaleToLevel(10.f * LLWorldMipmap::MAP_TILE_SIZE); - ensure("scaleToLevel() test 3 failed", level == 1); - } - // Test 2 : globalToMipmap() - template<> template<> - void worldmipmap_object_t::test<2>() - { - U32 grid_x, grid_y; - mMap->globalToMipmap(1000.f*REGION_WIDTH_METERS, 1000.f*REGION_WIDTH_METERS, 1, &grid_x, &grid_y); - ensure("globalToMipmap() test 1 failed", (grid_x == 1000) && (grid_y == 1000)); - mMap->globalToMipmap(0.0, 0.0, LLWorldMipmap::MAP_LEVELS, &grid_x, &grid_y); - ensure("globalToMipmap() test 2 failed", (grid_x == 0) && (grid_y == 0)); - } - // Test 3 : getObjectsTile() - template<> template<> - void worldmipmap_object_t::test<3>() - { - // Depends on some inline methods in LLViewerImage... Thinking about how to make this work - // LLPointer img = mMap->getObjectsTile(0, 0, 1); - // ensure("getObjectsTile() test failed", img.isNull()); - } - // Test 4 : equalizeBoostLevels() - template<> template<> - void worldmipmap_object_t::test<4>() - { - try - { - mMap->equalizeBoostLevels(); - } - catch (...) - { - fail("equalizeBoostLevels() test failed"); - } - } - // Test 5 : dropBoostLevels() - template<> template<> - void worldmipmap_object_t::test<5>() - { - try - { - mMap->dropBoostLevels(); - } - catch (...) - { - fail("dropBoostLevels() test failed"); - } - } - // Test 6 : reset() - template<> template<> - void worldmipmap_object_t::test<6>() - { - try - { - mMap->reset(); - } - catch (...) - { - fail("reset() test failed"); - } - } -} +/** + * @file llworldmipmap_test.cpp + * @author Merov Linden + * @date 2009-02-03 + * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +// Dependencies +#include "linden_common.h" +#include "../llviewertexture.h" +#include "../llviewercontrol.h" +// Class to test +#include "../llworldmipmap.h" +// Tut header +#include "../test/lltut.h" + +// ------------------------------------------------------------------------------------------- +// Stubbing: Declarations required to link and run the class being tested +// Notes: +// * Add here stubbed implementation of the few classes and methods used in the class to be tested +// * Add as little as possible (let the link errors guide you) +// * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code) +// * A simulator for a class can be implemented here. Please comment and document thoroughly. + +void LLGLTexture::setBoostLevel(S32 ) { } +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, FTType, bool, LLGLTexture::EBoostLevel, S8, + LLGLint, LLGLenum, const LLUUID& ) { return NULL; } + +LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker(name) { } +LLControlGroup::~LLControlGroup() { } +std::string LLControlGroup::getString(std::string_view) { return std::string("test_url"); } +LLControlGroup gSavedSettings("test_settings"); + +// End Stubbing +// ------------------------------------------------------------------------------------------- + +// ------------------------------------------------------------------------------------------- +// TUT +// ------------------------------------------------------------------------------------------- +namespace tut +{ + // Test wrapper declaration + struct worldmipmap_test + { + // Derived test class + class LLTestWorldMipmap : public LLWorldMipmap + { + // Put here stubbs of virtual methods we shouldn't call all the way down + }; + // Instance to be tested + LLTestWorldMipmap* mMap; + + // Constructor and destructor of the test wrapper + worldmipmap_test() + { + mMap = new LLTestWorldMipmap; + } + ~worldmipmap_test() + { + delete mMap; + } + }; + + // Tut templating thingamagic: test group, object and test instance + typedef test_group worldmipmap_t; + typedef worldmipmap_t::object worldmipmap_object_t; + tut::worldmipmap_t tut_worldmipmap("LLWorldMipmap"); + + // --------------------------------------------------------------------------------------- + // Test functions + // Notes: + // * Test as many as you possibly can without requiring a full blown simulation of everything + // * The tests are executed in sequence so the test instance state may change between calls + // * Remember that you cannot test private methods with tut + // --------------------------------------------------------------------------------------- + // Test static methods + // Test 1 : scaleToLevel() + template<> template<> + void worldmipmap_object_t::test<1>() + { + S32 level = mMap->scaleToLevel(0.0); + ensure("scaleToLevel() test 1 failed", level == LLWorldMipmap::MAP_LEVELS); + level = mMap->scaleToLevel((F32)LLWorldMipmap::MAP_TILE_SIZE); + ensure("scaleToLevel() test 2 failed", level == 1); + level = mMap->scaleToLevel(10.f * LLWorldMipmap::MAP_TILE_SIZE); + ensure("scaleToLevel() test 3 failed", level == 1); + } + // Test 2 : globalToMipmap() + template<> template<> + void worldmipmap_object_t::test<2>() + { + U32 grid_x, grid_y; + mMap->globalToMipmap(1000.f*REGION_WIDTH_METERS, 1000.f*REGION_WIDTH_METERS, 1, &grid_x, &grid_y); + ensure("globalToMipmap() test 1 failed", (grid_x == 1000) && (grid_y == 1000)); + mMap->globalToMipmap(0.0, 0.0, LLWorldMipmap::MAP_LEVELS, &grid_x, &grid_y); + ensure("globalToMipmap() test 2 failed", (grid_x == 0) && (grid_y == 0)); + } + // Test 3 : getObjectsTile() + template<> template<> + void worldmipmap_object_t::test<3>() + { + // Depends on some inline methods in LLViewerImage... Thinking about how to make this work + // LLPointer img = mMap->getObjectsTile(0, 0, 1); + // ensure("getObjectsTile() test failed", img.isNull()); + } + // Test 4 : equalizeBoostLevels() + template<> template<> + void worldmipmap_object_t::test<4>() + { + try + { + mMap->equalizeBoostLevels(); + } + catch (...) + { + fail("equalizeBoostLevels() test failed"); + } + } + // Test 5 : dropBoostLevels() + template<> template<> + void worldmipmap_object_t::test<5>() + { + try + { + mMap->dropBoostLevels(); + } + catch (...) + { + fail("dropBoostLevels() test failed"); + } + } + // Test 6 : reset() + template<> template<> + void worldmipmap_object_t::test<6>() + { + try + { + mMap->reset(); + } + catch (...) + { + fail("reset() test failed"); + } + } +} -- cgit v1.2.3 From b42f9d836b4c0f7fbd4bdae1734021e2a09fdbe8 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 1 Jun 2024 15:49:26 +0200 Subject: Re-enable a lot of compiler warnings for MSVC and address the C4267 "possible loss of precision" warnings --- indra/newview/tests/llsechandler_basic_test.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp index 4f32299b0d..f6ed745e96 100644 --- a/indra/newview/tests/llsechandler_basic_test.cpp +++ b/indra/newview/tests/llsechandler_basic_test.cpp @@ -634,19 +634,19 @@ namespace tut // Read each of the 4 Pem certs and store in mX509*Cert pointers BIO * validation_bio; - validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), mPemTestCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), static_cast(mPemTestCert.length())); PEM_read_bio_X509(validation_bio, &mX509TestCert, 0, NULL); BIO_free(validation_bio); - validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), mPemRootCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), static_cast(mPemRootCert.length())); PEM_read_bio_X509(validation_bio, &mX509RootCert, 0, NULL); BIO_free(validation_bio); - validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), mPemIntermediateCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), static_cast(mPemIntermediateCert.length())); PEM_read_bio_X509(validation_bio, &mX509IntermediateCert, 0, NULL); BIO_free(validation_bio); - validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), mPemChildCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), static_cast(mPemChildCert.length())); PEM_read_bio_X509(validation_bio, &mX509ChildCert, 0, NULL); BIO_free(validation_bio); } -- cgit v1.2.3 From c95b4bf3ea2b681d6d05468b07e60fedb71fa2cf Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Mon, 10 Jun 2024 20:42:42 +0300 Subject: Post-merge - trim trailing whitespace --- indra/newview/tests/llviewercontrollistener_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/llviewercontrollistener_test.cpp b/indra/newview/tests/llviewercontrollistener_test.cpp index 175c442dc5..f261a04544 100644 --- a/indra/newview/tests/llviewercontrollistener_test.cpp +++ b/indra/newview/tests/llviewercontrollistener_test.cpp @@ -3,7 +3,7 @@ * @author Nat Goodspeed * @date 2022-06-09 * @brief Test for llviewercontrollistener. - * + * * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Copyright (c) 2022, Linden Research, Inc. * $/LicenseInfo$ -- cgit v1.2.3 From b289e0b3adac63bcd96c68b9c05b7d9365eae884 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Mon, 22 Jul 2024 18:47:41 +0300 Subject: Update expired cert in integration test see fe8c976 for more info --- indra/newview/tests/llsechandler_basic_test.cpp | 670 ++++++++++++------------ 1 file changed, 345 insertions(+), 325 deletions(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp index bfe32406cb..cf37a4713c 100644 --- a/indra/newview/tests/llsechandler_basic_test.cpp +++ b/indra/newview/tests/llsechandler_basic_test.cpp @@ -232,381 +232,402 @@ namespace tut "Certificate:\n" " Data:\n" " Version: 3 (0x2)\n" - " Serial Number:\n" - " 82:2f:8f:eb:8d:06:24:b0\n" + " Serial Number: ef:54:d8:f7:da:18:e8:19\n" " Signature Algorithm: sha256WithRSAEncryption\n" " Issuer: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" " Validity\n" - " Not Before: May 22 22:19:45 2018 GMT\n" - " Not After : May 17 22:19:45 2038 GMT\n" + " Not Before: Jul 23 11:46:26 2024 GMT\n" + " Not After : Jul 21 11:46:26 2034 GMT\n" " Subject: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" " Subject Public Key Info:\n" " Public Key Algorithm: rsaEncryption\n" " Public-Key: (4096 bit)\n" " Modulus:\n" - " 00:bd:e0:79:dd:3b:a6:ac:87:d0:39:f0:58:c7:a4:\n" - " 42:42:f6:5f:93:b0:36:04:b5:e2:d5:f7:2a:c0:6c:\n" - " a0:13:d2:1e:02:81:57:02:50:4c:57:b7:ef:27:9e:\n" - " f6:f1:f1:30:30:72:1e:57:34:e5:3f:82:3c:21:c4:\n" - " 66:d2:73:63:6c:91:e6:dd:49:9e:9c:b1:34:6a:81:\n" - " 45:a1:6e:c4:50:28:f2:d8:e3:fe:80:2f:83:aa:28:\n" - " 91:b4:8c:57:c9:f1:16:d9:0c:87:3c:25:80:a0:81:\n" - " 8d:71:f2:96:e2:16:f1:97:c4:b0:d8:53:bb:13:6c:\n" - " 73:54:2f:29:94:85:cf:86:6e:75:71:ad:39:e3:fc:\n" - " 39:12:53:93:1c:ce:39:e0:33:da:49:b7:3d:af:b0:\n" - " 37:ce:77:09:03:27:32:70:c0:9c:7f:9c:89:ce:90:\n" - " 45:b0:7d:94:8b:ff:13:27:ba:88:7f:ae:c4:aa:73:\n" - " d5:47:b8:87:69:89:80:0c:c1:22:18:78:c2:0d:47:\n" - " d9:10:ff:80:79:0d:46:71:ec:d9:ba:c9:f3:77:fd:\n" - " 92:6d:1f:0f:d9:54:18:6d:f6:72:24:5c:5c:3d:43:\n" - " 49:35:3e:1c:28:de:7e:44:dc:29:c3:9f:62:04:46:\n" - " aa:c4:e6:69:6a:15:f8:e3:74:1c:14:e9:f4:97:7c:\n" - " 30:6c:d4:28:fc:2a:0e:1d:6d:39:2e:1d:f9:17:43:\n" - " 35:5d:23:e7:ba:e3:a8:e9:97:6b:3c:3e:23:ef:d8:\n" - " bc:fb:7a:57:37:39:93:59:03:fc:78:ca:b1:31:ef:\n" - " 26:19:ed:56:e1:63:c3:ad:99:80:5b:47:b5:03:35:\n" - " 5f:fe:6a:a6:21:63:ec:50:fb:4e:c9:f9:ae:a5:66:\n" - " d0:55:33:8d:e6:c5:50:5a:c6:8f:5c:34:45:a7:72:\n" - " da:50:f6:66:4c:19:f5:d1:e4:fb:11:8b:a1:b5:4e:\n" - " 09:43:81:3d:39:28:86:3b:fe:07:28:97:02:b5:3a:\n" - " 07:5f:4a:20:80:1a:7d:a4:8c:f7:6c:f6:c5:9b:f6:\n" - " 61:e5:c7:b0:c3:d5:58:38:7b:bb:47:1e:34:d6:16:\n" - " 55:c5:d2:6c:b0:93:77:b1:90:69:06:b1:53:cb:1b:\n" - " 84:71:cf:b8:87:1b:1e:44:35:b4:2b:bb:04:59:58:\n" - " 0b:e8:93:d8:ae:21:9b:b1:1c:89:30:ae:11:80:77:\n" - " cc:16:f3:d6:35:ed:a1:b3:70:b3:4f:cd:a1:56:99:\n" - " ee:0e:c0:00:a4:09:70:c3:5b:0b:be:a1:07:18:dd:\n" - " c6:f4:6d:8b:58:bc:f9:bb:4b:01:2c:f6:cc:2c:9b:\n" - " 87:0e:b1:4f:9c:10:be:fc:45:e2:a4:ec:7e:fc:ff:\n" - " 45:b8:53\n" + " 00:c6:cc:07:f4:0b:17:06:4d:a6:30:b4:c7:02:6b:\n" + " 9d:a4:47:a6:09:0e:60:1a:32:d4:6b:42:88:ee:c5:\n" + " b9:e9:fb:b5:0b:60:dc:a2:45:92:a5:bb:88:12:fc:\n" + " 42:1a:80:32:79:16:62:7a:97:af:84:28:53:3c:c1:\n" + " f2:68:c0:4e:45:e4:0a:63:f9:34:1d:a2:8b:cc:70:\n" + " df:c6:65:c0:ba:31:32:d2:9d:0c:c8:ce:dc:11:12:\n" + " a4:11:fa:d3:c8:56:e2:31:8a:e3:fb:91:40:da:25:\n" + " 55:d1:f2:75:9b:4d:fa:b8:1f:b5:6d:9b:e1:fe:5d:\n" + " e8:c4:02:79:14:ef:7d:5a:b3:3a:1e:b6:d0:60:2c:\n" + " 90:dc:22:e2:c5:ae:85:1f:b4:9d:7a:20:f8:af:63:\n" + " 56:25:1a:64:f3:9c:3f:9a:cf:68:08:0a:37:db:d0:\n" + " a3:65:26:db:80:82:ff:e0:1b:51:c8:ee:f6:ad:c2:\n" + " b4:f2:ab:d2:e8:85:86:77:28:d0:63:4a:71:78:41:\n" + " e3:8c:7f:71:51:31:af:24:3f:fa:8d:d0:d8:0b:e2:\n" + " 7e:79:33:8a:bb:d2:00:9e:2e:c8:cd:d5:50:92:b8:\n" + " 5c:5a:0b:99:ef:05:39:67:da:be:70:36:51:37:37:\n" + " 20:6f:84:ab:29:11:00:7b:38:32:ba:0b:bc:34:a6:\n" + " b5:c6:a7:f0:c0:25:2d:38:0b:72:40:ab:cf:e6:ff:\n" + " 97:75:ff:e2:a9:3c:2a:57:ce:e4:52:20:8c:de:fe:\n" + " 68:ce:54:85:37:ba:b3:7f:2e:53:58:ea:9b:ac:79:\n" + " 6b:16:65:b8:11:88:5a:46:eb:9e:9e:80:3c:89:91:\n" + " 35:e0:c5:33:45:c8:86:4d:25:51:39:b1:72:97:2b:\n" + " b3:c8:c9:e8:11:cd:32:41:c8:c1:56:22:7e:33:81:\n" + " 85:61:ab:da:9e:6e:5f:24:1c:0f:9b:fa:da:9d:86:\n" + " 1a:66:f6:32:2a:10:80:ea:72:7a:4a:ef:c0:f2:7c:\n" + " 43:02:e6:70:19:6a:e1:02:0a:00:80:51:1c:a3:03:\n" + " 8b:6d:89:9f:91:37:90:d6:d8:9c:73:77:06:9e:bc:\n" + " 95:89:66:ee:43:40:a3:ee:43:a3:f6:2d:43:dd:7b:\n" + " f0:2f:0b:12:37:49:b7:81:5a:e2:54:6d:71:88:ff:\n" + " fe:7e:41:25:35:4c:b4:b9:62:65:dd:9f:1f:7a:06:\n" + " 6e:2b:20:58:78:da:08:66:a8:f1:89:de:8f:7f:5c:\n" + " 5e:c2:72:33:7f:b6:8e:41:4c:26:f6:4c:d4:0e:11:\n" + " 44:da:c7:14:f7:8b:79:4e:53:29:87:15:b1:12:e9:\n" + " 19:2b:54:33:d6:2e:7f:bd:42:20:be:fc:d7:9c:b4:\n" + " 7a:0a:db\n" " Exponent: 65537 (0x10001)\n" " X509v3 extensions:\n" - " X509v3 Subject Key Identifier: \n" - " 8A:22:C6:9C:2E:11:F3:40:0C:CE:82:0C:22:59:FF:F8:7F:D0:B9:13\n" - " X509v3 Authority Key Identifier: \n" - " keyid:8A:22:C6:9C:2E:11:F3:40:0C:CE:82:0C:22:59:FF:F8:7F:D0:B9:13\n" + " X509v3 Subject Key Identifier:\n" + " 4D:7D:AE:0D:A5:5E:22:5A:6A:8F:19:61:54:B3:58:CB:7B:C0:BD:DA\n" + " X509v3 Authority Key Identifier:\n" + " keyid:4D:7D:AE:0D:A5:5E:22:5A:6A:8F:19:61:54:B3:58:CB:7B:C0:BD:DA\n" "\n" - " X509v3 Basic Constraints: critical\n" + " X509v3 Basic Constraints:\n" " CA:TRUE\n" - " X509v3 Key Usage: critical\n" - " Digital Signature, Certificate Sign, CRL Sign\n" " Signature Algorithm: sha256WithRSAEncryption\n" - " b3:cb:33:eb:0e:02:64:f4:55:9a:3d:03:9a:cf:6a:4c:18:43:\n" - " f7:42:cb:65:dc:61:52:e5:9f:2f:42:97:3c:93:16:22:d4:af:\n" - " ae:b2:0f:c3:9b:ef:e0:cc:ee:b6:b1:69:a3:d8:da:26:c3:ad:\n" - " 3b:c5:64:dc:9f:d4:c2:53:4b:91:6d:c4:92:09:0b:ac:f0:99:\n" - " be:6f:b9:3c:03:4a:6d:9f:01:5d:ec:5a:9a:f3:a7:e5:3b:2c:\n" - " 99:57:7d:7e:25:15:68:20:12:30:96:16:86:f5:db:74:90:60:\n" - " fe:8b:df:99:f6:f7:62:49:9f:bc:8d:45:23:0a:c8:73:b8:79:\n" - " 80:3c:b9:e5:72:85:4b:b3:81:66:74:a2:72:92:4c:44:fd:7b:\n" - " 46:2e:21:a2:a9:81:a2:f3:26:4d:e3:89:7d:78:b0:c6:6f:b5:\n" - " 87:cb:ee:25:ed:27:1f:75:13:fa:6d:e9:37:73:ad:07:bb:af:\n" - " d3:6c:87:ea:02:01:70:bd:53:aa:ce:39:2c:d4:66:39:33:aa:\n" - " d1:9c:ee:67:e3:a9:45:d2:7b:2e:54:09:af:70:5f:3f:5a:67:\n" - " 2e:6c:72:ef:e0:9d:92:28:4a:df:ba:0b:b7:23:ca:5b:04:11:\n" - " 45:d1:51:e9:ea:c9:ec:54:fa:34:46:ae:fc:dc:6c:f8:1e:2c:\n" - " 9e:f4:71:51:8d:b5:a1:26:9a:13:30:be:1e:41:25:59:58:05:\n" - " 2c:64:c8:f9:5e:38:ae:dc:93:b0:8a:d6:38:74:02:cb:ce:ce:\n" - " 95:31:76:f6:7c:bf:a4:a1:8e:27:fd:ca:74:82:d1:e1:4d:b6:\n" - " 48:51:fa:c5:17:59:22:a3:84:be:82:c8:83:ec:61:a0:f4:ee:\n" - " 2c:e3:a3:ea:e5:51:c9:d3:4f:db:85:bd:ba:7a:52:14:b6:03:\n" - " ed:43:17:d8:d7:1c:22:5e:c9:56:d9:d6:81:96:11:e3:5e:01:\n" - " 40:91:30:09:da:a3:5f:d3:27:60:e5:9d:6c:da:d0:f0:39:01:\n" - " 23:4a:a6:15:7a:4a:82:eb:ec:72:4a:1d:36:dc:6f:83:c4:85:\n" - " 84:b5:8d:cd:09:e5:12:63:f3:21:56:c8:64:6b:db:b8:cf:d4:\n" - " df:ca:a8:24:8e:df:8d:63:a5:96:84:bf:ff:8b:7e:46:7a:f0:\n" - " c7:73:7c:70:8a:f5:17:d0:ac:c8:89:1e:d7:89:42:0f:4d:66:\n" - " c4:d8:bb:36:a8:ae:ca:e1:cf:e2:88:f6:cf:b0:44:4a:5f:81:\n" - " 50:4b:d6:28:81:cd:6c:f0:ec:e6:09:08:f2:59:91:a2:69:ac:\n" - " c7:81:fa:ab:61:3e:db:6f:f6:7f:db:1a:9e:b9:5d:cc:cc:33:\n" - " fa:95:c6:f7:8d:4b:30:f3\n" + " 5b:40:71:96:c8:d1:57:3f:fc:f2:3c:75:fb:c9:a6:a7:63:8a:\n" + " 22:23:96:0f:40:77:77:e2:7f:76:fc:5f:7b:1c:bd:ea:ca:f0:\n" + " be:1a:fd:59:e6:0e:00:d1:78:44:01:28:f4:01:68:67:78:cf:\n" + " 78:43:36:ac:b2:5c:13:0e:2a:94:59:88:9e:64:46:42:0a:9b:\n" + " be:7d:2d:10:11:fe:8b:64:01:fb:00:c5:2e:47:63:c0:93:3a:\n" + " 4a:f8:6c:fc:a9:16:58:ab:bc:7b:6b:20:31:9d:d7:d8:84:01:\n" + " cc:ce:52:7f:a1:18:2f:5c:c9:59:58:9a:98:b9:ef:54:d7:a0:\n" + " 56:79:28:ba:ad:f5:e5:fd:7e:d8:d6:be:dd:25:76:6f:fa:8a:\n" + " 07:f6:8e:0f:83:43:19:ee:96:c4:c9:54:df:19:5a:4c:ae:25:\n" + " 57:a2:5d:d5:e8:0a:66:d8:19:e9:c4:44:ba:6a:3b:b3:86:ae:\n" + " 44:c0:7c:6e:e5:a0:6c:45:bb:7f:34:94:e9:d3:d4:f4:04:0b:\n" + " eb:fc:9a:fa:67:d4:e5:83:5e:08:09:9c:70:a9:d3:0d:8a:08:\n" + " ed:3c:04:33:4f:ac:02:d9:5c:99:62:12:fc:0e:8d:55:8a:ce:\n" + " ca:28:5a:1a:9e:c9:59:8e:f0:f5:19:c7:30:1e:59:1f:3c:77:\n" + " 6d:fc:a2:31:ec:bf:83:fd:14:26:91:68:88:05:4c:87:82:e0:\n" + " 33:f4:ee:d8:56:97:23:3a:00:9b:e7:a2:10:c2:83:28:c6:c0:\n" + " c1:92:49:95:c1:d3:e1:43:e8:8f:0c:d0:ae:e3:50:17:1a:8d:\n" + " 0f:4a:60:71:76:8e:9e:fb:15:76:cd:cd:69:2c:59:24:69:d2:\n" + " 0f:f2:d5:0e:96:95:2b:2e:d7:81:ed:b3:7b:6f:ce:60:32:b5:\n" + " f0:f6:74:ea:27:3a:ee:2c:96:7b:e0:06:6c:33:25:c4:60:da:\n" + " 76:de:c4:a1:22:b6:b1:63:57:10:3c:62:60:98:47:39:9e:38:\n" + " ce:c7:ef:75:75:19:d3:26:2a:cf:46:e3:b0:72:38:49:ee:c3:\n" + " 4e:52:97:e5:e5:b8:bc:b1:45:56:98:54:0a:63:c8:87:ff:a0:\n" + " cb:28:12:5c:8f:a2:6e:a7:f9:50:98:2d:a5:26:08:df:16:29:\n" + " 19:63:7f:6c:b4:41:20:f7:5d:ef:6a:90:fd:1a:08:1c:c2:4c:\n" + " 3e:77:ea:e0:df:c0:dd:aa:a2:36:e7:e8:be:98:39:0a:68:59:\n" + " 8e:a0:71:2f:7c:92:ab:e0:c4:c1:c2:eb:89:b6:34:ce:44:ab:\n" + " f9:f6:a4:c8:7b:ad:a8:bc:c9:04:7c:d5:4c:a4:d2:8b:54:23:\n" + " 89:68:86:4e:07:36:d9:bc\n" "-----BEGIN CERTIFICATE-----\n" - "MIIGXDCCBESgAwIBAgIJAIIvj+uNBiSwMA0GCSqGSIb3DQEBCwUAMIG6MQswCQYD\n" + "MIIGSTCCBDGgAwIBAgIJAO9U2PfaGOgZMA0GCSqGSIb3DQEBCwUAMIG6MQswCQYD\n" "VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5j\n" "aXNjbzETMBEGA1UECgwKTGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25kIExpZmUg\n" "RW5naW5lZXJpbmcxITAfBgNVBAMMGEludGVncmF0aW9uIFRlc3QgUm9vdCBDQTEk\n" - "MCIGCSqGSIb3DQEJARYVbm9yZXBseUBsaW5kZW5sYWIuY29tMB4XDTE4MDUyMjIy\n" - "MTk0NVoXDTM4MDUxNzIyMTk0NVowgboxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApD\n" + "MCIGCSqGSIb3DQEJARYVbm9yZXBseUBsaW5kZW5sYWIuY29tMB4XDTI0MDcyMzEx\n" + "NDYyNloXDTM0MDcyMTExNDYyNlowgboxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApD\n" "YWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMRMwEQYDVQQKDApMaW5k\n" "ZW4gTGFiMSAwHgYDVQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVlcmluZzEhMB8GA1UE\n" "AwwYSW50ZWdyYXRpb24gVGVzdCBSb290IENBMSQwIgYJKoZIhvcNAQkBFhVub3Jl\n" "cGx5QGxpbmRlbmxhYi5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC\n" - "AQC94HndO6ash9A58FjHpEJC9l+TsDYEteLV9yrAbKAT0h4CgVcCUExXt+8nnvbx\n" - "8TAwch5XNOU/gjwhxGbSc2NskebdSZ6csTRqgUWhbsRQKPLY4/6AL4OqKJG0jFfJ\n" - "8RbZDIc8JYCggY1x8pbiFvGXxLDYU7sTbHNULymUhc+GbnVxrTnj/DkSU5Mczjng\n" - "M9pJtz2vsDfOdwkDJzJwwJx/nInOkEWwfZSL/xMnuoh/rsSqc9VHuIdpiYAMwSIY\n" - "eMINR9kQ/4B5DUZx7Nm6yfN3/ZJtHw/ZVBht9nIkXFw9Q0k1Phwo3n5E3CnDn2IE\n" - "RqrE5mlqFfjjdBwU6fSXfDBs1Cj8Kg4dbTkuHfkXQzVdI+e646jpl2s8PiPv2Lz7\n" - "elc3OZNZA/x4yrEx7yYZ7VbhY8OtmYBbR7UDNV/+aqYhY+xQ+07J+a6lZtBVM43m\n" - "xVBaxo9cNEWnctpQ9mZMGfXR5PsRi6G1TglDgT05KIY7/gcolwK1OgdfSiCAGn2k\n" - "jPds9sWb9mHlx7DD1Vg4e7tHHjTWFlXF0mywk3exkGkGsVPLG4Rxz7iHGx5ENbQr\n" - "uwRZWAvok9iuIZuxHIkwrhGAd8wW89Y17aGzcLNPzaFWme4OwACkCXDDWwu+oQcY\n" - "3cb0bYtYvPm7SwEs9swsm4cOsU+cEL78ReKk7H78/0W4UwIDAQABo2MwYTAdBgNV\n" - "HQ4EFgQUiiLGnC4R80AMzoIMIln/+H/QuRMwHwYDVR0jBBgwFoAUiiLGnC4R80AM\n" - "zoIMIln/+H/QuRMwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJ\n" - "KoZIhvcNAQELBQADggIBALPLM+sOAmT0VZo9A5rPakwYQ/dCy2XcYVLlny9ClzyT\n" - "FiLUr66yD8Ob7+DM7raxaaPY2ibDrTvFZNyf1MJTS5FtxJIJC6zwmb5vuTwDSm2f\n" - "AV3sWprzp+U7LJlXfX4lFWggEjCWFob123SQYP6L35n292JJn7yNRSMKyHO4eYA8\n" - "ueVyhUuzgWZ0onKSTET9e0YuIaKpgaLzJk3jiX14sMZvtYfL7iXtJx91E/pt6Tdz\n" - "rQe7r9Nsh+oCAXC9U6rOOSzUZjkzqtGc7mfjqUXSey5UCa9wXz9aZy5scu/gnZIo\n" - "St+6C7cjylsEEUXRUenqyexU+jRGrvzcbPgeLJ70cVGNtaEmmhMwvh5BJVlYBSxk\n" - "yPleOK7ck7CK1jh0AsvOzpUxdvZ8v6Shjif9ynSC0eFNtkhR+sUXWSKjhL6CyIPs\n" - "YaD07izjo+rlUcnTT9uFvbp6UhS2A+1DF9jXHCJeyVbZ1oGWEeNeAUCRMAnao1/T\n" - "J2DlnWza0PA5ASNKphV6SoLr7HJKHTbcb4PEhYS1jc0J5RJj8yFWyGRr27jP1N/K\n" - "qCSO341jpZaEv/+LfkZ68MdzfHCK9RfQrMiJHteJQg9NZsTYuzaorsrhz+KI9s+w\n" - "REpfgVBL1iiBzWzw7OYJCPJZkaJprMeB+qthPttv9n/bGp65XczMM/qVxveNSzDz\n" + "AQDGzAf0CxcGTaYwtMcCa52kR6YJDmAaMtRrQojuxbnp+7ULYNyiRZKlu4gS/EIa\n" + "gDJ5FmJ6l6+EKFM8wfJowE5F5Apj+TQdoovMcN/GZcC6MTLSnQzIztwREqQR+tPI\n" + "VuIxiuP7kUDaJVXR8nWbTfq4H7Vtm+H+XejEAnkU731aszoettBgLJDcIuLFroUf\n" + "tJ16IPivY1YlGmTznD+az2gICjfb0KNlJtuAgv/gG1HI7vatwrTyq9LohYZ3KNBj\n" + "SnF4QeOMf3FRMa8kP/qN0NgL4n55M4q70gCeLsjN1VCSuFxaC5nvBTln2r5wNlE3\n" + "NyBvhKspEQB7ODK6C7w0prXGp/DAJS04C3JAq8/m/5d1/+KpPCpXzuRSIIze/mjO\n" + "VIU3urN/LlNY6puseWsWZbgRiFpG656egDyJkTXgxTNFyIZNJVE5sXKXK7PIyegR\n" + "zTJByMFWIn4zgYVhq9qebl8kHA+b+tqdhhpm9jIqEIDqcnpK78DyfEMC5nAZauEC\n" + "CgCAURyjA4ttiZ+RN5DW2JxzdwaevJWJZu5DQKPuQ6P2LUPde/AvCxI3SbeBWuJU\n" + "bXGI//5+QSU1TLS5YmXdnx96Bm4rIFh42ghmqPGJ3o9/XF7CcjN/to5BTCb2TNQO\n" + "EUTaxxT3i3lOUymHFbES6RkrVDPWLn+9QiC+/NectHoK2wIDAQABo1AwTjAdBgNV\n" + "HQ4EFgQUTX2uDaVeIlpqjxlhVLNYy3vAvdowHwYDVR0jBBgwFoAUTX2uDaVeIlpq\n" + "jxlhVLNYy3vAvdowDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAW0Bx\n" + "lsjRVz/88jx1+8mmp2OKIiOWD0B3d+J/dvxfexy96srwvhr9WeYOANF4RAEo9AFo\n" + "Z3jPeEM2rLJcEw4qlFmInmRGQgqbvn0tEBH+i2QB+wDFLkdjwJM6Svhs/KkWWKu8\n" + "e2sgMZ3X2IQBzM5Sf6EYL1zJWViamLnvVNegVnkouq315f1+2Na+3SV2b/qKB/aO\n" + "D4NDGe6WxMlU3xlaTK4lV6Jd1egKZtgZ6cREumo7s4auRMB8buWgbEW7fzSU6dPU\n" + "9AQL6/ya+mfU5YNeCAmccKnTDYoI7TwEM0+sAtlcmWIS/A6NVYrOyihaGp7JWY7w\n" + "9RnHMB5ZHzx3bfyiMey/g/0UJpFoiAVMh4LgM/Tu2FaXIzoAm+eiEMKDKMbAwZJJ\n" + "lcHT4UPojwzQruNQFxqND0pgcXaOnvsVds3NaSxZJGnSD/LVDpaVKy7Xge2ze2/O\n" + "YDK18PZ06ic67iyWe+AGbDMlxGDadt7EoSK2sWNXEDxiYJhHOZ44zsfvdXUZ0yYq\n" + "z0bjsHI4Se7DTlKX5eW4vLFFVphUCmPIh/+gyygSXI+ibqf5UJgtpSYI3xYpGWN/\n" + "bLRBIPdd72qQ/RoIHMJMPnfq4N/A3aqiNufovpg5CmhZjqBxL3ySq+DEwcLribY0\n" + "zkSr+fakyHutqLzJBHzVTKTSi1QjiWiGTgc22bw=\n" "-----END CERTIFICATE-----\n" - ); + ); + const std::string mPemIntermediateCert( "Certificate:\n" " Data:\n" " Version: 3 (0x2)\n" - " Serial Number: 4096 (0x1000)\n" + " Serial Number: 85:bb:4b:66:26:db:9a:c6\n" " Signature Algorithm: sha256WithRSAEncryption\n" " Issuer: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" " Validity\n" - " Not Before: May 22 22:39:08 2018 GMT\n" - " Not After : May 19 22:39:08 2028 GMT\n" - " Subject: C=US, ST=California, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Intermediate CA/emailAddress=noreply@lindenlab.com\n" + " Not Before: Jul 23 11:46:33 2024 GMT\n" + " Not After : Jul 21 11:46:33 2034 GMT\n" + " Subject: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Intermediate CA/emailAddress=noreply@lindenlab.com\n" " Subject Public Key Info:\n" " Public Key Algorithm: rsaEncryption\n" " Public-Key: (4096 bit)\n" " Modulus:\n" - " 00:ce:a3:70:e2:c4:fb:4b:97:90:a1:30:bb:c1:1b:\n" - " 13:b9:aa:7e:46:17:a3:26:8d:69:3f:5e:73:95:e8:\n" - " 6a:b1:0a:b4:8f:50:65:e3:c6:5c:39:24:34:df:0b:\n" - " b7:cc:ce:62:0c:36:5a:12:2c:fe:35:4c:e9:1c:ac:\n" - " 80:5e:24:99:d7:aa:bd:be:48:c0:62:64:77:36:88:\n" - " 66:ce:f4:a8:dd:d2:76:24:62:90:55:41:fc:1d:13:\n" - " 4e:a7:4e:57:bc:a8:a4:59:4b:2c:5a:1c:d8:cc:16:\n" - " de:e8:88:30:c9:95:df:2f:a6:14:28:0f:eb:34:46:\n" - " 12:58:ba:da:0e:e6:de:9c:15:f6:f4:e3:9f:74:aa:\n" - " 70:89:79:8b:e9:5a:7b:18:54:15:94:3a:23:0a:65:\n" - " 78:05:d9:33:90:2a:ce:15:18:0d:52:fc:5c:31:65:\n" - " 20:d0:12:37:8c:11:80:ba:d4:b0:82:73:00:4b:49:\n" - " be:cb:d6:bc:e7:cd:61:f3:00:98:99:74:5a:37:81:\n" - " 49:96:7e:14:01:1b:86:d2:d0:06:94:40:63:63:46:\n" - " 11:fc:33:5c:bd:3a:5e:d4:e5:44:47:64:50:bd:a6:\n" - " 97:55:70:64:9b:26:cc:de:20:82:90:6a:83:41:9c:\n" - " 6f:71:47:14:be:cb:68:7c:85:be:ef:2e:76:12:19:\n" - " d3:c9:87:32:b4:ac:60:20:16:28:2d:af:bc:e8:01:\n" - " c6:7f:fb:d8:11:d5:f4:b7:14:bd:27:08:5b:72:be:\n" - " 09:e0:91:c8:9c:7b:b4:b3:12:ef:32:36:be:b1:b9:\n" - " a2:b7:e3:69:47:30:76:ba:9c:9b:19:99:4d:53:dd:\n" - " 5c:e8:2c:f1:b2:64:69:cf:15:bd:f8:bb:58:95:73:\n" - " 58:38:95:b4:7a:cf:84:29:a6:c2:db:f0:bd:ef:97:\n" - " 26:d4:99:ac:d7:c7:be:b0:0d:11:f4:26:86:2d:77:\n" - " 42:52:25:d7:56:c7:e3:97:b1:36:5c:97:71:d0:9b:\n" - " f5:b5:50:8d:f9:ff:fb:10:77:3c:b5:53:6d:a1:43:\n" - " 35:a9:03:32:05:ab:d7:f5:d1:19:bd:5f:92:a3:00:\n" - " 2a:79:37:a4:76:4f:e9:32:0d:e4:86:bb:ea:c3:1a:\n" - " c5:33:e8:16:d4:a5:d8:e0:e8:bb:c2:f0:22:15:e2:\n" - " d9:8c:ae:ac:7d:2b:bf:eb:a3:4c:3b:29:1d:94:ac:\n" - " a3:bb:6d:ba:6d:03:91:03:cf:46:12:c4:66:21:c5:\n" - " c6:67:d8:11:19:79:01:0e:6e:84:1c:76:6f:11:3d:\n" - " eb:94:89:c5:6a:26:1f:cd:e0:11:8b:51:ee:99:35:\n" - " 69:e5:7f:0b:77:2a:94:e4:4b:64:b9:83:04:30:05:\n" - " e4:a2:e3\n" + " 00:be:f7:d2:cb:e4:5c:46:7b:e2:11:22:89:72:da:\n" + " 77:72:ec:05:87:19:f7:77:07:fd:67:d7:af:13:d5:\n" + " 76:12:92:dd:69:4d:22:47:b0:3d:94:8a:6a:95:85:\n" + " 34:b8:78:c3:9d:63:32:b1:4b:0a:b6:0e:05:7b:ab:\n" + " 06:23:fc:0d:21:b5:fc:c6:6a:5a:36:be:6e:fc:c7:\n" + " 47:97:a3:18:2e:33:cd:0e:8a:75:2b:b7:29:e9:68:\n" + " 4a:90:53:45:db:73:ff:b3:e5:c1:d4:6b:dd:3a:b1:\n" + " ef:53:9f:23:e9:c6:87:ce:67:b9:fb:a4:d5:76:21:\n" + " 03:cb:c5:72:6b:c5:a6:07:55:fb:47:90:e8:92:38:\n" + " 73:14:11:8e:ff:21:b9:35:64:5a:61:c7:fc:1f:e4:\n" + " 4d:47:e5:03:cc:0b:c3:69:66:71:84:0c:18:2f:61:\n" + " 7f:34:dd:f2:91:e3:b7:9d:a8:b8:db:3f:6e:6f:96:\n" + " fa:34:06:82:04:c8:18:cc:de:8b:7f:26:b5:48:53:\n" + " fb:fb:15:7b:0e:38:60:fe:da:21:98:8d:73:07:b2:\n" + " 6b:fd:ad:21:59:e7:84:66:e1:04:16:1c:be:13:34:\n" + " 28:43:2c:09:3d:e4:77:2a:a4:ad:6d:f9:26:04:f7:\n" + " 43:73:9b:d9:ea:1a:43:6a:b4:db:88:f8:f9:bd:34:\n" + " f8:a6:e8:7a:ab:b4:b2:e1:29:47:a6:ba:b8:65:9c:\n" + " c6:b3:af:13:43:38:ef:2a:05:77:9f:8f:f0:0c:56:\n" + " 21:c2:92:d2:2c:c3:32:50:d1:62:ae:51:fc:99:e6:\n" + " b8:38:f8:83:1d:8d:40:11:e0:1d:51:5d:3f:fa:55:\n" + " 61:b6:18:09:1e:71:af:95:64:9c:ea:c6:11:64:f0:\n" + " a8:02:7d:bb:c8:54:2e:57:48:32:7c:51:66:0d:d6:\n" + " 3e:0e:ed:5e:30:a8:a6:47:03:64:5c:89:21:45:90:\n" + " e1:4c:91:bc:bd:81:6e:73:a9:14:27:e6:0d:6d:38:\n" + " dc:50:9d:b2:56:66:60:6c:66:b9:5d:bb:8c:96:2d:\n" + " 89:5e:0d:2b:ed:b8:03:31:ce:0a:ff:82:03:f5:b2:\n" + " 3b:e5:27:de:61:d8:8f:bf:a2:6a:64:b0:4a:87:23:\n" + " 40:28:a3:f1:ec:96:50:cd:83:50:2d:78:71:92:f2:\n" + " 88:75:b0:9d:cd:0b:e4:62:a6:a5:63:11:fc:b4:ba:\n" + " 9f:c6:67:40:2c:ad:a4:ef:94:f0:f9:a0:ba:e1:52:\n" + " 2e:27:d9:6b:1d:82:23:ed:3c:0b:0b:d2:bc:14:be:\n" + " 6d:b1:69:ad:3e:25:3a:66:d2:d1:af:9f:88:45:25:\n" + " 6b:6e:be:1f:a0:e7:b2:9f:6d:24:94:0d:f4:c2:75:\n" + " f9:1f:5d\n" " Exponent: 65537 (0x10001)\n" " X509v3 extensions:\n" - " X509v3 Subject Key Identifier: \n" - " 83:21:DE:EC:C0:79:03:6D:1E:83:F3:E5:97:29:D5:5A:C0:96:40:FA\n" - " X509v3 Authority Key Identifier: \n" - " keyid:8A:22:C6:9C:2E:11:F3:40:0C:CE:82:0C:22:59:FF:F8:7F:D0:B9:13\n" - "\n" - " X509v3 Basic Constraints: critical\n" + " X509v3 Basic Constraints:\n" " CA:TRUE, pathlen:0\n" - " X509v3 Key Usage: critical\n" + " X509v3 Key Usage:\n" " Digital Signature, Certificate Sign, CRL Sign\n" + " X509v3 Subject Key Identifier:\n" + " 56:98:DC:45:25:11:E2:8C:2B:EA:D6:C6:E2:C8:BE:2C:C8:69:FF:FF\n" + " X509v3 Authority Key Identifier:\n" + " keyid:4D:7D:AE:0D:A5:5E:22:5A:6A:8F:19:61:54:B3:58:CB:7B:C0:BD:DA\n" + " DirName:/C=US/ST=California/L=San Francisco/O=Linden Lab/OU=Second Life Engineering/CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" + " serial:EF:54:D8:F7:DA:18:E8:19\n" " Signature Algorithm: sha256WithRSAEncryption\n" - " a3:6c:85:9a:2e:4e:7e:5d:83:63:0f:f5:4f:a9:7d:ec:0e:6f:\n" - " ae:d7:ba:df:64:e0:46:0e:3d:da:18:15:2c:f3:73:ca:81:b1:\n" - " 10:d9:53:14:21:7d:72:5c:94:88:a5:9d:ad:ab:45:42:c6:64:\n" - " a9:d9:2e:4e:29:47:2c:b1:95:07:b7:62:48:68:1f:68:13:1c:\n" - " d2:a0:fb:5e:38:24:4a:82:0a:87:c9:93:20:43:7e:e9:f9:79:\n" - " ef:03:a2:bd:9e:24:6b:0a:01:5e:4a:36:c5:7d:7a:fe:d6:aa:\n" - " 2f:c2:8c:38:8a:99:3c:b0:6a:e5:60:be:56:d6:eb:60:03:55:\n" - " 24:42:a0:1a:fa:91:24:a3:53:15:75:5d:c8:eb:7c:1e:68:5a:\n" - " 7e:13:34:e3:85:37:1c:76:3f:77:67:1b:ed:1b:52:17:fc:4a:\n" - " a3:e2:74:84:80:2c:69:fc:dd:7d:26:97:c4:2a:69:7d:9c:dc:\n" - " 61:97:70:29:a7:3f:2b:5b:2b:22:51:fd:fe:6a:5d:f9:e7:14:\n" - " 48:b7:2d:c8:33:58:fc:f2:5f:27:f7:26:16:be:be:b5:aa:a2:\n" - " 64:53:3c:69:e8:b5:61:eb:ab:91:a5:b4:09:9b:f6:98:b8:5c:\n" - " 5b:24:2f:93:f5:2b:9c:8c:58:fb:26:3f:67:53:d7:42:64:e8:\n" - " 79:77:73:41:4e:e3:02:39:0b:b6:68:97:8b:84:e8:1d:83:a8:\n" - " 15:f1:06:46:47:80:42:5e:14:e2:61:8a:76:84:d5:d4:71:7f:\n" - " 4e:ff:d9:74:87:ff:32:c5:87:20:0a:d4:59:40:3e:d8:17:ef:\n" - " da:65:e9:0a:51:fe:1e:c3:46:91:d2:ee:e4:23:57:97:87:d4:\n" - " a6:a5:eb:ef:81:6a:d8:8c:d6:1f:8e:b1:18:4c:6b:89:32:55:\n" - " 53:68:26:9e:bb:03:be:2c:e9:8b:ff:97:9c:1c:ac:28:c3:9f:\n" - " 0b:b7:93:23:24:31:63:e4:19:13:f2:bb:08:71:b7:c5:c5:c4:\n" - " 10:ff:dc:fc:33:54:a4:5e:ec:a3:fe:0a:80:ca:9c:bc:95:6f:\n" - " 5f:39:91:3b:61:69:16:94:0f:57:4b:fc:4b:b1:be:72:98:5d:\n" - " 10:f9:08:a7:d6:e0:e8:3d:5d:54:7d:fa:4b:6a:dd:98:41:ed:\n" - " 84:a1:39:67:5c:6c:7f:0c:b0:e1:98:c1:14:ed:fe:1e:e8:05:\n" - " 8d:7f:6a:24:cb:1b:05:42:0d:7f:13:ba:ca:b5:91:db:a5:f0:\n" - " 40:2b:70:7a:2a:a5:5d:ed:56:0c:f0:c2:72:ee:63:dd:cb:5d:\n" - " 76:f6:08:e6:e6:30:ef:3a:b2:16:34:41:a4:e1:30:14:bc:c7:\n" - " f9:23:3a:1a:70:df:b8:cc\n" + " ae:d0:30:ac:31:49:20:86:0b:34:01:58:08:94:68:cc:38:9c:\n" + " f7:13:5c:46:19:33:ed:54:5e:e4:43:f3:59:33:5c:50:d9:89:\n" + " 8b:ee:75:67:a8:c7:0e:d1:30:c2:4e:a3:2e:a8:64:2d:6a:a8:\n" + " f4:bd:b1:32:dc:bc:46:48:5d:1a:18:d8:e8:0b:8c:fe:7b:51:\n" + " d9:dd:b9:e3:4b:d1:f9:e0:22:46:dd:37:5b:b2:cb:72:8e:9c:\n" + " 4b:da:67:df:fd:ce:86:49:21:31:4e:99:b6:d4:38:0b:14:5d:\n" + " ad:97:ba:8f:e2:08:15:85:73:eb:4a:7d:01:49:af:63:ae:2d:\n" + " e3:9d:0a:d7:11:c2:03:d3:15:21:97:be:3d:d2:ea:ab:cc:93:\n" + " 16:98:64:80:72:eb:c2:78:0a:09:69:c4:2b:5d:df:30:7b:be:\n" + " 9b:02:34:73:62:9f:95:b1:cf:08:e8:9e:57:a8:37:31:cf:2c:\n" + " 8c:18:b1:d5:7a:25:90:d6:b6:76:28:1b:e2:b1:cf:1b:f1:ef:\n" + " dd:2f:d3:07:af:81:e3:5f:fc:5a:e7:3c:a9:37:0d:9c:78:5b:\n" + " 58:dc:89:54:70:a4:5b:ff:9f:64:30:a3:85:12:32:69:a5:02:\n" + " 73:d9:1d:ff:69:1f:d4:97:8f:d0:a8:90:8c:dd:2e:45:a1:b1:\n" + " e3:8a:82:fc:fc:08:41:01:51:92:87:9a:09:7b:35:c3:cc:48:\n" + " 81:39:30:a9:f4:41:3b:06:a3:06:21:cc:4b:bc:1b:76:58:94:\n" + " d1:e4:22:70:7f:20:7e:7a:b4:fa:7f:e8:79:c1:8c:89:9e:e9:\n" + " e3:72:2a:43:72:47:9e:bb:26:ed:64:2c:c8:54:f7:b4:95:c2:\n" + " c4:e9:8b:df:d5:10:a7:ed:a5:7a:94:97:c4:76:45:e3:6c:c0:\n" + " 0e:a6:2a:76:d5:1d:2f:ad:99:32:c6:7b:f6:41:e0:65:37:0f:\n" + " c0:1f:c5:99:4a:75:fd:6c:e0:f1:f0:58:49:2d:81:10:ca:d8:\n" + " eb:2b:c3:9b:a9:d9:a9:f5:6c:6d:26:fd:b8:32:92:58:f4:65:\n" + " 0b:d1:8e:03:1e:d5:6a:95:d4:46:9e:65:dd:e5:85:36:e6:31:\n" + " 77:3a:1a:20:2b:07:b7:f1:9a:4e:8d:54:22:5a:54:1c:72:5c:\n" + " 1f:b4:1a:5b:21:ed:06:5a:9a:e5:3c:01:c9:9b:af:50:61:f2:\n" + " 29:6b:ec:6d:19:bb:2e:02:94:ca:36:71:ef:45:39:f1:a5:25:\n" + " 10:0e:90:bc:a7:b3:5b:ab:af:f1:19:88:6a:09:2f:1f:d0:24:\n" + " a8:62:ed:d9:1a:65:89:65:16:a5:55:de:33:e8:7a:81:66:72:\n" + " 91:17:5e:1d:22:72:f7:b8\n" "-----BEGIN CERTIFICATE-----\n" - "MIIGSDCCBDCgAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwgboxCzAJBgNVBAYTAlVT\n" - "MRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMRMw\n" - "EQYDVQQKDApMaW5kZW4gTGFiMSAwHgYDVQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVl\n" - "cmluZzEhMB8GA1UEAwwYSW50ZWdyYXRpb24gVGVzdCBSb290IENBMSQwIgYJKoZI\n" - "hvcNAQkBFhVub3JlcGx5QGxpbmRlbmxhYi5jb20wHhcNMTgwNTIyMjIzOTA4WhcN\n" - "MjgwNTE5MjIzOTA4WjCBqjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3Ju\n" - "aWExEzARBgNVBAoMCkxpbmRlbiBMYWIxIDAeBgNVBAsMF1NlY29uZCBMaWZlIEVu\n" - "Z2luZWVyaW5nMSkwJwYDVQQDDCBJbnRlZ3JhdGlvbiBUZXN0IEludGVybWVkaWF0\n" - "ZSBDQTEkMCIGCSqGSIb3DQEJARYVbm9yZXBseUBsaW5kZW5sYWIuY29tMIICIjAN\n" - "BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAzqNw4sT7S5eQoTC7wRsTuap+Rhej\n" - "Jo1pP15zlehqsQq0j1Bl48ZcOSQ03wu3zM5iDDZaEiz+NUzpHKyAXiSZ16q9vkjA\n" - "YmR3NohmzvSo3dJ2JGKQVUH8HRNOp05XvKikWUssWhzYzBbe6IgwyZXfL6YUKA/r\n" - "NEYSWLraDubenBX29OOfdKpwiXmL6Vp7GFQVlDojCmV4BdkzkCrOFRgNUvxcMWUg\n" - "0BI3jBGAutSwgnMAS0m+y9a8581h8wCYmXRaN4FJln4UARuG0tAGlEBjY0YR/DNc\n" - "vTpe1OVER2RQvaaXVXBkmybM3iCCkGqDQZxvcUcUvstofIW+7y52EhnTyYcytKxg\n" - "IBYoLa+86AHGf/vYEdX0txS9Jwhbcr4J4JHInHu0sxLvMja+sbmit+NpRzB2upyb\n" - "GZlNU91c6CzxsmRpzxW9+LtYlXNYOJW0es+EKabC2/C975cm1Jms18e+sA0R9CaG\n" - "LXdCUiXXVsfjl7E2XJdx0Jv1tVCN+f/7EHc8tVNtoUM1qQMyBavX9dEZvV+SowAq\n" - "eTekdk/pMg3khrvqwxrFM+gW1KXY4Oi7wvAiFeLZjK6sfSu/66NMOykdlKyju226\n" - "bQORA89GEsRmIcXGZ9gRGXkBDm6EHHZvET3rlInFaiYfzeARi1HumTVp5X8LdyqU\n" - "5EtkuYMEMAXkouMCAwEAAaNmMGQwHQYDVR0OBBYEFIMh3uzAeQNtHoPz5Zcp1VrA\n" - "lkD6MB8GA1UdIwQYMBaAFIoixpwuEfNADM6CDCJZ//h/0LkTMBIGA1UdEwEB/wQI\n" - "MAYBAf8CAQAwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQCjbIWa\n" - "Lk5+XYNjD/VPqX3sDm+u17rfZOBGDj3aGBUs83PKgbEQ2VMUIX1yXJSIpZ2tq0VC\n" - "xmSp2S5OKUcssZUHt2JIaB9oExzSoPteOCRKggqHyZMgQ37p+XnvA6K9niRrCgFe\n" - "SjbFfXr+1qovwow4ipk8sGrlYL5W1utgA1UkQqAa+pEko1MVdV3I63weaFp+EzTj\n" - "hTccdj93ZxvtG1IX/Eqj4nSEgCxp/N19JpfEKml9nNxhl3Appz8rWysiUf3+al35\n" - "5xRIty3IM1j88l8n9yYWvr61qqJkUzxp6LVh66uRpbQJm/aYuFxbJC+T9SucjFj7\n" - "Jj9nU9dCZOh5d3NBTuMCOQu2aJeLhOgdg6gV8QZGR4BCXhTiYYp2hNXUcX9O/9l0\n" - "h/8yxYcgCtRZQD7YF+/aZekKUf4ew0aR0u7kI1eXh9SmpevvgWrYjNYfjrEYTGuJ\n" - "MlVTaCaeuwO+LOmL/5ecHKwow58Lt5MjJDFj5BkT8rsIcbfFxcQQ/9z8M1SkXuyj\n" - "/gqAypy8lW9fOZE7YWkWlA9XS/xLsb5ymF0Q+Qin1uDoPV1UffpLat2YQe2EoTln\n" - "XGx/DLDhmMEU7f4e6AWNf2okyxsFQg1/E7rKtZHbpfBAK3B6KqVd7VYM8MJy7mPd\n" - "y1129gjm5jDvOrIWNEGk4TAUvMf5IzoacN+4zA==\n" + "MIIHNjCCBR6gAwIBAgIJAIW7S2Ym25rGMA0GCSqGSIb3DQEBCwUAMIG6MQswCQYD\n" + "VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5j\n" + "aXNjbzETMBEGA1UECgwKTGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25kIExpZmUg\n" + "RW5naW5lZXJpbmcxITAfBgNVBAMMGEludGVncmF0aW9uIFRlc3QgUm9vdCBDQTEk\n" + "MCIGCSqGSIb3DQEJARYVbm9yZXBseUBsaW5kZW5sYWIuY29tMB4XDTI0MDcyMzEx\n" + "NDYzM1oXDTM0MDcyMTExNDYzM1owgcIxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApD\n" + "YWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMRMwEQYDVQQKDApMaW5k\n" + "ZW4gTGFiMSAwHgYDVQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVlcmluZzEpMCcGA1UE\n" + "AwwgSW50ZWdyYXRpb24gVGVzdCBJbnRlcm1lZGlhdGUgQ0ExJDAiBgkqhkiG9w0B\n" + "CQEWFW5vcmVwbHlAbGluZGVubGFiLmNvbTCCAiIwDQYJKoZIhvcNAQEBBQADggIP\n" + "ADCCAgoCggIBAL730svkXEZ74hEiiXLad3LsBYcZ93cH/WfXrxPVdhKS3WlNIkew\n" + "PZSKapWFNLh4w51jMrFLCrYOBXurBiP8DSG1/MZqWja+bvzHR5ejGC4zzQ6KdSu3\n" + "KeloSpBTRdtz/7PlwdRr3Tqx71OfI+nGh85nufuk1XYhA8vFcmvFpgdV+0eQ6JI4\n" + "cxQRjv8huTVkWmHH/B/kTUflA8wLw2lmcYQMGC9hfzTd8pHjt52ouNs/bm+W+jQG\n" + "ggTIGMzei38mtUhT+/sVew44YP7aIZiNcweya/2tIVnnhGbhBBYcvhM0KEMsCT3k\n" + "dyqkrW35JgT3Q3Ob2eoaQ2q024j4+b00+Kboequ0suEpR6a6uGWcxrOvE0M47yoF\n" + "d5+P8AxWIcKS0izDMlDRYq5R/JnmuDj4gx2NQBHgHVFdP/pVYbYYCR5xr5VknOrG\n" + "EWTwqAJ9u8hULldIMnxRZg3WPg7tXjCopkcDZFyJIUWQ4UyRvL2BbnOpFCfmDW04\n" + "3FCdslZmYGxmuV27jJYtiV4NK+24AzHOCv+CA/WyO+Un3mHYj7+iamSwSocjQCij\n" + "8eyWUM2DUC14cZLyiHWwnc0L5GKmpWMR/LS6n8ZnQCytpO+U8PmguuFSLifZax2C\n" + "I+08CwvSvBS+bbFprT4lOmbS0a+fiEUla26+H6Dnsp9tJJQN9MJ1+R9dAgMBAAGj\n" + "ggEzMIIBLzAPBgNVHRMECDAGAQH/AgEAMAsGA1UdDwQEAwIBhjAdBgNVHQ4EFgQU\n" + "VpjcRSUR4owr6tbG4si+LMhp//8wge8GA1UdIwSB5zCB5IAUTX2uDaVeIlpqjxlh\n" + "VLNYy3vAvdqhgcCkgb0wgboxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9y\n" + "bmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMRMwEQYDVQQKDApMaW5kZW4gTGFi\n" + "MSAwHgYDVQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVlcmluZzEhMB8GA1UEAwwYSW50\n" + "ZWdyYXRpb24gVGVzdCBSb290IENBMSQwIgYJKoZIhvcNAQkBFhVub3JlcGx5QGxp\n" + "bmRlbmxhYi5jb22CCQDvVNj32hjoGTANBgkqhkiG9w0BAQsFAAOCAgEArtAwrDFJ\n" + "IIYLNAFYCJRozDic9xNcRhkz7VRe5EPzWTNcUNmJi+51Z6jHDtEwwk6jLqhkLWqo\n" + "9L2xMty8RkhdGhjY6AuM/ntR2d2540vR+eAiRt03W7LLco6cS9pn3/3OhkkhMU6Z\n" + "ttQ4CxRdrZe6j+IIFYVz60p9AUmvY64t450K1xHCA9MVIZe+PdLqq8yTFphkgHLr\n" + "wngKCWnEK13fMHu+mwI0c2KflbHPCOieV6g3Mc8sjBix1XolkNa2digb4rHPG/Hv\n" + "3S/TB6+B41/8Wuc8qTcNnHhbWNyJVHCkW/+fZDCjhRIyaaUCc9kd/2kf1JeP0KiQ\n" + "jN0uRaGx44qC/PwIQQFRkoeaCXs1w8xIgTkwqfRBOwajBiHMS7wbdliU0eQicH8g\n" + "fnq0+n/oecGMiZ7p43IqQ3JHnrsm7WQsyFT3tJXCxOmL39UQp+2lepSXxHZF42zA\n" + "DqYqdtUdL62ZMsZ79kHgZTcPwB/FmUp1/Wzg8fBYSS2BEMrY6yvDm6nZqfVsbSb9\n" + "uDKSWPRlC9GOAx7VapXURp5l3eWFNuYxdzoaICsHt/GaTo1UIlpUHHJcH7QaWyHt\n" + "Blqa5TwByZuvUGHyKWvsbRm7LgKUyjZx70U58aUlEA6QvKezW6uv8RmIagkvH9Ak\n" + "qGLt2RpliWUWpVXeM+h6gWZykRdeHSJy97g=\n" "-----END CERTIFICATE-----\n" - ); + ); const std::string mPemChildCert( "Certificate:\n" " Data:\n" " Version: 3 (0x2)\n" - " Serial Number: 4096 (0x1000)\n" + " Serial Number: 9e:8d:34:13:e7:9b:f9:31\n" " Signature Algorithm: sha256WithRSAEncryption\n" - " Issuer: C=US, ST=California, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Intermediate CA/emailAddress=noreply@lindenlab.com\n" + " Issuer: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Intermediate CA/emailAddress=noreply@lindenlab.com\n" " Validity\n" - " Not Before: May 22 22:58:15 2018 GMT\n" - " Not After : Jul 19 22:58:15 2024 GMT\n" + " Not Before: Jul 23 11:46:39 2024 GMT\n" + " Not After : Jul 21 11:46:39 2034 GMT\n" " Subject: C=US, ST=California, L=San Francisco, O=Linden Lab, OU=Second Life Engineering, CN=Integration Test Server Cert/emailAddress=noreply@lindenlab.com\n" " Subject Public Key Info:\n" " Public Key Algorithm: rsaEncryption\n" - " Public-Key: (2048 bit)\n" + " Public-Key: (4096 bit)\n" " Modulus:\n" - " 00:bf:a1:1c:76:82:4a:10:1d:25:0e:02:e2:7a:64:\n" - " 54:c7:94:c5:c0:98:d5:35:f3:cb:cb:30:ba:31:9c:\n" - " bd:4c:2f:4a:4e:24:03:4b:87:5c:c1:5c:fe:d9:89:\n" - " 3b:cb:01:bc:eb:a5:b7:78:dc:b3:58:e5:78:a7:15:\n" - " 34:50:30:aa:16:3a:b2:94:17:6d:1e:7f:b2:70:1e:\n" - " 96:41:bb:1d:e3:22:80:fa:dc:00:6a:fb:34:3e:67:\n" - " e7:c2:21:2f:1b:d3:af:04:49:91:eb:bb:60:e0:26:\n" - " 52:75:28:8a:08:5b:91:56:4e:51:50:40:51:70:af:\n" - " cb:80:66:c8:59:e9:e2:48:a8:62:d0:26:67:80:0a:\n" - " 12:16:d1:f6:15:9e:1f:f5:92:37:f3:c9:2f:03:9e:\n" - " 22:f6:60:5a:76:45:8c:01:2c:99:54:72:19:db:b7:\n" - " 72:e6:5a:69:f3:e9:31:65:5d:0f:c7:5c:9c:17:29:\n" - " 71:14:7f:db:47:c9:1e:65:a2:41:b0:2f:14:17:ec:\n" - " 4b:25:f2:43:8f:b4:a3:8d:37:1a:07:34:b3:29:bb:\n" - " 8a:44:8e:84:08:a2:1b:76:7a:cb:c2:39:2f:6e:e3:\n" - " fc:d6:91:b5:1f:ce:58:91:57:70:35:6e:25:a9:48:\n" - " 0e:07:cf:4e:dd:16:42:65:cf:8a:42:b3:27:e6:fe:\n" - " 6a:e3\n" + " 00:d8:ac:0c:27:8f:ea:c0:4d:21:e4:75:55:31:57:\n" + " 83:46:47:14:1e:f5:67:ae:98:60:c4:97:6d:e8:53:\n" + " f2:4d:3b:ec:6f:08:bc:1e:c0:e2:a6:75:b5:90:1d:\n" + " 30:a2:59:68:32:10:2b:29:67:fc:99:f1:24:6a:36:\n" + " 73:60:31:6b:c7:a0:b8:b0:38:60:b1:59:23:2c:ab:\n" + " 25:a2:c8:b0:bc:2c:c6:d7:4c:87:37:1b:5e:51:a4:\n" + " 63:3e:c4:6d:ed:da:5e:d3:ad:8a:6d:52:e4:87:38:\n" + " 33:76:cf:f2:86:58:b3:10:a4:91:8d:3d:4f:27:9a:\n" + " 8b:b4:d7:67:90:31:1c:f5:7f:78:af:6f:f2:dd:39:\n" + " d0:16:16:7b:46:ad:88:1b:3b:74:6b:10:29:8b:64:\n" + " ba:ed:9f:a7:69:99:55:8f:73:0d:18:a3:7f:40:20:\n" + " 3a:41:4a:94:39:62:8b:fe:c6:9d:79:d0:cd:1c:e2:\n" + " d4:74:bb:43:75:eb:86:8b:30:c1:8d:cc:14:ab:75:\n" + " 2e:f5:3e:0c:05:cb:e4:c3:92:d8:81:8c:df:a5:4e:\n" + " 2e:0b:ae:17:15:9b:e6:dd:9e:16:46:42:27:92:8a:\n" + " 0e:3a:74:1e:d1:3f:ee:7e:a5:d7:ec:1c:63:d4:96:\n" + " 5b:36:f9:15:ee:da:66:ac:5e:de:91:d9:08:24:fb:\n" + " 5d:fc:9b:77:dd:ff:20:a6:67:6f:48:41:5e:5a:ac:\n" + " 13:a4:2c:2a:f2:a3:15:86:e2:84:33:34:e3:91:27:\n" + " 8b:37:ba:b0:c7:5e:1a:0d:b9:f2:4e:0c:55:e6:bb:\n" + " d9:63:f5:05:7b:aa:19:e5:57:ce:a5:b1:46:4b:b3:\n" + " 04:f6:a0:97:26:ed:48:ed:97:93:a6:75:b1:a3:42:\n" + " fc:cc:57:89:da:44:e9:16:a6:30:2c:01:8e:f2:ed:\n" + " be:45:05:08:8a:af:1e:07:51:89:cf:51:4c:aa:f3:\n" + " b3:f0:6f:db:21:80:11:32:0a:23:e2:ff:cc:59:15:\n" + " eb:ff:d2:b8:d6:a1:c1:b4:96:12:82:bf:3f:68:ad:\n" + " c8:61:50:f8:88:4f:d0:be:8e:29:64:1a:16:a5:d9:\n" + " 29:76:16:cd:70:37:c4:f2:1f:4e:c6:57:36:dd:c1:\n" + " 27:19:72:ef:98:7e:34:25:3f:76:b1:ea:15:b2:38:\n" + " 6e:d3:43:03:7a:2b:78:91:9a:19:26:2a:31:b7:5e:\n" + " b7:22:c4:fd:bf:93:10:a4:23:3f:d7:79:53:28:5d:\n" + " 2e:ba:0c:b0:5e:0a:b4:c4:a1:71:75:88:1b:b2:0e:\n" + " 2c:67:08:7b:f0:f6:37:d3:aa:39:50:03:a3:7c:17:\n" + " 1d:52:52:2a:6b:d0:a2:54:2e:ba:11:bc:26:a9:16:\n" + " a6:1b:79\n" " Exponent: 65537 (0x10001)\n" " X509v3 extensions:\n" - " X509v3 Basic Constraints: \n" + " X509v3 Basic Constraints:\n" " CA:FALSE\n" - " Netscape Cert Type: \n" - " SSL Server\n" - " Netscape Comment: \n" - " OpenSSL Generated Server Certificate\n" - " X509v3 Subject Key Identifier: \n" - " BB:59:9F:DE:6B:51:A7:6C:B3:6D:5B:8B:42:F7:B1:65:77:17:A4:E4\n" - " X509v3 Authority Key Identifier: \n" - " keyid:83:21:DE:EC:C0:79:03:6D:1E:83:F3:E5:97:29:D5:5A:C0:96:40:FA\n" - " DirName:/C=US/ST=California/L=San Francisco/O=Linden Lab/OU=Second Life Engineering/CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" - " serial:10:00\n" - "\n" - " X509v3 Key Usage: critical\n" + " X509v3 Key Usage:\n" " Digital Signature, Key Encipherment\n" - " X509v3 Extended Key Usage: \n" + " X509v3 Extended Key Usage:\n" " TLS Web Server Authentication\n" + " X509v3 Subject Key Identifier:\n" + " 7B:1A:F9:2B:C4:B2:F6:AE:D6:F2:8E:B1:73:FB:DD:11:CA:DB:F8:87\n" + " X509v3 Authority Key Identifier:\n" + " keyid:56:98:DC:45:25:11:E2:8C:2B:EA:D6:C6:E2:C8:BE:2C:C8:69:FF:FF\n" + " DirName:/C=US/ST=California/L=San Francisco/O=Linden Lab/OU=Second Life Engineering/CN=Integration Test Root CA/emailAddress=noreply@lindenlab.com\n" + " serial:85:BB:4B:66:26:DB:9A:C6\n" " Signature Algorithm: sha256WithRSAEncryption\n" - " 18:a6:58:55:9b:d4:af:7d:8a:27:d3:28:3a:4c:4b:42:4e:f0:\n" - " 30:d6:d9:95:11:48:12:0a:96:40:d9:2b:21:39:c5:d4:8d:e5:\n" - " 10:bc:68:78:69:0b:9f:15:4a:0b:f1:ab:99:45:0c:20:5f:27:\n" - " df:e7:14:2d:4a:30:f2:c2:8d:37:73:36:1a:27:55:5a:08:5f:\n" - " 71:a1:5e:05:83:b2:59:fe:02:5e:d7:4a:30:15:23:58:04:cf:\n" - " 48:cc:b0:71:88:9c:6b:57:f0:04:0a:d3:a0:64:6b:ee:f3:5f:\n" - " ea:ac:e1:2b:b9:7f:79:b8:db:ce:72:48:72:db:c8:5c:38:72:\n" - " 31:55:d0:ff:6b:bd:73:23:a7:30:18:5d:ed:47:18:0a:67:8e:\n" - " 53:32:0e:99:9b:96:72:45:7f:c6:00:2c:5d:1a:97:53:75:3a:\n" - " 0b:49:3d:3a:00:37:14:67:0c:28:97:34:87:aa:c5:32:e4:ae:\n" - " 34:83:12:4a:10:f7:0e:74:d4:5f:73:bd:ef:0c:b7:d8:0a:7d:\n" - " 8e:8d:5a:48:bd:f4:8e:7b:f9:4a:15:3b:61:c9:5e:40:59:6e:\n" - " c7:a8:a4:02:28:72:c5:54:8c:77:f4:55:a7:86:c0:38:a0:68:\n" - " 19:da:0f:72:5a:a9:7e:69:9f:9c:3a:d6:66:aa:e1:f4:fd:f9:\n" - " b8:4b:6c:71:9e:f0:38:02:c7:6a:9e:dc:e6:fb:ef:23:59:4f:\n" - " 5c:84:0a:df:ea:86:1f:fd:0e:5c:fa:c4:e5:50:1c:10:cf:89:\n" - " 4e:08:0e:4c:4b:61:1a:49:12:f7:e9:4b:17:71:43:7b:6d:b6:\n" - " b5:9f:d4:3b:c7:88:53:48:63:b6:00:80:8f:49:0a:c5:7e:58:\n" - " ac:78:d8:b9:06:b0:bc:86:e2:2e:48:5b:c3:24:fa:aa:72:d8:\n" - " ec:f6:c7:91:9f:0f:c8:b5:fd:2b:b2:a7:bc:2f:40:20:2b:47:\n" - " e0:d1:1d:94:52:6f:6b:be:12:b6:8c:dc:11:db:71:e6:19:ef:\n" - " a8:71:8b:ad:d3:32:c0:1c:a4:3f:b3:0f:af:e5:50:e1:ff:41:\n" - " a4:b7:6f:57:71:af:fd:16:4c:e8:24:b3:99:1b:cf:12:8f:43:\n" - " 05:80:ba:18:19:0a:a5:ec:49:81:41:4c:7e:28:b2:21:f2:59:\n" - " 6e:4a:ed:de:f9:fa:99:85:60:1f:e6:c2:42:5c:08:00:3c:84:\n" - " 06:a9:24:d4:cf:7b:6e:1b:59:1d:f4:70:16:03:a1:e0:0b:00:\n" - " 95:5c:39:03:fc:9d:1c:8e:f7:59:0c:61:47:f6:7f:07:22:48:\n" - " 83:40:ac:e1:98:5f:c7:be:05:d5:29:2b:bf:0d:03:0e:e9:5e:\n" - " 2b:dd:09:18:fe:5e:30:61\n" + " ad:7c:50:12:24:62:62:83:e9:dd:81:1a:12:1c:6d:ae:1e:a6:\n" + " 01:cc:93:8b:ac:83:7c:3d:57:d7:7f:d2:13:40:82:c7:27:07:\n" + " 31:d8:c4:01:04:64:9c:dc:ae:7b:52:bd:f5:62:7a:d0:7c:13:\n" + " 1a:19:86:6a:ce:9a:ba:69:07:77:75:b6:67:56:d0:c3:8d:6f:\n" + " 59:5f:ac:31:83:32:2c:4f:8c:85:8c:f3:56:5b:e0:83:16:19:\n" + " c9:55:4d:56:2c:e0:06:f8:71:85:4b:7e:c6:20:b3:f6:5b:85:\n" + " 6a:b7:0f:0e:0c:75:38:6a:aa:53:cc:b0:bf:c1:fd:a1:01:8a:\n" + " 7e:5a:0b:4d:51:fc:1b:14:b0:8d:62:17:b7:5d:6a:64:30:80:\n" + " aa:50:9a:23:9e:19:46:11:9d:49:d1:35:81:87:80:8c:9c:71:\n" + " 61:26:07:23:5d:a7:ea:4e:0c:53:77:bd:eb:18:6d:63:8b:2c:\n" + " e1:83:bb:bb:f8:3e:7c:e8:0d:19:1e:be:35:aa:99:0f:c7:25:\n" + " 0c:a8:f9:74:02:c8:4c:8e:bb:13:18:fd:aa:21:34:bc:2d:9f:\n" + " 10:96:e2:99:e3:9a:d7:91:0e:1e:77:20:70:e9:b4:63:25:f8:\n" + " ea:14:1f:24:b0:6a:8b:2a:f4:61:b1:0d:7d:18:bc:1d:6d:04:\n" + " 11:b2:9f:a2:a7:55:be:2b:2c:2f:c1:d8:95:13:73:af:1c:96:\n" + " 49:30:9c:9c:94:81:6c:9b:a7:87:5c:cf:46:95:95:4a:6f:bf:\n" + " df:c9:3d:74:3e:24:6e:44:1e:14:8b:68:23:e4:00:b5:a5:b7:\n" + " 5b:a9:ea:16:5f:fa:b1:d3:1a:b1:9b:36:ef:a4:7a:6f:a3:b0:\n" + " 97:35:ac:70:c0:cc:8e:a2:d3:40:0e:c1:70:0b:d5:ce:cd:51:\n" + " 82:8a:40:72:04:8d:62:af:ba:a8:e7:a8:e9:b9:99:b7:5c:5d:\n" + " 27:96:b2:3d:f9:0d:26:8c:3f:db:ac:86:97:be:f1:2c:0b:ca:\n" + " 90:07:93:96:f4:75:c3:e8:4c:f6:a8:a2:3f:da:11:21:e7:b1:\n" + " 8c:62:36:ae:91:a9:2a:73:ba:67:f5:24:16:c3:ee:b7:b1:b4:\n" + " e3:8a:28:23:84:cf:38:c6:f0:8e:21:f6:b8:76:9a:6d:d1:e3:\n" + " 74:81:7a:22:20:a0:82:2a:31:8a:ba:44:0b:61:5a:aa:ba:c6:\n" + " 07:99:36:0a:24:06:2f:8e:c1:1c:4b:f0:65:72:fb:e9:b5:31:\n" + " 59:13:2c:c6:f8:5b:91:e2:d8:96:f3:1a:06:0b:2a:62:12:4d:\n" + " 5e:65:c9:e9:e4:00:99:a6:d3:60:1f:c3:d6:cc:a6:9b:a5:14:\n" + " 1b:4d:db:e7:3d:52:7e:2c\n" "-----BEGIN CERTIFICATE-----\n" - "MIIGbjCCBFagAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwgaoxCzAJBgNVBAYTAlVT\n" - "MRMwEQYDVQQIDApDYWxpZm9ybmlhMRMwEQYDVQQKDApMaW5kZW4gTGFiMSAwHgYD\n" - "VQQLDBdTZWNvbmQgTGlmZSBFbmdpbmVlcmluZzEpMCcGA1UEAwwgSW50ZWdyYXRp\n" - "b24gVGVzdCBJbnRlcm1lZGlhdGUgQ0ExJDAiBgkqhkiG9w0BCQEWFW5vcmVwbHlA\n" - "bGluZGVubGFiLmNvbTAeFw0xODA1MjIyMjU4MTVaFw0yNDA3MTkyMjU4MTVaMIG+\n" - "MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2Fu\n" - "IEZyYW5jaXNjbzETMBEGA1UECgwKTGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25k\n" - "IExpZmUgRW5naW5lZXJpbmcxJTAjBgNVBAMMHEludGVncmF0aW9uIFRlc3QgU2Vy\n" - "dmVyIENlcnQxJDAiBgkqhkiG9w0BCQEWFW5vcmVwbHlAbGluZGVubGFiLmNvbTCC\n" - "ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL+hHHaCShAdJQ4C4npkVMeU\n" - "xcCY1TXzy8swujGcvUwvSk4kA0uHXMFc/tmJO8sBvOult3jcs1jleKcVNFAwqhY6\n" - "spQXbR5/snAelkG7HeMigPrcAGr7ND5n58IhLxvTrwRJkeu7YOAmUnUoighbkVZO\n" - "UVBAUXCvy4BmyFnp4kioYtAmZ4AKEhbR9hWeH/WSN/PJLwOeIvZgWnZFjAEsmVRy\n" - "Gdu3cuZaafPpMWVdD8dcnBcpcRR/20fJHmWiQbAvFBfsSyXyQ4+0o403Ggc0sym7\n" - "ikSOhAiiG3Z6y8I5L27j/NaRtR/OWJFXcDVuJalIDgfPTt0WQmXPikKzJ+b+auMC\n" - "AwEAAaOCAYYwggGCMAkGA1UdEwQCMAAwEQYJYIZIAYb4QgEBBAQDAgZAMDMGCWCG\n" - "SAGG+EIBDQQmFiRPcGVuU1NMIEdlbmVyYXRlZCBTZXJ2ZXIgQ2VydGlmaWNhdGUw\n" - "HQYDVR0OBBYEFLtZn95rUadss21bi0L3sWV3F6TkMIHoBgNVHSMEgeAwgd2AFIMh\n" - "3uzAeQNtHoPz5Zcp1VrAlkD6oYHApIG9MIG6MQswCQYDVQQGEwJVUzETMBEGA1UE\n" - "CAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzETMBEGA1UECgwK\n" - "TGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25kIExpZmUgRW5naW5lZXJpbmcxITAf\n" - "BgNVBAMMGEludGVncmF0aW9uIFRlc3QgUm9vdCBDQTEkMCIGCSqGSIb3DQEJARYV\n" - "bm9yZXBseUBsaW5kZW5sYWIuY29tggIQADAOBgNVHQ8BAf8EBAMCBaAwEwYDVR0l\n" - "BAwwCgYIKwYBBQUHAwEwDQYJKoZIhvcNAQELBQADggIBABimWFWb1K99iifTKDpM\n" - "S0JO8DDW2ZURSBIKlkDZKyE5xdSN5RC8aHhpC58VSgvxq5lFDCBfJ9/nFC1KMPLC\n" - "jTdzNhonVVoIX3GhXgWDsln+Al7XSjAVI1gEz0jMsHGInGtX8AQK06Bka+7zX+qs\n" - "4Su5f3m4285ySHLbyFw4cjFV0P9rvXMjpzAYXe1HGApnjlMyDpmblnJFf8YALF0a\n" - "l1N1OgtJPToANxRnDCiXNIeqxTLkrjSDEkoQ9w501F9zve8Mt9gKfY6NWki99I57\n" - "+UoVO2HJXkBZbseopAIocsVUjHf0VaeGwDigaBnaD3JaqX5pn5w61maq4fT9+bhL\n" - "bHGe8DgCx2qe3Ob77yNZT1yECt/qhh/9Dlz6xOVQHBDPiU4IDkxLYRpJEvfpSxdx\n" - "Q3tttrWf1DvHiFNIY7YAgI9JCsV+WKx42LkGsLyG4i5IW8Mk+qpy2Oz2x5GfD8i1\n" - "/Suyp7wvQCArR+DRHZRSb2u+EraM3BHbceYZ76hxi63TMsAcpD+zD6/lUOH/QaS3\n" - "b1dxr/0WTOgks5kbzxKPQwWAuhgZCqXsSYFBTH4osiHyWW5K7d75+pmFYB/mwkJc\n" - "CAA8hAapJNTPe24bWR30cBYDoeALAJVcOQP8nRyO91kMYUf2fwciSINArOGYX8e+\n" - "BdUpK78NAw7pXivdCRj+XjBh\n" + "MIIHSTCCBTGgAwIBAgIJAJ6NNBPnm/kxMA0GCSqGSIb3DQEBCwUAMIHCMQswCQYD\n" + "VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5j\n" + "aXNjbzETMBEGA1UECgwKTGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25kIExpZmUg\n" + "RW5naW5lZXJpbmcxKTAnBgNVBAMMIEludGVncmF0aW9uIFRlc3QgSW50ZXJtZWRp\n" + "YXRlIENBMSQwIgYJKoZIhvcNAQkBFhVub3JlcGx5QGxpbmRlbmxhYi5jb20wHhcN\n" + "MjQwNzIzMTE0NjM5WhcNMzQwNzIxMTE0NjM5WjCBvjELMAkGA1UEBhMCVVMxEzAR\n" + "BgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xEzARBgNV\n" + "BAoMCkxpbmRlbiBMYWIxIDAeBgNVBAsMF1NlY29uZCBMaWZlIEVuZ2luZWVyaW5n\n" + "MSUwIwYDVQQDDBxJbnRlZ3JhdGlvbiBUZXN0IFNlcnZlciBDZXJ0MSQwIgYJKoZI\n" + "hvcNAQkBFhVub3JlcGx5QGxpbmRlbmxhYi5jb20wggIiMA0GCSqGSIb3DQEBAQUA\n" + "A4ICDwAwggIKAoICAQDYrAwnj+rATSHkdVUxV4NGRxQe9WeumGDEl23oU/JNO+xv\n" + "CLwewOKmdbWQHTCiWWgyECspZ/yZ8SRqNnNgMWvHoLiwOGCxWSMsqyWiyLC8LMbX\n" + "TIc3G15RpGM+xG3t2l7TrYptUuSHODN2z/KGWLMQpJGNPU8nmou012eQMRz1f3iv\n" + "b/LdOdAWFntGrYgbO3RrECmLZLrtn6dpmVWPcw0Yo39AIDpBSpQ5Yov+xp150M0c\n" + "4tR0u0N164aLMMGNzBSrdS71PgwFy+TDktiBjN+lTi4LrhcVm+bdnhZGQieSig46\n" + "dB7RP+5+pdfsHGPUlls2+RXu2masXt6R2Qgk+138m3fd/yCmZ29IQV5arBOkLCry\n" + "oxWG4oQzNOORJ4s3urDHXhoNufJODFXmu9lj9QV7qhnlV86lsUZLswT2oJcm7Ujt\n" + "l5OmdbGjQvzMV4naROkWpjAsAY7y7b5FBQiKrx4HUYnPUUyq87Pwb9shgBEyCiPi\n" + "/8xZFev/0rjWocG0lhKCvz9orchhUPiIT9C+jilkGhal2Sl2Fs1wN8TyH07GVzbd\n" + "wScZcu+YfjQlP3ax6hWyOG7TQwN6K3iRmhkmKjG3XrcixP2/kxCkIz/XeVMoXS66\n" + "DLBeCrTEoXF1iBuyDixnCHvw9jfTqjlQA6N8Fx1SUipr0KJULroRvCapFqYbeQID\n" + "AQABo4IBQjCCAT4wCQYDVR0TBAIwADALBgNVHQ8EBAMCBaAwEwYDVR0lBAwwCgYI\n" + "KwYBBQUHAwEwHQYDVR0OBBYEFHsa+SvEsvau1vKOsXP73RHK2/iHMIHvBgNVHSME\n" + "gecwgeSAFFaY3EUlEeKMK+rWxuLIvizIaf//oYHApIG9MIG6MQswCQYDVQQGEwJV\n" + "UzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzET\n" + "MBEGA1UECgwKTGluZGVuIExhYjEgMB4GA1UECwwXU2Vjb25kIExpZmUgRW5naW5l\n" + "ZXJpbmcxITAfBgNVBAMMGEludGVncmF0aW9uIFRlc3QgUm9vdCBDQTEkMCIGCSqG\n" + "SIb3DQEJARYVbm9yZXBseUBsaW5kZW5sYWIuY29tggkAhbtLZibbmsYwDQYJKoZI\n" + "hvcNAQELBQADggIBAK18UBIkYmKD6d2BGhIcba4epgHMk4usg3w9V9d/0hNAgscn\n" + "BzHYxAEEZJzcrntSvfVietB8ExoZhmrOmrppB3d1tmdW0MONb1lfrDGDMixPjIWM\n" + "81Zb4IMWGclVTVYs4Ab4cYVLfsYgs/ZbhWq3Dw4MdThqqlPMsL/B/aEBin5aC01R\n" + "/BsUsI1iF7ddamQwgKpQmiOeGUYRnUnRNYGHgIyccWEmByNdp+pODFN3vesYbWOL\n" + "LOGDu7v4PnzoDRkevjWqmQ/HJQyo+XQCyEyOuxMY/aohNLwtnxCW4pnjmteRDh53\n" + "IHDptGMl+OoUHySwaosq9GGxDX0YvB1tBBGyn6KnVb4rLC/B2JUTc68clkkwnJyU\n" + "gWybp4dcz0aVlUpvv9/JPXQ+JG5EHhSLaCPkALWlt1up6hZf+rHTGrGbNu+kem+j\n" + "sJc1rHDAzI6i00AOwXAL1c7NUYKKQHIEjWKvuqjnqOm5mbdcXSeWsj35DSaMP9us\n" + "hpe+8SwLypAHk5b0dcPoTPaooj/aESHnsYxiNq6RqSpzumf1JBbD7rextOOKKCOE\n" + "zzjG8I4h9rh2mm3R43SBeiIgoIIqMYq6RAthWqq6xgeZNgokBi+OwRxL8GVy++m1\n" + "MVkTLMb4W5Hi2JbzGgYLKmISTV5lyenkAJmm02Afw9bMppulFBtN2+c9Un4s\n" "-----END CERTIFICATE-----\n" - ); + ); + // Test wrapper declaration : wrapping nothing for the moment struct sechandler_basic_test @@ -701,14 +722,13 @@ namespace tut //std::ostringstream llsd_value; //llsd_value << LLSDOStreamer(llsd_cert) << std::endl; LL_DEBUGS() << "test 1 cert " << llsd_cert << LL_ENDL; - ensure_equals("Issuer Name/commonName", (std::string)llsd_cert["issuer_name"]["commonName"], "Integration Test Intermediate CA"); ensure_equals("Issuer Name/countryName", (std::string)llsd_cert["issuer_name"]["countryName"], "US"); ensure_equals("Issuer Name/state", (std::string)llsd_cert["issuer_name"]["stateOrProvinceName"], "California"); ensure_equals("Issuer Name/org name", (std::string)llsd_cert["issuer_name"]["organizationName"], "Linden Lab"); ensure_equals("Issuer Name/org unit", (std::string)llsd_cert["issuer_name"]["organizationalUnitName"], "Second Life Engineering"); ensure_equals("Issuer name string", (std::string)llsd_cert["issuer_name_string"], - "emailAddress=noreply@lindenlab.com,CN=Integration Test Intermediate CA,OU=Second Life Engineering,O=Linden Lab,ST=California,C=US"); + "emailAddress=noreply@lindenlab.com,CN=Integration Test Intermediate CA,OU=Second Life Engineering,O=Linden Lab,L=San Francisco,ST=California,C=US"); ensure_equals("subject Name/commonName", (std::string)llsd_cert["subject_name"]["commonName"], "Integration Test Server Cert"); ensure_equals("subject Name/countryName", (std::string)llsd_cert["subject_name"]["countryName"], "US"); @@ -721,9 +741,9 @@ namespace tut ensure_equals("subject name string", (std::string)llsd_cert["subject_name_string"], "emailAddress=noreply@lindenlab.com,CN=Integration Test Server Cert,OU=Second Life Engineering,O=Linden Lab,L=San Francisco,ST=California,C=US"); - ensure_equals("serial number", (std::string)llsd_cert["serial_number"], "1000"); - ensure_equals("valid from", (std::string)llsd_cert["valid_from"], "2018-05-22T22:58:15Z"); - ensure_equals("valid to", (std::string)llsd_cert["valid_to"], "2024-07-19T22:58:15Z"); + ensure_equals("serial number", (std::string)llsd_cert["serial_number"], "9E8D3413E79BF931"); + ensure_equals("valid from", (std::string)llsd_cert["valid_from"], "2024-07-23T11:46:39Z"); + ensure_equals("valid to", (std::string)llsd_cert["valid_to"], "2034-07-21T11:46:39Z"); LLSD expectedKeyUsage = LLSD::emptyArray(); expectedKeyUsage.append(LLSD((std::string)"digitalSignature")); expectedKeyUsage.append(LLSD((std::string)"keyEncipherment")); @@ -1042,7 +1062,7 @@ namespace tut //validate find LLSD find_info = LLSD::emptyMap(); - find_info["subjectKeyIdentifier"] = "bb:59:9f:de:6b:51:a7:6c:b3:6d:5b:8b:42:f7:b1:65:77:17:a4:e4"; + find_info["subjectKeyIdentifier"] = "7b:1a:f9:2b:c4:b2:f6:ae:d6:f2:8e:b1:73:fb:dd:11:ca:db:f8:87"; LLBasicCertificateVector::iterator found_cert = test_vector->find(find_info); ensure("found some cert", found_cert != test_vector->end()); X509* found_x509 = (*found_cert).get()->getOpenSSLX509(); @@ -1225,7 +1245,7 @@ namespace tut X509_STORE_CTX_set0_untrusted(test_store, NULL); test_chain = new LLBasicCertificateChain(test_store); X509_STORE_CTX_free(test_store); - ensure_equals("two elements in store", test_chain->size(), 1); + ensure_equals("two elements in store [1]", test_chain->size(), 1); X509* test_cert = (*test_chain)[0]->getOpenSSLX509(); ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); X509_free(test_cert); @@ -1238,7 +1258,7 @@ namespace tut sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509IntermediateCert); test_chain = new LLBasicCertificateChain(test_store); X509_STORE_CTX_free(test_store); - ensure_equals("two elements in store", test_chain->size(), 2); + ensure_equals("two elements in store [2]", test_chain->size(), 2); test_cert = (*test_chain)[0]->getOpenSSLX509(); ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); X509_free(test_cert); @@ -1254,7 +1274,7 @@ namespace tut sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509TestCert); test_chain = new LLBasicCertificateChain(test_store); X509_STORE_CTX_free(test_store); - ensure_equals("two elements in store", test_chain->size(), 1); + ensure_equals("two elements in store [3]", test_chain->size(), 1); test_cert = (*test_chain)[0]->getOpenSSLX509(); ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); X509_free(test_cert); @@ -1267,7 +1287,7 @@ namespace tut sk_X509_push(X509_STORE_CTX_get0_untrusted(test_store), mX509TestCert); test_chain = new LLBasicCertificateChain(test_store); X509_STORE_CTX_free(test_store); - ensure_equals("two elements in store", test_chain->size(), 2); + ensure_equals("two elements in store [4]", test_chain->size(), 2); test_cert = (*test_chain)[0]->getOpenSSLX509(); ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert)); X509_free(test_cert); -- cgit v1.2.3 From 03d7f2b84daf9ab991de6cad7d6149abda1ef716 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 28 Aug 2024 21:16:56 -0400 Subject: Ditch trailing spaces. --- indra/newview/tests/llluamanager_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/llluamanager_test.cpp b/indra/newview/tests/llluamanager_test.cpp index 3209d93d39..4b143b52db 100644 --- a/indra/newview/tests/llluamanager_test.cpp +++ b/indra/newview/tests/llluamanager_test.cpp @@ -3,7 +3,7 @@ * @author Nat Goodspeed * @date 2023-09-28 * @brief Test for llluamanager. - * + * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Copyright (c) 2023, Linden Research, Inc. * $/LicenseInfo$ -- cgit v1.2.3 From 5319d314206c7c1c21b2bbd3a661c0c520373dcc Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 4 Sep 2024 16:24:42 -0400 Subject: Windows build fixes --- indra/newview/tests/llluamanager_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/tests') diff --git a/indra/newview/tests/llluamanager_test.cpp b/indra/newview/tests/llluamanager_test.cpp index 4b143b52db..8ce5c357e0 100644 --- a/indra/newview/tests/llluamanager_test.cpp +++ b/indra/newview/tests/llluamanager_test.cpp @@ -287,7 +287,7 @@ namespace tut while (expect_array.size() > 0 && send_array[expect_array.size() - 1].isUndefined()) { - expect_array.erase(expect_array.size() - 1); + expect_array.erase(LLSD::Integer(expect_array.size() - 1)); } round_trip("array", send_array, expect_array); -- cgit v1.2.3