shithub: riscv

Download patch

ref: b21fe017d1b80b3db5ac92568e28f670efad2509
parent: b540a22eb0c287398e21358d6b66c8e544001f77
author: cinap_lenrek <[email protected]>
date: Fri Aug 5 15:09:42 EDT 2016

libauthsrv: ANAMELEN -> PASSWDLEN

--- a/sys/include/authsrv.h
+++ b/sys/include/authsrv.h
@@ -108,7 +108,7 @@
 	char	changesecret;
 	char	secret[SECRETLEN];	/* new secret */
 };
-#define	MAXPASSREQLEN	(12+2*ANAMELEN+1+SECRETLEN+16)
+#define	MAXPASSREQLEN	(12+2*PASSWDLEN+1+SECRETLEN+16)
 
 struct	OChapreply
 {
--- a/sys/src/libauthsrv/convM2PR.c
+++ b/sys/src/libauthsrv/convM2PR.c
@@ -12,13 +12,13 @@
 
 	memset(f, 0, sizeof(Passwordreq));
 	if(t->form == 0){
-		m = 1+2*ANAMELEN+1+SECRETLEN;
+		m = 1+2*PASSWDLEN+1+SECRETLEN;
 		if(n < m)
 			return -m;
 		memmove(buf, ap, m);
 		decrypt(t->key, buf, m);
 	} else {
-		m = 12+2*ANAMELEN+1+SECRETLEN+16;
+		m = 12+2*PASSWDLEN+1+SECRETLEN+16;
 		if(n < m)
 			return -m;
 		memmove(buf, ap, m);
@@ -27,12 +27,12 @@
 	}
 	p = buf;
 	f->num = *p++;
-	memmove(f->old, p, ANAMELEN), p += ANAMELEN;
-	memmove(f->new, p, ANAMELEN), p += ANAMELEN;
+	memmove(f->old, p, PASSWDLEN), p += PASSWDLEN;
+	memmove(f->new, p, PASSWDLEN), p += PASSWDLEN;
 	f->changesecret = *p++;
 	memmove(f->secret, p, SECRETLEN);
-	f->old[ANAMELEN-1] = 0;
-	f->new[ANAMELEN-1] = 0;
+	f->old[PASSWDLEN-1] = 0;
+	f->new[PASSWDLEN-1] = 0;
 	f->secret[SECRETLEN-1] = 0;
 
 	return m;
--- a/sys/src/libauthsrv/convPR2M.c
+++ b/sys/src/libauthsrv/convPR2M.c
@@ -9,13 +9,13 @@
 {
 	uchar *p;
 
-	if(n < 1+2*ANAMELEN+1+SECRETLEN)
+	if(n < 1+2*PASSWDLEN+1+SECRETLEN)
 		return 0;
 
 	p = (uchar*)ap;
 	*p++ = f->num;
-	memmove(p, f->old, ANAMELEN), p += ANAMELEN;
-	memmove(p, f->new, ANAMELEN), p += ANAMELEN;
+	memmove(p, f->old, PASSWDLEN), p += PASSWDLEN;
+	memmove(p, f->new, PASSWDLEN), p += PASSWDLEN;
 	*p++ = f->changesecret;
 	memmove(p, f->secret, SECRETLEN), p += SECRETLEN;
 	switch(t->form){
@@ -24,7 +24,7 @@
 		encrypt(t->key, ap, n);
 		return n;
 	case 1:
-		if(n < 12+2*ANAMELEN+1+SECRETLEN+16)
+		if(n < 12+2*PASSWDLEN+1+SECRETLEN+16)
 			return 0;
 		return form1B2M(ap, p - (uchar*)ap, t->key);
 	}