/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1999-2004 The OpenLDAP Foundation.
+ * Copyright 1999-2005 The OpenLDAP Foundation.
* Portions Copyright 2001-2003 Pierangelo Masarati.
* Portions Copyright 1999-2003 Howard Chu.
* All rights reserved.
#include "slap.h"
#include "../back-ldap/back-ldap.h"
#include "back-meta.h"
-#include "external.h"
int
meta_back_open(
void *v_lc
)
{
- struct metaconn *lc = v_lc;
- struct metasingleconn *lsc;
+ struct metaconn *lc = v_lc;
+ struct metasingleconn *lsc;
- for ( lsc = lc->conns; !META_LAST(lsc); lsc++ ) {
- if ( lsc->ld != NULL ) {
- ldap_unbind( lsc->ld );
+ for ( lsc = lc->mc_conns; !META_LAST( lsc ); lsc++ ) {
+ if ( lsc->msc_ld != NULL ) {
+ ldap_unbind_ext_s( lsc->msc_ld, NULL, NULL );
}
- if ( lsc->bound_dn.bv_val ) {
- ber_memfree( lsc->bound_dn.bv_val );
+ if ( !BER_BVISNULL( &lsc->msc_bound_ndn ) ) {
+ ber_memfree( lsc->msc_bound_ndn.bv_val );
}
- if ( lsc->cred.bv_val ) {
- memset( lsc->cred.bv_val, 0, lsc->cred.bv_len );
- ber_memfree( lsc->cred.bv_val );
+ if ( !BER_BVISNULL( &lsc->msc_cred ) ) {
+ /* destroy sensitive data */
+ memset( lsc->msc_cred.bv_val, 0, lsc->msc_cred.bv_len );
+ ber_memfree( lsc->msc_cred.bv_val );
}
}
- free( lc->conns );
+ free( lc->mc_conns );
free( lc );
}
struct metatarget *lt
)
{
- if ( lt->uri ) {
- free( lt->uri );
+ if ( lt->mt_uri ) {
+ free( lt->mt_uri );
}
- if ( lt->psuffix.bv_val ) {
- free( lt->psuffix.bv_val );
+ if ( !BER_BVISNULL( <->mt_psuffix ) ) {
+ free( lt->mt_psuffix.bv_val );
}
- if ( lt->suffix.bv_val ) {
- free( lt->suffix.bv_val );
+ if ( !BER_BVISNULL( <->mt_nsuffix ) ) {
+ free( lt->mt_nsuffix.bv_val );
}
- if ( lt->binddn.bv_val ) {
- free( lt->binddn.bv_val );
+ if ( !BER_BVISNULL( <->mt_binddn ) ) {
+ free( lt->mt_binddn.bv_val );
}
- if ( lt->bindpw.bv_val ) {
- free( lt->bindpw.bv_val );
+ if ( !BER_BVISNULL( <->mt_bindpw ) ) {
+ free( lt->mt_bindpw.bv_val );
}
- if ( lt->pseudorootdn.bv_val ) {
- free( lt->pseudorootdn.bv_val );
+ if ( !BER_BVISNULL( <->mt_pseudorootdn ) ) {
+ free( lt->mt_pseudorootdn.bv_val );
}
- if ( lt->pseudorootpw.bv_val ) {
- free( lt->pseudorootpw.bv_val );
+ if ( !BER_BVISNULL( <->mt_pseudorootpw ) ) {
+ free( lt->mt_pseudorootpw.bv_val );
}
- if ( lt->rwmap.rwm_rw ) {
- rewrite_info_delete( <->rwmap.rwm_rw );
+ if ( lt->mt_rwmap.rwm_rw ) {
+ rewrite_info_delete( <->mt_rwmap.rwm_rw );
}
- avl_free( lt->rwmap.rwm_oc.remap, NULL );
- avl_free( lt->rwmap.rwm_oc.map, mapping_free );
- avl_free( lt->rwmap.rwm_at.remap, NULL );
- avl_free( lt->rwmap.rwm_at.map, mapping_free );
+ avl_free( lt->mt_rwmap.rwm_oc.remap, NULL );
+ avl_free( lt->mt_rwmap.rwm_oc.map, mapping_free );
+ avl_free( lt->mt_rwmap.rwm_at.remap, NULL );
+ avl_free( lt->mt_rwmap.rwm_at.map, mapping_free );
}
int
#if SLAPD_META == SLAPD_MOD_DYNAMIC
-int
-init_module( int argc, char *argv[] )
-{
- BackendInfo bi;
-
- memset( &bi, '\0', sizeof( bi ) );
- bi.bi_type = "meta";
- bi.bi_init = meta_back_initialize;
-
- backend_add( &bi );
-
- return 0;
-}
+/* conditionally define the init_module() function */
+SLAP_BACKEND_INIT_MODULE( meta )
-#endif /* SLAPD_META */
+#endif /* SLAPD_META == SLAPD_MOD_DYNAMIC */