summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorsamantharitter <samantha.ritter@10gen.com>2015-08-10 18:37:35 -0400
committersamantharitter <samantha.ritter@10gen.com>2015-08-12 17:37:30 -0400
commitda780777b278314d7820483882af014b7b773547 (patch)
treefda19acf3eb7bb2dc65ecdd61d9792adae90d9a2 /src/mongo/db
parent2482d4387b6a0fcdf825e07d7f5260041a89f3f6 (diff)
downloadmongo-da780777b278314d7820483882af014b7b773547.tar.gz
SERVER-19155 Remove authcommon target's dependency on DBClientWithCommands
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/auth/SConscript2
-rw-r--r--src/mongo/db/auth/internal_user_auth.cpp21
-rw-r--r--src/mongo/db/auth/internal_user_auth.h8
-rw-r--r--src/mongo/db/cloner.cpp2
-rw-r--r--src/mongo/db/repl/isself.cpp2
-rw-r--r--src/mongo/db/repl/oplogreader.cpp2
-rw-r--r--src/mongo/db/repl/sync_source_feedback.cpp2
7 files changed, 4 insertions, 35 deletions
diff --git a/src/mongo/db/auth/SConscript b/src/mongo/db/auth/SConscript
index 35e0228e737..d5c41e4c8fb 100644
--- a/src/mongo/db/auth/SConscript
+++ b/src/mongo/db/auth/SConscript
@@ -46,8 +46,6 @@ env.Library('authcommon',
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/bson/mutable/mutable_bson',
'$BUILD_DIR/mongo/bson/util/bson_extract',
- '$BUILD_DIR/mongo/client/clientdriver',
- '$BUILD_DIR/mongo/db/server_options_core',
])
env.Library('authorization_manager_global',
diff --git a/src/mongo/db/auth/internal_user_auth.cpp b/src/mongo/db/auth/internal_user_auth.cpp
index 8d00592734d..77d01a31b58 100644
--- a/src/mongo/db/auth/internal_user_auth.cpp
+++ b/src/mongo/db/auth/internal_user_auth.cpp
@@ -34,8 +34,6 @@
#include "mongo/bson/mutable/document.h"
#include "mongo/bson/mutable/element.h"
-#include "mongo/client/dbclientinterface.h"
-#include "mongo/db/server_options.h"
#include "mongo/util/log.h"
namespace mongo {
@@ -87,23 +85,4 @@ BSONObj getInternalUserAuthParamsWithFallback() {
return authParams.copy();
}
-bool authenticateInternalUser(DBClientWithCommands* conn) {
- if (!isInternalAuthSet()) {
- if (!serverGlobalParams.quiet) {
- log() << "ERROR: No authentication parameters set for internal user";
- }
- return false;
- }
-
- try {
- conn->auth(getInternalUserAuthParamsWithFallback());
- return true;
- } catch (const UserException& ex) {
- if (!serverGlobalParams.quiet) {
- log() << "can't authenticate to " << conn->toString()
- << " as internal user, error: " << ex.what();
- }
- return false;
- }
-}
} // namespace mongo
diff --git a/src/mongo/db/auth/internal_user_auth.h b/src/mongo/db/auth/internal_user_auth.h
index cff260f1bf4..6bec9404985 100644
--- a/src/mongo/db/auth/internal_user_auth.h
+++ b/src/mongo/db/auth/internal_user_auth.h
@@ -30,7 +30,6 @@
namespace mongo {
class BSONObj;
-class DBClientWithCommands;
/**
* @return true if internal authentication parameters has been set up
@@ -53,11 +52,4 @@ void setInternalUserAuthParams(const BSONObj& authParamsIn);
* returned.
**/
BSONObj getInternalUserAuthParamsWithFallback();
-
-/**
-* Authenticates to another cluster member using appropriate authentication data.
-* Uses getInternalUserAuthParams() to retrive authentication parameters.
-* @return true if the authentication was succesful
-*/
-bool authenticateInternalUser(DBClientWithCommands* conn);
} // namespace mongo
diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp
index ed20360dbd7..04b53a8ed1b 100644
--- a/src/mongo/db/cloner.cpp
+++ b/src/mongo/db/cloner.cpp
@@ -506,7 +506,7 @@ Status Cloner::copyDb(OperationContext* txn,
}
if (getGlobalAuthorizationManager()->isAuthEnabled() &&
- !authenticateInternalUser(con.get())) {
+ !con->authenticateInternalUser()) {
return Status(ErrorCodes::AuthenticationFailed,
"Unable to authenticate as internal user");
}
diff --git a/src/mongo/db/repl/isself.cpp b/src/mongo/db/repl/isself.cpp
index 39ddfbc037f..a4fc217481d 100644
--- a/src/mongo/db/repl/isself.cpp
+++ b/src/mongo/db/repl/isself.cpp
@@ -203,7 +203,7 @@ bool isSelf(const HostAndPort& hostAndPort) {
}
if (getGlobalAuthorizationManager()->isAuthEnabled() && isInternalAuthSet()) {
- if (!authenticateInternalUser(&conn)) {
+ if (!conn.authenticateInternalUser()) {
return false;
}
}
diff --git a/src/mongo/db/repl/oplogreader.cpp b/src/mongo/db/repl/oplogreader.cpp
index 0a94ba73e87..1332e6f7542 100644
--- a/src/mongo/db/repl/oplogreader.cpp
+++ b/src/mongo/db/repl/oplogreader.cpp
@@ -73,7 +73,7 @@ bool replAuthenticate(DBClientBase* conn) {
if (!isInternalAuthSet())
return false;
- return authenticateInternalUser(conn);
+ return conn->authenticateInternalUser();
}
const Seconds OplogReader::kSocketTimeout(30);
diff --git a/src/mongo/db/repl/sync_source_feedback.cpp b/src/mongo/db/repl/sync_source_feedback.cpp
index b8e137810c0..74450f5ac32 100644
--- a/src/mongo/db/repl/sync_source_feedback.cpp
+++ b/src/mongo/db/repl/sync_source_feedback.cpp
@@ -71,7 +71,7 @@ bool SyncSourceFeedback::replAuthenticate() {
if (!isInternalAuthSet())
return false;
- return authenticateInternalUser(_connection.get());
+ return _connection->authenticateInternalUser();
}
bool SyncSourceFeedback::_connect(OperationContext* txn, const HostAndPort& host) {