diff options
author | Adam Cooper <adam.cooper@mongodb.com> | 2019-09-04 17:33:32 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-09-04 17:33:32 +0000 |
commit | 324017ede1dbb1c9554dd2dceb15f8da3c59d0e8 (patch) | |
tree | e1b2273df3f9c3e68efae1d1a4c71a07f23bc502 /src | |
parent | 4406a3674738f41826413a412025b1cef4857024 (diff) | |
download | mongo-r3.4.23.tar.gz |
SERVER-42652 Fix issue with rename collectionr3.4.23-rc0r3.4.23
(cherry picked from commit cdde32442328fdd65bd1ae016164bcafff15fa92)
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/auth/authorization_manager.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mongo/db/auth/authorization_manager.cpp b/src/mongo/db/auth/authorization_manager.cpp index 4eb05ec666f..5b72e413ce9 100644 --- a/src/mongo/db/auth/authorization_manager.cpp +++ b/src/mongo/db/auth/authorization_manager.cpp @@ -672,8 +672,14 @@ bool loggedCommandOperatesOnAuthzData(const char* ns, const BSONObj& cmdObj) { } 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") { |