#define vp_ether data.datum.ether
#define vp_bool data.datum.boolean
-#define vp_byte data.datum.byte
+#define vp_uint8 data.datum.uint8
#define vp_short data.datum.uint16
-#define vp_integer data.datum.integer
+#define vp_uint32 data.datum.uint32
#define vp_uint64 data.datum.uint64
#define vp_size data.datum.size
#define vp_signed data.datum.int32
-#define vp_decimal data.datum.decimal
+#define vp_float64 data.datum.float64
#define vp_date data.datum.date
#define vp_filter data.datum.filter
struct {
union {
- uint8_t byte; //!< 8bit unsigned integer.
+ uint8_t uint8; //!< 8bit unsigned integer.
uint16_t uint16; //!< 16bit unsigned integer.
- uint32_t integer; //!< 32bit unsigned integer.
- uint64_t uint64; //!< 64bit unsigned integer.
- size_t size; //!< System specific file/memory size.
+ uint32_t uint32; //!< 32bit unsigned integer.
+ uint64_t uint64; //!< 64bit unsigned integer.
- int32_t int32; //!< 32bit signed integer.
+ int32_t int32; //!< 32bit signed integer.
};
fr_dict_attr_t const *enumv; //!< Enumeration values for integer type.
};
+ double float64; //!< Double precision float.
+
+ size_t size; //!< System specific file/memory size.
struct timeval timeval; //!< A time value with usec precision.
- double decimal; //!< Double precision float.
+
+
uint32_t date; //!< Date (32bit Unix timestamp).
{ "size", FR_TYPE_SIZE },
{ "signed", FR_TYPE_INT32 },
- { "decimal", FR_TYPE_FLOAT64 },
+ { "float64", FR_TYPE_FLOAT64 },
{ "timeval", FR_TYPE_TIMEVAL },
{ "date", FR_TYPE_DATE },
* offset: A Number. Specifies an offset into a frame
* to start comparing.
*
- * mask: A hexadecimal mask of bits to compare.
+ * mask: A hexafloat64 mask of bits to compare.
*
* value: A value to compare with the masked data.
*
n[h] = ((n[h] << 1) & 0xffffffffffffffff) + (n[l] >= 0x8000000000000000);
n[l] = ((n[l] << 1) & 0xffffffffffffffff);
- // Add s[] to itself in decimal, doubling it
+ // Add s[] to itself in float64, doubling it
for (j = sizeof(buff) - 2; j >= 0; j--) {
buff[j] += buff[j] - '0' + carry;
carry = (buff[j] > '9');
sec = strtoul(in, &end, 10);
if (in == end) {
- fr_strerror_printf("Failed parsing \"%s\" as decimal", in);
+ fr_strerror_printf("Failed parsing \"%s\" as float64", in);
return -1;
}
tv.tv_sec = sec;
*/
sec = strtoul(end + 1, &end, 10);
if (in == end) {
- fr_strerror_printf("Failed parsing fractional component \"%s\" of decimal ", in);
+ fr_strerror_printf("Failed parsing fractional component \"%s\" of float64 ", in);
return -1;
}
while (len < 6) {
static int _fr_pair_free(NDEBUG_UNUSED VALUE_PAIR *vp)
{
#ifndef NDEBUG
- vp->vp_integer = FREE_MAGIC;
+ vp->vp_uint32 = FREE_MAGIC;
#endif
#ifdef TALLOC_DEBUG
return vp->vp_bool ? "yes" : "no";
case FR_TYPE_UINT8:
- enumv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_byte);
+ enumv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_uint8);
break;
case FR_TYPE_UINT16:
break;
case FR_TYPE_UINT32:
- enumv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_integer);
+ enumv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_uint32);
break;
case FR_TYPE_UINT64:
*/
PRIVATE void
#ifdef __STDC__
-decimal(struct DATA *p, double d)
+float64(struct DATA *p, double d)
#else
-decimal(p, d)
+float64(p, d)
struct DATA *p;
double d;
#endif
PAD_LEFT(p);
}
-/* for %x %X hexadecimal representation */
+/* for %x %X hexafloat64 representation */
PRIVATE void
#ifdef __STDC__
hexa(struct DATA *p, double d)
exponent(&data, d);
state = 0;
break;
- case 'u': /* unsigned decimal */
+ case 'u': /* unsigned float64 */
STAR_ARGS(&data);
if (data.a_longlong == FOUND)
d = va_arg(args, unsigned LONG_LONG);
d = va_arg(args, unsigned long);
else
d = va_arg(args, unsigned int);
- decimal(&data, d);
+ float64(&data, d);
state = 0;
break;
- case 'd': /* decimal */
+ case 'd': /* float64 */
STAR_ARGS(&data);
if (data.a_longlong == FOUND)
d = va_arg(args, LONG_LONG);
d = va_arg(args, long);
else
d = va_arg(args, int);
- decimal(&data, d);
+ float64(&data, d);
state = 0;
break;
case 'o': /* octal */
state = 0;
break;
case 'x':
- case 'X': /* hexadecimal */
+ case 'X': /* hexafloat64 */
STAR_ARGS(&data);
if (data.a_longlong == FOUND)
d = va_arg(args, LONG_LONG);
PRIVATE void conv_flag(char *, struct DATA *);
PRIVATE void floating(struct DATA *, double);
PRIVATE void exponent(struct DATA *, double);
- PRIVATE void decimal(struct DATA *, double);
+ PRIVATE void float64(struct DATA *, double);
PRIVATE void octal(struct DATA *, double);
PRIVATE void hexa(struct DATA *, double);
PRIVATE void strings(struct DATA *, char *);
PRIVATE void conv_flag();
PRIVATE void floating();
PRIVATE void exponent();
- PRIVATE void decimal();
+ PRIVATE void float64();
PRIVATE void octal();
PRIVATE void hexa();
PRIVATE void strings();
* There are three notional data formats used in the server:
*
* - #fr_value_box_t are the INTERNAL format. This is usually close to the in-memory representation
- * of the data, though integers and IPs are always converted to/from octets with BIG ENDIAN
- * byte ordering for consistency.
+ * of the data, though uint32s and IPs are always converted to/from octets with BIG ENDIAN
+ * uint8 ordering for consistency.
* - #fr_value_box_cast is used to convert (cast) #fr_value_box_t between INTERNAL formats.
* - #fr_value_box_strdup* is used to ingest nul terminated strings into the INTERNAL format.
* - #fr_value_box_memdup* is used to ingest binary data into the INTERNAL format.
* - NETWORK format is the format we send/receive on the wire. It is not a perfect representation
* of data packing for all protocols, so you will likely need to overload conversion for some types.
* - fr_value_box_to_network is used to covert INTERNAL format data to generic NETWORK format data.
- * For integers, IP addresses etc... This means BIG ENDIAN byte ordering.
+ * For uint32s, IP addresses etc... This means BIG ENDIAN uint8 ordering.
* - fr_value_box_from_network is used to convert packet buffer fragments in NETWORK format to
* INTERNAL format.
*
#include <freeradius-devel/rad_assert.h>
#include <ctype.h>
-/** How many bytes on-the-wire would a #fr_value_box_t value consume
+/** How many uint8s on-the-wire would a #fr_value_box_t value consume
*
* This is for the generic NETWORK format. For field sizes in the in-memory
* structure use #fr_value_box_field_sizes.
"datum.ether has unexpected length");
static_assert(SIZEOF_MEMBER(fr_value_box_t, datum.boolean) == 1,
"datum.boolean has unexpected length");
-static_assert(SIZEOF_MEMBER(fr_value_box_t, datum.byte) == 1,
- "datum.byte has unexpected length");
+static_assert(SIZEOF_MEMBER(fr_value_box_t, datum.uint8) == 1,
+ "datum.uint8 has unexpected length");
static_assert(SIZEOF_MEMBER(fr_value_box_t, datum.uint16) == 2,
"datum.uint16 has unexpected length");
-static_assert(SIZEOF_MEMBER(fr_value_box_t, datum.integer) == 4,
- "datum.integer has unexpected length");
+static_assert(SIZEOF_MEMBER(fr_value_box_t, datum.uint32) == 4,
+ "datum.uint32 has unexpected length");
static_assert(SIZEOF_MEMBER(fr_value_box_t, datum.uint64) == 8,
"datum.uint64 has unexpected length");
static_assert(SIZEOF_MEMBER(fr_value_box_t, datum.int32) == 4,
"datum.int32 has unexpected length");
-/** How many bytes wide each of the value data fields are
+/** How many uint8s wide each of the value data fields are
*
* This is useful when copying a value from a fr_value_box_t to a memory
* location passed as a void *.
[FR_TYPE_ETHERNET] = SIZEOF_MEMBER(fr_value_box_t, datum.ether),
[FR_TYPE_BOOL] = SIZEOF_MEMBER(fr_value_box_t, datum.boolean),
- [FR_TYPE_UINT8] = SIZEOF_MEMBER(fr_value_box_t, datum.byte),
+ [FR_TYPE_UINT8] = SIZEOF_MEMBER(fr_value_box_t, datum.uint8),
[FR_TYPE_UINT16] = SIZEOF_MEMBER(fr_value_box_t, datum.uint16),
- [FR_TYPE_UINT32] = SIZEOF_MEMBER(fr_value_box_t, datum.integer),
+ [FR_TYPE_UINT32] = SIZEOF_MEMBER(fr_value_box_t, datum.uint32),
[FR_TYPE_UINT64] = SIZEOF_MEMBER(fr_value_box_t, datum.uint64),
[FR_TYPE_SIZE] = SIZEOF_MEMBER(fr_value_box_t, datum.size),
[FR_TYPE_INT32] = SIZEOF_MEMBER(fr_value_box_t, datum.int32),
[FR_TYPE_TIMEVAL] = SIZEOF_MEMBER(fr_value_box_t, datum.timeval),
- [FR_TYPE_FLOAT64] = SIZEOF_MEMBER(fr_value_box_t, datum.decimal),
+ [FR_TYPE_FLOAT64] = SIZEOF_MEMBER(fr_value_box_t, datum.float64),
[FR_TYPE_DATE] = SIZEOF_MEMBER(fr_value_box_t, datum.date),
[FR_TYPE_ABINARY] = SIZEOF_MEMBER(fr_value_box_t, datum.filter),
[FR_TYPE_ETHERNET] = offsetof(fr_value_box_t, datum.ether),
[FR_TYPE_BOOL] = offsetof(fr_value_box_t, datum.boolean),
- [FR_TYPE_UINT8] = offsetof(fr_value_box_t, datum.byte),
+ [FR_TYPE_UINT8] = offsetof(fr_value_box_t, datum.uint8),
[FR_TYPE_UINT16] = offsetof(fr_value_box_t, datum.uint16),
- [FR_TYPE_UINT32] = offsetof(fr_value_box_t, datum.integer),
+ [FR_TYPE_UINT32] = offsetof(fr_value_box_t, datum.uint32),
[FR_TYPE_UINT64] = offsetof(fr_value_box_t, datum.uint64),
[FR_TYPE_SIZE] = offsetof(fr_value_box_t, datum.size),
[FR_TYPE_INT32] = offsetof(fr_value_box_t, datum.int32),
[FR_TYPE_TIMEVAL] = offsetof(fr_value_box_t, datum.timeval),
- [FR_TYPE_FLOAT64] = offsetof(fr_value_box_t, datum.decimal),
+ [FR_TYPE_FLOAT64] = offsetof(fr_value_box_t, datum.float64),
[FR_TYPE_DATE] = offsetof(fr_value_box_t, datum.date),
case FR_TYPE_BOOL: /* this isn't a RADIUS type, and shouldn't really ever be used */
case FR_TYPE_UINT8:
- CHECK(byte);
+ CHECK(uint8);
break;
case FR_TYPE_UINT16:
break;
case FR_TYPE_UINT32:
- CHECK(integer);
+ CHECK(int32);
break;
case FR_TYPE_INT32:
break;
case FR_TYPE_FLOAT64:
- CHECK(decimal);
+ CHECK(float64);
break;
case FR_TYPE_ETHERNET:
*
* reserved, prefix-len, data...
*/
-static int fr_value_box_cidr_cmp_op(FR_TOKEN op, int bytes,
+static int fr_value_box_cidr_cmp_op(FR_TOKEN op, int uint8s,
uint8_t a_net, uint8_t const *a,
uint8_t b_net, uint8_t const *b)
{
if (a_net == b_net) {
int compare;
- compare = memcmp(a, b, bytes);
+ compare = memcmp(a, b, uint8s);
/*
* If they're identical return true for
}
/*
- * Do the check byte by byte. If the bytes are
+ * Do the check uint8 by uint8. If the uint8s are
* identical, it MAY be a match. If they're different,
* it is NOT a match.
*/
i = 0;
- while (i < bytes) {
+ while (i < uint8s) {
/*
- * All leading bytes are identical.
+ * All leading uint8s are identical.
*/
if (common == 0) return true;
* @param[in] inlen Length of input string.
* @param[in] quote Character around the string, determines unescaping mode.
*
- * @return >= 0 the number of bytes written to out.
+ * @return >= 0 the number of uint8s written to out.
*/
size_t value_str_unescape(uint8_t *out, char const *in, size_t inlen, char quote)
{
return out_p - out;
}
-/** Performs byte order reversal for types that need it
+/** Performs uint8 order reversal for types that need it
*
* @param[in] dst Where to write the result. May be the same as src.
- * @param[in] src #fr_value_box_t containing an integer value.
+ * @param[in] src #fr_value_box_t containing an uint32 value.
* @return
* - 0 on success.
* - -1 on failure.
{
if (!fr_cond_assert(src->type != FR_TYPE_INVALID)) return -1;
- /* 8 byte integers */
+ /* 8 uint8 uint32s */
switch (src->type) {
case FR_TYPE_UINT64:
dst->datum.uint64 = htonll(src->datum.uint64);
fr_value_box_copy_meta(dst, src);
break;
- /* 4 byte integers */
+ /* 4 uint8 uint32s */
case FR_TYPE_UINT32:
case FR_TYPE_DATE:
case FR_TYPE_INT32:
- dst->datum.integer = htonl(src->datum.integer);
+ dst->datum.uint32 = htonl(src->datum.uint32);
fr_value_box_copy_meta(dst, src);
break;
- /* 2 byte integers */
+ /* 2 uint8 uint32s */
case FR_TYPE_UINT16:
dst->datum.uint16 = htons(src->datum.uint16);
fr_value_box_copy_meta(dst, src);
break;
/*
- * <4 bytes address>
+ * <4 uint8s address>
*/
case FR_TYPE_IPV4_ADDR:
{
break;
/*
- * <1 byte prefix> + <4 bytes address>
+ * <1 uint8 prefix> + <4 uint8s address>
*/
case FR_TYPE_IPV4_PREFIX:
bin = talloc_array(ctx, uint8_t, sizeof(src->datum.ip.addr.v4.s_addr) + 1);
break;
/*
- * <16 bytes address>
+ * <16 uint8s address>
*/
case FR_TYPE_IPV6_ADDR:
bin = talloc_memdup(ctx, (uint8_t const *)src->datum.ip.addr.v6.s6_addr,
break;
/*
- * <1 byte prefix> + <1 byte scope> + <16 bytes address>
+ * <1 uint8 prefix> + <1 uint8 scope> + <16 uint8s address>
*/
case FR_TYPE_IPV6_PREFIX:
bin = talloc_array(ctx, uint8_t, sizeof(src->datum.ip.addr.v6.s6_addr) + 2);
* Get the raw binary in memory representation
*/
default:
- fr_value_box_hton(dst, src); /* Flip any integer representations */
+ fr_value_box_hton(dst, src); /* Flip any uint32 representations */
bin = talloc_memdup(ctx, ((uint8_t *)&dst->datum) + fr_value_box_offsets[src->type],
fr_value_box_field_sizes[src->type]);
break;
case FR_TYPE_OCTETS:
if (src->datum.length != sizeof(dst->datum.ip.addr.v4.s_addr)) {
- fr_strerror_printf("Invalid cast from %s to %s. Only %zu byte octet strings "
+ fr_strerror_printf("Invalid cast from %s to %s. Only %zu uint8 octet strings "
"may be cast to IP address types",
fr_int2str(dict_attr_types, src->type, "<INVALID>"),
fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
{
uint32_t net;
- net = ntohl(src->datum.integer);
+ net = ntohl(src->datum.uint32);
memcpy(&dst->datum.ip.addr.v4, (uint8_t *)&net, sizeof(dst->datum.ip.addr.v4.s_addr));
}
break;
break;
/*
- * Copy the last four bytes, to make an IPv4prefix
+ * Copy the last four uint8s, to make an IPv4prefix
*/
case FR_TYPE_IPV6_ADDR:
if (memcmp(src->datum.ip.addr.v6.s6_addr, v4_v6_map, sizeof(v4_v6_map)) != 0) {
case FR_TYPE_OCTETS:
if (src->datum.length != sizeof(dst->datum.ip.addr.v4.s_addr) + 1) {
- fr_strerror_printf("Invalid cast from %s to %s. Only %zu byte octet strings "
+ fr_strerror_printf("Invalid cast from %s to %s. Only %zu uint8 octet strings "
"may be cast to IP address types",
fr_int2str(dict_attr_types, src->type, "<INVALID>"),
fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
{
uint32_t net;
- net = ntohl(src->datum.integer);
+ net = ntohl(src->datum.uint32);
memcpy(&dst->datum.ip.addr.v4, (uint8_t *)&net, sizeof(dst->datum.ip.addr.v4.s_addr));
dst->datum.ip.prefix = 32;
}
case FR_TYPE_OCTETS:
if (src->datum.length != sizeof(dst->datum.ip.addr.v6.s6_addr)) {
- fr_strerror_printf("Invalid cast from %s to %s. Only %zu byte octet strings "
+ fr_strerror_printf("Invalid cast from %s to %s. Only %zu uint8 octet strings "
"may be cast to IP address types",
fr_int2str(dict_attr_types, src->type, "<INVALID>"),
fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
case FR_TYPE_OCTETS:
if (src->datum.length != (sizeof(dst->datum.ip.addr.v6.s6_addr) + 2)) {
- fr_strerror_printf("Invalid cast from %s to %s. Only %zu byte octet strings "
+ fr_strerror_printf("Invalid cast from %s to %s. Only %zu uint8 octet strings "
"may be cast to IP address types",
fr_int2str(dict_attr_types, src->type, "<INVALID>"),
fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
* @param ctx to allocate buffers in (usually the same as dst)
* @param dst Where to write result of casting.
* @param dst_type to cast to.
- * @param dst_enumv Enumerated values used to converts strings to integers.
+ * @param dst_enumv Enumerated values used to converts strings to uint32s.
* @param src Input data.
* @return
* - 0 on success.
if (dst_type == FR_TYPE_UINT16) {
switch (src->type) {
case FR_TYPE_UINT8:
- dst->datum.uint16 = src->datum.byte;
+ dst->datum.uint16 = src->datum.uint8;
break;
case FR_TYPE_OCTETS:
}
/*
- * We can cast LONG integers to SHORTER ones, so long
+ * We can cast LONG uint32s to SHORTER ones, so long
* as the long one is on the LHS.
*/
if (dst_type == FR_TYPE_UINT32) {
switch (src->type) {
case FR_TYPE_UINT8:
- dst->datum.integer = src->datum.byte;
+ dst->datum.uint32 = src->datum.uint8;
break;
case FR_TYPE_UINT16:
- dst->datum.integer = src->datum.uint16;
+ dst->datum.uint32 = src->datum.uint16;
break;
case FR_TYPE_INT32:
if (src->datum.int32 < 0 ) {
- fr_strerror_printf("Invalid cast: From signed to integer. "
+ fr_strerror_printf("Invalid cast: From signed to uint32. "
"signed value %d is negative ", src->datum.int32);
return -1;
}
- dst->datum.integer = (uint32_t)src->datum.int32;
+ dst->datum.uint32 = (uint32_t)src->datum.int32;
break;
case FR_TYPE_OCTETS:
}
/*
- * For integers, we allow the casting of a SMALL type to
+ * For uint32s, we allow the casting of a SMALL type to
* a larger type, but not vice-versa.
*/
if (dst_type == FR_TYPE_UINT64) {
switch (src->type) {
case FR_TYPE_UINT8:
- dst->datum.uint64 = src->datum.byte;
+ dst->datum.uint64 = src->datum.uint8;
break;
case FR_TYPE_UINT16:
break;
case FR_TYPE_UINT32:
- dst->datum.uint64 = src->datum.integer;
+ dst->datum.uint64 = src->datum.uint32;
break;
case FR_TYPE_DATE:
}
/*
- * We can cast integers less that < INT_MAX to signed
+ * We can cast uint32s less that < INT_MAX to signed
*/
if (dst_type == FR_TYPE_INT32) {
switch (src->type) {
case FR_TYPE_UINT8:
- dst->datum.int32 = src->datum.byte;
+ dst->datum.int32 = src->datum.uint8;
break;
case FR_TYPE_UINT16:
break;
case FR_TYPE_UINT32:
- if (src->datum.integer > INT_MAX) {
- fr_strerror_printf("Invalid cast: From integer to signed. integer value %u is larger "
- "than max signed int and would overflow", src->datum.integer);
+ if (src->datum.uint32 > INT_MAX) {
+ fr_strerror_printf("Invalid cast: From uint32 to signed. uint32 value %u is larger "
+ "than max signed int and would overflow", src->datum.uint32);
return -1;
}
- dst->datum.int32 = (int)src->datum.integer;
+ dst->datum.int32 = (int)src->datum.uint32;
break;
case FR_TYPE_UINT64:
- if (src->datum.integer > INT_MAX) {
+ if (src->datum.uint32 > INT_MAX) {
fr_strerror_printf("Invalid cast: From uint64 to signed. uint64 value %" PRIu64
" is larger than max signed int and would overflow", src->datum.uint64);
return -1;
if (dst_type == FR_TYPE_TIMEVAL) {
switch (src->type) {
case FR_TYPE_UINT8:
- dst->datum.timeval.tv_sec = src->datum.byte;
+ dst->datum.timeval.tv_sec = src->datum.uint8;
dst->datum.timeval.tv_usec = 0;
break;
break;
case FR_TYPE_UINT32:
- dst->datum.timeval.tv_sec = src->datum.integer;
+ dst->datum.timeval.tv_sec = src->datum.uint32;
dst->datum.timeval.tv_usec = 0;
break;
/*
* Copy the raw octets into the datum of a value_box
- * inverting bytesex for integers (if LE).
+ * inverting uint8sex for uint32s (if LE).
*/
memcpy(&tmp.datum, src->datum.octets, fr_value_box_field_sizes[dst_type]);
tmp.type = dst_type;
}
/*
- * Convert host order to network byte order.
+ * Convert host order to network uint8 order.
*/
if ((dst_type == FR_TYPE_IPV4_ADDR) &&
((src->type == FR_TYPE_UINT32) ||
dst->datum.ip.af = AF_INET;
dst->datum.ip.prefix = 32;
dst->datum.ip.scope_id = 0;
- dst->datum.ip.addr.v4.s_addr = htonl(src->datum.integer);
+ dst->datum.ip.addr.v4.s_addr = htonl(src->datum.uint32);
} else if ((src->type == FR_TYPE_IPV4_ADDR) &&
((dst_type == FR_TYPE_UINT32) ||
(dst_type == FR_TYPE_DATE) ||
(dst_type == FR_TYPE_INT32))) {
- dst->datum.integer = htonl(src->datum.ip.addr.v4.s_addr);
+ dst->datum.uint32 = htonl(src->datum.ip.addr.v4.s_addr);
- } else { /* they're of the same byte order */
+ } else { /* they're of the same uint8 order */
memcpy(&dst->datum, &src->datum, fr_value_box_field_sizes[src->type]);
}
char *str = NULL;
/*
- * Zero length strings still have a one byte buffer
+ * Zero length strings still have a one uint8 buffer
*/
str = talloc_bstrndup(ctx, src->datum.strvalue, src->datum.length);
if (!str) {
* @param[in] ctx to alloc strings in.
* @param[out] dst where to write parsed value.
* @param[in,out] dst_type of value data to create/dst_type of value created.
- * @param[in] dst_enumv fr_dict_attr_t with string aliases for integer values.
+ * @param[in] dst_enumv fr_dict_attr_t with string aliases for uint32 values.
* @param[in] in String to convert. Binary safe for variable length values
* if len is provided.
* @param[in] inlen may be < 0 in which case strlen(len) is used to determine
* Invalid.
*/
if ((len & 0x01) != 0) {
- fr_strerror_printf("Length of Hex String is not even, got %zu bytes", len);
+ fr_strerror_printf("Length of Hex String is not even, got %zu uint8s", len);
return -1;
}
unsigned int i;
/*
- * Note that ALL integers are unsigned!
+ * Note that ALL uint32s are unsigned!
*/
i = fr_strtoul(in, &p);
return -1;
}
- dst->datum.byte = dval->value;
+ dst->datum.uint8 = dval->value;
} else {
if (i > 255) {
fr_strerror_printf("Byte value \"%s\" is larger than 255", in);
return -1;
}
- dst->datum.byte = i;
+ dst->datum.uint8 = i;
}
break;
}
unsigned int i;
/*
- * Note that ALL integers are unsigned!
+ * Note that ALL uint32s are unsigned!
*/
i = fr_strtoul(in, &p);
/*
* If we have an enum, and the value isn't an
- * integer or hex string, try to parse it as a
+ * uint32 or hex string, try to parse it as a
* named value. Some VALUE names begin with
* numbers, so we have to be a bit flexible
* here.
return -1;
}
- dst->datum.integer = dval->value;
+ dst->datum.uint32 = dval->value;
} else {
unsigned long i;
* compatability.
*/
if (!*in || !isdigit((int) *in)) {
- dst->datum.integer = 0;
+ dst->datum.uint32 = 0;
break;
}
/*
* Value is always within the limits
*/
- dst->datum.integer = (uint32_t) i;
+ dst->datum.uint32 = (uint32_t) i;
}
}
break;
uint64_t i;
/*
- * Note that ALL integers are unsigned!
+ * Note that ALL uint32s are unsigned!
*/
if (sscanf(in, "%" PRIu64, &i) != 1) {
- fr_strerror_printf("Failed parsing \"%s\" as unsigned 64bit integer", in);
+ fr_strerror_printf("Failed parsing \"%s\" as unsigned 64bit uint32", in);
return -1;
}
dst->datum.uint64 = i;
double d;
if (sscanf(in, "%lf", &d) != 1) {
- fr_strerror_printf("Failed parsing \"%s\" as a decimal", in);
+ fr_strerror_printf("Failed parsing \"%s\" as a float64", in);
return -1;
}
- dst->datum.decimal = d;
+ dst->datum.float64 = d;
}
break;
size_t p_len = 0;
/*
- * Convert things which are obviously integers to Ethernet addresses
+ * Convert things which are obviously uint32s to Ethernet addresses
*
* We assume the number is the bigendian representation of the
* ethernet address.
*/
if (is_integer(in)) {
- uint64_t integer = htonll(atoll(in));
+ uint64_t uint32 = htonll(atoll(in));
- memcpy(dst->datum.ether, &integer, sizeof(dst->datum.ether));
+ memcpy(dst->datum.ether, &uint32, sizeof(dst->datum.ether));
break;
}
fr_value_box_cast(ctx, &tmp, FR_TYPE_UINT32, NULL, data);
- dv = fr_dict_enum_by_da(NULL, data->datum.enumv, tmp.datum.integer);
+ dv = fr_dict_enum_by_da(NULL, data->datum.enumv, tmp.datum.uint32);
if (dv) return talloc_typed_strdup(ctx, dv->name);
}
break;
case FR_TYPE_BOOL:
- p = talloc_typed_strdup(ctx, data->datum.byte ? "yes" : "no");
+ p = talloc_typed_strdup(ctx, data->datum.uint8 ? "yes" : "no");
break;
case FR_TYPE_UINT8:
- p = talloc_typed_asprintf(ctx, "%u", data->datum.byte);
+ p = talloc_typed_asprintf(ctx, "%u", data->datum.uint8);
break;
case FR_TYPE_UINT16:
break;
case FR_TYPE_UINT32:
- p = talloc_typed_asprintf(ctx, "%u", data->datum.integer);
+ p = talloc_typed_asprintf(ctx, "%u", data->datum.uint32);
break;
case FR_TYPE_UINT64:
break;
case FR_TYPE_FLOAT64:
- p = talloc_typed_asprintf(ctx, "%g", data->datum.decimal);
+ p = talloc_typed_asprintf(ctx, "%g", data->datum.float64);
break;
case FR_TYPE_DATE:
* @param data to print.
* @param quote char to escape in string output.
* @return
- * - The number of bytes written to the out buffer.
+ * - The number of uint8s written to the out buffer.
* - A number >= outlen if truncation has occurred.
*/
size_t fr_value_box_snprint(char *out, size_t outlen, fr_value_box_t const *data, char quote)
fr_value_box_cast(NULL, &tmp, FR_TYPE_UINT32, NULL, data);
- dv = fr_dict_enum_by_da(NULL, data->datum.enumv, tmp.datum.integer);
+ dv = fr_dict_enum_by_da(NULL, data->datum.enumv, tmp.datum.uint32);
if (dv) return strlcpy(out, dv->name, outlen);
}
return fr_snprint(out, outlen, data->datum.strvalue, data->datum.length, quote);
case FR_TYPE_UINT8:
- return snprintf(out, outlen, "%u", data->datum.byte);
+ return snprintf(out, outlen, "%u", data->datum.uint8);
case FR_TYPE_UINT16:
return snprintf(out, outlen, "%u", data->datum.uint16);
case FR_TYPE_UINT32:
- return snprintf(out, outlen, "%u", data->datum.integer);
+ return snprintf(out, outlen, "%u", data->datum.uint32);
case FR_TYPE_UINT64:
return snprintf(out, outlen, "%" PRIu64, data->datum.uint64);
{
size_t max;
- /* Return the number of bytes we would have written */
+ /* Return the number of uint8s we would have written */
len = (data->datum.length * 2) + 2;
if (freespace <= 1) {
return len;
return len;
}
- /* Get maximum number of bytes we can encode given freespace */
+ /* Get maximum number of uint8s we can encode given freespace */
max = ((freespace % 2) ? freespace - 1 : freespace - 2) / 2;
fr_bin2hex(out, data->datum.octets,
((size_t)data->datum.length > max) ? max : (size_t)data->datum.length);
data->datum.ether[4], data->datum.ether[5]);
case FR_TYPE_FLOAT64:
- return snprintf(out, outlen, "%g", data->datum.decimal);
+ return snprintf(out, outlen, "%g", data->datum.float64);
/*
* Don't add default here
if (a) strlcpy(out, a, outlen);
- return len; /* Return the number of bytes we would of written (for truncation detection) */
+ return len; /* Return the number of uint8s we would of written (for truncation detection) */
}
*/
vp = fr_pair_find_by_num(request->control, 0, PW_ACCT_TYPE, TAG_ANY);
if (vp) {
- acct_type = vp->vp_integer;
+ acct_type = vp->vp_uint32;
DEBUG2(" Found Acct-Type %s",
fr_dict_enum_name_by_da(NULL, vp->da, acct_type));
}
}
if ((pair = fr_pair_find_by_num(request->packet->vps, 0, PW_NAS_PORT, TAG_ANY)) != NULL) {
- port = pair->vp_integer;
+ port = pair->vp_uint32;
}
if (request->packet->dst_port == 0) {
if (auth_type) {
snprintf(clean_password, sizeof(clean_password),
"<via Auth-Type = %s>",
- fr_dict_enum_name_by_da(NULL, auth_type->da, auth_type->vp_integer));
+ fr_dict_enum_name_by_da(NULL, auth_type->da, auth_type->vp_uint32));
} else {
strcpy(clean_password, "<no User-Password attribute>");
}
*/
fr_pair_cursor_init(&cursor, &request->control);
while ((auth_type_pair = fr_pair_cursor_next_by_num(&cursor, 0, PW_AUTH_TYPE, TAG_ANY))) {
- auth_type = auth_type_pair->vp_integer;
+ auth_type = auth_type_pair->vp_uint32;
auth_type_count++;
RDEBUG2("Using 'Auth-Type = %s' for authenticate {...}", fr_dict_enum_name_by_da(NULL, auth_type_pair->da, auth_type));
*/
vp = fr_pair_find_by_num(request->control, 0, PW_POST_AUTH_TYPE, TAG_ANY);
if (vp) {
- postauth_type = vp->vp_integer;
+ postauth_type = vp->vp_uint32;
RDEBUG2("Using Post-Auth-Type %s",
fr_dict_enum_name_by_da(NULL, vp->da, postauth_type));
}
tmp = radius_pair_create(request,
&request->control,
PW_AUTH_TYPE, 0);
- if (tmp) tmp->vp_integer = PW_AUTH_TYPE_ACCEPT;
+ if (tmp) tmp->vp_uint32 = PW_AUTH_TYPE_ACCEPT;
rcode = RLM_MODULE_OK;
goto authenticate;
if (!autz_retry) {
tmp = fr_pair_find_by_num(request->control, 0, PW_AUTZ_TYPE, TAG_ANY);
if (tmp) {
- autz_type = tmp->vp_integer;
+ autz_type = tmp->vp_uint32;
RDEBUG2("Using Autz-Type %s",
fr_dict_enum_name_by_da(NULL, tmp->da, autz_type));
autz_retry = 1;
tmp = fr_pair_find_by_num(request->control, 0, PW_SESSION_TYPE, TAG_ANY);
if (tmp) {
- session_type = tmp->vp_integer;
+ session_type = tmp->vp_uint32;
RDEBUG2("Using Session-Type %s",
fr_dict_enum_name_by_da(NULL, tmp->da, session_type));
}
* for the Simultaneous-Use parameter.
*/
if (request->username &&
- (r = process_checksimul(session_type, request, check_item->vp_integer)) != 0) {
+ (r = process_checksimul(session_type, request, check_item->vp_uint32)) != 0) {
char mpp_ok = 0;
if (r == 2){
if ((port_limit = fr_pair_find_by_num(request->reply->vps, 0, PW_PORT_LIMIT,
TAG_ANY)) != NULL &&
- port_limit->vp_integer > check_item->vp_integer){
+ port_limit->vp_uint32 > check_item->vp_uint32){
RDEBUG2("MPP is OK");
mpp_ok = 1;
}
}
if (!mpp_ok){
- if (check_item->vp_integer > 1) {
+ if (check_item->vp_uint32 > 1) {
snprintf(umsg, sizeof(umsg), "%s (%u)", main_config.denied_msg,
- check_item->vp_integer);
+ check_item->vp_uint32);
} else {
strlcpy(umsg, main_config.denied_msg, sizeof(umsg));
}
pair_make_reply("Reply-Message", umsg, T_OP_SET);
snprintf(logstr, sizeof(logstr), "Multiple logins (max %d) %s",
- check_item->vp_integer,
+ check_item->vp_uint32,
r == 2 ? "[MPP attempt]" : "");
rad_authlog(logstr, request, 1);
CONF_PARSER const *parse;
pi = (int *) ((bool *) ((char *) c + dynamic_config[i].offset));
- *pi = vp->vp_integer;
+ *pi = vp->vp_uint32;
/*
* Same nastiness as above.
*/
vp = fr_pair_find_by_num(request->packet->vps, 0, PW_SERVICE_TYPE, TAG_ANY);
if (request->packet->code == PW_CODE_COA_REQUEST) {
- if (vp && (vp->vp_integer == PW_AUTHORIZE_ONLY)) {
+ if (vp && (vp->vp_uint32 == PW_AUTHORIZE_ONLY)) {
vp = fr_pair_find_by_num(request->packet->vps, 0, PW_STATE, TAG_ANY);
if (!vp || (vp->vp_length == 0)) {
REDEBUG("CoA-Request with Service-Type = Authorize-Only MUST "
break;
case FR_TYPE_UINT8:
- ret = vp->vp_byte - check->vp_byte;
+ ret = vp->vp_uint8 - check->vp_uint8;
break;
case FR_TYPE_UINT16:
ret = vp->vp_short - check->vp_short;
break;
case FR_TYPE_UINT32:
- ret = vp->vp_integer - check->vp_integer;
+ ret = vp->vp_uint32 - check->vp_uint32;
break;
case FR_TYPE_UINT64:
*/
vp = fr_pair_find_by_num(request->control, 0, PW_RESPONSE_PACKET_TYPE, TAG_ANY);
if (vp) {
- if (vp->vp_integer == 256) {
+ if (vp->vp_uint32 == 256) {
RDEBUG2("Not responding to request");
request->reply->code = 0;
} else {
- request->reply->code = vp->vp_integer;
+ request->reply->code = vp->vp_uint32;
}
}
/*
else if (request->packet->code == PW_CODE_ACCESS_REQUEST) {
if (request->reply->code == 0) {
vp = fr_pair_find_by_num(request->control, 0, PW_AUTH_TYPE, TAG_ANY);
- if (!vp || (vp->vp_integer != 5)) {
+ if (!vp || (vp->vp_uint32 != 5)) {
RDEBUG2("There was no response configured: "
"rejecting request");
}
vp = fr_pair_find_by_num(request->reply->vps, 0, PW_FREERADIUS_RESPONSE_DELAY, TAG_ANY);
if (vp) {
- if (vp->vp_integer <= 10) {
- request->response_delay.tv_sec = vp->vp_integer;
+ if (vp->vp_uint32 <= 10) {
+ request->response_delay.tv_sec = vp->vp_uint32;
} else {
request->response_delay.tv_sec = 10;
}
} else {
vp = fr_pair_find_by_num(request->reply->vps, 0, PW_FREERADIUS_RESPONSE_DELAY_USEC, TAG_ANY);
if (vp) {
- if (vp->vp_integer <= 10 * USEC) {
- request->response_delay.tv_sec = vp->vp_integer / USEC;
- request->response_delay.tv_usec = vp->vp_integer % USEC;
+ if (vp->vp_uint32 <= 10 * USEC) {
+ request->response_delay.tv_sec = vp->vp_uint32 / USEC;
+ request->response_delay.tv_usec = vp->vp_uint32 % USEC;
} else {
request->response_delay.tv_sec = 10;
request->response_delay.tv_usec = 0;
if (dval) {
vp = radius_pair_create(request, &request->control, PW_POST_PROXY_TYPE, 0);
- vp->vp_integer = dval->value;
+ vp->vp_uint32 = dval->value;
}
break;
}
}
- if (vp) RDEBUG2("Found Post-Proxy-Type %s", fr_dict_enum_name_by_da(NULL, vp->da, vp->vp_integer));
+ if (vp) RDEBUG2("Found Post-Proxy-Type %s", fr_dict_enum_name_by_da(NULL, vp->da, vp->vp_uint32));
/*
* Remove it from the proxy hash, if there's no reply, or
RDEBUG2("server %s {", request->server);
RINDENT();
- rcode = process_post_proxy(vp ? vp->vp_integer : 0, request);
+ rcode = process_post_proxy(vp ? vp->vp_uint32 : 0, request);
REXDENT();
RDEBUG2("}");
request->server = old_server;
} else {
- rcode = process_post_proxy(vp ? vp->vp_integer : 0, request);
+ rcode = process_post_proxy(vp ? vp->vp_uint32 : 0, request);
}
switch (rcode) {
vp = fr_pair_find_by_num(request->control, 0, PW_POST_PROXY_TYPE, TAG_ANY);
if (!vp) vp = radius_pair_create(request, &request->control,
PW_POST_PROXY_TYPE, 0);
- vp->vp_integer = dval->value;
+ vp->vp_uint32 = dval->value;
return 1;
}
* one.
*/
vp = fr_pair_find_by_num(request->control, 0, PW_RESPONSE_PACKET_TYPE, TAG_ANY);
- if (vp && (vp->vp_integer != 256)) {
+ if (vp && (vp->vp_uint32 != 256)) {
request->proxy->reply = fr_radius_alloc_reply(request, request->proxy->packet);
- request->proxy->reply->code = vp->vp_integer;
+ request->proxy->reply->code = vp->vp_uint32;
fr_pair_delete_by_num(&request->control, 0, PW_RESPONSE_PACKET_TYPE, TAG_ANY);
}
}
} else {
- dst_port = vp->vp_integer;
+ dst_port = vp->vp_uint32;
}
/*
*/
vp = fr_pair_find_by_num(request->control, 0, PW_PRE_PROXY_TYPE, TAG_ANY);
if (vp) {
- fr_dict_enum_t const *dval = fr_dict_enum_by_da(NULL, vp->da, vp->vp_integer);
+ fr_dict_enum_t const *dval = fr_dict_enum_by_da(NULL, vp->da, vp->vp_uint32);
/* Must be a validation issue */
rad_assert(dval);
RDEBUG2("Found Pre-Proxy-Type %s", dval->name);
- pre_proxy_type = vp->vp_integer;
+ pre_proxy_type = vp->vp_uint32;
}
/*
struct timeval now;
gettimeofday(&now, NULL);
- vp->vp_integer += now.tv_sec - request->proxy->packet->timestamp.tv_sec;
+ vp->vp_uint32 += now.tv_sec - request->proxy->packet->timestamp.tv_sec;
}
}
#endif
}
if (vp) {
- if (vp->vp_integer == 0) {
+ if (vp->vp_uint32 == 0) {
fail:
TALLOC_FREE(request->coa);
return;
char buffer[INET6_ADDRSTRLEN];
vp = fr_pair_find_by_num(coa->proxy->packet->vps, 0, PW_PACKET_DST_PORT, TAG_ANY);
- if (vp) port = vp->vp_integer;
+ if (vp) port = vp->vp_uint32;
coa->home_server = home_server_find(&ipaddr, port, IPPROTO_UDP);
if (!coa->home_server) {
vp = fr_pair_find_by_num(coa->proxy->packet->vps, 0, PW_PACKET_TYPE, TAG_ANY);
if (vp) {
- switch (vp->vp_integer) {
+ switch (vp->vp_uint32) {
case PW_CODE_COA_REQUEST:
case PW_CODE_DISCONNECT_REQUEST:
- coa->proxy->packet->code = vp->vp_integer;
+ coa->proxy->packet->code = vp->vp_uint32;
break;
default:
DEBUG("Cannot set CoA Packet-Type to code %d",
- vp->vp_integer);
+ vp->vp_uint32);
goto fail;
}
}
*/
vp = fr_pair_find_by_num(request->control, 0, PW_PRE_PROXY_TYPE, TAG_ANY);
if (vp) {
- fr_dict_enum_t const *dval = fr_dict_enum_by_da(NULL, vp->da, vp->vp_integer);
+ fr_dict_enum_t const *dval = fr_dict_enum_by_da(NULL, vp->da, vp->vp_uint32);
/* Must be a validation issue */
rad_assert(dval);
RDEBUG2("Found Pre-Proxy-Type %s", dval->name);
- pre_proxy_type = vp->vp_integer;
+ pre_proxy_type = vp->vp_uint32;
}
if (coa->home_pool && coa->home_pool->virtual_server) {
case PW_RESPONSE_PACKET_TYPE:
case PW_PACKET_TYPE:
fr_pair_cursor_remove(&cursor); /* so we don't break the filter */
- request->filter_code = vp->vp_integer;
+ request->filter_code = vp->vp_uint32;
talloc_free(vp);
default:
* the attributes read from the file.
*/
case PW_PACKET_TYPE:
- request->packet->code = vp->vp_integer;
+ request->packet->code = vp->vp_uint32;
break;
case PW_RESPONSE_PACKET_TYPE:
- request->filter_code = vp->vp_integer;
+ request->filter_code = vp->vp_uint32;
break;
case PW_PACKET_DST_PORT:
- request->packet->dst_port = (vp->vp_integer & 0xffff);
+ request->packet->dst_port = (vp->vp_uint32 & 0xffff);
break;
case PW_PACKET_DST_IP_ADDRESS:
break;
case PW_PACKET_SRC_PORT:
- if ((vp->vp_integer < 1024) ||
- (vp->vp_integer > 65535)) {
- ERROR("Invalid value '%u' for Packet-Src-Port", vp->vp_integer);
+ if ((vp->vp_uint32 < 1024) ||
+ (vp->vp_uint32 > 65535)) {
+ ERROR("Invalid value '%u' for Packet-Src-Port", vp->vp_uint32);
goto error;
}
- request->packet->src_port = (vp->vp_integer & 0xffff);
+ request->packet->src_port = (vp->vp_uint32 & 0xffff);
break;
case PW_PACKET_SRC_IP_ADDRESS:
type = fr_pair_cursor_next_by_num(&cursor, 0, PW_PACKET_TYPE, TAG_ANY);
if (type) {
fr_pair_cursor_remove(&cursor);
- conf->filter_request_code = type->vp_integer;
+ conf->filter_request_code = type->vp_uint32;
talloc_free(type);
}
}
type = fr_pair_cursor_next_by_num(&cursor, 0, PW_PACKET_TYPE, TAG_ANY);
if (type) {
fr_pair_cursor_remove(&cursor);
- conf->filter_response_code = type->vp_integer;
+ conf->filter_response_code = type->vp_uint32;
talloc_free(type);
}
}
* the index number should be available in attr.
*/
vp = fr_pair_afrom_da(ctx, index_attr);
- vp->vp_integer = attr;
+ vp->vp_uint32 = attr;
fr_pair_cursor_append(cursor, vp);
}
}
vp = fr_pair_afrom_da(ctx, conf->snmp_type);
- vp->vp_integer = type;
+ vp->vp_uint32 = type;
fr_pair_cursor_append(cursor, vp);
* Add the value of the index attribute as the next
* OID component.
*/
- len = snprintf(p, end - p, ".%i.", vp->vp_integer);
+ len = snprintf(p, end - p, ".%i.", vp->vp_uint32);
if (is_truncated(len, end - p)) goto oob;
p += len;
ERROR("Failed allocating SNMP operation attribute");
return EXIT_FAILURE;
}
- vp->vp_integer = (unsigned int)command; /* Commands must match dictionary */
+ vp->vp_uint32 = (unsigned int)command; /* Commands must match dictionary */
fr_pair_cursor_append(&cursor, vp);
/*
fr_pair_add(&(stopreq->packet->vps), vp); \
} while(0)
-#define INTPAIR(n,v) PAIR(n,v,vp_integer)
+#define INTPAIR(n,v) PAIR(n,v,vp_uint32)
#define IPPAIR(n,v) PAIR(n,v,vp_ipv4addr)
gettimeofday(&now, NULL);
fr_timeval_subtract(&diff, &now, &uptime);
- out->datum.integer = diff.tv_sec * 100;
- out->datum.integer += diff.tv_usec / 10000;
+ out->datum.uint32 = diff.tv_sec * 100;
+ out->datum.uint32 += diff.tv_usec / 10000;
return 0;
}
gettimeofday(&now, NULL);
fr_timeval_subtract(&diff, &now, &reset_time);
- out->datum.integer = diff.tv_sec * 100;
- out->datum.integer += diff.tv_usec / 10000;
+ out->datum.uint32 = diff.tv_sec * 100;
+ out->datum.uint32 += diff.tv_usec / 10000;
return 0;
}
{
rad_assert(map->da->type == FR_TYPE_UINT32);
- out->datum.integer = reset_state;
+ out->datum.uint32 = reset_state;
return 0;
}
{
rad_assert(map->da->type == FR_TYPE_UINT32);
- switch (in->datum.integer) {
+ switch (in->datum.uint32) {
case PW_RADIUS_AUTH_SERV_CONFIG_RESET_VALUE_RESET:
radius_signal_self(RADIUS_SIGNAL_SELF_HUP);
gettimeofday(&reset_time, NULL);
{
rad_assert(map->da->type == FR_TYPE_UINT32);
- out->datum.integer = *(uint32_t *)((uint8_t *)(&radius_auth_stats) + map->offset);
+ out->datum.uint32 = *(uint32_t *)((uint8_t *)(&radius_auth_stats) + map->offset);
return 0;
}
rad_assert(client);
- out->datum.integer = client->number + 1; /* Clients indexed from 0 */
+ out->datum.uint32 = client->number + 1; /* Clients indexed from 0 */
return 0;
}
rad_assert(client);
rad_assert(map->da->type == FR_TYPE_UINT32);
- out->datum.integer = *(uint32_t *)((uint8_t *)(&client->auth) + map->offset);
+ out->datum.uint32 = *(uint32_t *)((uint8_t *)(&client->auth) + map->offset);
return 0;
}
}
vp = fr_pair_afrom_da(request->reply, da);
- vp->vp_integer = i;
+ vp->vp_uint32 = i;
fr_pair_cursor_prepend(out, vp);
return 0; /* done */
* Get the index from the index attribute's value.
*/
vp = fr_pair_cursor_current(cursor);
- index_num = vp->vp_integer;
+ index_num = vp->vp_uint32;
/*
* Advance the cursor to the next index attribute
fr_pair_cursor_append(out, vp);
vp = fr_pair_afrom_da(request->reply, fr_snmp_type);
- vp->vp_integer = map_p->type;
+ vp->vp_uint32 = map_p->type;
fr_pair_cursor_append(out, vp);
}
return 0;
if (!map_p->set || (map_p->type == PW_FREERADIUS_SNMP_TYPE_OBJECT)) {
vp = fr_pair_afrom_da(request->reply, fr_snmp_failure);
- vp->vp_integer = PW_FREERADIUS_SNMP_FAILURE_VALUE_NOT_WRITABLE;
+ vp->vp_uint32 = PW_FREERADIUS_SNMP_FAILURE_VALUE_NOT_WRITABLE;
fr_pair_cursor_append(out, vp);
return 0;
}
case PW_FREERADIUS_SNMP_FAILURE_VALUE_WRONG_VALUE:
case PW_FREERADIUS_SNMP_FAILURE_VALUE_INCONSISTENT_VALUE:
vp = fr_pair_afrom_da(request->reply, fr_snmp_failure);
- vp->vp_integer = -(ret);
+ vp->vp_uint32 = -(ret);
fr_pair_cursor_append(out, vp);
break;
return -1;
}
- switch (op->vp_integer) {
+ switch (op->vp_uint32) {
case PW_FREERADIUS_SNMP_OPERATION_VALUE_PING:
case PW_FREERADIUS_SNMP_OPERATION_VALUE_GET:
case PW_FREERADIUS_SNMP_OPERATION_VALUE_GETNEXT:
break;
default:
- ERROR("Invalid operation %u", vp->vp_integer);
+ ERROR("Invalid operation %u", vp->vp_uint32);
return -1;
}
* Returns depth (as negative integer) at which the error occurred
*/
ret = snmp_process(&out_cursor, request, tlv_stack, depth,
- &request_cursor, snmp_iso, NULL, op->vp_integer);
+ &request_cursor, snmp_iso, NULL, op->vp_uint32);
if (ret < 0) {
fr_pair_list_free(&head);
vp = pair_make_request("SoH-MS-Machine-OS-version", NULL, T_OP_EQ);
if (!vp) return 0;
- vp->vp_integer = soh_pull_be_32(p); p+=4;
+ vp->vp_uint32 = soh_pull_be_32(p); p+=4;
vp = pair_make_request("SoH-MS-Machine-OS-release", NULL, T_OP_EQ);
if (!vp) return 0;
- vp->vp_integer = soh_pull_be_32(p); p+=4;
+ vp->vp_uint32 = soh_pull_be_32(p); p+=4;
vp = pair_make_request("SoH-MS-Machine-OS-build", NULL, T_OP_EQ);
if (!vp) return 0;
- vp->vp_integer = soh_pull_be_32(p); p+=4;
+ vp->vp_uint32 = soh_pull_be_32(p); p+=4;
vp = pair_make_request("SoH-MS-Machine-SP-version", NULL, T_OP_EQ);
if (!vp) return 0;
- vp->vp_integer = soh_pull_be_16(p); p+=2;
+ vp->vp_uint32 = soh_pull_be_16(p); p+=2;
vp = pair_make_request("SoH-MS-Machine-SP-release", NULL, T_OP_EQ);
if (!vp) return 0;
- vp->vp_integer = soh_pull_be_16(p); p+=2;
+ vp->vp_uint32 = soh_pull_be_16(p); p+=2;
vp = pair_make_request("SoH-MS-Machine-Processor", NULL, T_OP_EQ);
if (!vp) return 0;
- vp->vp_integer = soh_pull_be_16(p); p+=2;
+ vp->vp_uint32 = soh_pull_be_16(p); p+=2;
break;
case 2:
vp = pair_make_request("SoH-MS-Machine-Role", NULL, T_OP_EQ);
if (!vp) return 0;
- vp->vp_integer = *p;
+ vp->vp_uint32 = *p;
p++;
data_len -= 5;
break;
if (!vp) continue;
counter = *(fr_uint_t *) (((uint8_t *) stats) + table[i].offset);
- vp->vp_integer = counter;
+ vp->vp_uint32 = counter;
}
}
rad_assert(request->listener->type == RAD_LISTEN_NONE);
flag = fr_pair_find_by_num(request->packet->vps, VENDORPEC_FREERADIUS, PW_FREERADIUS_STATISTICS_TYPE, TAG_ANY);
- if (!flag || (flag->vp_integer == 0)) return;
+ if (!flag || (flag->vp_uint32 == 0)) return;
/*
* Authentication.
*/
- if (((flag->vp_integer & 0x01) != 0) &&
- ((flag->vp_integer & 0xc0) == 0)) {
+ if (((flag->vp_uint32 & 0x01) != 0) &&
+ ((flag->vp_uint32 & 0xc0) == 0)) {
request_stats_addvp(request, authvp, &radius_auth_stats);
}
/*
* Accounting
*/
- if (((flag->vp_integer & 0x02) != 0) &&
- ((flag->vp_integer & 0xc0) == 0)) {
+ if (((flag->vp_uint32 & 0x02) != 0) &&
+ ((flag->vp_uint32 & 0xc0) == 0)) {
request_stats_addvp(request, acctvp, &radius_acct_stats);
}
#endif
/*
* Proxied authentication requests.
*/
- if (((flag->vp_integer & 0x04) != 0) &&
- ((flag->vp_integer & 0x20) == 0)) {
+ if (((flag->vp_uint32 & 0x04) != 0) &&
+ ((flag->vp_uint32 & 0x20) == 0)) {
request_stats_addvp(request, proxy_authvp, &proxy_auth_stats);
}
/*
* Proxied accounting requests.
*/
- if (((flag->vp_integer & 0x08) != 0) &&
- ((flag->vp_integer & 0x20) == 0)) {
+ if (((flag->vp_uint32 & 0x08) != 0) &&
+ ((flag->vp_uint32 & 0x20) == 0)) {
request_stats_addvp(request, proxy_acctvp, &proxy_acct_stats);
}
#endif
/*
* Internal server statistics
*/
- if ((flag->vp_integer & 0x10) != 0) {
+ if ((flag->vp_uint32 & 0x10) != 0) {
vp = radius_pair_create(request->reply, &request->reply->vps,
PW_FREERADIUS_STATS_START_TIME, VENDORPEC_FREERADIUS);
if (vp) vp->vp_date = start_time.tv_sec;
/*
* For a particular client.
*/
- if ((flag->vp_integer & 0x20) != 0) {
+ if ((flag->vp_uint32 & 0x20) != 0) {
fr_ipaddr_t ipaddr;
VALUE_PAIR *server_ip, *server_port = NULL;
RADCLIENT *client = NULL;
if (server_port) {
ipaddr.af = AF_INET;
ipaddr.addr.v4.s_addr = server_ip->vp_ipv4addr;
- cl = listener_find_client_list(&ipaddr, server_port->vp_integer, IPPROTO_UDP);
+ cl = listener_find_client_list(&ipaddr, server_port->vp_uint32, IPPROTO_UDP);
/*
* Not found: don't do anything
*/
} else if ((vp = fr_pair_find_by_num(request->packet->vps, VENDORPEC_FREERADIUS,
PW_FREERADIUS_STATS_CLIENT_NUMBER, TAG_ANY)) != NULL) {
- client = client_findbynumber(cl, vp->vp_integer);
+ client = client_findbynumber(cl, vp->vp_uint32);
}
if (client) {
&request->reply->vps,
PW_FREERADIUS_STATS_CLIENT_NETMASK, VENDORPEC_FREERADIUS);
if (vp) {
- vp->vp_integer = client->ipaddr.prefix;
+ vp->vp_uint32 = client->ipaddr.prefix;
}
}
}
fr_pair_copy(request->reply, server_port));
}
- if ((flag->vp_integer & 0x01) != 0) {
+ if ((flag->vp_uint32 & 0x01) != 0) {
request_stats_addvp(request, client_authvp,
&client->auth);
}
#ifdef WITH_ACCOUNTING
- if ((flag->vp_integer & 0x02) != 0) {
+ if ((flag->vp_uint32 & 0x02) != 0) {
request_stats_addvp(request, client_acctvp,
&client->acct);
}
/*
* For a particular "listen" socket.
*/
- if (((flag->vp_integer & 0x40) != 0) &&
- ((flag->vp_integer & 0x03) != 0)) {
+ if (((flag->vp_uint32 & 0x40) != 0) &&
+ ((flag->vp_uint32 & 0x03) != 0)) {
rad_listen_t *this;
VALUE_PAIR *server_ip, *server_port;
fr_ipaddr_t ipaddr;
ipaddr.af = AF_INET;
ipaddr.addr.v4.s_addr = server_ip->vp_ipv4addr;
this = listener_find_byipaddr(&ipaddr,
- server_port->vp_integer,
+ server_port->vp_uint32,
IPPROTO_UDP);
/*
fr_pair_add(&request->reply->vps,
fr_pair_copy(request->reply, server_port));
- if (((flag->vp_integer & 0x01) != 0) &&
+ if (((flag->vp_uint32 & 0x01) != 0) &&
((request->listener->type == RAD_LISTEN_AUTH) ||
(request->listener->type == RAD_LISTEN_NONE))) {
request_stats_addvp(request, authvp, &this->stats);
}
#ifdef WITH_ACCOUNTING
- if (((flag->vp_integer & 0x02) != 0) &&
+ if (((flag->vp_uint32 & 0x02) != 0) &&
((request->listener->type == RAD_LISTEN_ACCT) ||
(request->listener->type == RAD_LISTEN_NONE))) {
request_stats_addvp(request, acctvp, &this->stats);
/*
* Home servers.
*/
- if (((flag->vp_integer & 0x80) != 0) &&
- ((flag->vp_integer & 0x03) != 0)) {
+ if (((flag->vp_uint32 & 0x80) != 0) &&
+ ((flag->vp_uint32 & 0x03) != 0)) {
home_server_t *home;
VALUE_PAIR *server_ip, *server_port;
fr_ipaddr_t ipaddr;
#endif
ipaddr.af = AF_INET;
ipaddr.addr.v4.s_addr = server_ip->vp_ipv4addr;
- home = home_server_find(&ipaddr, server_port->vp_integer,
+ home = home_server_find(&ipaddr, server_port->vp_uint32,
IPPROTO_UDP);
/*
vp = radius_pair_create(request->reply, &request->reply->vps,
PW_FREERADIUS_STATS_SERVER_OUTSTANDING_REQUESTS, VENDORPEC_FREERADIUS);
- if (vp) vp->vp_integer = home->currently_outstanding;
+ if (vp) vp->vp_uint32 = home->currently_outstanding;
vp = radius_pair_create(request->reply, &request->reply->vps,
PW_FREERADIUS_STATS_SERVER_STATE, VENDORPEC_FREERADIUS);
- if (vp) vp->vp_integer = home->state;
+ if (vp) vp->vp_uint32 = home->state;
if ((home->state == HOME_STATE_ALIVE) &&
(home->revive_time.tv_sec != 0)) {
vp = radius_pair_create(request->reply,
&request->reply->vps,
PW_FREERADIUS_SERVER_EMA_WINDOW, VENDORPEC_FREERADIUS);
- if (vp) vp->vp_integer = home->ema.window;
+ if (vp) vp->vp_uint32 = home->ema.window;
vp = radius_pair_create(request->reply,
&request->reply->vps,
PW_FREERADIUS_SERVER_EMA_USEC_WINDOW_1, VENDORPEC_FREERADIUS);
- if (vp) vp->vp_integer = home->ema.ema1 / EMA_SCALE;
+ if (vp) vp->vp_uint32 = home->ema.ema1 / EMA_SCALE;
vp = radius_pair_create(request->reply,
&request->reply->vps,
PW_FREERADIUS_SERVER_EMA_USEC_WINDOW_10, VENDORPEC_FREERADIUS);
- if (vp) vp->vp_integer = home->ema.ema10 / EMA_SCALE;
+ if (vp) vp->vp_uint32 = home->ema.ema10 / EMA_SCALE;
}
PW_FREERADIUS_STATS_LAST_PACKET_SENT, VENDORPEC_FREERADIUS);
if (vp) vp->vp_date = home->last_packet_sent;
- if (((flag->vp_integer & 0x01) != 0) &&
+ if (((flag->vp_uint32 & 0x01) != 0) &&
(home->type == HOME_TYPE_AUTH)) {
request_stats_addvp(request, proxy_authvp,
&home->stats);
}
#ifdef WITH_ACCOUNTING
- if (((flag->vp_integer & 0x02) != 0) &&
+ if (((flag->vp_uint32 & 0x02) != 0) &&
(home->type == HOME_TYPE_ACCT)) {
request_stats_addvp(request, proxy_acctvp,
&home->stats);
vp = fr_pair_afrom_num(request, 0, PW_TLS_CACHE_ACTION);
if (!vp) return -1;
- vp->vp_integer = action;
+ vp->vp_uint32 = action;
fr_pair_add(&request->control, vp);
RINDENT();
rdebug_pair(L_DBG_LVL_2, request, vp, "&control:");
vp = fr_pair_afrom_num(request, 0, PW_TLS_CACHE_ACTION);
if (!vp) return -1;
- vp->vp_integer = autz_type;
+ vp->vp_uint32 = autz_type;
fr_pair_add(&request->control, vp);
RINDENT();
if (!session->allow_session_resumption) goto disable;
vp = fr_pair_find_by_num(request->control, 0, PW_ALLOW_SESSION_RESUMPTION, TAG_ANY);
- if (vp && (vp->vp_integer == 0)) {
+ if (vp && (vp->vp_uint32 == 0)) {
RDEBUG2("&control:Allow-Session-Resumption == no, disabling session resumption");
disable:
SSL_CTX_remove_session(session->ctx, session->ssl_session);
* Allow us to cache the OCSP verified state externally
*/
vp = fr_pair_find_by_num(request->control, 0, PW_TLS_OCSP_CERT_VALID, TAG_ANY);
- if (vp) switch (vp->vp_integer) {
+ if (vp) switch (vp->vp_uint32) {
case 0: /* no */
RDEBUG2("Found &control:TLS-OCSP-Cert-Valid = no, forcing OCSP failure");
return OCSP_STATUS_FAILED;
RDEBUG2("Adding OCSP TTL attribute");
RINDENT();
vp = pair_make_request("TLS-OCSP-Next-Update", NULL, T_OP_SET);
- vp->vp_integer = next - now.tv_sec;
+ vp->vp_uint32 = next - now.tv_sec;
rdebug_pair(L_DBG_LVL_2, request, vp, NULL);
REXDENT();
} else {
}
vp = pair_make_request("TLS-OCSP-Cert-Valid", NULL, T_OP_SET);
- vp->vp_integer = 1; /* yes */
+ vp->vp_uint32 = 1; /* yes */
ocsp_status = OCSP_STATUS_OK;
break;
skipped:
SSL_DRAIN_ERROR_QUEUE(RWDEBUG, "", ssl_log);
vp = pair_make_request("TLS-OCSP-Cert-Valid", NULL, T_OP_SET);
- vp->vp_integer = 2; /* skipped */
+ vp->vp_uint32 = 2; /* skipped */
if (conf->softfail) {
RWDEBUG("Unable to check certificate: %s",
staple_response ?
default:
SSL_DRAIN_ERROR_QUEUE(REDEBUG, "", ssl_log);
vp = pair_make_request("TLS-OCSP-Cert-Valid", NULL, T_OP_SET);
- vp->vp_integer = 0; /* no */
+ vp->vp_uint32 = 0; /* no */
REDEBUG("Failed to validate certificate");
break;
}
*/
session->mtu = conf->fragment_size;
vp = fr_pair_find_by_num(request->packet->vps, 0, PW_FRAMED_MTU, TAG_ANY);
- if (vp && (vp->vp_integer > 100) && (vp->vp_integer < session->mtu)) {
+ if (vp && (vp->vp_uint32 > 100) && (vp->vp_uint32 < session->mtu)) {
RDEBUG2("Setting fragment_len from &Framed-MTU");
- session->mtu = vp->vp_integer;
+ session->mtu = vp->vp_uint32;
}
if (conf->session_cache_server) session->allow_session_resumption = true; /* otherwise it's false */
* the attributes read from the file.
*/
case PW_PACKET_TYPE:
- request->packet->code = vp->vp_integer;
+ request->packet->code = vp->vp_uint32;
break;
case PW_PACKET_DST_PORT:
- request->packet->dst_port = (vp->vp_integer & 0xffff);
+ request->packet->dst_port = (vp->vp_uint32 & 0xffff);
break;
case PW_PACKET_DST_IP_ADDRESS:
break;
case PW_PACKET_SRC_PORT:
- request->packet->src_port = (vp->vp_integer & 0xffff);
+ request->packet->src_port = (vp->vp_uint32 & 0xffff);
break;
case PW_PACKET_SRC_IP_ADDRESS:
* Update the list with the response type.
*/
vp = radius_pair_create(request->reply, &request->reply->vps, PW_RESPONSE_PACKET_TYPE, 0);
- vp->vp_integer = request->reply->code;
+ vp->vp_uint32 = request->reply->code;
{
VALUE_PAIR const *failed[2];
switch (g->vpt->tmpl_da->type) {
case FR_TYPE_UINT8:
- start = ((uint32_t) vp->vp_byte) % g->num_children;
+ start = ((uint32_t) vp->vp_uint8) % g->num_children;
break;
case FR_TYPE_UINT16:
break;
case FR_TYPE_UINT32:
- start = vp->vp_integer % g->num_children;
+ start = vp->vp_uint32 % g->num_children;
break;
case FR_TYPE_UINT64:
case PW_PACKET_SRC_PORT:
virtual = fr_pair_afrom_da(ctx, vpt->tmpl_da);
- virtual->vp_integer = packet->src_port;
+ virtual->vp_uint32 = packet->src_port;
vp = virtual;
break;
case PW_PACKET_DST_PORT:
virtual = fr_pair_afrom_da(ctx, vpt->tmpl_da);
- virtual->vp_integer = packet->dst_port;
+ virtual->vp_uint32 = packet->dst_port;
vp = virtual;
break;
}
return snprintf(*out, outlen, "%u", htonl(vp->vp_ipv4addr));
case FR_TYPE_UINT32:
- return snprintf(*out, outlen, "%u", vp->vp_integer);
+ return snprintf(*out, outlen, "%u", vp->vp_uint32);
case FR_TYPE_DATE:
return snprintf(*out, outlen, "%u", vp->vp_date);
case FR_TYPE_UINT8:
- return snprintf(*out, outlen, "%u", (unsigned int) vp->vp_byte);
+ return snprintf(*out, outlen, "%u", (unsigned int) vp->vp_uint8);
case FR_TYPE_UINT16:
return snprintf(*out, outlen, "%u", (unsigned int) vp->vp_short);
packet->code = PW_CODE_ACCOUNTING_REQUEST;
vp = fr_pair_find_by_num(packet->vps, 0, PW_PACKET_TYPE, TAG_ANY);
- if (vp) packet->code = vp->vp_integer;
+ if (vp) packet->code = vp->vp_uint32;
gettimeofday(&packet->timestamp, NULL);
*/
vp = fr_pair_find_by_num(packet->vps, 0, PW_EVENT_TIMESTAMP, TAG_ANY);
if (vp) {
- data->timestamp = vp->vp_integer;
+ data->timestamp = vp->vp_uint32;
}
/*
fr_pair_add(&packet->vps, vp);
}
if (data->timestamp != 0) {
- vp->vp_integer += time(NULL) - data->timestamp;
+ vp->vp_uint32 += time(NULL) - data->timestamp;
}
}
rad_assert(vp != NULL);
fr_pair_add(&packet->vps, vp);
}
- vp->vp_integer = data->tries;
+ vp->vp_uint32 = data->tries;
data->entry_state = STATE_RUNNING;
data->running = packet->timestamp.tv_sec;
switch (da->type) {
case FR_TYPE_UINT8:
if (data_len != 1) goto raw;
- vp->vp_byte = p[0];
+ vp->vp_uint8 = p[0];
p++;
break;
case FR_TYPE_UINT32:
if (data_len != 4) goto raw;
- memcpy(&vp->vp_integer, p, 4);
- vp->vp_integer = ntohl(vp->vp_integer);
+ memcpy(&vp->vp_uint32, p, 4);
+ vp->vp_uint32 = ntohl(vp->vp_uint32);
p += 4;
break;
switch (vp->vp_type) {
case FR_TYPE_UINT8:
- vp->vp_byte = p[0];
+ vp->vp_uint8 = p[0];
break;
case FR_TYPE_UINT16:
break;
case FR_TYPE_UINT32:
- memcpy(&vp->vp_integer, p, 4);
- vp->vp_integer = ntohl(vp->vp_integer);
+ memcpy(&vp->vp_uint32, p, 4);
+ vp->vp_uint32 = ntohl(vp->vp_uint32);
break;
case FR_TYPE_IPV4_ADDR:
* DHCP Opcode is request
*/
vp = fr_pair_find_by_num(head, DHCP_MAGIC_VENDOR, 256, TAG_ANY);
- if (vp && vp->vp_integer == 3) {
+ if (vp && vp->vp_uint32 == 3) {
/*
* Vendor is "MSFT 98"
*/
maxms = fr_pair_find_by_num(packet->vps, DHCP_MAGIC_VENDOR, 57, TAG_ANY);
mtu = fr_pair_find_by_num(packet->vps, DHCP_MAGIC_VENDOR, 26, TAG_ANY);
- if (mtu && (mtu->vp_integer < DEFAULT_PACKET_SIZE)) {
+ if (mtu && (mtu->vp_uint32 < DEFAULT_PACKET_SIZE)) {
fr_strerror_printf("Client says MTU is smaller than minimum permitted by the specification");
return -1;
}
* Client says maximum message size is smaller than minimum permitted
* by the specification: fixing it.
*/
- if (maxms && (maxms->vp_integer < DEFAULT_PACKET_SIZE)) maxms->vp_integer = DEFAULT_PACKET_SIZE;
+ if (maxms && (maxms->vp_uint32 < DEFAULT_PACKET_SIZE)) maxms->vp_uint32 = DEFAULT_PACKET_SIZE;
/*
* Client says MTU is smaller than maximum message size: fixing it
*/
- if (maxms && mtu && (maxms->vp_integer > mtu->vp_integer)) maxms->vp_integer = mtu->vp_integer;
+ if (maxms && mtu && (maxms->vp_uint32 > mtu->vp_uint32)) maxms->vp_uint32 = mtu->vp_uint32;
return 0;
}
switch (tlv_stack[depth]->type) {
case FR_TYPE_UINT8:
- p[0] = vp->vp_byte;
+ p[0] = vp->vp_uint8;
p ++;
break;
break;
case FR_TYPE_UINT32:
- lvalue = htonl(vp->vp_integer);
+ lvalue = htonl(vp->vp_uint32);
memcpy(p, &lvalue, 4);
p += 4;
break;
/* store xid */
if ((vp = fr_pair_find_by_num(packet->vps, DHCP_MAGIC_VENDOR, 260, TAG_ANY))) {
- packet->id = vp->vp_integer;
+ packet->id = vp->vp_uint32;
} else {
packet->id = fr_rand();
}
/* DHCP-DHCP-Maximum-Msg-Size */
vp = fr_pair_find_by_num(packet->vps, 57, DHCP_MAGIC_VENDOR, TAG_ANY);
- if (vp && (vp->vp_integer > mms)) {
- mms = vp->vp_integer;
+ if (vp && (vp->vp_uint32 > mms)) {
+ mms = vp->vp_uint32;
if (mms > MAX_PACKET_SIZE) mms = MAX_PACKET_SIZE;
}
vp = fr_pair_find_by_num(packet->vps, DHCP_MAGIC_VENDOR, 256, TAG_ANY);
if (vp) {
- *p++ = vp->vp_integer & 0xff;
+ *p++ = vp->vp_uint32 & 0xff;
} else {
*p++ = 1; /* client message */
}
/* DHCP-Hardware-Type */
if ((vp = fr_pair_find_by_num(packet->vps, DHCP_MAGIC_VENDOR, 257, TAG_ANY))) {
- *p++ = vp->vp_byte;
+ *p++ = vp->vp_uint8;
} else {
*p++ = 1; /* hardware type = ethernet */
}
/* DHCP-Hardware-Address-len */
if ((vp = fr_pair_find_by_num(packet->vps, DHCP_MAGIC_VENDOR, 258, TAG_ANY))) {
- *p++ = vp->vp_byte;
+ *p++ = vp->vp_uint8;
} else {
*p++ = 6; /* 6 bytes of ethernet */
}
/* DHCP-Hop-Count */
if ((vp = fr_pair_find_by_num(packet->vps, DHCP_MAGIC_VENDOR, 259, TAG_ANY))) {
- *p = vp->vp_byte;
+ *p = vp->vp_uint8;
}
p++;
* Allow to set packet type using DHCP-Message-Type
*/
if (vp->da->vendor == DHCP_MAGIC_VENDOR && vp->da->attr == PW_DHCP_MESSAGE_TYPE) {
- request->code = vp->vp_integer + PW_DHCP_OFFSET;
+ request->code = vp->vp_uint32 + PW_DHCP_OFFSET;
} else if (!vp->da->vendor) switch (vp->da->attr) {
/*
* Allow it to set the packet type in
* (this takes precedence over the command argument.)
*/
case PW_PACKET_TYPE:
- request->code = vp->vp_integer;
+ request->code = vp->vp_uint32;
break;
case PW_PACKET_DST_PORT:
- request->dst_port = (vp->vp_integer & 0xffff);
+ request->dst_port = (vp->vp_uint32 & 0xffff);
break;
case PW_PACKET_DST_IP_ADDRESS:
break;
case PW_PACKET_SRC_PORT:
- request->src_port = (vp->vp_integer & 0xffff);
+ request->src_port = (vp->vp_uint32 & 0xffff);
break;
case PW_PACKET_SRC_IP_ADDRESS:
* Drop requests if hop-count > 16 or admin specified another value
*/
if ((vp = fr_pair_find_by_num(request->control, DHCP_MAGIC_VENDOR, 271, TAG_ANY))) { /* DHCP-Relay-Max-Hop-Count */
- maxhops = vp->vp_integer;
+ maxhops = vp->vp_uint32;
}
vp = fr_pair_find_by_num(request->packet->vps, DHCP_MAGIC_VENDOR, 259, TAG_ANY); /* DHCP-Hop-Count */
rad_assert(vp != NULL);
- if (vp->vp_byte > maxhops) {
+ if (vp->vp_uint8 > maxhops) {
RDEBUG2("Number of hops is greater than %d: not relaying", maxhops);
return 1;
} else {
/* Increment hop count */
- vp->vp_byte++;
+ vp->vp_uint8++;
}
sock = request->listener->data;
if ((request->packet->code == PW_DHCP_NAK) ||
!sock->src_interface ||
((vp = fr_pair_find_by_num(request->packet->vps, DHCP_MAGIC_VENDOR, 262, TAG_ANY)) /* DHCP-Flags */ &&
- (vp->vp_integer & 0x8000) &&
+ (vp->vp_uint32 & 0x8000) &&
((vp = fr_pair_find_by_num(request->packet->vps, DHCP_MAGIC_VENDOR, 263, TAG_ANY)) /* DHCP-Client-IP-Address */ &&
(vp->vp_ipv4addr == htonl(INADDR_ANY))))) {
/*
vp = fr_pair_find_by_num(request->packet->vps, DHCP_MAGIC_VENDOR, 53, TAG_ANY); /* DHCP-Message-Type */
if (vp) {
- fr_dict_enum_t *dv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_byte);
+ fr_dict_enum_t *dv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_uint8);
if (dv) {
CONF_SECTION *server, *unlang;
unlang = cf_subsection_find_name2(server, "dhcp", dv->name);
rcode = unlang_interpret(request, unlang, RLM_MODULE_NOOP);
} else {
- REDEBUG("Unknown DHCP-Message-Type %d", vp->vp_byte);
+ REDEBUG("Unknown DHCP-Message-Type %d", vp->vp_uint8);
rcode = RLM_MODULE_FAIL;
}
} else {
vp = fr_pair_find_by_num(request->reply->vps, DHCP_MAGIC_VENDOR, 53, TAG_ANY); /* DHCP-Message-Type */
if (vp) {
- request->reply->code = vp->vp_byte;
+ request->reply->code = vp->vp_uint8;
if ((request->reply->code != 0) &&
(request->reply->code < PW_DHCP_OFFSET)) {
request->reply->code += PW_DHCP_OFFSET;
}
/* BOOTREPLY received on port 67 (i.e. from a server) */
- if (vp->vp_byte == 2) {
+ if (vp->vp_uint8 == 2) {
return dhcprelay_process_server_reply(request);
}
}
/* else it's a packet from a client, without relaying */
- rad_assert(vp->vp_byte == 1); /* BOOTREQUEST */
+ rad_assert(vp->vp_uint8 == 1); /* BOOTREQUEST */
sock = request->listener->data;
vp = fr_pair_find_by_num(request->reply->vps, DHCP_MAGIC_VENDOR, 256, TAG_ANY); /* DHCP-Opcode */
rad_assert(vp != NULL);
- vp->vp_byte = 2; /* BOOTREPLY */
+ vp->vp_uint8 = 2; /* BOOTREPLY */
/*
* Allow NAKs to be delayed for a short period of time.
if (request->reply->code == PW_DHCP_NAK) {
vp = fr_pair_find_by_num(request->reply->vps, 0, PW_FREERADIUS_RESPONSE_DELAY, TAG_ANY);
if (vp) {
- if (vp->vp_integer <= 10) {
- request->response_delay.tv_sec = vp->vp_integer;
+ if (vp->vp_uint32 <= 10) {
+ request->response_delay.tv_sec = vp->vp_uint32;
request->response_delay.tv_usec = 0;
} else {
request->response_delay.tv_sec = 10;
#define USEC 1000000
vp = fr_pair_find_by_num(request->reply->vps, 0, PW_FREERADIUS_RESPONSE_DELAY_USEC, TAG_ANY);
if (vp) {
- if (vp->vp_integer <= 10 * USEC) {
- request->response_delay.tv_sec = vp->vp_integer / USEC;
- request->response_delay.tv_usec = vp->vp_integer % USEC;
+ if (vp->vp_uint32 <= 10 * USEC) {
+ request->response_delay.tv_sec = vp->vp_uint32 / USEC;
+ request->response_delay.tv_usec = vp->vp_uint32 % USEC;
} else {
request->response_delay.tv_sec = 10;
request->response_delay.tv_usec = 0;
request->reply->dst_port = request->packet->dst_port;
vp = fr_pair_find_by_num(request->reply->vps, 0, PW_PACKET_DST_PORT, TAG_ANY);
- if (vp) request->reply->dst_port = vp->vp_integer;
+ if (vp) request->reply->dst_port = vp->vp_uint32;
return RLM_MODULE_OK;
}
*/
if ((request->reply->code == PW_DHCP_NAK) ||
((vp = fr_pair_find_by_num(request->reply->vps, DHCP_MAGIC_VENDOR, 262, TAG_ANY)) && /* DHCP-Flags */
- (vp->vp_integer & 0x8000) &&
+ (vp->vp_uint32 & 0x8000) &&
((vp = fr_pair_find_by_num(request->reply->vps, DHCP_MAGIC_VENDOR, 263, TAG_ANY)) && /* DHCP-Client-IP-Address */
(vp->vp_ipv4addr == htonl(INADDR_ANY))))) {
/*
*/
vp = fr_pair_find_by_num(request->reply->vps, 0, PW_PACKET_TYPE, TAG_ANY);
if (vp) {
- if (vp->vp_integer == 256) {
+ if (vp->vp_uint32 == 256) {
request->reply->code = 0;
} else {
- request->reply->code = vp->vp_integer;
+ request->reply->code = vp->vp_uint32;
}
}
if (auth_type) {
snprintf(clean_password, sizeof(clean_password),
"<via Auth-Type = %s>",
- fr_dict_enum_name_by_da(NULL, auth_type->da, auth_type->vp_integer));
+ fr_dict_enum_name_by_da(NULL, auth_type->da, auth_type->vp_uint32));
} else {
strcpy(clean_password, "<no User-Password attribute>");
}
continue;
}
- RWDEBUG("Ignoring extra Auth-Type = %s", fr_dict_enum_name_by_da(NULL, auth_type->da, vp->vp_integer));
+ RWDEBUG("Ignoring extra Auth-Type = %s", fr_dict_enum_name_by_da(NULL, auth_type->da, vp->vp_uint32));
}
/*
/*
* Handle hard-coded Accept and Reject.
*/
- if (auth_type->vp_integer == PW_AUTH_TYPE_ACCEPT) {
+ if (auth_type->vp_uint32 == PW_AUTH_TYPE_ACCEPT) {
RDEBUG2("Auth-Type = Accept, allowing user");
request->reply->code = PW_CODE_ACCESS_ACCEPT;
goto setup_send;
}
- if (auth_type->vp_integer == PW_AUTH_TYPE_REJECT) {
+ if (auth_type->vp_uint32 == PW_AUTH_TYPE_REJECT) {
RDEBUG2("Auth-Type = Reject, rejecting user");
request->reply->code = PW_CODE_ACCESS_REJECT;
goto setup_send;
* Find the appropriate Auth-Type by name.
*/
vp = auth_type;
- dv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_integer);
+ dv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_uint32);
if (!dv) {
- REDEBUG2("Unknown Auth-Type %d found: rejecting the user.", vp->vp_integer);
+ REDEBUG2("Unknown Auth-Type %d found: rejecting the user.", vp->vp_uint32);
request->reply->code = PW_CODE_ACCESS_REJECT;
goto setup_send;
}
*/
vp = fr_pair_find_by_num(request->reply->vps, 0, PW_PACKET_TYPE, TAG_ANY);
if (vp) {
- if (vp->vp_integer == 256) {
+ if (vp->vp_uint32 == 256) {
request->reply->code = 0;
} else {
- request->reply->code = vp->vp_integer;
+ request->reply->code = vp->vp_uint32;
}
}
if (!request->reply->code) {
vp = fr_pair_find_by_num(request->control, 0, PW_AUTH_TYPE, TAG_ANY);
if (vp) {
- if (vp->vp_integer == PW_AUTH_TYPE_ACCEPT) {
+ if (vp->vp_uint32 == PW_AUTH_TYPE_ACCEPT) {
request->reply->code = PW_CODE_ACCESS_ACCEPT;
- } else if (vp->vp_integer == PW_AUTH_TYPE_REJECT) {
+ } else if (vp->vp_uint32 == PW_AUTH_TYPE_REJECT) {
request->reply->code = PW_CODE_ACCESS_REJECT;
}
}
vp = fr_pair_find_by_num(request->reply->vps, 0, PW_FREERADIUS_RESPONSE_DELAY, TAG_ANY);
if (vp) {
- if (vp->vp_integer <= 10) {
- delay.tv_sec = vp->vp_integer;
+ if (vp->vp_uint32 <= 10) {
+ delay.tv_sec = vp->vp_uint32;
} else {
delay.tv_sec = 10;
}
} else {
vp = fr_pair_find_by_num(request->reply->vps, 0, PW_FREERADIUS_RESPONSE_DELAY_USEC, TAG_ANY);
if (vp) {
- if (vp->vp_integer <= 10 * USEC) {
- delay.tv_sec = vp->vp_integer / USEC;
- delay.tv_usec = vp->vp_integer % USEC;
+ if (vp->vp_uint32 <= 10 * USEC) {
+ delay.tv_sec = vp->vp_uint32 / USEC;
+ delay.tv_usec = vp->vp_uint32 % USEC;
} else {
delay.tv_sec = 10;
delay.tv_usec = 0;
*/
vp = fr_pair_find_by_num(request->reply->vps, 0, PW_PACKET_TYPE, TAG_ANY);
if (vp) {
- if (vp->vp_integer == 256) {
+ if (vp->vp_uint32 == 256) {
request->reply->code = 0;
} else {
- request->reply->code = vp->vp_integer;
+ request->reply->code = vp->vp_uint32;
}
}
uint32_t session_id;
uint8_t buf[16] = {0}; /* FIXME state.c:sizeof(struct state_comp) */
- rad_assert(sizeof(request->listener) + sizeof(vp->vp_integer) <= sizeof(buf));
+ rad_assert(sizeof(request->listener) + sizeof(vp->vp_uint32) <= sizeof(buf));
/* session_id is per TCP connection */
memcpy(&buf[0], &request->listener, sizeof(request->listener));
continue;
}
- RWDEBUG("Ignoring extra Auth-Type = %s", fr_dict_enum_name_by_da(NULL, auth_type->da, vp->vp_integer));
+ RWDEBUG("Ignoring extra Auth-Type = %s", fr_dict_enum_name_by_da(NULL, auth_type->da, vp->vp_uint32));
}
/*
/*
* Handle hard-coded Accept and Reject.
*/
- if (auth_type->vp_integer == PW_AUTH_TYPE_ACCEPT) {
+ if (auth_type->vp_uint32 == PW_AUTH_TYPE_ACCEPT) {
RDEBUG2("Auth-Type = Accept, allowing user");
tacacs_status(request, RLM_MODULE_OK);
goto setup_send;
}
- if (auth_type->vp_integer == PW_AUTH_TYPE_REJECT) {
+ if (auth_type->vp_uint32 == PW_AUTH_TYPE_REJECT) {
RDEBUG2("Auth-Type = Reject, rejecting user");
tacacs_status(request, RLM_MODULE_REJECT);
goto setup_send;
* Find the appropriate Auth-Type by name.
*/
vp = auth_type;
- dv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_integer);
+ dv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_uint32);
if (!dv) {
- REDEBUG2("Unknown Auth-Type %d found: rejecting the user.", vp->vp_integer);
+ REDEBUG2("Unknown Auth-Type %d found: rejecting the user.", vp->vp_uint32);
tacacs_status(request, RLM_MODULE_FAIL);
goto setup_send;
}
vp = fr_pair_find_by_da(request->reply->vps, authda, TAG_ANY);
if (vp) {
- switch ((tacacs_authen_reply_status_t)vp->vp_byte) {
+ switch ((tacacs_authen_reply_status_t)vp->vp_uint8) {
case TAC_PLUS_AUTHEN_STATUS_PASS:
case TAC_PLUS_AUTHEN_STATUS_FAIL:
case TAC_PLUS_AUTHEN_STATUS_RESTART:
rad_assert(vp != NULL);
/* authentication would continue but seq_no cannot continue */
- if (vp->vp_byte == 253) {
+ if (vp->vp_uint8 == 253) {
RWARN("Sequence number would wrap, restarting authentication");
fr_state_discard(global_state, request, request->packet);
fr_pair_list_free(&request->reply->vps);
vp = fr_pair_afrom_da(request->reply, authda);
rad_assert(vp != NULL);
- vp->vp_byte = (tacacs_authen_reply_status_t)TAC_PLUS_AUTHEN_STATUS_RESTART;
+ vp->vp_uint8 = (tacacs_authen_reply_status_t)TAC_PLUS_AUTHEN_STATUS_RESTART;
fr_pair_add(&request->reply->vps, vp);
} else {
state_add(request, request->reply);
vp = fr_pair_find_by_child_num(packet->vps, dict_tacacs_root, PW_TACACS_PACKET_TYPE, TAG_ANY);
rad_assert(vp != NULL);
- return (tacacs_type_t)vp->vp_byte;
+ return (tacacs_type_t)vp->vp_uint8;
}
char const * tacacs_lookup_packet_code(RADIUS_PACKET const * const packet)
vp = fr_pair_find_by_child_num(packet->vps, dict_tacacs_root, PW_TACACS_SESSION_ID, TAG_ANY);
rad_assert(vp != NULL);
- return vp->vp_integer;
+ return vp->vp_uint32;
}
static bool tacacs_ok(RADIUS_PACKET const * const packet, bool from_client)
switch (vp->da->attr) {
case PW_TACACS_VERSION_MINOR:
- pkt->hdr.ver.minor = vp->vp_byte;
+ pkt->hdr.ver.minor = vp->vp_uint8;
break;
case PW_TACACS_PACKET_TYPE:
- pkt->hdr.type = vp->vp_byte;
+ pkt->hdr.type = vp->vp_uint8;
break;
case PW_TACACS_SEQUENCE_NUMBER:
- pkt->hdr.seq_no = vp->vp_byte;
+ pkt->hdr.seq_no = vp->vp_uint8;
break;
case PW_TACACS_SESSION_ID:
- pkt->hdr.session_id = htonl(vp->vp_integer);
+ pkt->hdr.session_id = htonl(vp->vp_uint32);
break;
case PW_TACACS_AUTHENTICATION_STATUS:
- pkt->authen.reply.status = vp->vp_byte;
- status = vp->vp_byte;
+ pkt->authen.reply.status = vp->vp_uint8;
+ status = vp->vp_uint8;
break;
case PW_TACACS_AUTHENTICATION_FLAGS:
- authen_reply_flags |= vp->vp_byte;
+ authen_reply_flags |= vp->vp_uint8;
break;
case PW_TACACS_AUTHORIZATION_STATUS:
- pkt->author.res.status = vp->vp_byte;
- status = vp->vp_byte;
+ pkt->author.res.status = vp->vp_uint8;
+ status = vp->vp_uint8;
break;
case PW_TACACS_ACCOUNTING_STATUS:
- pkt->acct.res.status = vp->vp_byte;
- status = vp->vp_byte;
+ pkt->acct.res.status = vp->vp_uint8;
+ status = vp->vp_uint8;
break;
case PW_TACACS_SERVER_MESSAGE:
length_body += vp->vp_length;
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_VERSION_MINOR);
if (!vp) return -1;
- vp->vp_byte = pkt->hdr.ver.minor;
+ vp->vp_uint8 = pkt->hdr.ver.minor;
fr_pair_cursor_append(&cursor, vp);
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_PACKET_TYPE);
if (!vp) return -1;
- vp->vp_byte = pkt->hdr.type;
+ vp->vp_uint8 = pkt->hdr.type;
fr_pair_cursor_append(&cursor, vp);
packet->code = pkt->hdr.type;
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_SEQUENCE_NUMBER);
if (!vp) return -1;
- vp->vp_byte = pkt->hdr.seq_no;
+ vp->vp_uint8 = pkt->hdr.seq_no;
fr_pair_cursor_append(&cursor, vp);
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_SESSION_ID);
if (!vp) return -1;
- vp->vp_integer = ntohl(pkt->hdr.session_id);
+ vp->vp_uint32 = ntohl(pkt->hdr.session_id);
fr_pair_cursor_append(&cursor, vp);
- session_id = vp->vp_integer;
+ session_id = vp->vp_uint32;
switch ((tacacs_type_t)pkt->hdr.type) {
case TAC_PLUS_AUTHEN:
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_ACTION);
if (!vp) return -1;
- vp->vp_byte = pkt->authen.start.action;
+ vp->vp_uint8 = pkt->authen.start.action;
fr_pair_cursor_append(&cursor, vp);
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_PRIVILEGE_LEVEL);
if (!vp) return -1;
- vp->vp_byte = pkt->authen.start.priv_lvl;
+ vp->vp_uint8 = pkt->authen.start.priv_lvl;
fr_pair_cursor_append(&cursor, vp);
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_AUTHENTICATION_TYPE);
if (!vp) return -1;
- vp->vp_byte = pkt->authen.start.authen_type;
+ vp->vp_uint8 = pkt->authen.start.authen_type;
fr_pair_cursor_append(&cursor, vp);
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_AUTHENTICATION_SERVICE);
if (!vp) return -1;
- vp->vp_byte = pkt->authen.start.authen_service;
+ vp->vp_uint8 = pkt->authen.start.authen_service;
fr_pair_cursor_append(&cursor, vp);
if (pkt->authen.start.user_len) {
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_AUTHENTICATION_METHOD);
if (!vp) return -1;
- vp->vp_byte = pkt->author.req.authen_method;
+ vp->vp_uint8 = pkt->author.req.authen_method;
fr_pair_cursor_append(&cursor, vp);
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_PRIVILEGE_LEVEL);
if (!vp) return -1;
- vp->vp_byte = pkt->author.req.priv_lvl;
+ vp->vp_uint8 = pkt->author.req.priv_lvl;
fr_pair_cursor_append(&cursor, vp);
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_AUTHENTICATION_TYPE);
if (!vp) return -1;
- vp->vp_byte = pkt->author.req.authen_type;
+ vp->vp_uint8 = pkt->author.req.authen_type;
fr_pair_cursor_append(&cursor, vp);
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_AUTHENTICATION_SERVICE);
if (!vp) return -1;
- vp->vp_byte = pkt->author.req.authen_service;
+ vp->vp_uint8 = pkt->author.req.authen_service;
fr_pair_cursor_append(&cursor, vp);
if (pkt->author.req.user_len) {
if (pkt->acct.req.flags & TAC_PLUS_ACCT_FLAG_START) {
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_ACCOUNTING_FLAGS);
if (!vp) return -1;
- vp->vp_byte = TAC_PLUS_ACCT_FLAG_START;
+ vp->vp_uint8 = TAC_PLUS_ACCT_FLAG_START;
fr_pair_cursor_append(&cursor, vp);
}
if (pkt->acct.req.flags & TAC_PLUS_ACCT_FLAG_STOP) {
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_ACCOUNTING_FLAGS);
if (!vp) return -1;
- vp->vp_byte = TAC_PLUS_ACCT_FLAG_STOP;
+ vp->vp_uint8 = TAC_PLUS_ACCT_FLAG_STOP;
fr_pair_cursor_append(&cursor, vp);
}
if (pkt->acct.req.flags & TAC_PLUS_ACCT_FLAG_WATCHDOG) {
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_ACCOUNTING_FLAGS);
if (!vp) return -1;
- vp->vp_byte = TAC_PLUS_ACCT_FLAG_WATCHDOG;
+ vp->vp_uint8 = TAC_PLUS_ACCT_FLAG_WATCHDOG;
fr_pair_cursor_append(&cursor, vp);
}
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_AUTHENTICATION_METHOD);
if (!vp) return -1;
- vp->vp_byte = pkt->acct.req.authen_method;
+ vp->vp_uint8 = pkt->acct.req.authen_method;
fr_pair_cursor_append(&cursor, vp);
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_PRIVILEGE_LEVEL);
if (!vp) return -1;
- vp->vp_byte = pkt->acct.req.priv_lvl;
+ vp->vp_uint8 = pkt->acct.req.priv_lvl;
fr_pair_cursor_append(&cursor, vp);
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_AUTHENTICATION_TYPE);
if (!vp) return -1;
- vp->vp_byte = pkt->acct.req.authen_type;
+ vp->vp_uint8 = pkt->acct.req.authen_type;
fr_pair_cursor_append(&cursor, vp);
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_AUTHENTICATION_SERVICE);
if (!vp) return -1;
- vp->vp_byte = pkt->acct.req.authen_service;
+ vp->vp_uint8 = pkt->acct.req.authen_service;
fr_pair_cursor_append(&cursor, vp);
if (pkt->acct.req.user_len) {
vp = fr_pair_find_by_child_num(original->vps, dict_tacacs_root, PW_TACACS_VERSION_MINOR, TAG_ANY);
rad_assert(vp != NULL);
- vminor = vp->vp_byte;
+ vminor = vp->vp_uint8;
vp = fr_pair_afrom_da(packet, vp->da);
if (!vp) return -1;
- vp->vp_byte = vminor;
+ vp->vp_uint8 = vminor;
fr_pair_add(&packet->vps, vp);
type = tacacs_type(original);
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_PACKET_TYPE);
- vp->vp_byte = type;
+ vp->vp_uint8 = type;
fr_pair_add(&packet->vps, vp);
vp = fr_pair_find_by_child_num(original->vps, dict_tacacs_root, PW_TACACS_SEQUENCE_NUMBER, TAG_ANY);
rad_assert(vp != NULL);
- seq_no = vp->vp_byte + 1; /* we catch client 255 on ingress */
+ seq_no = vp->vp_uint8 + 1; /* we catch client 255 on ingress */
vp = fr_pair_afrom_da(packet, vp->da);
if (!vp) return -1;
- vp->vp_byte = seq_no;
+ vp->vp_uint8 = seq_no;
fr_pair_add(&packet->vps, vp);
vp = fr_pair_afrom_child_num(packet, dict_tacacs_root, PW_TACACS_SESSION_ID);
if (!vp) return -1;
- vp->vp_integer = tacacs_session_id(original);
+ vp->vp_uint32 = tacacs_session_id(original);
fr_pair_add(&packet->vps, vp);
if (tacacs_encode(packet, secret) < 0) {
goto done;
}
- dv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_integer);
+ dv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_uint32);
if (!dv) {
REDEBUG("Failed to find value for &request:VMPS-Packet-Type");
goto done;
if (vp) {
da = vp->da;
- if (vp->vp_integer == 256) {
+ if (vp->vp_uint32 == 256) {
request->reply->code = 0;
} else {
- request->reply->code = vp->vp_integer;
+ request->reply->code = vp->vp_uint32;
}
} else if (rcode != RLM_MODULE_HANDLED) {
fr_strerror_printf("No memory");
return -1;
}
- vp->vp_integer = packet->data[1];
+ vp->vp_uint32 = packet->data[1];
vp->vp_tainted = true;
debug_pair(vp);
fr_pair_cursor_append(&cursor, vp);
fr_strerror_printf("No memory");
return -1;
}
- vp->vp_integer = packet->data[2];
+ vp->vp_uint32 = packet->data[2];
vp->vp_tainted = true;
debug_pair(vp);
fr_pair_cursor_append(&cursor, vp);
fr_strerror_printf("No memory");
return -1;
}
- vp->vp_integer = packet->id; /* already set by vqp_recv */
+ vp->vp_uint32 = packet->id; /* already set by vqp_recv */
vp->vp_tainted = true;
debug_pair(vp);
fr_pair_cursor_append(&cursor, vp);
return -1;
}
- code = vp->vp_integer;
+ code = vp->vp_uint32;
if ((code < 1) || (code > 4)) {
fr_strerror_printf("Invalid value %d for VQP-Packet-Type", code);
return -1;
out[0] = VQP_VERSION;
out[1] = code;
- out[2] = vp->vp_integer & 0xff;
+ out[2] = vp->vp_uint32 & 0xff;
return 0;
}
check_item = fr_pair_cursor_next(&check)) {
if (!check_item->da->vendor &&
(check_item->da->attr == PW_FALL_THROUGH) &&
- (check_item->vp_integer == 1)) {
+ (check_item->vp_uint32 == 1)) {
fall_through = 1;
continue;
}
else if (!check_item->da->vendor && check_item->da->attr == PW_RELAX_FILTER) {
- relax_filter = check_item->vp_integer;
+ relax_filter = check_item->vp_uint32;
continue;
}
rad_assert(vp != NULL);
fr_pair_add(&request->packet->vps, vp);
}
- vp->vp_integer = c->hits;
+ vp->vp_uint32 = c->hits;
}
return merged > 0 ?
* Check to see if we need to merge the entry into the request
*/
vp = fr_pair_find_by_num(request->control, 0, PW_CACHE_MERGE_NEW, TAG_ANY);
- if (vp && (vp->vp_integer > 0)) merge = true;
+ if (vp && (vp->vp_uint32 > 0)) merge = true;
if (merge) cache_merge(inst, request, c);
* valid cache entry
*/
vp = fr_pair_find_by_num(request->control, 0, PW_CACHE_STATUS_ONLY, TAG_ANY);
- if (vp && vp->vp_integer) {
+ if (vp && vp->vp_uint32) {
RINDENT();
RDEBUG3("status-only: yes");
REXDENT();
* Figure out what operation we're doing
*/
vp = fr_pair_find_by_num(request->control, 0, PW_CACHE_ALLOW_MERGE, TAG_ANY);
- if (vp) merge = (bool)vp->vp_integer;
+ if (vp) merge = (bool)vp->vp_uint32;
vp = fr_pair_find_by_num(request->control, 0, PW_CACHE_ALLOW_INSERT, TAG_ANY);
- if (vp) insert = (bool)vp->vp_integer;
+ if (vp) insert = (bool)vp->vp_uint32;
vp = fr_pair_find_by_num(request->control, 0, PW_CACHE_TTL, TAG_ANY);
if (vp) {
switch (vp->vp_type) {
case FR_TYPE_UINT32:
- i = vp->vp_integer;
+ i = vp->vp_uint32;
goto print_int;
case FR_TYPE_UINT16:
goto print_int;
case FR_TYPE_UINT8:
- i = vp->vp_byte;
+ i = vp->vp_uint8;
print_int:
/* skip if we have flags */
/* get elapsed session time */
if ((vp = fr_pair_find_by_num(vps, 0, PW_ACCT_SESSION_TIME, TAG_ANY)) != NULL) {
/* calculate diff */
- ts = (ts - vp->vp_integer);
+ ts = (ts - vp->vp_uint32);
/* calculate start time */
size_t length = strftime(value, sizeof(value), "%b %e %Y %H:%M:%S %Z", localtime_r(&ts, &tm));
/* check length */
}
/* set status */
- status = vp->vp_integer;
+ status = vp->vp_uint32;
/* acknowledge the request but take no action */
if (status == PW_STATUS_ACCOUNTING_ON || status == PW_STATUS_ACCOUNTING_OFF) {
return RLM_MODULE_INVALID;
}
- switch (authtype->vp_integer){
+ switch (authtype->vp_uint32){
case 2: /* CRAM-MD5 */
if (challenge->vp_length < 5 || response->vp_length != 16) {
REDEBUG("Invalid MD5 challenge/response length");
case FR_TYPE_UINT32:
case FR_TYPE_UINT64:
- date = (time_t) vp->vp_integer;
+ date = (time_t) vp->vp_uint32;
encode:
if (localtime_r(&date, &tminfo) == NULL) {
detail_fr_pair_fprint(request, out, &dst_vp);
src_vp.da = fr_dict_attr_by_num(NULL, 0, PW_PACKET_SRC_PORT);
- src_vp.vp_integer = packet->src_port;
+ src_vp.vp_uint32 = packet->src_port;
dst_vp.da = fr_dict_attr_by_num(NULL, 0, PW_PACKET_DST_PORT);
- dst_vp.vp_integer = packet->dst_port;
+ dst_vp.vp_uint32 = packet->dst_port;
detail_fr_pair_fprint(request, out, &src_vp);
detail_fr_pair_fprint(request, out, &dst_vp);
* this allows you to NOT do EAP for some users.
*/
vp = fr_pair_find_by_num(request->packet->vps, 0, PW_EAP_TYPE, TAG_ANY);
- if (vp && vp->vp_integer == 0) {
+ if (vp && vp->vp_uint32 == 0) {
RDEBUG2("Found EAP-Message, but EAP-Type = None, so we're not doing EAP");
return RLM_MODULE_NOOP;
}
*/
vp = fr_pair_afrom_num(request->packet, 0, PW_EAP_TYPE);
if (vp) {
- vp->vp_integer = eap_msg->vp_octets[4];
+ vp->vp_uint32 = eap_msg->vp_octets[4];
fr_pair_add(&(request->packet->vps), vp);
}
*/
vp = fr_pair_find_by_num(request->control, 0, PW_CHBIND_RESPONSE_CODE, TAG_ANY);
if (vp) {
- ptr[0] = vp->vp_integer;
+ ptr[0] = vp->vp_uint32;
} else {
ptr[0] = CHBIND_CODE_FAILURE;
}
fr_strerror_printf("Failed allocating subtype attribute");
goto error;
}
- vp->vp_integer = data[0];
+ vp->vp_uint32 = data[0];
fr_pair_cursor_append(decoded, vp);
}
subtype = vp->vp_short;
vp = fr_pair_find_by_num(to_encode, 0, PW_EAP_ID, TAG_ANY);
- id = vp ? vp->vp_integer : ((int)getpid() & 0xff);
+ id = vp ? vp->vp_uint32 : ((int)getpid() & 0xff);
vp = fr_pair_find_by_num(to_encode, 0, PW_EAP_CODE, TAG_ANY);
- eap_code = vp ? vp->vp_integer : PW_EAP_REQUEST;
+ eap_code = vp ? vp->vp_uint32 : PW_EAP_REQUEST;
/*
* Fill in some bits in the EAP packet
keys->gsm.vector[idx].rand[i] = fr_rand();
}
- switch (version->vp_integer) {
+ switch (version->vp_uint32) {
case 1:
comp128v1(keys->gsm.vector[idx].sres,
keys->gsm.vector[idx].kc, vp->vp_octets,
return 1;
default:
- REDEBUG("Unknown/unsupported algorithm Comp128-%i", version->vp_integer);
+ REDEBUG("Unknown/unsupported algorithm Comp128-%i", version->vp_uint32);
return -1;
}
return 0;
keys->umts.vector.rand[i] = fr_rand();
}
- switch (version->vp_integer) {
+ switch (version->vp_uint32) {
case 1:
comp128v1(keys->umts.vector.sres,
keys->umts.vector.kc, vp->vp_octets,
return 1;
default:
- REDEBUG("Unknown/unsupported algorithm Comp128-%i", version->vp_integer);
+ REDEBUG("Unknown/unsupported algorithm Comp128-%i", version->vp_uint32);
return -1;
}
return 0;
* Enforce per-user configuration of EAP
* types.
*/
- if (vp && (vp->vp_integer != nak->data[i])) {
+ if (vp && (vp->vp_uint32 != nak->data[i])) {
RDEBUG2("Peer wants %s (%d), while we require %s (%d), skipping",
eap_type2name(nak->data[i]), nak->data[i],
- eap_type2name(vp->vp_integer), vp->vp_integer);
+ eap_type2name(vp->vp_uint32), vp->vp_uint32);
continue;
}
vp = fr_pair_find_by_num(eap_session->request->control, 0, PW_EAP_TYPE, TAG_ANY);
if (vp) {
RDEBUG2("Setting method from &control:EAP-Type");
- next = vp->vp_integer;
+ next = vp->vp_uint32;
}
/*
* and to get excited if it doesn't appear.
*/
vp = fr_pair_find_by_num(request->control, 0, PW_AUTH_TYPE, TAG_ANY);
- if ((!vp) || (vp->vp_integer != PW_AUTH_TYPE_REJECT)) {
+ if ((!vp) || (vp->vp_uint32 != PW_AUTH_TYPE_REJECT)) {
vp = pair_make_config("Auth-Type", inst->name, T_OP_EQ);
if (!vp) {
RDEBUG2("Failed to create Auth-Type %s: %s\n",
*/
vp = fr_pair_find_by_num(request->control, 0, PW_POST_AUTH_TYPE, TAG_ANY);
- if (!vp || (vp->vp_integer != PW_POST_AUTH_TYPE_REJECT)) return RLM_MODULE_NOOP;
+ if (!vp || (vp->vp_uint32 != PW_POST_AUTH_TYPE_REJECT)) return RLM_MODULE_NOOP;
if (!fr_pair_find_by_num(request->packet->vps, 0, PW_EAP_MESSAGE, TAG_ANY)) {
RDEBUG3("Request didn't contain an EAP-Message, not inserting EAP-Failure");
* Set the EAP_ID - new value
*/
vp = fr_pair_afrom_child_num(packet, fr_dict_root(fr_dict_internal), PW_EAP_ID);
- vp->vp_integer = eap_aka_session->aka_id++;
+ vp->vp_uint32 = eap_aka_session->aka_id++;
fr_pair_replace(to_client, vp);
/*
/* the SUBTYPE, set to challenge. */
vp = fr_pair_afrom_child_num(packet, dict_aka_root, PW_EAP_AKA_SUBTYPE);
- vp->vp_integer = PW_EAP_AKA_SUBTYPE_VALUE_AKA_CHALLENGE;
+ vp->vp_uint32 = PW_EAP_AKA_SUBTYPE_VALUE_AKA_CHALLENGE;
fr_pair_replace(to_client, vp);
return 1;
/* set the EAP_ID - new value */
vp = fr_pair_afrom_child_num(packet, fr_dict_root(fr_dict_internal), PW_EAP_ID);
- vp->vp_integer = eap_aka_session->aka_id++;
+ vp->vp_uint32 = eap_aka_session->aka_id++;
fr_pair_replace(&eap_session->request->reply->vps, vp);
p = eap_aka_session->keys.msk;
}
MEM(vp = fr_pair_find_by_child_num(vps, dict_aka_root, PW_EAP_AKA_SUBTYPE, TAG_ANY));
- subtype = vp->vp_integer;
+ subtype = vp->vp_uint32;
switch (eap_aka_session->state) {
case EAP_AKA_SERVER_CHALLENGE:
VALUE_PAIR *tvp;
tvp = fr_pair_afrom_num(fake, 0, PW_EAP_TYPE);
- tvp->vp_integer = t->default_provisioning_method;
+ tvp->vp_uint32 = t->default_provisioning_method;
fr_pair_add(&fake->control, tvp);
/*
*/
switch (vp->da->attr) {
case 1: /* PW_EAP_FAST_CRYPTO_BINDING_RESERVED */
- binding->reserved = vp->vp_integer;
+ binding->reserved = vp->vp_uint32;
break;
case 2: /* PW_EAP_FAST_CRYPTO_BINDING_VERSION */
- binding->version = vp->vp_integer;
+ binding->version = vp->vp_uint32;
break;
case 3: /* PW_EAP_FAST_CRYPTO_BINDING_RECV_VERSION */
- binding->received_version = vp->vp_integer;
+ binding->received_version = vp->vp_uint32;
break;
case 4: /* PW_EAP_FAST_CRYPTO_BINDING_SUB_TYPE */
- binding->subtype = vp->vp_integer;
+ binding->subtype = vp->vp_uint32;
break;
case 5: /* PW_EAP_FAST_CRYPTO_BINDING_NONCE */
memcpy(binding->nonce, vp->vp_octets, vp->vp_length);
case EAP_FAST_TLV_PAC:
switch (vp->da->attr) {
case PAC_INFO_PAC_ACK:
- if (vp->vp_integer == EAP_FAST_TLV_RESULT_SUCCESS) {
+ if (vp->vp_uint32 == EAP_FAST_TLV_RESULT_SUCCESS) {
code = PW_CODE_ACCESS_ACCEPT;
t->pac.expires = UINT32_MAX;
t->pac.expired = false;
}
break;
case PAC_INFO_PAC_TYPE:
- if (vp->vp_integer != PAC_TYPE_TUNNEL) {
+ if (vp->vp_uint32 != PAC_TYPE_TUNNEL) {
RDEBUG("only able to serve Tunnel PAC's, ignoring request");
continue;
}
switch (vp->da->attr) {
case PAC_INFO_PAC_TYPE:
rad_assert(t->pac.type == 0);
- t->pac.type = vp->vp_integer;
+ t->pac.type = vp->vp_uint32;
break;
case PAC_INFO_PAC_LIFETIME:
rad_assert(t->pac.expires == 0);
- t->pac.expires = vp->vp_integer;
- t->pac.expired = (vp->vp_integer <= time(NULL));
+ t->pac.expires = vp->vp_uint32;
+ t->pac.expired = (vp->vp_uint32 <= time(NULL));
break;
case PAC_INFO_PAC_KEY:
rad_assert(t->pac.key == NULL);
*/
vp = fr_pair_find_by_num(eap_session->request->control, 0, PW_EAP_TLS_REQUIRE_CLIENT_CERT, TAG_ANY);
if (vp) {
- client_cert = vp->vp_integer ? true : false;
+ client_cert = vp->vp_uint32 ? true : false;
} else {
client_cert = inst->req_client_cert;
}
if (rv<0) {
RDEBUG("SoH - error decoding payload: %s", fr_strerror());
} else {
- vp->vp_integer = 1;
+ vp->vp_uint32 = 1;
}
}
*/
vp = fr_pair_find_by_num(eap_session->request->control, 0, PW_EAP_TLS_REQUIRE_CLIENT_CERT, TAG_ANY);
if (vp) {
- client_cert = vp->vp_integer ? true : false;
+ client_cert = vp->vp_uint32 ? true : false;
} else {
client_cert = inst->req_client_cert;
}
* The fragmentation code deals with the included length
* so we don't need to subtract that here.
*/
- if (vp && (vp->vp_integer > 100) && (vp->vp_integer < session->mtu)) session->mtu = vp->vp_integer - 9;
+ if (vp && (vp->vp_uint32 > 100) && (vp->vp_uint32 < session->mtu)) session->mtu = vp->vp_uint32 - 9;
session->state = PWD_STATE_ID_REQ;
session->out_pos = 0;
/* set the EAP_ID - new value */
newvp = fr_pair_afrom_child_num(packet, fr_dict_root(fr_dict_internal), PW_EAP_ID);
- newvp->vp_integer = eap_sim_session->sim_id++;
+ newvp->vp_uint32 = eap_sim_session->sim_id++;
fr_pair_replace(vps, newvp);
/* record it in the ess */
/* the SUBTYPE, set to start. */
newvp = fr_pair_afrom_child_num(packet, dict_sim_root, PW_EAP_SIM_SUBTYPE);
- newvp->vp_integer = EAP_SIM_START;
+ newvp->vp_uint32 = EAP_SIM_START;
fr_pair_replace(vps, newvp);
return 0;
* Set the EAP_ID - new value
*/
vp = fr_pair_afrom_child_num(packet, fr_dict_root(fr_dict_internal), PW_EAP_ID);
- vp->vp_integer = eap_sim_session->sim_id++;
+ vp->vp_uint32 = eap_sim_session->sim_id++;
fr_pair_replace(to_client, vp);
/*
* Set subtype to challenge.
*/
vp = fr_pair_afrom_child_num(packet, dict_sim_root, PW_EAP_SIM_SUBTYPE);
- vp->vp_integer = EAP_SIM_CHALLENGE;
+ vp->vp_uint32 = EAP_SIM_CHALLENGE;
fr_pair_replace(to_client, vp);
return 0;
/* set the EAP_ID - new value */
vp = fr_pair_afrom_child_num(packet, fr_dict_root(fr_dict_internal), PW_EAP_ID);
- vp->vp_integer = eap_sim_session->sim_id++;
+ vp->vp_uint32 = eap_sim_session->sim_id++;
fr_pair_replace(&eap_session->request->reply->vps, vp);
p = eap_sim_session->keys.msk;
REDEBUG2("No subtype attribute was created, message dropped");
return 0;
}
- subtype = vp->vp_integer;
+ subtype = vp->vp_uint32;
/*
* Client error supersedes anything else.
*/
vp = fr_pair_find_by_num(eap_session->request->control, 0, PW_EAP_TLS_REQUIRE_CLIENT_CERT, TAG_ANY);
if (vp) {
- client_cert = vp->vp_integer ? true : false;
+ client_cert = vp->vp_uint32 ? true : false;
} else {
client_cert = inst->req_client_cert;
}
*/
vp = fr_pair_find_by_num(eap_session->request->control, 0, PW_EAP_TLS_REQUIRE_CLIENT_CERT, TAG_ANY);
if (vp) {
- client_cert = vp->vp_integer ? true : false;
+ client_cert = vp->vp_uint32 ? true : false;
} else {
client_cert = inst->req_client_cert;
}
switch (vp->vp_type) {
case FR_TYPE_UINT32:
case FR_TYPE_DATE:
- attr = htonl(vp->vp_integer); /* stored in host order */
+ attr = htonl(vp->vp_uint32); /* stored in host order */
memcpy(p, &attr, sizeof(attr));
length = 4;
break;
VERIFY_VP(check);
rate = atoi(req->vp_strvalue);
- return rate - check->vp_integer;
+ return rate - check->vp_uint32;
}
/*
* If Strip-User-Name == No, then don't do any more.
*/
vp = fr_pair_find_by_num(check_pairs, 0, PW_STRIP_USER_NAME, TAG_ANY);
- if (vp && !vp->vp_integer) return ret;
+ if (vp && !vp->vp_uint32) return ret;
/*
* See where to put the stripped user name.
{
VERIFY_VP(check);
- if (request->packet->code == check->vp_integer) {
+ if (request->packet->code == check->vp_uint32) {
return 0;
}
{
VERIFY_VP(check);
- if (request->reply->code == check->vp_integer) {
+ if (request->reply->code == check->vp_uint32) {
return 0;
}
VALUE_PAIR *tmp;
tmp = fr_pair_find_by_num(vp, 0, PW_FALL_THROUGH, TAG_ANY);
- return tmp ? tmp->vp_integer : 0;
+ return tmp ? tmp->vp_uint32 : 0;
}
static const CONF_PARSER module_config[] = {
case json_type_double:
in.type = FR_TYPE_FLOAT64;
- in.datum.decimal = json_object_get_double(object);
+ in.datum.float64 = json_object_get_double(object);
break;
case json_type_int:
in.datum.int32 = num;
} else if (num > UINT16_MAX) { /* 32bit unsigned (supported) */
in.type = FR_TYPE_UINT32;
- in.datum.integer = (uint32_t) num;
+ in.datum.uint32 = (uint32_t) num;
} else if (num > UINT8_MAX) { /* 16bit unsigned (supported) */
in.type = FR_TYPE_UINT16;
in.datum.uint16 = (uint16_t) num;
} else { /* 8bit unsigned (supported) */
in.type = FR_TYPE_UINT8;
- in.datum.byte = (uint8_t) num;
+ in.datum.uint8 = (uint8_t) num;
}
}
break;
}
case FR_TYPE_BOOL:
- return json_object_new_boolean(data->datum.byte);
+ return json_object_new_boolean(data->datum.uint8);
case FR_TYPE_UINT8:
- return json_object_new_int(data->datum.byte);
+ return json_object_new_int(data->datum.uint8);
case FR_TYPE_UINT16:
return json_object_new_int(data->datum.uint16);
case FR_TYPE_UINT32:
if (vp->da->flags.has_value) break;
- return snprintf(out, freespace, "%u", vp->vp_integer);
+ return snprintf(out, freespace, "%u", vp->vp_uint32);
case FR_TYPE_UINT16:
if (vp->da->flags.has_value) break;
case FR_TYPE_UINT8:
if (vp->da->flags.has_value) break;
- return snprintf(out, freespace, "%u", (unsigned int) vp->vp_byte);
+ return snprintf(out, freespace, "%u", (unsigned int) vp->vp_uint8);
case FR_TYPE_INT32:
return snprintf(out, freespace, "%d", vp->vp_signed);
json_object_object_add(vp_object, "mapping", mapping);
}
- dv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_integer);
+ dv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_uint32);
if (dv) {
struct json_object *mapped_value;
timeout = fr_pair_find_by_num(request->reply->vps, 0, PW_SESSION_TIMEOUT, TAG_ANY);
if (timeout) { /* just update... */
- if (timeout->vp_integer > (unsigned int) left) {
- timeout->vp_integer = left;
+ if (timeout->vp_uint32 > (unsigned int) left) {
+ timeout->vp_uint32 = left;
}
} else {
timeout = radius_pair_create(request->reply, &request->reply->vps, PW_SESSION_TIMEOUT, 0);
- timeout->vp_integer = left;
+ timeout->vp_uint32 = left;
}
RDEBUG("reply:Session-Timeout set to %d", left);
case FR_TYPE_UINT16:
case FR_TYPE_UINT32:
case FR_TYPE_INT32:
- lua_pushinteger(L, vp->vp_integer);
+ lua_pushinteger(L, vp->vp_uint32);
break;
default:
}
case FR_TYPE_UINT32:
- vp->vp_integer = (uint32_t) lua_tointeger(L, -1);
+ vp->vp_uint32 = (uint32_t) lua_tointeger(L, -1);
break;
case FR_TYPE_IPV4_ADDR:
break;
case FR_TYPE_UINT8:
- vp->vp_byte = (uint8_t) lua_tointeger(L, -1);
+ vp->vp_uint8 = (uint8_t) lua_tointeger(L, -1);
break;
case FR_TYPE_UINT16:
/*
* Encode the value of 'Digest' as "S=" followed by
- * 40 ASCII hexadecimal digits and return it in
+ * 40 ASCII hexafloat64 digits and return it in
* AuthenticatorResponse.
* For example,
* "S=0123456789ABCDEF0123456789ABCDEF01234567"
response[1] = '=';
/*
- * The hexadecimal digits [A-F] MUST be uppercase.
+ * The hexafloat64 digits [A-F] MUST be uppercase.
*/
for (i = 0; i < sizeof(digest); i++) {
response[2 + (i * 2)] = hex[(digest[i] >> 4) & 0x0f];
if ((mschap_result == -648) ||
((mschap_result == 0) &&
- (smb_ctrl && ((smb_ctrl->vp_integer & ACB_PW_EXPIRED) != 0)))) {
+ (smb_ctrl && ((smb_ctrl->vp_uint32 & ACB_PW_EXPIRED) != 0)))) {
REDEBUG("Password has expired. User should retry authentication");
error = 648;
* return 'not found'.
*/
} else if ((mschap_result == -691) ||
- (smb_ctrl && (((smb_ctrl->vp_integer & ACB_DISABLED) != 0) ||
- ((smb_ctrl->vp_integer & (ACB_NORMAL|ACB_WSTRUST)) == 0)))) {
+ (smb_ctrl && (((smb_ctrl->vp_uint32 & ACB_DISABLED) != 0) ||
+ ((smb_ctrl->vp_uint32 & (ACB_NORMAL|ACB_WSTRUST)) == 0)))) {
REDEBUG("SMB-Account-Ctrl (or ntlm_auth) "
"says that the account is disabled, "
"or is not a normal or workstation trust account");
* User is locked out.
*/
} else if ((mschap_result == -647) ||
- (smb_ctrl && ((smb_ctrl->vp_integer & ACB_AUTOLOCK) != 0))) {
+ (smb_ctrl && ((smb_ctrl->vp_uint32 & ACB_AUTOLOCK) != 0))) {
REDEBUG("SMB-Account-Ctrl (or ntlm_auth) "
"says that the account is locked out");
error = 647;
*/
if (auth_method != AUTH_INTERNAL) {
VALUE_PAIR *vp = fr_pair_find_by_num(request->control, 0, PW_MS_CHAP_USE_NTLM_AUTH, TAG_ANY);
- if (vp && vp->vp_integer == 0) auth_method = AUTH_INTERNAL;
+ if (vp && vp->vp_uint32 == 0) auth_method = AUTH_INTERNAL;
}
/*
if (password) {
smb_ctrl = pair_make_config("SMB-Account-CTRL", "0", T_OP_SET);
if (smb_ctrl) {
- smb_ctrl->vp_integer = pdb_decode_acct_ctrl(password->vp_strvalue);
+ smb_ctrl->vp_uint32 = pdb_decode_acct_ctrl(password->vp_strvalue);
}
}
}
/*
* Password is not required.
*/
- if ((smb_ctrl->vp_integer & ACB_PWNOTREQ) != 0) {
+ if ((smb_ctrl->vp_uint32 & ACB_PWNOTREQ) != 0) {
RDEBUG2("SMB-Account-Ctrl says no password is required");
return RLM_MODULE_OK;
}
* obviously the password change action will need
* to have cleared this bit in the config/SQL/wherever.
*/
- if (smb_ctrl && smb_ctrl->vp_integer & ACB_PW_EXPIRED) {
+ if (smb_ctrl && smb_ctrl->vp_uint32 & ACB_PW_EXPIRED) {
RDEBUG("Clearing expiry bit in SMB-Acct-Ctrl to allow authentication");
- smb_ctrl->vp_integer &= ~ACB_PW_EXPIRED;
+ smb_ctrl->vp_uint32 &= ~ACB_PW_EXPIRED;
}
/*
* Auth-Type := Accept
* Auth-Type := Reject
*/
- if ((vp->vp_integer == 254) ||
- (vp->vp_integer == 4)) {
+ if ((vp->vp_uint32 == 254) ||
+ (vp->vp_uint32 == 4)) {
found_pw = true;
}
break;
*/
vp = fr_pair_find_by_num(request->packet->vps, 0, PW_EAP_TYPE, TAG_ANY);
if (vp &&
- ((vp->vp_integer == 13) || /* EAP-TLS */
- (vp->vp_integer == 21) || /* EAP-TTLS */
- (vp->vp_integer == 25))) { /* PEAP */
+ ((vp->vp_uint32 == 13) || /* EAP-TLS */
+ (vp->vp_uint32 == 21) || /* EAP-TTLS */
+ (vp->vp_uint32 == 25))) { /* PEAP */
return RLM_MODULE_NOOP;
}
if (inst->auth_type) {
vp = radius_pair_create(request, &request->control,
PW_AUTH_TYPE, 0);
- vp->vp_integer = inst->auth_type;
+ vp->vp_uint32 = inst->auth_type;
}
return RLM_MODULE_UPDATED;
int acctstatustype = 0;
if ((pair = fr_pair_find_by_num(request->packet->vps, 0, PW_ACCT_STATUS_TYPE, TAG_ANY)) != NULL) {
- acctstatustype = pair->vp_integer;
+ acctstatustype = pair->vp_uint32;
} else {
RDEBUG("Invalid Accounting Packet");
return RLM_MODULE_INVALID;
VALUE_PAIR *tmp;
tmp = fr_pair_find_by_num(vp, 0, PW_FALL_THROUGH, TAG_ANY);
- return tmp ? tmp->vp_integer : 0;
+ return tmp ? tmp->vp_uint32 : 0;
}
/*
return;
}
- if (nas_port->vp_integer > 9999) {
- service = nas_port->vp_integer/10000; /* 1=digital 2=analog */
- line = (nas_port->vp_integer - (10000 * service)) / 100;
- channel = nas_port->vp_integer - ((10000 * service) + (100 * line));
- nas_port->vp_integer = (channel - 1) + ((line - 1) * channels_per_line);
+ if (nas_port->vp_uint32 > 9999) {
+ service = nas_port->vp_uint32/10000; /* 1=digital 2=analog */
+ line = (nas_port->vp_uint32 - (10000 * service)) / 100;
+ channel = nas_port->vp_uint32 - ((10000 * service) + (100 * line));
+ nas_port->vp_uint32 = (channel - 1) + ((line - 1) * channels_per_line);
}
}
if (fr_pair_find_by_num(request_pairs, 0, PW_FRAMED_PROTOCOL, TAG_ANY) != NULL &&
fr_pair_find_by_num(request_pairs, 0, PW_SERVICE_TYPE, TAG_ANY) == NULL) {
tmp = radius_pair_create(request->packet, &request->packet->vps, PW_SERVICE_TYPE, 0);
- tmp->vp_integer = PW_FRAMED_USER;
+ tmp->vp_uint32 = PW_FRAMED_USER;
}
num_proxy_state = 0;
delay = fr_pair_find_by_num(request->packet->vps, 0, PW_ACCT_DELAY_TIME, TAG_ANY);
if (delay) {
- if ((delay->vp_integer >= vp->vp_date) || (delay->vp_integer == UINT32_MAX)) {
- RWARN("Ignoring invalid Acct-Delay-time of %u seconds", delay->vp_integer);
+ if ((delay->vp_uint32 >= vp->vp_date) || (delay->vp_uint32 == UINT32_MAX)) {
+ RWARN("Ignoring invalid Acct-Delay-time of %u seconds", delay->vp_uint32);
} else {
- vp->vp_date -= delay->vp_integer;
+ vp->vp_date -= delay->vp_uint32;
}
}
}
break;
case FR_TYPE_UINT32:
- value = PyLong_FromUnsignedLong(vp->vp_integer);
+ value = PyLong_FromUnsignedLong(vp->vp_uint32);
break;
case FR_TYPE_UINT8:
- value = PyLong_FromUnsignedLong(vp->vp_byte);
+ value = PyLong_FromUnsignedLong(vp->vp_uint8);
break;
case FR_TYPE_UINT16:
break;
case FR_TYPE_FLOAT64:
- value = PyFloat_FromDouble(vp->vp_decimal);
+ value = PyFloat_FromDouble(vp->vp_float64);
break;
case FR_TYPE_BOOL:
RDEBUG2("No Accounting-Status-Type record");
return RLM_MODULE_NOOP;
}
- status = vp->vp_integer;
+ status = vp->vp_uint32;
/*
* Look for weird reboot packets.
break;
case PW_FRAMED_PROTOCOL:
- protocol = vp->vp_integer;
+ protocol = vp->vp_uint32;
break;
case PW_NAS_IP_ADDRESS:
break;
case PW_NAS_PORT:
- ut.nas_port = vp->vp_integer;
+ ut.nas_port = vp->vp_uint32;
port_seen = true;
break;
case PW_ACCT_DELAY_TIME:
- ut.delay = vp->vp_integer;
+ ut.delay = vp->vp_uint32;
break;
case PW_ACCT_SESSION_ID:
break;
case PW_NAS_PORT_TYPE:
- if (vp->vp_integer <= 4)
- ut.porttype = porttypes[vp->vp_integer];
+ if (vp->vp_uint32 <= 4)
+ ut.porttype = porttypes[vp->vp_uint32];
break;
case PW_CALLING_STATION_ID:
}
else if (reply->integer > UINT16_MAX) { /* 32bit unsigned (supported) */
in.type = FR_TYPE_UINT32;
- in.datum.integer = (uint32_t) reply->integer;
+ in.datum.uint32 = (uint32_t) reply->integer;
}
else if (reply->integer > UINT8_MAX) { /* 16bit unsigned (supported) */
in.type = FR_TYPE_UINT16;
}
else { /* 8bit unsigned (supported) */
in.type = FR_TYPE_UINT8;
- in.datum.byte = (uint8_t) reply->integer;
+ in.datum.uint8 = (uint8_t) reply->integer;
}
break;
memset(&tmp, 0, sizeof(tmp));
- tmp.datum.integer = ntohl((uint32_t)reply->element[1]->integer);
+ tmp.datum.uint32 = ntohl((uint32_t)reply->element[1]->integer);
tmp.type = FR_TYPE_UINT32;
if (fr_value_box_cast(NULL, &ip_map.rhs->tmpl_value_box, FR_TYPE_IPV4_ADDR,
goto finish;
}
} else {
- ip_map.rhs->tmpl_fr_value_box_datum.integer = ntohl((uint32_t)reply->element[1]->integer);
+ ip_map.rhs->tmpl_fr_value_box_datum.uint32 = ntohl((uint32_t)reply->element[1]->integer);
ip_map.rhs->tmpl_fr_value_box_type = FR_TYPE_UINT32;
}
}
goto finish;
}
- expiry_map.rhs->tmpl_fr_value_box_datum.integer = reply->element[3]->integer;
+ expiry_map.rhs->tmpl_fr_value_box_datum.uint32 = reply->element[3]->integer;
expiry_map.rhs->tmpl_fr_value_box_type = FR_TYPE_UINT32;
if (map_to_request(request, &expiry_map, map_to_vp, NULL) < 0) {
ret = IPPOOL_RCODE_FAIL;
.rhs = &expiry_rhs
};
- expiry_map.rhs->tmpl_fr_value_box_datum.integer = expires;
+ expiry_map.rhs->tmpl_fr_value_box_datum.uint32 = expires;
expiry_map.rhs->tmpl_fr_value_box_type = FR_TYPE_UINT32;
if (map_to_request(request, &expiry_map, map_to_vp, NULL) < 0) {
ret = IPPOOL_RCODE_FAIL;
* Pool-Action override
*/
vp = fr_pair_find_by_num(request->control, 0, PW_POOL_ACTION, TAG_ANY);
- if (vp) return mod_action(inst, request, vp->vp_integer);
+ if (vp) return mod_action(inst, request, vp->vp_uint32);
/*
* Otherwise, guess the action by Acct-Status-Type
return RLM_MODULE_NOOP;
}
- switch (vp->vp_integer) {
+ switch (vp->vp_uint32) {
case PW_STATUS_START:
case PW_STATUS_ALIVE:
return mod_action(inst, request, POOL_ACTION_UPDATE);
* when called in Post-Auth.
*/
vp = fr_pair_find_by_num(request->control, 0, PW_POOL_ACTION, TAG_ANY);
- return mod_action(inst, request, vp ? vp->vp_integer : POOL_ACTION_ALLOCATE);
+ return mod_action(inst, request, vp ? vp->vp_uint32 : POOL_ACTION_ALLOCATE);
}
static rlm_rcode_t mod_post_auth(void *instance, UNUSED void *thread, REQUEST *request) CC_HINT(nonnull);
* when called in Post-Auth.
*/
vp = fr_pair_find_by_num(request->control, 0, PW_POOL_ACTION, TAG_ANY);
- return mod_action(inst, request, vp ? vp->vp_integer : POOL_ACTION_ALLOCATE);
+ return mod_action(inst, request, vp ? vp->vp_uint32 : POOL_ACTION_ALLOCATE);
}
static int mod_instantiate(CONF_SECTION *conf, void *instance)
return RLM_MODULE_NOOP;
}
- dv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_integer);
+ dv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_uint32);
if (!dv) {
- RDEBUG("Unknown Acct-Status-Type %u", vp->vp_integer);
+ RDEBUG("Unknown Acct-Status-Type %u", vp->vp_uint32);
return RLM_MODULE_NOOP;
}
case json_type_double:
if (flags->do_xlat) RWDEBUG("Ignoring do_xlat on 'double', attribute \"%s\"", da->name);
- src.datum.decimal = json_object_get_double(leaf);
+ src.datum.float64 = json_object_get_double(leaf);
src.type = FR_TYPE_FLOAT64;
break;
RDEBUG2("&REST-HTTP-Status-Code := %i", code);
REXDENT();
- value.datum.integer = code;
+ value.datum.uint32 = code;
/*
* Find the reply list, and appropriate context in the
vp = fr_pair_afrom_num(request->reply, 0, PW_PROMPT);
rad_assert(vp != NULL);
- vp->vp_integer = 0; /* no echo */
+ vp->vp_uint32 = 0; /* no echo */
fr_pair_add(&request->reply->vps, vp);
/* Mark the packet as a Acceess-Challenge Packet */
vp[4] = fr_pair_find_by_num(request->packet->vps, 0, PW_SOH_MS_MACHINE_SP_VERSION, TAG_ANY);
vp[5] = fr_pair_find_by_num(request->packet->vps, 0, PW_SOH_MS_MACHINE_SP_RELEASE, TAG_ANY);
- if (vp[0] && vp[0]->vp_integer == VENDORPEC_MICROSOFT) {
+ if (vp[0] && vp[0]->vp_uint32 == VENDORPEC_MICROSOFT) {
if (!vp[1]) {
snprintf(*out, outlen, "Windows unknown");
} else {
- switch (vp[1]->vp_integer) {
+ switch (vp[1]->vp_uint32) {
case 7:
osname = "7";
break;
osname = "Other";
break;
}
- snprintf(*out, outlen, "Windows %s %d.%d.%d sp %d.%d", osname, vp[1]->vp_integer,
- vp[2] ? vp[2]->vp_integer : 0,
- vp[3] ? vp[3]->vp_integer : 0,
- vp[4] ? vp[4]->vp_integer : 0,
- vp[5] ? vp[5]->vp_integer : 0);
+ snprintf(*out, outlen, "Windows %s %d.%d.%d sp %d.%d", osname, vp[1]->vp_uint32,
+ vp[2] ? vp[2]->vp_uint32 : 0,
+ vp[3] ? vp[3]->vp_uint32 : 0,
+ vp[4] ? vp[4]->vp_uint32 : 0,
+ vp[5] ? vp[5]->vp_uint32 : 0);
}
return strlen(*out);
}
VALUE_PAIR *tmp;
tmp = fr_pair_find_by_num(vp, 0, PW_FALL_THROUGH, TAG_ANY);
- return tmp ? tmp->vp_integer : FALL_THROUGH_DEFAULT;
+ return tmp ? tmp->vp_uint32 : FALL_THROUGH_DEFAULT;
}
/*
RDEBUG2("Time remaining (%" PRIu64 "s) is greater than time to reset (%" PRIu64 "s). "
"Adding %" PRIu64 "s to reply value", to_reset, res, to_reset);
- res = to_reset + limit->vp_integer;
+ res = to_reset + limit->vp_uint32;
}
/*
vp = fr_pair_find_by_num(request->packet->vps, 0, PW_ACCT_STATUS_TYPE, TAG_ANY);
if (vp) {
- acct_type = vp->vp_integer;
+ acct_type = vp->vp_uint32;
}
else {
REDEBUG("Couldn't find type of accounting packet");
RDEBUG("Could not find account status type in packet");
return RLM_MODULE_NOOP;
}
- acct_status_type = vp->vp_integer;
+ acct_status_type = vp->vp_uint32;
switch (acct_status_type) {
case PW_STATUS_START:
RDEBUG("no Accounting-Status-Type attribute in request");
return RLM_MODULE_NOOP;
}
- status = vp->vp_integer;
+ status = vp->vp_uint32;
/*
* FIXME: handle PW_STATUS_ALIVE like 1.5.4.3 did.
break;
#ifdef USER_PROCESS
case PW_FRAMED_PROTOCOL:
- protocol = vp->vp_integer;
+ protocol = vp->vp_uint32;
break;
#endif
case PW_NAS_IP_ADDRESS:
break;
case PW_NAS_PORT:
- nas_port = vp->vp_integer;
+ nas_port = vp->vp_uint32;
port_seen = true;
break;
offset = (int) strtoul(data_size, &p, 10);
if (*p) {
- REDEBUG("unpack requires a decimal number, not '%s'", data_size);
+ REDEBUG("unpack requires a float64 number, not '%s'", data_size);
goto nothing;
}
case FR_TYPE_INT32:
case FR_TYPE_UINT32:
case FR_TYPE_DATE:
- cast->vp_integer = ntohl(cast->vp_integer);
+ cast->vp_uint32 = ntohl(cast->vp_uint32);
break;
case FR_TYPE_UINT16:
RWDEBUG("Not calculating MN-HA keys");
}
- if (vp) switch (vp->vp_integer) {
+ if (vp) switch (vp->vp_uint32) {
case 2: /* PMIP4 */
/*
* Look for WiMAX-hHA-IP-MIP4
RWDEBUG("Failed creating WiMAX-MN-hHA-MIP4-SPI");
break;
}
- vp->vp_integer = mip_spi + 1;
+ vp->vp_uint32 = mip_spi + 1;
break;
case 3: /* CMIP4 */
RWDEBUG("Failed creating WiMAX-MN-hHA-MIP4-SPI");
break;
}
- vp->vp_integer = mip_spi;
+ vp->vp_uint32 = mip_spi;
break;
case 4: /* CMIP6 */
RWDEBUG("Failed creating WiMAX-MN-hHA-MIP6-SPI");
break;
}
- vp->vp_integer = mip_spi + 2;
+ vp->vp_uint32 = mip_spi + 2;
break;
default:
if (!vp) {
RWDEBUG("Failed creating WiMAX-FA-RK-SPI");
} else {
- vp->vp_integer = mip_spi;
+ vp->vp_uint32 = mip_spi;
}
}
* WiMAX-HA-RK-Key-Requested
*/
vp = fr_pair_find_by_num(request->packet->vps, VENDORPEC_WIMAX, 58, TAG_ANY);
- if (vp && (vp->vp_integer == 1)) {
+ if (vp && (vp->vp_uint32 == 1)) {
RDEBUG("Client requested HA-RK: Should use IP to look it up from storage");
}
}
return RLM_MODULE_FAIL;
}
- vp->vp_integer = timestamp;
+ vp->vp_uint32 = timestamp;
/*
* Token random
return RLM_MODULE_FAIL;
}
- vp->vp_integer = token.rnd;
+ vp->vp_uint32 = token.rnd;
/*
* Combine the two counter fields together so we can do
return RLM_MODULE_FAIL;
}
- vp->vp_integer = counter;
+ vp->vp_uint32 = counter;
/*
* Now we check for replay attacks
return RLM_MODULE_OK;
}
- if (counter <= vp->vp_integer) {
+ if (counter <= vp->vp_uint32) {
REDEBUG("Replay attack detected! Counter value %u, is lt or eq to last known counter value %u",
- counter, vp->vp_integer);
+ counter, vp->vp_uint32);
return RLM_MODULE_REJECT;
}
dval = fr_dict_enum_by_name(NULL, fr_dict_attr_by_num(NULL, 0, PW_AUTH_TYPE), inst->name);
if (dval) {
vp = radius_pair_create(request, &request->control, PW_AUTH_TYPE, 0);
- vp->vp_integer = dval->value;
+ vp->vp_uint32 = dval->value;
}
return RLM_MODULE_OK;
break;
case FR_TYPE_UINT8:
- vp->vp_byte = p[0];
+ vp->vp_uint8 = p[0];
break;
case FR_TYPE_UINT16:
break;
case FR_TYPE_UINT32:
- memcpy(&vp->vp_integer, p, 4);
- vp->vp_integer = ntohl(vp->vp_integer);
+ memcpy(&vp->vp_uint32, p, 4);
+ vp->vp_uint32 = ntohl(vp->vp_uint32);
break;
case FR_TYPE_UINT64:
memcpy(&vp->vp_ip, &tmp_prefix, sizeof(vp->vp_ip));
break;
- case FR_TYPE_INT32: /* overloaded with vp_integer */
- memcpy(&vp->vp_integer, p, 4);
- vp->vp_integer = ntohl(vp->vp_integer);
+ case FR_TYPE_INT32: /* overloaded with vp_uint32 */
+ memcpy(&vp->vp_uint32, p, 4);
+ vp->vp_uint32 = ntohl(vp->vp_uint32);
break;
default:
break;
case FR_TYPE_BOOL:
- out[0] = vp->vp_byte & 0x01;
+ out[0] = vp->vp_uint8 & 0x01;
break;
case FR_TYPE_UINT8:
- out[0] = vp->vp_byte & 0xff;
+ out[0] = vp->vp_uint8 & 0xff;
break;
case FR_TYPE_UINT16:
break;
case FR_TYPE_UINT32:
- lvalue = htonl(vp->vp_integer);
+ lvalue = htonl(vp->vp_uint32);
memcpy(out, &lvalue, sizeof(lvalue));
break;