diff options
author | Andy Schwerin <schwerin@10gen.com> | 2013-03-27 10:46:09 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@10gen.com> | 2013-03-28 14:47:51 -0400 |
commit | 2dc4f569adf4b66a2b9f4500de521c9cdf7ba73b (patch) | |
tree | 5a16bc76395154891ed8984470daa25bee1cab8c /src/mongo/db/commands/authentication_commands.cpp | |
parent | e72ca6c0f8998225a11c2514db10e7346f516e6c (diff) | |
download | mongo-2dc4f569adf4b66a2b9f4500de521c9cdf7ba73b.tar.gz |
SERVER-8983 Include AuthenticationFailed error code in failed MONGODB-CR authentications.
Diffstat (limited to 'src/mongo/db/commands/authentication_commands.cpp')
-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 e5192f9727d..8d3b498a54a 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" @@ -102,6 +103,7 @@ namespace mongo { if (dbname != StringData("local", StringData::LiteralTag()) || user != internalSecurity.user) { errmsg = _nonceAuthenticateCommandsDisabledMessage; + result.append(saslCommandCodeFieldName, ErrorCodes::AuthenticationFailed); return false; } } @@ -115,6 +117,7 @@ namespace mongo { << endl; errmsg = "auth fails"; sleepmillis(10); + result.append(saslCommandCodeFieldName, ErrorCodes::AuthenticationFailed); return false; } @@ -142,6 +145,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; } } @@ -153,6 +157,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(); @@ -173,6 +178,7 @@ namespace mongo { if ( key != computed ) { log() << "auth: key mismatch " << user << ", ns:" << dbname << endl; errmsg = "auth fails"; + result.append(saslCommandCodeFieldName, ErrorCodes::AuthenticationFailed); return false; } |