diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2014-09-06 19:59:34 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2014-09-06 21:45:44 +0100 |
commit | be36e5721725253b7529899884d7fe8ecd5120b9 (patch) | |
tree | 33225671dc14835d619e638a0bab1319625010e9 | |
parent | f4952db2835a261d478321c930db5af27496e598 (diff) |
Support secondary-separator specifier for MX, SRV and TLSA dnsdb lookups
-rw-r--r-- | doc/doc-docbook/spec.xfpt | 16 | ||||
-rw-r--r-- | doc/doc-txt/ChangeLog | 2 | ||||
-rw-r--r-- | src/src/lookups/dnsdb.c | 19 | ||||
-rw-r--r-- | test/scripts/2200-dnsdb/2200 | 1 | ||||
-rw-r--r-- | test/stdout/2200 | 1 |
5 files changed, 27 insertions, 12 deletions
diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index 2a52666f6..69009e92d 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -6875,12 +6875,6 @@ ${lookup dnsdb{ptr=192.168.4.5}{$value}fail} If the data for a PTR record is not a syntactically valid IP address, it is not altered and nothing is added. -.cindex "MX record" "in &(dnsdb)& lookup" -.cindex "SRV record" "in &(dnsdb)& lookup" -For an MX lookup, both the preference value and the host name are returned for -each record, separated by a space. For an SRV lookup, the priority, weight, -port, and host name are returned for each record, separated by spaces. - For any record type, if multiple records are found (or, for A6 lookups, if a single record leads to multiple addresses), the data is returned as a concatenation, with newline as the default separator. The order, of course, @@ -6893,6 +6887,16 @@ ${lookup dnsdb{>: a=host1.example}} It is permitted to specify a space as the separator character. Further white space is ignored. +.cindex "MX record" "in &(dnsdb)& lookup" +.cindex "SRV record" "in &(dnsdb)& lookup" +For an MX lookup, both the preference value and the host name are returned for +each record, separated by a space. For an SRV lookup, the priority, weight, +port, and host name are returned for each record, separated by spaces. +.new +An alternate field separator can be specified using a comma after the main +separator character, followed immediately by the field separator. +.wen + .cindex "TXT record" "in &(dnsdb)& lookup" .cindex "SPF record" "in &(dnsdb)& lookup" For TXT records with multiple items of data, only the first item is returned, diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index f3f432459..c8e6ccf2b 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -28,6 +28,8 @@ TL/03 Bugzilla 1518: Clarify "condition" processing in routers; that JH/02 Add EXPERIMENTAL_DANE, allowing for using the DNS as trust-anchor for server certificates when making smtp deliveries. +JH/03 Support secondary-separator specifier for MX, SRV, TLSA lookups. + Exim version 4.84 ----------------- diff --git a/src/src/lookups/dnsdb.c b/src/src/lookups/dnsdb.c index fde98b977..5a82b340d 100644 --- a/src/src/lookups/dnsdb.c +++ b/src/src/lookups/dnsdb.c @@ -295,10 +295,15 @@ if (type == T_PTR && keystring[0] != '<' && /* 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. */ +not handled specially, thus they are concatenated with \n by default. +MX priority and value are space-separated by default. +SRV and TLSA record parts are space-separated by default. */ -if (type == T_SPF && outsep2 == NULL) - outsep2 = US""; +if (!outsep2) switch(type) + { + case T_SPF: outsep2 = US""; break; + case T_SRV: case T_MX: case T_TLSA: outsep2 = US" "; break; + } /* Now scan the list and do a lookup for each item */ @@ -442,7 +447,8 @@ while ((domain = string_nextinlist(&keystring, &sep, buffer, sizeof(buffer))) matching_type = *p++; /* What's left after removing the first 3 bytes above */ payload_length = rr->size - 3; - sp += sprintf(CS s, "%d %d %d ", usage, selector, matching_type); + sp += sprintf(CS s, "%d%c%d%c%d%c", usage, *outsep2, + selector, *outsep2, matching_type, *outsep2); /* Now append the cert/identifier, one hex char at a time */ for (i=0; i < payload_length && sp-s < (MAX_TLSA_EXPANDED_SIZE - 4); @@ -466,7 +472,7 @@ while ((domain = string_nextinlist(&keystring, &sep, buffer, sizeof(buffer))) else if (type == T_MX) { GETSHORT(priority, p); - sprintf(CS s, "%d ", priority); + sprintf(CS s, "%d%c", priority, *outsep2); yield = string_cat(yield, &size, &ptr, s, Ustrlen(s)); } else if (type == T_SRV) @@ -474,7 +480,8 @@ while ((domain = string_nextinlist(&keystring, &sep, buffer, sizeof(buffer))) GETSHORT(priority, p); GETSHORT(weight, p); GETSHORT(port, p); - sprintf(CS s, "%d %d %d ", priority, weight, port); + sprintf(CS s, "%d%c%d%c%d%c", priority, *outsep2, + weight, *outsep2, port, *outsep2); yield = string_cat(yield, &size, &ptr, s, Ustrlen(s)); } else if (type == T_CSA) diff --git a/test/scripts/2200-dnsdb/2200 b/test/scripts/2200-dnsdb/2200 index 1277b9ca6..d1770c84f 100644 --- a/test/scripts/2200-dnsdb/2200 +++ b/test/scripts/2200-dnsdb/2200 @@ -27,6 +27,7 @@ ten-1:ten2 ${lookup dnsdb{a=ten-1.test.ex:ten-2.test.ex}} ten-1:defer:ten2 ${lookup dnsdb{a=ten-1.test.ex:test.again.dns:ten-2.test.ex}} ten-1|ten2 ${lookup dnsdb{a=<|ten-1.test.ex|ten-2.test.ex}} mxt1;mxt2 | output ${lookup dnsdb{>|mx=<;mxt1.test.ex;mxt2.test.ex}} +mxt1;mxt2 | output+field ${lookup dnsdb{>|,:mx=<;mxt1.test.ex;mxt2.test.ex}} mxt1;mxt2 | output ${lookup dnsdb{>|mxh=<;mxt1.test.ex;mxt2.test.ex}} 13/14 rbl ${lookup dnsdb{> 13.12.11.V4NET.rbl.test.ex:13.12.11.V4NET.rbl.test.ex}} double ptr ${lookup dnsdb{ptr=V4NET.0.0.1:V4NET.0.0.2}} diff --git a/test/stdout/2200 b/test/stdout/2200 index 5d0b397bd..90504c6da 100644 --- a/test/stdout/2200 +++ b/test/stdout/2200 @@ -28,6 +28,7 @@ V4NET.0.0.2 > ten-1|ten2 V4NET.0.0.1 V4NET.0.0.2 > mxt1;mxt2 | output 5 eximtesthost.test.ex|5 not-exist.test.ex +> mxt1;mxt2 | output+field 5:eximtesthost.test.ex|5:not-exist.test.ex > mxt1;mxt2 | output eximtesthost.test.ex|not-exist.test.ex > 13/14 rbl This is a test blacklisting message This is a test blacklisting message > double ptr ten-1.test.ex |