git: 9front

Download patch

ref: 6080376a862bd671d33e7b4283cddc5246087dc3
parent: ed914d1066cd4cbbc100720a55e1da8c2475c849
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jan 14 20:31:27 EST 2018

authsrv: fix chap

use OCHAPREPLYLEN instead of sizeof(reply) (no padding).

exit after sending ticket response to force eof as factotum
unconditionally reads tailing secret hash (as of mschap).

--- a/sys/src/cmd/auth/authsrv.c
+++ b/sys/src/cmd/auth/authsrv.c
@@ -588,8 +588,9 @@
 	/*
 	 *  get chap reply
 	 */
-	if(readn(0, &reply, sizeof(reply)) < 0)
+	if(readn(0, &reply, OCHAPREPLYLEN) < 0)
 		exits(0);
+
 	safecpy(tr->uid, reply.uid, sizeof(tr->uid));
 	if(tr->uid[0] == 0)
 		exits(0);
@@ -625,6 +626,9 @@
 	tickauthreply(tr, &hkey);
 
 	syslog(0, AUTHLOG, "chap-ok %s %s", tr->uid, raddr);
+
+	/* no secret after ticket */
+	exits(0);
 }
 
 enum {
--