]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
pop3/smtp: return *WEIRD_SERVER_REPLY when not understood 8506/head
authorDaniel Stenberg <daniel@haxx.se>
Tue, 29 Mar 2022 12:01:48 +0000 (14:01 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 29 Mar 2022 12:01:53 +0000 (14:01 +0200)
This leaves the CURLE_RECV_ERROR error code for explicit failure to
receive network data and allows users to better separate the problems.

Ref #8356
Reported-by: Rianov Viacheslav
Closes #8506

lib/pingpong.c
lib/pop3.c
lib/smtp.c
tests/data/test852
tests/data/test855
tests/data/test926
tests/data/test957
tests/data/test958
tests/data/test961

index 1453bf299aade9f0cd89ddfcf09ab8fca3c077a5..e08c1d8663813c5831398c56ac7e141f7b62d3fd 100644 (file)
@@ -293,7 +293,7 @@ CURLcode Curl_pp_readresp(struct Curl_easy *data,
        */
       if((ptr + pp->cache_size) > (buf + data->set.buffer_size + 1)) {
         failf(data, "cached response data too big to handle");
-        return CURLE_RECV_ERROR;
+        return CURLE_WEIRD_SERVER_REPLY;
       }
       memcpy(ptr, pp->cache, pp->cache_size);
       gotbytes = (ssize_t)pp->cache_size;
index 065bdbaf51ca6be716fbf6ce7c65c149bc867f9a..3e0d5a4a09af23181d889702958e87b3ce469697 100644 (file)
@@ -924,7 +924,7 @@ static CURLcode pop3_state_command_resp(struct Curl_easy *data,
 
   if(pop3code != '+') {
     state(data, POP3_STOP);
-    return CURLE_RECV_ERROR;
+    return CURLE_WEIRD_SERVER_REPLY;
   }
 
   /* This 'OK' line ends with a CR LF pair which is the two first bytes of the
index 28aa44a49a0449cf41f7da6631d09b8866144981..3e04154ba3073dc65cd20518dcce009567de6190 100644 (file)
@@ -1037,7 +1037,7 @@ static CURLcode smtp_state_command_resp(struct Curl_easy *data, int smtpcode,
   if((smtp->rcpt && smtpcode/100 != 2 && smtpcode != 553 && smtpcode != 1) ||
      (!smtp->rcpt && smtpcode/100 != 2 && smtpcode != 1)) {
     failf(data, "Command failed: %d", smtpcode);
-    result = CURLE_RECV_ERROR;
+    result = CURLE_WEIRD_SERVER_REPLY;
   }
   else {
     /* Temporarily add the LF character back and send as body to the client */
@@ -1182,7 +1182,7 @@ static CURLcode smtp_state_postdata_resp(struct Curl_easy *data,
   (void)instate; /* no use for this yet */
 
   if(smtpcode != 250)
-    result = CURLE_RECV_ERROR;
+    result = CURLE_WEIRD_SERVER_REPLY;
 
   /* End of DONE phase */
   state(data, SMTP_STOP);
index 8e608eb571df1aef08e9e6d634cd4677b6c93d1c..2234087ee04b6b98545eeccbde308dae537d1237 100644 (file)
@@ -34,7 +34,7 @@ pop3://%HOSTIP:%POP3PORT/%TESTNUMBER -l -u user:secret
 # Verify data after the test has been "shot"
 <verify>
 <errorcode>
-56
+8
 </errorcode>
 <protocol>
 CAPA\r
index 24b1166c6437c4d372689cbebcf369bfd7f3d2d4..0ab1ab39717236d13b4313e1f98641b1c09c7697 100644 (file)
@@ -34,7 +34,7 @@ pop3://%HOSTIP:%POP3PORT/%TESTNUMBER -u user:secret
 # Verify data after the test has been "shot"
 <verify>
 <errorcode>
-56
+8
 </errorcode>
 <protocol>
 CAPA\r
index aed6f4b8d80335ea86adbdd79515449f5ceb3c9a..248cce9a7f248a33dab82420ffcdf31521bef332 100644 (file)
@@ -31,9 +31,9 @@ smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER --mail-rcpt recipient
 #
 # Verify data after the test has been "shot"
 <verify>
-# 56 - CURLE_RECV_ERROR
+# 8 - CURLE_WEIRD_SERVER_REPLY
 <errorcode>
-56
+8
 </errorcode>
 <protocol>
 EHLO %TESTNUMBER\r
index 5859f92fc5826842ed4f4d4cb5ee4251db60fd75..097385fe2a598cb0ca15f4be585323ea3b88951b 100644 (file)
@@ -38,9 +38,9 @@ smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER --mail-rcpt Användaren
 #
 # Verify data after the test has been "shot"
 <verify>
-# 56 - CURLE_RECV_ERROR
+# 8 - CURLE_WEIRD_SERVER_REPLY
 <errorcode>
-56
+8
 </errorcode>
 <protocol>
 EHLO %TESTNUMBER\r
index ce3de334268e8789a018eb426a6ff907f5b8e9fc..1df15808404be54c1b187d3163b0e2f56614b56e 100644 (file)
@@ -38,9 +38,9 @@ smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER --mail-rcpt Användaren@example.com
 #
 # Verify data after the test has been "shot"
 <verify>
-# 56 - CURLE_RECV_ERROR
+# 8 - CURLE_WEIRD_SERVER_REPLY
 <errorcode>
-56
+8
 </errorcode>
 <protocol>
 EHLO %TESTNUMBER\r
index 02e2653532e674968c5aec671791758cea466f8e..9cd10f574527b5c36b9cb11712bff8d909fb67c3 100644 (file)
@@ -39,9 +39,9 @@ smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER --mail-rcpt user@åäö.se
 #
 # Verify data after the test has been "shot"
 <verify>
-# 56 - CURLE_RECV_ERROR
+# 8 - CURLE_WEIRD_SERVER_REPLY
 <errorcode>
-56
+8
 </errorcode>
 <protocol>
 EHLO %TESTNUMBER\r