← Commit list

3aa67d5e49

Daniel Stenberg
Daniel Stenberg
2026-09-21
SUCCESS Duration: 397s

Subject

digest: quote the digest-uri param as well

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/vauth/digest.c+7 -4
@@ -371,6 +371,7 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
char *qrealm;
char *qnonce;
char *quserp;
+ char *qspn;
/* Decode the challenge message */
CURLcode result = auth_decode_digest_md5_message(chlg,
@@ -484,23 +485,25 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
for(i = 0; i < MD5_DIGEST_LEN; i++)
curl_msnprintf(&resp_hash_hex[2 * i], 3, "%02x", digest[i]);
- /* escape double quotes and backslashes in the username, realm and nonce as
- necessary */
+ /* escape double quotes and backslashes in the username, realm, nonce and
+ spn as necessary */
qrealm = auth_digest_string_quoted(realm);
qnonce = auth_digest_string_quoted(nonce);
quserp = auth_digest_string_quoted(userp);
- if(qrealm && qnonce && quserp)
+ qspn = auth_digest_string_quoted(spn);
+ if(qrealm && qnonce && quserp && qspn)
/* Generate the response */
response = curl_maprintf("username=\"%s\",realm=\"%s\",nonce=\"%s\","
"cnonce=\"%s\",nc=\"%s\",digest-uri=\"%s\","
"response=%s,qop=%s",
quserp, qrealm, qnonce,
- cnonce, nonceCount, spn, resp_hash_hex, qop);
+ cnonce, nonceCount, qspn, resp_hash_hex, qop);
curlx_free(qrealm);
curlx_free(qnonce);
curlx_free(quserp);
curlx_free(spn);
+ curlx_free(qspn);
if(!response)
return CURLE_OUT_OF_MEMORY;
tests/data/Makefile.am+1 -0
@@ -2029,6 +2029,7 @@ TESTCASES = \
test2885 \
test2918 \
test2924 \
+ test2967 \
test3000 \
test3001 \
test3002 \
tests/data/test2967+65 -0
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<testcase>
+<info>
+<keywords>
+SMTP
+SASL
+SASL AUTH DIGEST-MD5
+RFC2831
+RFC4954
+</keywords>
+</info>
+
+# Server-side
+<reply>
+<servercmd>
+AUTH DIGEST-MD5
+REPLY AUTH 334 %b64[realm="cu\"rl",nonce="5300d17a1d695bd411e4cdf96f9548c23ced6175",algorithm=md5-sess,qop="auth"]b64%
+REPLY %b64[username="us\"er",realm="cu\"rl",nonce="5300d17a1d695bd411e4cdf96f9548c23ced6175",cnonce="34333231353332313633323137333231",nc="00000001",digest-uri="smtp\",injected=1,x=\"/127.0.0.1",response=c6f01f4f75dcb83068b66c8b4f347400,qop=auth]b64% 334 %b64[rspauth=9ea859cb9d90c37ca30d49d35378630c]b64%
+REPLY 235 Authenticated
+</servercmd>
+</reply>
+
+# Client-side
+<client>
+<server>
+smtp
+</server>
+<features>
+!SSPI
+Debug
+crypto
+digest
+</features>
+<setenv>
+CURL_ENTROPY=12345678
+</setenv>
+<name>
+SMTP DIGEST-MD5 with set service name
+</name>
+<stdin crlf="yes">
+mail body
+</stdin>
+<command>
+smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER --mail-rcpt [email protected] --mail-from [email protected] -u "us\"er:secret" -T - --service-name 'smtp",injected=1,x="'
+</command>
+</client>
+
+# Verify data after the test has been "shot"
+<verify>
+<protocol crlf="yes">
+EHLO %TESTNUMBER
+AUTH DIGEST-MD5
+%b64[username="us\"er",realm="cu\"rl",nonce="5300d17a1d695bd411e4cdf96f9548c23ced6175",cnonce="34333231353332313633323137333231",nc="00000001",digest-uri="smtp\",injected=1,x=\"/127.0.0.1",response=c6f01f4f75dcb83068b66c8b4f347400,qop=auth]b64%
+
+MAIL FROM:%[email protected]%GT
+RCPT TO:%[email protected]%GT
+DATA
+QUIT
+</protocol>
+<upload crlf="yes">
+mail body
+.
+</upload>
+</verify>
+</testcase>