Commit Diff
Diff:
b4f1cb947f4bc0e71cbd4f78d991909643dc0408
bc1f044a51c739dfa28356a28b4d54397121dcbd
Commit:
bc1f044a51c739dfa28356a28b4d54397121dcbd
Tree:
0ede516eb90a51cbdde7a26b0a35ae096b96f0c4
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Tue Nov 5 17:07:20 2019 UTC
Message:
reply with a tsig answer if tsig'ed questioned on our AXFR port
blob - fedcb8ecfe155f9182ab9e63f9a03233bdc02178
blob + 9bb5d2601da5e9159cdd711639c9eaffe3ede0f6
--- axfr.c
+++ axfr.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: axfr.c,v 1.34 2019/10/26 08:13:04 pjp Exp $
+ * $Id: axfr.c,v 1.35 2019/11/05 17:07:20 pjp Exp $
*/
#include <sys/types.h>
@@ -931,7 +931,7 @@ axfr_connection(int so, char *address, int is_ipv6, dd
/* now we can be reasonably sure that it's an AXFR for us */
- reply = calloc(1, 65538);
+ reply = calloc(1, 0xffff + 2);
if (reply == NULL) {
dolog(LOG_INFO, "internal error: %s\n", strerror(errno));
goto drop;
@@ -979,7 +979,16 @@ axfr_connection(int so, char *address, int is_ipv6, dd
outlen = 0;
outlen = build_header(db, (reply + 2), (p + 2), question, 1);
outlen = build_soa(db, (reply + 2), outlen, soa, question);
-
+ if (question->tsig.tsigverified == 1) {
+ struct dns_header *odh;
+
+ odh = (struct dns_header *)&reply[2];
+ outlen = additional_tsig(question, (reply + 2), 0xffff, outlen, 0, 0, NULL);
+ NTOHS(odh->additional);
+ odh->additional++;
+ HTONS(odh->additional);
+ }
+
tmp = (u_int16_t *)reply;
*tmp = htons(outlen);
repomaster@centroid.eu