summaryrefslogtreecommitdiff
path: root/db/repl
diff options
context:
space:
mode:
authorKristina <kristina@10gen.com>2010-12-27 16:05:40 -0500
committerKristina <kristina@10gen.com>2010-12-27 16:07:33 -0500
commitfbf7b90a1eac4b93180ecc2cf02ae8daadc5d7b3 (patch)
treed921ef4c2b85babac895d16b045d8187a7d58311 /db/repl
parent9a8dda83d13938e981194a87a5e60bdf2d623f50 (diff)
downloadmongo-fbf7b90a1eac4b93180ecc2cf02ae8daadc5d7b3.tar.gz
rs auth
Diffstat (limited to 'db/repl')
-rw-r--r--db/repl/connections.h11
-rw-r--r--db/repl/rs.cpp3
-rw-r--r--db/repl/rs_sync.cpp3
3 files changed, 16 insertions, 1 deletions
diff --git a/db/repl/connections.h b/db/repl/connections.h
index 682aea4afdf..428b8302491 100644
--- a/db/repl/connections.h
+++ b/db/repl/connections.h
@@ -20,6 +20,7 @@
#include <map>
#include "../../client/dbclient.h"
+#include "../security_key.h"
namespace mongo {
@@ -96,7 +97,15 @@ namespace mongo {
// we already locked above...
string err;
- x->cc.connect(hostport, err);
+ if (!x->cc.connect(hostport, err)) {
+ log() << "couldn't connect to " << hostport << ": " << err << rsLog;
+ return;
+ }
+
+ if (!noauth && !x->cc.auth("local", internalSecurity.user, internalSecurity.pwd, err, false)) {
+ log() << "could not authenticate against " << conn()->toString() << ", " << err << rsLog;
+ return;
+ }
}
inline ScopedConn::~ScopedConn() {
diff --git a/db/repl/rs.cpp b/db/repl/rs.cpp
index 88d66c2b47b..ed0eb3b18c5 100644
--- a/db/repl/rs.cpp
+++ b/db/repl/rs.cpp
@@ -645,6 +645,9 @@ namespace mongo {
assert(!replSet);
return;
}
+ if( !noauth ) {
+ cc().getAuthenticationInfo()->authorize("local");
+ }
(theReplSet = new ReplSet(*replSetCmdline))->go();
}
catch(std::exception& e) {
diff --git a/db/repl/rs_sync.cpp b/db/repl/rs_sync.cpp
index 80ed4a8875b..0c0811fdf4a 100644
--- a/db/repl/rs_sync.cpp
+++ b/db/repl/rs_sync.cpp
@@ -493,6 +493,9 @@ namespace mongo {
Client::initThread("replica set sync");
cc().iAmSyncThread();
+ if (!noauth) {
+ cc().getAuthenticationInfo()->authorize("local");
+ }
theReplSet->syncThread();
cc().shutdown();
}