[exim-cvs] Testsuite: support for multi-chunk DNS TXT record…

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Exim Git Commits Mailing List
Ημερομηνία:  
Προς: exim-cvs
Αντικείμενο: [exim-cvs] Testsuite: support for multi-chunk DNS TXT records; more cases for dnsdb
Gitweb: https://git.exim.org/exim.git/commitdiff/2194d594e9f1f966cfa2e0e266d37216729b0fa1
Commit:     2194d594e9f1f966cfa2e0e266d37216729b0fa1
Parent:     79670d3c32ccb37fe06f25d8192943b58606a32a
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Fri Nov 17 20:27:16 2023 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Fri Nov 17 20:27:16 2023 +0000


    Testsuite: support for multi-chunk DNS TXT records; more cases for dnsdb


    adds to: 79670d3c32cc
---
 doc/doc-txt/ChangeLog        |  5 +++--
 test/dnszones-src/db.test.ex |  1 +
 test/scripts/2200-dnsdb/2200 | 10 +++++++++-
 test/src/fakens.c            | 16 ++++++++++------
 test/stdout/2200             | 11 ++++++++++-
 5 files changed, 33 insertions(+), 10 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 1663f8552..8722e109f 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -32,8 +32,9 @@ JH/05 Fix TLS resumption for TLS-on-connect.  This was broken by the advent
       to be a static string, for TLS-on-connect cases; meaning that resumption
       will always be attempted (unless deliberately overriden).


-JH/06 Bug 3054: Fix dnsdb lookup for a TXT record with multiple chunks.  This
-      was broken by hardening introduced for Bug 3033.
+JH/06 Bug 3054: Fix dnsdb lookup for a TXT record with multiple chunks, with a
+      chunk-separator specification.  This was broken by hardening introduced
+      for Bug 3031.




diff --git a/test/dnszones-src/db.test.ex b/test/dnszones-src/db.test.ex
index 94ac98608..d6de7aa6c 100644
--- a/test/dnszones-src/db.test.ex
+++ b/test/dnszones-src/db.test.ex
@@ -25,6 +25,7 @@ test.ex.     SOA     exim.test.ex. hostmaster.exim.test.ex 1430683638 1200 120 6
 test.ex.     TXT     "A TXT record for test.ex."
 s/lash       TXT     "A TXT record for s/lash.test.ex."
 long         TXT     "This is a max-length chunk 789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234" "A short chunk" "A final chunk"
+long         TXT     "Second RR"


 cname        CNAME   test.ex.


diff --git a/test/scripts/2200-dnsdb/2200 b/test/scripts/2200-dnsdb/2200
index 4b89a7338..3d78a2639 100644
--- a/test/scripts/2200-dnsdb/2200
+++ b/test/scripts/2200-dnsdb/2200
@@ -4,7 +4,15 @@ exim -be
 test.ex                    ${lookup dnsdb{test.ex}{$value}fail}
 s/lash.test.ex             ${lookup dnsdb{s/lash.test.ex}{$value}fail}
 txt=test.ex                ${lookup dnsdb{txt=test.ex}{$value}fail}
-txt=long.test.ex           ${lookup dnsdb{>\n; txt=long.test.ex}{$value}fail}
+>X txt=test.ex             ${lookup dnsdb{txt=test.ex}{$value}fail}
+>X; txt=test.ex            ${lookup dnsdb{txt=test.ex}{$value}fail}
+>X, txt=test.ex            ${lookup dnsdb{txt=test.ex}{$value}fail}
+>X, txt=test.ex            ${lookup dnsdb{txt=test.ex}{$value}fail}
+txt=long.test.ex           ${lookup dnsdb{     txt=long.test.ex}{$value}fail}
+>X   txt=long.test.ex      ${lookup dnsdb{>X   txt=long.test.ex}{$value}fail}
+>X;  txt=long.test.ex      ${lookup dnsdb{>X;  txt=long.test.ex}{$value}fail}
+>X,  txt=long.test.ex      ${lookup dnsdb{>X,  txt=long.test.ex}{$value}fail}
+>X,Z txt=long.test.ex      ${lookup dnsdb{>X,Z txt=long.test.ex}{$value}fail}
 a=black-1.test.ex          ${lookup dnsdb{a=black-1.test.ex}{$value}fail}
 xxx=test.ex                ${lookup dnsdb{xxx=test.ex}{$value}fail}
 a=localhost.test.ex        ${lookup dnsdb{a=localhost.test.ex}{$value}fail}
diff --git a/test/src/fakens.c b/test/src/fakens.c
index 0de4e60c2..3d6f513fc 100644
--- a/test/src/fakens.c
+++ b/test/src/fakens.c
@@ -329,7 +329,7 @@ int domainlen = Ustrlen(domain);
 BOOL pass_on_not_found = FALSE;
 tlist *typeptr;
 uschar *pk = *pkptr;
-uschar buffer[256];
+uschar buffer[512];
 uschar rrdomain[256];
 uschar RRdomain[256];


@@ -536,12 +536,16 @@ while (fgets(CS buffer, sizeof(buffer), f) != NULL)
       break;


     case ns_t_txt:
-      pp = pk++;
-      if (*p == '"') p++;   /* Should always be the case */
-      while (*p != 0 && *p != '"') *pk++ = *p++;
-      *pp = pk - pp - 1;
+      while (*p)
+        {
+        pp = pk++;            /* Skip the size byte in output */
+        if (*p == '"') p++;   /* Should always be the case */
+        while (*p && *p != '"') *pk++ = *p++;
+        *pp = pk - pp - 1;    /* fill in the size */
+        p++;                  /* skip the closing doublequote */
+        while (isspace(*p)) p++; /* next chunk start */
+        }
       break;
-      /*XXX need a way of doing multi-chunk TXT RRs */


     case ns_t_tlsa:
       pk = bytefield(&p, pk);   /* usage */
diff --git a/test/stdout/2200 b/test/stdout/2200
index 8d02a903e..bc9d346c1 100644
--- a/test/stdout/2200
+++ b/test/stdout/2200
@@ -1,7 +1,16 @@

 > test.ex                    A TXT record for test.ex.
 > s/lash.test.ex             A TXT record for s/lash.test.ex.
 > txt=test.ex                A TXT record for test.ex.

-> txt=long.test.ex           This is a max-length chunk 789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234A short chunkA final chunk
+> >X txt=test.ex             A TXT record for test.ex.
+> >X; txt=test.ex            A TXT record for test.ex.
+> >X, txt=test.ex            A TXT record for test.ex.
+> >X, txt=test.ex            A TXT record for test.ex.
+> txt=long.test.ex           This is a max-length chunk 789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234
+Second RR
+> >X   txt=long.test.ex      This is a max-length chunk 789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234XSecond RR
+> >X;  txt=long.test.ex      This is a max-length chunk 789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234A short chunkA final chunkXSecond RR
+> >X,  txt=long.test.ex      This is a max-length chunk 789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234 A short chunk A final chunkXSecond RR
+> >X,Z txt=long.test.ex      This is a max-length chunk 789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234ZA short chunkZA final chunkXSecond RR

 > a=black-1.test.ex          V4NET.11.12.13
 > Failed: lookup of "xxx=test.ex" gave DEFER: unsupported DNS record type
 > a=localhost.test.ex        127.0.0.1


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-cvs.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-cvs-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/