Commit Diff
Diff:
d6512f5140ec5a82ff51a0807e580e561b23334a
461510429d21eb890ff1e5e71bb34233a273709b
Commit:
461510429d21eb890ff1e5e71bb34233a273709b
Tree:
39860e9ac0d518a3fef44acabdf65e96c8e8a2ca
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Sun Aug 2 14:58:18 2020 UTC
Message:
cached mx records should be cached with priorities in host byte order, also the name of the dns server should be lower cased
blob - 9a1a513e16f2e07085b50dea81c29ac7cddbd41e
blob + 228698104634c5a4dc793aee8820d5087cc43c3a
--- cache.c
+++ cache.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: cache.c,v 1.10 2020/07/20 08:41:31 pjp Exp $
+ * $Id: cache.c,v 1.11 2020/08/02 14:58:18 pjp Exp $
*/
#include <sys/types.h>
@@ -523,6 +523,7 @@ cache_mx(struct scache *scache)
q += 2;
memset(&expand, 0, sizeof(expand));
+ elen = 0;
save = expand_compression(q, scache->estart, scache->end, (u_char *)&expand, &elen, max);
if (save == NULL) {
fprintf(stderr, "expanding compression failure 2\n");
@@ -532,8 +533,12 @@ cache_mx(struct scache *scache)
}
memcpy(&mx.exchange, expand, sizeof(mx.exchange));
+ if (lower_dnsname(mx.exchange, elen) == -1) {
+ dolog(LOG_INFO, "lower_dnsname failed\n");
+ return -1;
+ }
mx.exchangelen = elen;
- mx.preference = mxpriority;
+ mx.preference = ntohs(mxpriority);
transmit_rr(scache, &mx, sizeof(mx));
repomaster@centroid.eu