summaryrefslogtreecommitdiff
path: root/Utilities/cmcurl/lib/vauth/spnego_sspi.c
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:20:10 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:20:10 +0900
commitf58f7a233a9b66287e1a0fad0d149e3202a098b4 (patch)
treecc0cea82fae3f153df9299b27650e17c58da1125 /Utilities/cmcurl/lib/vauth/spnego_sspi.c
parent46f8b5215bbbfcf4bc0caed1daf52b678fd2b976 (diff)
downloadcmake-f58f7a233a9b66287e1a0fad0d149e3202a098b4.tar.gz
cmake-f58f7a233a9b66287e1a0fad0d149e3202a098b4.tar.bz2
cmake-f58f7a233a9b66287e1a0fad0d149e3202a098b4.zip
Imported Upstream version 3.18.0upstream/3.18.0
Diffstat (limited to 'Utilities/cmcurl/lib/vauth/spnego_sspi.c')
-rw-r--r--Utilities/cmcurl/lib/vauth/spnego_sspi.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/Utilities/cmcurl/lib/vauth/spnego_sspi.c b/Utilities/cmcurl/lib/vauth/spnego_sspi.c
index 4b21cc769..194f250f8 100644
--- a/Utilities/cmcurl/lib/vauth/spnego_sspi.c
+++ b/Utilities/cmcurl/lib/vauth/spnego_sspi.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -59,6 +59,12 @@ bool Curl_auth_is_spnego_supported(void)
TEXT(SP_NAME_NEGOTIATE),
&SecurityPackage);
+ /* Release the package buffer as it is not required anymore */
+ if(status == SEC_E_OK) {
+ s_pSecFn->FreeContextBuffer(SecurityPackage);
+ }
+
+
return (status == SEC_E_OK ? TRUE : FALSE);
}
@@ -123,8 +129,10 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
nego->status = s_pSecFn->QuerySecurityPackageInfo((TCHAR *)
TEXT(SP_NAME_NEGOTIATE),
&SecurityPackage);
- if(nego->status != SEC_E_OK)
- return CURLE_NOT_BUILT_IN;
+ if(nego->status != SEC_E_OK) {
+ failf(data, "SSPI: couldn't get auth info\n");
+ return CURLE_AUTH_ERROR;
+ }
nego->token_max = SecurityPackage->cbMaxToken;
@@ -165,7 +173,7 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
nego->p_identity, NULL, NULL,
nego->credentials, &expiry);
if(nego->status != SEC_E_OK)
- return CURLE_LOGIN_DENIED;
+ return CURLE_AUTH_ERROR;
/* Allocate our new context handle */
nego->context = calloc(1, sizeof(CtxtHandle));
@@ -251,14 +259,25 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
char buffer[STRERROR_LEN];
failf(data, "InitializeSecurityContext failed: %s",
Curl_sspi_strerror(nego->status, buffer, sizeof(buffer)));
- return CURLE_OUT_OF_MEMORY;
+
+ if(nego->status == (DWORD)SEC_E_INSUFFICIENT_MEMORY)
+ return CURLE_OUT_OF_MEMORY;
+
+ return CURLE_AUTH_ERROR;
}
if(nego->status == SEC_I_COMPLETE_NEEDED ||
nego->status == SEC_I_COMPLETE_AND_CONTINUE) {
nego->status = s_pSecFn->CompleteAuthToken(nego->context, &resp_desc);
if(GSS_ERROR(nego->status)) {
- return CURLE_RECV_ERROR;
+ char buffer[STRERROR_LEN];
+ failf(data, "CompleteAuthToken failed: %s",
+ Curl_sspi_strerror(nego->status, buffer, sizeof(buffer)));
+
+ if(nego->status == (DWORD)SEC_E_INSUFFICIENT_MEMORY)
+ return CURLE_OUT_OF_MEMORY;
+
+ return CURLE_AUTH_ERROR;
}
}