Add Attribute inside an Module
Hello everybody is it possible to add inside from a Module an Attribute. I have included an C-Modul to my freeradis which works! Now i want do add an individual Attribute like, "Web-Page" = "www.google.de" Which also works it's to change the Attribute-Value if the "State" Attribute, but I also want to have antoher Name like "State". VALUE_PAIR *reply; reply = pairmake("*State*", "*Hello State*", T_OP_EQ); pairadd(&request->reply->vps, reply); This works fine, but If now I want to add an individual Attribute it doens't work. VALUE_PAIR *reply; reply = pairmake("*Web_page*", "*www.google.de*", T_OP_EQ); pairadd(&request->reply->vps, reply); Did everyone know what did I made wrong and could help me please ? Thanks, Greetz Patrick
On 18/02/13 11:49, Patrick Ko wrote:
Hello everybody is it possible to add inside from a Module an Attribute. I have included an C-Modul to my freeradis which works! Now i want do add an individual Attribute like, "Web-Page" = "www.google.de <http://www.google.de>"
Which also works it's to change the Attribute-Value if the "State" Attribute, but I also want to have antoher Name like "State".
VALUE_PAIR *reply; reply = pairmake("*State*", "*Hello State*", T_OP_EQ); pairadd(&request->reply->vps, reply);
This should really be: if (reply) pairadd(...); i.e. you must check the return value of pairmake, in case it fails.
This works fine, but If now I want to add an individual Attribute it doens't work.
VALUE_PAIR *reply; reply = pairmake("*Web_page*", "*www.google.de <http://www.google.de>*", T_OP_EQ); pairadd(&request->reply->vps, reply);
Did everyone know what did I made wrong and could help me please ?
Did you define the attribute in a dictionary? If not, pairmake will return null.
Hello Phil, thanks for your fast an helpfull Reply! I added the following Line in the dicontairy Configuration File ( I use the dictonairy.cisco.asa ): ATTRIBUTE Webpage 4001 string Now I checked the Return Value of pairmake like this: VALUE_PAIR *rep; rep = pairmake("WebPage","www.google.de",T_OP_EQ); if(rep == NULL) { printf("Errorrrrrrrrrrrrrrrrrrrrrrrr\n\n\n\n"); exit(1); } And if I "make" && "make install" and run my radius it exited, so i see that the Value will not be created! Is it possible to get Error Messages, to see why i fails to make a pair ? And could you please help me to explain the last value (T_OP_EQ) of the pairmake function. I don't really understand which function this value has ? Greetz Patrick 2013/2/18 Phil Mayers <p.mayers@imperial.ac.uk>
On 18/02/13 11:49, Patrick Ko wrote:
Hello everybody is it possible to add inside from a Module an Attribute. I have included an C-Modul to my freeradis which works! Now i want do add an individual Attribute like, "Web-Page" = "www.google.de <http://www.google.de>"
Which also works it's to change the Attribute-Value if the "State" Attribute, but I also want to have antoher Name like "State".
VALUE_PAIR *reply; reply = pairmake("*State*", "*Hello State*", T_OP_EQ); pairadd(&request->reply->vps, reply);
This should really be:
if (reply) pairadd(...);
i.e. you must check the return value of pairmake, in case it fails.
This works fine, but If now I want to add an individual Attribute it doens't work.
VALUE_PAIR *reply; reply = pairmake("*Web_page*", "*www.google.de <http://www.google.de>*",
T_OP_EQ); pairadd(&request->reply->vps, reply);
Did everyone know what did I made wrong and could help me please ?
Did you define the attribute in a dictionary? If not, pairmake will return null. - List info/subscribe/unsubscribe? See http://www.freeradius.org/** list/devel.html <http://www.freeradius.org/list/devel.html>
Hello Phil, thanks for your fast an helpfull Reply! I added the following Line in the dicontairy Configuration File ( I use the dictonairy.cisco.asa ): ATTRIBUTE Webpage 4001 string Now I checked the Return Value of pairmake like this: VALUE_PAIR *rep; rep = pairmake("WebPage","www.google.de",T_OP_EQ); if(rep == NULL) { printf(" Errorrrrrrrrrrrrrrrrrrrrrrrr\n\n\n\n"); exit(1); } And if I "make" && "make install" and run my radius it exited, so i see that the Value will not be created! Is it possible to get Error Messages, to see why i fails to make a pair ? And could you please help me to explain the last value (T_OP_EQ) of the pairmake function. I don't really understand which function this value has ?
participants (2)
-
Patrick Ko -
Phil Mayers