From: Alan T. DeKok Date: Tue, 28 Mar 2023 07:36:46 +0000 (+0900) Subject: move disallow_qualifiers boolean to list_presence enum X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6100d384574d82858a2960a8fd3e4845c531fa59;p=thirdparty%2Ffreeradius-server.git move disallow_qualifiers boolean to list_presence enum --- diff --git a/src/bin/unit_test_attribute.c b/src/bin/unit_test_attribute.c index ae137fcd04a..1f5dbc86581 100644 --- a/src/bin/unit_test_attribute.c +++ b/src/bin/unit_test_attribute.c @@ -2595,16 +2595,6 @@ static ssize_t command_tmpl_rule_attr_parent(UNUSED TALLOC_CTX *ctx, tmpl_rules_ return slen; } -static ssize_t command_tmpl_rule_disallow_qualifiers(UNUSED TALLOC_CTX *ctx, tmpl_rules_t *rules, fr_sbuff_t *value) -{ - bool res; - ssize_t slen; - - slen = fr_sbuff_out_bool(&res, value); - rules->attr.disallow_qualifiers = res; - return slen; -} - static ssize_t command_tmpl_rule_list_def(UNUSED TALLOC_CTX *ctx, tmpl_rules_t *rules, fr_sbuff_t *value) { ssize_t slen; @@ -2647,7 +2637,6 @@ static size_t command_tmpl_rules(command_result_t *result, command_file_ctx_t *c { L("allow_unknown"), (void *)command_tmpl_rule_allow_unknown }, { L("allow_unresolved"), (void *)command_tmpl_rule_allow_unresolved }, { L("attr_parent"), (void *)command_tmpl_rule_attr_parent }, - { L("disallow_qualifiers"), (void *)command_tmpl_rule_disallow_qualifiers }, { L("list_def"), (void *)command_tmpl_rule_list_def }, { L("request_def"), (void *)command_tmpl_rule_request_def } }; @@ -3152,7 +3141,7 @@ static fr_table_ptr_sorted_t commands[] = { { L("tmpl-rules "), &(command_entry_t){ .func = command_tmpl_rules, - .usage = "tmpl-rule [allow_foreign=yes] [allow_unknown=yes|no] [allow_unresolved=yes|no] [attr_parent=] [disallow_qualifiers=yes|no] [list_def=request|reply|control|session-state] [request_def=current|outer|parent]", + .usage = "tmpl-rule [allow_foreign=yes] [allow_unknown=yes|no] [allow_unresolved=yes|no] [attr_parent=] [list_def=request|reply|control|session-state] [request_def=current|outer|parent]", .description = "Alter the tmpl parsing rules for subsequent tmpl parsing commands in the same command context" }}, { L("touch "), &(command_entry_t){ diff --git a/src/lib/server/map.c b/src/lib/server/map.c index 5eea7c9d07c..610d82db5ff 100644 --- a/src/lib/server/map.c +++ b/src/lib/server/map.c @@ -846,14 +846,6 @@ do_children: goto error; /* re-do "goto marker" stuff to print out spaces ? */ } - /* - * Disallow list qualifiers for the child - * templates. The syntax requires that - * the child attributes go into the - * parent one. - */ - child_lhs_rules.attr.disallow_qualifiers = true; - /* * The leaf reference of the outer section * is used as the parsing context of the diff --git a/src/lib/server/tmpl.h b/src/lib/server/tmpl.h index c9683aa95b2..5874ab9f917 100644 --- a/src/lib/server/tmpl.h +++ b/src/lib/server/tmpl.h @@ -321,8 +321,6 @@ struct tmpl_attr_rules_s { uint8_t allow_foreign:1; //!< Allow arguments not found in dict_def. - uint8_t disallow_qualifiers:1; //!< disallow request / list qualifiers - uint8_t disallow_filters:1; //!< disallow filters. }; diff --git a/src/lib/server/tmpl_tokenize.c b/src/lib/server/tmpl_tokenize.c index 3dd45e4afd3..a56260ec80a 100644 --- a/src/lib/server/tmpl_tokenize.c +++ b/src/lib/server/tmpl_tokenize.c @@ -595,7 +595,7 @@ static fr_slen_t tmpl_request_ref_list_from_substr(TALLOC_CTX *ctx, tmpl_attr_er } if (depth == 0) { - if (at_rules->namespace || at_rules->disallow_qualifiers) { + if (at_rules->namespace || (at_rules->list_presence == TMPL_ATTR_LIST_FORBID)) { fr_strerror_const("It is not permitted to specify a request reference here"); if (err) *err = TMPL_ATTR_ERROR_INVALID_LIST_QUALIFIER; diff --git a/src/lib/server/users_file.c b/src/lib/server/users_file.c index 321f19b316a..98aafb387cf 100644 --- a/src/lib/server/users_file.c +++ b/src/lib/server/users_file.c @@ -273,7 +273,7 @@ int pairlist_read(TALLOC_CTX *ctx, fr_dict_t const *dict, char const *file, PAIR .dict_def = dict, .prefix = TMPL_ATTR_REF_PREFIX_NO, .list_def = request_attr_request, - .disallow_qualifiers = true, /* for now, until more tests are made */ + .list_presence = TMPL_ATTR_LIST_FORBID, /* * Otherwise the tmpl code returns 0 when asked @@ -290,7 +290,7 @@ int pairlist_read(TALLOC_CTX *ctx, fr_dict_t const *dict, char const *file, PAIR .dict_def = dict, .prefix = TMPL_ATTR_REF_PREFIX_YES, .list_def = request_attr_request, - .disallow_qualifiers = true, /* for now, until rlm_files supports it */ + .list_presence = TMPL_ATTR_LIST_FORBID, } }; diff --git a/src/listen/ldap_sync/proto_ldap_sync.c b/src/listen/ldap_sync/proto_ldap_sync.c index 76a9310db33..4ef2f195f4a 100644 --- a/src/listen/ldap_sync/proto_ldap_sync.c +++ b/src/listen/ldap_sync/proto_ldap_sync.c @@ -290,7 +290,7 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) .allow_foreign = false, .allow_unknown = false, .allow_unresolved = false, - .disallow_qualifiers = true, + .list_presence = TMPL_ATTR_LIST_FORBID, } };