|
I verified that this is a problem. The JavaScript "DB" constructor calls validDBName() to make sure that the name is valid, but this validates differently on Windows than it does on other platforms:
static bool validDBName( const string& db ) {
|
if ( db.size() == 0 || db.size() > 64 )
|
return false;
|
#ifdef _WIN32
|
// We prohibit all FAT32-disallowed characters on Windows
|
size_t good = strcspn( db.c_str() , "/\\. \"*<>:|?" );
|
#else
|
// For non-Windows platforms we are much more lenient
|
size_t good = strcspn( db.c_str() , "/\\. \"" );
|
#endif
|
return good == db.size();
|
}
|
This is the wrong thing to do whenever a Windows client is connected to a non-Windows server or a non-Windows client is connected to a Windows server. A Windows client will incorrectly reject database names that are valid on the non-Windows server, and a non-Windows client will permit database names that will potentially cause problems on the Windows server.
The DB constructor (db_constructor() in src/mongo/scripting/sm_db.cpp line 765 for SpiderMonkey, or dbInit() in src/mongo/scripting/v8_db.cpp line 388 for V8) should apply rules based on the type of the server on which it will create the database.
|