From: Arran Cudbard-Bell Date: Sat, 22 Oct 2022 08:15:33 +0000 (-0400) Subject: Catch commands returning invalid codes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0f00104427ddbc7d636b20f24252c9be61061b7;p=thirdparty%2Ffreeradius-server.git Catch commands returning invalid codes --- diff --git a/src/bin/unit_test_attribute.c b/src/bin/unit_test_attribute.c index 1b6a2bbcfe4..845e332d4ac 100644 --- a/src/bin/unit_test_attribute.c +++ b/src/bin/unit_test_attribute.c @@ -981,7 +981,7 @@ static int dictionary_load_common(command_result_t *result, command_file_ctx_t * * Decrease ref count if we're loading in a new dictionary */ if (cc->tmpl_rules.attr.dict_def) { - if (fr_dict_const_free(&cc->tmpl_rules.attr.dict_def, __FILE__) < 0) return -1; + if (fr_dict_const_free(&cc->tmpl_rules.attr.dict_def, __FILE__) < 0) RETURN_COMMAND_ERROR(); } q = strchr(in, ' '); @@ -3497,7 +3497,6 @@ static int process_file(bool *exit_now, TALLOC_CTX *ctx, command_config_t const case RESULT_MISMATCH: { ret = EXIT_FAILURE; - goto finish; } @@ -3505,6 +3504,14 @@ static int process_file(bool *exit_now, TALLOC_CTX *ctx, command_config_t const ret = result.ret; *exit_now = true; goto finish; + + default: + /* + * If this happens, fix the damn command. + */ + fr_assert_msg(false, "Command exited with invalid return code (%i)", result.rcode); + ret = -1; + goto finish; } }