Compiler quietening
[exim.git] / src / src / deliver.c
index 4462d5c4af9c81f5891ab4169ace2eb571f67c54..2c0524e357984c2abfeff67b1d96956befebefd5 100644 (file)
@@ -718,27 +718,27 @@ d_tlslog(uschar * s, int * sizep, int * ptrp, address_item * addr)
 
 
 
-#ifdef EXPERIMENTAL_TPDA
-int
-tpda_raise_event(uschar * action, uschar * event, uschar * ev_data)
+#ifdef EXPERIMENTAL_EVENT
+uschar *
+event_raise(uschar * action, uschar * event, uschar * ev_data)
 {
 uschar * s;
 if (action)
   {
   DEBUG(D_deliver)
-    debug_printf("TPDA(%s): tpda_event_action=|%s| tpda_delivery_IP=%s\n",
+    debug_printf("Event(%s): event_action=|%s| delivery_IP=%s\n",
       event,
       action, deliver_host_address);
 
-  tpda_event = event;
-  tpda_data =  ev_data;
+  event_name = event;
+  event_data = ev_data;
 
   if (!(s = expand_string(action)) && *expand_string_message)
     log_write(0, LOG_MAIN|LOG_PANIC,
-      "failed to expand tpda_event_action %s in %s: %s\n",
+      "failed to expand event_action %s in %s: %s\n",
       event, transport_name, expand_string_message);
 
-  tpda_event = tpda_data = NULL;
+  event_name = event_data = NULL;
 
   /* If the expansion returns anything but an empty string, flag for
   the caller to modify his normal processing
@@ -746,15 +746,15 @@ if (action)
   if (s && *s)
     {
     DEBUG(D_deliver)
-      debug_printf("TPDA(%s): event_action returned \"%s\"\n", event, s);
-    return DEFER;
+      debug_printf("Event(%s): event_action returned \"%s\"\n", event, s);
+    return s;
     }
   }
-return OK;
+return NULL;
 }
 
 static void
-tpda_msg_event(uschar * event, address_item * addr)
+msg_event_raise(uschar * event, address_item * addr)
 {
 uschar * save_domain = deliver_domain;
 uschar * save_local =  deliver_localpart;
@@ -769,7 +769,7 @@ deliver_domain = addr->domain;
 deliver_localpart = addr->local_part;
 deliver_host =   addr->host_used ? addr->host_used->name : NULL;
 
-(void) tpda_raise_event(addr->transport->tpda_event_action, event,
+(void) event_raise(addr->transport->event_action, event,
          addr->host_used || Ustrcmp(addr->transport->driver_name, "lmtp") == 0
          ? addr->message : NULL);
 
@@ -778,7 +778,7 @@ deliver_localpart = save_local;
 deliver_domain =    save_domain;
 router_name = transport_name = NULL;
 }
-#endif /*EXPERIMENTAL_TPDA*/
+#endif /*EXPERIMENTAL_EVENT*/
 
 
 
@@ -803,7 +803,7 @@ the log line, and reset the store afterwards. Remote deliveries should always
 have a pointer to the host item that succeeded; local deliveries can have a
 pointer to a single host item in their host list, for use by the transport. */
 
-#ifdef EXPERIMENTAL_TPDA
+#ifdef EXPERIMENTAL_EVENT
   /* presume no successful remote delivery */
   lookup_dnssec_authenticated = NULL;
 #endif
@@ -870,7 +870,7 @@ else
     if (continue_sequence > 1)
       s = string_cat(s, &size, &ptr, US"*", 1);
 
-#ifdef EXPERIMENTAL_TPDA
+#ifdef EXPERIMENTAL_EVENT
     deliver_host_address = addr->host_used->address;
     deliver_host_port =    addr->host_used->port;
     deliver_host =         addr->host_used->name;
@@ -939,8 +939,8 @@ store we used to build the line after writing it. */
 s[ptr] = 0;
 log_write(0, flags, "%s", s);
 
-#ifdef EXPERIMENTAL_TPDA
-if (!msg) tpda_msg_event(US"msg:delivery", addr);
+#ifdef EXPERIMENTAL_EVENT
+if (!msg) msg_event_raise(US"msg:delivery", addr);
 #endif
 
 store_reset(reset_point);
@@ -1138,7 +1138,7 @@ if (result == OK)
     child_done(addr, now);
     }
 
-  /* Certificates for logging (via TPDA) */
+  /* Certificates for logging (via events) */
 #ifdef SUPPORT_TLS
   tls_out.ourcert = addr->ourcert;
   addr->ourcert = NULL;
@@ -1381,8 +1381,8 @@ else
 
   log_write(0, LOG_MAIN, "** %s", s);
 
-#ifdef EXPERIMENTAL_TPDA
-  tpda_msg_event(US"msg:fail:delivery", addr);
+#ifdef EXPERIMENTAL_EVENT
+  msg_event_raise(US"msg:fail:delivery", addr);
 #endif
 
   store_reset(reset_point);
@@ -5585,7 +5585,7 @@ if (process_recipients != RECIP_IGNORE)
         break;
         }
 
-#ifdef EXPERIMENTAL_TPDA
+#ifdef EXPERIMENTAL_EVENT
       if (process_recipients != RECIP_ACCEPT)
        {
        uschar * save_local =  deliver_localpart;
@@ -5596,7 +5596,7 @@ if (process_recipients != RECIP_IGNORE)
        deliver_domain =    expand_string(
                      string_sprintf("${domain:%s}", new->address));
 
-       (void) tpda_raise_event(delivery_event_action,
+       (void) event_raise(event_action,
                      US"msg:fail:internal", new->message);
 
        deliver_localpart = save_local;
@@ -6660,14 +6660,13 @@ if (addr_senddsn != NULL)
     FILE *f = fdopen(fd, "wb");
     /* header only as required by RFC. only failure DSN needs to honor RET=FULL */
     int topt = topt_add_return_path | topt_no_body;
-    uschar boundaryStr[64];
+    uschar * bound;
      
     DEBUG(D_deliver) debug_printf("sending error message to: %s\n", sender_address);
   
     /* build unique id for MIME boundary */
-    snprintf(boundaryStr, sizeof(boundaryStr)-1, TIME_T_FMT "-eximdsn-%d",
-      time(NULL), rand());
-    DEBUG(D_deliver) debug_printf("DSN: MIME boundary: %s\n", boundaryStr);
+    bound = string_sprintf(TIME_T_FMT "-eximdsn-%d", time(NULL), rand());
+    DEBUG(D_deliver) debug_printf("DSN: MIME boundary: %s\n", bound);
   
     if (errors_reply_to)
       fprintf(f, "Reply-To: %s\n", errors_reply_to);
@@ -6684,7 +6683,7 @@ if (addr_senddsn != NULL)
    
        "This message was created automatically by mail delivery software.\n"
        " ----- The following addresses had successful delivery notifications -----\n",
-      qualify_domain_sender, sender_address, boundaryStr, boundaryStr);
+      qualify_domain_sender, sender_address, bound, bound);
 
     addr_dsntmp = addr_senddsn;
     while(addr_dsntmp)
@@ -6702,7 +6701,7 @@ if (addr_senddsn != NULL)
     fprintf(f, "--%s\n"
        "Content-type: message/delivery-status\n\n"
        "Reporting-MTA: dns; %s\n",
-      boundaryStr, smtp_active_hostname);
+      bound, smtp_active_hostname);
 
     if (dsn_envid != NULL) {
       /* must be decoded from xtext: see RFC 3461:6.3a */
@@ -6735,7 +6734,7 @@ if (addr_senddsn != NULL)
       fputc('\n', f);
       }
 
