Update all copyright messages to cover 1995 - 2009. Remove tab from exim_checkaccess.src
[exim.git] / src / src / lookups / dnsdb.c
index 169fd67f1bf7729f9161c822bd5c7343202cef13..5e9741beaca053e29207858aff1d078ce43ea5c0 100644 (file)
@@ -1,10 +1,10 @@
-/* $Cambridge: exim/src/src/lookups/dnsdb.c,v 1.13 2005/06/10 13:38:06 tom Exp $ */
+/* $Cambridge: exim/src/src/lookups/dnsdb.c,v 1.19 2009/11/16 19:50:38 nm4 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2005 */
+/* Copyright (c) University of Cambridge 1995 - 2009 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 #include "../exim.h"
@@ -221,7 +221,7 @@ remaining string is valid as an IP address, set an impossible separator so that
 it is treated as one item. */
 
 if (type == T_PTR && keystring[0] != '<' &&
-    string_is_ip_address(keystring, NULL) > 0)
+    string_is_ip_address(keystring, NULL) != 0)
   sep = -1;
 
 /* Now scan the list and do a lookup for each item */
@@ -241,7 +241,7 @@ while ((domain = string_nextinlist(&keystring, &sep, buffer, sizeof(buffer)))
   doing the reversal is now in a separate function. */
 
   if ((type == T_PTR || type == T_CSA) &&
-      string_is_ip_address(domain, NULL) > 0)
+      string_is_ip_address(domain, NULL) != 0)
     {
     dns_build_reverse(domain, rbuffer);
     domain = rbuffer;
@@ -249,13 +249,13 @@ while ((domain = string_nextinlist(&keystring, &sep, buffer, sizeof(buffer)))
 
   DEBUG(D_lookup) debug_printf("dnsdb key: %s\n", domain);
 
-  /* Do the lookup and sort out the result. There are two special types that
-  are handled specially: T_ZNS and T_MXH. The former is handled in a special
-  lookup function so that the facility could be used from other parts of the
-  Exim code. The latter affects only what happens later on in this function,
-  but for tidiness it is handled in a similar way. If the lookup fails,
-  continue with the next domain. In the case of DEFER, adjust the final
-  "nothing found" result, but carry on to the next domain. */
+  /* Do the lookup and sort out the result. There are three special types that
+  are handled specially: T_CSA, T_ZNS and T_MXH. The former two are handled in
+  a special lookup function so that the facility could be used from other
+  parts of the Exim code. The latter affects only what happens later on in
+  this function, but for tidiness it is handled in a similar way. If the
+  lookup fails, continue with the next domain. In the case of DEFER, adjust
+  the final "nothing found" result, but carry on to the next domain. */
 
   found = domain;
   rc = dns_special_lookup(&dnsa, domain, type, &found);
@@ -303,8 +303,14 @@ while ((domain = string_nextinlist(&keystring, &sep, buffer, sizeof(buffer)))
 
     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 */
       {