diff options
author | Jason Rassi <rassi@10gen.com> | 2015-04-25 12:57:35 -0400 |
---|---|---|
committer | Jason Rassi <rassi@10gen.com> | 2015-04-28 16:53:26 -0400 |
commit | 4ea827d383156d36e666d05eb6dad8bbc2a75801 (patch) | |
tree | 3cd082f98883ca77f44b3c69f518472e38fcda6c /src | |
parent | 659d6c26e12d3396aafff70ca11d74a4187b4084 (diff) | |
download | mongo-4ea827d383156d36e666d05eb6dad8bbc2a75801.tar.gz |
SERVER-18111 Check userAllowedWriteNS() in findAndModify cmd parsing
(cherry picked from commit 040879f6885395ab49754bd76449af71d0903dd7)
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/commands/find_and_modify.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp index acd9dbed9b1..0f23f2fc6a1 100644 --- a/src/mongo/db/commands/find_and_modify.cpp +++ b/src/mongo/db/commands/find_and_modify.cpp @@ -41,6 +41,7 @@ #include "mongo/db/exec/working_set_common.h" #include "mongo/db/projection.h" #include "mongo/db/ops/delete.h" +#include "mongo/db/ops/insert.h" #include "mongo/db/ops/update.h" #include "mongo/db/ops/update_lifecycle_impl.h" #include "mongo/db/query/get_executor.h" @@ -84,6 +85,10 @@ namespace mongo { bool fromRepl) { const std::string ns = parseNsCollectionRequired(dbname, cmdObj); + Status allowedWriteStatus = userAllowedWriteNS(ns); + if (!allowedWriteStatus.isOK()) { + return appendCommandStatus(result, allowedWriteStatus); + } const BSONObj query = cmdObj.getObjectField("query"); const BSONObj fields = cmdObj.getObjectField("fields"); |