Tidying: explicit (de)tainting copies
[exim.git] / src / src / spool_out.c
index 8531112c061193cf7f9a7812bfd0d690a3b9fe40..bfa935eb060665399125278979cf153301bda5e7 100644 (file)
@@ -3,7 +3,7 @@
 *************************************************/
 
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 */
+/* Copyright (c) The Exim Maintainers 2020 - 2021 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 /* Functions for writing spool files, and moving them about. */
@@ -120,8 +120,14 @@ return z;
 static void
 spool_var_write(FILE * fp, const uschar * name, const uschar * val)
 {
-if (is_tainted(val)) putc('-', fp);
-fprintf(fp, "-%s %s\n", name, val);
+putc('-', fp);
+if (is_tainted(val))
+  {
+  int q = quoter_for_address(val);
+  putc('-', fp);
+  if (is_real_quoter(q)) fprintf(fp, "(%s)", lookup_list[q]->name);
+  }
+fprintf(fp, "%s %s\n", name, val);
 }
 
 /*************************************************
@@ -523,7 +529,7 @@ spool_move_message(uschar *id, uschar *subdir, uschar *from, uschar *to)
 uschar * dest_qname = queue_name_dest ? queue_name_dest : queue_name;
 
 /* Since we are working within the spool, de-taint the dest queue name */
-dest_qname = string_copy_taint(dest_qname, FALSE);
+dest_qname = string_copy_taint(dest_qname, GET_UNTAINTED);
 
 /* Create any output directories that do not exist. */