help-gnu-radius
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gnu-radius] Next question with CHAP


From: Sergey Poznyakoff
Subject: Re: [Help-gnu-radius] Next question with CHAP
Date: Tue, 17 Sep 2002 11:27:48 +0300

> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]