X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-meta%2Finit.c;h=e7883ce14738fb4077c9eda321983e02961997d3;hb=8d14165274b244d6f91587502bd0a23ec7b08a87;hp=d173e6e1de04c90f28cb029d8e922c45626ce2c5;hpb=9c550e7235830af9d031d8d7ba86b87f36dcc99f;p=openldap diff --git a/servers/slapd/back-meta/init.c b/servers/slapd/back-meta/init.c index d173e6e1de..e7883ce147 100644 --- a/servers/slapd/back-meta/init.c +++ b/servers/slapd/back-meta/init.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * 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. @@ -25,7 +25,6 @@ #include "slap.h" #include "../back-ldap/back-ldap.h" #include "back-meta.h" -#include "external.h" int meta_back_open( @@ -111,22 +110,23 @@ conn_free( 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 ); } @@ -144,34 +144,34 @@ target_free( 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 @@ -224,20 +224,9 @@ meta_back_db_destroy( #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 */