]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
sort names properly
authorAlan T. DeKok <aland@freeradius.org>
Wed, 4 Dec 2024 21:33:44 +0000 (16:33 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 5 Dec 2024 17:15:54 +0000 (12:15 -0500)
fix typo, and push the transport configuration parser into the
appropriate child.

src/lib/bio/fd_config.c

index 36b1164da0185c94a3baa2f14e616875e7d953bc..2d8446c4021f150da0ba7af811e5fd487fbc0110 100644 (file)
@@ -157,15 +157,14 @@ static const conf_parser_t file_config[] = {
 
        { FR_CONF_OFFSET("mkdir", fr_bio_fd_config_t, mkdir) },
 
-
        CONF_PARSER_TERMINATOR
 };
 
 static fr_table_ptr_sorted_t transport_names[] = {
        { L("file"),            file_config },
        { L("tcp"),             tcp_config },
-       { L("unix"),            unix_config },
        { L("udp"),             udp_config },
+       { L("unix"),            unix_config },
 };
 static size_t transport_names_len = NUM_ELEMENTS(transport_names);
 
@@ -178,6 +177,7 @@ static int transport_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent, CONF
        conf_parser_t const *rules;
        char const *name = cf_pair_value(cf_item_to_pair(ci));
        fr_bio_fd_config_t *fd_config = parent;
+       CONF_SECTION *subcs;
 
        rules = fr_table_value_by_str(transport_names, name, NULL);
        if (!rules) {
@@ -185,7 +185,16 @@ static int transport_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent, CONF
                return -1;
        }
 
-       if (cf_section_rules_push(cf_item_to_section(cf_parent(ci)), rules) < 0) {
+       /*
+        *      Find the relevant subsection.
+        */
+       subcs = cf_section_find(cf_item_to_section(cf_parent(ci)), name, NULL);
+       if (!subcs) {
+               cf_log_perr(ci, "Failed finding transport configuration section %s { ... }", name);
+               return -1;
+       }
+
+       if (cf_section_rules_push(subcs, rules) < 0) {
                cf_log_perr(ci, "Failed updating parse rules");
                return -1;
        }
@@ -199,7 +208,7 @@ static int transport_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent, CONF
 }
 
 const conf_parser_t fr_bio_fd_config[] = {
-       { FR_CONF_OFFSET("transport", fr_bio_fd_config_t, socket_type), .func = transport_parse },
+       { FR_CONF_OFFSET("transport", fr_bio_fd_config_t, transport), .func = transport_parse },
 
        { FR_CONF_OFFSET("async", fr_bio_fd_config_t, async), .dflt = "true" },