diff options
author | Adam Cooper <adam.cooper@mongodb.com> | 2019-08-09 13:03:23 -0400 |
---|---|---|
committer | Adam Cooper <adam.cooper@mongodb.com> | 2019-08-19 13:03:28 -0400 |
commit | cdde32442328fdd65bd1ae016164bcafff15fa92 (patch) | |
tree | 7af09113ccace34ea34854fead988d766b5c1689 /src | |
parent | 81af22b71fcc2fdc5ed69a3cd46476e65227a2ab (diff) | |
download | mongo-cdde32442328fdd65bd1ae016164bcafff15fa92.tar.gz |
SERVER-42652 Fix issue with rename collection
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/auth/authorization_manager_impl.cpp | 11 |
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 63e59eb4628..219f07d5cc0 100644 --- a/src/mongo/db/auth/authorization_manager_impl.cpp +++ b/src/mongo/db/auth/authorization_manager_impl.cpp @@ -792,8 +792,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") { |