Commit Diff
Diff:
b7d74d0818db8b5b6337e2e2c1be204097b7f494
4ec050febc5abae6c990335c01ecd52bcead034d
Commit:
4ec050febc5abae6c990335c01ecd52bcead034d
Tree:
85e39ae6eeb3c57a4bff69431b87948db057dab7
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Wed Dec 11 16:22:26 2019 UTC
Message:
replace magic numbers of 300 with DEFAULT_TSIG_FUDGE of the same value. in util.c I found a weird ppoffset set to 0I, I think this was a typo I'm wondering how this got in there, without problems.
blob - b7f53cfb0c898c9f4fb924549a0224cb0efdfbcc
blob + ba873b1da91b674b5d1d1edff70cf277932ef621
--- additional.c
+++ additional.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: additional.c,v 1.31 2019/12/04 06:52:55 pjp Exp $
+ * $Id: additional.c,v 1.32 2019/12/11 16:22:26 pjp Exp $
*/
#include <sys/types.h>
@@ -522,12 +522,12 @@ additional_tsig(struct question *question, char *reply
answer = (struct dns_tsigrr *)&reply[offset];
if (envelope > 1 || envelope < -1) {
- answer->timefudge = htobe64(((u_int64_t)now << 16) | (300 & 0xffff));
+ answer->timefudge = htobe64(((u_int64_t)now << 16) | (DEFAULT_TSIG_FUDGE & 0xffff));
} else {
if (request == 0 || envelope == 1) {
answer->timefudge = question->tsig.tsig_timefudge;
} else {
- answer->timefudge = htobe64((now << 16) | (300 & 0xffff));
+ answer->timefudge = htobe64((now << 16) | (DEFAULT_TSIG_FUDGE & 0xffff));
}
}
@@ -562,7 +562,7 @@ additional_tsig(struct question *question, char *reply
if (request == 0 || envelope == 1)
ppanswer->timefudge = question->tsig.tsig_timefudge;
else
- ppanswer->timefudge = htobe64(((u_int64_t)now << 16) | (300 & 0xffff));
+ ppanswer->timefudge = htobe64(((u_int64_t)now << 16) | (DEFAULT_TSIG_FUDGE & 0xffff));
ppoffset += 8;
@@ -590,7 +590,7 @@ additional_tsig(struct question *question, char *reply
if (envelope % 89 == 0 || envelope == -2) {
ttlen = 0;
timers = (struct dns_tsigrr *)&tsig_timers[ttlen];
- timers->timefudge = htobe64(((u_int64_t)now << 16) | (300 & 0xffff));
+ timers->timefudge = htobe64(((u_int64_t)now << 16) | (DEFAULT_TSIG_FUDGE & 0xffff));
ttlen += 8;
HMAC_Update(tsigctx, (const unsigned char *)tsig_timers, ttlen);
}
blob - 1281f8234cb629f6e5d0f0ac5ecc81dc6c56796f
blob + a548c2c7e03ac072255ae1c6588a18272b01eae2
--- ddd-dns.h
+++ ddd-dns.h
@@ -27,7 +27,7 @@
*/
/*
- * $Id: ddd-dns.h,v 1.9 2019/10/25 10:24:49 pjp Exp $
+ * $Id: ddd-dns.h,v 1.10 2019/12/11 16:22:26 pjp Exp $
*/
#ifndef _DNS_H
@@ -249,6 +249,8 @@ struct tsig {
u_int64_t tsig_timefudge;
u_int16_t tsigorigid;
};
+
+#define DEFAULT_TSIG_FUDGE 300
struct question {
struct dns_question_hdr *hdr;
blob - 6f604be16303869a5a692f974a4a3249cd7ed300
blob + dd156b8b1e04abb2445898bdf10045f57a14f150
--- raxfr.c
+++ raxfr.c
@@ -26,7 +26,7 @@
*
*/
/*
- * $Id: raxfr.c,v 1.45 2019/12/07 08:02:59 pjp Exp $
+ * $Id: raxfr.c,v 1.46 2019/12/11 16:22:26 pjp Exp $
*/
#include <sys/types.h>
@@ -1790,7 +1790,7 @@ get_remote_soa(struct rzone *rzone)
HMAC_Update(ctx, &query[2], totallen - 2);
now = time(NULL);
- if (tsig_pseudoheader(rzone->tsigkey, 300, now, ctx) < 0) {
+ if (tsig_pseudoheader(rzone->tsigkey, DEFAULT_TSIG_FUDGE, now, ctx) < 0) {
fprintf(stderr, "tsig_pseudoheader failed\n");
return(MY_SOCK_TIMEOUT);
}
@@ -1843,7 +1843,7 @@ get_remote_soa(struct rzone *rzone)
totallen += 4;
/* fudge */
- pack16(&query[totallen], htons(300));
+ pack16(&query[totallen], htons(DEFAULT_TSIG_FUDGE));
totallen += 2;
/* hmac size */
blob - 382c21f632abf05d0c0afaf35e382d849c09868c
blob + 9c30404732badf26648752751218925af1a7f256
--- util.c
+++ util.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: util.c,v 1.57 2019/12/06 16:28:35 pjp Exp $
+ * $Id: util.c,v 1.58 2019/12/11 16:22:26 pjp Exp $
*/
#include <sys/types.h>
@@ -1613,7 +1613,7 @@ tsig_pseudoheader(char *tsigkeyname, uint16_t fudge, t
char pseudo_packet[512];
char *keyname = NULL;
- int ppoffset = 0I;
+ int ppoffset = 0;
int len;
char *p;
@@ -1890,7 +1890,7 @@ lookup_axfr(FILE *f, int so, char *zonename, struct so
HMAC_Update(ctx, &query[2], totallen - 2);
now = time(NULL);
- if (tsig_pseudoheader(tsigkey, 300, now, ctx) < 0) {
+ if (tsig_pseudoheader(tsigkey, DEFAULT_TSIG_FUDGE, now, ctx) < 0) {
fprintf(stderr, "tsig_pseudoheader failed\n");
return -1;
}
@@ -1954,7 +1954,7 @@ lookup_axfr(FILE *f, int so, char *zonename, struct so
p += 4;
/* fudge */
- pack16(p, htons(300));
+ pack16(p, htons(DEFAULT_TSIG_FUDGE));
totallen += 2;
p += 2;
repomaster@centroid.eu