[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnu-radius-help
Subject:    Re: [Help-gnu-radius] Next question with CHAP
From:       Sergey Poznyakoff <gray () Mirddin ! farlep ! net>
Date:       2002-09-17 8:27:48
[Download RAW message or body]

> Previous question was
> http://mail.gnu.org/pipermail/help-gnu-radius/2002-September/000513.html
>
> I can't properly read CHAP-Password attribute in my program via argv[]
> mechanism. It happenes because of first simbol (CHAP ID) in this =
> parameter is 0x00, I think.

Hmm, yes, I didn't take it into account. Then, the patch should have
looked as follows:

Index: radiusd/radutil.c
===================================================================
RCS file: /cvsroot/radius/radius/radiusd/radutil.c,v
retrieving revision 1.25.2.1
diff -p -u -w -b -r1.25.2.1 radutil.c
--- radiusd/radutil.c	9 Jul 2002 11:39:25 -0000	1.25.2.1
+++ radiusd/radutil.c	17 Sep 2002 08:22:47 -0000
@@ -54,6 +54,10 @@ obstack_grow_quoted(obp, str, len)
 {
 	for (; len > 0; len--, str++) {
 		switch (*str) {
+		case 0:
+			obstack_1grow(obp, '\\');
+			obstack_1grow(obp, '0');
+			break;
 		case '"':
 		case '\'':
 		case '\\':
@@ -161,7 +165,9 @@ attr_to_str(obp, req, pairlist, attr, de
 	tmp[AUTH_STRING_LEN] = 0;
 	switch (attr->type) {
 	case TYPE_STRING:
-		if (attr->value == DA_PASSWORD && req) {
+		if ((attr->value == DA_PASSWORD 
+                     || attr->value == DA_CHAP_PASSWORD)
+                    && req) {
 			char string[AUTH_STRING_LEN+1];
 			int len;
 			req_decrypt_password(string, req, pair);


This should quote the zero bytes as well. Notice that the patch is not
cumulative, i.e. it won't apply over the previous one.

Please inform me if it works for you.

Regards,
Sergey



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic