diff options
author | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2014-03-07 15:22:54 -0500 |
---|---|---|
committer | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2014-03-10 14:29:32 -0400 |
commit | 629de3b0f493ad7517b2aecd6ec616df015f53dc (patch) | |
tree | 0b10092e401aa88eda32ce01acd07d6fe816f1ca /src/mongo/s/cluster_write.cpp | |
parent | cc421d9723c67f0afa3efacc7ff4c766aceea332 (diff) | |
download | mongo-629de3b0f493ad7517b2aecd6ec616df015f53dc.tar.gz |
SERVER-12975 Write command to mongos checks invalid NS
Diffstat (limited to 'src/mongo/s/cluster_write.cpp')
-rw-r--r-- | src/mongo/s/cluster_write.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/s/cluster_write.cpp b/src/mongo/s/cluster_write.cpp index 5d726737e67..6299208d6f9 100644 --- a/src/mongo/s/cluster_write.cpp +++ b/src/mongo/s/cluster_write.cpp @@ -325,6 +325,13 @@ namespace mongo { return; } + if ( !NamespaceString::validCollectionName( nss.coll() ) ) { + toBatchError( Status( ErrorCodes::BadValue, + str::stream() << "invalid collection name " << nss.coll() ), + response ); + return; + } + string errMsg; if ( request.isInsertIndexRequest() && !request.isValidIndexRequest( &errMsg ) ) { toBatchError( Status( ErrorCodes::InvalidOptions, errMsg ), response ); |