shithub: riscv

Download patch

ref: e73ce8475e683c62d0335a18788d86ae92a010f0
parent: 08292c8f1fb3c122e92ed13d8c107009c919ada1
author: cinap_lenrek <[email protected]>
date: Tue Oct 9 02:34:27 EDT 2018

ndb/dnstcp: return a proper non-answer when rejecting zone transfer

--- a/sys/src/cmd/ndb/dnstcp.c
+++ b/sys/src/cmd/ndb/dnstcp.c
@@ -299,15 +299,15 @@
 
 	/* send the soa */
 	repp->an = rrlookup(dp, Tsoa, NOneg);
-	reply(1, repp, req);
-	if(repp->an == nil)
-		goto out;
-	if(!anyone && !myip(srcip) && findserver(srcip, repp->an->soa->slaves, req) == nil){
+	if(repp->an != nil && !anyone && !myip(srcip)
+	&& findserver(srcip, repp->an->soa->slaves, req) == nil){
 		dnslog("dnstcp: %I axfr %s - not a dnsslave", srcip, dp->name);
 		rrfreelist(repp->an);
 		repp->an = nil;
-		goto out;
 	}
+	reply(1, repp, req);
+	if(repp->an == nil)
+		goto out;
 	rrfreelist(repp->an);
 	repp->an = nil;