1
0
mirror of https://github.com/moparisthebest/curl synced 2025-03-01 01:41:50 -05:00

sasl: Tidy up to rename SPN variable from URI

This commit is contained in:
Steve Holme 2014-08-09 17:32:12 +01:00
parent ff5dcb8df2
commit d01e30431c

View File

@ -441,7 +441,7 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
char nonceCount[] = "00000001"; char nonceCount[] = "00000001";
char method[] = "AUTHENTICATE"; char method[] = "AUTHENTICATE";
char qop[] = DIGEST_QOP_VALUE_STRING_AUTH; char qop[] = DIGEST_QOP_VALUE_STRING_AUTH;
char *uri = NULL; char *spn = NULL;
/* Decode the challange message */ /* Decode the challange message */
result = sasl_decode_digest_md5_message(chlg64, nonce, sizeof(nonce), result = sasl_decode_digest_md5_message(chlg64, nonce, sizeof(nonce),
@ -506,15 +506,15 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
for(i = 0; i < MD5_DIGEST_LEN; i++) for(i = 0; i < MD5_DIGEST_LEN; i++)
snprintf(&HA1_hex[2 * i], 3, "%02x", digest[i]); snprintf(&HA1_hex[2 * i], 3, "%02x", digest[i]);
/* Prepare the URL string */ /* Generate our SPN */
uri = Curl_sasl_build_spn(service, realm); spn = Curl_sasl_build_spn(service, realm);
if(!uri) if(!spn)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
/* Calculate H(A2) */ /* Calculate H(A2) */
ctxt = Curl_MD5_init(Curl_DIGEST_MD5); ctxt = Curl_MD5_init(Curl_DIGEST_MD5);
if(!ctxt) { if(!ctxt) {
Curl_safefree(uri); Curl_safefree(spn);
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
} }
@ -522,8 +522,8 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
Curl_MD5_update(ctxt, (const unsigned char *) method, Curl_MD5_update(ctxt, (const unsigned char *) method,
curlx_uztoui(strlen(method))); curlx_uztoui(strlen(method)));
Curl_MD5_update(ctxt, (const unsigned char *) ":", 1); Curl_MD5_update(ctxt, (const unsigned char *) ":", 1);
Curl_MD5_update(ctxt, (const unsigned char *) uri, Curl_MD5_update(ctxt, (const unsigned char *) spn,
curlx_uztoui(strlen(uri))); curlx_uztoui(strlen(spn)));
Curl_MD5_final(ctxt, digest); Curl_MD5_final(ctxt, digest);
for(i = 0; i < MD5_DIGEST_LEN; i++) for(i = 0; i < MD5_DIGEST_LEN; i++)
@ -532,7 +532,7 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
/* Now calculate the response hash */ /* Now calculate the response hash */
ctxt = Curl_MD5_init(Curl_DIGEST_MD5); ctxt = Curl_MD5_init(Curl_DIGEST_MD5);
if(!ctxt) { if(!ctxt) {
Curl_safefree(uri); Curl_safefree(spn);
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
} }
@ -564,7 +564,7 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
"cnonce=\"%s\",nc=\"%s\",digest-uri=\"%s\",response=%s," "cnonce=\"%s\",nc=\"%s\",digest-uri=\"%s\",response=%s,"
"qop=%s", "qop=%s",
userp, realm, nonce, userp, realm, nonce,
cnonce, nonceCount, uri, resp_hash_hex, qop); cnonce, nonceCount, spn, resp_hash_hex, qop);
if(!response) if(!response)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
@ -572,11 +572,11 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
result = Curl_base64_encode(data, response, 0, outptr, outlen); result = Curl_base64_encode(data, response, 0, outptr, outlen);
Curl_safefree(response); Curl_safefree(response);
Curl_safefree(uri); Curl_safefree(spn);
return result; return result;
} }
#endif /* USE_WINDOWS_SSPI */ #endif /* !USE_WINDOWS_SSPI */
#endif /* CURL_DISABLE_CRYPTO_AUTH */ #endif /* CURL_DISABLE_CRYPTO_AUTH */