From a7f7c028c4cdda1ab0939c6c7788bb39bd94cc5f Mon Sep 17 00:00:00 2001 From: Andy Schwerin Date: Fri, 20 Sep 2013 10:36:01 -0400 Subject: SERVER-1105 Use ResourcePattern type when identifying the resource component of required privileges. This patch has two principal components. First, it changes the interface to Privilege and AuthorizationSession to use ResourcePattern in place of std::string for identifying resources. Second, it examines all call sites of the authorization session interface in commands and other code to ensure that the correct resource requirements are conveyed to the authorization_session. --- src/mongo/db/commands/rename_collection_common.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/mongo/db/commands/rename_collection_common.cpp') diff --git a/src/mongo/db/commands/rename_collection_common.cpp b/src/mongo/db/commands/rename_collection_common.cpp index 8000da5cd85..caf395af353 100644 --- a/src/mongo/db/commands/rename_collection_common.cpp +++ b/src/mongo/db/commands/rename_collection_common.cpp @@ -44,6 +44,8 @@ namespace rename_collection { std::vector* out) { NamespaceString sourceNS = NamespaceString(cmdObj.getStringField("renameCollection")); NamespaceString targetNS = NamespaceString(cmdObj.getStringField("to")); + uassert(17140, "Invalid source namespace " + sourceNS.ns(), sourceNS.isValid()); + uassert(17141, "Invalid target namespace " + targetNS.ns(), targetNS.isValid()); ActionSet sourceActions; ActionSet targetActions; @@ -58,8 +60,8 @@ namespace rename_collection { targetActions.addAction(ActionType::ensureIndex); } - out->push_back(Privilege(sourceNS.ns(), sourceActions)); - out->push_back(Privilege(targetNS.ns(), targetActions)); + out->push_back(Privilege(ResourcePattern::forExactNamespace(sourceNS), sourceActions)); + out->push_back(Privilege(ResourcePattern::forExactNamespace(targetNS), targetActions)); } } // namespace rename_collection -- cgit v1.2.1