diff options
author | Kristina <kristina@10gen.com> | 2011-08-18 11:25:58 -0400 |
---|---|---|
committer | Kristina <kristina@10gen.com> | 2011-08-18 11:25:58 -0400 |
commit | 93ce4de477c610b8ba667b22b72121bd00a40d0b (patch) | |
tree | e8b0553c3c83f2ee5c3dc5752bda10bc6a5d2ff9 /s | |
parent | 5bd3f44d5ce76fb44a83e8e278c062c83e5ccaa0 (diff) | |
download | mongo-93ce4de477c610b8ba667b22b72121bd00a40d0b.tar.gz |
do not start mongos without checking auth SERVER-3587
Diffstat (limited to 's')
-rw-r--r-- | s/config.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/s/config.cpp b/s/config.cpp index f9e548235d3..264887e6976 100644 --- a/s/config.cpp +++ b/s/config.cpp @@ -558,6 +558,15 @@ namespace mongo { BSONObj x; try { ScopedDbConnection conn( _config[i], 30.0 ); + + // check auth + conn->update("foo.bar", BSONObj(), BSON("x" << 1)); + conn->simpleCommand( "admin", &x, "getlasterror"); + if (x["err"].type() == String && x["err"].String() == "unauthorized") { + errmsg = "not authorized, did you start with --keyFile?"; + return false; + } + if ( ! conn->simpleCommand( "config" , &x , "dbhash" ) ) x = BSONObj(); else { |