diff options
author | Mathias Stearn <mathias@10gen.com> | 2018-01-16 13:00:48 -0500 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2018-01-17 17:10:47 -0500 |
commit | daf6c4714b45aeb8ba1a09380135b3267c4cc280 (patch) | |
tree | c436a157d25ccb13f91746ba4e099a6396462115 /src/mongo/client/sasl_client_authenticate_impl.cpp | |
parent | 4dc36c7ccb6b5b8f7d865993b5d648fe6dc4b7c7 (diff) | |
download | mongo-daf6c4714b45aeb8ba1a09380135b3267c4cc280.tar.gz |
SERVER-32617 Fix code that reconstructs status with just code and string
Diffstat (limited to 'src/mongo/client/sasl_client_authenticate_impl.cpp')
-rw-r--r-- | src/mongo/client/sasl_client_authenticate_impl.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/mongo/client/sasl_client_authenticate_impl.cpp b/src/mongo/client/sasl_client_authenticate_impl.cpp index d4755a22775..8ea87b55794 100644 --- a/src/mongo/client/sasl_client_authenticate_impl.cpp +++ b/src/mongo/client/sasl_client_authenticate_impl.cpp @@ -212,15 +212,9 @@ void asyncSaslConversation(auth::RunCommandHook runCommand, } auto serverResponse = response.data.getOwned(); - auto code = getStatusFromCommandResult(serverResponse).code(); - - // Server versions 2.3.2 and earlier may return "ok: 1" with a non-zero - // "code" field, indicating a failure. Subsequent versions should - // return "ok: 0" on failure with a non-zero "code" field to indicate specific - // failure. In all versions, either (ok: 1, code: > 0) or (ok: 0, code optional) - // indicate failure. - if (code != ErrorCodes::OK) { - return handler({code, serverResponse[saslCommandErrmsgFieldName].str()}); + auto status = getStatusFromCommandResult(serverResponse); + if (!status.isOK()) { + return handler(status); } // Exit if we have finished |