I18N: Move EAI support from Experimental to mainline
[exim.git] / src / src / lookups / dnsdb.c
index d06455e61f1119e90b68d43e0192cbc031cd6f4f..70e6c8c637586a3bafea0815104be05ad63be60c 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2014 */
+/* Copyright (c) University of Cambridge 1995 - 2015 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 #include "../exim.h"
@@ -131,7 +131,7 @@ separator, as always, is colon. */
 
 static int
 dnsdb_find(void *handle, uschar *filename, const uschar *keystring, int length,
-  uschar **result, uschar **errmsg, BOOL *do_cache)
+  uschar **result, uschar **errmsg, uint *do_cache)
 {
 int rc;
 int size = 256;
@@ -230,7 +230,7 @@ for (;;)
   else if (strncmpic(keystring, US"retry_", 6) == 0)
     {
     int retries;
-    if ((retries = (int)strtol(keystring + 6, CSS &keystring, 0)) < 0)
+    if ((retries = (int)strtol(CCS keystring + 6, CSS &keystring, 0)) < 0)
       {
       *errmsg = US"unsupported dnsdb retry count";
       return DEFER;
@@ -388,10 +388,13 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
       {
       if (rr->type != searchtype) continue;
 
+      if (*do_cache > rr->ttl)
+       *do_cache = rr->ttl;
+
       if (type == T_A || type == T_AAAA || type == T_ADDRESSES)
         {
         dns_address *da;
-        for (da = dns_address_from_rr(&dnsa, rr); da != NULL; da = da->next)
+        for (da = dns_address_from_rr(&dnsa, rr); da; da = da->next)
           {
           if (ptr != 0) yield = string_cat(yield, &size, &ptr, outsep, 1);
           yield = string_cat(yield, &size, &ptr, da->address,
@@ -548,7 +551,7 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
          p += rc;
          GETLONG(serial, p); GETLONG(refresh, p);
          GETLONG(retry,  p); GETLONG(expire,  p); GETLONG(minimum, p);
-         sprintf(CS s, "%c%d%c%d%c%d%c%d%c%d",
+         sprintf(CS s, "%c%lu%c%lu%c%lu%c%lu%c%lu",
            *outsep2, serial, *outsep2, refresh,
            *outsep2, retry,  *outsep2, expire,  *outsep2, minimum);
          yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));