Merge branch 'master' into transp_logging_1031
[users/jgh/exim.git] / src / src / expand.c
index 391b943cfcb40afe343c9461bbda7888c0b753e7..d808d1bf3a90636930123f86586c917b28d0ce06 100644 (file)
@@ -181,6 +181,7 @@ static uschar *op_table_main[] = {
   US"h",
   US"hash",
   US"hex2b64",
+  US"hexquote",
   US"l",
   US"lc",
   US"length",
@@ -216,6 +217,7 @@ enum {
   EOP_H,
   EOP_HASH,
   EOP_HEX2B64,
+  EOP_HEXQUOTE,
   EOP_L,
   EOP_LC,
   EOP_LENGTH,
@@ -429,6 +431,16 @@ static var_entry var_table[] = {
   { "compile_date",        vtype_stringptr,   &version_date },
   { "compile_number",      vtype_stringptr,   &version_cnumber },
   { "csa_status",          vtype_stringptr,   &csa_status },
+#ifdef EXPERIMENTAL_DBL
+  { "dbl_defer_errno",     vtype_int,         &dbl_defer_errno },
+  { "dbl_defer_errstr",    vtype_stringptr,   &dbl_defer_errstr },
+  { "dbl_delivery_confirmation", vtype_stringptr,   &dbl_delivery_confirmation },
+  { "dbl_delivery_domain", vtype_stringptr,   &dbl_delivery_domain },
+  { "dbl_delivery_fqdn",   vtype_stringptr,   &dbl_delivery_fqdn },
+  { "dbl_delivery_ip",     vtype_stringptr,   &dbl_delivery_ip },
+  { "dbl_delivery_local_part",vtype_stringptr,&dbl_delivery_local_part },
+  { "dbl_delivery_port",   vtype_int,         &dbl_delivery_port },
+#endif
 #ifdef EXPERIMENTAL_DCC
   { "dcc_header",          vtype_stringptr,   &dcc_header },
   { "dcc_result",          vtype_stringptr,   &dcc_result },
@@ -5664,6 +5676,22 @@ while (*s != 0)
         continue;
         }
 
+      /* Convert octets outside 0x21..0x7E to \xXX form */
+
+      case EOP_HEXQUOTE:
+       {
+        uschar *t = sub - 1;
+        while (*(++t) != 0)
+          {
+          if (*t < 0x21 || 0x7E < *t)
+            yield = string_cat(yield, &size, &ptr,
+             string_sprintf("\\x%02x", *t), 4);
+         else
+           yield = string_cat(yield, &size, &ptr, t, 1);
+          }
+       continue;
+       }
+
       /* count the number of list elements */
 
       case EOP_LISTCOUNT: