Blame SOURCES/ntp-4.2.6p5-cve-2015-7974.patch

6e16f6
diff -up ntp-4.2.6p5/ntpd/ntp_proto.c.cve-2015-7974 ntp-4.2.6p5/ntpd/ntp_proto.c
6e16f6
--- ntp-4.2.6p5/ntpd/ntp_proto.c.cve-2015-7974	2016-01-21 14:06:18.958346184 +0100
6e16f6
+++ ntp-4.2.6p5/ntpd/ntp_proto.c	2016-01-21 14:16:34.894828262 +0100
6e16f6
@@ -674,10 +674,13 @@ receive(
6e16f6
 		 * succeed in bloating the key cache. If an autokey,
6e16f6
 		 * purge it immediately, since we won't be needing it
6e16f6
 		 * again. If the packet is authentic, it can mobilize an
6e16f6
-		 * association. Note that there is no key zero.
6e16f6
+		 * association. If it's a persistent association using a
6e16f6
+		 * symmetric key, the key ID has to match the configured
6e16f6
+		 * value. Note that there is no key zero. 
6e16f6
 		 */
6e16f6
-		if (!authdecrypt(skeyid, (u_int32 *)pkt, authlen,
6e16f6
-		    has_mac))
6e16f6
+		if ((peer && !(peer->flags & FLAG_PREEMPT) &&
6e16f6
+		     peer->keyid <= NTP_MAXKEY && skeyid != peer->keyid) ||
6e16f6
+		    !authdecrypt(skeyid, (u_int32 *)pkt, authlen, has_mac))
6e16f6
 			is_authentic = AUTH_ERROR;
6e16f6
 		else
6e16f6
 			is_authentic = AUTH_OK;