summaryrefslogtreecommitdiff
path: root/src/mongo/s/request.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2012-01-24 18:32:06 -0500
committerEliot Horowitz <eliot@10gen.com>2012-01-24 18:32:06 -0500
commit7fc7559750e36985407b5471de2d7136ded81354 (patch)
tree0be09f75f2ec14b3493efa4770df54ca963e5deb /src/mongo/s/request.cpp
parent1b329639d499f31cfd9ed1fda1328dbf7cbf09fb (diff)
downloadmongo-7fc7559750e36985407b5471de2d7136ded81354.tar.gz
fix killOp in mongos with or without auth SERVER-4251
Diffstat (limited to 'src/mongo/s/request.cpp')
-rw-r--r--src/mongo/s/request.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mongo/s/request.cpp b/src/mongo/s/request.cpp
index 96cce96685d..e8f2a36102d 100644
--- a/src/mongo/s/request.cpp
+++ b/src/mongo/s/request.cpp
@@ -45,12 +45,18 @@ namespace mongo {
_clientInfo->newRequest( p );
}
- void Request::checkAuth( Auth::Level levelNeeded ) const {
+ void Request::checkAuth( Auth::Level levelNeeded , const char * need ) const {
char cl[256];
- nsToDatabase(getns(), cl);
+
+ const char * use = cl;
+ if ( need )
+ use = need;
+ else
+ nsToDatabase(getns(), cl);
+
uassert( 15845 ,
- str::stream() << "unauthorized for db:" << cl << " level: " << levelNeeded ,
- _clientInfo->getAuthenticationInfo()->isAuthorizedForLevel(cl,levelNeeded) );
+ str::stream() << "unauthorized for db:" << use << " level: " << levelNeeded ,
+ _clientInfo->getAuthenticationInfo()->isAuthorizedForLevel(use,levelNeeded) );
}
void Request::init() {