summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2020-08-10 18:29:23 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-09-29 15:03:54 +0000
commit524bf1f8b51575f046a9baa8d55a9283e858d380 (patch)
tree61c3a82290b20de3c0b97bffee35e7eb5f77afbb
parent469c36d7b782256a854452f828627d1026d5c18e (diff)
downloadmongo-524bf1f8b51575f046a9baa8d55a9283e858d380.tar.gz
SERVER-50050 Fix non-ssl build
(cherry picked from commit 5eedf66fc4ae88a0eb0bdf42cb5b8f865379c762)
-rw-r--r--src/mongo/db/auth/SConscript1
-rw-r--r--src/mongo/db/auth/authorization_manager_impl.cpp2
-rw-r--r--src/mongo/db/auth/authorization_manager_test.cpp6
-rw-r--r--src/mongo/s/SConscript1
4 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/db/auth/SConscript b/src/mongo/db/auth/SConscript
index c3e01cad5b8..0710a65c7cf 100644
--- a/src/mongo/db/auth/SConscript
+++ b/src/mongo/db/auth/SConscript
@@ -168,6 +168,7 @@ env.Library(
'$BUILD_DIR/mongo/db/pipeline/lite_parsed_document_source',
'$BUILD_DIR/mongo/db/update/update_driver',
'$BUILD_DIR/mongo/util/icu',
+ '$BUILD_DIR/mongo/util/concurrency/thread_pool',
'$BUILD_DIR/mongo/util/net/ssl_manager',
'$BUILD_DIR/mongo/util/net/ssl_types',
],
diff --git a/src/mongo/db/auth/authorization_manager_impl.cpp b/src/mongo/db/auth/authorization_manager_impl.cpp
index 9059dfcc4d7..eaf471f561b 100644
--- a/src/mongo/db/auth/authorization_manager_impl.cpp
+++ b/src/mongo/db/auth/authorization_manager_impl.cpp
@@ -451,6 +451,7 @@ StatusWith<UserHandle> AuthorizationManagerImpl::acquireUser(OperationContext* o
UserRequest request(userName, boost::none);
+#ifdef MONGO_CONFIG_SSL
// Clients connected via TLS may present an X.509 certificate which contains an authorization
// grant. If this is the case, the roles must be provided to the external state, for expansion
// into privileges.
@@ -463,6 +464,7 @@ StatusWith<UserHandle> AuthorizationManagerImpl::acquireUser(OperationContext* o
sslPeerInfo.roles.end(),
std::inserter(*request.roles, request.roles->begin()));
}
+#endif
auto cachedUser = _userCache.acquire(opCtx, request);
invariant(cachedUser);
diff --git a/src/mongo/db/auth/authorization_manager_test.cpp b/src/mongo/db/auth/authorization_manager_test.cpp
index 1578db97b18..b40bbf7a025 100644
--- a/src/mongo/db/auth/authorization_manager_test.cpp
+++ b/src/mongo/db/auth/authorization_manager_test.cpp
@@ -61,6 +61,7 @@
namespace mongo {
namespace {
+#ifdef MONGO_CONFIG_SSL
// Construct a simple, structured X509 name equivalent to "CN=mongodb.com"
SSLX509Name buildX509Name() {
return SSLX509Name(std::vector<std::vector<SSLX509Name::Entry>>(
@@ -72,6 +73,8 @@ void setX509PeerInfo(const transport::SessionHandle& session, SSLPeerInfo info)
sslPeerInfo = info;
}
+#endif
+
class AuthorizationManagerTest : public ServiceContextTest {
public:
AuthorizationManagerTest() {
@@ -193,7 +196,6 @@ TEST_F(AuthorizationManagerTest, testLocalX509Authorization) {
ASSERT(privilegeIt != privileges.end());
ASSERT(privilegeIt->second.includesAction(ActionType::insert));
}
-#endif
TEST_F(AuthorizationManagerTest, testLocalX509AuthorizationInvalidUser) {
setX509PeerInfo(session,
@@ -212,6 +214,8 @@ TEST_F(AuthorizationManagerTest, testLocalX509AuthenticationNoAuthorization) {
.getStatus());
}
+#endif
+
/**
* An implementation of AuthzManagerExternalStateMock that overrides the getUserDescription method
* to return the user document unmodified from how it was inserted. When using this insert user
diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript
index 8ebc0ec1caa..f54aad9499b 100644
--- a/src/mongo/s/SConscript
+++ b/src/mongo/s/SConscript
@@ -309,6 +309,7 @@ env.Library(
'$BUILD_DIR/mongo/client/clientdriver_network',
'$BUILD_DIR/mongo/db/logical_time_metadata_hook',
'$BUILD_DIR/mongo/executor/task_executor_pool',
+ '$BUILD_DIR/mongo/util/caching',
'client/shard_interface',
'query/cluster_cursor_manager',
'sharding_routing_table',