[exim-cvs] Better debug.

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Exim Git Commits Mailing List
Date:  
À: exim-cvs
Sujet: [exim-cvs] Better debug.
Gitweb: http://git.exim.org/exim.git/commitdiff/2e5b33cdf3591080e44862951f7c2ac9eced16de
Commit:     2e5b33cdf3591080e44862951f7c2ac9eced16de
Parent:     376bac608a7962729992ea1ca2b65aa00b4f9555
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Mon May 7 18:24:16 2012 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Mon Jun 4 14:57:03 2012 +0100


    Better debug.
---
 src/src/acl.c       |    6 +++---
 src/src/functions.h |    2 +-
 src/src/receive.c   |   16 ++++++++--------
 src/src/smtp_in.c   |    2 +-
 src/src/verify.c    |   23 ++++++++++++-----------
 5 files changed, 25 insertions(+), 24 deletions(-)


diff --git a/src/src/acl.c b/src/src/acl.c
index 3177ac8..a721665 100644
--- a/src/src/acl.c
+++ b/src/src/acl.c
@@ -3938,7 +3938,7 @@ switch (where)
 {
 case ACL_WHERE_RCPT:
   if( rcpt_count > 1 )
-    cancel_cutthrough_connection();
+    cancel_cutthrough_connection("more than one recipient");
   else if (rc == OK  &&  cutthrough_delivery  &&  cutthrough_fd < 0)
     open_cutthrough_connection(addr);
   break;
@@ -3947,12 +3947,12 @@ case ACL_WHERE_PREDATA:
   if( rc == OK )
     cutthrough_predata();
   else
-    cancel_cutthrough_connection();
+    cancel_cutthrough_connection("predata acl not ok");
   break;


case ACL_WHERE_QUIT:
case ACL_WHERE_NOTQUIT:
- cancel_cutthrough_connection();
+ cancel_cutthrough_connection("quit or notquit");
break;

 default:
diff --git a/src/src/functions.h b/src/src/functions.h
index 2500431..bc61f31 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -66,7 +66,7 @@ extern int     auth_get_no64_data(uschar **, uschar *);
 extern uschar *auth_xtextencode(uschar *, int);
 extern int     auth_xtextdecode(uschar *, uschar **);


-extern void    cancel_cutthrough_connection(void);
+extern void    cancel_cutthrough_connection(const char *);
 extern int     check_host(void *, uschar *, uschar **, uschar **);
 extern uschar **child_exec_exim(int, BOOL, int *, BOOL, int, ...);
 extern pid_t   child_open_uid(uschar **, uschar **, int, uid_t *, gid_t *,
diff --git a/src/src/receive.c b/src/src/receive.c
index d0fc0c2..636913b 100644
--- a/src/src/receive.c
+++ b/src/src/receive.c
@@ -1415,7 +1415,7 @@ search_tidyup();
 cutthrough delivery with the no-spool option.  It shouldn't be possible
 to set up the combination, but just in case kill any ongoing connection. */
 if (extract_recip || !smtp_input)
-  cancel_cutthrough_connection();
+  cancel_cutthrough_connection("not smtp input");


 /* Initialize the chain of headers by setting up a place-holder for Received:
 header. Temporarily mark it as "old", i.e. not to be used. We keep header_last
@@ -2716,7 +2716,7 @@ if (cutthrough_fd >= 0)
   {
   if (received_count > received_headers_max)
     {
-    cancel_cutthrough_connection();
+    cancel_cutthrough_connection("too many headers");
     if (smtp_input) receive_swallow_smtp();  /* Swallow incoming SMTP */
     log_write(0, LOG_MAIN|LOG_REJECT, "rejected from <%s>%s%s%s%s: "
       "Too many \"Received\" headers",
@@ -2816,7 +2816,7 @@ if (!ferror(data_file) && !(receive_feof)() && message_ended != END_DOT)
   if (smtp_input && message_ended == END_EOF)
     {
     Uunlink(spool_name);                     /* Lose data file when closed */
-    cancel_cutthrough_connection();
+    cancel_cutthrough_connection("sender closed connection");
     message_id[0] = 0;                       /* Indicate no message accepted */
     smtp_reply = handle_lost_connection(US"");
     smtp_yield = FALSE;
@@ -2829,7 +2829,7 @@ if (!ferror(data_file) && !(receive_feof)() && message_ended != END_DOT)
   if (message_ended == END_SIZE)
     {
     Uunlink(spool_name);                /* Lose the data file when closed */
-    cancel_cutthrough_connection();
+    cancel_cutthrough_connection("mail too big");
     if (smtp_input) receive_swallow_smtp();  /* Swallow incoming SMTP */


     log_write(L_size_reject, LOG_MAIN|LOG_REJECT, "rejected from <%s>%s%s%s%s: "
@@ -2885,7 +2885,7 @@ if (fflush(data_file) == EOF || ferror(data_file) ||


   log_write(0, LOG_MAIN, "Message abandoned: %s", msg);
   Uunlink(spool_name);                /* Lose the data file */
-  cancel_cutthrough_connection();
+  cancel_cutthrough_connection("error writing spoolfile");


   if (smtp_input)
     {
@@ -3128,7 +3128,7 @@ else
               {
                 DEBUG(D_receive)
                   debug_printf("acl_smtp_dkim: acl_check returned %d on %s, skipping remaining items\n", rc, item);
-            cancel_cutthrough_connection();
+            cancel_cutthrough_connection("dkim acl not ok");
                 break;
               }
             }
@@ -3174,12 +3174,12 @@ else
         blackholed_by = US"DATA ACL";
         if (log_msg != NULL)
           blackhole_log_msg = string_sprintf(": %s", log_msg);
-    cancel_cutthrough_connection();
+    cancel_cutthrough_connection("data acl discard");
         }
       else if (rc != OK)
         {
         Uunlink(spool_name);
-    cancel_cutthrough_connection();
+    cancel_cutthrough_connection("data acl not ok");
 #ifdef WITH_CONTENT_SCAN
         unspool_mbox();
 #endif
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index 4789fba..9c81579 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -1037,7 +1037,7 @@ store_reset(reset_point);
 recipients_list = NULL;
 rcpt_count = rcpt_defer_count = rcpt_fail_count =
   raw_recipients_count = recipients_count = recipients_list_max = 0;
-cancel_cutthrough_connection();
+cancel_cutthrough_connection("smtp reset");
 message_linecount = 0;
 message_size = -1;
 acl_added_headers = NULL;
diff --git a/src/src/verify.c b/src/src/verify.c
index 39ef337..23eab05 100644
--- a/src/src/verify.c
+++ b/src/src/verify.c
@@ -957,8 +957,9 @@ else
       }
     else
       {
+      /* Ensure no cutthrough on multiple address verifies */
       if (options & vopt_callout_recipsender)
-        cancel_cutthrough_connection();    /* Ensure no cutthrough on multiple address verifies */
+        cancel_cutthrough_connection("multiple verify calls");
       if (send_quit) (void)smtp_write_command(&outblock, FALSE, "QUIT\r\n");


       #ifdef SUPPORT_TLS
@@ -1129,7 +1130,7 @@ cutthrough_puts(uschar * cp, int n)
 {
 if (cutthrough_fd < 0)       return TRUE;
 if (_cutthrough_puts(cp, n)) return TRUE;
-cancel_cutthrough_connection();
+cancel_cutthrough_connection("transmit failed");
 return FALSE;
 }


@@ -1151,7 +1152,7 @@ BOOL
cutthrough_flush_send( void )
{
if (_cutthrough_flush_send()) return TRUE;
-cancel_cutthrough_connection();
+cancel_cutthrough_connection("transmit failed");
return FALSE;
}

@@ -1178,7 +1179,7 @@ inblock.ptrend = inbuffer;
inblock.sock = cutthrough_fd;
/* this relies on (inblock.sock == tls_out.active) */
if(!smtp_read_response(&inblock, responsebuffer, sizeof(responsebuffer), expect, CUTTHROUGH_DATA_TIMEOUT))
- cancel_cutthrough_connection();
+ cancel_cutthrough_connection("target timeout on read");

if(copy != NULL)
{
@@ -1235,7 +1236,7 @@ return cutthrough_put_nl();


static void
-close_cutthrough_connection( void )
+close_cutthrough_connection( const char * why )
{
if(cutthrough_fd >= 0)
{
@@ -1254,15 +1255,15 @@ if(cutthrough_fd >= 0)
#endif
(void)close(cutthrough_fd);
cutthrough_fd= -1;
- HDEBUG(D_acl) debug_printf("----------- cutthrough shutdown ------------\n");
+ HDEBUG(D_acl) debug_printf("----------- cutthrough shutdown (%s) ------------\n", why);
}
ctblock.ptr = ctbuffer;
}

void
-cancel_cutthrough_connection( void )
+cancel_cutthrough_connection( const char * why )
{
-close_cutthrough_connection();
+close_cutthrough_connection(why);
cutthrough_delivery= FALSE;
}

@@ -1287,7 +1288,7 @@ switch(cutthrough_response('2', &cutthrough_addr.message))
   {
   case '2':
     delivery_log(LOG_MAIN, &cutthrough_addr, (int)'>', NULL);
-    close_cutthrough_connection();
+    close_cutthrough_connection("delivered");
     break;


   case '4':
@@ -1761,7 +1762,7 @@ while (addr_new != NULL)
         }
       respond_printf(f, "%s\n", cr);
       }
-    cancel_cutthrough_connection();
+    cancel_cutthrough_connection("routing hard fail");


     if (!full_info) return copy_error(vaddr, addr, FAIL);
       else yield = FAIL;
@@ -1796,7 +1797,7 @@ while (addr_new != NULL)
         }
       respond_printf(f, "%s\n", cr);
       }
-    cancel_cutthrough_connection();
+    cancel_cutthrough_connection("routing soft fail");


     if (!full_info) return copy_error(vaddr, addr, DEFER);
       else if (yield == OK) yield = DEFER;