usage of "FR_TOKEN op" parameter to pairmake ?

Chaigneau, Nicolas nicolas.chaigneau at capgemini.com
Tue Feb 4 09:53:51 CET 2014


> 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);
	
	VALUE_PAIR *vp_test;
	
	pairmove_reply(vp_test, "Reply-Message", "Msg1.EQ", T_OP_EQ);
	pairmove_reply(vp_test, "Reply-Message", "Msg2.EQ", T_OP_EQ);
	pairmove_reply(vp_test, "Reply-Message", "Msg3.SET", T_OP_SET);
	pairmove_reply(vp_test, "Reply-Message", "Msg4.ADD", T_OP_ADD);
	pairmove_reply(vp_test, "Reply-Message", "Msg5.ADD", T_OP_ADD);

At the end I expect to obtain three Reply-Message attributes with, respectively: "Msg3.SET", "Msg4.ADD", "Msg5.ADD".
What I get is:

rad_recv: Access-Accept packet from host <...> port 1812, id=128, length=143
        Reply-Message = 'Msg4.ADD'
        Reply-Message = 'Msg4.ADD'
        Reply-Message = 'Msg5.ADD'

(ie, twice "Msg4.ADD").




I tried to use "radius_pairmove" instead. I'm not having the same issue with this function.

Am I doing something wrong with "pairmove" ?



Thanks,
Nicolas.


This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.



More information about the Freeradius-Devel mailing list