diff options
Diffstat (limited to 'src/mongo/client/authenticate.cpp')
-rw-r--r-- | src/mongo/client/authenticate.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/client/authenticate.cpp b/src/mongo/client/authenticate.cpp index 3fb41a28b27..66414275cb6 100644 --- a/src/mongo/client/authenticate.cpp +++ b/src/mongo/client/authenticate.cpp @@ -283,22 +283,24 @@ Future<std::string> negotiateSaslMechanism(RunCommandHook runCommand, } Future<void> authenticateInternalClient(const std::string& clientSubjectName, + const HostAndPort& remote, boost::optional<std::string> mechanismHint, RunCommandHook runCommand) { return negotiateSaslMechanism(runCommand, internalSecurity.user->getName(), mechanismHint) - .then([runCommand, clientSubjectName](std::string mechanism) -> Future<void> { + .then([runCommand, clientSubjectName, remote](std::string mechanism) -> Future<void> { auto params = getInternalAuthParams(0, mechanism); if (params.isEmpty()) { return Status(ErrorCodes::BadValue, "Missing authentication parameters for internal user auth"); } - return authenticateClient(params, HostAndPort(), clientSubjectName, runCommand) + return authenticateClient(params, remote, clientSubjectName, runCommand) .onError<ErrorCodes::AuthenticationFailed>( - [runCommand, clientSubjectName, mechanism](Status status) -> Future<void> { + [runCommand, clientSubjectName, remote, mechanism]( + Status status) -> Future<void> { auto altCreds = getInternalAuthParams(1, mechanism); if (!altCreds.isEmpty()) { return authenticateClient( - altCreds, HostAndPort(), clientSubjectName, runCommand); + altCreds, remote, clientSubjectName, runCommand); } return status; }); |