From: aland Date: Tue, 25 Oct 2005 20:17:42 +0000 (+0000) Subject: Now that we have rad_vp2attr, and it's clean, adding support for X-Git-Tag: release_2_0_0_pre1~878 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=9749f70ca7dafa5042afb886784e8f677fdb8934;p=freeradius.git Now that we have rad_vp2attr, and it's clean, adding support for Starent VSA's is trivial. We still have to make rad_attr2vp() support Starent VSA's, and the Juniper encrypted integers & IP's --- diff --git a/share/dictionary b/share/dictionary index 474ea57..08d99ed 100644 --- a/share/dictionary +++ b/share/dictionary @@ -127,6 +127,7 @@ $INCLUDE dictionary.shasta $INCLUDE dictionary.shiva $INCLUDE dictionary.sonicwall $INCLUDE dictionary.springtide +$INCLUDE dictionary.starent $INCLUDE dictionary.telebit $INCLUDE dictionary.trapeze $INCLUDE dictionary.t_systems_nova diff --git a/src/include/libradius.h b/src/include/libradius.h index d5aa44e..454c09c 100644 --- a/src/include/libradius.h +++ b/src/include/libradius.h @@ -79,6 +79,7 @@ # define AUTH_HDR_LEN 20 # define VENDORPEC_USR 429 #define VENDORPEC_LUCENT 4846 +#define VENDORPEC_STARENT 8164 # define VENDOR(x) ((x >> 16) & 0xffff) # define DEBUG if (librad_debug) printf # define debug_pair(vp) do { if (librad_debug) { \ diff --git a/src/lib/dict.c b/src/lib/dict.c index 9475860..0c785cf 100644 --- a/src/lib/dict.c +++ b/src/lib/dict.c @@ -352,6 +352,7 @@ int dict_addattr(const char *name, int vendor, int type, int value, */ if ((vendor != VENDORPEC_USR) && (vendor != VENDORPEC_LUCENT) && + (vendor != VENDORPEC_STARENT) && (value > 256)) { librad_log("dict_addattr: ATTRIBUTE has invalid number (larger than 255)."); return -1; diff --git a/src/lib/radius.c b/src/lib/radius.c index 56f0cb4..f2e49e8 100644 --- a/src/lib/radius.c +++ b/src/lib/radius.c @@ -577,6 +577,20 @@ int rad_vp2attr(const RADIUS_PACKET *packet, const RADIUS_PACKET *original, *vsa_length_ptr += 3; *ptr++ = 3; total_length += 3; + + } else if (vendorcode == VENDORPEC_STARENT) { + /* + * 16-bit attribute, 16-bit length + * with the upper 8 bits of the length + * always zero! + */ + *ptr++ = ((vp->attribute >> 8) & 0xFF); + *ptr++ = (vp->attribute & 0xFF); + *ptr++ = 0; + length_ptr = ptr; + *vsa_length_ptr += 4; + *ptr++ = 4; + total_length += 4; } else { /* * All other VSA's are encoded the same