diff options
author | Blake Oler <blake.oler@mongodb.com> | 2018-07-25 15:04:05 -0400 |
---|---|---|
committer | Blake Oler <blake.oler@mongodb.com> | 2018-07-30 11:48:24 -0400 |
commit | 56059c0dba6db079798f67a0a4063c4c3921ddb8 (patch) | |
tree | a6186d73c041a1dd892bbd134d32b87166262a8a /src/mongo/db/initialize_operation_session_info.cpp | |
parent | 35898a0c48b0bb1bcb0a69f7db646d2fda4ec5de (diff) | |
download | mongo-56059c0dba6db079798f67a0a4063c4c3921ddb8.tar.gz |
SERVER-35180 Safeguard from setting operation session info values while in a direct client
Diffstat (limited to 'src/mongo/db/initialize_operation_session_info.cpp')
-rw-r--r-- | src/mongo/db/initialize_operation_session_info.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/initialize_operation_session_info.cpp b/src/mongo/db/initialize_operation_session_info.cpp index eb3821f0dce..aec8a4fb584 100644 --- a/src/mongo/db/initialize_operation_session_info.cpp +++ b/src/mongo/db/initialize_operation_session_info.cpp @@ -57,6 +57,13 @@ boost::optional<OperationSessionInfoFromClient> initializeOperationSessionInfo( bool supportsRecoverToStableTimestamp) { auto osi = OperationSessionInfoFromClient::parse("OperationSessionInfo"_sd, requestBody); + if (opCtx->getClient()->isInDirectClient()) { + uassert(50891, + "Invalid to set operation session info in a direct client", + !osi.getSessionId() && !osi.getTxnNumber() && !osi.getAutocommit() && + !osi.getStartTransaction()); + } + if (!requiresAuth) { uassert(ErrorCodes::OperationNotSupportedInTransaction, "This command is not supported in transactions", |