diff options
author | Jason Carey <jcarey@argv.me> | 2017-08-01 11:29:51 -0400 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2017-08-17 12:16:40 -0400 |
commit | cb20cab73393fbf725627d5f7b1af5e797866870 (patch) | |
tree | d2282b9e7490f7e73ead3cf35a746d0f126b42fd /src/mongo/db/commands.cpp | |
parent | 427647f7cea35a782f3532c02d3e16323c4aea99 (diff) | |
download | mongo-cb20cab73393fbf725627d5f7b1af5e797866870.tar.gz |
SERVER-28338 KillSessions Support
Diffstat (limited to 'src/mongo/db/commands.cpp')
-rw-r--r-- | src/mongo/db/commands.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp index 5f5982d76f4..c8f99250182 100644 --- a/src/mongo/db/commands.cpp +++ b/src/mongo/db/commands.cpp @@ -189,7 +189,7 @@ BSONObj Command::runCommandDirectly(OperationContext* opCtx, const OpMsgRequest& BSONObjBuilder out; try { - bool ok = command->enhancedRun(opCtx, request, out); + bool ok = command->publicRun(opCtx, request, out); appendCommandStatus(out, ok); } catch (const StaleConfigException& ex) { // These exceptions are intended to be handled at a higher level and cannot losslessly @@ -321,6 +321,20 @@ Status Command::checkAuthorization(Command* c, return status; } +bool Command::publicRun(OperationContext* opCtx, + const OpMsgRequest& request, + BSONObjBuilder& result) { + try { + return enhancedRun(opCtx, request, result); + } catch (const DBException& e) { + if (e.code() == ErrorCodes::Unauthorized) { + audit::logCommandAuthzCheck( + opCtx->getClient(), request, this, ErrorCodes::Unauthorized); + } + throw; + } +} + bool Command::isHelpRequest(const BSONElement& helpElem) { return !helpElem.eoo() && helpElem.trueValue(); } |