summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2012-01-17 01:10:31 -0500
committerEliot Horowitz <eliot@10gen.com>2012-01-17 01:11:08 -0500
commit68e305862aad6c618211d4e100768a62834d6d2a (patch)
tree7c982e2320e59e42f60fc2a1e7b0e2d128c9efce
parent0b38e1009b7e43b84fd791cfc58bf83fb3c6d0eb (diff)
downloadmongo-68e305862aad6c618211d4e100768a62834d6d2a.tar.gz
fix getLog auth SERVER-4695
-rw-r--r--db/dbcommands_generic.cpp2
-rw-r--r--jstests/auth/auth1.js8
2 files changed, 9 insertions, 1 deletions
diff --git a/db/dbcommands_generic.cpp b/db/dbcommands_generic.cpp
index 22cee2270d0..c62357499ed 100644
--- a/db/dbcommands_generic.cpp
+++ b/db/dbcommands_generic.cpp
@@ -334,7 +334,7 @@ namespace mongo {
virtual bool slaveOk() const { return true; }
virtual LockType locktype() const { return NONE; }
- virtual bool requiresAuth() { return false; }
+ virtual bool requiresAuth() { return true; }
virtual bool adminOnly() const { return true; }
virtual void help( stringstream& help ) const {
diff --git a/jstests/auth/auth1.js b/jstests/auth/auth1.js
index c83708555f7..8639202fd92 100644
--- a/jstests/auth/auth1.js
+++ b/jstests/auth/auth1.js
@@ -16,6 +16,14 @@ db.addUser( "eliot" , "eliot" );
db.addUser( "guest" , "guest", true );
db.getSisterDB( "admin" ).addUser( "super", "super" );
+print("make sure we can't run certain commands w/out auth");
+var errmsg = "need to login";
+res = db.adminCommand({getLog : "global"});
+printjson( res );
+assert( ! res.log || res.log.length == 0 , "getLog should fail: " + tojson( res ) )
+assert.eq( res.errmsg , "need to login" , tojson( res ) );
+
+
assert.throws( function() { t.findOne() }, [], "read without login" );
assert( db.auth( "eliot" , "eliot" ) , "auth failed" );