Skip to content

Commit

Permalink
McServerSSLUtil -> McSSLUtil
Browse files Browse the repository at this point in the history
Summary: We plan to put client routines in here as well.

Reviewed By: andreazevedo

Differential Revision: D7401598

fbshipit-source-id: 812945047084475ee6a884f5d458d364371fa8b3
  • Loading branch information
callenrain authored and facebook-github-bot committed Mar 27, 2018
1 parent 7241e5e commit 2e39a38
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions mcrouter/lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ libmcrouter_a_SOURCES = \
network/McServerRequestContext.h \
network/McServerSession.cpp \
network/McServerSession.h \
network/McServerSSLUtil.cpp \
network/McServerSSLUtil.h \
network/McSSLUtil.cpp \
network/McSSLUtil.h \
network/MemcacheMessageHelpers.h \
network/MemoryController.cpp \
network/MemoryController.h \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* file in the root directory of this source tree.
*
*/
#include "McServerSSLUtil.h"
#include "McSSLUtil.h"

#include <folly/SharedMutex.h>
#include <folly/io/async/ssl/OpenSSLUtils.h>
Expand All @@ -19,13 +19,13 @@ static folly::SharedMutex& getMutex() {
return MUTEX;
}

static McServerSSLUtil::SSLVerifyFunction& getAppFuncRef() {
static McServerSSLUtil::SSLVerifyFunction VERIFIER;
static McSSLUtil::SSLVerifyFunction& getAppFuncRef() {
static McSSLUtil::SSLVerifyFunction VERIFIER;
return VERIFIER;
}
} // namespace

bool McServerSSLUtil::verifySSLWithDefaultBehavior(
bool McSSLUtil::verifySSLWithDefaultBehavior(
folly::AsyncSSLSocket*,
bool preverifyOk,
X509_STORE_CTX* ctx) noexcept {
Expand Down Expand Up @@ -59,12 +59,12 @@ bool McServerSSLUtil::verifySSLWithDefaultBehavior(
cert, reinterpret_cast<sockaddr*>(&addrStorage), addrLen);
}

void McServerSSLUtil::setApplicationSSLVerifier(SSLVerifyFunction func) {
void McSSLUtil::setApplicationSSLVerifier(SSLVerifyFunction func) {
folly::SharedMutex::WriteHolder wh(getMutex());
getAppFuncRef() = std::move(func);
}

bool McServerSSLUtil::verifySSL(
bool McSSLUtil::verifySSL(
folly::AsyncSSLSocket* sock,
bool preverifyOk,
X509_STORE_CTX* ctx) noexcept {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
namespace facebook {
namespace memcache {
/**
* A utility class for SSL related items in McRouter Servers.
* Manages an app specific SSL verification routine that is used by
* McServerSession when verifying SSL handshakes.
* A utility class for SSL related items in McRouter clients and servers.
* Manages app-specific SSL routines that are used by clients and servers during
* and immediately after SSL handshakes.
*/
class McServerSSLUtil {
class McSSLUtil {
public:
using SSLVerifyFunction =
folly::Function<bool(folly::AsyncSSLSocket*, bool, X509_STORE_CTX*)
Expand Down
4 changes: 2 additions & 2 deletions mcrouter/lib/network/McServerSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <folly/small_vector.h>

#include "mcrouter/lib/debug/FifoManager.h"
#include "mcrouter/lib/network/McSSLUtil.h"
#include "mcrouter/lib/network/McServerRequestContext.h"
#include "mcrouter/lib/network/McServerSSLUtil.h"
#include "mcrouter/lib/network/MultiOpParent.h"
#include "mcrouter/lib/network/WriteBuffer.h"

Expand Down Expand Up @@ -481,7 +481,7 @@ bool McServerSession::handshakeVer(
folly::AsyncSSLSocket* sock,
bool preverifyOk,
X509_STORE_CTX* ctx) noexcept {
return McServerSSLUtil::verifySSL(sock, preverifyOk, ctx);
return McSSLUtil::verifySSL(sock, preverifyOk, ctx);
}

void McServerSession::handshakeSuc(folly::AsyncSSLSocket* sock) noexcept {
Expand Down
4 changes: 2 additions & 2 deletions mcrouter/lib/network/test/AsyncMcServerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
#include <gtest/gtest.h>

#include "mcrouter/lib/network/McServerSSLUtil.h"
#include "mcrouter/lib/network/McSSLUtil.h"
#include "mcrouter/lib/network/test/TestClientServerUtil.h"

using namespace facebook::memcache;
Expand Down Expand Up @@ -60,7 +60,7 @@ TEST(AsyncMcServer, sslCertCommonName) {
}

TEST(AsyncMcServer, sslVerify) {
McServerSSLUtil::setApplicationSSLVerifier(
McSSLUtil::setApplicationSSLVerifier(
[](folly::AsyncSSLSocket*, bool, X509_STORE_CTX*) { return false; });
auto server = TestServer::create(false, true /* use ssl */);

Expand Down

0 comments on commit 2e39a38

Please sign in to comment.