[Git][NTPsec/ntpsec][master] Bug fix for recent received packet cleanup
    Hal Murray 
    gitlab at mg.gitlab.com
       
    Fri Apr  6 22:07:26 UTC 2018
    
    
  
Hal Murray pushed to branch master at NTPsec / ntpsec
Commits:
33a62720 by Hal Murray at 2018-04-06T09:06:55Z
Bug fix for recent received packet cleanup
It broke if 2 sites used each other as servers
with different auth keys.
- - - - -
1 changed file:
- ntpd/ntp_proto.c
Changes:
=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -744,7 +744,18 @@ receive(
 		sys_badlength++;
 		goto done;
 	}
-	peer = findpeer(rbufp);
+
+	if (MODE_SERVER == PKT_MODE(rbufp->pkt.li_vn_mode)) {
+	    /* Reply to our request:
+	     * Auth check breaks if we findpeer for MODE_CLIENT and
+	     * a site we are using as a server uses us as a server
+	     * with a different key. */
+	    peer = findpeer(rbufp);
+	    if (NULL == peer) {
+		sys_declined++;
+		goto done;
+	    }
+	}
 
 	if(i_require_authentication(peer, rbufp, restrict_mask)) {
 		if(
@@ -790,8 +801,7 @@ receive(
 		/* Reply to our request. */
 		handle_procpkt(rbufp, peer);
 		sys_processed++;
-		if (peer != NULL)	/* just to be on the safe side */
-		    peer->processed++;
+		peer->processed++;
 		break;
 	    default:
 		/* Everything else is for broadcast modes,
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/33a62720b89062b8dcdc45cf55667b4111c0de19
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/33a62720b89062b8dcdc45cf55667b4111c0de19
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20180406/1daee06c/attachment.html>
    
    
More information about the vc
mailing list