[PATCH] Remove CNAME check as it breaks with DNS responses > 512B

Discussion in 'qmail' started by popowich, Jun 25, 2012.

  1. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    9,001
    Likes Received:
    120
    Remove an ancient misfeature that was introduced for compatibility with
    misguided setups that don't exist anymore. Not doing an ANY query (to
    check for CNAMEs) avoids getting large amounts of data we have no
    interest in and that may overflow our response buffer. This is becoming
    an increasingly widespread problem in practice due to DNSSEC.

    With this change, qmail will only break for (i.e. be unable to deliver
    to) domains that have enough _MX_ records to overflow the fixed buffer
    size.

    This approach was suggested [1] by DJB:

    [1] Re: CNAME lookup failure started

    Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
    ---
    dns.c | 27 +--------------------------
    1 file changed, 1 insertion(+), 26 deletions(-)

    diff --git a/dns.c b/dns.c
    index e9faad7..f00c16d 100644
    --- a/dns.c
    +++ b/dns.c
    @@ -187,32 +187,7 @@ int flagsearch;
    int dns_cname(sa)
    stralloc *sa;
    {
    - int r;
    - int loop;
    - for (loop = 0;loop < 10;++loop)
    - {
    - if (!sa->len) return loop;
    - if (sa->s[sa->len - 1] == ']') return loop;
    - if (sa->s[sa->len - 1] == '.') { --sa->len; continue; }
    - switch(resolve(sa,T_ANY))
    - {
    - case DNS_MEM: return DNS_MEM;
    - case DNS_SOFT: return DNS_SOFT;
    - case DNS_HARD: return loop;
    - default:
    - while ((r = findname(T_CNAME)) != 2)
    - {
    - if (r == DNS_SOFT) return DNS_SOFT;
    - if (r == 1)
    - {
    - if (!stralloc_copys(sa,name)) return DNS_MEM;
    - break;
    - }
    - }
    - if (r == 2) return loop;
    - }
    - }
    - return DNS_HARD; /* alias loop */
    + return 0;
    }

    #define FMT_IAA 40
     


Want to reply or ask your own question?

It only takes a minute to sign up (and it's free!). Click the orange sign up button to choose a username and then you can ask your own questions on the forum.
Loading...