diff --git a/db/pdfile.cpp b/db/pdfile.cpp index 43dfdb59df3..d449278fd40 100644 --- a/db/pdfile.cpp +++ b/db/pdfile.cpp @@ -1756,14 +1756,10 @@ namespace mongo { uassert( 10095 , "attempt to insert in reserved database name 'system'", sys != ns); if ( strstr(ns, ".system.") ) { // later:check for dba-type permissions here if have that at some point separate - if ( strstr(ns, ".system.indexes" ) ){ + if ( strstr(ns, ".system.indexes" ) ) wouldAddIndex = true; - } else if ( legalClientSystemNS( ns , true ) ) { if ( obuf && strstr( ns , ".system.users" ) ) { - static const BSONObj userPattern = BSON("user" << 1); - Helpers::ensureIndex(ns, userPattern, false, "user_1"); - BSONObj t( reinterpret_cast( obuf ) ); uassert( 14051 , "system.user entry needs 'user' field to be a string" , t["user"].type() == String ); uassert( 14052 , "system.user entry needs 'pwd' field to be a string" , t["pwd"].type() == String ); diff --git a/db/security.cpp b/db/security.cpp index ed6fab4f87f..6721efba2a2 100644 --- a/db/security.cpp +++ b/db/security.cpp @@ -79,7 +79,9 @@ namespace mongo { pwd = internalSecurity.pwd; } else { + // static BSONObj userPattern = fromjson("{\"user\":1}"); string systemUsers = dbname + ".system.users"; + // OCCASIONALLY Helpers::ensureIndex(systemUsers.c_str(), userPattern, false, "user_1"); { BSONObjBuilder b; b << "user" << user;