Loading lib/curl_sasl.c +17 −10 Original line number Original line Diff line number Diff line Loading @@ -246,7 +246,7 @@ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data, /* Finalise the digest */ /* Finalise the digest */ Curl_HMAC_final(ctxt, digest); Curl_HMAC_final(ctxt, digest); /* Prepare the response */ /* Generate the response */ response = aprintf( response = aprintf( "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", userp, digest[0], digest[1], digest[2], digest[3], digest[4], userp, digest[0], digest[1], digest[2], digest[3], digest[4], Loading @@ -255,7 +255,7 @@ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data, if(!response) if(!response) return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY; /* Base64 encode the reply */ /* Base64 encode the response */ result = Curl_base64_encode(data, response, 0, outptr, outlen); result = Curl_base64_encode(data, response, 0, outptr, outlen); Curl_safefree(response); Curl_safefree(response); Loading Loading @@ -354,8 +354,10 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data, #ifndef DEBUGBUILD #ifndef DEBUGBUILD static const char table16[] = "0123456789abcdef"; static const char table16[] = "0123456789abcdef"; #endif #endif CURLcode result = CURLE_OK; size_t i; size_t i; MD5_context *ctxt; MD5_context *ctxt; char *response = NULL; unsigned char digest[MD5_DIGEST_LEN]; unsigned char digest[MD5_DIGEST_LEN]; char HA1_hex[2 * MD5_DIGEST_LEN + 1]; char HA1_hex[2 * MD5_DIGEST_LEN + 1]; char HA2_hex[2 * MD5_DIGEST_LEN + 1]; char HA2_hex[2 * MD5_DIGEST_LEN + 1]; Loading @@ -366,7 +368,6 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data, char method[] = "AUTHENTICATE"; char method[] = "AUTHENTICATE"; char qop[] = "auth"; char qop[] = "auth"; char uri[128]; char uri[128]; char response[512]; #ifndef DEBUGBUILD #ifndef DEBUGBUILD /* Generate 64 bits of random data */ /* Generate 64 bits of random data */ Loading Loading @@ -451,14 +452,20 @@ 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(&resp_hash_hex[2 * i], 3, "%02x", digest[i]); snprintf(&resp_hash_hex[2 * i], 3, "%02x", digest[i]); snprintf(response, sizeof(response), /* Generate the response */ "username=\"%s\",realm=\"%s\",nonce=\"%s\"," response = aprintf("username=\"%s\",realm=\"%s\",nonce=\"%s\"," "cnonce=\"%s\",nc=\"%s\",digest-uri=\"%s\",response=%s", "cnonce=\"%s\",nc=\"%s\",digest-uri=\"%s\",response=%s", userp, realm, nonce, userp, realm, nonce, cnonce, nonceCount, uri, resp_hash_hex); cnonce, nonceCount, uri, resp_hash_hex); if(!response) return CURLE_OUT_OF_MEMORY; /* Base64 encode the reply */ /* Base64 encode the response */ return Curl_base64_encode(data, response, 0, outptr, outlen); result = Curl_base64_encode(data, response, 0, outptr, outlen); Curl_safefree(response); return result; } } #endif #endif Loading Loading
lib/curl_sasl.c +17 −10 Original line number Original line Diff line number Diff line Loading @@ -246,7 +246,7 @@ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data, /* Finalise the digest */ /* Finalise the digest */ Curl_HMAC_final(ctxt, digest); Curl_HMAC_final(ctxt, digest); /* Prepare the response */ /* Generate the response */ response = aprintf( response = aprintf( "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", userp, digest[0], digest[1], digest[2], digest[3], digest[4], userp, digest[0], digest[1], digest[2], digest[3], digest[4], Loading @@ -255,7 +255,7 @@ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data, if(!response) if(!response) return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY; /* Base64 encode the reply */ /* Base64 encode the response */ result = Curl_base64_encode(data, response, 0, outptr, outlen); result = Curl_base64_encode(data, response, 0, outptr, outlen); Curl_safefree(response); Curl_safefree(response); Loading Loading @@ -354,8 +354,10 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data, #ifndef DEBUGBUILD #ifndef DEBUGBUILD static const char table16[] = "0123456789abcdef"; static const char table16[] = "0123456789abcdef"; #endif #endif CURLcode result = CURLE_OK; size_t i; size_t i; MD5_context *ctxt; MD5_context *ctxt; char *response = NULL; unsigned char digest[MD5_DIGEST_LEN]; unsigned char digest[MD5_DIGEST_LEN]; char HA1_hex[2 * MD5_DIGEST_LEN + 1]; char HA1_hex[2 * MD5_DIGEST_LEN + 1]; char HA2_hex[2 * MD5_DIGEST_LEN + 1]; char HA2_hex[2 * MD5_DIGEST_LEN + 1]; Loading @@ -366,7 +368,6 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data, char method[] = "AUTHENTICATE"; char method[] = "AUTHENTICATE"; char qop[] = "auth"; char qop[] = "auth"; char uri[128]; char uri[128]; char response[512]; #ifndef DEBUGBUILD #ifndef DEBUGBUILD /* Generate 64 bits of random data */ /* Generate 64 bits of random data */ Loading Loading @@ -451,14 +452,20 @@ 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(&resp_hash_hex[2 * i], 3, "%02x", digest[i]); snprintf(&resp_hash_hex[2 * i], 3, "%02x", digest[i]); snprintf(response, sizeof(response), /* Generate the response */ "username=\"%s\",realm=\"%s\",nonce=\"%s\"," response = aprintf("username=\"%s\",realm=\"%s\",nonce=\"%s\"," "cnonce=\"%s\",nc=\"%s\",digest-uri=\"%s\",response=%s", "cnonce=\"%s\",nc=\"%s\",digest-uri=\"%s\",response=%s", userp, realm, nonce, userp, realm, nonce, cnonce, nonceCount, uri, resp_hash_hex); cnonce, nonceCount, uri, resp_hash_hex); if(!response) return CURLE_OUT_OF_MEMORY; /* Base64 encode the reply */ /* Base64 encode the response */ return Curl_base64_encode(data, response, 0, outptr, outlen); result = Curl_base64_encode(data, response, 0, outptr, outlen); Curl_safefree(response); return result; } } #endif #endif Loading