Cheap method to follow redis cluster MOVED replies
[exim.git] / src / src / expand.c
index 44e8e1ba0f781815a146170a641699c8708731e9..009049db4d69f3601b99387f1da76b0ac950e2db 100644 (file)
@@ -1666,11 +1666,11 @@ static gstring *
 authres_iprev(gstring * g)
 {
 if (sender_host_name)
-  return string_append(g, 3, US";\\n\\tiprev=pass (", sender_host_name, US")");
+  return string_append(g, 3, US";\n\tiprev=pass (", sender_host_name, US")");
 if (host_lookup_deferred)
-  return string_catn(g, US";\\n\\tiprev=temperror", 21);
+  return string_catn(g, US";\n\tiprev=temperror", 19);
 if (host_lookup_failed)
-  return string_catn(g, US";\\n\\tiprev=fail", 15);
+  return string_catn(g, US";\n\tiprev=fail", 13);
 return g;
 }
 
@@ -4144,6 +4144,9 @@ while (*s != 0)
 #endif
 #ifndef DISABLE_DKIM
       yield = authres_dkim(yield);
+#endif
+#ifdef EXPERIMENTAL_ARC
+      yield = authres_arc(yield);
 #endif
       continue;
       }
@@ -7530,10 +7533,9 @@ terminating brace. */
 
 if (ket_ends && *s == 0)
   {
-  expand_string_message = malformed_header?
-    US"missing } at end of string - could be header name not terminated by colon"
-    :
-    US"missing } at end of string";
+  expand_string_message = malformed_header
+    ? US"missing } at end of string - could be header name not terminated by colon"
+    : US"missing } at end of string";
   goto EXPAND_FAILED;
   }
 
@@ -7866,6 +7868,45 @@ return (  (  Ustrstr(s, "failed to expand") != NULL
 }
 
 
+/* Read given named file into big_buffer.  Use for keying material etc.
+The content will have an ascii NUL appended.
+
+Arguments:
+ filename      as it says
+
+Return:  pointer to buffer, or NULL on error.
+*/
+
+uschar *
+expand_file_big_buffer(const uschar * filename)
+{
+int fd, off = 0, len;
+
+if ((fd = open(CS filename, O_RDONLY)) < 0)
+  {
+  log_write(0, LOG_MAIN | LOG_PANIC, "unable to open file for reading: %s",
+            filename);
+  return NULL;
+  }
+
+do
+  {
+  if ((len = read(fd, big_buffer + off, big_buffer_size - 2 - off)) < 0)
+    {
+    (void) close(fd);
+    log_write(0, LOG_MAIN|LOG_PANIC, "unable to read file: %s", filename);
+    return NULL;
+    }
+  off += len;
+  }
+while (len > 0);
+
+(void) close(fd);
+big_buffer[off] = '\0';
+return big_buffer;
+}
+
+
 
 /*************************************************
 * Error-checking for testsuite                   *