Problem with 3Com-User-Access-Level and rlm_perl
Krzysztof Olędzki
krzysztof.oledzki at axelspringer.pl
Sun Nov 26 21:41:08 CET 2006
On Sun, 26 Nov 2006, Krzysztof Olędzki wrote:
> On 2006-11-26 20:25, Alan DeKok wrote:
>> Krzysztof Olędzki wrote:
>>
>>> Like I said in my first mail: problem with rlm_perl was tested with both
>>> freeradius-1.1.2 and 1.1.3. The test with users file was done using
>>> version 1.1.3.
>>
>> Ok... I get enough email that I don't keep track of previous messages
>> in a thread.
>>
>> In any case, the issue is that the VALUE name starts with '3', so
>> *any* of the '3Com-*' VALUES get parsed as '3'. The solution is to
>> update the VALUE name so it doesn't start with '3'.
>>
>> Or, update the source code to be a little more intelligent about
>> parsing VALUEs
>
> OK, probably found it (src/lib/valuepair.c):
How about attached (for patching) and inlined (for easy review) patch?
I also fixed else/if abuse - this is a code in a switch/case statement so we
can simply use a "break;".
diff -Nur freeradius-1.1.3-orig/src/lib/valuepair.c freeradius-1.1.3/src/lib/valuepair.c
--- freeradius-1.1.3-orig/src/lib/valuepair.c 2006-05-03 19:40:58.000000000 +0200
+++ freeradius-1.1.3/src/lib/valuepair.c 2006-11-26 21:26:05.000000000 +0100
@@ -699,29 +699,29 @@
if (s) free(s);
vp->length = 4;
break;
+
case PW_TYPE_INTEGER:
/*
- * If it starts with a digit, it must
- * be a number (or a range).
- *
* Note that ALL integers are unsigned!
*/
- if (isdigit((int) *value)) {
- vp->lvalue = (uint32_t) strtoul(value, NULL, 10);
+ vp->lvalue = (uint32_t) strtoul(value, &p, 10);
+ if (!*p) {
vp->length = 4;
+ break;
}
+
/*
* Look for the named value for the given
* attribute.
*/
- else if ((dval = dict_valbyname(vp->attribute, value)) == NULL) {
+ if ((dval = dict_valbyname(vp->attribute, value)) == NULL) {
librad_log("Unknown value %s for attribute %s",
value, vp->name);
return NULL;
- } else {
- vp->lvalue = dval->value;
- vp->length = 4;
}
+
+ vp->lvalue = dval->value;
+ vp->length = 4;
break;
case PW_TYPE_DATE:
Best regards,
Krzysztof Olędzki
-------------- next part --------------
diff -Nur freeradius-1.1.3-orig/src/lib/valuepair.c freeradius-1.1.3/src/lib/valuepair.c
--- freeradius-1.1.3-orig/src/lib/valuepair.c 2006-05-03 19:40:58.000000000 +0200
+++ freeradius-1.1.3/src/lib/valuepair.c 2006-11-26 21:26:05.000000000 +0100
@@ -699,29 +699,29 @@
if (s) free(s);
vp->length = 4;
break;
+
case PW_TYPE_INTEGER:
/*
- * If it starts with a digit, it must
- * be a number (or a range).
- *
* Note that ALL integers are unsigned!
*/
- if (isdigit((int) *value)) {
- vp->lvalue = (uint32_t) strtoul(value, NULL, 10);
+ vp->lvalue = (uint32_t) strtoul(value, &p, 10);
+ if (!*p) {
vp->length = 4;
+ break;
}
+
/*
* Look for the named value for the given
* attribute.
*/
- else if ((dval = dict_valbyname(vp->attribute, value)) == NULL) {
+ if ((dval = dict_valbyname(vp->attribute, value)) == NULL) {
librad_log("Unknown value %s for attribute %s",
value, vp->name);
return NULL;
- } else {
- vp->lvalue = dval->value;
- vp->length = 4;
}
+
+ vp->lvalue = dval->value;
+ vp->length = 4;
break;
case PW_TYPE_DATE:
More information about the Freeradius-Users
mailing list