summaryrefslogtreecommitdiff
path: root/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2016-12-05 11:19:48 -0500
committerDavid Storch <david.storch@10gen.com>2016-12-09 17:59:52 -0500
commit7cf929f25638e4ad9525775c8ea0e18f3c86faf5 (patch)
tree42328072009a72ce73f1c5bffe60f0c36ee0d492 /src/mongo/s/commands/cluster_enable_sharding_cmd.cpp
parent586ac20773ff7dc18cabf329c238bf261e00387d (diff)
downloadmongo-7cf929f25638e4ad9525775c8ea0e18f3c86faf5.tar.gz
SERVER-24128 reject embedded null bytes in namespace string parsing
Diffstat (limited to 'src/mongo/s/commands/cluster_enable_sharding_cmd.cpp')
-rw-r--r--src/mongo/s/commands/cluster_enable_sharding_cmd.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp b/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp
index e6352a95fa1..1254fca23b5 100644
--- a/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp
+++ b/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp
@@ -95,10 +95,10 @@ public:
BSONObjBuilder& result) {
const std::string dbname = parseNs("", cmdObj);
- if (dbname.empty() || !nsIsDbOnly(dbname)) {
- errmsg = "invalid db name specified: " + dbname;
- return false;
- }
+ uassert(
+ ErrorCodes::InvalidNamespace,
+ str::stream() << "invalid db name specified: " << dbname,
+ NamespaceString::validDBName(dbname, NamespaceString::DollarInDbNameBehavior::Allow));
if (dbname == "admin" || dbname == "config" || dbname == "local") {
errmsg = "can't shard " + dbname + " database";