From: Alan T. DeKok Date: Mon, 15 May 2023 19:45:31 +0000 (-0400) Subject: remove "parse_new_conditions" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94ee43c0b1b76313fcb02c39ce56e2c5f0567109;p=thirdparty%2Ffreeradius-server.git remove "parse_new_conditions" That was only useful while developing the new conditions. We can now just switch to them via "use_new_conditions" --- diff --git a/src/lib/server/cf_file.c b/src/lib/server/cf_file.c index 1bfeb5814a6..9cc7976f445 100644 --- a/src/lib/server/cf_file.c +++ b/src/lib/server/cf_file.c @@ -1518,7 +1518,6 @@ static CONF_ITEM *process_if(cf_stack_t *stack) char *buff[4]; tmpl_rules_t t_rules; bool use_new_conditions = main_config_migrate_option_get("use_new_conditions"); - bool parse_new_conditions = main_config_migrate_option_get("parse_new_conditions"); /* * Short names are nicer. @@ -1678,9 +1677,7 @@ static CONF_ITEM *process_if(cf_stack_t *stack) talloc_free(cs); return NULL; } - } - - if (parse_new_conditions) { + } else { name2 = buff[3]; } } diff --git a/src/lib/server/main_config.c b/src/lib/server/main_config.c index 21c50b91bcf..f46db3ac6c4 100644 --- a/src/lib/server/main_config.c +++ b/src/lib/server/main_config.c @@ -184,7 +184,6 @@ static const CONF_PARSER migrate_config[] = { { FR_CONF_OFFSET("unflatten_after_decode", FR_TYPE_BOOL | FR_TYPE_HIDDEN, main_config_t, unflatten_after_decode) }, { FR_CONF_OFFSET("unflatten_before_encode", FR_TYPE_BOOL | FR_TYPE_HIDDEN, main_config_t, unflatten_before_encode) }, { FR_CONF_OFFSET("tmpl_tokenize_all_nested", FR_TYPE_BOOL | FR_TYPE_HIDDEN, main_config_t, tmpl_tokenize_all_nested) }, - { FR_CONF_OFFSET("parse_new_conditions", FR_TYPE_BOOL | FR_TYPE_HIDDEN, main_config_t, parse_new_conditions) }, { FR_CONF_OFFSET("use_new_conditions", FR_TYPE_BOOL | FR_TYPE_HIDDEN, main_config_t, use_new_conditions) }, { FR_CONF_OFFSET("rewrite_update", FR_TYPE_BOOL | FR_TYPE_HIDDEN, main_config_t, rewrite_update) }, { FR_CONF_OFFSET("forbid_update", FR_TYPE_BOOL | FR_TYPE_HIDDEN, main_config_t, forbid_update) }, @@ -1461,7 +1460,6 @@ void main_config_hup(main_config_t *config) } static fr_table_num_ordered_t config_arg_table[] = { - { L("parse_new_conditions"), offsetof(main_config_t, parse_new_conditions) }, { L("use_new_conditions"), offsetof(main_config_t, use_new_conditions) }, { L("tmpl_tokenize_all_nested"), offsetof(main_config_t, tmpl_tokenize_all_nested) }, { L("rewrite_update"), offsetof(main_config_t, rewrite_update) }, diff --git a/src/lib/server/main_config.h b/src/lib/server/main_config.h index 48aa39fb5e0..916b125a80d 100644 --- a/src/lib/server/main_config.h +++ b/src/lib/server/main_config.h @@ -161,7 +161,6 @@ struct main_config_s { bool unflatten_after_decode; //!< the worker will call "unflatten" after protocol decoding bool unflatten_before_encode; //!< the worker will call "unflatten" before all encoding bool tmpl_tokenize_all_nested; //!< tmpl_tokenize will create nested tmpls instead of flat ones - bool parse_new_conditions; //!< the new xlat expressions will be parsed, but not used. bool use_new_conditions; //!< the new xlat expressions will be used for conditions, instead of the old code bool rewrite_update; //!< rewrite "update" to be new edit sections bool forbid_update; //!< forbid "update" sections diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index b1b366749bb..fb5a4da8411 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -3654,7 +3654,7 @@ static unlang_t *compile_if_subsection(unlang_t *parent, unlang_compile_t *unlan /* * Migration support. */ - if (main_config->parse_new_conditions) { + if (main_config->use_new_conditions) { char const *name2 = cf_section_name2(cs); ssize_t slen; @@ -3700,11 +3700,9 @@ static unlang_t *compile_if_subsection(unlang_t *parent, unlang_compile_t *unlan * If the condition is always false, we don't compile the * children. */ - if (main_config->use_new_conditions) { - if (is_truthy && !value) goto skip; + if (is_truthy && !value) goto skip; - goto do_compile; - } + goto do_compile; } cond = cf_data_value(cf_data_find(cs, fr_cond_t, NULL)); diff --git a/src/tests/keywords/all.mk b/src/tests/keywords/all.mk index 59924f72433..b82a4df6fdb 100644 --- a/src/tests/keywords/all.mk +++ b/src/tests/keywords/all.mk @@ -72,13 +72,13 @@ KEYWORD_UPDATE_REWRITE_TESTS := update-all update-array update-delete update-rem # conditions, so we don't run them under the new conditions. # ifneq "$(findstring ${1}, paircmp if-paircmp)" "" -$(OUTPUT)/${1}: NEW_COND=-S parse_new_conditions=no -S use_new_conditions=no +$(OUTPUT)/${1}: NEW_COND=-S use_new_conditions=no else ifneq "$(findstring ${1}, comments update-to-edit if-regex-multivalue smash wimax unknown $(KEYWORD_UPDATE_TESTS) vendor_specific vendor_specific.raw xlat-unknown update-proto update-proto-error)" "" -$(OUTPUT)/${1}: NEW_COND=-S parse_new_conditions=yes -S use_new_conditions=yes +$(OUTPUT)/${1}: NEW_COND=-S use_new_conditions=yes else ifneq "$(findstring ${1}, $(KEYWORD_UPDATE_REWRITE_TESTS))" "" -$(OUTPUT)/${1}: NEW_COND=-S parse_new_conditions=yes -S use_new_conditions=yes -S rewrite_update=yes +$(OUTPUT)/${1}: NEW_COND=-S use_new_conditions=yes -S rewrite_update=yes else -$(OUTPUT)/${1}: NEW_COND=-S parse_new_conditions=yes -S use_new_conditions=yes -S forbid_update=yes +$(OUTPUT)/${1}: NEW_COND=-S use_new_conditions=yes -S forbid_update=yes endif endef diff --git a/src/tests/modules/all.mk b/src/tests/modules/all.mk index eb719bd96de..b0c32583be4 100644 --- a/src/tests/modules/all.mk +++ b/src/tests/modules/all.mk @@ -79,8 +79,8 @@ $(foreach x, $(filter sql_%,$(FILES)), $(eval $$(OUTPUT.$(TEST))/$x: $(patsubst # Migration support. Some of the tests don't run under the new # conditions, so we don't run them under the new conditions. # -$(foreach x, $(filter ldap% sql_%,$(FILES)), $(eval $$(OUTPUT.$(TEST))/$x: NEW_COND=-S parse_new_conditions=no -S use_new_conditions=no)) -$(foreach x, $(filter-out ldap% sql_%,$(FILES)), $(eval $$(OUTPUT.$(TEST))/$x: NEW_COND=-S parse_new_conditions=yes -S use_new_conditions=yes)) +$(foreach x, $(filter ldap% sql_%,$(FILES)), $(eval $$(OUTPUT.$(TEST))/$x: NEW_COND=-S use_new_conditions=no)) +$(foreach x, $(filter-out ldap% sql_%,$(FILES)), $(eval $$(OUTPUT.$(TEST))/$x: NEW_COND=-S use_new_conditions=yes)) # # Files in the output dir depend on the unit tests diff --git a/src/tests/process/all.mk b/src/tests/process/all.mk index a76630ec970..0fc6fb96f55 100644 --- a/src/tests/process/all.mk +++ b/src/tests/process/all.mk @@ -28,7 +28,7 @@ FILES := $(filter-out %.ignore %.conf %.md %.attrs %.mk %~ %.rej,$(subst $(DIR)/ $(eval $(call TEST_BOOTSTRAP)) -# -S parse_new_conditions=yes -S use_new_conditions=yes -S forbid_update=yes +# -S use_new_conditions=yes -S forbid_update=yes # # The dictionaries are in "share", because the server tries to load @@ -85,7 +85,7 @@ $(foreach x,$(FILES),$(eval $(call PROCESS_TEST,$x))) # PROCESS_ARGS := -p test PROCESS_ARGS += -D $(DIR)/share -d $(DIR)/ -PROCESS_ARGS += -S parse_new_conditions=yes -S use_new_conditions=yes -S forbid_update=yes +PROCESS_ARGS += -S use_new_conditions=yes -S forbid_update=yes PROCESS_ARGS += -i $(DIR)/test.attrs -f $(DIR)/test.attrs $(OUTPUT)/%: $(DIR)/% $(TEST_BIN_DIR)/unit_test_module $(DIR)/unit_test_module.conf