diff options
author | Andy Schwerin <schwerin@10gen.com> | 2013-03-27 10:46:09 -0400 |
---|---|---|
committer | Dan Pasette <dan@10gen.com> | 2013-03-28 19:11:38 -0400 |
commit | 7f45f0fe14b9ffd64b6e75a9fe87d49c66a17b83 (patch) | |
tree | fc0bcc74ddf3be2c8ec3a7d6b351ddcb29ed32c7 | |
parent | 4f26c3137e67ba98b4160c40d95c053b5905a9fe (diff) | |
download | mongo-7f45f0fe14b9ffd64b6e75a9fe87d49c66a17b83.tar.gz |
SERVER-8983 Include AuthenticationFailed error code in failed MONGODB-CR authentications.
-rw-r--r-- | src/mongo/db/commands/authentication_commands.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/db/commands/authentication_commands.cpp b/src/mongo/db/commands/authentication_commands.cpp index 479ab225027..bcc5a2f16a0 100644 --- a/src/mongo/db/commands/authentication_commands.cpp +++ b/src/mongo/db/commands/authentication_commands.cpp @@ -21,6 +21,7 @@ #include <vector> #include "mongo/base/status.h" +#include "mongo/client/sasl_client_authenticate.h" #include "mongo/db/auth/action_set.h" #include "mongo/db/auth/action_type.h" #include "mongo/db/auth/authorization_manager.h" @@ -103,6 +104,7 @@ namespace mongo { if (dbname != StringData("local", StringData::LiteralTag()) || user != internalSecurity.user) { errmsg = _nonceAuthenticateCommandsDisabledMessage; + result.append(saslCommandCodeFieldName, ErrorCodes::AuthenticationFailed); return false; } } @@ -116,6 +118,7 @@ namespace mongo { << endl; errmsg = "auth fails"; sleepmillis(10); + result.append(saslCommandCodeFieldName, ErrorCodes::AuthenticationFailed); return false; } @@ -143,6 +146,7 @@ namespace mongo { log() << "auth: bad nonce received or getnonce not called. could be a driver bug or a security attack. db:" << dbname << endl; errmsg = "auth fails"; sleepmillis(30); + result.append(saslCommandCodeFieldName, ErrorCodes::AuthenticationFailed); return false; } } @@ -154,6 +158,7 @@ namespace mongo { if (!status.isOK()) { log() << status.reason() << std::endl; errmsg = "auth fails"; + result.append(saslCommandCodeFieldName, ErrorCodes::AuthenticationFailed); return false; } pwd = userObj["pwd"].String(); @@ -174,6 +179,7 @@ namespace mongo { if ( key != computed ) { log() << "auth: key mismatch " << user << ", ns:" << dbname << endl; errmsg = "auth fails"; + result.append(saslCommandCodeFieldName, ErrorCodes::AuthenticationFailed); return false; } |