-/*
- * Copyright 1998-2001 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1999-2003 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
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by the Howard Chu for inclusion
+ * in OpenLDAP Software and subsequently enhanced by Pierangelo
+ * Masarati.
+ */
+/* This is an altered version */
+/*
* Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
*
* This work has been developed to fulfill the requirements
#include <stdio.h>
+#include <ac/string.h>
#include <ac/socket.h>
#include "slap.h"
#ifdef SLAPD_META_DYNAMIC
int
-back_meta_LTX_init_module( int argc, char *argv[] ) {
+init_module( int argc, char *argv[] ) {
BackendInfo bi;
memset( &bi, '\0', sizeof( bi ) );
BackendInfo *bi
)
{
+ bi->bi_controls = slap_known_controls;
+
bi->bi_open = 0;
bi->bi_config = 0;
bi->bi_close = 0;
bi->bi_extended = 0;
- bi->bi_acl_group = meta_back_group;
- bi->bi_acl_attribute = meta_back_attribute;
bi->bi_chk_referrals = 0;
bi->bi_connection_init = 0;
{
struct metainfo *li;
+ struct rewrite_info *rwinfo;
+
+ rwinfo = rewrite_info_init( REWRITE_MODE_USE_DEFAULT );
+ if ( rwinfo == NULL ) {
+ return -1;
+ }
+
li = ch_calloc( 1, sizeof( struct metainfo ) );
if ( li == NULL ) {
+ rewrite_info_delete( &rwinfo );
return -1;
}
-
+
/*
* At present the default is no default target;
* this may change
*/
li->defaulttarget = META_DEFAULT_TARGET_NONE;
+ li->rwinfo = rwinfo;
ldap_pvt_thread_mutex_init( &li->conn_mutex );
ldap_pvt_thread_mutex_init( &li->cache.mutex );
static void
conn_free(
- struct metaconn *lc
+ void *v_lc
)
{
- struct metasingleconn **lsc;
+ struct metaconn *lc = v_lc;
+ struct metasingleconn *lsc;
- for ( lsc = lc->conns; lsc[ 0 ] != NULL; lsc++ ) {
- if ( lsc[ 0 ]->ld != NULL ) {
- ldap_unbind( lsc[ 0 ]->ld );
+ for ( lsc = lc->conns; !META_LAST(lsc); lsc++ ) {
+ if ( lsc->ld != NULL ) {
+ ldap_unbind( lsc->ld );
+ }
+ if ( lsc->bound_dn.bv_val ) {
+ ber_memfree( lsc->bound_dn.bv_val );
}
- if ( lsc[ 0 ]->bound_dn ) {
- free( lsc[ 0 ]->bound_dn );
+ if ( lsc->cred.bv_val ) {
+ memset( lsc->cred.bv_val, 0, lsc->cred.bv_len );
+ ber_memfree( lsc->cred.bv_val );
}
- free( lsc[ 0 ] );
}
free( lc->conns );
free( lc );
if ( lt->uri ) {
free( lt->uri );
}
- if ( lt->binddn ) {
- free( lt->binddn );
+ if ( lt->psuffix.bv_val ) {
+ free( lt->psuffix.bv_val );
+ }
+ if ( lt->suffix.bv_val ) {
+ free( lt->suffix.bv_val );
+ }
+ if ( lt->binddn.bv_val ) {
+ free( lt->binddn.bv_val );
+ }
+ if ( lt->bindpw.bv_val ) {
+ free( lt->bindpw.bv_val );
}
- if ( lt->bindpw ) {
- free( lt->bindpw );
+ if ( lt->pseudorootdn.bv_val ) {
+ free( lt->pseudorootdn.bv_val );
}
- if ( lt->rwinfo ) {
- rewrite_info_delete( lt->rwinfo );
+ if ( lt->pseudorootpw.bv_val ) {
+ free( lt->pseudorootpw.bv_val );
}
- avl_free( lt->oc_map.remap, NULL );
- avl_free( lt->oc_map.map, ( AVL_FREE )mapping_free );
- avl_free( lt->at_map.remap, NULL );
- avl_free( lt->at_map.map, ( AVL_FREE )mapping_free );
+ if ( lt->rwmap.rwm_rw ) {
+ rewrite_info_delete( <->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 );
}
int
ldap_pvt_thread_mutex_lock( &li->conn_mutex );
if ( li->conntree ) {
- avl_free( li->conntree,
- ( AVL_FREE )conn_free );
+ avl_free( li->conntree, conn_free );
}
- ldap_pvt_thread_mutex_unlock( &li->cache.mutex );
- ldap_pvt_thread_mutex_destroy( &li->cache.mutex );
-
/*
* Destroy the per-target stuff (assuming there's at
* least one ...)
ldap_pvt_thread_mutex_lock( &li->cache.mutex );
if ( li->cache.tree ) {
- avl_free( li->cache.tree,
- ( AVL_FREE )meta_dncache_free );
+ avl_free( li->cache.tree, meta_dncache_free );
}
ldap_pvt_thread_mutex_unlock( &li->cache.mutex );
ldap_pvt_thread_mutex_destroy( &li->cache.mutex );
-
+ ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
+ ldap_pvt_thread_mutex_destroy( &li->conn_mutex );
}
free( be->be_private );