build: use pkg-config for i18n
[exim.git] / src / src / spool_in.c
index 1fcff954f76c53c23288b9e6fb9b8460e7310c9c..43b30986d9225ed761496aec9b44fade4e8bc796 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2024 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
@@ -36,7 +36,7 @@ Side effect: message_subdir is set for the (possibly split) spool directory
 */
 
 int
 */
 
 int
-spool_open_datafile(uschar * id)
+spool_open_datafile(const uschar * id)
 {
 struct stat statbuf;
 flock_t lock_data;
 {
 struct stat statbuf;
 flock_t lock_data;
@@ -269,9 +269,18 @@ bmi_verdicts = NULL;
 #endif
 
 #ifndef DISABLE_DKIM
 #endif
 
 #ifndef DISABLE_DKIM
-dkim_signers = NULL;
 f.dkim_disable_verify = FALSE;
 f.dkim_disable_verify = FALSE;
+# ifdef COMPILE_UTILITY
+dkim_signers = NULL;
 dkim_collect_input = 0;
 dkim_collect_input = 0;
+#else
+  {
+  misc_module_info * mi = misc_mod_findonly(US"dkim");
+  /* We used to clear only dkim_signers, dkim_collect_input. This does more
+  but I think it is safe. */
+  if (mi) mi->smtp_reset();
+  }
+# endif
 #endif
 
 #ifndef DISABLE_TLS
 #endif
 
 #ifndef DISABLE_TLS
@@ -323,7 +332,7 @@ while ((len = Ustrlen(big_buffer)) == big_buffer_size-1
 
   if (big_buffer_size >= BIG_BUFFER_SIZE * 4) return NULL;
   newsize = big_buffer_size * 2;
 
   if (big_buffer_size >= BIG_BUFFER_SIZE * 4) return NULL;
   newsize = big_buffer_size * 2;
-  newbuffer = store_get_perm(newsize, FALSE);
+  newbuffer = store_get_perm(newsize, GET_UNTAINTED);
   memcpy(newbuffer, big_buffer, len);
 
   big_buffer = newbuffer;
   memcpy(newbuffer, big_buffer, len);
 
   big_buffer = newbuffer;
@@ -456,9 +465,12 @@ n = Ustrlen(big_buffer);
 if (n < 3 || big_buffer[0] != '<' || big_buffer[n-2] != '>')
   goto SPOOL_FORMAT_ERROR;
 
 if (n < 3 || big_buffer[0] != '<' || big_buffer[n-2] != '>')
   goto SPOOL_FORMAT_ERROR;
 
-sender_address = store_get(n-2, GET_TAINTED);
-Ustrncpy(sender_address, big_buffer+1, n-3);
-sender_address[n-3] = 0;
+ {
+  uschar * s = store_get(n-2, GET_TAINTED);
+  Ustrncpy(s, big_buffer+1, n-3);
+  s[n-3] = '\0';
+  sender_address = s;
+ }
 
 where = US"time";
 if (Ufgets(big_buffer, big_buffer_size, fp) == NULL) goto SPOOL_READ_ERROR;
 
 where = US"time";
 if (Ufgets(big_buffer, big_buffer_size, fp) == NULL) goto SPOOL_READ_ERROR;
@@ -515,15 +527,15 @@ for (;;)
     for (s = ++var; *s != ')'; ) s++;
 #ifndef COMPILE_UTILITY
       {
     for (s = ++var; *s != ')'; ) s++;
 #ifndef COMPILE_UTILITY
       {
-      int idx;
-      if ((idx = search_findtype(var, s - var)) < 0)
+      const lookup_info * li;
+      if (!(li= search_findtype(var, s - var)))
        {
        DEBUG(D_any)
          debug_printf("Unrecognised quoter %.*s\n", (int)(s - var), var+1);
        where = NULL;
        goto SPOOL_FORMAT_ERROR;
        }
        {
        DEBUG(D_any)
          debug_printf("Unrecognised quoter %.*s\n", (int)(s - var), var+1);
        where = NULL;
        goto SPOOL_FORMAT_ERROR;
        }
-      proto_mem = store_get_quoted(1, GET_TAINTED, idx);
+      proto_mem = store_get_quoted(1, GET_TAINTED, li->acq_num, li->name);
       }
 #endif  /* COMPILE_UTILITY */
     var = s + 1;
       }
 #endif  /* COMPILE_UTILITY */
     var = s + 1;