summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@10gen.com>2013-10-06 13:47:22 -0400
committerAndy Schwerin <schwerin@10gen.com>2013-10-06 16:25:25 -0400
commit3a122656855ca33ee3ee84744b6d413ed30ade04 (patch)
tree3073cec68964d7553fc882d472094c8466c41148 /src/mongo/db/repl
parent4f481600f817f5d3c6d2c1cee74e3c133c453681 (diff)
downloadmongo-3a122656855ca33ee3ee84744b6d413ed30ade04.tar.gz
SERVER-10670 Make isAuthEnabled a member rather than static function of AuthorizationManager.
It should have been from the beginning, and fixing it makes it easier to write tests.
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r--src/mongo/db/repl/connections.h3
-rw-r--r--src/mongo/db/repl/oplogreader.cpp8
-rw-r--r--src/mongo/db/repl/rs.cpp2
-rw-r--r--src/mongo/db/repl/sync_source_feedback.cpp6
4 files changed, 12 insertions, 7 deletions
diff --git a/src/mongo/db/repl/connections.h b/src/mongo/db/repl/connections.h
index de564345e38..d0ae0411971 100644
--- a/src/mongo/db/repl/connections.h
+++ b/src/mongo/db/repl/connections.h
@@ -33,6 +33,7 @@
#include <map>
#include "mongo/db/auth/authorization_manager.h"
+#include "mongo/db/auth/authorization_manager_global.h"
#include "mongo/db/auth/security_key.h"
#include "mongo/db/repl/rs.h" // extern Tee* rslog
@@ -140,7 +141,7 @@ namespace mongo {
// or our key file has to change. if our key file has to change, we'll
// be rebooting. if their file has to change, they'll be rebooted so the
// connection created above will go dead, reconnect, and reauth.
- if (AuthorizationManager::isAuthEnabled()) {
+ if (getGlobalAuthorizationManager()->isAuthEnabled()) {
return authenticateInternalUser(connInfo->cc.get());
}
diff --git a/src/mongo/db/repl/oplogreader.cpp b/src/mongo/db/repl/oplogreader.cpp
index b7c2034c70a..7290c73685a 100644
--- a/src/mongo/db/repl/oplogreader.cpp
+++ b/src/mongo/db/repl/oplogreader.cpp
@@ -33,6 +33,8 @@
#include "mongo/base/counter.h"
#include "mongo/client/dbclientinterface.h"
+#include "mongo/db/auth/authorization_manager.h"
+#include "mongo/db/auth/authorization_manager_global.h"
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/commands/server_status.h"
#include "mongo/db/auth/security_key.h"
@@ -55,7 +57,7 @@ namespace mongo {
static const BSONObj userReplQuery = fromjson("{\"user\":\"repl\"}");
bool replAuthenticate(DBClientBase *conn) {
- if (!AuthorizationManager::isAuthEnabled())
+ if (!getGlobalAuthorizationManager()->isAuthEnabled())
return true;
if (!isInternalAuthSet())
@@ -97,7 +99,9 @@ namespace mongo {
tcp_timeout));
string errmsg;
if ( !_conn->connect(hostName.c_str(), errmsg) ||
- (AuthorizationManager::isAuthEnabled() && !replAuthenticate(_conn.get())) ) {
+ (getGlobalAuthorizationManager()->isAuthEnabled() &&
+ !replAuthenticate(_conn.get())) ) {
+
resetConnection();
log() << "repl: " << errmsg << endl;
return false;
diff --git a/src/mongo/db/repl/rs.cpp b/src/mongo/db/repl/rs.cpp
index 02a41334784..76c5c044ca4 100644
--- a/src/mongo/db/repl/rs.cpp
+++ b/src/mongo/db/repl/rs.cpp
@@ -926,8 +926,6 @@ namespace mongo {
}
void replLocalAuth() {
- if (!AuthorizationManager::isAuthEnabled())
- return;
cc().getAuthorizationSession()->grantInternalAuthorization();
}
diff --git a/src/mongo/db/repl/sync_source_feedback.cpp b/src/mongo/db/repl/sync_source_feedback.cpp
index c80e34f861a..6210ada12fd 100644
--- a/src/mongo/db/repl/sync_source_feedback.cpp
+++ b/src/mongo/db/repl/sync_source_feedback.cpp
@@ -30,6 +30,8 @@
#include "mongo/client/constants.h"
#include "mongo/client/dbclientcursor.h"
+#include "mongo/db/auth/authorization_manager.h"
+#include "mongo/db/auth/authorization_manager_global.h"
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/auth/security_key.h"
#include "mongo/db/dbhelpers.h"
@@ -50,7 +52,7 @@ namespace mongo {
}
bool SyncSourceFeedback::replAuthenticate() {
- if (!AuthorizationManager::isAuthEnabled())
+ if (!getGlobalAuthorizationManager()->isAuthEnabled())
return true;
if (!isInternalAuthSet())
@@ -150,7 +152,7 @@ namespace mongo {
_connection.reset(new DBClientConnection(false, 0, OplogReader::tcp_timeout));
string errmsg;
if (!_connection->connect(hostName.c_str(), errmsg) ||
- (AuthorizationManager::isAuthEnabled() && !replAuthenticate())) {
+ (getGlobalAuthorizationManager()->isAuthEnabled() && !replAuthenticate())) {
resetConnection();
log() << "repl: " << errmsg << endl;
return false;