[exim-cvs] cvs commit: exim/exim-src/src dkim.c exim/exim-s…

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Tom Kistner
Dátum:  
Címzett: exim-cvs
Tárgy: [exim-cvs] cvs commit: exim/exim-src/src dkim.c exim/exim-src/src/lookups dnsdb.c
tom 2009/04/30 09:21:30 BST

  Modified files:        (Branch: DEVEL_PDKIM)
    exim-src/src         dkim.c 
    exim-src/src/lookups dnsdb.c 
  Log:
  Fix dnsdb lookup to support multi-chunk TXT RRs / Do the same for DKIM TXT lookup glue


  Revision  Changes    Path
  1.1.2.7   +10 -3     exim/exim-src/src/dkim.c
  1.17.2.1  +8 -2      exim/exim-src/src/lookups/dnsdb.c


  Index: dkim.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/Attic/dkim.c,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- dkim.c    9 Apr 2009 13:57:21 -0000    1.1.2.6
  +++ dkim.c    30 Apr 2009 08:21:30 -0000    1.1.2.7
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/dkim.c,v 1.1.2.6 2009/04/09 13:57:21 tom Exp $ */
  +/* $Cambridge: exim/exim-src/src/dkim.c,v 1.1.2.7 2009/04/30 08:21:30 tom Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -34,9 +34,16 @@


     /* Copy record content to the answer buffer */
     if (rr != NULL) {
  -    int len = (rr->data)[0];
  -    //if (len > 511) len = 127; // ???
  -    snprintf(answer, PDKIM_DNS_TXT_MAX_RECLEN, "%.*s", len, (char *)(rr->data+1));
  +    int rr_offset = 0;
  +    int answer_offset = 0;
  +    while (rr_offset < rr->size) {
  +      uschar len = (rr->data)[rr_offset++];
  +      snprintf(answer+(answer_offset),
  +               PDKIM_DNS_TXT_MAX_RECLEN-(answer_offset),
  +               "%.*s", (int)len, (char *)((rr->data)+rr_offset));
  +      rr_offset+=len;
  +      answer_offset+=len;
  +    }
     }
     else return 1;



  Index: dnsdb.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/lookups/dnsdb.c,v
  retrieving revision 1.17
  retrieving revision 1.17.2.1
  diff -u -r1.17 -r1.17.2.1
  --- dnsdb.c    8 Jan 2007 10:50:19 -0000    1.17
  +++ dnsdb.c    30 Apr 2009 08:21:30 -0000    1.17.2.1
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/lookups/dnsdb.c,v 1.17 2007/01/08 10:50:19 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/lookups/dnsdb.c,v 1.17.2.1 2009/04/30 08:21:30 tom Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -303,8 +303,14 @@


       if (type == T_TXT)
         {
  -      yield = string_cat(yield, &size, &ptr, (uschar *)(rr->data+1),
  -        (rr->data)[0]);
  +      int data_offset = 0;
  +      while (data_offset < rr->size)
  +        {
  +        uschar chunk_len = (rr->data)[data_offset++];
  +        yield = string_cat(yield, &size, &ptr,
  +                           (uschar *)((rr->data)+data_offset), chunk_len);
  +        data_offset += chunk_len;
  +        }
         }
       else   /* T_CNAME, T_CSA, T_MX, T_MXH, T_NS, T_PTR, T_SRV */
         {