diff --git a/configure.in b/configure.in
index e9e9db0a42..f47ce81d68 100644
--- a/configure.in
+++ b/configure.in
@@ -2886,6 +2886,66 @@ else
SLAPD_NO_STATIC=
fi
+dnl Generate static backend header file
+BACKEND_HEADER=servers/slapd/backend.h
+cat > $BACKEND_HEADER << EOF
+/* This work is part of OpenLDAP Software .
+ *
+ * Copyright 1998-2004 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * .
+ */
+/* Portions Copyright (c) 1995 Regents of the University of Michigan.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of Michigan at Ann Arbor. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+/* this file is automatically generated by configure; do not edit */
+
+EOF
+
+for b in $SLAPD_STATIC_BACKENDS; do
+ bb=`echo "$b" | sed -e 's;back-;;'`
+
+ cat >> $BACKEND_HEADER << EOF
+extern BI_init ${bb}_back_initialize;
+EOF
+done
+
+cat >> $BACKEND_HEADER << EOF
+
+static BackendInfo binfo[[]] = {
+EOF
+
+for b in $SLAPD_STATIC_BACKENDS; do
+ bb=`echo "$b" | sed -e 's;back-;;'`
+
+ cat >> $BACKEND_HEADER << EOF
+ { "$bb", ${bb}_back_initialize },
+
+EOF
+done
+
+cat >> $BACKEND_HEADER << EOF
+ { NULL, NULL }
+};
+
+/* end of generated file */
+EOF
+dnl done generating static backend header file
+
AC_SUBST(LIBSRCS)
AC_SUBST(PLAT)
AC_SUBST(WITH_SASL)
diff --git a/servers/slapd/back-hdb/external.h b/servers/slapd/back-hdb/external.h
index e71ab152a8..e1bec3ae7e 100644
--- a/servers/slapd/back-hdb/external.h
+++ b/servers/slapd/back-hdb/external.h
@@ -25,7 +25,7 @@
#define BDB_HIER
#endif
-extern BI_init hdb_initialize;
+extern BI_init hdb_back_initialize;
#include "../back-bdb/external.h"
diff --git a/servers/slapd/back-ldap/back-ldap.h b/servers/slapd/back-ldap/back-ldap.h
index 4622443be7..00f9b9a80f 100644
--- a/servers/slapd/back-ldap/back-ldap.h
+++ b/servers/slapd/back-ldap/back-ldap.h
@@ -24,7 +24,7 @@
#ifndef SLAPD_LDAP_H
#define SLAPD_LDAP_H
-#include "external.h"
+#include "proto-ldap.h"
/* String rewrite library */
#ifdef ENABLE_REWRITE
diff --git a/servers/slapd/back-ldap/external.h b/servers/slapd/back-ldap/external.h
index 5f72eda8ae..f4e4d9b712 100644
--- a/servers/slapd/back-ldap/external.h
+++ b/servers/slapd/back-ldap/external.h
@@ -23,38 +23,7 @@
LDAP_BEGIN_DECL
-extern BI_init ldap_back_initialize;
-extern BI_open ldap_back_open;
-extern BI_close ldap_back_close;
-extern BI_destroy ldap_back_destroy;
-
-extern BI_db_init ldap_back_db_init;
-extern BI_db_open ldap_back_db_open;
-extern BI_db_destroy ldap_back_db_destroy;
-
-extern BI_db_config ldap_back_db_config;
-
-extern BI_op_bind ldap_back_bind;
-
-extern BI_connection_destroy ldap_back_conn_destroy;
-
-extern BI_op_search ldap_back_search;
-
-extern BI_op_compare ldap_back_compare;
-
-extern BI_op_modify ldap_back_modify;
-
-extern BI_op_modrdn ldap_back_modrdn;
-
-extern BI_op_add ldap_back_add;
-
-extern BI_op_delete ldap_back_delete;
-
-extern BI_op_abandon ldap_back_abandon;
-
-extern BI_op_extended ldap_back_extended;
-
-extern BI_entry_get_rw ldap_back_entry_get;
+extern BI_init ldap_back_initialize;
LDAP_END_DECL
diff --git a/servers/slapd/back-ldap/init.c b/servers/slapd/back-ldap/init.c
index 8062a63730..bbf35ef531 100644
--- a/servers/slapd/back-ldap/init.c
+++ b/servers/slapd/back-ldap/init.c
@@ -30,6 +30,7 @@
#include "slap.h"
#include "back-ldap.h"
+#include "external.h"
#if SLAPD_LDAP == SLAPD_MOD_DYNAMIC
diff --git a/servers/slapd/back-ldap/proto-ldap.h b/servers/slapd/back-ldap/proto-ldap.h
new file mode 100644
index 0000000000..9f761fdbdc
--- /dev/null
+++ b/servers/slapd/back-ldap/proto-ldap.h
@@ -0,0 +1,51 @@
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software .
+ *
+ * Copyright 2003-2004 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * .
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by the Howard Chu for inclusion
+ * in OpenLDAP Software and subsequently enhanced by Pierangelo
+ * Masarati.
+ */
+
+#ifndef _LDAP_EXTERNAL_H
+#define _LDAP_EXTERNAL_H
+
+LDAP_BEGIN_DECL
+
+extern BI_open ldap_back_open;
+extern BI_close ldap_back_close;
+extern BI_destroy ldap_back_destroy;
+
+extern BI_db_init ldap_back_db_init;
+extern BI_db_open ldap_back_db_open;
+extern BI_db_destroy ldap_back_db_destroy;
+extern BI_db_config ldap_back_db_config;
+
+extern BI_op_bind ldap_back_bind;
+extern BI_op_search ldap_back_search;
+extern BI_op_compare ldap_back_compare;
+extern BI_op_modify ldap_back_modify;
+extern BI_op_modrdn ldap_back_modrdn;
+extern BI_op_add ldap_back_add;
+extern BI_op_delete ldap_back_delete;
+extern BI_op_abandon ldap_back_abandon;
+extern BI_op_extended ldap_back_extended;
+
+extern BI_connection_destroy ldap_back_conn_destroy;
+
+extern BI_entry_get_rw ldap_back_entry_get;
+
+LDAP_END_DECL
+
+#endif /* _LDAP_EXTERNAL_H */
diff --git a/servers/slapd/back-ldbm/external.h b/servers/slapd/back-ldbm/external.h
index 1d28f03202..1ced099a26 100644
--- a/servers/slapd/back-ldbm/external.h
+++ b/servers/slapd/back-ldbm/external.h
@@ -18,50 +18,7 @@
LDAP_BEGIN_DECL
-extern BI_init ldbm_back_initialize;
-extern BI_open ldbm_back_open;
-extern BI_close ldbm_back_close;
-extern BI_destroy ldbm_back_destroy;
-
-extern BI_db_init ldbm_back_db_init;
-extern BI_db_open ldbm_back_db_open;
-extern BI_db_close ldbm_back_db_close;
-extern BI_db_destroy ldbm_back_db_destroy;
-
-extern BI_db_config ldbm_back_db_config;
-
-extern BI_op_extended ldbm_back_extended;
-
-extern BI_op_bind ldbm_back_bind;
-
-extern BI_op_search ldbm_back_search;
-
-extern BI_op_compare ldbm_back_compare;
-
-extern BI_op_modify ldbm_back_modify;
-
-extern BI_op_modrdn ldbm_back_modrdn;
-
-extern BI_op_add ldbm_back_add;
-
-extern BI_op_delete ldbm_back_delete;
-
-extern BI_operational ldbm_back_operational;
-
-extern BI_has_subordinates ldbm_back_hasSubordinates;
-
-/* hooks for slap tools */
-extern BI_tool_entry_open ldbm_tool_entry_open;
-extern BI_tool_entry_close ldbm_tool_entry_close;
-extern BI_tool_entry_first ldbm_tool_entry_first;
-extern BI_tool_entry_next ldbm_tool_entry_next;
-extern BI_tool_entry_get ldbm_tool_entry_get;
-extern BI_tool_entry_put ldbm_tool_entry_put;
-
-extern BI_tool_entry_reindex ldbm_tool_entry_reindex;
-extern BI_tool_sync ldbm_tool_sync;
-
-extern BI_chk_referrals ldbm_back_referrals;
+extern BI_init ldbm_back_initialize;
LDAP_END_DECL
diff --git a/servers/slapd/back-ldbm/init.c b/servers/slapd/back-ldbm/init.c
index 4e18fcf78a..c78ce11261 100644
--- a/servers/slapd/back-ldbm/init.c
+++ b/servers/slapd/back-ldbm/init.c
@@ -23,6 +23,7 @@
#include "slap.h"
#include "back-ldbm.h"
+#include "external.h"
#if SLAPD_LDBM == SLAPD_MOD_DYNAMIC
diff --git a/servers/slapd/back-ldbm/proto-back-ldbm.h b/servers/slapd/back-ldbm/proto-back-ldbm.h
index 6960bd984a..88685dd123 100644
--- a/servers/slapd/back-ldbm/proto-back-ldbm.h
+++ b/servers/slapd/back-ldbm/proto-back-ldbm.h
@@ -18,8 +18,6 @@
#include
-#include "external.h"
-
LDAP_BEGIN_DECL
/*
@@ -219,5 +217,45 @@ int next_id LDAP_P(( Backend *be, ID *idp ));
int next_id_get LDAP_P(( Backend *be, ID *idp ));
int next_id_write LDAP_P(( Backend *be, ID id ));
+/*
+ * former external.h
+ */
+
+extern BI_open ldbm_back_open;
+extern BI_close ldbm_back_close;
+extern BI_destroy ldbm_back_destroy;
+
+extern BI_db_init ldbm_back_db_init;
+extern BI_db_open ldbm_back_db_open;
+extern BI_db_close ldbm_back_db_close;
+extern BI_db_destroy ldbm_back_db_destroy;
+extern BI_db_config ldbm_back_db_config;
+
+extern BI_op_extended ldbm_back_extended;
+extern BI_op_bind ldbm_back_bind;
+extern BI_op_search ldbm_back_search;
+extern BI_op_compare ldbm_back_compare;
+extern BI_op_modify ldbm_back_modify;
+extern BI_op_modrdn ldbm_back_modrdn;
+extern BI_op_add ldbm_back_add;
+extern BI_op_delete ldbm_back_delete;
+
+extern BI_operational ldbm_back_operational;
+extern BI_has_subordinates ldbm_back_hasSubordinates;
+
+/* hooks for slap tools */
+extern BI_tool_entry_open ldbm_tool_entry_open;
+extern BI_tool_entry_close ldbm_tool_entry_close;
+extern BI_tool_entry_first ldbm_tool_entry_first;
+extern BI_tool_entry_next ldbm_tool_entry_next;
+extern BI_tool_entry_get ldbm_tool_entry_get;
+extern BI_tool_entry_put ldbm_tool_entry_put;
+
+extern BI_tool_entry_reindex ldbm_tool_entry_reindex;
+extern BI_tool_sync ldbm_tool_sync;
+
+extern BI_chk_referrals ldbm_back_referrals;
+
LDAP_END_DECL
-#endif
+
+#endif /* _PROTO_BACK_LDBM */
diff --git a/servers/slapd/back-meta/back-meta.h b/servers/slapd/back-meta/back-meta.h
index 426f66dc4b..0e35e11ac1 100644
--- a/servers/slapd/back-meta/back-meta.h
+++ b/servers/slapd/back-meta/back-meta.h
@@ -27,7 +27,7 @@
#ifndef SLAPD_META_H
#define SLAPD_META_H
-#include "external.h"
+#include "proto-meta.h"
/* String rewrite library */
#include "rewrite.h"
diff --git a/servers/slapd/back-meta/external.h b/servers/slapd/back-meta/external.h
index bbffdd91e4..4fb791759a 100644
--- a/servers/slapd/back-meta/external.h
+++ b/servers/slapd/back-meta/external.h
@@ -25,24 +25,7 @@
LDAP_BEGIN_DECL
-extern BI_init meta_back_initialize;
-extern BI_open meta_back_open;
-extern BI_close meta_back_close;
-extern BI_destroy meta_back_destroy;
-
-extern BI_db_init meta_back_db_init;
-extern BI_db_destroy meta_back_db_destroy;
-extern BI_db_config meta_back_db_config;
-
-extern BI_op_bind meta_back_bind;
-extern BI_connection_destroy meta_back_conn_destroy;
-extern BI_op_search meta_back_search;
-extern BI_op_compare meta_back_compare;
-extern BI_op_modify meta_back_modify;
-extern BI_op_modrdn meta_back_modrdn;
-extern BI_op_add meta_back_add;
-extern BI_op_delete meta_back_delete;
-extern BI_op_abandon meta_back_abandon;
+extern BI_init meta_back_initialize;
LDAP_END_DECL
diff --git a/servers/slapd/back-meta/init.c b/servers/slapd/back-meta/init.c
index 8830e17639..01d9874537 100644
--- a/servers/slapd/back-meta/init.c
+++ b/servers/slapd/back-meta/init.c
@@ -25,6 +25,7 @@
#include "slap.h"
#include "../back-ldap/back-ldap.h"
#include "back-meta.h"
+#include "external.h"
#if SLAPD_META == SLAPD_MOD_DYNAMIC
diff --git a/servers/slapd/back-meta/proto-meta.h b/servers/slapd/back-meta/proto-meta.h
new file mode 100644
index 0000000000..f789cbb170
--- /dev/null
+++ b/servers/slapd/back-meta/proto-meta.h
@@ -0,0 +1,49 @@
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software .
+ *
+ * Copyright 1999-2004 The OpenLDAP Foundation.
+ * Portions Copyright 2001-2003 Pierangelo Masarati.
+ * Portions Copyright 1999-2003 Howard Chu.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * .
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by the Howard Chu for inclusion
+ * in OpenLDAP Software and subsequently enhanced by Pierangelo
+ * Masarati.
+ */
+
+#ifndef PROTO_META_H
+#define PROTO_META_H
+
+LDAP_BEGIN_DECL
+
+extern BI_open meta_back_open;
+extern BI_close meta_back_close;
+extern BI_destroy meta_back_destroy;
+
+extern BI_db_init meta_back_db_init;
+extern BI_db_destroy meta_back_db_destroy;
+extern BI_db_config meta_back_db_config;
+
+extern BI_op_bind meta_back_bind;
+extern BI_op_search meta_back_search;
+extern BI_op_compare meta_back_compare;
+extern BI_op_modify meta_back_modify;
+extern BI_op_modrdn meta_back_modrdn;
+extern BI_op_add meta_back_add;
+extern BI_op_delete meta_back_delete;
+extern BI_op_abandon meta_back_abandon;
+
+extern BI_connection_destroy meta_back_conn_destroy;
+
+LDAP_END_DECL
+
+#endif /* PROTO_META_H */
diff --git a/servers/slapd/back-monitor/external.h b/servers/slapd/back-monitor/external.h
index 1d9795bdb0..edcd0a8753 100644
--- a/servers/slapd/back-monitor/external.h
+++ b/servers/slapd/back-monitor/external.h
@@ -23,19 +23,7 @@
LDAP_BEGIN_DECL
-extern BI_init monitor_back_initialize;
-extern BI_db_init monitor_back_db_init;
-extern BI_db_open monitor_back_db_open;
-extern BI_config monitor_back_config;
-extern BI_db_config monitor_back_db_config;
-
-extern BI_db_destroy monitor_back_db_destroy;
-
-extern BI_op_search monitor_back_search;
-extern BI_op_compare monitor_back_compare;
-extern BI_op_modify monitor_back_modify;
-extern BI_op_bind monitor_back_bind;
-extern BI_operational monitor_back_operational;
+extern BI_init monitor_back_initialize;
LDAP_END_DECL
diff --git a/servers/slapd/back-monitor/proto-back-monitor.h b/servers/slapd/back-monitor/proto-back-monitor.h
index dcc0b9e826..e9621efa4a 100644
--- a/servers/slapd/back-monitor/proto-back-monitor.h
+++ b/servers/slapd/back-monitor/proto-back-monitor.h
@@ -23,8 +23,6 @@
#include
-#include "external.h"
-
LDAP_BEGIN_DECL
/*
@@ -172,6 +170,22 @@ int monitor_subsys_rww_update LDAP_P(( Operation *op, Entry *e ));
} while ( 0 )
#endif /* ! HAVE_GMP */
+/*
+ * former external.h
+ */
+
+extern BI_db_init monitor_back_db_init;
+extern BI_db_open monitor_back_db_open;
+extern BI_config monitor_back_config;
+extern BI_db_destroy monitor_back_db_destroy;
+extern BI_db_config monitor_back_db_config;
+
+extern BI_op_search monitor_back_search;
+extern BI_op_compare monitor_back_compare;
+extern BI_op_modify monitor_back_modify;
+extern BI_op_bind monitor_back_bind;
+extern BI_operational monitor_back_operational;
+
LDAP_END_DECL
#endif /* _PROTO_BACK_MONITOR */
diff --git a/servers/slapd/back-null/external.h b/servers/slapd/back-null/external.h
index 6e899ddf5d..158779286e 100644
--- a/servers/slapd/back-null/external.h
+++ b/servers/slapd/back-null/external.h
@@ -24,25 +24,6 @@ LDAP_BEGIN_DECL
extern BI_init null_back_initialize;
-extern BI_db_init null_back_db_init;
-extern BI_db_destroy null_back_db_destroy;
-
-extern BI_db_config null_back_db_config;
-
-extern BI_op_bind null_back_bind;
-
-extern BI_op_search null_back_search;
-
-extern BI_op_compare null_back_compare;
-
-extern BI_op_modify null_back_modify;
-
-extern BI_op_modrdn null_back_modrdn;
-
-extern BI_op_add null_back_add;
-
-extern BI_op_delete null_back_delete;
-
LDAP_END_DECL
#endif /* _NULL_EXTERNAL_H */
diff --git a/servers/slapd/back-null/null.c b/servers/slapd/back-null/null.c
index e87575862c..f0d5f76df9 100644
--- a/servers/slapd/back-null/null.c
+++ b/servers/slapd/back-null/null.c
@@ -26,6 +26,22 @@
#include "slap.h"
#include "external.h"
+/*
+ * former external.h
+ */
+
+extern BI_db_init null_back_db_init;
+extern BI_db_destroy null_back_db_destroy;
+extern BI_db_config null_back_db_config;
+
+extern BI_op_bind null_back_bind;
+extern BI_op_search null_back_search;
+extern BI_op_compare null_back_compare;
+extern BI_op_modify null_back_modify;
+extern BI_op_modrdn null_back_modrdn;
+extern BI_op_add null_back_add;
+extern BI_op_delete null_back_delete;
+
struct null_info {
int bind_allowed;
};
diff --git a/servers/slapd/back-passwd/back-passwd.h b/servers/slapd/back-passwd/back-passwd.h
index a73f816cd9..4980530936 100644
--- a/servers/slapd/back-passwd/back-passwd.h
+++ b/servers/slapd/back-passwd/back-passwd.h
@@ -16,12 +16,18 @@
#ifndef _BACK_PASSWD_H
#define _BACK_PASSWD_H
-#include "external.h"
+#include "proto-passwd.h"
LDAP_BEGIN_DECL
extern ldap_pvt_thread_mutex_t passwd_mutex;
+extern BI_destroy passwd_back_destroy;
+
+extern BI_db_config passwd_back_db_config;
+
+extern BI_op_search passwd_back_search;
+
LDAP_END_DECL
#endif /* _BACK_PASSWD_H */
diff --git a/servers/slapd/back-passwd/config.c b/servers/slapd/back-passwd/config.c
index 4e9c92fdc4..65f59c363a 100644
--- a/servers/slapd/back-passwd/config.c
+++ b/servers/slapd/back-passwd/config.c
@@ -37,7 +37,7 @@
#include
#include "slap.h"
-#include "external.h"
+#include "back-passwd.h"
int
passwd_back_db_config(
diff --git a/servers/slapd/back-passwd/external.h b/servers/slapd/back-passwd/external.h
index 5622dda7c3..eb32b9b156 100644
--- a/servers/slapd/back-passwd/external.h
+++ b/servers/slapd/back-passwd/external.h
@@ -18,12 +18,7 @@
LDAP_BEGIN_DECL
-extern BI_init passwd_back_initialize;
-extern BI_destroy passwd_back_destroy;
-
-extern BI_op_search passwd_back_search;
-
-extern BI_db_config passwd_back_db_config;
+extern BI_init passwd_back_initialize;
LDAP_END_DECL
diff --git a/servers/slapd/back-passwd/init.c b/servers/slapd/back-passwd/init.c
index 1ef59c31e6..34e486846c 100644
--- a/servers/slapd/back-passwd/init.c
+++ b/servers/slapd/back-passwd/init.c
@@ -22,6 +22,7 @@
#include "slap.h"
#include "back-passwd.h"
+#include "external.h"
ldap_pvt_thread_mutex_t passwd_mutex;
diff --git a/servers/slapd/back-passwd/proto-passwd.h b/servers/slapd/back-passwd/proto-passwd.h
new file mode 100644
index 0000000000..e43f1b9458
--- /dev/null
+++ b/servers/slapd/back-passwd/proto-passwd.h
@@ -0,0 +1,29 @@
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software .
+ *
+ * Copyright 1998-2004 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * .
+ */
+
+#ifndef PROTO_PASSWD_H
+#define PROTO_PASSWD_H
+
+LDAP_BEGIN_DECL
+
+extern BI_destroy passwd_back_destroy;
+
+extern BI_db_config passwd_back_db_config;
+
+extern BI_op_search passwd_back_search;
+
+LDAP_END_DECL
+
+#endif /* PROTO_PASSWD_H */
diff --git a/servers/slapd/back-perl/external.h b/servers/slapd/back-perl/external.h
index 89cd9cbecf..166f839753 100644
--- a/servers/slapd/back-perl/external.h
+++ b/servers/slapd/back-perl/external.h
@@ -20,30 +20,7 @@
LDAP_BEGIN_DECL
-extern BI_init perl_back_initialize;
-extern BI_open perl_back_open;
-extern BI_close perl_back_close;
-extern BI_destroy perl_back_destroy;
-
-extern BI_db_init perl_back_db_init;
-extern BI_db_open perl_back_db_open;
-extern BI_db_destroy perl_back_db_destroy;
-
-extern BI_db_config perl_back_db_config;
-
-extern BI_op_bind perl_back_bind;
-
-extern BI_op_search perl_back_search;
-
-extern BI_op_compare perl_back_compare;
-
-extern BI_op_modify perl_back_modify;
-
-extern BI_op_modrdn perl_back_modrdn;
-
-extern BI_op_add perl_back_add;
-
-extern BI_op_delete perl_back_delete;
+extern BI_init perl_back_initialize;
LDAP_END_DECL
diff --git a/servers/slapd/back-perl/init.c b/servers/slapd/back-perl/init.c
index 8b512135bd..91ca484979 100644
--- a/servers/slapd/back-perl/init.c
+++ b/servers/slapd/back-perl/init.c
@@ -16,7 +16,7 @@
*/
#include "perl_back.h"
-
+#include "external.h"
static void perl_back_xs_init LDAP_P((PERL_BACK_XS_INIT_PARAMS));
EXT void boot_DynaLoader LDAP_P((PERL_BACK_BOOT_DYNALOADER_PARAMS));
diff --git a/servers/slapd/back-perl/perl_back.h b/servers/slapd/back-perl/perl_back.h
index 332d1dc390..4609889959 100644
--- a/servers/slapd/back-perl/perl_back.h
+++ b/servers/slapd/back-perl/perl_back.h
@@ -70,6 +70,6 @@ typedef struct perl_backend_instance {
LDAP_END_DECL
-#include "external.h"
+#include "proto-perl.h"
-#endif
+#endif /* PERL_BACK_H */
diff --git a/servers/slapd/back-perl/proto-perl.h b/servers/slapd/back-perl/proto-perl.h
new file mode 100644
index 0000000000..8fe2a1f2d5
--- /dev/null
+++ b/servers/slapd/back-perl/proto-perl.h
@@ -0,0 +1,42 @@
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software .
+ *
+ * Copyright 1999-2004 The OpenLDAP Foundation.
+ * Portions Copyright 1999 John C. Quillan.
+ * Portions Copyright 2002 myinternet Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * .
+ */
+
+#ifndef PROTO_PERL_H
+#define PROTO_PERL_H
+
+LDAP_BEGIN_DECL
+
+extern BI_open perl_back_open;
+extern BI_close perl_back_close;
+extern BI_destroy perl_back_destroy;
+
+extern BI_db_init perl_back_db_init;
+extern BI_db_open perl_back_db_open;
+extern BI_db_destroy perl_back_db_destroy;
+extern BI_db_config perl_back_db_config;
+
+extern BI_op_bind perl_back_bind;
+extern BI_op_search perl_back_search;
+extern BI_op_compare perl_back_compare;
+extern BI_op_modify perl_back_modify;
+extern BI_op_modrdn perl_back_modrdn;
+extern BI_op_add perl_back_add;
+extern BI_op_delete perl_back_delete;
+
+LDAP_END_DECL
+
+#endif /* PROTO_PERL_H */
diff --git a/servers/slapd/back-relay/back-relay.h b/servers/slapd/back-relay/back-relay.h
index 9e447a7448..43b86f68fe 100644
--- a/servers/slapd/back-relay/back-relay.h
+++ b/servers/slapd/back-relay/back-relay.h
@@ -21,7 +21,7 @@
#ifndef SLAPD_RELAY_H
#define SLAPD_RELAY_H
-#include "external.h"
+#include "proto-back-relay.h"
/* String rewrite library */
diff --git a/servers/slapd/back-relay/external.h b/servers/slapd/back-relay/external.h
index f5b33ba810..71eb4e335b 100644
--- a/servers/slapd/back-relay/external.h
+++ b/servers/slapd/back-relay/external.h
@@ -23,52 +23,6 @@
LDAP_BEGIN_DECL
extern BI_init relay_back_initialize;
-#if 0
-extern BI_config relay_back_config;
-extern BI_open relay_back_open;
-extern BI_close relay_back_close;
-extern BI_destroy relay_back_destroy;
-#endif
-
-extern BI_db_init relay_back_db_init;
-extern BI_db_config relay_back_db_config;
-extern BI_db_open relay_back_db_open;
-extern BI_db_close relay_back_db_close;
-extern BI_db_destroy relay_back_db_destroy;
-
-extern BI_op_bind relay_back_op_bind;
-extern BI_op_unbind relay_back_op_unbind;
-extern BI_op_search relay_back_op_search;
-extern BI_op_compare relay_back_op_compare;
-extern BI_op_modify relay_back_op_modify;
-extern BI_op_modrdn relay_back_op_modrdn;
-extern BI_op_add relay_back_op_add;
-extern BI_op_delete relay_back_op_delete;
-extern BI_op_abandon relay_back_op_abandon;
-extern BI_op_cancel relay_back_op_cancel;
-extern BI_op_extended relay_back_op_extended;
-extern BI_entry_release_rw relay_back_entry_release_rw;
-extern BI_entry_get_rw relay_back_entry_get_rw;
-extern BI_chk_referrals relay_back_chk_referrals;
-extern BI_operational relay_back_operational;
-extern BI_has_subordinates relay_back_has_subordinates;
-
-extern BI_connection_init relay_back_connection_init;
-extern BI_connection_destroy relay_back_connection_destroy;
-
-#if 0
-extern BI_tool_entry_open relay_back_tool_entry_open;
-extern BI_tool_entry_close relay_back_tool_entry_close;
-extern BI_tool_entry_first relay_back_tool_entry_first;
-extern BI_tool_entry_next relay_back_tool_entry_next;
-extern BI_tool_entry_get relay_back_tool_entry_get;
-extern BI_tool_entry_put relay_back_tool_entry_put;
-extern BI_tool_entry_reindex relay_back_tool_entry_reindex;
-extern BI_tool_sync relay_back_tool_sync;
-extern BI_tool_dn2id_get relay_back_tool_dn2id_get;
-extern BI_tool_id2entry_get relay_back_tool_id2entry_get;
-extern BI_tool_entry_modify relay_back_tool_entry_modify;
-#endif
LDAP_END_DECL
diff --git a/servers/slapd/back-relay/init.c b/servers/slapd/back-relay/init.c
index e448ec1185..3f57f83795 100644
--- a/servers/slapd/back-relay/init.c
+++ b/servers/slapd/back-relay/init.c
@@ -24,6 +24,7 @@
#include "slap.h"
#include "back-relay.h"
+#include "external.h"
#if SLAPD_RELAY == SLAPD_MOD_DYNAMIC
diff --git a/servers/slapd/back-relay/proto-back-relay.h b/servers/slapd/back-relay/proto-back-relay.h
index afaba21bf1..5d2d8ba388 100644
--- a/servers/slapd/back-relay/proto-back-relay.h
+++ b/servers/slapd/back-relay/proto-back-relay.h
@@ -22,10 +22,34 @@
#include
-#include "external.h"
-
LDAP_BEGIN_DECL
+extern BI_db_init relay_back_db_init;
+extern BI_db_config relay_back_db_config;
+extern BI_db_open relay_back_db_open;
+extern BI_db_close relay_back_db_close;
+extern BI_db_destroy relay_back_db_destroy;
+
+extern BI_op_bind relay_back_op_bind;
+extern BI_op_unbind relay_back_op_unbind;
+extern BI_op_search relay_back_op_search;
+extern BI_op_compare relay_back_op_compare;
+extern BI_op_modify relay_back_op_modify;
+extern BI_op_modrdn relay_back_op_modrdn;
+extern BI_op_add relay_back_op_add;
+extern BI_op_delete relay_back_op_delete;
+extern BI_op_abandon relay_back_op_abandon;
+extern BI_op_cancel relay_back_op_cancel;
+extern BI_op_extended relay_back_op_extended;
+extern BI_entry_release_rw relay_back_entry_release_rw;
+extern BI_entry_get_rw relay_back_entry_get_rw;
+extern BI_chk_referrals relay_back_chk_referrals;
+extern BI_operational relay_back_operational;
+extern BI_has_subordinates relay_back_has_subordinates;
+
+extern BI_connection_init relay_back_connection_init;
+extern BI_connection_destroy relay_back_connection_destroy;
+
LDAP_END_DECL
#endif /* PROTO_BACK_RELAY */
diff --git a/servers/slapd/back-shell/external.h b/servers/slapd/back-shell/external.h
index 6de49c680e..103c323aa7 100644
--- a/servers/slapd/back-shell/external.h
+++ b/servers/slapd/back-shell/external.h
@@ -32,31 +32,7 @@
LDAP_BEGIN_DECL
-extern BI_init shell_back_initialize;
-extern BI_open shell_back_open;
-extern BI_close shell_back_close;
-extern BI_destroy shell_back_destroy;
-
-extern BI_db_init shell_back_db_init;
-extern BI_db_destroy shell_back_db_destroy;
-
-extern BI_db_config shell_back_db_config;
-
-extern BI_op_bind shell_back_bind;
-
-extern BI_op_unbind shell_back_unbind;
-
-extern BI_op_search shell_back_search;
-
-extern BI_op_compare shell_back_compare;
-
-extern BI_op_modify shell_back_modify;
-
-extern BI_op_modrdn shell_back_modrdn;
-
-extern BI_op_add shell_back_add;
-
-extern BI_op_delete shell_back_delete;
+extern BI_init shell_back_initialize;
LDAP_END_DECL
diff --git a/servers/slapd/back-shell/init.c b/servers/slapd/back-shell/init.c
index 56f4b75a8d..a523ef3a2d 100644
--- a/servers/slapd/back-shell/init.c
+++ b/servers/slapd/back-shell/init.c
@@ -35,7 +35,9 @@
#include
#include "slap.h"
+
#include "shell.h"
+#include "external.h"
#if SLAPD_SHELL == SLAPD_MOD_DYNAMIC
diff --git a/servers/slapd/back-shell/proto-shell.h b/servers/slapd/back-shell/proto-shell.h
new file mode 100644
index 0000000000..f2a1279622
--- /dev/null
+++ b/servers/slapd/back-shell/proto-shell.h
@@ -0,0 +1,54 @@
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software .
+ *
+ * Copyright 1998-2004 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * .
+ */
+/* Portions Copyright (c) 1995 Regents of the University of Michigan.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of Michigan at Ann Arbor. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was originally developed by the University of Michigan
+ * (as part of U-MICH LDAP).
+ */
+
+#ifndef PROTO_SHELL_H
+#define PROTO_SHELL_H
+
+LDAP_BEGIN_DECL
+
+extern BI_open shell_back_open;
+extern BI_close shell_back_close;
+extern BI_destroy shell_back_destroy;
+
+extern BI_db_init shell_back_db_init;
+extern BI_db_destroy shell_back_db_destroy;
+extern BI_db_config shell_back_db_config;
+
+extern BI_op_bind shell_back_bind;
+extern BI_op_unbind shell_back_unbind;
+extern BI_op_search shell_back_search;
+extern BI_op_compare shell_back_compare;
+extern BI_op_modify shell_back_modify;
+extern BI_op_modrdn shell_back_modrdn;
+extern BI_op_add shell_back_add;
+extern BI_op_delete shell_back_delete;
+
+LDAP_END_DECL
+
+#endif /* PROTO_SHELL_H */
diff --git a/servers/slapd/back-shell/shell.h b/servers/slapd/back-shell/shell.h
index c2f17ed8f3..c10cffd748 100644
--- a/servers/slapd/back-shell/shell.h
+++ b/servers/slapd/back-shell/shell.h
@@ -31,7 +31,7 @@
#ifndef SLAPD_SHELL_H
#define SLAPD_SHELL_H
-#include "external.h"
+#include "proto-shell.h"
LDAP_BEGIN_DECL
diff --git a/servers/slapd/back-sql/back-sql.h b/servers/slapd/back-sql/back-sql.h
index 14a8a36f2f..07a73e2615 100644
--- a/servers/slapd/back-sql/back-sql.h
+++ b/servers/slapd/back-sql/back-sql.h
@@ -74,7 +74,6 @@
#ifndef __BACKSQL_H__
#define __BACKSQL_H__
-#include "external.h"
#include "sql-types.h"
/*
diff --git a/servers/slapd/back-sql/external.h b/servers/slapd/back-sql/external.h
index 57c05321be..f9d90c86e4 100644
--- a/servers/slapd/back-sql/external.h
+++ b/servers/slapd/back-sql/external.h
@@ -23,27 +23,7 @@
LDAP_BEGIN_DECL
-extern BI_init backsql_initialize;
-extern BI_destroy backsql_destroy;
-
-extern BI_db_init backsql_db_init;
-extern BI_db_open backsql_db_open;
-extern BI_db_close backsql_db_close;
-extern BI_db_destroy backsql_db_destroy;
-
-extern BI_db_config backsql_db_config;
-
-extern BI_op_bind backsql_bind;
-extern BI_op_search backsql_search;
-extern BI_op_compare backsql_compare;
-extern BI_op_modify backsql_modify;
-extern BI_op_modrdn backsql_modrdn;
-extern BI_op_add backsql_add;
-extern BI_op_delete backsql_delete;
-
-extern BI_operational backsql_operational;
-
-extern BI_connection_destroy backsql_connection_destroy;
+extern BI_init sql_back_initialize;
LDAP_END_DECL
diff --git a/servers/slapd/back-sql/init.c b/servers/slapd/back-sql/init.c
index e4eb0c5fcc..e5519bb794 100644
--- a/servers/slapd/back-sql/init.c
+++ b/servers/slapd/back-sql/init.c
@@ -28,6 +28,7 @@
#include "slap.h"
#include "proto-sql.h"
+#include "external.h"
#if SLAPD_SQL == SLAPD_MOD_DYNAMIC
@@ -40,7 +41,7 @@ init_module(
memset( &bi, '\0', sizeof( bi ) );
bi.bi_type = "sql";
- bi.bi_init = backsql_initialize;
+ bi.bi_init = sql_back_initialize;
backend_add( &bi );
return 0;
@@ -49,7 +50,7 @@ init_module(
#endif /* SLAPD_SQL == SLAPD_MOD_DYNAMIC */
int
-backsql_initialize(
+sql_back_initialize(
BackendInfo *bi )
{
static char *controls[] = {
@@ -66,7 +67,7 @@ backsql_initialize(
bi->bi_controls = controls;
- Debug( LDAP_DEBUG_TRACE,"==>backsql_initialize()\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE,"==>sql_back_initialize()\n", 0, 0, 0 );
bi->bi_open = 0;
bi->bi_config = 0;
@@ -95,7 +96,7 @@ backsql_initialize(
bi->bi_connection_init = 0;
bi->bi_connection_destroy = backsql_connection_destroy;
- Debug( LDAP_DEBUG_TRACE,"<==backsql_initialize()\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE,"<==sql_back_initialize()\n", 0, 0, 0 );
return 0;
}
diff --git a/servers/slapd/back-sql/proto-sql.h b/servers/slapd/back-sql/proto-sql.h
index 65ad3351ad..cd6d0107e6 100644
--- a/servers/slapd/back-sql/proto-sql.h
+++ b/servers/slapd/back-sql/proto-sql.h
@@ -256,4 +256,27 @@ int backsql_entryUUID_decode( struct berval *entryUUID, unsigned long *oc_id,
#endif /* ! BACKSQL_ARBITRARY_KEY */
);
+/*
+ * former external.h
+ */
+extern BI_destroy backsql_destroy;
+
+extern BI_db_init backsql_db_init;
+extern BI_db_open backsql_db_open;
+extern BI_db_close backsql_db_close;
+extern BI_db_destroy backsql_db_destroy;
+extern BI_db_config backsql_db_config;
+
+extern BI_op_bind backsql_bind;
+extern BI_op_search backsql_search;
+extern BI_op_compare backsql_compare;
+extern BI_op_modify backsql_modify;
+extern BI_op_modrdn backsql_modrdn;
+extern BI_op_add backsql_add;
+extern BI_op_delete backsql_delete;
+
+extern BI_operational backsql_operational;
+
+extern BI_connection_destroy backsql_connection_destroy;
+
#endif /* PROTO_SQL_H */
diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c
index 0a59626bea..1ef4c3fdfd 100644
--- a/servers/slapd/backend.c
+++ b/servers/slapd/backend.c
@@ -48,6 +48,8 @@ static int call_group_preop_plugins( Operation *op );
static void call_group_postop_plugins( Operation *op );
#endif /* LDAP_SLAPI */
+#if 0
+
/*
* If a module is configured as dynamic, its header should not
* get included into slapd. While this is a general rule and does
@@ -152,11 +154,34 @@ static BackendInfo binfo[] = {
{NULL}
};
+#endif
+
+/*
+ * If a module is configured as dynamic, its header should not
+ * get included into slapd. While this is a general rule and does
+ * not have much of an effect in UNIX, this rule should be adhered
+ * to for Windows, where dynamic object code should not be implicitly
+ * imported into slapd without appropriate __declspec(dllimport) directives.
+ */
+
+/*
+ * This file is automatically generated by configure; it defines
+ * the BackendInfo binfo[] structure with the configured static
+ * backend info. It assumes that every backend of type
+ * provides an initialization function
+ *
+ * int name_back_initialize( BackendInfo *bi )
+ *
+ * that populates the rest of the structure.
+ */
+
+#include "backend.h"
+
int nBackendInfo = 0;
-BackendInfo *backendInfo = NULL;
+BackendInfo *backendInfo = NULL;
int nBackendDB = 0;
-BackendDB *backendDB = NULL;
+BackendDB *backendDB = NULL;
ldap_pvt_thread_pool_t syncrepl_pool;
int syncrepl_pool_max = SLAP_MAX_SYNCREPL_THREADS;