summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam Cooper <adam.cooper@mongodb.com>2019-09-03 22:01:57 +0000
committerevergreen <evergreen@mongodb.com>2019-09-03 22:01:57 +0000
commit148c01077d4d8648a7c34125d2ec12d6e5a1056e (patch)
tree8d791b52bd84022bef6a1b0b11bd25ea3b8be55e /src
parent88df2558b0c3b39b86df2ab97814d701d701d704 (diff)
downloadmongo-148c01077d4d8648a7c34125d2ec12d6e5a1056e.tar.gz
SERVER-42652 Fix issue with rename collection
(cherry picked from commit cdde32442328fdd65bd1ae016164bcafff15fa92)
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/auth/authorization_manager_impl.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mongo/db/auth/authorization_manager_impl.cpp b/src/mongo/db/auth/authorization_manager_impl.cpp
index 9909657b06a..71a2d9ba071 100644
--- a/src/mongo/db/auth/authorization_manager_impl.cpp
+++ b/src/mongo/db/auth/authorization_manager_impl.cpp
@@ -643,8 +643,15 @@ bool loggedCommandOperatesOnAuthzData(const NamespaceString& nss, const BSONObj&
} else if (cmdName == "dropDatabase") {
return true;
} else if (cmdName == "renameCollection") {
- return isAuthzCollection(cmdObj.firstElement().str()) ||
- isAuthzCollection(cmdObj["to"].str());
+ const NamespaceString fromNamespace(cmdObj.firstElement().str());
+ const NamespaceString toNamespace(cmdObj["to"].str());
+ if (fromNamespace.db() == "admin" || toNamespace.db() == "admin") {
+ return isAuthzCollection(fromNamespace.coll().toString()) ||
+ isAuthzCollection(toNamespace.coll().toString());
+ } else {
+ return false;
+ }
+
} else if (cmdName == "dropIndexes" || cmdName == "deleteIndexes") {
return false;
} else if (cmdName == "create") {