updating avp lists with unlang and operators
Hi, if i overwrite an avp in the preacct section like update request { User-Name := "foobar" } and i have a "detail" instance in the acct section, the line that is written to the detail log is "User-Name := foobar" instead of "User-Name = foobar" I guess the problem lies in my_pairmove() in evaluate.c (line 774). The avp is copied from the src avp list to the dst avp list and the operator is not touched. Maybe the operator in the dst list should default to "=" if the list is "reply" or "request"? Another solution might be to alter rlm_detail to always use the "=" operator when printing out avp's. What do you think? Stephan Jaeger -- Stephan Jaeger <stephan.jaeger@ewetel.de> EWE TEL GmbH
Stephan Jaeger wrote:
and i have a "detail" instance in the acct section, the line that is written to the detail log is
"User-Name := foobar"
Yeah, the operators aren't changed when the attributes are added to the list. This is in 1.1.x, too.
I guess the problem lies in my_pairmove() in evaluate.c (line 774). The avp is copied from the src avp list to the dst avp list and the operator is not touched. Maybe the operator in the dst list should default to "=" if the list is "reply" or "request"?
Once the attribute has been moved to the destination list, the operator should be updated to '='. Alan DeKok.
Am Mittwoch, den 01.08.2007, 10:36 -0400 schrieb Alan DeKok:
Stephan Jaeger wrote:
and i have a "detail" instance in the acct section, the line that is written to the detail log is
"User-Name := foobar"
Yeah, the operators aren't changed when the attributes are added to the list. This is in 1.1.x, too.
I guess the problem lies in my_pairmove() in evaluate.c (line 774). The avp is copied from the src avp list to the dst avp list and the operator is not touched. Maybe the operator in the dst list should default to "=" if the list is "reply" or "request"?
Once the attribute has been moved to the destination list, the operator should be updated to '='.
It does work with the simple patch below, but what about control and config lists? Shouldn't the old operator better be saved and re-set afterwards? --- evaluate.c.orig 2007-08-01 16:57:14.000000000 +0200 +++ evaluate.c 2007-08-01 16:58:09.000000000 +0200 @@ -776,6 +776,7 @@ to_list[j]->name, i, j); pairfree(&to_list[j]); to_list[j] = from_list[i]; + to_list[j]->operator = T_OP_EQ; from_list[i] = NULL; edited[j] = TRUE; break; Stephan Jaeger -- Stephan Jaeger <stephan.jaeger@ewetel.de> EWE TEL GmbH
Stephan Jaeger wrote:
It does work with the simple patch below, but what about control and config lists? Shouldn't the old operator better be saved and re-set afterwards?
Nope. The operators exist *only* for putting attributes into the list. Once they're in a list, they have no effect on anything. Alan DeKok.
participants (2)
-
Alan DeKok -
Stephan Jaeger