Commit 2d466553 authored by Neel Goyal's avatar Neel Goyal Committed by Facebook Github Bot

Ignore setSSLLockTypes() calls after SSLContext is initialized.

Summary: We set the actual locks on initialization, so attempting to change locks after had no affect, other than making isSSLLockDisabled() report incorrect information.

Reviewed By: yfeldblum

Differential Revision: D4935475

fbshipit-source-id: 7b80cd530801c925ade769163579b86b1a8f0027
parent 3bdf6ef1
...@@ -794,6 +794,13 @@ static void dyn_destroy(struct CRYPTO_dynlock_value* lock, const char*, int) { ...@@ -794,6 +794,13 @@ static void dyn_destroy(struct CRYPTO_dynlock_value* lock, const char*, int) {
} }
void SSLContext::setSSLLockTypes(std::map<int, SSLLockType> inLockTypes) { void SSLContext::setSSLLockTypes(std::map<int, SSLLockType> inLockTypes) {
if (initialized_) {
// We set the locks on initialization, so if we are already initialized
// this would have no affect.
LOG(INFO) << "Ignoring setSSLLockTypes after initialization";
return;
}
lockTypes() = inLockTypes; lockTypes() = inLockTypes;
} }
......
...@@ -205,6 +205,14 @@ TEST(AsyncSSLSocketTest2, SSLContextLocks) { ...@@ -205,6 +205,14 @@ TEST(AsyncSSLSocketTest2, SSLContextLocks) {
#endif #endif
} }
TEST(AsyncSSLSocketTest2, SSLContextLocksSetAfterInitIgnored) {
SSLContext::initializeOpenSSL();
SSLContext::setSSLLockTypes({});
#ifdef CRYPTO_LOCK_EVP_PKEY
EXPECT_TRUE(SSLContext::isSSLLockDisabled(CRYPTO_LOCK_EVP_PKEY));
#endif
}
} // folly } // folly
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment