PRDR client should not request PRDR for 1-recipient mails.
authorJeremy Harris <jgh146exb@wizmail.org>
Mon, 14 Jan 2013 21:43:15 +0000 (21:43 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Mon, 14 Jan 2013 21:43:15 +0000 (21:43 +0000)
src/src/transports/smtp.c
test/log/5510
test/scripts/5500-PRDR/5510
test/stdout/5510

index 8873640ec10a4ae4e36c5f5388964fc50c4968ff..144718a65a678b2303faf09eb275c097932e905f 100644 (file)
@@ -1288,6 +1288,17 @@ if (continue_hostname == NULL
   DEBUG(D_transport) debug_printf("%susing PIPELINING\n",
     smtp_use_pipelining? "" : "not ");
 
+#ifdef EXPERIMENTAL_PRDR
+  prdr_offered = esmtp &&
+    pcre_exec(regex_PRDR, NULL, CS buffer, Ustrlen(CS buffer), 0,
+      PCRE_EOPT, NULL, 0) >= 0 &&
+    verify_check_this_host(&(ob->hosts_try_prdr), NULL, host->name,
+      host->address, NULL) == OK;
+
+  if (prdr_offered)
+    {DEBUG(D_transport) debug_printf("PRDR usable\n");}
+#endif
+
   /* Note if the response to EHLO specifies support for the AUTH extension.
   If it has, check that this host is one we want to authenticate to, and do
   the business. The host name and address must be available when the
@@ -1492,14 +1503,23 @@ if (smtp_use_size)
   }
 
 #ifdef EXPERIMENTAL_PRDR
-if (prdr_offered)      /*XXX limit to >1 rcpts?  Need prdr_active flag */
+prdr_active = FALSE;
+if (prdr_offered)
   {
-  prdr_active = TRUE;
-  sprintf(CS p, " PRDR");
-  p += 5;
+  for (addr = first_addr; addr; addr = addr->next)
+    if (addr->transport_return == PENDING_DEFER)
+      {
+      for (addr = addr->next; addr; addr = addr->next)
+        if (addr->transport_return == PENDING_DEFER)
+         {                     /* at least two recipients to send */
+         prdr_active = TRUE;
+         sprintf(CS p, " PRDR"); p += 5;
+         goto prdr_is_active;
+         }
+      break;
+      }
   }
-else
-  prdr_active = FALSE;
+prdr_is_active:
 #endif
 
 /* If an authenticated_sender override has been specified for this transport
index 795c0b6624e9e413b8bce20223f8dbe551e970cb..5cf25f1db1a1a71ab8accebb75d125ab0c37b8bb 100644 (file)
@@ -18,3 +18,6 @@
 1999-03-02 09:44:33 10HmbB-0005vi-00 == user5.1@test.ex R=r0 T=t1 defer (-46): SMTP error from remote mail server after end of data: host 127.0.0.1 [127.0.0.1]: 450 oops, try again later please
 1999-03-02 09:44:33 10HmbB-0005vi-00 == user5.2@test.ex R=r0 T=t1 defer (-46): SMTP error from remote mail server after end of data: host 127.0.0.1 [127.0.0.1]: 450 oops, try again later please
 1999-03-02 09:44:33 10HmbB-0005vi-00 == user5.3@test.ex R=r0 T=t1 defer (-46): SMTP error from remote mail server after end of data: host 127.0.0.1 [127.0.0.1]: 450 oops, try again later please
+1999-03-02 09:44:33 10HmbC-0005vi-00 <= <> U=CALLER P=local S=sss
+1999-03-02 09:44:33 10HmbC-0005vi-00 => user6.1@test.ex R=r0 T=t1 H=127.0.0.1 [127.0.0.1] C="250 OK, got that"
+1999-03-02 09:44:33 10HmbC-0005vi-00 Completed
index 05ae4128e58998824e3f7f04e8b9fead25daa49d..8d6c899ca04797170f62dfac6cd9e9cd813ad6a9 100644 (file)
@@ -2,7 +2,7 @@
 need_ipv4
 no_msglog_check
 #
-# 1: Two recipients, accepted
+# 1: Two recipients, accepted by full PRDR response sequence
 server PORT_S
 220 Server ready
 EHLO
@@ -59,7 +59,7 @@ Some message text.
 #
 #
 # 3: Two recipients, one accepted one rejected
-# Avoid issues dealing with the bounce by sending
+# Avoid tester issues dealing with the bounce by sending
 # with a null from.
 #
 server PORT_S
@@ -150,4 +150,27 @@ text
 #
 #
 #
-# 6 ?
+# 8: Client should avoid requesting PRDR for a single-recipient mail
+# even though the server offers
+server PORT_S
+220 Server ready
+EHLO
+250-
+250-PRDR
+250 OK
+MAIL FROM:<>
+250 OK
+RCPT TO
+250 OK
+DATA
+300 go ahead
+.
+250 OK, got that
+QUIT
+250 OK, bye
+****
+exim -odi -f "" user6.1
+text
+****
+#
+#
index 310058dfd0a2386420517cbeafc76f4df8091f1f..10842ed004402a22400b8779f3aef246cc8c6957 100644 (file)
@@ -150,3 +150,28 @@ text
 QUIT
 250 OK
 End of script
+Listening on port 1224 ... 
+Connection request from [127.0.0.1]
+220 Server ready
+EHLO myhost.test.ex
+250-
+250-PRDR
+250 OK
+MAIL FROM:<>
+250 OK
+RCPT TO:<user6.1@test.ex>
+250 OK
+DATA
+300 go ahead
+Received: from CALLER by myhost.test.ex with local (Exim x.yz)
+       id 10HmbC-0005vi-00
+       for user6.1@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmbC-0005vi-00@myhost.test.ex>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+text
+.
+250 OK, got that
+QUIT
+250 OK, bye
+End of script