On callout avoid SIZE every time but noncacheable rcpt main-verify. Bug 2151
authorJeremy Harris <jgh146exb@wizmail.org>
Sat, 22 Jul 2017 15:38:08 +0000 (16:38 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Sat, 22 Jul 2017 22:26:32 +0000 (23:26 +0100)
16 files changed:
doc/doc-txt/ChangeLog
src/src/exim.c
src/src/macros.h
src/src/transport.c
src/src/transports/smtp.c
src/src/transports/smtp.h
src/src/verify.c
test/confs/0227
test/log/0227
test/rejectlog/0227
test/scripts/0000-Basic/0227
test/stderr/0227
test/stderr/5410
test/stderr/5420
test/stderr/5840
test/stdout/0227

index af7571fd496819851e873310113cdfaa9231565d..dba462937bbc4c65ccde9302135d2529e3b6b1f6 100644 (file)
@@ -34,6 +34,10 @@ JH/20 Bug 2147: Do not defer for a verify-with-callout-and-random which is not
       cache-hot.  Previously, although the result was properly cached, the
       initial verify call returned a defer.
 
+JH/21 Bug 2151 (partial):
+                Avoid using SIZE on the MAIL for a callout verify, on any but
+      the main verify for receipient in uncached-mode.
+
 
 Exim version 4.89
 -----------------
index 394bf84f09737cb8558cc2973c0cf4f6f297d237..b0ba8a027a77532e3ce5aec75ce046258a5f58df 100644 (file)
@@ -2738,7 +2738,7 @@ for (i = 1; i < argc; i++)
     /* -MCD: set the smtp_use_dsn flag; this indicates that the host
        that exim is connected to supports the esmtp extension DSN */
 
-       case 'D': smtp_peer_options |= PEER_OFFERED_DSN; break;
+       case 'D': smtp_peer_options |= OPTION_DSN; break;
 
     /* -MCG: set the queue name, to a non-default value */
 
@@ -2748,12 +2748,12 @@ for (i = 1; i < argc; i++)
 
     /* -MCK: the peer offered CHUNKING.  Must precede -MC */
 
-       case 'K': smtp_peer_options |= PEER_OFFERED_CHUNKING; break;
+       case 'K': smtp_peer_options |= OPTION_CHUNKING; break;
 
     /* -MCP: set the smtp_use_pipelining flag; this is useful only when
     it preceded -MC (see above) */
 
-       case 'P': smtp_peer_options |= PEER_OFFERED_PIPE; break;
+       case 'P': smtp_peer_options |= OPTION_PIPE; break;
 
     /* -MCQ: pass on the pid of the queue-running process that started
     this chain of deliveries and the fd of its synchronizing pipe; this
@@ -2768,14 +2768,14 @@ for (i = 1; i < argc; i++)
     /* -MCS: set the smtp_use_size flag; this is useful only when it
     precedes -MC (see above) */
 
-       case 'S': smtp_peer_options |= PEER_OFFERED_SIZE; break;
+       case 'S': smtp_peer_options |= OPTION_SIZE; break;
 
 #ifdef SUPPORT_TLS
     /* -MCT: set the tls_offered flag; this is useful only when it
     precedes -MC (see above). The flag indicates that the host to which
     Exim is connected has offered TLS support. */
 
-       case 'T': smtp_peer_options |= PEER_OFFERED_TLS; break;
+       case 'T': smtp_peer_options |= OPTION_TLS; break;
 #endif
 
        default:  badarg = TRUE; break;
index 2692714f71d6f8c69d59a324f96e838f13c20417..c334a71c8e0c53806171cd75196c24c26666d82f 100644 (file)
@@ -959,14 +959,14 @@ enum { FILTER_UNSET, FILTER_FORWARD, FILTER_EXIM, FILTER_SIEVE };
 
 /* Codes for ESMTP facilities offered by peer */
 
-#define PEER_OFFERED_TLS       BIT(0)
-#define PEER_OFFERED_IGNQ      BIT(1)
-#define PEER_OFFERED_PRDR      BIT(2)
-#define PEER_OFFERED_UTF8      BIT(3)
-#define PEER_OFFERED_DSN       BIT(4)
-#define PEER_OFFERED_PIPE      BIT(5)
-#define PEER_OFFERED_SIZE      BIT(6)
-#define PEER_OFFERED_CHUNKING  BIT(7)
+#define OPTION_TLS     BIT(0)
+#define OPTION_IGNQ    BIT(1)
+#define OPTION_PRDR    BIT(2)
+#define OPTION_UTF8    BIT(3)
+#define OPTION_DSN     BIT(4)
+#define OPTION_PIPE    BIT(5)
+#define OPTION_SIZE    BIT(6)
+#define OPTION_CHUNKING        BIT(7)
 
 /* Argument for *_getc */
 
index b8a4636b60818fe2cc4220d5ff8de4ebb7ab2cec..c3d844173a8abfa60e11f2750294b8255b4b7f43 100644 (file)
@@ -1977,12 +1977,12 @@ if ((pid = fork()) == 0)
 
   if (smtp_authenticated) argv[i++] = US"-MCA";
 
-  if (smtp_peer_options & PEER_OFFERED_CHUNKING) argv[i++] = US"-MCK";
-  if (smtp_peer_options & PEER_OFFERED_DSN) argv[i++] = US"-MCD";
-  if (smtp_peer_options & PEER_OFFERED_PIPE) argv[i++] = US"-MCP";
-  if (smtp_peer_options & PEER_OFFERED_SIZE) argv[i++] = US"-MCS";
+  if (smtp_peer_options & OPTION_CHUNKING) argv[i++] = US"-MCK";
+  if (smtp_peer_options & OPTION_DSN) argv[i++] = US"-MCD";
+  if (smtp_peer_options & OPTION_PIPE) argv[i++] = US"-MCP";
+  if (smtp_peer_options & OPTION_SIZE) argv[i++] = US"-MCS";
 #ifdef SUPPORT_TLS
-  if (smtp_peer_options & PEER_OFFERED_TLS) argv[i++] = US"-MCT";
+  if (smtp_peer_options & OPTION_TLS) argv[i++] = US"-MCT";
 #endif
 
   if (queue_run_pid != (pid_t)0)
index 2f41adbbf322e234d72328ab5007fea27e760561..13dada2b3f87249817ccf92b7510d768fe435e65 100644 (file)
@@ -1293,44 +1293,44 @@ ehlo_response(uschar * buf, uschar checks)
 size_t bsize = Ustrlen(buf);
 
 #ifdef SUPPORT_TLS
-if (  checks & PEER_OFFERED_TLS
+if (  checks & OPTION_TLS
    && pcre_exec(regex_STARTTLS, NULL, CS buf, bsize, 0, PCRE_EOPT, NULL, 0) < 0)
-  checks &= ~PEER_OFFERED_TLS;
+  checks &= ~OPTION_TLS;
 #endif
 
-if (  checks & PEER_OFFERED_IGNQ
+if (  checks & OPTION_IGNQ
    && pcre_exec(regex_IGNOREQUOTA, NULL, CS buf, bsize, 0,
                PCRE_EOPT, NULL, 0) < 0)
-  checks &= ~PEER_OFFERED_IGNQ;
+  checks &= ~OPTION_IGNQ;
 
-if (  checks & PEER_OFFERED_CHUNKING
+if (  checks & OPTION_CHUNKING
    && pcre_exec(regex_CHUNKING, NULL, CS buf, bsize, 0, PCRE_EOPT, NULL, 0) < 0)
-  checks &= ~PEER_OFFERED_CHUNKING;
+  checks &= ~OPTION_CHUNKING;
 
 #ifndef DISABLE_PRDR
-if (  checks & PEER_OFFERED_PRDR
+if (  checks & OPTION_PRDR
    && pcre_exec(regex_PRDR, NULL, CS buf, bsize, 0, PCRE_EOPT, NULL, 0) < 0)
-  checks &= ~PEER_OFFERED_PRDR;
+  checks &= ~OPTION_PRDR;
 #endif
 
 #ifdef SUPPORT_I18N
-if (  checks & PEER_OFFERED_UTF8
+if (  checks & OPTION_UTF8
    && pcre_exec(regex_UTF8, NULL, CS buf, bsize, 0, PCRE_EOPT, NULL, 0) < 0)
-  checks &= ~PEER_OFFERED_UTF8;
+  checks &= ~OPTION_UTF8;
 #endif
 
-if (  checks & PEER_OFFERED_DSN
+if (  checks & OPTION_DSN
    && pcre_exec(regex_DSN, NULL, CS buf, bsize, 0, PCRE_EOPT, NULL, 0) < 0)
-  checks &= ~PEER_OFFERED_DSN;
+  checks &= ~OPTION_DSN;
 
-if (  checks & PEER_OFFERED_PIPE
+if (  checks & OPTION_PIPE
    && pcre_exec(regex_PIPELINING, NULL, CS buf, bsize, 0,
                PCRE_EOPT, NULL, 0) < 0)
-  checks &= ~PEER_OFFERED_PIPE;
+  checks &= ~OPTION_PIPE;
 
-if (  checks & PEER_OFFERED_SIZE
+if (  checks & OPTION_SIZE
    && pcre_exec(regex_SIZE, NULL, CS buf, bsize, 0, PCRE_EOPT, NULL, 0) < 0)
-  checks &= ~PEER_OFFERED_SIZE;
+  checks &= ~OPTION_SIZE;
 
 return checks;
 }
@@ -1481,6 +1481,7 @@ sx->dane_required = verify_check_given_host(&sx->ob->hosts_require_dane, sx->hos
 
 if ((sx->max_rcpt = sx->tblock->max_addresses) == 0) sx->max_rcpt = 999999;
 sx->peer_offered = 0;
+sx->avoid_option = 0;
 sx->igquotstr = US"";
 if (!sx->helo_data) sx->helo_data = sx->ob->helo_data;
 #ifdef EXPERIMENTAL_DSN_INFO
@@ -1717,7 +1718,7 @@ goto SEND_QUIT;
 #ifdef SUPPORT_TLS
   if (sx->smtps)
     {
-    smtp_peer_options |= PEER_OFFERED_TLS;
+    smtp_peer_options |= OPTION_TLS;
     suppress_tls = FALSE;
     sx->ob->tls_tempfail_tryclear = FALSE;
     smtp_command = US"SSL-on-connect";
@@ -1782,18 +1783,18 @@ goto SEND_QUIT;
       }
     }
 
-  sx->peer_offered = smtp_peer_options = 0;
+  sx->avoid_option = sx->peer_offered = smtp_peer_options = 0;
 
   if (sx->esmtp || sx->lmtp)
     {
     sx->peer_offered = ehlo_response(sx->buffer,
-      PEER_OFFERED_TLS /* others checked later */
+      OPTION_TLS       /* others checked later */
       );
 
   /* Set tls_offered if the response to EHLO specifies support for STARTTLS. */
 
 #ifdef SUPPORT_TLS
-    smtp_peer_options |= sx->peer_offered & PEER_OFFERED_TLS;
+    smtp_peer_options |= sx->peer_offered & OPTION_TLS;
 #endif
     }
   }
@@ -1827,7 +1828,7 @@ the client not be required to use TLS. If the response is bad, copy the buffer
 for error analysis. */
 
 #ifdef SUPPORT_TLS
-if (  smtp_peer_options & PEER_OFFERED_TLS
+if (  smtp_peer_options & OPTION_TLS
    && !suppress_tls
    && verify_check_given_host(&sx->ob->hosts_avoid_tls, sx->host) != OK
    && (  !sx->verify
@@ -1972,7 +1973,7 @@ else if (  sx->smtps
   {
   errno = ERRNO_TLSREQUIRED;
   message = string_sprintf("a TLS session is required, but %s",
-    smtp_peer_options & PEER_OFFERED_TLS
+    smtp_peer_options & OPTION_TLS
     ? "an attempt to start TLS failed" : "the server did not offer TLS support");
   goto TLS_FAILED;
   }
@@ -1993,60 +1994,60 @@ if (continue_hostname == NULL
     {
     sx->peer_offered = ehlo_response(sx->buffer,
        0 /* no TLS */
-       | (sx->lmtp && sx->ob->lmtp_ignore_quota ? PEER_OFFERED_IGNQ : 0)
-       | PEER_OFFERED_CHUNKING
-       | PEER_OFFERED_PRDR
+       | (sx->lmtp && sx->ob->lmtp_ignore_quota ? OPTION_IGNQ : 0)
+       | OPTION_CHUNKING
+       | OPTION_PRDR
 #ifdef SUPPORT_I18N
-       | (sx->addrlist->prop.utf8_msg ? PEER_OFFERED_UTF8 : 0)
+       | (sx->addrlist->prop.utf8_msg ? OPTION_UTF8 : 0)
          /*XXX if we hand peercaps on to continued-conn processes,
                must not depend on this addr */
 #endif
-       | PEER_OFFERED_DSN
-       | PEER_OFFERED_PIPE
-       | (sx->ob->size_addition >= 0 ? PEER_OFFERED_SIZE : 0)
+       | OPTION_DSN
+       | OPTION_PIPE
+       | (sx->ob->size_addition >= 0 ? OPTION_SIZE : 0)
       );
 
     /* Set for IGNOREQUOTA if the response to LHLO specifies support and the
     lmtp_ignore_quota option was set. */
 
-    sx->igquotstr = sx->peer_offered & PEER_OFFERED_IGNQ ? US" IGNOREQUOTA" : US"";
+    sx->igquotstr = sx->peer_offered & OPTION_IGNQ ? US" IGNOREQUOTA" : US"";
 
     /* If the response to EHLO specified support for the SIZE parameter, note
     this, provided size_addition is non-negative. */
 
-    smtp_peer_options |= sx->peer_offered & PEER_OFFERED_SIZE;
+    smtp_peer_options |= sx->peer_offered & OPTION_SIZE;
 
     /* Note whether the server supports PIPELINING. If hosts_avoid_esmtp matched
     the current host, esmtp will be false, so PIPELINING can never be used. If
     the current host matches hosts_avoid_pipelining, don't do it. */
 
-    if (  sx->peer_offered & PEER_OFFERED_PIPE
+    if (  sx->peer_offered & OPTION_PIPE
        && verify_check_given_host(&sx->ob->hosts_avoid_pipelining, sx->host) != OK)
-      smtp_peer_options |= PEER_OFFERED_PIPE;
+      smtp_peer_options |= OPTION_PIPE;
 
     DEBUG(D_transport) debug_printf("%susing PIPELINING\n",
-      smtp_peer_options & PEER_OFFERED_PIPE ? "" : "not ");
+      smtp_peer_options & OPTION_PIPE ? "" : "not ");
 
-    if (  sx->peer_offered & PEER_OFFERED_CHUNKING
+    if (  sx->peer_offered & OPTION_CHUNKING
        && verify_check_given_host(&sx->ob->hosts_try_chunking, sx->host) != OK)
-      sx->peer_offered &= ~PEER_OFFERED_CHUNKING;
+      sx->peer_offered &= ~OPTION_CHUNKING;
 
-    if (sx->peer_offered & PEER_OFFERED_CHUNKING)
+    if (sx->peer_offered & OPTION_CHUNKING)
       {DEBUG(D_transport) debug_printf("CHUNKING usable\n");}
 
 #ifndef DISABLE_PRDR
-    if (  sx->peer_offered & PEER_OFFERED_PRDR
+    if (  sx->peer_offered & OPTION_PRDR
        && verify_check_given_host(&sx->ob->hosts_try_prdr, sx->host) != OK)
-      sx->peer_offered &= ~PEER_OFFERED_PRDR;
+      sx->peer_offered &= ~OPTION_PRDR;
 
-    if (sx->peer_offered & PEER_OFFERED_PRDR)
+    if (sx->peer_offered & OPTION_PRDR)
       {DEBUG(D_transport) debug_printf("PRDR usable\n");}
 #endif
 
     /* Note if the server supports DSN */
-    smtp_peer_options |= sx->peer_offered & PEER_OFFERED_DSN;
+    smtp_peer_options |= sx->peer_offered & OPTION_DSN;
     DEBUG(D_transport) debug_printf("%susing DSN\n",
-                       sx->peer_offered & PEER_OFFERED_DSN ? "" : "not ");
+                       sx->peer_offered & OPTION_DSN ? "" : "not ");
 
     /* 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
@@ -2063,7 +2064,7 @@ if (continue_hostname == NULL
       }
     }
   }
-pipelining_active = !!(smtp_peer_options & PEER_OFFERED_PIPE);
+pipelining_active = !!(smtp_peer_options & OPTION_PIPE);
 
 /* The setting up of the SMTP call is now complete. Any subsequent errors are
 message-specific. */
@@ -2081,7 +2082,7 @@ if (sx->addrlist->prop.utf8_msg)
   }
 
 /* If this is an international message we need the host to speak SMTPUTF8 */
-if (sx->utf8_needed && !(sx->peer_offered & PEER_OFFERED_UTF8))
+if (sx->utf8_needed && !(sx->peer_offered & OPTION_UTF8))
   {
   errno = ERRNO_UTF8_FWD;
   goto RESPONSE_FAILED;
@@ -2204,14 +2205,15 @@ int address_count;
 
 *p = 0;
 
-/* If we know the receiving MTA supports the SIZE qualification,
+/* If we know the receiving MTA supports the SIZE qualification, and we know it,
 send it, adding something to the message size to allow for imprecision
 and things that get added en route. Exim keeps the number of lines
 in a message, so we can give an accurate value for the original message, but we
 need some additional to handle added headers. (Double "." characters don't get
 included in the count.) */
 
-if (sx->peer_offered & PEER_OFFERED_SIZE)
+if (  message_size > 0
+   && sx->peer_offered & OPTION_SIZE && !(sx->avoid_option & OPTION_SIZE))
   {
   sprintf(CS p, " SIZE=%d", message_size+message_linecount+sx->ob->size_addition);
   while (*p) p++;
@@ -2222,7 +2224,7 @@ if (sx->peer_offered & PEER_OFFERED_SIZE)
 request that */
 
 sx->prdr_active = FALSE;
-if (sx->peer_offered & PEER_OFFERED_PRDR)
+if (sx->peer_offered & OPTION_PRDR)
   for (addr = addrlist; addr; addr = addr->next)
     if (addr->transport_return == PENDING_DEFER)
       {
@@ -2241,7 +2243,7 @@ if (sx->peer_offered & PEER_OFFERED_PRDR)
 /* If it supports internationalised messages, and this meesage need that,
 request it */
 
-if (  sx->peer_offered & PEER_OFFERED_UTF8
+if (  sx->peer_offered & OPTION_UTF8
    && addrlist->prop.utf8_msg
    && !addrlist->prop.utf8_downcvt
    )
@@ -2263,7 +2265,7 @@ for (sx->dsn_all_lasthop = TRUE, addr = addrlist, address_count = 0;
 
 /* Add any DSN flags to the mail command */
 
-if (sx->peer_offered & PEER_OFFERED_DSN && !sx->dsn_all_lasthop)
+if (sx->peer_offered & OPTION_DSN && !sx->dsn_all_lasthop)
   {
   if (dsn_ret == dsn_ret_hdrs)
     { Ustrcpy(p, " RET=HDRS"); p += 9; }
@@ -2299,7 +2301,7 @@ uschar * p = sx->buffer;
 
 /* Add any DSN flags to the rcpt command */
 
-if (sx->peer_offered & PEER_OFFERED_DSN && !(addr->dsn_flags & rf_dsnlasthop))
+if (sx->peer_offered & OPTION_DSN && !(addr->dsn_flags & rf_dsnlasthop))
   {
   if (addr->dsn_flags & rf_dsnflags)
     {
@@ -2369,7 +2371,7 @@ sx->pending_MAIL = TRUE;     /* The block starts with MAIL */
   the delivery log line. */
 
   if (  sx->addrlist->prop.utf8_msg
-     && (sx->addrlist->prop.utf8_downcvt || !(sx->peer_offered & PEER_OFFERED_UTF8))
+     && (sx->addrlist->prop.utf8_downcvt || !(sx->peer_offered & OPTION_UTF8))
      )
     {
     if (s = string_address_utf8_to_alabel(s, &errstr), errstr)
@@ -2433,7 +2435,7 @@ for (addr = sx->first_addr, address_count = 0;
   BOOL no_flush;
   uschar * rcpt_addr;
 
-  addr->dsn_aware = sx->peer_offered & PEER_OFFERED_DSN
+  addr->dsn_aware = sx->peer_offered & OPTION_DSN
     ? dsn_support_yes : dsn_support_no;
 
   address_count++;
@@ -2597,10 +2599,10 @@ if (tblock->filter_command)
   if (  transport_filter_argv
      && *transport_filter_argv
      && **transport_filter_argv
-     && sx.peer_offered & PEER_OFFERED_CHUNKING
+     && sx.peer_offered & OPTION_CHUNKING
      )
     {
-    sx.peer_offered &= ~PEER_OFFERED_CHUNKING;
+    sx.peer_offered &= ~OPTION_CHUNKING;
     DEBUG(D_transport) debug_printf("CHUNKING not usable due to transport filter\n");
     }
   }
@@ -2661,7 +2663,7 @@ are pipelining. The responses are all handled by sync_responses().
 If using CHUNKING, do not send a BDAT until we know how big a chunk we want
 to send is. */
 
-if (  !(sx.peer_offered & PEER_OFFERED_CHUNKING)
+if (  !(sx.peer_offered & OPTION_CHUNKING)
    && (sx.ok || (pipelining_active && !mua_wrapper)))
   {
   int count = smtp_write_command(&sx.outblock, FALSE, "DATA\r\n");
@@ -2691,7 +2693,7 @@ for handling the SMTP dot-handling protocol, flagging to apply to headers as
 well as body. Set the appropriate timeout value to be used for each chunk.
 (Haven't been able to make it work using select() for writing yet.) */
 
-if (!(sx.peer_offered & PEER_OFFERED_CHUNKING) && !sx.ok)
+if (!(sx.peer_offered & OPTION_CHUNKING) && !sx.ok)
   {
   /* Save the first address of the next batch. */
   sx.first_addr = sx.next_addr;
@@ -2717,7 +2719,7 @@ else
   of responses.  The callback needs a whole bunch of state so set up
   a transport-context structure to be passed around. */
 
-  if (sx.peer_offered & PEER_OFFERED_CHUNKING)
+  if (sx.peer_offered & OPTION_CHUNKING)
     {
     tctx.check_string = tctx.escape_string = NULL;
     tctx.options |= topt_use_bdat;
@@ -2742,7 +2744,7 @@ else
   transport_write_timeout = sx.ob->data_timeout;
   smtp_command = US"sending data block";   /* For error messages */
   DEBUG(D_transport|D_v)
-    if (sx.peer_offered & PEER_OFFERED_CHUNKING)
+    if (sx.peer_offered & OPTION_CHUNKING)
       debug_printf("         will write message using CHUNKING\n");
     else
       debug_printf("  SMTP>> writing message and terminating \".\"\n");
@@ -2776,7 +2778,7 @@ else
 
   smtp_command = US"end of data";
 
-  if (sx.peer_offered & PEER_OFFERED_CHUNKING && sx.cmd_count > 1)
+  if (sx.peer_offered & OPTION_CHUNKING && sx.cmd_count > 1)
     {
     /* Reap any outstanding MAIL & RCPT commands, but not a DATA-go-ahead */
     switch(sync_responses(&sx, sx.cmd_count-1, 0))
@@ -2931,7 +2933,7 @@ else
 #ifndef DISABLE_PRDR
       if (sx.prdr_active) addr->flags |= af_prdr_used;
 #endif
-      if (sx.peer_offered & PEER_OFFERED_CHUNKING) addr->flags |= af_chunking_used;
+      if (sx.peer_offered & OPTION_CHUNKING) addr->flags |= af_chunking_used;
       flag = '-';
 
 #ifndef DISABLE_PRDR
index 4bb6d6da3a813833525c4807c718c4e0cb747720..abfd65fc5b0c3c67ee4edca7b4a62af8e2fec929 100644 (file)
@@ -127,6 +127,7 @@ typedef struct {
   int          cmd_count;
 
   uschar       peer_offered;
+  uschar       avoid_option;
   uschar *     igquotstr;
   uschar *     helo_data;
 #ifdef EXPERIMENTAL_DSN_INFO
index ba5e84d15aa7997c52793d58873d7abec6822057..31c061535274197b3044cec3770f2b179705d5e1 100644 (file)
@@ -779,8 +779,12 @@ tls_retry_connection:
       postmaster-verify.
       The sync_responses() would need to be taught about it and we'd
       need another return code filtering out to here.
+
+      Avoid using a SIZE option on the MAIL for all randon-rcpt checks.
       */
 
+      sx.avoid_option = OPTION_SIZE;
+
       /* Remember when we last did a random test */
       new_domain_record.random_stamp = time(NULL);
 
@@ -792,8 +796,9 @@ tls_retry_connection:
            yield = OK;         /* Only usable result we can return */
            done = TRUE;
            goto no_conn;
-         case FAIL:
+         case FAIL:            /* the preferred result */
            new_domain_record.random_result = ccache_reject;
+           sx.avoid_option = 0;
 
            /* Between each check, issue RSET, because some servers accept only
            one recipient after MAIL FROM:<>.
@@ -838,12 +843,14 @@ tls_retry_connection:
     else
       done = TRUE;
 
-    /* Main verify. If the host is accepting all local parts, as determined
-    by the "random" check, we don't need to waste time doing any further
-    checking. */
+    /* Main verify.  For rcpt-verify use SIZE if we know it and we're not cacheing;
+    for sndr-verify never use it. */
 
     if (done)
       {
+      if (!(options & vopt_is_recipient  &&  options & vopt_callout_no_cache))
+       sx.avoid_option = OPTION_SIZE;
+
       done = FALSE;
       switch(smtp_write_mail_and_rcpt_cmds(&sx, &yield))
        {
@@ -852,12 +859,12 @@ tls_retry_connection:
                    case PENDING_OK:  done = TRUE;
                                      new_address_record.result = ccache_accept;
                                      break;
-                   case FAIL:        done = TRUE;
+                   case FAIL:      done = TRUE;
                                      yield = FAIL;
                                      *failure_ptr = US"recipient";
                                      new_address_record.result = ccache_reject;
                                      break;
-                   default:          break;
+                   default:        break;
                    }
                  break;
 
@@ -910,6 +917,7 @@ tls_retry_connection:
        sx.ok = FALSE;
        sx.send_rset = TRUE;
        sx.completed_addr = FALSE;
+       sx.avoid_option = OPTION_SIZE;
 
        if(  smtp_write_mail_and_rcpt_cmds(&sx, &yield) == 0
          && addr->transport_return == PENDING_OK
index ed988ac85d81a6e15301312a4f2271d02c640b60..fea66e16f8d7b950f9a91350e970bd4ff582353a 100644 (file)
@@ -24,6 +24,8 @@ check_recipient:
          !verify   = sender/callout=no_cache
   deny    hosts    = V4NET.0.0.3
          !verify   = recipient/callout=no_cache
+  deny    hosts    = V4NET.0.0.7
+         !verify   = recipient/callout=no_cache,use_sender,random
   deny    hosts    = V4NET.0.0.5
          !verify   = sender/callout=no_cache/check_postmaster
   deny    hosts    = V4NET.0.0.6
index f1e64701c5f96d26bc59e18ea3d9d1abebf17933..d91075fb6251c35c4e4150627faf342212e8e4dd 100644 (file)
@@ -14,6 +14,9 @@
 1999-03-02 09:44:33 H=[V4NET.0.0.5] U=root F=<ok@localhost1> rejected RCPT <z@remote.domain>: relay not permitted
 1999-03-02 09:44:33 H=[V4NET.0.0.5] U=root sender verify fail for <ok@localhost1>: 127.0.0.1 [127.0.0.1] : SMTP error from remote mail server after RCPT TO:<postmaster@localhost1>: 550 Don't like postmaster
 1999-03-02 09:44:33 H=[V4NET.0.0.5] U=root F=<ok@localhost1> rejected RCPT <z@remote.domain>: Sender verify failed
+1999-03-02 09:44:33 H=(me) [V4NET.0.0.3] U=root F=<ok@localhost1> rejected RCPT <z@remote.domain>: relay not permitted
+1999-03-02 09:44:33 H=(me) [V4NET.0.0.3] U=root F=<ok@localhost1> rejected RCPT <z@remote.domain>: relay not permitted
+1999-03-02 09:44:33 H=(me) [V4NET.0.0.7] U=root F=<ok@localhost1> rejected RCPT <z@remote.domain>: relay not permitted
 1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@remote.lmtp>: 127.0.0.1 [127.0.0.1] : SMTP error from remote mail server after RCPT TO:<z@remote.lmtp>: 550 Recipient not liked
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root sender verify defer for <bad@localhost1>: Could not complete sender verify callout: 127.0.0.1 [127.0.0.1] : Remote host closed connection in response to initial connection
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<bad@localhost1> temporarily rejected RCPT <z@test.ex>: Could not complete sender verify callout
index 8f5c0ad150463fcae22590f599a8d2e4dd6b7bda..e44ddafbc42e2c4dee9b82b597fe0b5f03c86555 100644 (file)
@@ -30,6 +30,9 @@ F From: abcd@x.y.z
 1999-03-02 09:44:33 H=[V4NET.0.0.5] U=root F=<ok@localhost1> rejected RCPT <z@remote.domain>: relay not permitted
 1999-03-02 09:44:33 H=[V4NET.0.0.5] U=root sender verify fail for <ok@localhost1>: 127.0.0.1 [127.0.0.1] : SMTP error from remote mail server after RCPT TO:<postmaster@localhost1>: 550 Don't like postmaster
 1999-03-02 09:44:33 H=[V4NET.0.0.5] U=root F=<ok@localhost1> rejected RCPT <z@remote.domain>: Sender verify failed
+1999-03-02 09:44:33 H=(me) [V4NET.0.0.3] U=root F=<ok@localhost1> rejected RCPT <z@remote.domain>: relay not permitted
+1999-03-02 09:44:33 H=(me) [V4NET.0.0.3] U=root F=<ok@localhost1> rejected RCPT <z@remote.domain>: relay not permitted
+1999-03-02 09:44:33 H=(me) [V4NET.0.0.7] U=root F=<ok@localhost1> rejected RCPT <z@remote.domain>: relay not permitted
 1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@remote.lmtp>: 127.0.0.1 [127.0.0.1] : SMTP error from remote mail server after RCPT TO:<z@remote.lmtp>: 550 Recipient not liked
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root sender verify defer for <bad@localhost1>: Could not complete sender verify callout: 127.0.0.1 [127.0.0.1] : Remote host closed connection in response to initial connection
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<bad@localhost1> temporarily rejected RCPT <z@test.ex>: Could not complete sender verify callout
index a67dab2ebd9a1d9e4a3a284c94c3e8a827537f02..e53c1da7ffa94b70ae800f3c3998aebc58df7cc2 100644 (file)
@@ -12,11 +12,13 @@ RCPT TO
 QUIT
 250 OK
 ****
+# sender
 sudo exim -v -bs -oMa V4NET.0.0.1
 MAIL FROM:<ok@localhost>
 RCPT TO:<z@test.ex>
 QUIT
 ****
+# sender, no callout
 sudo exim -v -bs -oMa V4NET.0.0.2
 MAIL FROM:<unchecked@localhost>
 RCPT TO:<z@test.ex>
@@ -33,6 +35,7 @@ RCPT TO
 QUIT
 250 OK
 ****
+# sender, refused
 sudo exim -v -bs -oMa V4NET.0.0.1
 MAIL FROM:<bad@localhost>
 RCPT TO:<z@test.ex>
@@ -49,6 +52,7 @@ RCPT TO
 QUIT
 250 OK
 ****
+# sender, tmperr
 sudo exim -v -bs -oMa V4NET.0.0.1
 MAIL FROM:<uncheckable@localhost1>
 RCPT TO:<z@test.ex>
@@ -63,6 +67,7 @@ MAIL FROM
 QUIT
 250 OK
 ****
+# sender, err on mailfrom
 sudo exim -v -bs -oMa V4NET.0.0.1
 MAIL FROM:<uncheckable2@localhost1>
 RCPT TO:<z@test.ex>
@@ -78,6 +83,7 @@ MAIL FROM
 QUIT
 250 OK
 ****
+# sender, err on mailfrom
 sudo exim -v -bs -oMa V4NET.0.0.1
 MAIL FROM:<uncheckable@localhost1>
 RCPT TO:<z@test.ex>
@@ -94,6 +100,7 @@ RCPT TO
 QUIT
 250 OK
 ****
+# recipient, refused
 sudo exim -v -bs -oMa V4NET.0.0.3
 MAIL FROM:<uncheckable@localhost1>
 RCPT TO:<z@remote.domain>
@@ -111,11 +118,13 @@ RCPT TO
 QUIT
 250 OK
 ****
+# recipient, refused
 sudo exim -v -bs -oMa V4NET.0.0.3
 MAIL FROM:<uncheckable@localhost1>
 RCPT TO:<z@remote.domain>
 QUIT
 ****
+# recipient, no conneect
 sudo exim -v -bs -oMa V4NET.0.0.3
 MAIL FROM:<uncheckable@localhost1>
 RCPT TO:<z@remote.domain>
@@ -207,16 +216,17 @@ QUIT
 server PORT_S
 220 Server ready
 EHLO
-250- wotcher
+250- wotcher sverifier
 250-SIZE
 250 OK
-MAIL FROM
+MAIL FROM:<>
 250 OK
 RCPT TO
 250 OK
 QUIT
 250 OK
 ****
+# sender, size known, tgt supports sixe
 sudo exim -v -bs -oMa V4NET.0.0.6
 EHLO me
 MAIL FROM:<ok@localhost1> SIZE=420000
@@ -226,6 +236,76 @@ QUIT
 #
 server PORT_S
 220 Server ready
+EHLO
+250- wotcher rverifier
+250-SIZE
+250 OK
+MAIL FROM:<> SIZE=
+250 OK
+RCPT TO
+250 OK
+QUIT
+250 OK
+****
+# receipient, size known, tgt supports size
+sudo exim -v -bs -oMa V4NET.0.0.3
+EHLO me
+MAIL FROM:<ok@localhost1> SIZE=420000
+RCPT TO:<z@remote.domain>
+QUIT
+****
+#
+server PORT_S
+220 Server ready
+EHLO
+250- wotcher rverifier
+250-SIZE
+250 OK
+MAIL FROM:<>
+250 OK
+RCPT TO
+250 OK
+QUIT
+250 OK
+****
+# receipient, size unknown, tgt supports size
+sudo exim -v -bs -oMa V4NET.0.0.3
+EHLO me
+MAIL FROM:<ok@localhost1>
+RCPT TO:<z@remote.domain>
+QUIT
+****
+#
+server PORT_S
+220 Server ready
+EHLO
+250- wotcher rverifier
+250-SIZE
+250 OK
+MAIL FROM:<ok@localhost1>
+250 OK
+RCPT TO:<myhost.test.ex-
+550 RANDOM NOT OK
+RSET
+250 OK
+MAIL FROM:<ok@localhost1> SIZE=
+250 OK
+RCPT TO:<z@remote.domain>
+250 OK
+QUIT
+250 OK
+****
+# receipient, size known, tgt supports size, use_sender, w/random
+# stdout should see SIZE on the main but not on the random receipient's MAIL FROM
+sudo exim -v -bs -oMa V4NET.0.0.7
+EHLO me
+MAIL FROM:<ok@localhost1> SIZE=420000
+RCPT TO:<z@remote.domain>
+QUIT
+****
+#
+server PORT_S
+220 Server ready
 LHLO
 250 OK
 MAIL FROM
index 6a8ee1f7e887efd40d8fa7fe6ce59def00efe343..e3282cc6f4bf333a63870ccf12a4d5102bbe6a38 100644 (file)
@@ -222,10 +222,10 @@ LOG: smtp_connection MAIN
 Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
   SMTP<< 220 Server ready
   SMTP>> EHLO myhost.test.ex
-  SMTP<< 250- wotcher
+  SMTP<< 250- wotcher sverifier
          250-SIZE
          250 OK
-  SMTP>> MAIL FROM:<> SIZE=ssss
+  SMTP>> MAIL FROM:<>
   SMTP<< 250 OK
   SMTP>> RCPT TO:<ok@localhost1>
   SMTP<< 250 OK
@@ -236,6 +236,69 @@ LOG: smtp_connection MAIN
   SMTP connection from root closed by QUIT
 LOG: smtp_connection MAIN
   SMTP connection from root
+Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
+  SMTP<< 220 Server ready
+  SMTP>> EHLO myhost.test.ex
+  SMTP<< 250- wotcher rverifier
+         250-SIZE
+         250 OK
+  SMTP>> MAIL FROM:<> SIZE=ssss
+  SMTP<< 250 OK
+  SMTP>> RCPT TO:<z@remote.domain>
+  SMTP<< 250 OK
+  SMTP>> QUIT
+  SMTP<< 250 OK
+  SMTP(close)>>
+LOG: MAIN REJECT
+  H=(me) [V4NET.0.0.3] U=root F=<ok@localhost1> rejected RCPT <z@remote.domain>: relay not permitted
+LOG: smtp_connection MAIN
+  SMTP connection from root closed by QUIT
+LOG: smtp_connection MAIN
+  SMTP connection from root
+Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
+  SMTP<< 220 Server ready
+  SMTP>> EHLO myhost.test.ex
+  SMTP<< 250- wotcher rverifier
+         250-SIZE
+         250 OK
+  SMTP>> MAIL FROM:<>
+  SMTP<< 250 OK
+  SMTP>> RCPT TO:<z@remote.domain>
+  SMTP<< 250 OK
+  SMTP>> QUIT
+  SMTP<< 250 OK
+  SMTP(close)>>
+LOG: MAIN REJECT
+  H=(me) [V4NET.0.0.3] U=root F=<ok@localhost1> rejected RCPT <z@remote.domain>: relay not permitted
+LOG: smtp_connection MAIN
+  SMTP connection from root closed by QUIT
+LOG: smtp_connection MAIN
+  SMTP connection from root
+Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
+  SMTP<< 220 Server ready
+  SMTP>> EHLO myhost.test.ex
+  SMTP<< 250- wotcher rverifier
+         250-SIZE
+         250 OK
+  SMTP>> MAIL FROM:<ok@localhost1>
+  SMTP<< 250 OK
+  SMTP>> RCPT TO:<myhost.test.ex-dddddddd-testing@remote.domain>
+  SMTP<< 550 RANDOM NOT OK
+  SMTP>> RSET
+  SMTP<< 250 OK
+  SMTP>> MAIL FROM:<ok@localhost1> SIZE=ssss
+  SMTP<< 250 OK
+  SMTP>> RCPT TO:<z@remote.domain>
+  SMTP<< 250 OK
+  SMTP>> QUIT
+  SMTP<< 250 OK
+  SMTP(close)>>
+LOG: MAIN REJECT
+  H=(me) [V4NET.0.0.7] U=root F=<ok@localhost1> rejected RCPT <z@remote.domain>: relay not permitted
+LOG: smtp_connection MAIN
+  SMTP connection from root closed by QUIT
+LOG: smtp_connection MAIN
+  SMTP connection from root
 Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
   SMTP<< 220 Server ready
   SMTP>> LHLO myhost.test.ex
index 6c1f10e392d83931a9e9a2e1697cf2b11e676610..f9241a5d0b199b28cb2e46bcda2babf4acb83b2a 100644 (file)
@@ -119,7 +119,7 @@ cmd buf flush ddd bytes
 using PIPELINING
 not using DSN
 127.0.0.1 in hosts_require_auth? no (option unset)
-  SMTP>> MAIL FROM:<CALLER@myhost.test.ex> SIZE=ssss
+  SMTP>> MAIL FROM:<CALLER@myhost.test.ex>
   SMTP>> RCPT TO:<userx@domain.com>
 cmd buf flush ddd bytes
   SMTP<< 250 OK
@@ -345,7 +345,7 @@ cmd buf flush ddd bytes
 using PIPELINING
 not using DSN
 127.0.0.1 in hosts_require_auth? no (option unset)
-  SMTP>> MAIL FROM:<CALLER@myhost.test.ex> SIZE=ssss
+  SMTP>> MAIL FROM:<CALLER@myhost.test.ex>
   SMTP>> RCPT TO:<usery@domain.com>
 cmd buf flush ddd bytes
   SMTP<< 250 OK
@@ -571,7 +571,7 @@ cmd buf flush ddd bytes
 using PIPELINING
 not using DSN
 127.0.0.1 in hosts_require_auth? no (option unset)
-  SMTP>> MAIL FROM:<CALLER@myhost.test.ex> SIZE=ssss
+  SMTP>> MAIL FROM:<CALLER@myhost.test.ex>
   SMTP>> RCPT TO:<usery@domain.com>
 cmd buf flush ddd bytes
   SMTP<< 250 OK
index 0f197afd1802cd1e01b99291999bd670490392fd..27bc24fa60c62ab7cdf38e402d2b47e8bcd4b830 100644 (file)
@@ -118,7 +118,7 @@ cmd buf flush ddd bytes
 using PIPELINING
 not using DSN
 127.0.0.1 in hosts_require_auth? no (option unset)
-  SMTP>> MAIL FROM:<CALLER@myhost.test.ex> SIZE=ssss
+  SMTP>> MAIL FROM:<CALLER@myhost.test.ex>
   SMTP>> RCPT TO:<userx@domain.com>
 cmd buf flush ddd bytes
   SMTP<< 250 OK
@@ -344,7 +344,7 @@ cmd buf flush ddd bytes
 using PIPELINING
 not using DSN
 127.0.0.1 in hosts_require_auth? no (option unset)
-  SMTP>> MAIL FROM:<CALLER@myhost.test.ex> SIZE=ssss
+  SMTP>> MAIL FROM:<CALLER@myhost.test.ex>
   SMTP>> RCPT TO:<usery@domain.com>
 cmd buf flush ddd bytes
   SMTP<< 250 OK
@@ -570,7 +570,7 @@ cmd buf flush ddd bytes
 using PIPELINING
 not using DSN
 127.0.0.1 in hosts_require_auth? no (option unset)
-  SMTP>> MAIL FROM:<CALLER@myhost.test.ex> SIZE=ssss
+  SMTP>> MAIL FROM:<CALLER@myhost.test.ex>
   SMTP>> RCPT TO:<usery@domain.com>
 cmd buf flush ddd bytes
   SMTP<< 250 OK
index e4cf15c5142e998e74da3afdded28ad1f284a23a..f1d0e672fece941b35a5262323a31bdad51e8a4c 100644 (file)
@@ -53,9 +53,9 @@ MUNGED: ::1 will be omitted in what follows
 >>>          250 HELP
 >>> ip4.ip4.ip4.ip4 in hosts_avoid_pipelining? no (option unset)
 >>> ip4.ip4.ip4.ip4 in hosts_require_auth? no (option unset)
->>>   SMTP>> MAIL FROM:<> SIZE=ssss
+>>>   SMTP>> MAIL FROM:<>
 >>>   SMTP>> RCPT TO:<rcptuser@dane256ee.test.ex>
->>> cmd buf flush 62 bytes
+>>> cmd buf flush 52 bytes
 >>>   SMTP<< 250 OK
 >>>   SMTP<< 250 Accepted
 >>>   SMTP>> QUIT
index ea8520ef16e283b2baaedb17bd7cf90f2d7b4412..9ee7e9f546d493416db99bac97438493796bbfb5 100644 (file)
 250 Accepted\r
 221 myhost.test.ex closing connection\r
 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250-myhost.test.ex Hello root at me [V4NET.0.0.3]\r
+250-SIZE 52428800\r
+250-8BITMIME\r
+250-PIPELINING\r
+250 HELP\r
+250 OK\r
+550 relay not permitted\r
+221 myhost.test.ex closing connection\r
+220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250-myhost.test.ex Hello root at me [V4NET.0.0.3]\r
+250-SIZE 52428800\r
+250-8BITMIME\r
+250-PIPELINING\r
+250 HELP\r
+250 OK\r
+550 relay not permitted\r
+221 myhost.test.ex closing connection\r
+220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250-myhost.test.ex Hello root at me [V4NET.0.0.7]\r
+250-SIZE 52428800\r
+250-8BITMIME\r
+250-PIPELINING\r
+250 HELP\r
+250 OK\r
+550 relay not permitted\r
+221 myhost.test.ex closing connection\r
+220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
 250 OK\r
 550-Callout verification failed:\r
 550 550 Recipient not liked\r
@@ -248,10 +275,10 @@ Listening on port 1224 ...
 Connection request from [127.0.0.1]
 220 Server ready
 EHLO myhost.test.ex
-250- wotcher
+250- wotcher sverifier
 250-SIZE
 250 OK
-MAIL FROM:<> SIZE=ssss
+MAIL FROM:<>
 250 OK
 RCPT TO:<ok@localhost1>
 250 OK
@@ -261,6 +288,54 @@ End of script
 Listening on port 1224 ... 
 Connection request from [127.0.0.1]
 220 Server ready
+EHLO myhost.test.ex
+250- wotcher rverifier
+250-SIZE
+250 OK
+MAIL FROM:<> SIZE=ssss
+250 OK
+RCPT TO:<z@remote.domain>
+250 OK
+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- wotcher rverifier
+250-SIZE
+250 OK
+MAIL FROM:<>
+250 OK
+RCPT TO:<z@remote.domain>
+250 OK
+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- wotcher rverifier
+250-SIZE
+250 OK
+MAIL FROM:<ok@localhost1>
+250 OK
+RCPT TO:<myhost.test.ex-dddddddd-testing@remote.domain>
+550 RANDOM NOT OK
+RSET
+250 OK
+MAIL FROM:<ok@localhost1> SIZE=ssss
+250 OK
+RCPT TO:<z@remote.domain>
+250 OK
+QUIT
+250 OK
+End of script
+Listening on port 1224 ... 
+Connection request from [127.0.0.1]
+220 Server ready
 LHLO myhost.test.ex
 250 OK
 MAIL FROM:<>