Skip to content

Commit

Permalink
sspi: Only call CompleteAuthToken() when complete is needed
Browse files Browse the repository at this point in the history
Don't call CompleteAuthToken() after InitializeSecurityContext() has
returned SEC_I_CONTINUE_NEEDED as this return code only indicates the
function should be called again after receiving a response back from
the server.

This only affected the Digest and NTLM authentication code.
  • Loading branch information
captain-caveman2k committed Oct 26, 2014
1 parent 382cee0 commit 9c613ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/curl_ntlm_msgs.c
Expand Up @@ -497,10 +497,10 @@ CURLcode Curl_ntlm_create_type1_message(const char *userp,
ntlm->context, &type_1_desc,
&attrs, &tsDummy);

if(status == SEC_I_COMPLETE_AND_CONTINUE ||
status == SEC_I_CONTINUE_NEEDED)
if(status == SEC_I_COMPLETE_NEEDED ||
status == SEC_I_COMPLETE_AND_CONTINUE)
s_pSecFn->CompleteAuthToken(ntlm->context, &type_1_desc);
else if(status != SEC_E_OK)
else if(status != SEC_E_OK && status != SEC_I_CONTINUE_NEEDED)
return CURLE_RECV_ERROR;

size = type_1_buf.cbBuffer;
Expand Down
6 changes: 3 additions & 3 deletions lib/curl_sasl_sspi.c
Expand Up @@ -232,10 +232,10 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
&chlg_desc, 0, &ctx,
&resp_desc, &attrs, &tsDummy);

if(status == SEC_I_COMPLETE_AND_CONTINUE ||
status == SEC_I_CONTINUE_NEEDED)
if(status == SEC_I_COMPLETE_NEEDED ||
status == SEC_I_COMPLETE_AND_CONTINUE)
s_pSecFn->CompleteAuthToken(&handle, &resp_desc);
else if(status != SEC_E_OK) {
else if(status != SEC_E_OK && status != SEC_I_CONTINUE_NEEDED) {
s_pSecFn->FreeCredentialsHandle(&handle);
Curl_sspi_free_identity(&identity);
Curl_safefree(spn);
Expand Down

0 comments on commit 9c613ad

Please sign in to comment.