for module instances like "foo { ... }" versus "foo bar { ... }".
if the xlat is already registered, don't do anything. If it isn't
registered, then register it
* that must be referenced in later calls, store a handle to it
* in *instance otherwise put a null pointer there.
*/
-static int mod_bootstrap(void *instance, UNUSED CONF_SECTION *conf)
+static int mod_bootstrap(void *instance, CONF_SECTION *conf)
{
xlat_t *xlat;
+
+ if (cf_section_name2(conf)) return 0;
+
xlat = xlat_register(instance, "client", xlat_client, false);
xlat_func_args(xlat, xlat_client_args);
map_proc_register(instance, "client", map_proc_client, NULL, 0);
* that must be referenced in later calls, store a handle to it
* in *instance otherwise put a null pointer there.
*/
-static int mod_bootstrap(void *instance, UNUSED CONF_SECTION *conf)
+static int mod_bootstrap(void *instance, CONF_SECTION *conf)
{
xlat_t *xlat;
+
+ /*
+ * Only register these xlats for the first instance of the dictionary module.
+ */
+ if (cf_section_name2(conf) != NULL) return 0;
+
xlat = xlat_register(instance, "attr_by_num", xlat_dict_attr_by_num, false);
xlat_func_args(xlat, xlat_dict_attr_by_num_args);
xlat = xlat_register(instance, "attr_by_oid", xlat_dict_attr_by_oid, false);
if (!inst->name) inst->name = cf_section_name1(conf);
xlat = xlat_register(instance, "jsonquote", json_quote_xlat, false);
- xlat_func_mono(xlat, &json_quote_xlat_arg);
+ if (xlat) xlat_func_mono(xlat, &json_quote_xlat_arg);
xlat = xlat_register(instance, "jpathvalidate", jpath_validate_xlat, false);
- xlat_func_mono(xlat, &jpath_validate_xlat_arg);
+ if (xlat) xlat_func_mono(xlat, &jpath_validate_xlat_arg);
name = talloc_asprintf(inst, "%s_encode", inst->name);
xlat = xlat_register(instance, name, json_encode_xlat, false);
xlat = xlat_register(NULL, inst->name, ldap_xlat, false);
xlat_func_mono(xlat, &ldap_xlat_arg);
xlat_async_thread_instantiate_set(xlat, mod_xlat_thread_instantiate, ldap_xlat_thread_inst_t, NULL, inst);
+
xlat = xlat_register(NULL, "ldap_escape", ldap_escape_xlat, false);
- xlat_func_mono(xlat, &ldap_escape_xlat_arg);
+ if (xlat) xlat_func_mono(xlat, &ldap_escape_xlat_arg);
xlat = xlat_register(NULL, "ldap_unescape", ldap_unescape_xlat, false);
- xlat_func_mono(xlat, &ldap_escape_xlat_arg);
+ if (xlat) xlat_func_mono(xlat, &ldap_escape_xlat_arg);
+
map_proc_register(inst, inst->name, mod_map_proc, ldap_map_verify, 0);
return 0;
{
xlat_t *xlat;
- if (cf_section_name2(conf)) return 0;
-
xlat = xlat_register(NULL, "unpack", unpack_xlat, false);
- xlat_func_args(xlat, unpack_xlat_args);
+ if (xlat) xlat_func_args(xlat, unpack_xlat_args);
return 0;
}
}
#endif
- if (cf_section_name2(conf)) return 0;
-
xlat = xlat_register(inst, "modhextohex", modhex_to_hex_xlat, false);
- xlat_func_mono(xlat, &modhex_to_hex_xlat_arg);
+ if (xlat) xlat_func_mono(xlat, &modhex_to_hex_xlat_arg);
return 0;
}