-    fprintf(f, "--%s\nContent-type: text/rfc822-headers\n\n", boundaryStr);
+    fprintf(f, "--%s\nContent-type: text/rfc822-headers\n\n", bound);
            
     fflush(f);
     transport_filter_argv = NULL;   /* Just in case */
@@ -6746,7 +6745,7 @@ if (addr_senddsn != NULL)
     fflush(f);
 
     fprintf(f,"\n");       
-    fprintf(f,"--%s--\n", boundaryStr);
+    fprintf(f,"--%s--\n", bound);
 
     fflush(f);
     fclose(f);
@@ -6871,7 +6870,7 @@ while (addr_failed != NULL)
       int max = (bounce_return_size_limit/DELIVER_IN_BUFFER_SIZE + 1) *
         DELIVER_IN_BUFFER_SIZE;
 #ifdef EXPERIMENTAL_DSN
-      uschar boundaryStr[64];
+      uschar * bound;
       uschar *dsnlimitmsg;
       uschar *dsnnotifyhdr;
       int topt;
@@ -6931,13 +6930,12 @@ while (addr_failed != NULL)
 
 #ifdef EXPERIMENTAL_DSN
       /* generate boundary string and output MIME-Headers */
-      snprintf(boundaryStr, sizeof(boundaryStr)-1, TIME_T_FMT "-eximdsn-%d",
-       time(NULL), rand());
+      bound = string_sprintf(TIME_T_FMT "-eximdsn-%d", time(NULL), rand());
 
       fprintf(f, "Content-Type: multipart/report;"
            " report-type=delivery-status; boundary=%s\n"
          "MIME-Version: 1.0\n",
-       boundaryStr);
+       bound);
 #endif
 
       /* Open a template file if one is provided. Log failure to open, but
@@ -6967,7 +6965,7 @@ while (addr_failed != NULL)
       /* output human readable part as text/plain section */
       fprintf(f, "--%s\n"
          "Content-type: text/plain; charset=us-ascii\n\n",
-       boundaryStr);
+       bound);
 #endif
 
       if ((emf_text = next_emf(emf, US"intro")))
