Re: IPv6 recap

Sam Varshavchik <[email protected]>
Newsgroups gmane.mail.imap.courier.general
Message-ID <[email protected]>
… and one more patch, on top of the previous one. With this, the output of
testmxlookup finally respects what ESMTP_PREFER_IPV6_MX is set to, and  
should accurately reflect which MX will be tried, in turn.

diff --git a/rfc1035/rfc1035mxlist.c b/rfc1035/rfc1035mxlist.c
index 10eb6203..e861e7f9 100644
--- a/rfc1035/rfc1035mxlist.c
+++ b/rfc1035/rfc1035mxlist.c
@@ -132,6 +132,8 @@ records weren't found.
 		second_a=RFC1035_TYPE_A;
 	}

+	/* Read cached records, for the less-preferred address type */
+
 	if (mxreply && !(opts & RFC1035_MX_QUERYALL))
 	{
 		rc2=harvest_records(res, list, mxreply, mxpreference,
@@ -140,7 +142,21 @@ records weren't found.

 		if (rc2 != RFC1035_MX_OK && rc2 != RFC1035_MX_SOFTERR)
 			return rc2;
+	}
+
+	/* If there's nothing cached make an explicit query */
+
+	rc2=harvest_records(res, list, mxreply, mxpreference, mxname,
+			    second_a, &found, HARVEST_AUTOQUERY,
+			    port);
+
+	if (rc2 != RFC1035_MX_OK && rc2 != RFC1035_MX_SOFTERR)
+		return rc2;

+	/* Read cached records, for the preferred address type */
+
+	if (mxreply && !(opts & RFC1035_MX_QUERYALL))
+	{
 		rc=harvest_records(res, list, mxreply, mxpreference,
 				   mxname, first_a, &found, 0,
 				   port);
@@ -152,12 +168,7 @@ records weren't found.
 			return rc;
 	}

-	rc2=harvest_records(res, list, mxreply, mxpreference, mxname,
-			    second_a, &found, HARVEST_AUTOQUERY,
-			    port);
-
-	if (rc2 != RFC1035_MX_OK && rc2 != RFC1035_MX_SOFTERR)
-		return rc2;
+	/* If there's nothing cached make an explicit query */

 	rc=harvest_records(res, list, mxreply, mxpreference, mxname,
 			   first_a, &found, HARVEST_AUTOQUERY,
@@ -288,7 +299,8 @@ static int harvest_records(struct rfc1035_res *res,
 				memcpy(&sin6, &q->address, sizeof(sin6));

 				if (memcmp(&sin6.sin6_addr, &in, sizeof(in))
-					== 0 && q->priority == mxpreference)
+					== 0 && q->priority == mxpreference &&
+				    strcmp(q->hostname, mxname) == 0)
 					break;
 			}
 			if (q)	continue;

_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQRupkKLJP96aW75pIOKYPgoojZS4gUCZhGrZAAKCRCKYPgoojZS
4rtVAP43q7CTr6pibTE81+8zNxcaNOQjpP2uST78IcCEXQr6PAD+K09fNrdOSXMM
EhiKK9+se6bshrSHutQ39L7e+xIPVAU=
=6c+c
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.