File: merit-2.4.21-CHAP.diff

package info (click to toggle)
freeradius-client 1.1.6-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,048 kB
  • ctags: 504
  • sloc: sh: 8,504; ansic: 4,704; perl: 425; makefile: 86
file content (41 lines) | stat: -rw-r--r-- 1,214 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--- funcs.c.dist	Mon May 13 00:37:37 1996
+++ funcs.c	Mon May 13 00:58:33 1996
@@ -830,11 +830,12 @@
 				/* reply.*/
 
 {
-	VALUE_PAIR     *item;
+	VALUE_PAIR     *item, *chall;
 	u_char          buffer[AUTH_PASS_LEN + AUTH_VECTOR_LEN + 1];
 	int             i;
 	int             secretlen;
 	int             result;
+	int		chall_len;
 	u_char          digest[CHAP_VALUE_LENGTH];
 	u_char         *ptr;
 	char           *crypt ();
@@ -896,10 +897,21 @@
 
 		secretlen = strlen ((char *) ptr);
 		ptr += secretlen;
-		memcpy ((char *) ptr, (char *) authreq->vector,
-			AUTH_VECTOR_LEN);
+
+		/* this uses CHAP-Challenge as the challenge if it exists */
+		/* lf, 5/13/96 */
+		if ((chall = get_vp (authreq->request, PW_CHAP_CHALLENGE))
+			!= (VALUE_PAIR *) NULL) {
+			memcpy ((char *) ptr, chall->strvalue, chall->lvalue);	
+			chall_len = chall->lvalue;
+		} else {
+			memcpy ((char *) ptr, (char *) authreq->vector,
+				AUTH_VECTOR_LEN);
+			chall_len = AUTH_VECTOR_LEN;
+		}	
+		
 		md5_calc (digest, buffer,
-			  1 + CHAP_VALUE_LENGTH + secretlen);
+			  1 + chall_len + secretlen);
 		/* Compare them */
 		if ((result = memcmp ((char *) digest, item->strvalue + 1,
 				      CHAP_VALUE_LENGTH)) != 0)