From: Alan T. DeKok Date: Wed, 8 Oct 2025 18:42:07 +0000 (-0400) Subject: move function to bottom of file X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03af2ac1837da875c755d5d75ad10fd45791420d;p=thirdparty%2Ffreeradius-server.git move function to bottom of file to be compatible with others, so there are consistent locations --- diff --git a/src/protocols/tacacs/base.c b/src/protocols/tacacs/base.c index 2cdec93aa29..0a7520bb3b4 100644 --- a/src/protocols/tacacs/base.c +++ b/src/protocols/tacacs/base.c @@ -142,42 +142,6 @@ char const *fr_tacacs_packet_names[FR_TACACS_CODE_MAX] = { }; -int fr_tacacs_global_init(void) -{ - if (instance_count > 0) { - instance_count++; - return 0; - } - - instance_count++; - - if (fr_dict_autoload(libfreeradius_tacacs_dict) < 0) { - fail: - instance_count--; - return -1; - } - - if (fr_dict_attr_autoload(libfreeradius_tacacs_dict_attr) < 0) { - fr_dict_autofree(libfreeradius_tacacs_dict); - goto fail; - } - - instantiated = true; - return 0; -} - -void fr_tacacs_global_free(void) -{ - if (!instantiated) return; - - fr_assert(instance_count > 0); - - if (--instance_count > 0) return; - - fr_dict_autofree(libfreeradius_tacacs_dict); - instantiated = false; -} - /** XOR the body based on the secret key. * * This function encrypts (or decrypts) TACACS+ packets, and sets the "encrypted" flag. @@ -619,3 +583,40 @@ void _fr_tacacs_packet_log_hex(fr_log_t const *log, fr_tacacs_packet_t const *pa fr_assert(p == end); } + +int fr_tacacs_global_init(void) +{ + if (instance_count > 0) { + instance_count++; + return 0; + } + + instance_count++; + + if (fr_dict_autoload(libfreeradius_tacacs_dict) < 0) { + fail: + instance_count--; + return -1; + } + + if (fr_dict_attr_autoload(libfreeradius_tacacs_dict_attr) < 0) { + fr_dict_autofree(libfreeradius_tacacs_dict); + goto fail; + } + + instantiated = true; + return 0; +} + +void fr_tacacs_global_free(void) +{ + if (!instantiated) return; + + fr_assert(instance_count > 0); + + if (--instance_count > 0) return; + + fr_dict_autofree(libfreeradius_tacacs_dict); + instantiated = false; +} +