#include <sys/stat.h>
#include "slap.h"
+#include "lutil.h"
+#ifdef SLAPD_LDAP
+#include "back-ldap/external.h"
+#endif
#ifdef SLAPD_LDBM
#include "back-ldbm/external.h"
#endif
#ifdef SLAPD_SHELL
#include "back-shell/external.h"
#endif
+#ifdef SLAPD_TCL
+#include "back-tcl/external.h"
+#endif
static BackendInfo binfo[] = {
+#ifdef SLAPD_LDAP
+ {"ldap", ldap_back_initialize},
+#endif
#ifdef SLAPD_LDBM
{"ldbm", ldbm_back_initialize},
#endif
#endif
#ifdef SLAPD_SHELL
{"shell", shell_back_initialize},
+#endif
+#ifdef SLAPD_TCL
+ {"tcl", tcl_back_initialize},
#endif
{NULL}
};
int i;
for ( i = 0; i < nbackends; i++ ) {
- if ( backends[i].bd_info->bi_db_close != NULL ) {
+ if ( backends[i].bd_info->bi_db_close ) {
(*backends[i].bd_info->bi_db_close)( &backends[i] );
}
}
dnlen = strlen( dn );
for ( i = 0; i < nbackends; i++ ) {
- for ( j = 0; backends[i].be_suffix != NULL &&
- backends[i].be_suffix[j] != NULL; j++ )
+ for ( j = 0; backends[i].be_nsuffix != NULL &&
+ backends[i].be_nsuffix[j] != NULL; j++ )
{
- len = strlen( backends[i].be_suffix[j] );
+ len = strlen( backends[i].be_nsuffix[j] );
if ( len > dnlen ) {
continue;
}
- if ( strcmp( backends[i].be_suffix[j],
+ if ( strcmp( backends[i].be_nsuffix[j],
dn + (dnlen - len) ) == 0 ) {
return( &backends[i] );
}
{
int i;
- for ( i = 0; be->be_suffix != NULL && be->be_suffix[i] != NULL; i++ ) {
- if ( strcmp( be->be_suffix[i], suffix ) == 0 ) {
+ for ( i = 0; be->be_nsuffix != NULL && be->be_nsuffix[i] != NULL; i++ ) {
+ if ( strcmp( be->be_nsuffix[i], suffix ) == 0 ) {
return( 1 );
}
}
char *
be_root_dn( Backend *be )
{
- int rc;
-
if ( be->be_root_dn == NULL ) {
return( "" );
}
return result == 0;
}
+int
+be_entry_release_rw( Backend *be, Entry *e, int rw )
+{
+ if ( be->be_release ) {
+ /* free and release entry from backend */
+ return be->be_release( be, e, rw );
+ } else {
+ /* free entry */
+ entry_free( e );
+ return 0;
+ }
+}
+
int
backend_unbind(
Connection *conn,
int i;
for ( i = 0; i < nbackends; i++ ) {
- if ( backends[i].be_unbind != NULL ) {
+ if ( backends[i].be_unbind ) {
(*backends[i].be_unbind)( &backends[i], conn, op );
}
}
return 0;
}
+int
+backend_connection_init(
+ Connection *conn
+)
+{
+ int i;
+
+ for ( i = 0; i < nbackends; i++ ) {
+ if ( backends[i].be_connection_init ) {
+ (*backends[i].be_connection_init)( &backends[i], conn);
+ }
+ }
+
+ return 0;
+}
+
+int
+backend_connection_destroy(
+ Connection *conn
+)
+{
+ int i;
+
+ for ( i = 0; i < nbackends; i++ ) {
+ if ( backends[i].be_connection_destroy ) {
+ (*backends[i].be_connection_destroy)( &backends[i], conn);
+ }
+ }
+
+ return 0;
+}
+
#ifdef SLAPD_ACLGROUPS
int
backend_group(