summaryrefslogtreecommitdiff
path: root/s
diff options
context:
space:
mode:
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 {