summaryrefslogtreecommitdiff
path: root/s
diff options
context:
space:
mode:
authorKristina <kristina@10gen.com>2011-08-18 11:25:58 -0400
committerKristina <kristina@10gen.com>2011-08-18 11:25:58 -0400
commit93ce4de477c610b8ba667b22b72121bd00a40d0b (patch)
treee8b0553c3c83f2ee5c3dc5752bda10bc6a5d2ff9 /s
parent5bd3f44d5ce76fb44a83e8e278c062c83e5ccaa0 (diff)
downloadmongo-93ce4de477c610b8ba667b22b72121bd00a40d0b.tar.gz
do not start mongos without checking auth SERVER-3587
Diffstat (limited to 's')
-rw-r--r--s/config.cpp9
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 {