diff options
author | Antonin Kral <a.kral@bobek.cz> | 2012-06-05 19:50:36 +0200 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2012-06-05 19:50:36 +0200 |
commit | 291c9687fb2307dc22d1f269eb4d0aa98fe8cadc (patch) | |
tree | f46fac7bf8530d100aa55da89dfaa53490fbb350 /db/dbwebserver.cpp | |
parent | 6d0f215499dda50fdba4a6f60ab359efe0054e0d (diff) | |
parent | 3703a282eca7e79e91f4bd651b1b861b76dc6c68 (diff) | |
download | mongodb-291c9687fb2307dc22d1f269eb4d0aa98fe8cadc.tar.gz |
Merge tag 'upstream/2.0.6'
Upstream version 2.0.6
Diffstat (limited to 'db/dbwebserver.cpp')
-rw-r--r-- | db/dbwebserver.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/db/dbwebserver.cpp b/db/dbwebserver.cpp index 78c09c0..eb19ba3 100644 --- a/db/dbwebserver.cpp +++ b/db/dbwebserver.cpp @@ -79,11 +79,10 @@ namespace mongo { } bool allowed( const char * rq , vector<string>& headers, const SockAddr &from ) { - if ( from.isLocalHost() ) - return true; - - if ( ! _webUsers->haveAdminUsers() ) + if ( from.isLocalHost() || !_webUsers->haveAdminUsers() ) { + cmdAuthenticate.authenticate( "admin", "RestUser", false ); return true; + } string auth = getHeader( rq , "Authorization" ); @@ -118,8 +117,10 @@ namespace mongo { r << ha2; string r1 = md5simpledigest( r.str() ); - if ( r1 == parms["response"] ) + if ( r1 == parms["response"] ) { + cmdAuthenticate.authenticate( "admin", user["user"].str(), user[ "readOnly" ].isBoolean() && user[ "readOnly" ].boolean() ); return true; + } } } |