summaryrefslogtreecommitdiff
path: root/indra/newview/llsecapi.cpp
diff options
context:
space:
mode:
authorRoxanne Skelly <roxie@lindenlab.com>2009-07-09 21:45:04 +0000
committerRoxanne Skelly <roxie@lindenlab.com>2009-07-09 21:45:04 +0000
commite65b6d96957fd92fdc8c5a42b1ad4b1a153552b3 (patch)
tree0eff61a199c8c9386d6ef19b27f243150b557dd2 /indra/newview/llsecapi.cpp
parent7a64aad1def1b0612addbf2e66c66db061d7e182 (diff)
DEV-34822
svn merge -c120157 svn+ssh://svn.lindenlab.com/svn/linden/branches/giab-viewer/giab-viewer-2
Diffstat (limited to 'indra/newview/llsecapi.cpp')
-rw-r--r--indra/newview/llsecapi.cpp37
1 files changed, 37 insertions, 0 deletions
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()
{