diff options
author | Roxanne Skelly <roxie@lindenlab.com> | 2009-07-09 21:45:04 +0000 |
---|---|---|
committer | Roxanne Skelly <roxie@lindenlab.com> | 2009-07-09 21:45:04 +0000 |
commit | e65b6d96957fd92fdc8c5a42b1ad4b1a153552b3 (patch) | |
tree | 0eff61a199c8c9386d6ef19b27f243150b557dd2 /indra/newview | |
parent | 7a64aad1def1b0612addbf2e66c66db061d7e182 (diff) |
DEV-34822
svn merge -c120157 svn+ssh://svn.lindenlab.com/svn/linden/branches/giab-viewer/giab-viewer-2
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewer.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llsecapi.cpp | 37 | ||||
-rw-r--r-- | indra/newview/llsecapi.h | 4 | ||||
-rw-r--r-- | indra/newview/llworld.cpp | 3 |
4 files changed, 44 insertions, 1 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index d1e33fa91a..187038ab15 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -621,6 +621,7 @@ bool LLAppViewer::init() initThreads(); initializeSecHandler(); + LLHTTPClient::setCertVerifyCallback(secapiSSLCertVerifyCallback); writeSystemInfo(); // Build a string representing the current version number. diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp index 70c247c2de..26bdfd19da 100644 --- a/indra/newview/llsecapi.cpp +++ b/indra/newview/llsecapi.cpp @@ -36,6 +36,8 @@ #include "llsechandler_basic.h" #include <openssl/evp.h> #include <map> +#include "llhttpclient.h" + std::map<std::string, LLPointer<LLSecAPIHandler> > gHandlerMap; @@ -79,7 +81,42 @@ std::ostream& operator <<(std::ostream& s, const LLCredential& cred) return s << (std::string)cred; } + +// secapiSSLCertVerifyCallback +// basic callback called when a cert verification is requested. +// calls SECAPI to validate the context +// not initialized in the above initialization function, due to unit tests +// see llappviewer +int secapiSSLCertVerifyCallback(X509_STORE_CTX *ctx, void *param) +{ + LLURLRequest *req = (LLURLRequest *)param; + LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore(""); + LLPointer<LLCertificateChain> chain = gSecAPIHandler->getCertificateChain(ctx); + LLSD validation_params = LLSD::emptyMap(); + LLURI uri(req->getURL()); + validation_params[CERT_HOSTNAME] = uri.hostName(); + try + { + chain->validate(VALIDATION_POLICY_SSL, store, validation_params); + } + catch (LLCertValidationTrustException& cert_exception) + { + LL_WARNS("AppInit") << "Cert not trusted: " << cert_exception.getMessage() << LL_ENDL; + return 0; + } + catch (LLCertException& cert_exception) + { + LL_WARNS("AppInit") << "cert error " << cert_exception.getMessage() << LL_ENDL; + return 0; + } + catch (...) + { + LL_WARNS("AppInit") << "cert error " << LL_ENDL; + return 0; + } + return 1; +} LLSD LLCredential::getLoginParams() { diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h index 6fd12c044a..d3fb3c4c07 100644 --- a/indra/newview/llsecapi.h +++ b/indra/newview/llsecapi.h @@ -474,4 +474,8 @@ void registerSecHandler(const std::string& handler_type, extern LLPointer<LLSecAPIHandler> gSecAPIHandler; + +int secapiSSLCertVerifyCallback(X509_STORE_CTX *ctx, void *param); + + #endif // LL_SECAPI_H diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 118d7f8d08..ed70be7b9f 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -132,10 +132,11 @@ void LLWorld::destroyClass() LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) { LLMemType mt(LLMemType::MTYPE_REGIONS); - + llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl; LLViewerRegion *regionp = getRegionFromHandle(region_handle); if (regionp) { + llinfos << "Region exists, removing it " << llendl; LLHost old_host = regionp->getHost(); // region already exists! if (host == old_host && regionp->isAlive()) |