Phil Mayers wrote:
> It's also appending a 2nd "w" on the end, almost as if something is
> re-using the original string buffer:
>
> "IC\rmtw"
>
> ...and writing "IC<cr>mtw" into it, giving:
>
> "IC<cr>mtww"
That looks like a separate bug. Try the "valuepair.diff" patch first.
> I can work up a patch for the sql_set_user functions in rlm_sql and
> rlm_sql_log; I take it then this is un-related to the unlang issue?
Yes.
Try the sql.diff file for the \r bug.
Alan DeKok.
diff --git a/src/modules/rlm_sql/rlm_sql.c b/src/modules/rlm_sql/rlm_sql.c
index dc8dc25..f59a04e 100644
--- a/src/modules/rlm_sql/rlm_sql.c
+++ b/src/modules/rlm_sql/rlm_sql.c
@@ -435,13 +435,16 @@ int sql_set_user(SQL_INST *inst, REQUEST *request, char *sqlusername, const char
strlcpy(sqlusername, tmpuser, MAX_STRING_LEN);
DEBUG2("rlm_sql (%s): sql_set_user escaped user --> '%s'",
inst->config->xlat_name, sqlusername);
- vp = pairmake("SQL-User-Name", sqlusername, 0);
- if (vp == NULL) {
+ vp = radius_pairmake(request, &request->packet->vps,
+ "SQL-User-Name", NULL, 0);
+ if (!vp) {
radlog(L_ERR, "%s", librad_errstr);
return -1;
}
- pairadd(&request->packet->vps, vp);
+ strlcpy(vp->vp_strvalue, tmpuser, sizeof(vp->vp_strvalue));
+ vp->vp_length = strlen(vp->vp_strvalue);
+
return 0;
}
diff --git a/src/lib/valuepair.c b/src/lib/valuepair.c
index 97c7b93..42eb3f8 100644
--- a/src/lib/valuepair.c
+++ b/src/lib/valuepair.c
@@ -879,6 +879,7 @@ VALUE_PAIR *pairparsevalue(VALUE_PAIR *vp, const char *value)
length++;
}
vp->length = length;
+ vp->vp_strvalue[vp->length] = '\0';
break;
case PW_TYPE_IPADDR:
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html