Callouts: fix recipient verify/random
[exim.git] / src / src / verify.c
index 3dd2d3a39c9c850ee6bf196f6ec0194c8495bdce..96c2b66cc0b16a0a95117043a785c24eeedd1f0a 100644 (file)
@@ -778,6 +778,9 @@ tls_retry_connection:
       need another return code filtering out to here.
       */
 
+      /* Remember when we last did a random test */
+      new_domain_record.random_stamp = time(NULL);
+
       if (smtp_write_mail_and_rcpt_cmds(&sx, &yield) == 0)
        switch(addr->transport_return)
          {
@@ -810,13 +813,15 @@ tls_retry_connection:
            (void) event_raise(addr->transport->event_action,
                              US"tcp:close", NULL);
 #endif
+           addr->address = main_address;
+           addr->transport_return = PENDING_DEFER;
+           sx.first_addr = sx.sync_addr = addr;
+           sx.ok = FALSE;
+           sx.send_rset = TRUE;
+           sx.completed_addr = FALSE;
            goto tls_retry_connection;
          }
 
-      /* Remember when we last did a random test */
-
-      new_domain_record.random_stamp = time(NULL);
-
       /* Re-setup for main verify, or for the error message when failing */
       addr->address = main_address;
       addr->transport_return = PENDING_DEFER;