]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
xlat: Register xlat protocols _AFTER_ bootstrap has completed
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 15 Jun 2023 15:20:09 +0000 (11:20 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 15 Jun 2023 15:20:09 +0000 (11:20 -0400)
src/lib/server/base.c
src/lib/unlang/xlat_builtin.c

index 9b43af06456de7516781dea34f70bf76905cc109..876bf602758fdf376c9ccd3a4a2a504de1df6e54 100644 (file)
@@ -27,6 +27,7 @@ RCSID("$Id$")
 
 #include <freeradius-devel/server/base.h>
 #include <freeradius-devel/server/module_rlm.h>
+#include <freeradius-devel/unlang/xlat.h>
 
 /** Initialize src/lib/server/
  *
@@ -74,6 +75,17 @@ int server_init(CONF_SECTION *cs)
         */
        if (modules_rlm_bootstrap(cs) < 0) return -1;
 
+       /*
+        *      Now all the modules and virtual servers have been bootstrapped,
+        *      we have all the dictionaries we're going to use in the server.
+        *
+        *      We can now register xlats for any protocol encoders/decoders.
+        *
+        *      Note: These xlats get freed automatically, so no explicit cleanup
+        *      is required.
+        */
+       if (xlat_protocols_register() < 0) return -1;
+
        /*
         *      And then load the virtual servers.
         */
index d9076f51d4cd97ea4682e740ddb7d44b77cf187d..306a20f5293825fa4d24d9a5ee95747c2a344c14 100644 (file)
@@ -3269,11 +3269,6 @@ int xlat_init(void)
         */
        unlang_xlat_init();
 
-       /*
-        *      Define encode/decode xlats for the various protocols.
-        */
-       if (xlat_protocol_init() < 0) return -1;
-
        /*
         *      These are all "pure" functions.
         */