summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/service_entry_point_common.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index 2cc05fc5080..ab449e2b9a7 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -664,6 +664,7 @@ private:
LogicalTime _startOperationTime;
OperationSessionInfoFromClient _sessionOptions;
boost::optional<ResourceConsumption::ScopedMetricsCollector> _scopedMetrics;
+ boost::optional<ImpersonationSessionGuard> _impersonationSessionGuard;
std::unique_ptr<PolymorphicScoped> _scoped;
};
@@ -1377,7 +1378,7 @@ Future<void> ExecCommandDatabase::_initiateCommand() try {
"Skipping command execution for help request");
}
- ImpersonationSessionGuard guard(opCtx);
+ _impersonationSessionGuard.emplace(opCtx);
_invocation->checkAuthorization(opCtx, request);
const bool iAmPrimary = replCoord->canAcceptWritesForDatabase_UNSAFE(opCtx, dbname);