I18N: Fix protocol recorded for a multi-SMTPUTF8-message connection. Bug 2287
[exim.git] / src / src / spool_in.c
index e34b541713d1774418527bc74d816c1dfe497514..cd74d1ee7cee74ba611b0cbc75cc1872a8aed84f 100644 (file)
@@ -57,9 +57,17 @@ for (i = 0; i < 2; i++)
   fname = spool_fname(US"input", message_subdir, id, US"-D");
   DEBUG(D_deliver) debug_printf("Trying spool file %s\n", fname);
 
+  /* We protect against symlink attacks both in not propagating the
+   * file-descriptor to other processes as we exec, and also ensuring that we
+   * don't even open symlinks.
+   * No -D file inside the spool area should be a symlink.
+   */
   if ((fd = Uopen(fname,
 #ifdef O_CLOEXEC
                      O_CLOEXEC |
+#endif
+#ifdef O_NOFOLLOW
+                     O_NOFOLLOW |
 #endif
                      O_RDWR | O_APPEND, 0)) >= 0)
     break;
@@ -231,7 +239,9 @@ host_lookup_failed = FALSE;
 interface_address = NULL;
 interface_port = 0;
 local_error_message = FALSE;
+#ifdef HAVE_LOCAL_SCAN
 local_scan_data = NULL;
+#endif
 max_received_linelength = 0;
 message_linecount = 0;
 received_protocol = NULL;
@@ -261,7 +271,7 @@ bmi_verdicts = NULL;
 #ifndef DISABLE_DKIM
 dkim_signers = NULL;
 dkim_disable_verify = FALSE;
-dkim_collect_input = FALSE;
+dkim_collect_input = 0;
 #endif
 
 #ifdef SUPPORT_TLS
@@ -589,8 +599,10 @@ for (;;)
       sender_local = TRUE;
     else if (Ustrcmp(big_buffer, "-localerror") == 0)
       local_error_message = TRUE;
+#ifdef HAVE_LOCAL_SCAN
     else if (Ustrncmp(p, "ocal_scan ", 10) == 0)
       local_scan_data = string_copy(big_buffer + 12);
+#endif
     break;
 
     case 'm':