On 4 Feb 2014, at 08:53, Chaigneau, Nicolas <nicolas.chaigneau@capgemini.com> wrote:
De : Alan DeKok
Chaigneau, Nicolas wrote:
I'm trying to figure out the purpose of the last parameter to pairmake (FR_TOKEN op).
The operator is used in many configuration files. So... there needs to be a way to create / use it.
I assumed it was semantically equivalent to the following unlang syntax :
Yes.
But, whatever the operator I'm using (T_OP_EQ, T_OP_ADD or T_OP_SET), it doesn't seem to have any effect. All attributes added through pairmake to the reply vp list are returned to the client anyway.
Yes, because you're manually appending them to the list.
If you call pairmove(), it uses the operators to move one list to another.
Thanks.
So I tried using "pairmove". But I'm encountering some strange behaviour when combining the operators. I don't know if it's a weird bug or I'm doing it wrong (probably the latter...)
What I'm doing:
// macro for easier use: #define pairmove_reply(_vp, _a, _b, _c) _vp = pairmake(request->reply, NULL, _a, _b, _c); pairmove(request->reply, &(request->reply->vps), &_vp); pairfree(&_vp);
Your macro is wrong it should be #define pairmove_reply(_vp, _a, _b, _c) do {\ _vp = pairmake(request, NULL, _a, _b, _c);\ pairmove(request, &(request->reply->vps), &_vp); \ pairfree(&_vp); \ while (0) I'll look at it properly later... Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS Development Team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2