]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Split conf parsing phase off from dl instantiation
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 3 Mar 2022 00:08:47 +0000 (18:08 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 3 Mar 2022 02:36:07 +0000 (20:36 -0600)
This lets us get the instance data in all the appropriate trees before running CONF_PARSER callbacks

16 files changed:
src/lib/io/master.c
src/lib/server/dl_module.c
src/lib/server/dl_module.h
src/lib/server/module.c
src/lib/server/virtual_servers.c
src/listen/arp/proto_arp.c
src/listen/control/proto_control.c
src/listen/cron/proto_cron.c
src/listen/detail/proto_detail.c
src/listen/dhcpv4/proto_dhcpv4.c
src/listen/dhcpv6/proto_dhcpv6.c
src/listen/dns/proto_dns.c
src/listen/load/proto_load.c
src/listen/radius/proto_radius.c
src/listen/tacacs/proto_tacacs.c
src/listen/vmps/proto_vmps.c

index 0a5c8401f7745c51d7c7997685a3ec50c0afa04e..0bf9324d04eecdd49fda11be7e983fdc59c9c4f6 100644 (file)
@@ -499,6 +499,12 @@ static fr_io_connection_t *fr_io_connection_alloc(fr_io_instance_t const *inst,
                        DEBUG("Failed to find proto_%s_%s", inst->app->name, inst->transport);
                        return NULL;
                }
+
+               if (dl_module_conf_parse(dl_inst) < 0) {
+                       TALLOC_FREE(dl_inst);
+                       return NULL;
+               }
+
                fr_assert(dl_inst != NULL);
        } else {
                dl_inst = talloc_init_const("nak");
@@ -2601,6 +2607,11 @@ static int mod_bootstrap(void *instance, CONF_SECTION *cs)
                        return -1;
                }
 
+               if (dl_module_conf_parse(inst->dynamic_submodule) < 0) {
+                       TALLOC_FREE(inst->dynamic_submodule);
+                       return -1;
+               }
+
                fr_assert(inst->dynamic_submodule != NULL);
 
                /*
index fb090f4e8254c8085aa6eca26eeddf967a228332..a3709bfd346f4c746b7eed0f62d6e72e835e390a 100644 (file)
@@ -576,16 +576,6 @@ int dl_module_instance(TALLOC_CTX *ctx, dl_module_inst_t **out,
         */
        cf_data_add(conf, dl_inst, dl_inst->module->dl->name, false);
 
