Re: Feature request/Rodopi problem with gnu-radius

Sergey Poznyakoff <[email protected]> Fri, 7 Feb 2003 00:06:15 +0200
Newsgroups gmane.comp.gnu.radius.bugs
Organization Farlep-Internet
Message-ID <[email protected]>
> The ISP I currently work for was using the old Livingston radius up until
> recently, when we switched to gnu-radius for security reasons. The problem
> we have encountered is that with the old radius server the detail files had
> "quotes" around the User-Name and Acct-Session-Id attribute values and
> gnu-radius doesn't. This is a small problem since we are using the Rodopi
[...]
>     Has anybody else encountered this problem or have a solution? I tried to

A couple of days ago I've received a similar question. Since there's
some demand, here is a patch that will make radiusd output string 
attributes surrounded with double-quotes. The patch is for version
0.96.4 of GNU Radius.

Regards,
Sergey


Index: radlib/util.c
===================================================================
RCS file: /cvsroot/radius/radius/radlib/Attic/util.c,v
retrieving revision 1.21.2.2
diff -p -u -w -b -r1.21.2.2 util.c
--- util.c	31 Jul 2002 11:58:21 -0000	1.21.2.2
+++ util.c	6 Feb 2003 21:59:20 -0000
@@ -316,6 +316,9 @@ format_string_visual(buf, runlen, str, l
 
 	seg = NULL;
 	ptr = str;
+	outbytes = 2;
+	if (buf)
+	        *buf++ = '"';
 	while (len) {
 		if (isprint(*ptr)) {
 			if (!seg)
@@ -341,8 +344,10 @@ format_string_visual(buf, runlen, str, l
 			while (seg < ptr) 
 				*buf++ = *seg++;
 	}
-	if (buf)
+	if (buf) {
+		*buf++ = '"';
 		*buf++ = 0;
+	}
 	return outbytes;
 }
 
@@ -376,9 +381,10 @@ format_pair(pair)
 	VALUE_PAIR *pair;
 {
 	static char *buf1;
-	char buf2[1+10+4*AUTH_STRING_LEN+1]; /* Enough to hold longest possible
-					        string value all converted to
-					        octal + enentual V%d prefix */
+	char buf2[1+10+4*AUTH_STRING_LEN+1];   /* Enough to hold longest 
+	                                          possible string value all 
+	                                          converted to octal +
+	                                          eventual V%d prefix */
 	DICT_VALUE *dval;
 	
 	if (buf1)