Thanks to Chris Parker for the heads up.

For the record, creating a vendor attribute for modules is exactly the
same as creating regular attributes. The packet formation is done by the
radius library code.

(In my particualr case, I had a mlaformed dictionary file).

Explicity, here are the steps:

dictionary file:
---------------

# your vendor code here
VENDOR  SOMA    4735

# Define your attributes: don't forget the trailing vendor name!
ATTRIBUTE       SOMA-Something          1       string          SOMA
:


Source file:
------------
#define VENDOR_SOMA (4735)
#define SOMA_SOMETHING ((VENDOR_SOMA << 16) | 1)
/* I'll be honest, I'm not sure why we are shifting by 16 bits here, but
I'll assume is has something to do with the dictionary system */

:
void add_my_vp (REQUEST *request)
{
    VALUE_PAIR *vp;
    if ((vp = paircreate(SOMA_SOMETHING, PW_TYPE_STRING)) == NULL) {
        radlog(L_ERR|L_CONS, "no memory");
        return;
    }
    vp->lvalue = "hey HEY! This is a vendor attribute";
    pairadd(&request->reply->vps, vp);
}


-----------

Nice and easy.

Thanks again to Chris.

MV

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mike Varley         -= SOMA Networks =-
Tel: 416.977.1414   x1578
email: [EMAIL PROTECTED]


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to