+#ifdef SLAPD_EXTERNAL_EXTENSIONS
+int
+load_extop_module (
+ const void *module,
+ const char *file_name
+)
+{
+ SLAP_EXTOP_MAIN_FN *ext_main;
+ int (*ext_getoid)(int index, char *oid, int blen);
+ char *oid;
+ int rc;
+
+ ext_main = (SLAP_EXTOP_MAIN_FN *)module_resolve(module, "ext_main");
+ if (ext_main == NULL) {
+ return(-1);
+ }
+
+ ext_getoid = module_resolve(module, "ext_getoid");
+ if (ext_getoid == NULL) {
+ return(-1);
+ }
+
+ oid = ch_malloc(256);
+ rc = (ext_getoid)(0, oid, 256);
+ if (rc != 0) {
+ ch_free(oid);
+ return(rc);
+ }
+ if (*oid == 0) {
+ free(oid);
+ return(-1);
+ }
+
+ rc = load_extop( oid, ext_main );
+ free(oid);
+ return rc;
+}
+#endif /* SLAPD_EXTERNAL_EXTENSIONS */