fr_pair_list_init(&vps);
if (!init) LLVMFuzzerInitialize(NULL, NULL);
- if (tp->test_ctx && (tp->test_ctx(&decode_ctx, NULL, dict) < 0)) {
+ if (tp->test_ctx && (tp->test_ctx(&decode_ctx, NULL, dict, NULL) < 0)) {
fr_perror("fuzzer: Failed initializing test point decode_ctx");
fr_exit_now(EXIT_FAILURE);
}
p += slen;
fr_skip_whitespace(p);
- if (tp->test_ctx && (tp->test_ctx(&decode_ctx, cc->tmp_ctx, dictionary_current(cc)) < 0)) {
+ if (tp->test_ctx && (tp->test_ctx(&decode_ctx, cc->tmp_ctx, dictionary_current(cc), NULL) < 0)) {
fr_strerror_const_push("Failed initialising decoder testpoint");
RETURN_COMMAND_ERROR();
}
p += slen;
fr_skip_whitespace(p);
- if (tp->test_ctx && (tp->test_ctx(&decode_ctx, cc->tmp_ctx, dictionary_current(cc)) < 0)) {
+ if (tp->test_ctx && (tp->test_ctx(&decode_ctx, cc->tmp_ctx, dictionary_current(cc), NULL) < 0)) {
fr_strerror_const_push("Failed initialising decoder testpoint");
RETURN_COMMAND_ERROR();
}
fr_skip_whitespace(p);
}
- if (tp->test_ctx && (tp->test_ctx(&encode_ctx, cc->tmp_ctx, dictionary_current(cc)) < 0)) {
+ if (tp->test_ctx && (tp->test_ctx(&encode_ctx, cc->tmp_ctx, dictionary_current(cc), NULL) < 0)) {
fr_strerror_const_push("Failed initialising encoder testpoint");
CLEAR_TEST_POINT(cc);
RETURN_COMMAND_ERROR();
p += ((size_t)slen);
fr_skip_whitespace(p);
- if (tp->test_ctx && (tp->test_ctx(&encode_ctx, cc->tmp_ctx, dictionary_current(cc)) < 0)) {
+ if (tp->test_ctx && (tp->test_ctx(&encode_ctx, cc->tmp_ctx, dictionary_current(cc), NULL) < 0)) {
fr_strerror_const_push("Failed initialising encoder testpoint");
CLEAR_TEST_POINT(cc);
RETURN_COMMAND_ERROR();
/*
* Test ctx data
*/
-static int decode_test_ctx_sim(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int decode_test_ctx_sim(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_aka_sim_ctx_t *test_ctx;
static uint8_t k_encr[] = { 0x00, 0x01, 0x02, 0x03, 0x04 ,0x05, 0x06, 0x07,
}
-static int decode_test_ctx_aka(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int decode_test_ctx_aka(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_aka_sim_ctx_t *test_ctx;
static uint8_t k_encr[] = { 0x00, 0x01, 0x02, 0x03, 0x04 ,0x05, 0x06, 0x07,
return 0;
}
-static int decode_test_ctx_sim_rfc4186(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int decode_test_ctx_sim_rfc4186(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_aka_sim_ctx_t *test_ctx;
static uint8_t k_encr[] = { 0x53, 0x6e, 0x5e, 0xbc, 0x44 ,0x65, 0x58, 0x2a,
/*
* Test ctx data
*/
-static int encode_test_ctx_sim(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int encode_test_ctx_sim(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_aka_sim_ctx_t *test_ctx;
static uint8_t k_encr[] = { 0x00, 0x01, 0x02, 0x03, 0x04 ,0x05, 0x06, 0x07,
return 0;
}
-static int encode_test_ctx_aka(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int encode_test_ctx_aka(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_aka_sim_ctx_t *test_ctx;
static uint8_t k_encr[] = { 0x00, 0x01, 0x02, 0x03, 0x04 ,0x05, 0x06, 0x07,
return 0;
}
-static int encode_test_ctx_sim_rfc4186(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int encode_test_ctx_sim_rfc4186(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_aka_sim_ctx_t *test_ctx;
static uint8_t k_encr[] = { 0x53, 0x6e, 0x5e, 0xbc, 0x44 ,0x65, 0x58, 0x2a,
* @param[out] out Where the decoder context should be written.
* @param[in] ctx to allocate the test point context in.
* @param[in] dict the default dictionary context for the test point
+ * @param[in] root_da Optional root DA for the encoder/decoder ctx.
* @return proto or pair encoder or decoder ctx.
*/
-typedef int (*fr_test_point_ctx_alloc_t)(void **out, TALLOC_CTX *ctx, fr_dict_t const *dict);
+typedef int (*fr_test_point_ctx_alloc_t)(void **out, TALLOC_CTX *ctx, fr_dict_t const *dict, fr_dict_attr_t const *root_da);
/** A generic interface for decoding packets to fr_pair_ts
*
}
if (tp_decode->test_ctx) {
- if (tp_decode->test_ctx(&decode_ctx, ctx, request->proto_dict) < 0) {
+ if (tp_decode->test_ctx(&decode_ctx, ctx, request->proto_dict, NULL) < 0) {
return XLAT_ACTION_FAIL;
}
}
* Create the encoding context.
*/
if (tp_encode->test_ctx) {
- if (tp_encode->test_ctx(&encode_ctx, cursor, request->proto_dict) < 0) {
+ if (tp_encode->test_ctx(&encode_ctx, cursor, request->proto_dict, NULL) < 0) {
return XLAT_ACTION_FAIL;
}
}
#include <freeradius-devel/io/test_point.h>
-static int decode_test_ctx(void **out, UNUSED TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int decode_test_ctx(void **out, UNUSED TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
*out = NULL;
return 0;
bool tmp;
} fr_arp_ctx_t;
-static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_arp_ctx_t *test_ctx;
return slen;
}
-static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_bfd_ctx_t *test_ctx;
}
-static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_bfd_ctx_t *test_ctx;
.func = decode_pair
};
-static int decode_test_ctx(void **out, UNUSED TALLOC_CTX *ctx, fr_dict_t const *dict)
+static int decode_test_ctx(void **out, UNUSED TALLOC_CTX *ctx, fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
*out = UNCONST(fr_dict_t *, dict);
/*
* Test points
*/
-static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_der_decode_ctx_t *test_ctx;
/*
* Test points
*/
-static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_der_encode_ctx_t *test_ctx;
}
-static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ fr_dict_attr_t const *root_da)
{
fr_dhcpv4_ctx_t *test_ctx;
test_ctx = talloc_zero(ctx, fr_dhcpv4_ctx_t);
test_ctx->tmp_ctx = talloc(test_ctx, uint8_t);
+ test_ctx->root = root_da;
*out = test_ctx;
return fr_dhcpv4_encode_dbuff(&FR_DBUFF_TMP(data, data_len), NULL, 0, 0, vps);
}
-static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ fr_dict_attr_t const *root_da)
{
fr_dhcpv4_ctx_t *test_ctx;
test_ctx = talloc_zero(ctx, fr_dhcpv4_ctx_t);
if (!test_ctx) return -1;
- test_ctx->root = fr_dict_root(dict_dhcpv4);
+ test_ctx->root = root_da ? root_da : fr_dict_root(dict_dhcpv4);
*out = test_ctx;
return data_len;
}
-static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_dhcpv6_decode_ctx_t *test_ctx;
}
-static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_dhcpv6_encode_ctx_t *test_ctx;
/*
* Test points
*/
-static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_dns_ctx_t *test_ctx;
return fr_dbuff_set(dbuff, &work_dbuff);
}
-static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_dns_ctx_t *test_ctx;
return 0;
}
-static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
static uint8_t vector[RADIUS_AUTH_VECTOR_LENGTH] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
}
-static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
static uint8_t vector[RADIUS_AUTH_VECTOR_LENGTH] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
return 0;
}
-static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_tacacs_ctx_t *test_ctx;
return 0;
}
-static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_tacacs_ctx_t *test_ctx;
return 0;
}
-static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_tftp_ctx_t *test_ctx;
return 0;
}
-static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_tftp_ctx_t *test_ctx;
return 0;
}
-static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_vmps_ctx_t *test_ctx;
return 0;
}
-static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict)
+static int encode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict,
+ UNUSED fr_dict_attr_t const *root_da)
{
fr_vmps_ctx_t *test_ctx;