Commit Diff
Diff:
6fcedbcce90255dd6fb66e9f865613b6f11ab415
9d8a2e59b12881b4615f17410fc40b3728ce45e2
Commit:
9d8a2e59b12881b4615f17410fc40b3728ce45e2
Tree:
46fa4e77beb33abc6fc150f1d3e9aeae91007371
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Sun Jul 26 16:17:10 2020 UTC
Message:
make sure that a zone "" {} gets written in an axfr even if there is no data and lookup_axfr() fails.
blob - 58b9200d0db65619d864763b513a35ddb0a37774
blob + 4e529820440e591b040e42b891a55d3780ba0061
--- query.c
+++ query.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: query.c,v 1.9 2020/07/19 13:50:06 pjp Exp $
+ * $Id: query.c,v 1.10 2020/07/26 16:17:10 pjp Exp $
*/
#include <sys/types.h>
@@ -338,9 +338,16 @@ dig(int argc, char *argv[])
answers = 0;
if (type == DNS_TYPE_AXFR) {
+ if ((format & ZONE_FORMAT) && f != NULL)
+ fprintf(f, "zone \"%s\" {\n", domainname);
+
if (lookup_axfr(f, so, domainname, &mysoa, format, tsigkey, tsigpass, &segment, &answers, &additionalcount) < 0) {
exit(1);
}
+
+ if ((format & ZONE_FORMAT) && f != NULL)
+ fprintf(f, "}\n");
+
} else {
if (lookup_name(f, so, domainname, type, &mysoa, format, nameserver, port, &answers, &additionalcount, class) < 0) {
blob - 25910e783e4270ed096c42a94a0b5772a2ba0ae8
blob + d8dc95eb561581fb1f6179c17fde9d578079aaee
--- raxfr.c
+++ raxfr.c
@@ -26,7 +26,7 @@
*
*/
/*
- * $Id: raxfr.c,v 1.56 2020/07/23 10:48:45 pjp Exp $
+ * $Id: raxfr.c,v 1.57 2020/07/26 16:17:10 pjp Exp $
*/
#include <sys/types.h>
@@ -2311,11 +2311,21 @@ do_raxfr(FILE *f, struct rzone *rzone)
answers = 0;
additionalcount = 0;
+ if ((format & ZONE_FORMAT) && f != NULL)
+ fprintf(f, "zone \"%s\" {\n", rzone->zonename);
+
if (lookup_axfr(f, so, rzone->zonename, &mysoa, format, ((dotsig == 0) ? NULL : rzone->tsigkey), humanpass, &segment, &answers, &additionalcount) < 0) {
+ /* close the zone */
+ if ((format & ZONE_FORMAT) && f != NULL)
+ fprintf(f, "}\n");
+
dolog(LOG_ERR, "lookup_axfr() failed\n");
close(so);
return -1;
}
+
+ if ((format & ZONE_FORMAT) && f != NULL)
+ fprintf(f, "}\n");
close(so);
return (0);
blob - 8324fbf141bb7cf23966b06757bd20f5973108f9
blob + b8d92cfd231f5aa2e18bcbf33723cfd54dfcefb6
--- util.c
+++ util.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: util.c,v 1.77 2020/07/23 10:48:45 pjp Exp $
+ * $Id: util.c,v 1.78 2020/07/26 16:17:10 pjp Exp $
*/
#include <sys/types.h>
@@ -2136,8 +2136,10 @@ lookup_axfr(FILE *f, int so, char *zonename, struct so
rwh->dh.additional = saveadd;
}
+#if 0
if (*segment == 0 && (format & ZONE_FORMAT) && f != NULL)
fprintf(f, "zone \"%s\" {\n", zonename);
+#endif
(*segment)++;
@@ -2230,10 +2232,12 @@ out:
HMAC_CTX_free(ctx);
}
+#if 0
if (f != NULL) {
if ((format & ZONE_FORMAT))
fprintf(f, "}\n");
}
+#endif
free_question(q);
repomaster@centroid.eu