};
-/** Return the on-the-wire length of an attribute value
- *
- * @param[in] vp to return the length of.
- * @return the length of the attribute.
- */
-size_t fr_radius_attr_len(fr_pair_t const *vp)
-{
- switch (vp->vp_type) {
- case FR_TYPE_VARIABLE_SIZE:
- if (vp->da->flags.length) return vp->da->flags.length; /* Variable type with fixed length */
- return vp->vp_length;
-
- case FR_TYPE_STRUCTURAL:
- fr_assert_fail(NULL);
- return 0;
-
- default:
- return fr_radius_attr_sizes[vp->vp_type][0];
- }
-}
-
/** Do Ascend-Send / Recv-Secret calculation.
*
* The secret is hidden by xoring with a MD5 digest created from
fr_dbuff_marker(&src, &value_dbuff);
fr_dbuff_marker(&dest, &value_dbuff);
- /*
- * Set up the default sources for the data.
- */
- len = fr_radius_attr_len(vp);
-
- /*
- * Invalid value, don't encode.
- */
- if (len > RADIUS_MAX_STRING_LENGTH) {
- fr_strerror_printf("%s length of %zu bytes exceeds maximum value length",
- vp->da->name, len);
- return PAIR_ENCODE_SKIPPED;
- }
-
switch (da->type) {
/*
* IPv4 addresses are normal, but IPv6 addresses are special to RADIUS.
FR_PROTO_STACK_PRINT(da_stack, depth);
p = vp->vp_octets;
- data_len = fr_radius_attr_len(vp);
+ data_len = vp->vp_length;
fr_dbuff_marker(&hdr, &work_dbuff);
while (data_len > 0) {
*/
case FR_TYPE_STRING:
case FR_TYPE_OCTETS:
- if (fr_radius_attr_len(vp) != 0) break;
-
/*
* Zero-length strings are allowed for CUI
* (thanks WiMAX!), and for
* Message-Authenticator, because we will
* automagically generate that one ourselves.
*/
- if (!fr_dict_attr_is_top_level(vp->da) ||
- ((vp->da->attr != FR_CHARGEABLE_USER_IDENTITY) &&
- (vp->da->attr != FR_MESSAGE_AUTHENTICATOR))) {
+ if ((vp->vp_length == 0) &&
+ (vp->da != attr_chargeable_user_identity) &&
+ (vp->da != attr_message_authenticator)) {
fr_dcursor_next(cursor);
fr_strerror_const("Zero length string attributes not allowed");
return PAIR_ENCODE_SKIPPED;
/*
* protocols/radius/base.c
*/
-size_t fr_radius_attr_len(fr_pair_t const *vp);
-
int fr_radius_sign(uint8_t *packet, uint8_t const *original,
uint8_t const *secret, size_t secret_len) CC_HINT(nonnull (1,3));
int fr_radius_verify(uint8_t *packet, uint8_t const *original,