2003-11-27 14:35:14 +08:00
|
|
|
/* $OpenLDAP$ */
|
|
|
|
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
|
*
|
2007-01-03 04:00:42 +08:00
|
|
|
* Copyright 1999-2007 The OpenLDAP Foundation.
|
2003-12-09 01:41:40 +08:00
|
|
|
* Portions Copyright 2001-2003 Pierangelo Masarati.
|
|
|
|
* Portions Copyright 1999-2003 Howard Chu.
|
2003-11-27 14:35:14 +08:00
|
|
|
* All rights reserved.
|
2001-05-12 08:51:28 +08:00
|
|
|
*
|
2003-11-27 14:35:14 +08:00
|
|
|
* 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>.
|
|
|
|
*/
|
2001-05-12 08:51:28 +08:00
|
|
|
|
|
|
|
#include "portable.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2003-04-29 23:05:19 +08:00
|
|
|
#include <ac/string.h>
|
2001-05-12 08:51:28 +08:00
|
|
|
#include <ac/socket.h>
|
|
|
|
|
|
|
|
#include "slap.h"
|
2007-07-26 01:21:05 +08:00
|
|
|
#include "config.h"
|
2001-05-12 08:51:28 +08:00
|
|
|
#include "../back-ldap/back-ldap.h"
|
|
|
|
#include "back-meta.h"
|
|
|
|
|
2004-11-10 17:45:02 +08:00
|
|
|
int
|
2004-08-19 20:10:22 +08:00
|
|
|
meta_back_open(
|
2005-04-23 05:43:52 +08:00
|
|
|
BackendInfo *bi )
|
2004-08-19 20:10:22 +08:00
|
|
|
{
|
2005-09-11 02:59:35 +08:00
|
|
|
/* FIXME: need to remove the pagedResults, and likely more... */
|
2004-10-06 13:51:38 +08:00
|
|
|
bi->bi_controls = slap_known_controls;
|
2005-09-11 02:59:35 +08:00
|
|
|
|
2004-08-19 20:10:22 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2001-05-12 08:51:28 +08:00
|
|
|
int
|
|
|
|
meta_back_initialize(
|
2005-04-23 05:43:52 +08:00
|
|
|
BackendInfo *bi )
|
2001-05-12 08:51:28 +08:00
|
|
|
{
|
2006-01-07 01:08:06 +08:00
|
|
|
bi->bi_flags =
|
|
|
|
#if 0
|
|
|
|
/* this is not (yet) set essentially because back-meta does not
|
|
|
|
* directly support extended operations... */
|
|
|
|
#ifdef LDAP_DYNAMIC_OBJECTS
|
|
|
|
/* this is set because all the support a proxy has to provide
|
|
|
|
* is the capability to forward the refresh exop, and to
|
|
|
|
* pass thru entries that contain the dynamicObject class
|
|
|
|
* and the entryTtl attribute */
|
|
|
|
SLAP_BFLAG_DYNAMIC |
|
|
|
|
#endif /* LDAP_DYNAMIC_OBJECTS */
|
|
|
|
#endif
|
|
|
|
0;
|
|
|
|
|
2004-08-19 20:10:22 +08:00
|
|
|
bi->bi_open = meta_back_open;
|
2001-05-12 08:51:28 +08:00
|
|
|
bi->bi_config = 0;
|
|
|
|
bi->bi_close = 0;
|
|
|
|
bi->bi_destroy = 0;
|
|
|
|
|
|
|
|
bi->bi_db_init = meta_back_db_init;
|
|
|
|
bi->bi_db_config = meta_back_db_config;
|
2005-05-05 07:57:55 +08:00
|
|
|
bi->bi_db_open = meta_back_db_open;
|
2001-05-12 08:51:28 +08:00
|
|
|
bi->bi_db_close = 0;
|
|
|
|
bi->bi_db_destroy = meta_back_db_destroy;
|
|
|
|
|
|
|
|
bi->bi_op_bind = meta_back_bind;
|
|
|
|
bi->bi_op_unbind = 0;
|
|
|
|
bi->bi_op_search = meta_back_search;
|
|
|
|
bi->bi_op_compare = meta_back_compare;
|
|
|
|
bi->bi_op_modify = meta_back_modify;
|
|
|
|
bi->bi_op_modrdn = meta_back_modrdn;
|
|
|
|
bi->bi_op_add = meta_back_add;
|
|
|
|
bi->bi_op_delete = meta_back_delete;
|
|
|
|
bi->bi_op_abandon = 0;
|
|
|
|
|
|
|
|
bi->bi_extended = 0;
|
|
|
|
|
|
|
|
bi->bi_chk_referrals = 0;
|
|
|
|
|
|
|
|
bi->bi_connection_init = 0;
|
|
|
|
bi->bi_connection_destroy = meta_back_conn_destroy;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
meta_back_db_init(
|
2007-07-26 01:21:05 +08:00
|
|
|
Backend *be,
|
2007-08-03 20:02:07 +08:00
|
|
|
ConfigReply *cr)
|
2001-05-12 08:51:28 +08:00
|
|
|
{
|
2005-04-23 05:43:52 +08:00
|
|
|
metainfo_t *mi;
|
2006-12-25 02:23:36 +08:00
|
|
|
int i;
|
2001-05-12 08:51:28 +08:00
|
|
|
|
2005-11-19 23:00:50 +08:00
|
|
|
mi = ch_calloc( 1, sizeof( metainfo_t ) );
|
2005-04-23 05:43:52 +08:00
|
|
|
if ( mi == NULL ) {
|
2001-05-12 08:51:28 +08:00
|
|
|
return -1;
|
|
|
|
}
|
2003-12-06 19:12:53 +08:00
|
|
|
|
2001-05-12 08:51:28 +08:00
|
|
|
/*
|
|
|
|
* At present the default is no default target;
|
|
|
|
* this may change
|
|
|
|
*/
|
2005-04-23 05:43:52 +08:00
|
|
|
mi->mi_defaulttarget = META_DEFAULT_TARGET_NONE;
|
2005-12-12 23:57:58 +08:00
|
|
|
mi->mi_bind_timeout.tv_sec = 0;
|
|
|
|
mi->mi_bind_timeout.tv_usec = META_BIND_TIMEOUT;
|
2001-05-12 08:51:28 +08:00
|
|
|
|
2006-05-07 00:15:25 +08:00
|
|
|
mi->mi_rebind_f = meta_back_default_rebind;
|
|
|
|
mi->mi_urllist_f = meta_back_default_urllist;
|
|
|
|
|
2005-11-19 23:00:50 +08:00
|
|
|
ldap_pvt_thread_mutex_init( &mi->mi_conninfo.lai_mutex );
|
2005-04-23 05:43:52 +08:00
|
|
|
ldap_pvt_thread_mutex_init( &mi->mi_cache.mutex );
|
2005-04-27 04:10:15 +08:00
|
|
|
|
|
|
|
/* safe default */
|
|
|
|
mi->mi_nretries = META_RETRY_DEFAULT;
|
2005-05-05 07:57:55 +08:00
|
|
|
mi->mi_version = LDAP_VERSION3;
|
2006-12-25 02:23:36 +08:00
|
|
|
|
|
|
|
for ( i = LDAP_BACK_PCONN_FIRST; i < LDAP_BACK_PCONN_LAST; i++ ) {
|
|
|
|
mi->mi_conn_priv[ i ].mic_num = 0;
|
|
|
|
LDAP_TAILQ_INIT( &mi->mi_conn_priv[ i ].mic_priv );
|
|
|
|
}
|
|
|
|
mi->mi_conn_priv_max = LDAP_BACK_CONN_PRIV_DEFAULT;
|
2005-04-27 04:10:15 +08:00
|
|
|
|
2005-04-23 05:43:52 +08:00
|
|
|
be->be_private = mi;
|
2001-05-12 08:51:28 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-05-05 07:57:55 +08:00
|
|
|
int
|
|
|
|
meta_back_db_open(
|
2007-07-26 01:21:05 +08:00
|
|
|
Backend *be,
|
2007-08-03 20:02:07 +08:00
|
|
|
ConfigReply *cr )
|
2005-05-05 07:57:55 +08:00
|
|
|
{
|
|
|
|
metainfo_t *mi = (metainfo_t *)be->be_private;
|
|
|
|
|
2006-12-18 07:52:23 +08:00
|
|
|
int i,
|
|
|
|
not_always = 0,
|
2007-01-13 19:51:28 +08:00
|
|
|
not_always_anon_proxyauthz = 0,
|
|
|
|
not_always_anon_non_prescriptive = 0,
|
2006-12-18 07:52:23 +08:00
|
|
|
rc;
|
2005-05-05 07:57:55 +08:00
|
|
|
|
2007-01-27 07:03:46 +08:00
|
|
|
if ( mi->mi_ntargets == 0 ) {
|
|
|
|
Debug( LDAP_DEBUG_ANY,
|
|
|
|
"meta_back_db_open: no targets defined\n",
|
|
|
|
0, 0, 0 );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2005-05-05 07:57:55 +08:00
|
|
|
for ( i = 0; i < mi->mi_ntargets; i++ ) {
|
2007-01-04 05:34:49 +08:00
|
|
|
slap_bindconf sb = { BER_BVNULL };
|
2006-05-07 00:15:25 +08:00
|
|
|
metatarget_t *mt = mi->mi_targets[ i ];
|
|
|
|
|
2006-09-11 08:52:43 +08:00
|
|
|
ber_str2bv( mt->mt_uri, 0, 0, &sb.sb_uri );
|
|
|
|
sb.sb_version = mt->mt_version;
|
|
|
|
sb.sb_method = LDAP_AUTH_SIMPLE;
|
|
|
|
BER_BVSTR( &sb.sb_binddn, "" );
|
|
|
|
|
2006-05-20 22:29:01 +08:00
|
|
|
if ( META_BACK_TGT_T_F_DISCOVER( mt ) ) {
|
2006-09-11 08:52:43 +08:00
|
|
|
rc = slap_discover_feature( &sb,
|
2005-05-05 08:22:43 +08:00
|
|
|
slap_schema.si_ad_supportedFeatures->ad_cname.bv_val,
|
|
|
|
LDAP_FEATURE_ABSOLUTE_FILTERS );
|
2005-05-05 07:57:55 +08:00
|
|
|
if ( rc == LDAP_COMPARE_TRUE ) {
|
2006-05-20 22:29:01 +08:00
|
|
|
mt->mt_flags |= LDAP_BACK_F_T_F;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( META_BACK_TGT_CANCEL_DISCOVER( mt ) ) {
|
2006-09-11 08:52:43 +08:00
|
|
|
rc = slap_discover_feature( &sb,
|
2006-05-20 22:29:01 +08:00
|
|
|
slap_schema.si_ad_supportedExtension->ad_cname.bv_val,
|
|
|
|
LDAP_EXOP_CANCEL );
|
|
|
|
if ( rc == LDAP_COMPARE_TRUE ) {
|
|
|
|
mt->mt_flags |= LDAP_BACK_F_CANCEL_EXOP;
|
2005-05-05 07:57:55 +08:00
|
|
|
}
|
|
|
|
}
|
2006-12-18 07:52:23 +08:00
|
|
|
|
|
|
|
if ( not_always == 0 ) {
|
|
|
|
if ( !( mt->mt_idassert_flags & LDAP_BACK_AUTH_OVERRIDE )
|
2007-01-13 19:51:28 +08:00
|
|
|
|| mt->mt_idassert_authz != NULL )
|
2006-12-18 07:52:23 +08:00
|
|
|
{
|
|
|
|
not_always = 1;
|
|
|
|
}
|
|
|
|
}
|
2007-01-13 19:51:28 +08:00
|
|
|
|
|
|
|
if ( ( mt->mt_idassert_flags & LDAP_BACK_AUTH_AUTHZ_ALL )
|
|
|
|
&& !( mt->mt_idassert_flags & LDAP_BACK_AUTH_PRESCRIPTIVE ) )
|
|
|
|
{
|
|
|
|
Debug( LDAP_DEBUG_ANY, "meta_back_db_open(%s): "
|
|
|
|
"target #%d inconsistent idassert configuration "
|
|
|
|
"(likely authz=\"*\" used with \"non-prescriptive\" flag)\n",
|
|
|
|
be->be_suffix[ 0 ].bv_val, i, 0 );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( not_always_anon_proxyauthz == 0 ) {
|
|
|
|
if ( !( mt->mt_idassert_flags & LDAP_BACK_AUTH_AUTHZ_ALL ) )
|
|
|
|
{
|
|
|
|
not_always_anon_proxyauthz = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( not_always_anon_non_prescriptive == 0 ) {
|
|
|
|
if ( ( mt->mt_idassert_flags & LDAP_BACK_AUTH_PRESCRIPTIVE ) )
|
|
|
|
{
|
|
|
|
not_always_anon_non_prescriptive = 1;
|
|
|
|
}
|
|
|
|
}
|
2006-12-18 07:52:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( not_always == 0 ) {
|
|
|
|
mi->mi_flags |= META_BACK_F_PROXYAUTHZ_ALWAYS;
|
2005-05-05 07:57:55 +08:00
|
|
|
}
|
|
|
|
|
2007-01-13 19:51:28 +08:00
|
|
|
if ( not_always_anon_proxyauthz == 0 ) {
|
|
|
|
mi->mi_flags |= META_BACK_F_PROXYAUTHZ_ANON;
|
|
|
|
|
|
|
|
} else if ( not_always_anon_non_prescriptive == 0 ) {
|
|
|
|
mi->mi_flags |= META_BACK_F_PROXYAUTHZ_NOANON;
|
|
|
|
}
|
|
|
|
|
2005-05-05 07:57:55 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-06-10 23:30:24 +08:00
|
|
|
/*
|
|
|
|
* meta_back_conn_free()
|
|
|
|
*
|
|
|
|
* actually frees a connection; the reference count must be 0,
|
|
|
|
* and it must not (or no longer) be in the cache.
|
|
|
|
*/
|
2005-10-02 02:07:00 +08:00
|
|
|
void
|
|
|
|
meta_back_conn_free(
|
2005-04-23 05:43:52 +08:00
|
|
|
void *v_mc )
|
2001-05-12 08:51:28 +08:00
|
|
|
{
|
2005-04-23 05:43:52 +08:00
|
|
|
metaconn_t *mc = v_mc;
|
2006-06-10 23:30:24 +08:00
|
|
|
int ntargets;
|
2001-05-12 08:51:28 +08:00
|
|
|
|
2005-10-02 02:07:00 +08:00
|
|
|
assert( mc != NULL );
|
|
|
|
assert( mc->mc_refcnt == 0 );
|
|
|
|
|
2005-05-06 01:34:11 +08:00
|
|
|
/* at least one must be present... */
|
2006-10-29 00:20:59 +08:00
|
|
|
ntargets = mc->mc_info->mi_ntargets;
|
2006-06-10 23:30:24 +08:00
|
|
|
assert( ntargets > 0 );
|
|
|
|
|
|
|
|
for ( ; ntargets--; ) {
|
2006-10-29 00:20:59 +08:00
|
|
|
(void)meta_clear_one_candidate( NULL, mc, ntargets );
|
2006-06-10 23:30:24 +08:00
|
|
|
}
|
2005-05-06 01:34:11 +08:00
|
|
|
|
2006-06-10 23:30:24 +08:00
|
|
|
if ( !BER_BVISNULL( &mc->mc_local_ndn ) ) {
|
|
|
|
free( mc->mc_local_ndn.bv_val );
|
2001-05-12 08:51:28 +08:00
|
|
|
}
|
2005-04-21 02:52:10 +08:00
|
|
|
|
2005-04-23 05:43:52 +08:00
|
|
|
free( mc );
|
2001-05-12 08:51:28 +08:00
|
|
|
}
|
|
|
|
|
2004-11-10 17:56:55 +08:00
|
|
|
static void
|
2005-04-23 05:43:52 +08:00
|
|
|
mapping_free(
|
|
|
|
void *v_mapping )
|
2004-11-10 17:56:55 +08:00
|
|
|
{
|
|
|
|
struct ldapmapping *mapping = v_mapping;
|
|
|
|
ch_free( mapping->src.bv_val );
|
|
|
|
ch_free( mapping->dst.bv_val );
|
|
|
|
ch_free( mapping );
|
|
|
|
}
|
|
|
|
|
2005-11-03 23:20:33 +08:00
|
|
|
static void
|
|
|
|
mapping_dst_free(
|
|
|
|
void *v_mapping )
|
|
|
|
{
|
|
|
|
struct ldapmapping *mapping = v_mapping;
|
|
|
|
|
|
|
|
if ( BER_BVISEMPTY( &mapping->dst ) ) {
|
|
|
|
mapping_free( &mapping[ -1 ] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-05-12 08:51:28 +08:00
|
|
|
static void
|
|
|
|
target_free(
|
2005-04-23 05:43:52 +08:00
|
|
|
metatarget_t *mt )
|
2001-05-12 08:51:28 +08:00
|
|
|
{
|
2005-04-23 05:43:52 +08:00
|
|
|
if ( mt->mt_uri ) {
|
|
|
|
free( mt->mt_uri );
|
2006-05-07 00:15:25 +08:00
|
|
|
ldap_pvt_thread_mutex_destroy( &mt->mt_uri_mutex );
|
2001-05-12 08:51:28 +08:00
|
|
|
}
|
2006-03-02 08:35:12 +08:00
|
|
|
if ( mt->mt_subtree_exclude ) {
|
|
|
|
ber_bvarray_free( mt->mt_subtree_exclude );
|
|
|
|
}
|
2005-04-23 05:43:52 +08:00
|
|
|
if ( !BER_BVISNULL( &mt->mt_psuffix ) ) {
|
|
|
|
free( mt->mt_psuffix.bv_val );
|
2001-12-27 20:17:54 +08:00
|
|
|
}
|
2005-04-23 05:43:52 +08:00
|
|
|
if ( !BER_BVISNULL( &mt->mt_nsuffix ) ) {
|
|
|
|
free( mt->mt_nsuffix.bv_val );
|
2001-12-27 20:17:54 +08:00
|
|
|
}
|
2005-04-23 05:43:52 +08:00
|
|
|
if ( !BER_BVISNULL( &mt->mt_binddn ) ) {
|
|
|
|
free( mt->mt_binddn.bv_val );
|
2001-05-12 08:51:28 +08:00
|
|
|
}
|
2005-04-23 05:43:52 +08:00
|
|
|
if ( !BER_BVISNULL( &mt->mt_bindpw ) ) {
|
|
|
|
free( mt->mt_bindpw.bv_val );
|
2001-12-27 20:17:54 +08:00
|
|
|
}
|
2006-06-16 07:12:38 +08:00
|
|
|
if ( !BER_BVISNULL( &mt->mt_idassert_authcID ) ) {
|
|
|
|
ch_free( mt->mt_idassert_authcID.bv_val );
|
2001-12-27 20:17:54 +08:00
|
|
|
}
|
2006-06-16 07:12:38 +08:00
|
|
|
if ( !BER_BVISNULL( &mt->mt_idassert_authcDN ) ) {
|
|
|
|
ch_free( mt->mt_idassert_authcDN.bv_val );
|
|
|
|
}
|
|
|
|
if ( !BER_BVISNULL( &mt->mt_idassert_passwd ) ) {
|
|
|
|
ch_free( mt->mt_idassert_passwd.bv_val );
|
|
|
|
}
|
|
|
|
if ( !BER_BVISNULL( &mt->mt_idassert_authzID ) ) {
|
|
|
|
ch_free( mt->mt_idassert_authzID.bv_val );
|
|
|
|
}
|
|
|
|
if ( !BER_BVISNULL( &mt->mt_idassert_sasl_mech ) ) {
|
|
|
|
ch_free( mt->mt_idassert_sasl_mech.bv_val );
|
|
|
|
}
|
|
|
|
if ( !BER_BVISNULL( &mt->mt_idassert_sasl_realm ) ) {
|
|
|
|
ch_free( mt->mt_idassert_sasl_realm.bv_val );
|
|
|
|
}
|
|
|
|
if ( mt->mt_idassert_authz != NULL ) {
|
|
|
|
ber_bvarray_free( mt->mt_idassert_authz );
|
2001-05-12 08:51:28 +08:00
|
|
|
}
|
2005-04-23 05:43:52 +08:00
|
|
|
if ( mt->mt_rwmap.rwm_rw ) {
|
|
|
|
rewrite_info_delete( &mt->mt_rwmap.rwm_rw );
|
2001-05-12 08:51:28 +08:00
|
|
|
}
|
2005-11-03 23:20:33 +08:00
|
|
|
avl_free( mt->mt_rwmap.rwm_oc.remap, mapping_dst_free );
|
2005-04-23 05:43:52 +08:00
|
|
|
avl_free( mt->mt_rwmap.rwm_oc.map, mapping_free );
|
2005-11-03 23:20:33 +08:00
|
|
|
avl_free( mt->mt_rwmap.rwm_at.remap, mapping_dst_free );
|
2005-04-23 05:43:52 +08:00
|
|
|
avl_free( mt->mt_rwmap.rwm_at.map, mapping_free );
|
2006-05-07 00:15:25 +08:00
|
|
|
|
|
|
|
free( mt );
|
2001-05-12 08:51:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
meta_back_db_destroy(
|
2007-07-26 01:21:05 +08:00
|
|
|
Backend *be,
|
2007-08-03 20:02:07 +08:00
|
|
|
ConfigReply *cr )
|
2001-05-12 08:51:28 +08:00
|
|
|
{
|
2005-04-23 05:43:52 +08:00
|
|
|
metainfo_t *mi;
|
2001-05-12 08:51:28 +08:00
|
|
|
|
|
|
|
if ( be->be_private ) {
|
|
|
|
int i;
|
|
|
|
|
2005-04-23 05:43:52 +08:00
|
|
|
mi = ( metainfo_t * )be->be_private;
|
2001-05-12 08:51:28 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Destroy the connection tree
|
|
|
|
*/
|
2005-11-19 23:00:50 +08:00
|
|
|
ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex );
|
2001-05-12 08:51:28 +08:00
|
|
|
|
2005-11-19 23:00:50 +08:00
|
|
|
if ( mi->mi_conninfo.lai_tree ) {
|
|
|
|
avl_free( mi->mi_conninfo.lai_tree, meta_back_conn_free );
|
2001-05-12 08:51:28 +08:00
|
|
|
}
|
2006-12-25 02:23:36 +08:00
|
|
|
for ( i = LDAP_BACK_PCONN_FIRST; i < LDAP_BACK_PCONN_LAST; i++ ) {
|
|
|
|
while ( !LDAP_TAILQ_EMPTY( &mi->mi_conn_priv[ i ].mic_priv ) ) {
|
|
|
|
metaconn_t *mc = LDAP_TAILQ_FIRST( &mi->mi_conn_priv[ i ].mic_priv );
|
|
|
|
|
|
|
|
LDAP_TAILQ_REMOVE( &mi->mi_conn_priv[ i ].mic_priv, mc, mc_q );
|
|
|
|
meta_back_conn_free( mc );
|
|
|
|
}
|
|
|
|
}
|
2001-05-12 08:51:28 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Destroy the per-target stuff (assuming there's at
|
|
|
|
* least one ...)
|
|
|
|
*/
|
2005-11-02 00:36:17 +08:00
|
|
|
if ( mi->mi_targets != NULL ) {
|
|
|
|
for ( i = 0; i < mi->mi_ntargets; i++ ) {
|
2006-06-08 07:25:38 +08:00
|
|
|
metatarget_t *mt = mi->mi_targets[ i ];
|
|
|
|
|
|
|
|
if ( META_BACK_TGT_QUARANTINE( mt ) ) {
|
|
|
|
if ( mt->mt_quarantine.ri_num != mi->mi_quarantine.ri_num )
|
|
|
|
{
|
|
|
|
slap_retry_info_destroy( &mt->mt_quarantine );
|
|
|
|
}
|
|
|
|
|
|
|
|
ldap_pvt_thread_mutex_destroy( &mt->mt_quarantine_mutex );
|
2006-05-28 03:54:27 +08:00
|
|
|
}
|
|
|
|
|
2006-06-08 07:25:38 +08:00
|
|
|
target_free( mt );
|
2005-11-02 00:36:17 +08:00
|
|
|
}
|
2001-05-12 08:51:28 +08:00
|
|
|
|
2005-11-02 00:36:17 +08:00
|
|
|
free( mi->mi_targets );
|
|
|
|
}
|
2001-05-12 08:51:28 +08:00
|
|
|
|
2005-04-23 05:43:52 +08:00
|
|
|
ldap_pvt_thread_mutex_lock( &mi->mi_cache.mutex );
|
|
|
|
if ( mi->mi_cache.tree ) {
|
|
|
|
avl_free( mi->mi_cache.tree, meta_dncache_free );
|
2001-05-12 08:51:28 +08:00
|
|
|
}
|
|
|
|
|
2005-04-23 05:43:52 +08:00
|
|
|
ldap_pvt_thread_mutex_unlock( &mi->mi_cache.mutex );
|
|
|
|
ldap_pvt_thread_mutex_destroy( &mi->mi_cache.mutex );
|
2001-05-12 08:51:28 +08:00
|
|
|
|
2005-11-19 23:00:50 +08:00
|
|
|
ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex );
|
|
|
|
ldap_pvt_thread_mutex_destroy( &mi->mi_conninfo.lai_mutex );
|
2005-04-16 10:25:41 +08:00
|
|
|
|
2005-04-23 05:43:52 +08:00
|
|
|
if ( mi->mi_candidates != NULL ) {
|
|
|
|
ber_memfree_x( mi->mi_candidates, NULL );
|
2005-04-16 10:25:41 +08:00
|
|
|
}
|
2006-05-28 03:54:27 +08:00
|
|
|
|
|
|
|
if ( META_BACK_QUARANTINE( mi ) ) {
|
|
|
|
slap_retry_info_destroy( &mi->mi_quarantine );
|
|
|
|
}
|
2001-05-12 08:51:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
free( be->be_private );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-11-14 02:52:44 +08:00
|
|
|
#if SLAPD_META == SLAPD_MOD_DYNAMIC
|
|
|
|
|
2004-11-16 03:45:49 +08:00
|
|
|
/* conditionally define the init_module() function */
|
|
|
|
SLAP_BACKEND_INIT_MODULE( meta )
|
2004-11-14 02:52:44 +08:00
|
|
|
|
2004-11-16 03:45:49 +08:00
|
|
|
#endif /* SLAPD_META == SLAPD_MOD_DYNAMIC */
|
2004-11-14 02:52:44 +08:00
|
|
|
|
|
|
|
|