Arran Cudbard-Bell wrote:
...
> rlm_attr_rewrite: Changed value for attribute Calling-Station-Id from
> '00-17-f2-31-b4-81' to '0017f231b48'
>
> Seems to be missing last char of value...
Try the attached patch.
Alan DeKok.
--
http://deployingradius.com - The web site of the book
http://deployingradius.com/blog/ - The blog
Index: src/modules/rlm_attr_rewrite/rlm_attr_rewrite.c
===================================================================
RCS file: /source/radiusd/src/modules/rlm_attr_rewrite/rlm_attr_rewrite.c,v
retrieving revision 1.43
diff -u -r1.43 rlm_attr_rewrite.c
--- src/modules/rlm_attr_rewrite/rlm_attr_rewrite.c 17 Apr 2007 13:14:50
-0000 1.43
+++ src/modules/rlm_attr_rewrite/rlm_attr_rewrite.c 8 May 2007 13:26:26
-0000
@@ -285,9 +285,9 @@
if ((attr_vp->type == PW_TYPE_IPADDR) &&
(attr_vp->vp_strvalue[0] == '\0')) {
- inet_ntop(AF_INET, &(attr_vp->vp_ipaddr),
- attr_vp->vp_strvalue,
- sizeof(attr_vp->vp_strvalue));
+ inet_ntop(AF_INET, &(attr_vp->vp_ipaddr),
+ attr_vp->vp_strvalue,
+ sizeof(attr_vp->vp_strvalue));
}
ptr = new_str;
@@ -325,8 +325,9 @@
return ret;
}
- strlcpy(ptr, ptr2,len);
+ memcpy(ptr, ptr2,len);
ptr += len;
+ *ptr = '\0';
ptr2 += pmatch[0].rm_eo;
if (i == 0){
@@ -380,8 +381,9 @@
return ret;
}
if (replace_len){
- strlcpy(ptr, replace_STR, replace_len);
+ memcpy(ptr, replace_STR, replace_len);
ptr += replace_len;
+ *ptr = '\0';
}
}
regfree(&preg);
@@ -392,7 +394,8 @@
data->attribute, attr_vp->vp_strvalue);
return ret;
}
- strlcpy(ptr, ptr2, len);
+ memcpy(ptr, ptr2, len);
+ ptr[len] = '\0';
DEBUG2("rlm_attr_rewrite: Changed value for attribute %s from
'%s' to '%s'",
data->attribute, attr_vp->vp_strvalue, new_str);
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html