-       if (dl_inst->module->common->config && conf) {
-               if ((cf_section_rules_push(conf, dl_inst->module->common->config)) < 0 ||
-                   (cf_section_parse(dl_inst->data, dl_inst->data, conf) < 0)) {
-                       cf_log_err(conf, "Failed evaluating configuration for module \"%s\"",
-                                  dl_inst->module->dl->name);
-                       talloc_free(dl_inst);
-                       return -1;
-               }
-       }
-
        name2 = cf_section_name2(conf);
        if (name2) {
                dl_inst->name = talloc_typed_strdup(dl_inst, name2);
@@ -601,6 +591,19 @@ int dl_module_instance(TALLOC_CTX *ctx, dl_module_inst_t **out,
        return 0;
 }
 
+int dl_module_conf_parse(dl_module_inst_t *dl_inst)
+{
+       if (dl_inst->module->common->config && dl_inst->conf) {
+               if ((cf_section_rules_push(dl_inst->conf, dl_inst->module->common->config)) < 0 ||
+                   (cf_section_parse(dl_inst->data, dl_inst->data, dl_inst->conf) < 0)) {
+                       cf_log_err(dl_inst->conf, "Failed evaluating configuration for module \"%s\"",
+                                  dl_inst->module->dl->name);
+                       return -1;
+               }
+       }
+       return 0;
+}
+
 static int _dl_module_loader_free(dl_module_loader_t *dl_module_l)
 {
        int ret = 0;
index d06736740997450b076843d2221affa37a6bfd0e..82396f6832d1e7816d7eb4a9dad515c407bfb416 100644 (file)
@@ -187,6 +187,8 @@ int                 dl_module_instance(TALLOC_CTX *ctx, dl_module_inst_t **out,
                                           CONF_SECTION *conf, dl_module_inst_t const *parent,
                                           char const *name, dl_module_type_t type);
 
+int                    dl_module_conf_parse(dl_module_inst_t *dl_inst);
+
 char const             *dl_module_search_path(void);
 
 dl_loader_t            *dl_loader_from_module_loader(dl_module_loader_t *dl_module_loader);
index 2c5a7cf0da6b313d6037417f271638b5cda30907..3e7cb2141def0b7e415cce055e8fe94d534883ee 100644 (file)
@@ -314,9 +314,9 @@ module_instance_t *module_by_data(void const *data)
        module_instance_t *mi;
 
        mi = fr_rb_find(module_instance_data_tree,
-                            &(module_instance_t){
+                       &(module_instance_t){
                                .dl_inst = &(dl_module_inst_t){ .data = UNCONST(void *, data) },
-                            });
+                       });
        if (!mi) return NULL;
 
        return talloc_get_type_abort(mi, module_instance_t);
@@ -779,6 +779,14 @@ module_instance_t *module_bootstrap(dl_module_type_t type, module_instance_t con
                mi->in_data_tree = true;
        }
 
+       /*
+        *      Do this after inserting the module instance into the tree
+        */
+       if (dl_module_conf_parse(mi->dl_inst) < 0) {
+               TALLOC_FREE(mi->dl_inst);
+               return -1;
+       }
+
        /*
         *      Bootstrap the module.
         *      This must be done last so that the
index 856657718c7c170aecbd6b467d181408ee805512..09d59e30caf8c0e4cae50277d2dfcccb431bca3f 100644 (file)
@@ -397,6 +397,11 @@ static int namespace_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF
                return -1;
        }
 
+       if (dl_module_conf_parse(server->process_module) < 0) {
+               TALLOC_FREE(server->process_module);
+               return -1;
+       }
+
        return 0;
 }
 
@@ -429,6 +434,11 @@ static int listen_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_IT
                return -1;
        }
 
+       if (dl_module_conf_parse(listen->proto_module) < 0) {
+               TALLOC_FREE(listen->proto_module);
+               return -1;
+       }
+
        return 0;
 }
 
@@ -535,6 +545,11 @@ int virtual_server_dynamic_clients_allow(CONF_SECTION *server_cs)
                return -1;
        }
 
+       if (dl_module_conf_parse(server->dynamic_client_module) < 0) {
+               TALLOC_FREE(server->dynamic_client_module);
+               return -1;
+       }
+
        return 0;
 }
 
index e45679e5ee15387ecf16e2bdd2bcc675648a77a2..c77ba5c7e1427beaee767517443b5b7cdbf1f4ce 100644 (file)
@@ -269,6 +269,11 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf)
                return -1;
        }
 
+       if (dl_module_conf_parse(inst->io_submodule) < 0) {
+               TALLOC_FREE(inst->io_submodule);
+               return -1;
+       }
+
        /*
         *      Bootstrap the I/O module
         */
index 7a4fe1319045c4fc6f620c88045ca5a7fdf7bf12..2bbba2ddadc614acaa6bd68e5c069dace16a04a7 100644 (file)
@@ -78,11 +78,12 @@ fr_dict_autoload_t proto_control_dict[] = {
  */
 static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule)
 {
-       char const      *name = cf_pair_value(cf_item_to_pair(ci));
+       char const              *name = cf_pair_value(cf_item_to_pair(ci));
        dl_module_inst_t        *parent_inst;
-       proto_control_t *inst;
-       CONF_SECTION    *listen_cs = cf_item_to_section(cf_parent(ci));
-       CONF_SECTION    *transport_cs;
+       proto_control_t         *inst;
+       CONF_SECTION            *listen_cs = cf_item_to_section(cf_parent(ci));
+       CONF_SECTION            *transport_cs;
+       dl_module_inst_t        *dl_mod_inst;
 
        transport_cs = cf_section_find(listen_cs, name, NULL);
 
@@ -102,7 +103,14 @@ static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF
        inst = talloc_get_type_abort(parent_inst->data, proto_control_t);
        inst->io.transport = name;
 
-       return dl_module_instance(ctx, out, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE);
+       if (dl_module_instance(ctx, &dl_mod_inst, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE) < 0) return -1;
+       if (dl_module_conf_parse(dl_mod_inst) < 0) {
+               talloc_free(dl_mod_inst);
+               return -1;
+       }
+       *((dl_module_inst_t **)out) = dl_mod_inst;
+
+       return 0;
 }
 
 
index 0cee760d30cef0716dfc85d28cf41ed0274540ba..af48499a9652fe8c6adfa33c0790bbc5171c50cc 100644 (file)
@@ -151,10 +151,11 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM
 static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
                           CONF_ITEM *ci, UNUSED CONF_PARSER const *rule)
 {
-       char const      *name = cf_pair_value(cf_item_to_pair(ci));
+       char const              *name = cf_pair_value(cf_item_to_pair(ci));
        dl_module_inst_t        *parent_inst;
-       CONF_SECTION    *listen_cs = cf_item_to_section(cf_parent(ci));
-       CONF_SECTION    *transport_cs;
+       CONF_SECTION            *listen_cs = cf_item_to_section(cf_parent(ci));
+       CONF_SECTION            *transport_cs;
+       dl_module_inst_t        *dl_mod_inst;
 
        transport_cs = cf_section_find(listen_cs, name, NULL);
 
@@ -167,7 +168,14 @@ static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
        parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_cron"));
        fr_assert(parent_inst);
 
-       return dl_module_instance(ctx, out, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE);
+       if (dl_module_instance(ctx, &dl_mod_inst, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE) < 0) return -1;
+       if (dl_module_conf_parse(dl_mod_inst) < 0) {
+               talloc_free(dl_mod_inst);
+               return -1;
+       }
+       *((dl_module_inst_t **)out) = dl_mod_inst;
+
+       return 0;
 }
 
 /** Decode the packet, and set the request->process function
index 84c4eebcefb6ffc02ee425b416fecf380bf90d75..4151e130f36466a254ca27facd1db66acf9894ed 100644 (file)
@@ -162,10 +162,11 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM
 static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
                           CONF_ITEM *ci, UNUSED CONF_PARSER const *rule)
 {
-       char const      *name = cf_pair_value(cf_item_to_pair(ci));
+       char const              *name = cf_pair_value(cf_item_to_pair(ci));
        dl_module_inst_t        *parent_inst;
-       CONF_SECTION    *listen_cs = cf_item_to_section(cf_parent(ci));
-       CONF_SECTION    *transport_cs;
+       CONF_SECTION            *listen_cs = cf_item_to_section(cf_parent(ci));
+       CONF_SECTION            *transport_cs;
+       dl_module_inst_t        *dl_mod_inst;
 
        transport_cs = cf_section_find(listen_cs, name, NULL);
 
@@ -178,7 +179,14 @@ static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
        parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_detail"));
        fr_assert(parent_inst);
 
-       return dl_module_instance(ctx, out, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE);
+       if (dl_module_instance(ctx, &dl_mod_inst, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE) < 0) return -1;
+       if (dl_module_conf_parse(dl_mod_inst) < 0) {
+               talloc_free(dl_mod_inst);
+               return -1;
+       }
+       *((dl_module_inst_t **)out) = dl_mod_inst;
+
+       return 0;
 }
 
 /** Decode the packet, and set the request->process function
@@ -551,6 +559,11 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf)
                        return -1;
                }
 
+               if (dl_module_conf_parse(inst->work_submodule) < 0) {
+                       TALLOC_FREE(inst->work_submodule);
+                       return -1;
+               }
+
                /*
                 *      Boot strap the work module.
                 */
