perl version oddity
[exim.git] / src / src / dcc.c
index fb32fef6af266d3e32ab2be4bb42bd50bfaa3f11..8939bbef6b9e412f7dc70ddd6d49c52be09aabfc 100644 (file)
@@ -2,18 +2,24 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) Wolfgang Breyha 2005 - 2019
+/*
+ * Copyright (c) The Exim Maintainers 2015 - 2023
+ * Copyright (c) Wolfgang Breyha 2005 - 2019
  * Vienna University Computer Center
  * wbreyha@gmx.net
  * See the file NOTICE for conditions of use and distribution.
  *
- * Copyright (c) The Exim Maintainers 2015 - 2019
+ * SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 /* Code for calling dccifd. Called from acl.c. */
 
 #include "exim.h"
 #ifdef EXPERIMENTAL_DCC
+#ifndef WITH_CONTENT_SCAN
+# error EXPERIMENTAL_DCC requires WITH_CONTENT_SCAN
+#endif
+
 #include "dcc.h"
 #include "unistd.h"
 
@@ -232,11 +238,11 @@ for (int i = 0; i < recipients_count; i++)
   }
 /* send a blank line between options and message */
 dcc_headers = string_catn(dcc_headers, US"\n", 1);
+
 /* Now we send the input buffer */
-(void) string_from_gstring(dcc_headers);
 DEBUG(D_acl)
-  debug_printf("DCC: ***********************************\nDCC: Sending options:\n%s"
-              "DCC: ***********************************\n", dcc_headers->s);
+  debug_printf("DCC: ***********************************\nDCC: Sending options:\n%Y"
+              "DCC: ***********************************\n", dcc_headers);
 if (flushbuffer(sockfd, dcc_headers) != 0)
   {
   (void)fclose(data_file);
@@ -254,10 +260,9 @@ while((mail_headers=mail_headers->next))
 
 /* a blank line separates header from body */
 sendbuf = string_catn(sendbuf, US"\r\n", 2);
-(void) string_from_gstring(sendbuf);
 gstring_release_unused(sendbuf);
 DEBUG(D_acl)
-  debug_printf("%sDCC: ***********************************\n", sendbuf->s);
+  debug_printf("%YDCC: ***********************************\n", sendbuf);
 if (flushbuffer(sockfd, sendbuf) != 0)
   {
   (void)fclose(data_file);
@@ -267,7 +272,7 @@ if (flushbuffer(sockfd, sendbuf) != 0)
 /* now send the body */
 DEBUG(D_acl)
   debug_printf("DCC: ***********************************\nDCC: Writing body:\n");
-(void)fseek(data_file, SPOOL_DATA_START_OFFSET, SEEK_SET);
+(void)fseek(data_file, spool_data_start_offset(message_id), SEEK_SET);
 
 gstring filebuf = { .size = big_buffer_size, .ptr = 0, .s = big_buffer };
 
@@ -444,23 +449,23 @@ dcc_header_str = string_catn(dcc_header_str, US"\n", 1);
 /* Now let's sum up what we've got. */
 DEBUG(D_acl)
   debug_printf("\nDCC: --------------------------\nDCC: Overall result = %d\n"
-              "DCC: X-DCC header: %sReturn message: %s\nDCC: dcc_result: %s\n",
-                retval, dcc_header_str->s, dcc_return_text, dcc_result);
+              "DCC: X-DCC header: %YReturn message: %s\nDCC: dcc_result: %s\n",
+                retval, dcc_header_str, dcc_return_text, dcc_result);
 
 /* We only add the X-DCC header if it starts with X-DCC */
 if(!(Ustrncmp(dcc_header_str->s, "X-DCC", 5)))
   {
-  dcc_header = dcc_header_str->s;
+  dcc_header = string_from_gstring(dcc_header_str);
   if(dcc_direct_add_header)
     {
-    header_add(' ' , "%s", dcc_header_str->s);
+    header_add(' ' , "%s", dcc_header);
 /* since the MIME ACL already writes the .eml file to disk without DCC Header we've to erase it */
     unspool_mbox();
     }
   }
 else
   DEBUG(D_acl)
-    debug_printf("DCC: Wrong format of the X-DCC header: %.*s\n", dcc_header_str->ptr, dcc_header_str->s);
+    debug_printf("DCC: Wrong format of the X-DCC header: %Y\n", dcc_header_str);
 
 /* check if we should add additional headers passed in acl_m_dcc_add_header */
 if (dcc_direct_add_header)
@@ -472,7 +477,7 @@ if (dcc_direct_add_header)
       dcc_xtra_hdrs = string_catn(dcc_xtra_hdrs, US"\n", 1);
     header_add(' ', "%s", string_from_gstring(dcc_xtra_hdrs));
     DEBUG(D_acl)
-      debug_printf("DCC: adding additional headers in $acl_m_dcc_add_header: %.*s", dcc_xtra_hdrs->ptr, dcc_xtra_hdrs->s);
+      debug_printf("DCC: adding additional headers in $acl_m_dcc_add_header: %Y", dcc_xtra_hdrs);
     }
   }