Hello,
i want to upgrade from freeradius-0.8.1 to freeradius-1.0.1. My hints file:
DEFAULT Prefix == "t", Strip-User-Name = No Hint = "TUM"
It works with freeradius-0.8.1, the username leaves unstripped. With freeradius-1.0.1 the username is always be stripped, why? Maybe i made a Syntax-Error?
i got a "nightly CVS snapshot" and this works how i supposed (with the syntax above). But now i has problems with eap. So i made a dirty source-patch for 1.0.1.
Delete the function presufcmp in .../src/main/valuepair.c and copy this one in (from freeradius-snapshot-20050111/src/modules/ rlm_expr/paircmp.c):
static int presufcmp(void *instance,
REQUEST *req UNUSED,
VALUE_PAIR *request, VALUE_PAIR *check,
VALUE_PAIR *check_pairs, VALUE_PAIR **reply_pairs)
{
VALUE_PAIR *vp;
char *name = (char *)request->strvalue;
char rest[MAX_STRING_LEN];
int len, namelen;
int ret = -1; instance = instance;
reply_pairs = reply_pairs; /* shut the compiler up */#if 0 /* DEBUG */
printf("Comparing %s and %s, check->attr is %d\n",
name, check->strvalue, check->attribute);
#endif len = strlen((char *)check->strvalue);
switch (check->attribute) {
case PW_PREFIX:
ret = strncmp(name, (char *)check->strvalue, len);
if (ret == 0 && rest)
strcpy(rest, name + len);
break;
case PW_SUFFIX:
namelen = strlen(name);
if (namelen < len)
break;
ret = strcmp(name + namelen - len,
(char *)check->strvalue);
if (ret == 0 && rest) {
strNcpy(rest, name, namelen - len + 1);
} break;
}
if (ret != 0)
return ret; /*
* If Strip-User-Name == No, then don't do any more.
*/
vp = pairfind(check_pairs, PW_STRIP_USER_NAME);
if (vp && !vp->lvalue) return ret; /*
* See where to put the stripped user name.
*/
vp = pairfind(check_pairs, PW_STRIPPED_USER_NAME);
if (!vp) {
vp = paircreate(PW_STRIPPED_USER_NAME, PW_TYPE_STRING);
if (!vp) return ret; /* no memory, do anything? */ pairadd(&request, vp);
} strcpy((char *)vp->strvalue, rest);
vp->length = strlen(rest);return ret; }
regards
Helmut Troebs
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