@@ -561,6 +574,7 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf)
                if (inst->work_io->bootstrap && (inst->work_io->bootstrap(inst->work_io_instance,
                                                                          inst->work_io_conf) < 0)) {
                        cf_log_err(inst->work_io_conf, "Bootstrap failed for \"%s\"", inst->work_io->name);
+                       TALLOC_FREE(inst->work_submodule);
                        return -1;
                }
        }
index 8682e33342ed884c4a5449429626fd72101c5e13..b7fc0ed9ade54ba9762154ad1c2d4c6cf184e7bb 100644 (file)
@@ -151,11 +151,12 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent,
 static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
                           CONF_ITEM *ci, UNUSED CONF_PARSER const *rule)
 {
-       char const      *name = cf_pair_value(cf_item_to_pair(ci));
+       char const              *name = cf_pair_value(cf_item_to_pair(ci));
        dl_module_inst_t        *parent_inst;
-       proto_dhcpv4_t  *inst;
-       CONF_SECTION    *listen_cs = cf_item_to_section(cf_parent(ci));
-       CONF_SECTION    *transport_cs;
+       proto_dhcpv4_t          *inst;
+       CONF_SECTION            *listen_cs = cf_item_to_section(cf_parent(ci));
+       CONF_SECTION            *transport_cs;
+       dl_module_inst_t        *dl_mod_inst;
 
        transport_cs = cf_section_find(listen_cs, name, NULL);
 
@@ -175,7 +176,14 @@ static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
        inst = talloc_get_type_abort(parent_inst->data, proto_dhcpv4_t);
        inst->io.transport = name;
 
-       return dl_module_instance(ctx, out, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE);
+       if (dl_module_instance(ctx, &dl_mod_inst, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE) < 0) return -1;
+       if (dl_module_conf_parse(dl_mod_inst) < 0) {
+               talloc_free(dl_mod_inst);
+               return -1;
+       }
+       *((dl_module_inst_t **)out) = dl_mod_inst;
+
+       return 0;
 }
 
 /** Decode the packet
index 51c0a00c1a284065018864aba878b5a275fc7071..dc4c0da563c03ea53a11d60c168d2ba88c6f042a 100644 (file)
@@ -151,11 +151,12 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent,
 static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
                           CONF_ITEM *ci, UNUSED CONF_PARSER const *rule)
 {
-       char const      *name = cf_pair_value(cf_item_to_pair(ci));
+       char const              *name = cf_pair_value(cf_item_to_pair(ci));
        dl_module_inst_t        *parent_inst;
-       proto_dhcpv6_t  *inst;
-       CONF_SECTION    *listen_cs = cf_item_to_section(cf_parent(ci));
-       CONF_SECTION    *transport_cs;
+       proto_dhcpv6_t          *inst;
+       CONF_SECTION            *listen_cs = cf_item_to_section(cf_parent(ci));
+       CONF_SECTION            *transport_cs;
+       dl_module_inst_t        *dl_mod_inst;
 
        transport_cs = cf_section_find(listen_cs, name, NULL);
 
@@ -175,7 +176,14 @@ static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
        inst = talloc_get_type_abort(parent_inst->data, proto_dhcpv6_t);
        inst->io.transport = name;
 
-       return dl_module_instance(ctx, out, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE);
+       if (dl_module_instance(ctx, &dl_mod_inst, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE) < 0) return -1;
+       if (dl_module_conf_parse(dl_mod_inst) < 0) {
+               talloc_free(dl_mod_inst);
+               return -1;
+       }
+       *((dl_module_inst_t **)out) = dl_mod_inst;
+
+       return 0;
 }
 
 /** Decode the packet
index 42c1a70236f467c4408e99d40bdf7e40ff33623a..780799698809fdeae6fa8f162624db9123ce3ce9 100644 (file)
@@ -132,11 +132,12 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent,
 static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
                           CONF_ITEM *ci, UNUSED CONF_PARSER const *rule)
 {
-       char const      *name = cf_pair_value(cf_item_to_pair(ci));
+       char const              *name = cf_pair_value(cf_item_to_pair(ci));
        dl_module_inst_t        *parent_inst;
-       proto_dns_t     *inst;
-       CONF_SECTION    *listen_cs = cf_item_to_section(cf_parent(ci));
-       CONF_SECTION    *transport_cs;
+       proto_dns_t             *inst;
+       CONF_SECTION            *listen_cs = cf_item_to_section(cf_parent(ci));
+       CONF_SECTION            *transport_cs;
+       dl_module_inst_t        *dl_mod_inst;
 
        transport_cs = cf_section_find(listen_cs, name, NULL);
 
@@ -156,7 +157,14 @@ static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
        inst = talloc_get_type_abort(parent_inst->data, proto_dns_t);
        inst->io.transport = name;
 
-       return dl_module_instance(ctx, out, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE);
+       if (dl_module_instance(ctx, &dl_mod_inst, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE) < 0) return -1;
+       if (dl_module_conf_parse(dl_mod_inst) < 0) {
+               talloc_free(dl_mod_inst);
+               return -1;
+       }
+       *((dl_module_inst_t **)out) = dl_mod_inst;
+
+       return 0;
 }
 
 /** Decode the packet
index 75f1e4cbd7172bd3150bbf6e74a95bf98957f7a7..1de8c442832404047891d5629ddba38ff837e6d9 100644 (file)
@@ -151,10 +151,11 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM
 static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
                           CONF_ITEM *ci, UNUSED CONF_PARSER const *rule)
 {
-       char const      *name = cf_pair_value(cf_item_to_pair(ci));
+       char const              *name = cf_pair_value(cf_item_to_pair(ci));
        dl_module_inst_t        *parent_inst;
-       CONF_SECTION    *listen_cs = cf_item_to_section(cf_parent(ci));
-       CONF_SECTION    *transport_cs;
+       CONF_SECTION            *listen_cs = cf_item_to_section(cf_parent(ci));
+       CONF_SECTION            *transport_cs;
+       dl_module_inst_t        *dl_mod_inst;
 
        transport_cs = cf_section_find(listen_cs, name, NULL);
 
@@ -167,7 +168,14 @@ static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
        parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_load"));
        fr_assert(parent_inst);
 
-       return dl_module_instance(ctx, out, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE);
+       if (dl_module_instance(ctx, &dl_mod_inst, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE) < 0) return -1;
+       if (dl_module_conf_parse(dl_mod_inst) < 0) {
+               talloc_free(dl_mod_inst);
+               return -1;
+       }
+       *((dl_module_inst_t **)out) = dl_mod_inst;
+
+       return 0;
 }
 
 /** Decode the packet, and set the request->process function
index 0af6899bd9835edf091750735ac6fd377a29a6e7..b9b34a1e63fcf3b7181fb6a3abe28aa5733c7149 100644 (file)
@@ -155,11 +155,12 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM
  */
 static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule)
 {
-       char const      *name = cf_pair_value(cf_item_to_pair(ci));
+       char const              *name = cf_pair_value(cf_item_to_pair(ci));
        dl_module_inst_t        *parent_inst;
-       proto_radius_t  *inst;
-       CONF_SECTION    *listen_cs = cf_item_to_section(cf_parent(ci));
-       CONF_SECTION    *transport_cs;
+       proto_radius_t          *inst;
+       CONF_SECTION            *listen_cs = cf_item_to_section(cf_parent(ci));
+       CONF_SECTION            *transport_cs;
+       dl_module_inst_t        *dl_mod_inst;
 
        transport_cs = cf_section_find(listen_cs, name, NULL);
 
@@ -182,7 +183,14 @@ static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF
                inst->io.app_io_conf = transport_cs;
        }
 
