diff options
Diffstat (limited to 'src/mongo/db/commands/oplog_application_checks.cpp')
-rw-r--r-- | src/mongo/db/commands/oplog_application_checks.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mongo/db/commands/oplog_application_checks.cpp b/src/mongo/db/commands/oplog_application_checks.cpp index 4ef23c19a2c..1a001805f55 100644 --- a/src/mongo/db/commands/oplog_application_checks.cpp +++ b/src/mongo/db/commands/oplog_application_checks.cpp @@ -89,8 +89,17 @@ Status OplogApplicationChecks::checkOperationAuthorization(OperationContext* opC dbNameForAuthCheck = "admin"; } - return Command::checkAuthorization( - commandInOplogEntry, opCtx, OpMsgRequest::fromDBAndBody(dbNameForAuthCheck, o)); + // TODO reuse the parse result for when we run() later. Note that when running, + // we must use a potentially different dbname. + return [&] { + try { + auto request = OpMsgRequest::fromDBAndBody(dbNameForAuthCheck, o); + commandInOplogEntry->parse(opCtx, request)->checkAuthorization(opCtx, request); + return Status::OK(); + } catch (const DBException& e) { + return e.toStatus(); + } + }(); } if (opType == "i"_sd) { |