Permalink
Browse files

Merge branch 'master' of git@github.com:mongodb/mongo

  • Loading branch information...
2 parents 6a27f13 + 5d7f77d commit f69f94cbb4eed4a8b8cc49f32e0272d06e8e351f @erh erh committed Mar 22, 2010
Showing with 12 additions and 6 deletions.
  1. +3 −2 db/client.cpp
  2. +1 −1 db/client.h
  3. +8 −3 db/repl.cpp
View
@@ -93,14 +93,15 @@ namespace mongo {
BSONObj CurOp::_tooBig = fromjson("{\"$msg\":\"query not recording (too large)\"}");
AtomicUInt CurOp::_nextOpNum;
- Client::Context::Context( string ns , Database * db )
+ Client::Context::Context( string ns , Database * db, bool doauth )
: _client( currentClient.get() ) , _oldContext( _client->_context ) ,
_path( dbpath ) , _lock(0) , _justCreated(false) {
assert( db && db->isOk() );
_ns = ns;
_db = db;
_client->_context = this;
- _auth();
+ if ( doauth )
+ _auth();
}
void Client::Context::_finishInit( bool doauth ){
View
@@ -96,7 +96,7 @@ namespace mongo {
* if you are doing this after allowing a write there could be a race condition
* if someone closes that db. this checks that the DB is still valid
*/
- Context( string ns , Database * db );
+ Context( string ns , Database * db, bool doauth=true );
~Context();
View
@@ -1539,14 +1539,14 @@ namespace mongo {
Record *r;
if ( strncmp( logNS, "local.", 6 ) == 0 ) { // For now, assume this is olog main
if ( localOplogMainDetails == 0 ) {
- Client::Context ctx("local.");
+ Client::Context ctx("local.", dbpath, 0, false);
localOplogDB = ctx.db();
localOplogMainDetails = nsdetails(logNS);
}
- Client::Context ctx( "" , localOplogDB );
+ Client::Context ctx( "" , localOplogDB, false );
r = theDataFileMgr.fast_oplog_insert(localOplogMainDetails, logNS, len);
} else {
- Client::Context ctx( logNS );
+ Client::Context ctx( logNS, dbpath, 0, false );
assert( nsdetails( logNS ) );
r = theDataFileMgr.fast_oplog_insert( nsdetails( logNS ), logNS, len);
}
@@ -1718,6 +1718,10 @@ namespace mongo {
sleepsecs(4);
Client::initThread("replmaster");
while( 1 ) {
+ {
+ dblock lk;
+ cc().getAuthenticationInfo()->authorize("admin");
+ }
sleepsecs(10);
/* write a keep-alive like entry to the log. this will make things like
printReplicationStatus() and printSlaveReplicationStatus() stay up-to-date
@@ -1835,6 +1839,7 @@ namespace mongo {
{
dblock lk;
+ cc().getAuthenticationInfo()->authorize("admin");
pairSync->init();
}

0 comments on commit f69f94c

Please sign in to comment.