-       return dl_module_instance(ctx, out, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE);
+       if (dl_module_instance(ctx, &dl_mod_inst, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE) < 0) return -1;
+       if (dl_module_conf_parse(dl_mod_inst) < 0) {
+               talloc_free(dl_mod_inst);
+               return -1;
+       }
+       *((dl_module_inst_t **)out) = dl_mod_inst;
+
+       return 0;
 }
 
 /** Decode the packet
index f41bc32c7e8cc4df9e2ce7cf063203b7d8cafd9e..3c926a4775da74909c4ae77191d4a962b02505eb 100644 (file)
@@ -128,11 +128,12 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM
  */
 static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED CONF_PARSER const *rule)
 {
-       char const      *name = cf_pair_value(cf_item_to_pair(ci));
+       char const              *name = cf_pair_value(cf_item_to_pair(ci));
        dl_module_inst_t        *parent_inst;
-       proto_tacacs_t  *inst;
-       CONF_SECTION    *listen_cs = cf_item_to_section(cf_parent(ci));
-       CONF_SECTION    *transport_cs;
+       proto_tacacs_t          *inst;
+       CONF_SECTION            *listen_cs = cf_item_to_section(cf_parent(ci));
+       CONF_SECTION            *transport_cs;
+       dl_module_inst_t        *dl_mod_inst;
 
        transport_cs = cf_section_find(listen_cs, name, NULL);
 
@@ -155,7 +156,14 @@ static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF
                inst->io.app_io_conf = transport_cs;
        }
 
