From: Arran Cudbard-Bell Date: Tue, 5 Nov 2019 17:59:09 +0000 (-0600) Subject: Rename 'alias' to 'name' in the dictionary code X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edfd84f1379255d1c0d5aa787db554ba272732ec;p=thirdparty%2Ffreeradius-server.git Rename 'alias' to 'name' in the dictionary code --- diff --git a/src/bin/radsnmp.c b/src/bin/radsnmp.c index 26759c9249d..092c5f1a42e 100644 --- a/src/bin/radsnmp.c +++ b/src/bin/radsnmp.c @@ -697,7 +697,7 @@ static int radsnmp_send_recv(radsnmp_conf_t *conf, int fd) strlcpy(type_str, value, (p - value) + 1); - type = fr_dict_enum_by_alias(attr_freeradius_snmp_type, type_str, -1); + type = fr_dict_enum_by_name(attr_freeradius_snmp_type, type_str, -1); if (!type) { ERROR("Unknown type \"%s\"", type_str); RESPOND_STATIC("NONE"); diff --git a/src/lib/eap/types.c b/src/lib/eap/types.c index 8529a64c890..960902d9bbe 100644 --- a/src/lib/eap/types.c +++ b/src/lib/eap/types.c @@ -37,7 +37,7 @@ eap_type_t eap_name2type(char const *name) { fr_dict_enum_t *dv; - dv = fr_dict_enum_by_alias(attr_eap_type, name, -1); + dv = fr_dict_enum_by_name(attr_eap_type, name, -1); if (!dv) return FR_EAP_METHOD_INVALID; if (dv->value->vb_uint32 >= FR_EAP_METHOD_MAX) return FR_EAP_METHOD_INVALID; @@ -54,7 +54,7 @@ char const *eap_type2name(eap_type_t method) fr_dict_enum_t *dv; dv = fr_dict_enum_by_value(attr_eap_type, fr_box_uint32(method)); - if (dv) return dv->alias; + if (dv) return dv->name; return "unknown"; } diff --git a/src/lib/eap_aka_sim/xlat.c b/src/lib/eap_aka_sim/xlat.c index b1195e98965..c92eda52921 100644 --- a/src/lib/eap_aka_sim/xlat.c +++ b/src/lib/eap_aka_sim/xlat.c @@ -79,17 +79,17 @@ static ssize_t aka_sim_xlat_id_method_xlat(TALLOC_CTX *ctx, char **out, UNUSED s return 0; case AKA_SIM_METHOD_HINT_SIM: - method = fr_dict_enum_alias_by_value(attr_eap_aka_sim_method_hint, + method = fr_dict_enum_name_by_value(attr_eap_aka_sim_method_hint, fr_box_uint32(FR_METHOD_HINT_VALUE_SIM)); break; case AKA_SIM_METHOD_HINT_AKA: - method = fr_dict_enum_alias_by_value(attr_eap_aka_sim_method_hint, + method = fr_dict_enum_name_by_value(attr_eap_aka_sim_method_hint, fr_box_uint32(FR_METHOD_HINT_VALUE_AKA)); break; case AKA_SIM_METHOD_HINT_AKA_PRIME: - method = fr_dict_enum_alias_by_value(attr_eap_aka_sim_method_hint, + method = fr_dict_enum_name_by_value(attr_eap_aka_sim_method_hint, fr_box_uint32(FR_METHOD_HINT_VALUE_AKA_PRIME)); break; } @@ -150,17 +150,17 @@ static ssize_t aka_sim_xlat_id_type_xlat(TALLOC_CTX *ctx, char **out, UNUSED siz return 0; case AKA_SIM_ID_TYPE_PERMANENT: - type = fr_dict_enum_alias_by_value(attr_eap_aka_sim_identity_type, + type = fr_dict_enum_name_by_value(attr_eap_aka_sim_identity_type, fr_box_uint32(FR_IDENTITY_TYPE_VALUE_PERMANENT)); break; case AKA_SIM_ID_TYPE_PSEUDONYM: - type = fr_dict_enum_alias_by_value(attr_eap_aka_sim_identity_type, + type = fr_dict_enum_name_by_value(attr_eap_aka_sim_identity_type, fr_box_uint32(FR_IDENTITY_TYPE_VALUE_PSEUDONYM)); break; case AKA_SIM_ID_TYPE_FASTAUTH: - type = fr_dict_enum_alias_by_value(attr_eap_aka_sim_identity_type, + type = fr_dict_enum_name_by_value(attr_eap_aka_sim_identity_type, fr_box_uint32(FR_IDENTITY_TYPE_VALUE_FASTAUTH)); break; } diff --git a/src/lib/json/json.c b/src/lib/json/json.c index a4b48afca8e..7a49e35d8ae 100644 --- a/src/lib/json/json.c +++ b/src/lib/json/json.c @@ -62,7 +62,7 @@ int fr_json_object_to_value_box(TALLOC_CTX *ctx, fr_value_box_t *out, json_objec /* * If an alias exists, use that value instead */ - found = fr_dict_enum_by_alias(enumv, value, len); + found = fr_dict_enum_by_name(enumv, value, len); if (found) { if (fr_value_box_copy(ctx, out, found->value) < 0) return -1; return 0; @@ -160,7 +160,7 @@ json_object *json_object_from_value_box(TALLOC_CTX *ctx, fr_value_box_t const *d fr_dict_enum_t *enumv; enumv = fr_dict_enum_by_value(data->enumv, data); - if (enumv) return json_object_new_string(enumv->alias); + if (enumv) return json_object_new_string(enumv->name); } switch (data->type) { diff --git a/src/lib/server/module.c b/src/lib/server/module.c index 6f90b128a58..9c30ed33bde 100644 --- a/src/lib/server/module.c +++ b/src/lib/server/module.c @@ -627,7 +627,7 @@ bool module_section_type_set(REQUEST *request, fr_dict_attr_t const *type_da, fr return true; case 1: - RDEBUG2("&control:%s already set. Not setting to %s", vp->da->name, enumv->alias); + RDEBUG2("&control:%s already set. Not setting to %s", vp->da->name, enumv->name); return false; default: diff --git a/src/lib/server/virtual_servers.c b/src/lib/server/virtual_servers.c index 00ac7b27ee1..31e2d488e47 100644 --- a/src/lib/server/virtual_servers.c +++ b/src/lib/server/virtual_servers.c @@ -387,7 +387,7 @@ int virtual_server_section_attribute_define(CONF_SECTION *server_cs, char const * If the value already exists, don't * create it again. */ - dv = fr_dict_enum_by_alias(da, name2, -1); + dv = fr_dict_enum_by_name(da, name2, -1); if (dv) continue; cf_log_debug(subcs, "Creating %s = %s", da->name, name2); @@ -398,7 +398,7 @@ int virtual_server_section_attribute_define(CONF_SECTION *server_cs, char const * this code, so it doesn't matter. The only * requirement is that it's unique. */ - if (fr_dict_enum_add_alias_next(da, name2) < 0) { + if (fr_dict_enum_add_name_next(da, name2) < 0) { PERROR("Failed adding section value"); return -1; } @@ -1072,15 +1072,15 @@ rlm_rcode_t process_authenticate(int auth_type, REQUEST *request) dv = fr_dict_enum_by_value(da, fr_box_uint32((uint32_t) auth_type)); if (!dv) return RLM_MODULE_FAIL; - subcs = cf_section_find(cs, da->name, dv->alias); + subcs = cf_section_find(cs, da->name, dv->name); if (!subcs) { RDEBUG2("%s %s sub-section not found. Using default return values.", - da->name, dv->alias); + da->name, dv->name); return RLM_MODULE_REJECT; } RDEBUG("Running %s %s from file %s", - da->name, dv->alias, cf_filename(subcs)); + da->name, dv->name, cf_filename(subcs)); cs = subcs; /* @@ -1119,7 +1119,7 @@ rlm_rcode_t virtual_server_process_auth(REQUEST *request, CONF_SECTION *virtual_ return unlang_module_yield_to_section(request, NULL, RLM_MODULE_FAIL, resume, signal, rctx); } - auth_name = fr_dict_enum_alias_by_value(attr_auth_type, &vp->data); + auth_name = fr_dict_enum_name_by_value(attr_auth_type, &vp->data); if (!auth_name) { REDEBUG2("Invalid %pP value", vp); goto fail; @@ -1274,7 +1274,7 @@ int fr_app_process_instantiate(CONF_SECTION *server, dl_module_inst_t **type_sub code = enumv->value->vb_uint32; if (code >= code_max) { - cf_log_err(conf, "Invalid type code \"%s\" for \"%s\"", enumv->alias, app_process->name); + cf_log_err(conf, "Invalid type code \"%s\" for \"%s\"", enumv->name, app_process->name); return -1; } diff --git a/src/lib/unlang/call.c b/src/lib/unlang/call.c index 1806d17e327..3e1cc106cb3 100644 --- a/src/lib/unlang/call.c +++ b/src/lib/unlang/call.c @@ -161,10 +161,10 @@ static unlang_action_t unlang_call(REQUEST *request, rlm_rcode_t *presult) return UNLANG_ACTION_CALCULATE_RESULT; } - process_p = (fr_io_process_t *) cf_data_value(cf_data_find(g->server_cs, fr_io_process_t, type_enum->alias)); + process_p = (fr_io_process_t *) cf_data_value(cf_data_find(g->server_cs, fr_io_process_t, type_enum->name)); if (!process_p) { REDEBUG("No such packet type '%s' in server '%s'", - type_enum->alias, cf_section_name2(g->server_cs)); + type_enum->name, cf_section_name2(g->server_cs)); *presult = RLM_MODULE_FAIL; return UNLANG_ACTION_CALCULATE_RESULT; } @@ -173,7 +173,7 @@ static unlang_action_t unlang_call(REQUEST *request, rlm_rcode_t *presult) * We MUST use _cd_data_find() so that we don't try to * find the "value" with talloc type "CF_IDENT_ANY". */ - process_inst = cf_data_value(_cf_data_find(cf_section_to_item(g->server_cs), CF_IDENT_ANY, type_enum->alias)); + process_inst = cf_data_value(_cf_data_find(cf_section_to_item(g->server_cs), CF_IDENT_ANY, type_enum->name)); /* can be NULL */ child = unlang_io_subrequest_alloc(request, dict, UNLANG_NORMAL_CHILD); diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index 9783f9713ad..de749bf551d 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -465,7 +465,7 @@ static bool pass2_fixup_map(fr_cond_t *c, vp_tmpl_rules_t const *rules) * Where "foo" is dynamically defined. */ if (c->pass2_fixup == PASS2_FIXUP_TYPE) { - if (!fr_dict_enum_by_alias(map->lhs->tmpl_da, map->rhs->name, -1)) { + if (!fr_dict_enum_by_name(map->lhs->tmpl_da, map->rhs->name, -1)) { cf_log_err(map->ci, "Invalid reference to non-existent %s %s { ... }", map->lhs->tmpl_da->name, map->rhs->name); @@ -2944,7 +2944,7 @@ static unlang_t *compile_subrequest(unlang_t *parent, unlang_compile_t *unlang_c } } - type_enum = fr_dict_enum_by_alias(da, packet_name, -1); + type_enum = fr_dict_enum_by_name(da, packet_name, -1); if (!type_enum) { cf_log_err(cs, "No such value '%s' for attribute 'Packet-Type' in namespace '%s'", packet_name, namespace); diff --git a/src/lib/util/dict.h b/src/lib/util/dict.h index 5d249867e0e..c3faf5cab2d 100644 --- a/src/lib/util/dict.h +++ b/src/lib/util/dict.h @@ -140,8 +140,8 @@ struct dict_attr { */ typedef struct { fr_dict_attr_t const *da; //!< Dictionary attribute enum is associated with. - char const *alias; //!< Enum name. - size_t alias_len; //!< Allows for efficient alias lookups when operating + char const *name; //!< Enum name. + size_t name_len; //!< Allows for efficient name lookups when operating ///< on partial buffers. fr_value_box_t const *value; //!< Enum value (what name maps to). } fr_dict_enum_t; @@ -248,10 +248,10 @@ extern bool const fr_dict_non_data_types[FR_TYPE_MAX + 1]; int fr_dict_attr_add(fr_dict_t *dict, fr_dict_attr_t const *parent, char const *name, int attr, fr_type_t type, fr_dict_attr_flags_t const *flags) CC_HINT(nonnull(1,2,3)); -int fr_dict_enum_add_alias(fr_dict_attr_t const *da, char const *alias, +int fr_dict_enum_add_name(fr_dict_attr_t const *da, char const *name, fr_value_box_t const *value, bool coerce, bool replace); -int fr_dict_enum_add_alias_next(fr_dict_attr_t const *da, char const *alias) CC_HINT(nonnull); +int fr_dict_enum_add_name_next(fr_dict_attr_t const *da, char const *name) CC_HINT(nonnull); int fr_dict_str_to_argv(char *str, char **argv, int max_argc); /** @} */ @@ -381,9 +381,9 @@ fr_dict_attr_t const *fr_dict_attr_child_by_num(fr_dict_attr_t const *parent, un fr_dict_enum_t *fr_dict_enum_by_value(fr_dict_attr_t const *da, fr_value_box_t const *value); -char const *fr_dict_enum_alias_by_value(fr_dict_attr_t const *da, fr_value_box_t const *value); +char const *fr_dict_enum_name_by_value(fr_dict_attr_t const *da, fr_value_box_t const *value); -fr_dict_enum_t *fr_dict_enum_by_alias(fr_dict_attr_t const *da, char const *alias, ssize_t len); +fr_dict_enum_t *fr_dict_enum_by_name(fr_dict_attr_t const *da, char const *name, ssize_t len); /** @} */ /** @name Dictionary and protocol loading diff --git a/src/lib/util/dict_priv.h b/src/lib/util/dict_priv.h index 90757f01118..1659bff8c5f 100644 --- a/src/lib/util/dict_priv.h +++ b/src/lib/util/dict_priv.h @@ -73,7 +73,7 @@ struct fr_dict { fr_hash_table_t *attributes_combo; //!< Lookup variants of polymorphic attributes. fr_hash_table_t *values_by_da; //!< Lookup an attribute enum by its value. - fr_hash_table_t *values_by_alias; //!< Lookup an attribute enum by its alias name. + fr_hash_table_t *values_by_name; //!< Lookup an attribute enum by its name name. fr_dict_attr_t *root; //!< Root attribute of this dictionary. diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index 017587f94ae..4481407acdf 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -43,7 +43,7 @@ struct dict_enum_fixup_s { char *filename; //!< where the "enum" was defined int line; //!< ditto char *attribute; //!< we couldn't find (and will need to resolve later). - char *alias; //!< Raw enum name. + char *name; //!< Raw enum name. char *value; //!< Raw enum value. We can't do anything with this until //!< we know the attribute type, which we only find out later. @@ -855,8 +855,8 @@ static int dict_read_process_value(dict_tokenize_ctx_t *ctx, char **argv, int ar fixup->attribute = talloc_strdup(fixup, argv[0]); if (!fixup->attribute) goto oom; - fixup->alias = talloc_strdup(fixup, argv[1]); - if (!fixup->alias) goto oom; + fixup->name = talloc_strdup(fixup, argv[1]); + if (!fixup->name) goto oom; fixup->value = talloc_strdup(fixup, argv[2]); if (!fixup->value) goto oom; @@ -895,7 +895,7 @@ static int dict_read_process_value(dict_tokenize_ctx_t *ctx, char **argv, int ar } } - if (fr_dict_enum_add_alias(da, argv[1], &value, false, true) < 0) { + if (fr_dict_enum_add_name(da, argv[1], &value, false, true) < 0) { fr_value_box_clear(&value); return -1; } @@ -1347,7 +1347,7 @@ static int fr_dict_finalise(dict_tokenize_ctx_t *ctx) da = fr_dict_attr_by_name(ctx->dict, this->attribute); if (!da) { fr_strerror_printf("No ATTRIBUTE '%s' defined for VALUE '%s' at %s[%d]", - this->attribute, this->alias, this->filename, this->line); + this->attribute, this->name, this->filename, this->line); return -1; } type = da->type; @@ -1359,7 +1359,7 @@ static int fr_dict_finalise(dict_tokenize_ctx_t *ctx) return -1; } - ret = fr_dict_enum_add_alias(da, this->alias, &value, false, false); + ret = fr_dict_enum_add_name(da, this->name, &value, false, false); fr_value_box_clear(&value); if (ret < 0) return -1; @@ -1508,7 +1508,7 @@ static int fr_dict_finalise(dict_tokenize_ctx_t *ctx) fr_hash_table_walk(ctx->dict->vendors_by_num, hash_null_callback, NULL); fr_hash_table_walk(ctx->dict->values_by_da, hash_null_callback, NULL); - fr_hash_table_walk(ctx->dict->values_by_alias, hash_null_callback, NULL); + fr_hash_table_walk(ctx->dict->values_by_name, hash_null_callback, NULL); ctx->value_attr = NULL; ctx->relative_attr = NULL; diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index aef61f35eda..7a17e745331 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -337,12 +337,12 @@ static int dict_vendor_pen_cmp(void const *one, void const *two) /** Hash a dictionary name * */ -static uint32_t dict_enum_alias_hash(void const *data) +static uint32_t dict_enum_name_hash(void const *data) { uint32_t hash; fr_dict_enum_t const *enumv = data; - hash = dict_hash_name((void const *)enumv->alias, enumv->alias_len); + hash = dict_hash_name((void const *)enumv->name, enumv->name_len); return fr_hash_update(&enumv->da, sizeof(enumv->da), hash); //-V568 } @@ -350,7 +350,7 @@ static uint32_t dict_enum_alias_hash(void const *data) /** Compare two dictionary attribute enum values * */ -static int dict_enum_alias_cmp(void const *one, void const *two) +static int dict_enum_name_cmp(void const *one, void const *two) { int rcode; fr_dict_enum_t const *a = one; @@ -359,7 +359,7 @@ static int dict_enum_alias_cmp(void const *one, void const *two) rcode = a->da - b->da; if (rcode != 0) return rcode; - return strcasecmp(a->alias, b->alias); + return strcasecmp(a->name, b->name); } /** Hash a dictionary enum value @@ -934,30 +934,30 @@ int fr_dict_attr_add(fr_dict_t *dict, fr_dict_attr_t const *parent, return 0; } -/** Add a value alias +/** Add a value name * - * Aliases are textual (string) aliases for a given value. + * Aliases are textual (string) names for a given value. * - * Value aliases are not limited to integers, and may be added for any non-structural + * Value names are not limited to integers, and may be added for any non-structural * attribute type. * * @param[in] da to add enumeration value to. - * @param[in] alias Name of value alias. - * @param[in] value to associate with alias. + * @param[in] name Name of value name. + * @param[in] value to associate with name. * @param[in] coerce if the type of the value does not match the * type of the da, attempt to cast it to match * the type of the da. If this is false and there's * a type mismatch, we fail. * We also fail if the value cannot be coerced to * the attribute type. - * @param[in] takes_precedence This alias should take precedence over previous - * aliases for the same value, when resolving value - * to alias. + * @param[in] takes_precedence This name should take precedence over previous + * names for the same value, when resolving value + * to name. * @return * - 0 on success. * - -1 on failure. */ -int fr_dict_enum_add_alias(fr_dict_attr_t const *da, char const *alias, +int fr_dict_enum_add_name(fr_dict_attr_t const *da, char const *name, fr_value_box_t const *value, bool coerce, bool takes_precedence) { @@ -971,12 +971,12 @@ int fr_dict_enum_add_alias(fr_dict_attr_t const *da, char const *alias, return -1; } - if (!*alias) { + if (!*name) { fr_strerror_printf("%s: Empty names are not permitted", __FUNCTION__); return -1; } - len = strlen(alias); + len = strlen(name); if (len >= FR_DICT_ENUM_MAX_NAME_LEN) { fr_strerror_printf("%s: Value name too long", __FUNCTION__); return -1; @@ -990,8 +990,8 @@ int fr_dict_enum_add_alias(fr_dict_attr_t const *da, char const *alias, fr_strerror_printf("%s: Out of memory", __FUNCTION__); return -1; } - enumv->alias = talloc_typed_strdup(enumv, alias); - enumv->alias_len = strlen(alias); + enumv->name = talloc_typed_strdup(enumv, name); + enumv->name_len = strlen(name); enum_value = fr_value_box_alloc(enumv, da->type, NULL, false); if (!enum_value) goto oom; @@ -1029,7 +1029,7 @@ int fr_dict_enum_add_alias(fr_dict_attr_t const *da, char const *alias, fr_dict_attr_t *tmp; memcpy(&tmp, &enumv, sizeof(tmp)); - if (!fr_hash_table_insert(dict->values_by_alias, tmp)) { + if (!fr_hash_table_insert(dict->values_by_name, tmp)) { fr_dict_enum_t *old; /* @@ -1037,7 +1037,7 @@ int fr_dict_enum_add_alias(fr_dict_attr_t const *da, char const *alias, * name and value. There are lots in * dictionary.ascend. */ - old = fr_dict_enum_by_alias(da, alias, -1); + old = fr_dict_enum_by_name(da, name, -1); if (!fr_cond_assert(old)) return -1; if (fr_value_box_cmp(old->value, enumv->value) == 0) { @@ -1045,8 +1045,8 @@ int fr_dict_enum_add_alias(fr_dict_attr_t const *da, char const *alias, return 0; } - fr_strerror_printf("Duplicate VALUE alias \"%s\" for attribute \"%s\". " - "Old value was \"%pV\", new value was \"%pV\"", alias, da->name, + fr_strerror_printf("Duplicate VALUE name \"%s\" for attribute \"%s\". " + "Old value was \"%pV\", new value was \"%pV\"", name, da->name, old->value, enumv->value); talloc_free(enumv); return -1; @@ -1059,7 +1059,7 @@ int fr_dict_enum_add_alias(fr_dict_attr_t const *da, char const *alias, */ if (takes_precedence) { if (!fr_hash_table_replace(dict->values_by_da, enumv)) { - fr_strerror_printf("%s: Failed inserting value %s", __FUNCTION__, alias); + fr_strerror_printf("%s: Failed inserting value %s", __FUNCTION__, name); return -1; } } else { @@ -1080,10 +1080,10 @@ int fr_dict_enum_add_alias(fr_dict_attr_t const *da, char const *alias, return 0; } -/** Add an alias to an integer attribute hashing the alias for the integer value +/** Add an name to an integer attribute hashing the name for the integer value * */ -int fr_dict_enum_add_alias_next(fr_dict_attr_t const *da, char const *alias) +int fr_dict_enum_add_name_next(fr_dict_attr_t const *da, char const *name) { fr_value_box_t v = { .type = da->type @@ -1092,39 +1092,39 @@ int fr_dict_enum_add_alias_next(fr_dict_attr_t const *da, char const *alias) .type = da->type }; - if (fr_dict_enum_by_alias(da, alias, -1)) return 0; + if (fr_dict_enum_by_name(da, name, -1)) return 0; switch (da->type) { case FR_TYPE_INT8: - v.vb_int8 = s.vb_int8 = fr_hash_string(alias) & INT8_MAX; + v.vb_int8 = s.vb_int8 = fr_hash_string(name) & INT8_MAX; break; case FR_TYPE_INT16: - v.vb_int16 = s.vb_int16 = fr_hash_string(alias) & INT16_MAX; + v.vb_int16 = s.vb_int16 = fr_hash_string(name) & INT16_MAX; break; case FR_TYPE_INT32: - v.vb_int32 = s.vb_int32 = fr_hash_string(alias) & INT32_MAX; + v.vb_int32 = s.vb_int32 = fr_hash_string(name) & INT32_MAX; break; case FR_TYPE_INT64: - v.vb_int64 = s.vb_int64 = fr_hash_string(alias) & INT64_MAX; + v.vb_int64 = s.vb_int64 = fr_hash_string(name) & INT64_MAX; break; case FR_TYPE_UINT8: - v.vb_uint8 = s.vb_uint8 = fr_hash_string(alias) & UINT8_MAX; + v.vb_uint8 = s.vb_uint8 = fr_hash_string(name) & UINT8_MAX; break; case FR_TYPE_UINT16: - v.vb_uint16 = s.vb_uint16 = fr_hash_string(alias) & UINT16_MAX; + v.vb_uint16 = s.vb_uint16 = fr_hash_string(name) & UINT16_MAX; break; case FR_TYPE_UINT32: - v.vb_uint32 = s.vb_uint32 = fr_hash_string(alias) & UINT32_MAX; + v.vb_uint32 = s.vb_uint32 = fr_hash_string(name) & UINT32_MAX; break; case FR_TYPE_UINT64: - v.vb_uint64 = s.vb_uint64 = fr_hash_string(alias) & UINT64_MAX; + v.vb_uint64 = s.vb_uint64 = fr_hash_string(name) & UINT64_MAX; break; default: @@ -1135,14 +1135,14 @@ int fr_dict_enum_add_alias_next(fr_dict_attr_t const *da, char const *alias) /* * If there's no existing value, add an enum - * with the hash value of the alias. + * with the hash value of the name. * * This helps with debugging as the values * are consistent. */ if (!fr_dict_enum_by_value(da, &v)) { add: - return fr_dict_enum_add_alias(da, alias, &v, false, false); + return fr_dict_enum_add_name(da, name, &v, false, false); } for (;;) { @@ -2050,17 +2050,17 @@ fr_dict_enum_t *fr_dict_enum_by_value(fr_dict_attr_t const *da, fr_value_box_t c if (value->type != da->type) return NULL; /* - * First, look up aliases. + * First, look up names. */ enumv.da = da; - enumv.alias = ""; - enumv.alias_len = 0; + enumv.name = ""; + enumv.name_len = 0; /* - * Look up the attribute alias target, and use + * Look up the attribute name target, and use * the correct attribute number if found. */ - dv = fr_hash_table_finddata(dict->values_by_alias, &enumv); + dv = fr_hash_table_finddata(dict->values_by_name, &enumv); if (dv) enumv.da = dv->da; enumv.value = value; @@ -2076,7 +2076,7 @@ fr_dict_enum_t *fr_dict_enum_by_value(fr_dict_attr_t const *da, fr_value_box_t c * - Name of value. * - NULL if no matching value could be found. */ -char const *fr_dict_enum_alias_by_value(fr_dict_attr_t const *da, fr_value_box_t const *value) +char const *fr_dict_enum_name_by_value(fr_dict_attr_t const *da, fr_value_box_t const *value) { fr_dict_enum_t *dv; fr_dict_t *dict; @@ -2092,22 +2092,22 @@ char const *fr_dict_enum_alias_by_value(fr_dict_attr_t const *da, fr_value_box_t dv = fr_dict_enum_by_value(da, value); if (!dv) return ""; - return dv->alias; + return dv->name; } /* * Get a value by its name, keyed off of an attribute. */ -fr_dict_enum_t *fr_dict_enum_by_alias(fr_dict_attr_t const *da, char const *alias, ssize_t len) +fr_dict_enum_t *fr_dict_enum_by_name(fr_dict_attr_t const *da, char const *name, ssize_t len) { fr_dict_enum_t *found; fr_dict_enum_t find = { .da = da, - .alias = alias + .name = name }; fr_dict_t *dict; - if (!alias) return NULL; + if (!name) return NULL; dict = fr_dict_by_da(da); if (!dict) { @@ -2115,17 +2115,17 @@ fr_dict_enum_t *fr_dict_enum_by_alias(fr_dict_attr_t const *da, char const *alia return NULL; } - if (len < 0) len = strlen(alias); - find.alias_len = (size_t)len; + if (len < 0) len = strlen(name); + find.name_len = (size_t)len; /* - * Look up the attribute alias target, and use + * Look up the attribute name target, and use * the correct attribute number if found. */ - found = fr_hash_table_finddata(dict->values_by_alias, &find); + found = fr_hash_table_finddata(dict->values_by_name, &find); if (found) find.da = found->da; - return fr_hash_table_finddata(dict->values_by_alias, &find); + return fr_hash_table_finddata(dict->values_by_name, &find); } int dict_dlopen(fr_dict_t *dict, char const *name) @@ -2241,8 +2241,8 @@ fr_dict_t *dict_alloc(TALLOC_CTX *ctx) dict->attributes_combo = fr_hash_table_create(dict, dict_attr_combo_hash, dict_attr_combo_cmp, hash_pool_free); if (!dict->attributes_combo) goto error; - dict->values_by_alias = fr_hash_table_create(dict, dict_enum_alias_hash, dict_enum_alias_cmp, hash_pool_free); - if (!dict->values_by_alias) goto error; + dict->values_by_name = fr_hash_table_create(dict, dict_enum_name_hash, dict_enum_name_cmp, hash_pool_free); + if (!dict->values_by_name) goto error; dict->values_by_da = fr_hash_table_create(dict, dict_enum_value_hash, dict_enum_value_cmp, hash_pool_free); if (!dict->values_by_da) goto error; diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index 492108cc969..cfb775a3e93 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -2374,7 +2374,7 @@ char const *fr_pair_value_enum(VALUE_PAIR const *vp, char buff[20]) fr_pair_value_snprint(buff, 20, vp, '\0'); str = buff; } else { - str = enumv->alias; + str = enumv->name; } return str; diff --git a/src/lib/util/value.c b/src/lib/util/value.c index 60dbe03946a..36099788e32 100644 --- a/src/lib/util/value.c +++ b/src/lib/util/value.c @@ -2651,7 +2651,7 @@ static inline int fr_value_box_cast_to_uint64(TALLOC_CTX *ctx, fr_value_box_t *d * @param dst_type to cast to. * @param dst_enumv Aliases for values contained within this fr_value_box_t. * If #fr_value_box_t is passed to #fr_value_box_asprint - * aliases will be printed instead of actual value. + * names will be printed instead of actual value. * @param src Input data. * @return * - 0 on success. @@ -2678,7 +2678,7 @@ int fr_value_box_cast(TALLOC_CTX *ctx, fr_value_box_t *dst, * * The theory here is that the attribute value isn't * being converted into its presentation format and - * re-parsed, and the enumv aliases only get applied + * re-parsed, and the enumv names only get applied * when converting internal values to/from strings, * so it's OK just to swap out the enumv. * @@ -2947,7 +2947,7 @@ int fr_value_box_cast(TALLOC_CTX *ctx, fr_value_box_t *dst, * @param dst_type to cast to. * @param dst_enumv Aliases for values contained within this fr_value_box_t. * If #fr_value_box_t is passed to #fr_value_box_asprint - * aliases will be printed instead of actual value. + * names will be printed instead of actual value. * @return * - 0 on success. * - -1 on failure. @@ -3926,7 +3926,7 @@ static int fr_value_box_from_integer_str(fr_value_box_t *dst, fr_type_t dst_type * @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 uint32 values. + * @param[in] dst_enumv fr_dict_attr_t with string names 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 @@ -3958,39 +3958,39 @@ int fr_value_box_from_str(TALLOC_CTX *ctx, fr_value_box_t *dst, ret = dict_attr_sizes[*dst_type][1]; /* Max length */ /* - * Lookup any aliases before continuing + * Lookup any names before continuing */ if (dst_enumv) { char *tmp = NULL; - char *alias; - size_t alias_len; + char *name; + size_t name_len; fr_dict_enum_t *enumv; if (len > (sizeof(buffer) - 1)) { tmp = talloc_array(NULL, char, len + 1); if (!tmp) return -1; - alias_len = fr_value_str_unescape((uint8_t *)tmp, in, len, quote); - alias = tmp; + name_len = fr_value_str_unescape((uint8_t *)tmp, in, len, quote); + name = tmp; } else { - alias_len = fr_value_str_unescape((uint8_t *)buffer, in, len, quote); - alias = buffer; + name_len = fr_value_str_unescape((uint8_t *)buffer, in, len, quote); + name = buffer; } - alias[alias_len] = '\0'; + name[name_len] = '\0'; /* - * Check the alias name is valid first before bothering + * Check the name name is valid first before bothering * to look it up. * * Catches any embedded \0 bytes that might cause * incorrect results. */ - if (fr_dict_valid_name(alias, alias_len) <= 0) { + if (fr_dict_valid_name(name, name_len) <= 0) { if (tmp) talloc_free(tmp); goto parse; } - enumv = fr_dict_enum_by_alias(dst_enumv, alias, alias_len); + enumv = fr_dict_enum_by_name(dst_enumv, name, name_len); if (tmp) talloc_free(tmp); if (!enumv) goto parse; @@ -4385,7 +4385,7 @@ char *fr_value_box_asprint(TALLOC_CTX *ctx, fr_value_box_t const *data, char quo fr_dict_enum_t const *dv; dv = fr_dict_enum_by_value(data->enumv, data); - if (dv) return talloc_typed_strdup(ctx, dv->alias); + if (dv) return talloc_typed_strdup(ctx, dv->name); } switch (data->type) { @@ -4894,7 +4894,7 @@ size_t fr_value_box_snprint(char *out, size_t outlen, fr_value_box_t const *data fr_dict_enum_t const *dv; dv = fr_dict_enum_by_value(data->enumv, data); - if (dv) return strlcpy(out, dv->alias, outlen); + if (dv) return strlcpy(out, dv->name, outlen); } switch (data->type) { diff --git a/src/modules/proto_detail/proto_detail.c b/src/modules/proto_detail/proto_detail.c index 246d7937f7a..53ff84daf3e 100644 --- a/src/modules/proto_detail/proto_detail.c +++ b/src/modules/proto_detail/proto_detail.c @@ -170,7 +170,7 @@ static int type_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, U * Allow the process module to be specified by * packet type. */ - type_enum = fr_dict_enum_by_alias(attr_packet_type, type_str, -1); + type_enum = fr_dict_enum_by_name(attr_packet_type, type_str, -1); if (!type_enum) { cf_log_err(ci, "Invalid type \"%s\"", type_str); return -1; diff --git a/src/modules/proto_detail/proto_detail_process.c b/src/modules/proto_detail/proto_detail_process.c index ac00984cae9..7c9ccb7af39 100644 --- a/src/modules/proto_detail/proto_detail_process.c +++ b/src/modules/proto_detail/proto_detail_process.c @@ -59,7 +59,7 @@ static rlm_rcode_t mod_process(void const *instance, REQUEST *request) switch (request->request_state) { case REQUEST_INIT: RDEBUG("Received %s ID %i", - fr_dict_enum_alias_by_value(inst->attr_packet_type, fr_box_uint32(request->packet->code)), + fr_dict_enum_name_by_value(inst->attr_packet_type, fr_box_uint32(request->packet->code)), request->packet->id); log_request_pair_list(L_DBG_LVL_1, request, request->packet->vps, ""); @@ -180,7 +180,7 @@ static rlm_rcode_t mod_process(void const *instance, REQUEST *request) REDEBUG("Failed ID %i", request->reply->id); } else { RDEBUG("Sent %s ID %i", - fr_dict_enum_alias_by_value(inst->attr_packet_type, fr_box_uint32(request->reply->code)), + fr_dict_enum_name_by_value(inst->attr_packet_type, fr_box_uint32(request->reply->code)), request->reply->id); } diff --git a/src/modules/proto_dhcpv4/proto_dhcpv4.c b/src/modules/proto_dhcpv4/proto_dhcpv4.c index 4d702623285..93cdf5ec6f3 100644 --- a/src/modules/proto_dhcpv4/proto_dhcpv4.c +++ b/src/modules/proto_dhcpv4/proto_dhcpv4.c @@ -142,7 +142,7 @@ static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, * Allow the process module to be specified by * packet type. */ - type_enum = fr_dict_enum_by_alias(attr_message_type, type_str, -1); + type_enum = fr_dict_enum_by_name(attr_message_type, type_str, -1); if (!type_enum) { cf_log_err(ci, "Invalid type \"%s\"", type_str); return -1; @@ -166,9 +166,9 @@ static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, * Setting 'type = foo' means you MUST have at least a * 'recv foo' section. */ - if (!cf_section_find(server, "recv", type_enum->alias)) { + if (!cf_section_find(server, "recv", type_enum->name)) { cf_log_err(ci, "Failed finding 'recv %s {...} section of virtual server %s", - type_enum->alias, cf_section_name2(server)); + type_enum->name, cf_section_name2(server)); return -1; } @@ -182,14 +182,14 @@ static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, inst = talloc_get_type_abort(parent_inst->data, proto_dhcpv4_t); inst->code_allowed[code] = true; - process_app_cs = cf_section_find(listen_cs, type_enum->alias, NULL); + process_app_cs = cf_section_find(listen_cs, type_enum->name, NULL); /* * Allocate an empty section if one doesn't exist * this is so defaults get parsed. */ if (!process_app_cs) { - MEM(process_app_cs = cf_section_alloc(listen_cs, listen_cs, type_enum->alias, NULL)); + MEM(process_app_cs = cf_section_alloc(listen_cs, listen_cs, type_enum->name, NULL)); } /* diff --git a/src/modules/proto_dhcpv4/proto_dhcpv4_base.c b/src/modules/proto_dhcpv4/proto_dhcpv4_base.c index 52c6782c44e..05a90467cc8 100644 --- a/src/modules/proto_dhcpv4/proto_dhcpv4_base.c +++ b/src/modules/proto_dhcpv4/proto_dhcpv4_base.c @@ -144,9 +144,9 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) return RLM_MODULE_FAIL; } - unlang = cf_section_find(request->server_cs, "recv", dv->alias); + unlang = cf_section_find(request->server_cs, "recv", dv->name); if (!unlang) { - RWDEBUG("Failed to find 'recv %s' section", dv->alias); + RWDEBUG("Failed to find 'recv %s' section", dv->name); request->reply->code = FR_DHCP_MESSAGE_TYPE_VALUE_DHCP_DO_NOT_RESPOND; goto send_reply; } @@ -211,7 +211,7 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) dv = fr_dict_enum_by_value(da, fr_box_uint8(request->reply->code)); unlang = NULL; - if (dv) unlang = cf_section_find(request->server_cs, "send", dv->alias); + if (dv) unlang = cf_section_find(request->server_cs, "send", dv->name); if (!unlang) goto send_reply; @@ -246,7 +246,7 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) */ if (request->reply->code != FR_DHCP_MESSAGE_TYPE_VALUE_DHCP_DO_NOT_RESPOND) { dv = fr_dict_enum_by_value(attr_message_type, fr_box_uint8(request->reply->code)); - RWDEBUG("Failed running 'send %s', trying 'send Do-Not-Respond'", dv->alias); + RWDEBUG("Failed running 'send %s', trying 'send Do-Not-Respond'", dv->name); request->reply->code = FR_DHCP_MESSAGE_TYPE_VALUE_DHCP_DO_NOT_RESPOND; @@ -254,10 +254,10 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) unlang = NULL; if (!dv) goto send_reply; - unlang = cf_section_find(request->server_cs, "send", dv->alias); + unlang = cf_section_find(request->server_cs, "send", dv->name); if (unlang) goto rerun_nak; - RWDEBUG("Not running 'send %s' section as it does not exist", dv->alias); + RWDEBUG("Not running 'send %s' section as it does not exist", dv->name); } break; } diff --git a/src/modules/proto_ldap_sync/proto_ldap_sync.c b/src/modules/proto_ldap_sync/proto_ldap_sync.c index e333da0a47d..fe497d47ed1 100644 --- a/src/modules/proto_ldap_sync/proto_ldap_sync.c +++ b/src/modules/proto_ldap_sync/proto_ldap_sync.c @@ -250,7 +250,7 @@ static int fr_dict_enum_from_name_number(fr_dict_attr_t const *da, fr_table_num_ for (p = table; p->name; p++) { value.vb_int32 = p->value; - if (fr_dict_enum_add_alias(da, p->name, &value, true, false) < 0) return -1; + if (fr_dict_enum_add_name(da, p->name, &value, true, false) < 0) return -1; } return 0; diff --git a/src/modules/proto_radius/proto_radius.c b/src/modules/proto_radius/proto_radius.c index 0135ac1c2b9..cf5eb238869 100644 --- a/src/modules/proto_radius/proto_radius.c +++ b/src/modules/proto_radius/proto_radius.c @@ -147,7 +147,7 @@ static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM * Allow the process module to be specified by * packet type. */ - type_enum = fr_dict_enum_by_alias(attr_packet_type, type_str, -1); + type_enum = fr_dict_enum_by_name(attr_packet_type, type_str, -1); if (!type_enum) { size_t i; @@ -183,9 +183,9 @@ static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM * Setting 'type = foo' means you MUST have at least a * 'recv foo' section. */ - if (!cf_section_find(server, "recv", type_enum->alias)) { + if (!cf_section_find(server, "recv", type_enum->name)) { cf_log_err(ci, "Failed finding 'recv %s {...} section of virtual server %s", - type_enum->alias, cf_section_name2(server)); + type_enum->name, cf_section_name2(server)); return -1; } @@ -210,14 +210,14 @@ static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM inst->code_allowed[FR_CODE_DISCONNECT_REQUEST] = true; } - process_app_cs = cf_section_find(listen_cs, type_enum->alias, NULL); + process_app_cs = cf_section_find(listen_cs, type_enum->name, NULL); /* * Allocate an empty section if one doesn't exist * this is so defaults get parsed. */ if (!process_app_cs) { - MEM(process_app_cs = cf_section_alloc(listen_cs, listen_cs, type_enum->alias, NULL)); + MEM(process_app_cs = cf_section_alloc(listen_cs, listen_cs, type_enum->name, NULL)); } /* diff --git a/src/modules/proto_radius/proto_radius_acct.c b/src/modules/proto_radius/proto_radius_acct.c index 96bde953eeb..a046b7a2150 100644 --- a/src/modules/proto_radius/proto_radius_acct.c +++ b/src/modules/proto_radius/proto_radius_acct.c @@ -125,9 +125,9 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) dv = fr_dict_enum_by_value(vp->da, &vp->data); if (!dv) goto setup_send; - unlang = cf_section_find(request->server_cs, "accounting", dv->alias); + unlang = cf_section_find(request->server_cs, "accounting", dv->name); if (!unlang) { - REDEBUG2("No 'accounting %s' section found: Ignoring it.", dv->alias); + REDEBUG2("No 'accounting %s' section found: Ignoring it.", dv->name); goto setup_send; } @@ -181,7 +181,7 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) dv = fr_dict_enum_by_value(attr_packet_type, fr_box_uint32(request->reply->code)); unlang = NULL; - if (dv) unlang = cf_section_find(request->server_cs, "send", dv->alias); + if (dv) unlang = cf_section_find(request->server_cs, "send", dv->name); if (!unlang) goto send_reply; diff --git a/src/modules/proto_radius/proto_radius_auth.c b/src/modules/proto_radius/proto_radius_auth.c index 701b1efdd80..f33e2adfccc 100644 --- a/src/modules/proto_radius/proto_radius_auth.c +++ b/src/modules/proto_radius/proto_radius_auth.c @@ -214,7 +214,7 @@ static void CC_HINT(format (printf, 4, 5)) auth_message(proto_radius_auth_t cons auth_type = fr_pair_find_by_da(request->control, attr_auth_type, TAG_ANY); if (auth_type) { snprintf(password_buff, sizeof(password_buff), "", - fr_dict_enum_alias_by_value(auth_type->da, &auth_type->data)); + fr_dict_enum_name_by_value(auth_type->da, &auth_type->data)); password_str = password_buff; } else { password_str = ""; @@ -407,9 +407,9 @@ static rlm_rcode_t mod_process(void const *instance, REQUEST *request) goto setup_send; } - unlang = cf_section_find(request->server_cs, "authenticate", dv->alias); + unlang = cf_section_find(request->server_cs, "authenticate", dv->name); if (!unlang) { - REDEBUG2("No 'authenticate %s' section found: rejecting the user", dv->alias); + REDEBUG2("No 'authenticate %s' section found: rejecting the user", dv->name); request->reply->code = FR_CODE_ACCESS_REJECT; goto setup_send; } @@ -515,7 +515,7 @@ static rlm_rcode_t mod_process(void const *instance, REQUEST *request) dv = fr_dict_enum_by_value(attr_packet_type, fr_box_uint32(request->reply->code)); unlang = NULL; - if (dv) unlang = cf_section_find(request->server_cs, "send", dv->alias); + if (dv) unlang = cf_section_find(request->server_cs, "send", dv->name); if (!unlang) goto send_reply; @@ -564,7 +564,7 @@ static rlm_rcode_t mod_process(void const *instance, REQUEST *request) if (request->reply->code != FR_CODE_ACCESS_REJECT) { dv = fr_dict_enum_by_value(attr_packet_type, fr_box_uint32(request->reply->code)); - RWDEBUG("Failed running 'send %s', trying 'send Access-Reject'", dv ? dv->alias : "???" ); + RWDEBUG("Failed running 'send %s', trying 'send Access-Reject'", dv ? dv->name : "???" ); request->reply->code = FR_CODE_ACCESS_REJECT; @@ -572,10 +572,10 @@ static rlm_rcode_t mod_process(void const *instance, REQUEST *request) unlang = NULL; if (!dv) goto send_reply; - unlang = cf_section_find(request->server_cs, "send", dv->alias); + unlang = cf_section_find(request->server_cs, "send", dv->name); if (unlang) goto rerun_nak; - RWDEBUG("Not running 'send %s' section as it does not exist", dv->alias); + RWDEBUG("Not running 'send %s' section as it does not exist", dv->name); } /* diff --git a/src/modules/proto_radius/proto_radius_coa.c b/src/modules/proto_radius/proto_radius_coa.c index f57ee83d404..192118b35c8 100644 --- a/src/modules/proto_radius/proto_radius_coa.c +++ b/src/modules/proto_radius/proto_radius_coa.c @@ -90,13 +90,13 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) } } - unlang = cf_section_find(request->server_cs, "recv", dv->alias); + unlang = cf_section_find(request->server_cs, "recv", dv->name); if (!unlang) { - REDEBUG("Failed to find 'recv %s' section", dv->alias); + REDEBUG("Failed to find 'recv %s' section", dv->name); return RLM_MODULE_FAIL; } - RDEBUG("Running 'recv %s' from file %s", dv->alias, cf_filename(unlang)); + RDEBUG("Running 'recv %s' from file %s", dv->name, cf_filename(unlang)); unlang_interpret_push_section(request, unlang, RLM_MODULE_NOOP, UNLANG_TOP_FRAME); request->request_state = REQUEST_RECV; @@ -141,7 +141,7 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) nak: dv = fr_dict_enum_by_value(attr_packet_type, fr_box_uint32(request->reply->code)); unlang = NULL; - if (dv) unlang = cf_section_find(request->server_cs, "send", dv->alias); + if (dv) unlang = cf_section_find(request->server_cs, "send", dv->name); if (!unlang) goto send_reply; @@ -186,7 +186,7 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) */ if (request->reply->code == request->packet->code + 1) { dv = fr_dict_enum_by_value(attr_packet_type, fr_box_uint32(request->reply->code)); - RWDEBUG("Failed running 'send %s', trying corresponding NAK section.", dv->alias); + RWDEBUG("Failed running 'send %s', trying corresponding NAK section.", dv->name); request->reply->code = request->packet->code + 2; @@ -194,10 +194,10 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) unlang = NULL; if (!dv) goto send_reply; - unlang = cf_section_find(request->server_cs, "send", dv->alias); + unlang = cf_section_find(request->server_cs, "send", dv->name); if (unlang) goto rerun_nak; - RWDEBUG("Not running 'send %s' section as it does not exist", dv->alias); + RWDEBUG("Not running 'send %s' section as it does not exist", dv->name); } /* * Else it was already a NAK or something else. diff --git a/src/modules/proto_radius/proto_radius_status.c b/src/modules/proto_radius/proto_radius_status.c index 21ccbc3cea4..12653c68281 100644 --- a/src/modules/proto_radius/proto_radius_status.c +++ b/src/modules/proto_radius/proto_radius_status.c @@ -111,7 +111,7 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) dv = fr_dict_enum_by_value(attr_packet_type, fr_box_uint32(request->reply->code)); unlang = NULL; - if (dv) unlang = cf_section_find(request->server_cs, "send", dv->alias); + if (dv) unlang = cf_section_find(request->server_cs, "send", dv->name); if (!unlang) goto send_reply; @@ -146,7 +146,7 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) */ if (request->reply->code != FR_CODE_ACCESS_REJECT) { dv = fr_dict_enum_by_value(attr_packet_type, fr_box_uint32(request->reply->code)); - if (dv) RWDEBUG("Failed running 'send %s', trying 'send Access-Reject'", dv->alias); + if (dv) RWDEBUG("Failed running 'send %s', trying 'send Access-Reject'", dv->name); request->reply->code = FR_CODE_ACCESS_REJECT; @@ -154,10 +154,10 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) unlang = NULL; if (!dv) goto send_reply; - unlang = cf_section_find(request->server_cs, "send", dv->alias); + unlang = cf_section_find(request->server_cs, "send", dv->name); if (unlang) goto rerun_nak; - RWDEBUG("Not running 'send %s' section as it does not exist", dv->alias); + RWDEBUG("Not running 'send %s' section as it does not exist", dv->name); } break; } diff --git a/src/modules/proto_tacacs/proto_tacacs.c b/src/modules/proto_tacacs/proto_tacacs.c index bb2c6817457..ab1fa8162ee 100644 --- a/src/modules/proto_tacacs/proto_tacacs.c +++ b/src/modules/proto_tacacs/proto_tacacs.c @@ -323,7 +323,7 @@ stop_processing: } RWDEBUG("Ignoring extra Auth-Type = %s", - fr_dict_enum_alias_by_value(auth_type->da, &vp->data)); + fr_dict_enum_name_by_value(auth_type->da, &vp->data)); } /* @@ -361,9 +361,9 @@ stop_processing: goto setup_send; } - unlang = cf_section_find(request->server_cs, "process", dv->alias); + unlang = cf_section_find(request->server_cs, "process", dv->name); if (!unlang) { - REDEBUG2("No 'process %s' section found: rejecting the user.", dv->alias); + REDEBUG2("No 'process %s' section found: rejecting the user.", dv->name); tacacs_status(request, RLM_MODULE_FAIL); goto setup_send; } diff --git a/src/modules/proto_vmps/proto_vmps.c b/src/modules/proto_vmps/proto_vmps.c index 8d60d21753a..7995c3d78ef 100644 --- a/src/modules/proto_vmps/proto_vmps.c +++ b/src/modules/proto_vmps/proto_vmps.c @@ -124,7 +124,7 @@ static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, * Allow the process module to be specified by * packet type. */ - type_enum = fr_dict_enum_by_alias(attr_packet_type, type_str, -1); + type_enum = fr_dict_enum_by_name(attr_packet_type, type_str, -1); if (!type_enum) { cf_log_err(ci, "Invalid type \"%s\"", type_str); return -1; @@ -144,9 +144,9 @@ static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, * Setting 'type = foo' means you MUST have at least a * 'recv foo' section. */ - if (!cf_section_find(server, "recv", type_enum->alias)) { + if (!cf_section_find(server, "recv", type_enum->name)) { cf_log_err(ci, "Failed finding 'recv %s {...} section of virtual server %s", - type_enum->alias, cf_section_name2(server)); + type_enum->name, cf_section_name2(server)); return -1; } @@ -161,14 +161,14 @@ static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, inst->code_allowed[code] = true; - process_app_cs = cf_section_find(listen_cs, type_enum->alias, NULL); + process_app_cs = cf_section_find(listen_cs, type_enum->name, NULL); /* * Allocate an empty section if one doesn't exist * this is so defaults get parsed. */ if (!process_app_cs) { - MEM(process_app_cs = cf_section_alloc(listen_cs, listen_cs, type_enum->alias, NULL)); + MEM(process_app_cs = cf_section_alloc(listen_cs, listen_cs, type_enum->name, NULL)); } /* diff --git a/src/modules/proto_vmps/proto_vmps_all.c b/src/modules/proto_vmps/proto_vmps_all.c index 1329cc2d6a4..a48b5604bda 100644 --- a/src/modules/proto_vmps/proto_vmps_all.c +++ b/src/modules/proto_vmps/proto_vmps_all.c @@ -69,9 +69,9 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) return RLM_MODULE_FAIL; } - unlang = cf_section_find(request->server_cs, "recv", dv->alias); + unlang = cf_section_find(request->server_cs, "recv", dv->name); if (!unlang) { - RWDEBUG("Failed to find 'recv %s' section", dv->alias); + RWDEBUG("Failed to find 'recv %s' section", dv->name); request->reply->code = FR_PACKET_TYPE_VALUE_DO_NOT_RESPOND; goto send_reply; } @@ -116,7 +116,7 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) dv = fr_dict_enum_by_value(attr_packet_type, fr_box_uint32(request->reply->code)); unlang = NULL; - if (dv) unlang = cf_section_find(request->server_cs, "send", dv->alias); + if (dv) unlang = cf_section_find(request->server_cs, "send", dv->name); if (!unlang) goto send_reply; @@ -152,7 +152,7 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) if (request->reply->code != FR_PACKET_TYPE_VALUE_DO_NOT_RESPOND) { dv = fr_dict_enum_by_value(attr_packet_type, fr_box_uint32(request->reply->code)); - RWDEBUG("Failed running 'send %s', trying 'send Do-Not-Respond'.", dv->alias); + RWDEBUG("Failed running 'send %s', trying 'send Do-Not-Respond'.", dv->name); request->reply->code = FR_PACKET_TYPE_VALUE_DO_NOT_RESPOND; @@ -161,10 +161,10 @@ static rlm_rcode_t mod_process(UNUSED void const *instance, REQUEST *request) unlang = NULL; if (!dv) goto send_reply; - unlang = cf_section_find(request->server_cs, "send", dv->alias); + unlang = cf_section_find(request->server_cs, "send", dv->name); if (unlang) goto rerun_nak; - RWDEBUG("Not running 'send %s' section as it does not exist", dv->alias); + RWDEBUG("Not running 'send %s' section as it does not exist", dv->name); } break; } diff --git a/src/modules/rlm_chap/rlm_chap.c b/src/modules/rlm_chap/rlm_chap.c index 1914aae9b81..89ae47b95e4 100644 --- a/src/modules/rlm_chap/rlm_chap.c +++ b/src/modules/rlm_chap/rlm_chap.c @@ -201,11 +201,11 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf) inst->name = cf_section_name2(conf); if (!inst->name) inst->name = cf_section_name1(conf); - if (fr_dict_enum_add_alias_next(attr_auth_type, inst->name) < 0) { + if (fr_dict_enum_add_name_next(attr_auth_type, inst->name) < 0) { PERROR("Failed adding %s alias", attr_auth_type->name); return -1; } - inst->auth_type = fr_dict_enum_by_alias(attr_auth_type, inst->name, -1); + inst->auth_type = fr_dict_enum_by_name(attr_auth_type, inst->name, -1); rad_assert(inst->auth_type); return 0; diff --git a/src/modules/rlm_detail/rlm_detail.c b/src/modules/rlm_detail/rlm_detail.c index 92c2fb5d6d1..3ab6307e1eb 100644 --- a/src/modules/rlm_detail/rlm_detail.c +++ b/src/modules/rlm_detail/rlm_detail.c @@ -278,7 +278,7 @@ static int detail_write(FILE *out, rlm_detail_t const *inst, REQUEST *request, R */ if (is_radius_code(packet->code)) { WRITE("\tPacket-Type = %s\n", - fr_dict_enum_alias_by_value(attr_packet_type, fr_box_uint32(packet->code))); + fr_dict_enum_name_by_value(attr_packet_type, fr_box_uint32(packet->code))); } else { WRITE("\tPacket-Type = %u\n", packet->code); } diff --git a/src/modules/rlm_digest/rlm_digest.c b/src/modules/rlm_digest/rlm_digest.c index 15fbf54d8ee..f6db40f84e6 100644 --- a/src/modules/rlm_digest/rlm_digest.c +++ b/src/modules/rlm_digest/rlm_digest.c @@ -585,11 +585,11 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf) if (!name) name = cf_section_name1(conf); inst->name = name; - if (fr_dict_enum_add_alias_next(attr_auth_type, inst->name) < 0) { + if (fr_dict_enum_add_name_next(attr_auth_type, inst->name) < 0) { PERROR("Failed adding %s alias", attr_auth_type->name); return -1; } - inst->auth_type = fr_dict_enum_by_alias(attr_auth_type, inst->name, -1); + inst->auth_type = fr_dict_enum_by_name(attr_auth_type, inst->name, -1); rad_assert(inst->auth_type); return 0; diff --git a/src/modules/rlm_eap/rlm_eap.c b/src/modules/rlm_eap/rlm_eap.c index 1cdf9bdfdbc..7fe9602f1f5 100644 --- a/src/modules/rlm_eap/rlm_eap.c +++ b/src/modules/rlm_eap/rlm_eap.c @@ -996,11 +996,11 @@ static int mod_bootstrap(void *instance, CONF_SECTION *cs) inst->name = cf_section_name2(cs); if (!inst->name) inst->name = "eap"; - if (fr_dict_enum_add_alias_next(attr_auth_type, inst->name) < 0) { + if (fr_dict_enum_add_name_next(attr_auth_type, inst->name) < 0) { PERROR("Failed adding %s alias", inst->name); return -1; } - inst->auth_type = fr_dict_enum_by_alias(attr_auth_type, inst->name, -1); + inst->auth_type = fr_dict_enum_by_name(attr_auth_type, inst->name, -1); rad_assert(inst->name); /* 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 79c120faed5..ba49bfd60f5 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 @@ -86,11 +86,11 @@ static int auth_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *paren { char const *auth_type = cf_pair_value(cf_item_to_pair(ci)); - if (fr_dict_enum_add_alias_next(attr_auth_type, auth_type) < 0) { + if (fr_dict_enum_add_name_next(attr_auth_type, auth_type) < 0) { cf_log_err(ci, "Failed adding %s alias", attr_auth_type->name); return -1; } - *((fr_dict_enum_t **)out) = fr_dict_enum_by_alias(attr_auth_type, auth_type, -1); + *((fr_dict_enum_t **)out) = fr_dict_enum_by_name(attr_auth_type, auth_type, -1); return 0; } @@ -166,7 +166,7 @@ static rlm_rcode_t mod_process(void *instance, void *thread, REQUEST *request) fr_pair_value_bstrncpy(vp, eap_round->response->type.data, eap_round->response->type.length); vp->vp_tainted = true; - unlang = cf_section_find(request->server_cs, "authenticate", inst->auth_type->alias); + unlang = cf_section_find(request->server_cs, "authenticate", inst->auth_type->name); if (!unlang) { /* * Call the authenticate section of the *current* virtual server. 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 0c193f21d27..a76ab5bc453 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 @@ -134,11 +134,11 @@ static int auth_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *paren { char const *auth_type = cf_pair_value(cf_item_to_pair(ci)); - if (fr_dict_enum_add_alias_next(attr_auth_type, auth_type) < 0) { + if (fr_dict_enum_add_name_next(attr_auth_type, auth_type) < 0) { cf_log_err(ci, "Failed adding %s alias", attr_auth_type->name); return -1; } - *((fr_dict_enum_t **)out) = fr_dict_enum_by_alias(attr_auth_type, auth_type, -1); + *((fr_dict_enum_t **)out) = fr_dict_enum_by_name(attr_auth_type, auth_type, -1); return 0; } @@ -749,7 +749,7 @@ packet_ready: /* * This is a wild & crazy hack. */ - unlang = cf_section_find(request->server_cs, "authenticate", inst->auth_type->alias); + unlang = cf_section_find(request->server_cs, "authenticate", inst->auth_type->name); if (!unlang) { rcode = process_authenticate(inst->auth_type->value->vb_uint32, request); } else { diff --git a/src/modules/rlm_mschap/rlm_mschap.c b/src/modules/rlm_mschap/rlm_mschap.c index afb11bdb923..2456f5a30ee 100644 --- a/src/modules/rlm_mschap/rlm_mschap.c +++ b/src/modules/rlm_mschap/rlm_mschap.c @@ -2188,11 +2188,11 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf) if (!name) name = cf_section_name1(conf); inst->name = name; - if (fr_dict_enum_add_alias_next(attr_auth_type, inst->name) < 0) { + if (fr_dict_enum_add_name_next(attr_auth_type, inst->name) < 0) { PERROR("Failed adding %s alias", attr_auth_type->name); return -1; } - inst->auth_type = fr_dict_enum_by_alias(attr_auth_type, inst->name, -1); + inst->auth_type = fr_dict_enum_by_name(attr_auth_type, inst->name, -1); rad_assert(inst->auth_type); xlat_register(inst, inst->name, mschap_xlat, NULL, NULL, 0, XLAT_DEFAULT_BUF_LEN, true); diff --git a/src/modules/rlm_opendirectory/rlm_opendirectory.c b/src/modules/rlm_opendirectory/rlm_opendirectory.c index 30c4a18c01e..f8e727d5aaa 100644 --- a/src/modules/rlm_opendirectory/rlm_opendirectory.c +++ b/src/modules/rlm_opendirectory/rlm_opendirectory.c @@ -517,11 +517,11 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf) inst->name = cf_section_name2(conf); if (!inst->name) inst->name = cf_section_name1(conf); - if (fr_dict_enum_add_alias_next(attr_auth_type, inst->name) < 0) { + if (fr_dict_enum_add_name_next(attr_auth_type, inst->name) < 0) { PERROR("Failed adding %s alias", attr_auth_type->name); return -1; } - inst->auth_type = fr_dict_enum_by_alias(attr_auth_type, inst->name, -1); + inst->auth_type = fr_dict_enum_by_name(attr_auth_type, inst->name, -1); rad_assert(inst->auth_type); return 0; diff --git a/src/modules/rlm_pap/rlm_pap.c b/src/modules/rlm_pap/rlm_pap.c index 581800283d0..1a785769238 100644 --- a/src/modules/rlm_pap/rlm_pap.c +++ b/src/modules/rlm_pap/rlm_pap.c @@ -922,11 +922,11 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf) if (!name) name = cf_section_name1(conf); inst->name = name; - if (fr_dict_enum_add_alias_next(attr_auth_type, inst->name) < 0) { + if (fr_dict_enum_add_name_next(attr_auth_type, inst->name) < 0) { PERROR("Failed adding %s alias", attr_auth_type->name); return -1; } - inst->auth_type = fr_dict_enum_by_alias(attr_auth_type, inst->name, -1); + inst->auth_type = fr_dict_enum_by_name(attr_auth_type, inst->name, -1); rad_assert(inst->auth_type); return 0; diff --git a/src/modules/rlm_radius/rlm_radius.c b/src/modules/rlm_radius/rlm_radius.c index 3bfd7a45e8b..6a3c990f943 100644 --- a/src/modules/rlm_radius/rlm_radius.c +++ b/src/modules/rlm_radius/rlm_radius.c @@ -198,7 +198,7 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, * Allow the process module to be specified by * packet type. */ - type_enum = fr_dict_enum_by_alias(attr_packet_type, type_str, -1); + type_enum = fr_dict_enum_by_name(attr_packet_type, type_str, -1); if (!type_enum) { invalid_code: cf_log_err(ci, "Unknown or invalid RADIUS packet type '%s'", type_str); @@ -287,7 +287,7 @@ static int status_check_type_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED voi * Allow the process module to be specified by * packet type. */ - type_enum = fr_dict_enum_by_alias(attr_packet_type, type_str, -1); + type_enum = fr_dict_enum_by_name(attr_packet_type, type_str, -1); if (!type_enum) { invalid_code: cf_log_err(ci, "Unknown or invalid RADIUS packet type '%s'", type_str); diff --git a/src/modules/rlm_rediswho/rlm_rediswho.c b/src/modules/rlm_rediswho/rlm_rediswho.c index 391e3eb9350..88b50435542 100644 --- a/src/modules/rlm_rediswho/rlm_rediswho.c +++ b/src/modules/rlm_rediswho/rlm_rediswho.c @@ -217,9 +217,9 @@ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, UNUSED void * return RLM_MODULE_NOOP; } - cs = cf_section_find(inst->cs, dv->alias, NULL); + cs = cf_section_find(inst->cs, dv->name, NULL); if (!cs) { - RDEBUG2("No subsection %s", dv->alias); + RDEBUG2("No subsection %s", dv->name); return RLM_MODULE_NOOP; } diff --git a/src/modules/rlm_winbind/rlm_winbind.c b/src/modules/rlm_winbind/rlm_winbind.c index 115a3a9ecf7..117c449503c 100644 --- a/src/modules/rlm_winbind/rlm_winbind.c +++ b/src/modules/rlm_winbind/rlm_winbind.c @@ -335,11 +335,11 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf) inst->name = cf_section_name2(conf); if (!inst->name) inst->name = cf_section_name1(conf); - if (fr_dict_enum_add_alias_next(attr_auth_type, inst->name) < 0) { + if (fr_dict_enum_add_name_next(attr_auth_type, inst->name) < 0) { PERROR("Failed adding %s alias", inst->name); return -1; } - inst->auth_type = fr_dict_enum_by_alias(attr_auth_type, inst->name, -1); + inst->auth_type = fr_dict_enum_by_name(attr_auth_type, inst->name, -1); if (inst->group_attribute) { group_attribute = inst->group_attribute; diff --git a/src/modules/rlm_yubikey/rlm_yubikey.c b/src/modules/rlm_yubikey/rlm_yubikey.c index a67779fc8b3..9c78ee989d9 100644 --- a/src/modules/rlm_yubikey/rlm_yubikey.c +++ b/src/modules/rlm_yubikey/rlm_yubikey.c @@ -165,11 +165,11 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf) } #endif - if (fr_dict_enum_add_alias_next(attr_auth_type, inst->name) < 0) { + if (fr_dict_enum_add_name_next(attr_auth_type, inst->name) < 0) { PERROR("Failed adding %s alias", inst->name); return -1; } - inst->auth_type = fr_dict_enum_by_alias(attr_auth_type, inst->name, -1); + inst->auth_type = fr_dict_enum_by_name(attr_auth_type, inst->name, -1); if (!cf_section_name2(conf)) return 0; diff --git a/src/protocols/dhcpv4/base.c b/src/protocols/dhcpv4/base.c index 856efdb9c1e..170f7e0b5af 100644 --- a/src/protocols/dhcpv4/base.c +++ b/src/protocols/dhcpv4/base.c @@ -556,7 +556,7 @@ int fr_dhcpv4_global_init(void) } value.vb_uint8 = i; - if (fr_dict_enum_add_alias(attr_dhcp_parameter_request_list, attr->name, &value, true, false) < 0) { + if (fr_dict_enum_add_name(attr_dhcp_parameter_request_list, attr->name, &value, true, false) < 0) { return -1; } } diff --git a/src/protocols/dhcpv6/base.c b/src/protocols/dhcpv6/base.c index e71014aec5c..6a86875444a 100644 --- a/src/protocols/dhcpv6/base.c +++ b/src/protocols/dhcpv6/base.c @@ -466,7 +466,7 @@ int fr_dhcpv6_global_init(void) value.vb_uint16 = child->attr; - if (fr_dict_enum_add_alias(attr_option_request, child->name, &value, true, false) < 0) { + if (fr_dict_enum_add_name(attr_option_request, child->name, &value, true, false) < 0) { fr_dict_autofree(libfreeradius_dhcpv6_dict); return -1; } diff --git a/src/protocols/tacacs/base.c b/src/protocols/tacacs/base.c index c69eb96391a..4271f9c791d 100644 --- a/src/protocols/tacacs/base.c +++ b/src/protocols/tacacs/base.c @@ -109,7 +109,7 @@ char const *tacacs_packet_code(RADIUS_PACKET const * const packet) dv = fr_dict_enum_by_value(attr_tacacs_packet_type, fr_box_uint32(type)); if (!dv) return NULL; - return dv->alias; + return dv->name; } uint32_t tacacs_session_id(RADIUS_PACKET const * const packet)