DKIM: reinstate embedded Polarssl SHA routines under older GnuTLS. Bug 1772
[exim.git] / src / src / dns.c
index f99b470b21f76644de89a5b5f42731372d09b31a..e6e4fb6b3e7708b4bc4b1f3fe39293e28e644923 100644 (file)
@@ -468,7 +468,7 @@ if (  !h->aa
    || !*trusted
    || !(auth_name = dns_extract_auth_name(dnsa))
    || OK != match_isinlist(auth_name, &trusted, 0, NULL, NULL,
-                           MCL_DOMAIN, TRUE, NULL) 
+                           MCL_DOMAIN, TRUE, NULL)
    )
   return FALSE;
 
@@ -483,8 +483,10 @@ return TRUE;
 static void
 dns_set_insecure(dns_answer * dnsa)
 {
+#ifndef DISABLE_DNSSEC
 HEADER * h = (HEADER *)dnsa->answer;
 h->ad = 0;
+#endif
 }
 
 /************************************************
@@ -496,7 +498,11 @@ h->ad = 0;
 BOOL
 dns_is_aa(const dns_answer *dnsa)
 {
+#ifdef DISABLE_DNSSEC
+return FALSE;
+#else
 return ((HEADER*)dnsa->answer)->aa;
+#endif
 }
 
 
@@ -558,7 +564,7 @@ dns_return(const uschar * name, int type, int rc)
 res_state resp = os_get_dns_resolver_res();
 tree_node *node = store_get_perm(sizeof(tree_node) + 290);
 sprintf(CS node->name, "%.255s-%s-%lx", name, dns_text_type(type),
-  resp->options);
+  (unsigned long) resp->options);
 node->data.val = rc;
 (void)tree_insertnode(&tree_dns_fails, node);
 return rc;
@@ -607,7 +613,7 @@ have many addresses in the same domain. We rely on the resolver and name server
 caching for successful lookups. */
 
 sprintf(CS node_name, "%.255s-%s-%lx", name, dns_text_type(type),
-  resp->options);
+  (unsigned long) resp->options);
 previous = tree_search(tree_dns_fails, node_name);
 if (previous != NULL)
   {
@@ -620,7 +626,7 @@ if (previous != NULL)
   return previous->data.val;
   }
 
-#ifdef EXPERIMENTAL_INTERNATIONAL
+#ifdef SUPPORT_I18N
 /* Convert all names to a-label form before doing lookup */
   {
   uschar * alabel;
@@ -851,7 +857,7 @@ for (i = 0; i < 10; i++)
     if (  rr_name
        && Ustrcmp(rr_name, *fully_qualified_name) != 0
        && rr_name[0] != '*'
-#ifdef EXPERIMENTAL_INTERNATIONAL
+#ifdef SUPPORT_I18N
        && (  !string_is_utf8(*fully_qualified_name)
          || Ustrcmp(rr_name,
               string_domain_utf8_to_alabel(*fully_qualified_name, NULL)) != 0
@@ -1112,8 +1118,7 @@ return DNS_FAIL;
 *          Get address(es) from DNS record       *
 *************************************************/
 
-/* The record type is either T_A for an IPv4 address or T_AAAA (or T_A6 when
-supported) for an IPv6 address.
+/* The record type is either T_A for an IPv4 address or T_AAAA for an IPv6 address.
 
 Argument:
   dnsa       the DNS answer block
@@ -1145,8 +1150,11 @@ else
   {
   if (rr->data + 16 <= dnsa_lim)
     {
+    struct in6_addr in6;
+    int i;
+    for (i = 0; i < 16; i++) in6.s6_addr[i] = rr->data[i];
     yield = store_get(sizeof(dns_address) + 50);
-    inet_ntop(AF_INET6, US rr->data, CS yield->address, 50);
+    inet_ntop(AF_INET6, &in6, CS yield->address, 50);
     yield->next = NULL;
     }
   }