-       return dl_module_instance(ctx, out, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE);
+       if (dl_module_instance(ctx, &dl_mod_inst, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE) < 0) return -1;
+       if (dl_module_conf_parse(dl_mod_inst) < 0) {
+               talloc_free(dl_mod_inst);
+               return -1;
+       }
+       *((dl_module_inst_t **)out) = dl_mod_inst;
+
+       return 0;
 }
 
 /** Decode the packet
index 8eb02c65f272f07c1488db71df6b7244ddee2bb6..250894cf4e1fcaf78f27a7fe17978c4b6eeae3d2 100644 (file)
@@ -140,11 +140,12 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent,
 static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
                           CONF_ITEM *ci, UNUSED CONF_PARSER const *rule)
 {
-       char const      *name = cf_pair_value(cf_item_to_pair(ci));
+       char const              *name = cf_pair_value(cf_item_to_pair(ci));
        dl_module_inst_t        *parent_inst;
-       proto_vmps_t    *inst;
-       CONF_SECTION    *listen_cs = cf_item_to_section(cf_parent(ci));
-       CONF_SECTION    *transport_cs;
+       proto_vmps_t            *inst;
+       CONF_SECTION            *listen_cs = cf_item_to_section(cf_parent(ci));
+       CONF_SECTION            *transport_cs;
+       dl_module_inst_t        *dl_mod_inst;
 
        transport_cs = cf_section_find(listen_cs, name, NULL);
 
@@ -164,7 +165,14 @@ static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
        inst = talloc_get_type_abort(parent_inst->data, proto_vmps_t);
        inst->io.transport = name;
 
-       return dl_module_instance(ctx, out, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE);
+       if (dl_module_instance(ctx, &dl_mod_inst, transport_cs, parent_inst, name, DL_MODULE_TYPE_SUBMODULE) < 0) return -1;
+       if (dl_module_conf_parse(dl_mod_inst) < 0) {
+               talloc_free(dl_mod_inst);
+               return -1;
+       }
+       *((dl_module_inst_t **)out) = dl_mod_inst;
+
+       return 0;
 }
 
 /** Decode the packet