From: Arran Cudbard-Bell Date: Wed, 27 Jun 2018 00:54:22 +0000 (-0400) Subject: Add "parent" or "base" pointer to custom parsing functions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e9ce147c33dffc2590cebebf2efdaa86776acd9;p=thirdparty%2Ffreeradius-server.git Add "parent" or "base" pointer to custom parsing functions This allows parsing functions to access fields in the structure for previously parsed values... and potentially adds ordering issues, so don't reorder the CONF_PARSER entries that have functions! --- diff --git a/src/include/cf_parse.h b/src/include/cf_parse.h index 02149601d0d..4a12b98d097 100644 --- a/src/include/cf_parse.h +++ b/src/include/cf_parse.h @@ -355,13 +355,14 @@ typedef struct CONF_PARSER CONF_PARSER; * * @param[in] ctx to allocate any data in. * @param[out] out Where to write the result of parsing. + * @param[in] parent The base address of the structure. * @param[in] ci The #CONF_SECTION or #CONF_PAIR to parse. * @param[in] rule Parse rules - How the #CONF_PAIR or #CONF_SECTION should be converted. * @return * - 0 on success. * - -1 on failure. */ -typedef int (* cf_parse_t)(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); +typedef int (* cf_parse_t)(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); /** Defines a #CONF_PAIR to C data type mapping * @@ -452,8 +453,8 @@ struct CONF_PARSER { /* * Type validation and conversion */ -int cf_pair_parse_value(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule) - CC_HINT(nonnull(2, 3, 4)); +int cf_pair_parse_value(TALLOC_CTX *ctx, void *out, void *base, CONF_ITEM *ci, CONF_PARSER const *rule) + CC_HINT(nonnull(2, 4, 5)); int cf_pair_parse(TALLOC_CTX *ctx, CONF_SECTION *cs, char const *name, unsigned int type, void *data, char const *dflt, FR_TOKEN dflt_quote) CC_HINT(nonnull(2,3)); int cf_section_parse(TALLOC_CTX *ctx, void *base, CONF_SECTION *cs); diff --git a/src/lib/tls/conf.c b/src/lib/tls/conf.c index 827ac6cfc3b..c99b9014e79 100644 --- a/src/lib/tls/conf.c +++ b/src/lib/tls/conf.c @@ -61,9 +61,11 @@ static const FR_NAME_NUMBER chain_verify_mode_table[] = { #endif #if OPENSSL_VERSION_NUMBER >= 0x10002000L -static int chain_verify_mode_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int chain_verify_mode_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); #endif -static int certificate_format_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int certificate_format_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); static CONF_PARSER cache_config[] = { { FR_CONF_OFFSET("virtual_server", FR_TYPE_STRING, fr_tls_conf_t, session_cache_server) }, @@ -227,7 +229,8 @@ CONF_PARSER tls_client_config[] = { * - 0 on success. * - -1 on failure. */ -static int chain_verify_mode_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int chain_verify_mode_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { fr_tls_chain_verify_mode_t type; char const *type_str; @@ -255,7 +258,8 @@ static int chain_verify_mode_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM * - 0 on success. * - -1 on failure. */ -static int certificate_format_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int certificate_format_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { int type; char const *type_str; diff --git a/src/main/cf_parse.c b/src/main/cf_parse.c index ee297656145..46a8b6e3dac 100644 --- a/src/main/cf_parse.c +++ b/src/main/cf_parse.c @@ -109,13 +109,15 @@ static inline int CC_HINT(nonnull) fr_item_validate_ipaddr(CONF_SECTION *cs, cha * * @param[in] ctx to allocate any dynamic buffers in. * @param[out] out Where to write the parsed value. + * @param[in] base address of the structure out points into. + * May be NULL in the case of manual parsing. * @param[in] ci to parse. * @param[in] rule to parse to. May contain flags. * @return * - 0 on success. * - -1 on failure. */ -int cf_pair_parse_value(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule) +int cf_pair_parse_value(TALLOC_CTX *ctx, void *out, UNUSED void *base, CONF_ITEM *ci, CONF_PARSER const *rule) { int rcode = 0; bool attribute, required, secret, file_input, cant_be_empty, tmpl, file_exists; @@ -504,6 +506,8 @@ static int cf_pair_default(CONF_PAIR **out, CONF_SECTION *cs, char const *name, * * @param[in] ctx To allocate arrays and values in. * @param[out] out Where to write the result. + * @param[in] base address of the structure out points into. + * May be NULL in the case of manual parsing. * @param[in] cs to search for matching #CONF_PAIR in. * @param[in] rule to parse #CONF_PAIR with. * @return @@ -512,7 +516,7 @@ static int cf_pair_default(CONF_PAIR **out, CONF_SECTION *cs, char const *name, * - -1 on error. * - -2 if deprecated. */ -static int CC_HINT(nonnull(3,4)) cf_pair_parse_internal(TALLOC_CTX *ctx, void *out, +static int CC_HINT(nonnull(4,5)) cf_pair_parse_internal(TALLOC_CTX *ctx, void *out, void *base, CONF_SECTION *cs, CONF_PARSER const *rule) { bool multi, required, deprecated; @@ -680,7 +684,7 @@ static int CC_HINT(nonnull(3,4)) cf_pair_parse_internal(TALLOC_CTX *ctx, void *o func = cf_pair_parse_value; } - ret = func(value_ctx, entry, cf_pair_to_item(cp), rule); + ret = func(value_ctx, entry, base, cf_pair_to_item(cp), rule); if (ret < 0) { talloc_free(array); talloc_free(dflt_cp); @@ -730,7 +734,7 @@ static int CC_HINT(nonnull(3,4)) cf_pair_parse_internal(TALLOC_CTX *ctx, void *o func = rule->func; } - ret = func(ctx, out, cf_pair_to_item(cp), rule); + ret = func(ctx, out, base, cf_pair_to_item(cp), rule); if (ret < 0) { talloc_free(dflt_cp); return -1; @@ -830,7 +834,7 @@ int cf_pair_parse(TALLOC_CTX *ctx, CONF_SECTION *cs, char const *name, .quote = dflt_quote }; - return cf_pair_parse_internal(ctx, data, cs, &rule); + return cf_pair_parse_internal(ctx, data, NULL, cs, &rule); } /** Pre-allocate a config section structure to allow defaults to be set @@ -957,16 +961,18 @@ static void cf_section_parse_warn(CONF_SECTION *cs) * For now we have a horrible hack where only multi-subsections get an array of structures * of the appropriate size. * - * @param[in] ctx to allocate any additional structures under. - * @param[out] out pointer to a struct/pointer to fill with data. - * @param[in] cs to parse. - * @param[in] rule to parse the subcs with. + * @param[in] ctx to allocate any additional structures under. + * @param[out] out pointer to a struct/pointer to fill with data. + * @param[in] base address of the structure out points into. + * May be NULL in the case of manual parsing. + * @param[in] cs to parse. + * @param[in] rule to parse the subcs with. * @return * - 0 on success. * - -1 on general error. * - -2 if a deprecated #CONF_ITEM was found. */ -static int cf_subsection_parse(TALLOC_CTX *ctx, void *out, CONF_SECTION *cs, CONF_PARSER const *rule) +static int cf_subsection_parse(TALLOC_CTX *ctx, void *out, void *base, CONF_SECTION *cs, CONF_PARSER const *rule) { CONF_SECTION *subcs = NULL; int count = 0, i = 0, ret; @@ -996,7 +1002,7 @@ static int cf_subsection_parse(TALLOC_CTX *ctx, void *out, CONF_SECTION *cs, CON * if it wants to continue after doing its stuff. */ if (cf_section_rules_push(subcs, rules) < 0) return -1; - if (rule->func) return rule->func(ctx, out, cf_section_to_item(subcs), rule); + if (rule->func) return rule->func(ctx, out, base, cf_section_to_item(subcs), rule); /* * FIXME: We shouldn't allow nested structures like this. @@ -1066,7 +1072,7 @@ static int cf_subsection_parse(TALLOC_CTX *ctx, void *out, CONF_SECTION *cs, CON return -1; } if (rule->func) { - ret = rule->func(ctx, buff, cf_section_to_item(subcs), rule); + ret = rule->func(ctx, buff, base, cf_section_to_item(subcs), rule); if (ret < 0) { talloc_free(array); return ret; @@ -1135,7 +1141,7 @@ int cf_section_parse(TALLOC_CTX *ctx, void *base, CONF_SECTION *cs) * Handle subsections specially */ if (FR_BASE_TYPE(rule->type) == FR_TYPE_SUBSECTION) { - ret = cf_subsection_parse(ctx, data, cs, rule); + ret = cf_subsection_parse(ctx, data, base, cs, rule); if (ret < 0) goto finish; continue; } /* else it's a CONF_PAIR */ @@ -1161,7 +1167,7 @@ int cf_section_parse(TALLOC_CTX *ctx, void *base, CONF_SECTION *cs) /* * Parse the pair we found, or a default value. */ - ret = cf_pair_parse_internal(ctx, data, cs, rule); + ret = cf_pair_parse_internal(ctx, data, base, cs, rule); switch (ret) { case 1: /* Used default (or not present) */ if (is_set) *is_set = false; diff --git a/src/main/cf_util.c b/src/main/cf_util.c index 8660c75d87e..9de500b74e3 100644 --- a/src/main/cf_util.c +++ b/src/main/cf_util.c @@ -762,7 +762,7 @@ CONF_SECTION *_cf_section_alloc(TALLOC_CTX *ctx, CONF_SECTION *parent, ((rule_p->type & FR_TYPE_ON_READ) != 0) && (strcmp(rule_p->name, name1) == 0)) { (void) _cf_section_rule_push(cs, rule_p, cd->item.filename, cd->item.lineno); - (void) rule_p->func(ctx, NULL, cf_section_to_item(cs), rule_p); + (void) rule_p->func(ctx, NULL, NULL, cf_section_to_item(cs), rule_p); return cs; } } @@ -782,7 +782,7 @@ CONF_SECTION *_cf_section_alloc(TALLOC_CTX *ctx, CONF_SECTION *parent, ((rule->type & FR_TYPE_ON_READ) != 0)) { (void) cf_section_rules_push(cs, rule); - (void) rule->func(ctx, NULL, cf_section_to_item(cs), rule); + (void) rule->func(ctx, NULL, NULL, cf_section_to_item(cs), rule); } } } diff --git a/src/main/mainconfig.c b/src/main/mainconfig.c index ad85c7077c0..afe589d98b1 100644 --- a/src/main/mainconfig.c +++ b/src/main/mainconfig.c @@ -63,18 +63,18 @@ fr_log_t debug_log = { .fd = -1, .dst = L_DST_NULL }; * **********************************************************************/ -static int reverse_lookups_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); -static int hostname_lookups_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); +static int reverse_lookups_parse(TALLOC_CTX *ctx, void *out, void *parent,CONF_ITEM *ci, CONF_PARSER const *rule); +static int hostname_lookups_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); -static int num_networks_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); -static int num_workers_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); +static int num_networks_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); +static int num_workers_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); -static int talloc_memory_limit_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); -static int talloc_pool_size_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); +static int talloc_memory_limit_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); +static int talloc_pool_size_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); -static int max_request_time_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); +static int max_request_time_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); -static int name_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); +static int name_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); /* * Log destinations @@ -237,34 +237,37 @@ static const CONF_PARSER switch_users_config[] = { CONF_PARSER_TERMINATOR }; -static int reverse_lookups_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule) +static int reverse_lookups_parse(TALLOC_CTX *ctx, void *out, void *parent, + CONF_ITEM *ci, CONF_PARSER const *rule) { int ret; - if ((ret = cf_pair_parse_value(ctx, out, ci, rule)) < 0) return ret; + if ((ret = cf_pair_parse_value(ctx, out, parent, ci, rule)) < 0) return ret; memcpy(&fr_reverse_lookups, out, sizeof(fr_reverse_lookups)); return 0; } -static int hostname_lookups_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule) +static int hostname_lookups_parse(TALLOC_CTX *ctx, void *out, void *parent, + CONF_ITEM *ci, CONF_PARSER const *rule) { int ret; - if ((ret = cf_pair_parse_value(ctx, out, ci, rule)) < 0) return ret; + if ((ret = cf_pair_parse_value(ctx, out, parent, ci, rule)) < 0) return ret; memcpy(&fr_hostname_lookups, out, sizeof(fr_hostname_lookups)); return 0; } -static int talloc_memory_limit_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule) +static int talloc_memory_limit_parse(TALLOC_CTX *ctx, void *out, void *parent, + CONF_ITEM *ci, CONF_PARSER const *rule) { int ret; size_t value; - if ((ret = cf_pair_parse_value(ctx, out, ci, rule)) < 0) return ret; + if ((ret = cf_pair_parse_value(ctx, out, parent, ci, rule)) < 0) return ret; memcpy(&value, out, sizeof(value)); @@ -281,12 +284,13 @@ static int talloc_memory_limit_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, return 0; } -static int talloc_pool_size_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule) +static int talloc_pool_size_parse(TALLOC_CTX *ctx, void *out, void *parent, + CONF_ITEM *ci, CONF_PARSER const *rule) { int ret; size_t value; - if ((ret = cf_pair_parse_value(ctx, out, ci, rule)) < 0) return ret; + if ((ret = cf_pair_parse_value(ctx, out, parent, ci, rule)) < 0) return ret; memcpy(&value, out, sizeof(value)); @@ -298,12 +302,13 @@ static int talloc_pool_size_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CON return 0; } -static int max_request_time_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule) +static int max_request_time_parse(TALLOC_CTX *ctx, void *out, void *parent, + CONF_ITEM *ci, CONF_PARSER const *rule) { int ret; uint32_t value; - if ((ret = cf_pair_parse_value(ctx, out, ci, rule)) < 0) return ret; + if ((ret = cf_pair_parse_value(ctx, out, parent, ci, rule)) < 0) return ret; memcpy(&value, out, sizeof(value)); @@ -315,12 +320,13 @@ static int max_request_time_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CON } -static int num_networks_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule) +static int num_networks_parse(TALLOC_CTX *ctx, void *out, void *parent, + CONF_ITEM *ci, CONF_PARSER const *rule) { int ret; uint32_t value; - if ((ret = cf_pair_parse_value(ctx, out, ci, rule)) < 0) return ret; + if ((ret = cf_pair_parse_value(ctx, out, parent, ci, rule)) < 0) return ret; memcpy(&value, out, sizeof(value)); @@ -331,12 +337,13 @@ static int num_networks_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PA return 0; } -static int num_workers_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule) +static int num_workers_parse(TALLOC_CTX *ctx, void *out, void *parent, + CONF_ITEM *ci, CONF_PARSER const *rule) { int ret; uint32_t value; - if ((ret = cf_pair_parse_value(ctx, out, ci, rule)) < 0) return ret; + if ((ret = cf_pair_parse_value(ctx, out, parent, ci, rule)) < 0) return ret; memcpy(&value, out, sizeof(value)); @@ -351,11 +358,12 @@ static int num_workers_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PAR /** Configured server name takes precedence over default values * */ -static int name_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule) +static int name_parse(TALLOC_CTX *ctx, void *out, void *parent, + CONF_ITEM *ci, CONF_PARSER const *rule) { if (*((char **)out)) talloc_free(*((char **)out)); /* Free existing buffer */ - return cf_pair_parse_value(ctx, out, ci, rule); /* Set new value */ + return cf_pair_parse_value(ctx, out, parent, ci, rule); /* Set new value */ } diff --git a/src/main/virtual_servers.c b/src/main/virtual_servers.c index 167e71ae118..9f0aabec867 100644 --- a/src/main/virtual_servers.c +++ b/src/main/virtual_servers.c @@ -97,11 +97,11 @@ static fr_virtual_server_t **virtual_servers; */ static CONF_SECTION *virtual_server_root; -static int listen_on_read(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); -static int server_on_read(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int listen_on_read(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); +static int server_on_read(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); -static int listen_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); -static int server_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int listen_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); +static int server_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); static const CONF_PARSER listen_on_read_config[] = { { FR_CONF_OFFSET("listen", FR_TYPE_SUBSECTION | FR_TYPE_MULTI | FR_TYPE_OK_MISSING | FR_TYPE_ON_READ, @@ -153,13 +153,15 @@ const CONF_PARSER virtual_servers_config[] = { * * @param[in] ctx to allocate data in. * @param[out] out always NULL + * @param[in] parent Base structure address. * @param[in] ci #CONF_SECTION containing the listen section. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int listen_on_read(UNUSED TALLOC_CTX *ctx, UNUSED void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int listen_on_read(UNUSED TALLOC_CTX *ctx, UNUSED void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { CONF_SECTION *listen_cs = cf_item_to_section(ci); CONF_SECTION *server_cs = cf_item_to_section(cf_parent(ci)); @@ -179,13 +181,15 @@ static int listen_on_read(UNUSED TALLOC_CTX *ctx, UNUSED void *out, CONF_ITEM *c * * @param[in] ctx to allocate data in. * @param[out] out Where to our listen configuration. Is a #fr_virtual_server_t structure. + * @param[in] parent Base structure address. * @param[in] ci #CONF_SECTION containing the listen section. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int server_on_read(UNUSED TALLOC_CTX *ctx, UNUSED void *out, UNUSED CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int server_on_read(UNUSED TALLOC_CTX *ctx, UNUSED void *out, UNUSED void *parent, + UNUSED CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { /* @@ -199,13 +203,14 @@ static int server_on_read(UNUSED TALLOC_CTX *ctx, UNUSED void *out, UNUSED CONF_ * * @param[in] ctx to allocate data in. * @param[out] out Where to our listen configuration. Is a #fr_virtual_listen_t structure. + * @param[in] parent Base structure address. * @param[in] ci #CONF_SECTION containing the listen section. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int listen_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int listen_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { fr_virtual_listen_t *listen = talloc_get_type_abort(out, fr_virtual_listen_t); /* Pre-allocated for us */ CONF_SECTION *listen_cs = cf_item_to_section(ci); @@ -226,13 +231,15 @@ static int listen_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_P * * @param[in] ctx to allocate data in. * @param[out] out Where to our listen configuration. Is a #fr_virtual_server_t structure. + * @param[in] parent Base structure address. * @param[in] ci #CONF_SECTION containing the listen section. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int server_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int server_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { fr_virtual_server_t *server = talloc_get_type_abort(out, fr_virtual_server_t); CONF_SECTION *server_cs = cf_item_to_section(ci); diff --git a/src/modules/proto_control/proto_control.c b/src/modules/proto_control/proto_control.c index bb3da1823a6..9cfa3d3b704 100644 --- a/src/modules/proto_control/proto_control.c +++ b/src/modules/proto_control/proto_control.c @@ -30,8 +30,8 @@ #include "proto_control.h" extern fr_app_t proto_control; -static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); -static int transport_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); +static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); +static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); static CONF_PARSER const limit_config[] = { { FR_CONF_OFFSET("idle_timeout", FR_TYPE_TIMEVAL, proto_control_t, io.idle_timeout), .dflt = "30.0" } , @@ -85,13 +85,14 @@ fr_dict_attr_autoload_t proto_control_dict_attr[] = { * * @param[in] ctx to allocate data in (instance of proto_control). * @param[out] out Where to write a dl_instance_t containing the module handle and instance. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the type module. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { // char const *type_str = cf_pair_value(cf_item_to_pair(ci)); CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci)); @@ -127,7 +128,7 @@ static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PAR * - 0 on success. * - -1 on failure. */ -static int transport_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *name = cf_pair_value(cf_item_to_pair(ci)); dl_instance_t *parent_inst; diff --git a/src/modules/proto_detail/proto_detail.c b/src/modules/proto_detail/proto_detail.c index cc4e4dec651..1c6a8bd9a90 100644 --- a/src/modules/proto_detail/proto_detail.c +++ b/src/modules/proto_detail/proto_detail.c @@ -31,8 +31,8 @@ #include "proto_detail.h" extern fr_app_t proto_detail; -static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); -static int transport_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); +static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); +static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); #if 0 /* @@ -114,13 +114,14 @@ fr_dict_attr_autoload_t proto_detail_dict_attr[] = { * * @param[in] ctx to allocate data in (instance of proto_detail). * @param[out] out Where to write a dl_instance_t containing the module handle and instance. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the type module. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *type_str = cf_pair_value(cf_item_to_pair(ci)); CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci)); @@ -197,7 +198,8 @@ static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PAR * - 0 on success. * - -1 on failure. */ -static int transport_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *name = cf_pair_value(cf_item_to_pair(ci)); dl_instance_t *parent_inst; diff --git a/src/modules/proto_dhcpv4/proto_dhcpv4.c b/src/modules/proto_dhcpv4/proto_dhcpv4.c index 48f406973a9..6c4f055b6e5 100644 --- a/src/modules/proto_dhcpv4/proto_dhcpv4.c +++ b/src/modules/proto_dhcpv4/proto_dhcpv4.c @@ -30,9 +30,10 @@ #include "proto_dhcpv4.h" extern fr_app_t proto_dhcpv4; -static int priority_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); -static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); -static int transport_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); +static int priority_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); +static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); static const CONF_PARSER priority_config[] = { { FR_CONF_OFFSET("DHCP-Discover", FR_TYPE_UINT32, proto_dhcpv4_t, priorities[FR_DHCP_DISCOVER]), @@ -107,7 +108,8 @@ fr_dict_attr_autoload_t proto_dhcpv4_dict_attr[] = { { NULL } }; -static int priority_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int priority_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { int32_t priority; @@ -122,13 +124,15 @@ static int priority_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUS * * @param[in] ctx to allocate data in (instance of proto_dhcpv4). * @param[out] out Where to write a dl_instance_t containing the module handle and instance. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the type module. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { static char const *type_lib_table[] = { [FR_DHCP_DISCOVER] = "base", @@ -217,13 +221,15 @@ static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PAR * * @param[in] ctx to allocate data in (instance of proto_dhcpv4). * @param[out] out Where to write a dl_instance_t containing the module handle and instance. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the type module. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int transport_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *name = cf_pair_value(cf_item_to_pair(ci)); dl_instance_t *parent_inst; diff --git a/src/modules/proto_radius/proto_radius.c b/src/modules/proto_radius/proto_radius.c index 14960fa6e6c..48f22d8bfe1 100644 --- a/src/modules/proto_radius/proto_radius.c +++ b/src/modules/proto_radius/proto_radius.c @@ -32,9 +32,9 @@ extern fr_app_t proto_radius; -static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); -static int transport_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); -static int priority_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); +static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); +static int priority_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); static CONF_PARSER const limit_config[] = { { FR_CONF_OFFSET("cleanup_delay", FR_TYPE_TIMEVAL, proto_radius_t, io.cleanup_delay), .dflt = "5.0" } , @@ -110,7 +110,7 @@ fr_dict_attr_autoload_t proto_radius_dict_attr[] = { { NULL } }; -static int priority_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int priority_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { int32_t priority; @@ -134,7 +134,7 @@ static int priority_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUS * - 0 on success. * - -1 on failure. */ -static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { static char const *type_lib_table[] = { [FR_CODE_ACCESS_REQUEST] = "auth", @@ -250,7 +250,7 @@ static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PAR * - 0 on success. * - -1 on failure. */ -static int transport_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *name = cf_pair_value(cf_item_to_pair(ci)); dl_instance_t *parent_inst; diff --git a/src/modules/proto_vmps/proto_vmps.c b/src/modules/proto_vmps/proto_vmps.c index 44cc1b5b6f7..7e05321a893 100644 --- a/src/modules/proto_vmps/proto_vmps.c +++ b/src/modules/proto_vmps/proto_vmps.c @@ -31,9 +31,12 @@ #include "proto_vmps.h" extern fr_app_t proto_vmps; -static int priority_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); -static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); -static int transport_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); +static int priority_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, CONF_PARSER const *rule); +static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, CONF_PARSER const *rule); static const CONF_PARSER priority_config[] = { { FR_CONF_OFFSET("VMPS-Join-Request", FR_TYPE_UINT32, proto_vmps_t, priorities[FR_VMPS_PACKET_TYPE_VALUE_VMPS_JOIN_REQUEST]), @@ -91,7 +94,8 @@ fr_dict_attr_autoload_t proto_vmps_dict_attr[] = { { NULL } }; -static int priority_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int priority_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { int32_t priority; @@ -106,13 +110,15 @@ static int priority_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUS * * @param[in] ctx to allocate data in (instance of proto_vmps). * @param[out] out Where to write a dl_instance_t containing the module handle and instance. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the type module. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *type_str = cf_pair_value(cf_item_to_pair(ci)); CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci)); @@ -177,13 +183,15 @@ static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PAR * * @param[in] ctx to allocate data in (instance of proto_vmps). * @param[out] out Where to write a dl_instance_t containing the module handle and instance. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the type module. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int transport_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *name = cf_pair_value(cf_item_to_pair(ci)); dl_instance_t *parent_inst; diff --git a/src/modules/rlm_cipher/rlm_cipher.c b/src/modules/rlm_cipher/rlm_cipher.c index 3579af44453..09f0cbd2ed3 100644 --- a/src/modules/rlm_cipher/rlm_cipher.c +++ b/src/modules/rlm_cipher/rlm_cipher.c @@ -38,12 +38,17 @@ RCSID("$Id$") #include #include -static int digest_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); -static int cipher_rsa_padding_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); -static int cipher_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); - -static int cipher_rsa_private_key_file_load(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); -static int cipher_rsa_certificate_file_load(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int digest_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int cipher_rsa_padding_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int cipher_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); + +static int cipher_rsa_private_key_file_load(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int cipher_rsa_certificate_file_load(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); typedef enum { RLM_CIPHER_TYPE_INVALID = 0, @@ -189,13 +194,15 @@ static const CONF_PARSER module_config[] = { * * @param[in] ctx to allocate data in. * @param[out] out EVP_MD representing the OpenSSL digest type. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the digest. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int digest_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int digest_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { EVP_MD const *md; char const *type_str; @@ -216,14 +223,15 @@ static int digest_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, U * * @param[in] ctx to allocate data in. * @param[out] out Padding type. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the padding type.. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int cipher_rsa_padding_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, - UNUSED CONF_PARSER const *rule) +static int cipher_rsa_padding_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { int type; char const *type_str; @@ -244,13 +252,14 @@ static int cipher_rsa_padding_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF * * @param[in] ctx to allocate data in. * @param[out] out Cipher enumeration type. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the type module. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int cipher_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int cipher_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { cipher_type_t type; char const *type_str; @@ -323,14 +332,15 @@ static int _evp_pkey_free(EVP_PKEY *pkey) * function anyway. * @param[out] out Where to write the EVP_PKEY * representing the * certificate we just loaded. + * @param[in] parent Base structure address. * @param[in] ci Config item containing the certificate path. * @param[in] rule this callback was attached to. * @return * - -1 on failure. * - 0 on success. */ -static int cipher_rsa_private_key_file_load(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, - UNUSED CONF_PARSER const *rule) +static int cipher_rsa_private_key_file_load(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { FILE *fp; char const *filename; @@ -383,14 +393,15 @@ static int cipher_rsa_private_key_file_load(TALLOC_CTX *ctx, void *out, CONF_ITE * function anyway. * @param[out] out Where to write the EVP_PKEY * representing the * certificate we just loaded. + * @param[in] parent Base structure address. * @param[in] ci Config item containing the certificate path. * @param[in] rule this callback was attached to. * @return * - -1 on failure. * - 0 on success. */ -static int cipher_rsa_certificate_file_load(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, - UNUSED CONF_PARSER const *rule) +static int cipher_rsa_certificate_file_load(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { FILE *fp; char const *filename; diff --git a/src/modules/rlm_eap/rlm_eap.c b/src/modules/rlm_eap/rlm_eap.c index 52542fd224d..3bf054d7ef1 100644 --- a/src/modules/rlm_eap/rlm_eap.c +++ b/src/modules/rlm_eap/rlm_eap.c @@ -45,8 +45,10 @@ typedef struct { rlm_rcode_t rcode; //!< The result of the submodule. } eap_auth_rctx_t; -static int submodule_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); -static int eap_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int submodule_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int eap_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); static const CONF_PARSER module_config[] = { { FR_CONF_OFFSET("default_eap_type", FR_TYPE_VOID, rlm_eap_t, default_method), @@ -106,13 +108,15 @@ static rlm_rcode_t mod_authorize(void *instance, UNUSED void *thread, REQUEST *r * * @param[in] ctx to allocate data in (instance of rlm_eap_t). * @param[out] out Where to write a dl_instance_t containing the module handle and instance. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the type module. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int submodule_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int submodule_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *name = cf_pair_value(cf_item_to_pair(ci)); CONF_SECTION *eap_cs = cf_item_to_section(cf_parent(ci)); @@ -217,13 +221,15 @@ static int submodule_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CON * * @param[in] ctx unused. * @param[out] out Where to write the #eap_type_t value we found. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the EAP method. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int eap_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int eap_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *default_method_name = cf_pair_value(cf_item_to_pair(ci)); eap_type_t method; diff --git a/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c b/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c index 49e22d70d72..5c786de2ef6 100644 --- a/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c +++ b/src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c @@ -33,7 +33,8 @@ RCSID("$Id$") #include -static int auth_type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int auth_type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); /* * EAP-GTC is just ASCII data carried inside of the EAP session. @@ -77,13 +78,15 @@ static rlm_rcode_t CC_HINT(nonnull) mod_process(void *instance, eap_session_t *e * * @param[in] ctx to allocate data. * @param[out] out Where to write the auth_type we created or resolved. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the auth_type. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int auth_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int auth_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *auth_type = cf_pair_value(cf_item_to_pair(ci)); diff --git a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c index 67b9326b8c3..6d7d4535c5b 100644 --- a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c +++ b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c @@ -30,7 +30,8 @@ RCSID("$Id$") #include -static int auth_type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int auth_type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); typedef struct { bool with_ntdomain_hack; @@ -42,7 +43,7 @@ typedef struct { static CONF_PARSER submodule_config[] = { { FR_CONF_OFFSET("with_ntdomain_hack", FR_TYPE_BOOL, rlm_eap_mschapv2_t, with_ntdomain_hack), .dflt = "no" }, - { FR_CONF_OFFSET("auth_type", FR_TYPE_VOID, rlm_eap_mschapv2_t, auth_type), .func = auth_type_parse, .dflt = "mschap" }, + { FR_CONF_OFFSET("auth_type", FR_TYPE_VOID, rlm_eap_mschapv2_t, auth_type), .func = auth_type_parse, .dflt = "mschap" }, { FR_CONF_OFFSET("send_error", FR_TYPE_BOOL, rlm_eap_mschapv2_t, send_error), .dflt = "no" }, { FR_CONF_OFFSET("identity", FR_TYPE_STRING, rlm_eap_mschapv2_t, identity) }, CONF_PARSER_TERMINATOR @@ -110,13 +111,15 @@ static void fix_mppe_keys(eap_session_t *eap_session, mschapv2_opaque_t *data) * * @param[in] ctx to allocate data. * @param[out] out Where to write the auth_type we created or resolved. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the auth_type. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int auth_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int auth_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *auth_type = cf_pair_value(cf_item_to_pair(ci)); diff --git a/src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c b/src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c index 15ea4d8d8ca..3d82f1bc83d 100644 --- a/src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c +++ b/src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c @@ -26,7 +26,8 @@ RCSID("$Id$") #include "eap_peap.h" -static int auth_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); +static int auth_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule); typedef struct rlm_eap_peap_t { char const *tls_conf_name; //!< TLS configuration. @@ -109,13 +110,15 @@ fr_dict_attr_autoload_t rlm_eap_peap_dict_attr[] = { * * @param[in] ctx to allocate data. * @param[out] out Where to write the auth_type we created or resolved. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the auth_type. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int auth_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int auth_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *auth_type = cf_pair_value(cf_item_to_pair(ci)); diff --git a/src/modules/rlm_radius/rlm_radius.c b/src/modules/rlm_radius/rlm_radius.c index cf6ffc6a95a..c5df0a2fb59 100644 --- a/src/modules/rlm_radius/rlm_radius.c +++ b/src/modules/rlm_radius/rlm_radius.c @@ -31,10 +31,10 @@ RCSID("$Id$") #include "rlm_radius.h" -static int transport_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); -static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); -static int status_check_type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); -static int status_check_update_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, CONF_PARSER const *rule); +static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); +static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); +static int status_check_type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); +static int status_check_update_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, CONF_PARSER const *rule); static CONF_PARSER const status_checks_config[] = { { FR_CONF_OFFSET("type", FR_TYPE_VOID, rlm_radius_t, status_check), @@ -174,14 +174,16 @@ fr_dict_attr_autoload_t rlm_radius_dict_attr[] = { /** Set which types of packets we can parse * * @param[in] ctx to allocate data in (instance of rlm_radius). - * @param[out] out Where to write the parsed data + * @param[out] out Where to write the parsed data. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the type module. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *type_str = cf_pair_value(cf_item_to_pair(ci)); CONF_SECTION *cs = cf_item_to_section(cf_parent(ci)); @@ -233,13 +235,15 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED C * * @param[in] ctx to allocate data in (instance of proto_radius). * @param[out] out Where to write a dl_instance_t containing the module handle and instance. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the type module. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int transport_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *name = cf_pair_value(cf_item_to_pair(ci)); dl_instance_t *parent_inst; @@ -264,14 +268,16 @@ static int transport_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CON /** Allow for Status-Server ping checks * * @param[in] ctx to allocate data in (instance of proto_radius). - * @param[out] out Where to write our parsed data + * @param[out] out Where to write our parsed data. + * @param[in] parent Base structure address. * @param[in] ci #CONF_PAIR specifying the name of the type module. * @param[in] rule unused. * @return * - 0 on success. * - -1 on failure. */ -static int status_check_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int status_check_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { char const *type_str = cf_pair_value(cf_item_to_pair(ci)); CONF_SECTION *cs = cf_item_to_section(cf_parent(ci)); @@ -327,7 +333,8 @@ static int status_check_type_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM * - 0 on success. * - -1 on failure. */ -static int status_check_update_parse(UNUSED TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) +static int status_check_update_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, + CONF_ITEM *ci, UNUSED CONF_PARSER const *rule) { int rcode; CONF_SECTION *cs;