@@ -7100,7 +7098,7 @@ wording. */
       fprintf(f, "--%s\n"
          "Content-type: message/delivery-status\n\n"
          "Reporting-MTA: dns; %s\n",
-       boundaryStr, smtp_active_hostname);
+       bound, smtp_active_hostname);
 
       if (dsn_envid)
        {
@@ -7202,7 +7200,7 @@ wording. */
          bounce_return_size_limit is always honored.
       */
   
-      fprintf(f, "\n--%s\n", boundaryStr);
+      fprintf(f, "\n--%s\n", bound);
 
       dsnlimitmsg = US"X-Exim-DSN-Information: Due to administrative limits only headers are returned";
       dsnnotifyhdr = NULL;
@@ -7247,7 +7245,7 @@ wording. */
       if (emf)
         (void)fclose(emf);
  
-      fprintf(f, "\n--%s--\n", boundaryStr);
+      fprintf(f, "\n--%s--\n", bound);
 #endif /*EXPERIMENTAL_DSN*/
 
       /* Close the file, which should send an EOF to the child process
@@ -7364,8 +7362,8 @@ if (addr_defer == NULL)
   /* Unset deliver_freeze so that we won't try to move the spool files further down */
   deliver_freeze = FALSE;
 
-#ifdef EXPERIMENTAL_TPDA
-  (void) tpda_raise_event(delivery_event_action, US"msg:complete", NULL);
+#ifdef EXPERIMENTAL_EVENT
+  (void) event_raise(event_action, US"msg:complete", NULL);
 #endif
 }
 
@@ -7553,7 +7551,7 @@ else if (addr_defer != (address_item *)(+1))
         FILE *wmf = NULL;
         FILE *f = fdopen(fd, "wb");
 #ifdef EXPERIMENTAL_DSN
-       uschar boundaryStr[64];
+       uschar * bound;
 #endif
 
         if (warn_message_file)
@@ -7577,13 +7575,12 @@ else if (addr_defer != (address_item *)(+1))
 
 #ifdef EXPERIMENTAL_DSN
         /* generated boundary string and output MIME-Headers */
-        snprintf(boundaryStr, sizeof(boundaryStr)-1,
-         TIME_T_FMT "-eximdsn-%d", time(NULL), rand());
+        bound = string_sprintf(TIME_T_FMT "-eximdsn-%d", time(NULL), rand());
 
         fprintf(f, "Content-Type: multipart/report;"
            " report-type=delivery-status; boundary=%s\n"
            "MIME-Version: 1.0\n",
-         boundaryStr);
+         bound);
 #endif
 
         if ((wmf_text = next_emf(wmf, US"header")))
@@ -7596,7 +7593,7 @@ else if (addr_defer != (address_item *)(+1))
         /* output human readable part as text/plain section */
         fprintf(f, "--%s\n"
            "Content-type: text/plain; charset=us-ascii\n\n",
-         boundaryStr);
+         bound);
 #endif
 
         if ((wmf_text = next_emf(wmf, US"intro")))
@@ -7673,7 +7670,7 @@ else if (addr_defer != (address_item *)(+1))
         fprintf(f, "\n--%s\n"
            "Content-type: message/delivery-status\n\n"
            "Reporting-MTA: dns; %s\n",
-         boundaryStr,
+         bound,
          smtp_active_hostname);
  
 
@@ -7704,7 +7701,7 @@ else if (addr_defer != (address_item *)(+1))
 
         fprintf(f, "\n--%s\n"
            "Content-type: text/rfc822-headers\n\n",
-         boundaryStr);
+         bound);
 
         fflush(f);
         /* header only as required by RFC. only failure DSN needs to honor RET=FULL */
@@ -7715,7 +7712,7 @@ else if (addr_defer != (address_item *)(+1))
         transport_write_message(NULL, fileno(f), topt, 0, NULL, NULL, NULL, NULL, NULL, 0);
         fflush(f);
 
-        fprintf(f,"\n--%s--\n", boundaryStr);
+        fprintf(f,"\n--%s--\n", bound);
 
         fflush(f);
 #endif /*EXPERIMENTAL_DSN*/