SPF multiple strings join on "".
authorPhil Pennock <pdp@exim.org>
Fri, 18 May 2012 19:35:32 +0000 (15:35 -0400)
committerPhil Pennock <pdp@exim.org>
Fri, 18 May 2012 19:35:32 +0000 (15:35 -0400)
Patch from Janne Snabb.

doc/doc-docbook/spec.xfpt
doc/doc-txt/ChangeLog
src/src/lookups/dnsdb.c

index b650fc39fa6d47d22f013fb99d0cde49802c05c1..c4c181ef1a9f426ba75c5617f4cc0482aa4855a9 100644 (file)
@@ -6790,14 +6790,16 @@ white space is ignored.
 .cindex "TXT record" "in &(dnsdb)& lookup"
 .cindex "SPF record" "in &(dnsdb)& lookup"
 .new
 .cindex "TXT record" "in &(dnsdb)& lookup"
 .cindex "SPF record" "in &(dnsdb)& lookup"
 .new
-For TXT and SPF records with multiple items of data, only the first item is returned,
+For TXT records with multiple items of data, only the first item is returned,
 unless a separator for them is specified using a comma after the separator
 unless a separator for them is specified using a comma after the separator
-character followed immediately by the TXT/SPF record item separator. To concatenate
-items without a separator, use a semicolon instead.
+character followed immediately by the TXT record item separator. To concatenate
+items without a separator, use a semicolon instead. For SPF records the
+default behaviour is to concatenate multiple items without using a separator.
 .wen
 .code
 ${lookup dnsdb{>\n,: txt=a.b.example}}
 ${lookup dnsdb{>\n; txt=a.b.example}}
 .wen
 .code
 ${lookup dnsdb{>\n,: txt=a.b.example}}
 ${lookup dnsdb{>\n; txt=a.b.example}}
+${lookup dnsdb{spf=example.org}}
 .endd
 It is permitted to specify a space as the separator character. Further
 white space is ignored.
 .endd
 It is permitted to specify a space as the separator character. Further
 white space is ignored.
index bf4ddf1afa94d1ea92f8ca3999c637d0f12e179c..b3815cd45ad28b22017d6c1347b020a4f786ea63 100644 (file)
@@ -113,6 +113,8 @@ PP/25 Revamped GnuTLS support, passing tls_require_ciphers to
 PP/26 Added EXPERIMENTAL_OCSP for OpenSSL.
 
 PP/27 Applied dnsdb SPF support patch from Janne Snabb.
 PP/26 Added EXPERIMENTAL_OCSP for OpenSSL.
 
 PP/27 Applied dnsdb SPF support patch from Janne Snabb.
+      Applied second patch from Janne, implementing suggestion to default
+      multiple-strings-in-record handling to match SPF spec.
 
 JH/04 Added expansion variable $tod_epoch_l for a higher-precision time.
 
 
 JH/04 Added expansion variable $tod_epoch_l for a higher-precision time.
 
index 3fd9f981bb37dcc66609c52fc40b19323cef8f1a..be090cf7811cf68b4cbe6fd72be67d3e2b0850f4 100644 (file)
@@ -96,7 +96,8 @@ separator is newline.
 character used for multiple items of text in "TXT" records. Alternatively,
 if the next character is ';' then these multiple items are concatenated with
 no separator. With neither of these options specified, only the first item
 character used for multiple items of text in "TXT" records. Alternatively,
 if the next character is ';' then these multiple items are concatenated with
 no separator. With neither of these options specified, only the first item
-is output.
+is output.  Similarly for "SPF" records, but the default for joining multiple
+items in one SPF record is the empty string, for direct concatenation.
 
 (c) If the next sequence of characters is 'defer_FOO' followed by a comma,
 the defer behaviour is set to FOO. The possible behaviours are: 'strict', where
 
 (c) If the next sequence of characters is 'defer_FOO' followed by a comma,
 the defer behaviour is set to FOO. The possible behaviours are: 'strict', where
@@ -163,6 +164,14 @@ if (*keystring == '>')
   while (isspace(*keystring)) keystring++;
   }
 
   while (isspace(*keystring)) keystring++;
   }
 
+/* SPF strings should be concatenated without a separator, thus make
+it the default if not defined (see RFC 4408 section 3.1.3).
+Multiple SPF records are forbidden (section 3.1.2) but are currently
+not handled specially, thus they are concatenated with \n by default. */
+
+if (type == T_SPF && outsep2 == NULL)
+  outsep2 = US"";
+
 /* Check for a defer behaviour keyword. */
 
 if (strncmpic(keystring, US"defer_", 6) == 0)
 /* Check for a defer behaviour keyword. */
 
 if (strncmpic(keystring, US"defer_", 6) == 0)