summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Nilsson <andreas.nilsson@10gen.com>2014-11-03 12:56:39 -0500
committerAndreas Nilsson <andreas.nilsson@10gen.com>2014-11-03 12:58:11 -0500
commit4026a60ee751a5190efb893539f65381bf173bc7 (patch)
treeaba5e2d8c4e5d10c4ad532b9d182ba18587c8bc5 /src
parent1bb29da08f761b4ed79c8bb1cacb74aaec702530 (diff)
downloadmongo-4026a60ee751a5190efb893539f65381bf173bc7.tar.gz
SERVER-15684 Make copydb from localhost not call auth
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/commands/copydb.cpp1
-rw-r--r--src/mongo/shell/db.js4
2 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/db/commands/copydb.cpp b/src/mongo/db/commands/copydb.cpp
index d5e4d62a619..f360efa3e24 100644
--- a/src/mongo/db/commands/copydb.cpp
+++ b/src/mongo/db/commands/copydb.cpp
@@ -179,6 +179,7 @@ namespace mongo {
}
else if (cmdObj.hasField(saslCommandConversationIdFieldName) &&
cmdObj.hasField(saslCommandPayloadFieldName)) {
+ uassert( 25487, "must call copydbsaslstart first", authConn_.get() );
BSONObj ret;
if ( !authConn_->runCommand( cloneOptions.fromDB,
BSON( "saslContinue" << 1 <<
diff --git a/src/mongo/shell/db.js b/src/mongo/shell/db.js
index 896597f268b..e43bb4f0de8 100644
--- a/src/mongo/shell/db.js
+++ b/src/mongo/shell/db.js
@@ -269,8 +269,8 @@ DB.prototype.copyDatabase = function(fromdb, todb, fromhost, username, password)
var mechanism = this._getDefaultAuthenticationMechanism();
assert(mechanism == "SCRAM-SHA-1" || mechanism == "MONGODB-CR");
- // Check for no auth
- if (!username || !password) {
+ // Check for no auth or copying from localhost
+ if (!username || !password || fromhost == "") {
return this._adminCommand( { copydb:1, fromhost:fromhost, fromdb:fromdb, todb:todb } );
}