aboutsummaryrefslogtreecommitdiff
path: root/lib/libradius
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libradius')
-rw-r--r--lib/libradius/libradius.322
-rw-r--r--lib/libradius/radlib.c13
2 files changed, 34 insertions, 1 deletions
diff --git a/lib/libradius/libradius.3 b/lib/libradius/libradius.3
index 2199d26b2960..3ccd9e4275b2 100644
--- a/lib/libradius/libradius.3
+++ b/lib/libradius/libradius.3
@@ -55,6 +55,8 @@
.Ft int
.Fn rad_get_attr "struct rad_handle *h" "const void **data" "size_t *len"
.Ft int
+.Fn rad_get_vendor_attr "u_int32_t *vendor" "const void **data" "size_t *len"
+.Ft int
.Fn rad_init_send_request "struct rad_handle *h" "int *fd" "struct timeval *tv"
.Ft int
.Fn rad_put_addr "struct rad_handle *h" "int type" "struct in_addr addr"
@@ -293,6 +295,22 @@ returns 0.
If an error such as a malformed attribute is detected, -1 is
returned.
.Pp
+If
+.Fn rad_get_attr
+returns
+.Dv RAD_VENDOR_SPECIFIC ,
+.Fn rad_get_vendor_attr
+may be called to determine the vendor.
+The vendor specific RADIUS attribute type is returned.
+The reference parameters
+.Va data
+and
+.Va len
+.Pq as returned from Fn rad_get_attr
+are passed to
+.Fn rad_get_vendor_attr ,
+and are adjusted to point to the vendor specific attribute data.
+.Pp
The common types of attributes can be decoded using
.Fn rad_cvt_addr ,
.Fn rad_cvt_int ,
@@ -300,7 +318,9 @@ and
.Fn rad_cvt_string .
These functions accept a pointer to the attribute data, which should
have been obtained using
-.Fn rad_get_attr .
+.Fn rad_get_attr
+and optionally
+.Fn rad_get_vendor_attr .
In the case of
.Fn rad_cvt_string ,
the length
diff --git a/lib/libradius/radlib.c b/lib/libradius/radlib.c
index c94481e8aadc..bc3679e06674 100644
--- a/lib/libradius/radlib.c
+++ b/lib/libradius/radlib.c
@@ -866,6 +866,19 @@ split(char *str, char *fields[], int maxfields, char *msg, size_t msglen)
}
int
+rad_get_vendor_attr(u_int32_t *vendor, const void **data, size_t *len)
+{
+ struct vendor_attribute *attr;
+
+ attr = (struct vendor_attribute *)*data;
+ *vendor = ntohl(attr->vendor_value);
+ *data = attr->attrib_data;
+ *len = attr->attrib_len - 2;
+
+ return (attr->attrib_type);
+}
+
+int
rad_put_vendor_addr(struct rad_handle *h, int vendor, int type,
struct in_addr addr)
{