summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2019-12-12 18:05:45 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-27 19:34:50 +0000
commita04ac059ae692aadc28ba77e61c97a23d0ed2069 (patch)
tree12615a46e332ab0b1c440b50f3bea87c761f9fb8
parent24efa5a2afeaad495a2317c09b229c35216a9dbe (diff)
downloadmongo-a04ac059ae692aadc28ba77e61c97a23d0ed2069.tar.gz
SERVER-45050 Change Windows Kerberos client to use default credentials when no password is specified
-rw-r--r--src/mongo/client/sasl_sspi.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mongo/client/sasl_sspi.cpp b/src/mongo/client/sasl_sspi.cpp
index 28c5be43926..578e51ce616 100644
--- a/src/mongo/client/sasl_sspi.cpp
+++ b/src/mongo/client/sasl_sspi.cpp
@@ -171,15 +171,16 @@ int sspiClientMechNew(void* glob_context,
std::unique_ptr<SspiConnContext> pcctx(new SspiConnContext());
pcctx->userPlusRealm = userPlusRealm;
TimeStamp ignored;
- SECURITY_STATUS status = AcquireCredentialsHandleW(NULL, // principal
- const_cast<LPWSTR>(L"kerberos"),
- SECPKG_CRED_OUTBOUND,
- NULL, // LOGON id
- &authIdentity, // auth data
- NULL, // get key fn
- NULL, // get key arg
- &pcctx->cred,
- &ignored);
+ SECURITY_STATUS status =
+ AcquireCredentialsHandleW(NULL, // principal
+ const_cast<LPWSTR>(L"kerberos"),
+ SECPKG_CRED_OUTBOUND,
+ NULL, // LOGON id
+ authIdentity.Password ? &authIdentity : NULL, // auth data
+ NULL, // get key fn
+ NULL, // get key arg
+ &pcctx->cred,
+ &ignored);
if (status != SEC_E_OK) {
HandleLastError(cparams->utils, status, "AcquireCredentialsHandle");
return SASL_FAIL;