diff options
Diffstat (limited to 'servers/slapd/back-asyncmeta')
-rw-r--r-- | servers/slapd/back-asyncmeta/Makefile.in | 2 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/add.c | 2 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/back-asyncmeta.h | 5 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/bind.c | 2 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/candidates.c | 2 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/compare.c | 2 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/config.c | 103 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/conn.c | 2 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/delete.c | 2 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/dncache.c | 2 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/init.c | 6 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/map.c | 2 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/message_queue.c | 2 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/meta_result.c | 2 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/modify.c | 2 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/modrdn.c | 2 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/proto-asyncmeta.h | 2 | ||||
-rw-r--r-- | servers/slapd/back-asyncmeta/search.c | 2 |
18 files changed, 80 insertions, 64 deletions
diff --git a/servers/slapd/back-asyncmeta/Makefile.in b/servers/slapd/back-asyncmeta/Makefile.in index c609458..6a375e7 100644 --- a/servers/slapd/back-asyncmeta/Makefile.in +++ b/servers/slapd/back-asyncmeta/Makefile.in @@ -2,7 +2,7 @@ ## $OpenLDAP$ ## This work is part of OpenLDAP Software <http://www.openldap.org/>. ## -## Copyright 2016-2022 The OpenLDAP Foundation. +## Copyright 2016-2024 The OpenLDAP Foundation. ## Portions Copyright 2016 Symas Corporation. ## All rights reserved. ## diff --git a/servers/slapd/back-asyncmeta/add.c b/servers/slapd/back-asyncmeta/add.c index 55277ee..a90322c 100644 --- a/servers/slapd/back-asyncmeta/add.c +++ b/servers/slapd/back-asyncmeta/add.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * diff --git a/servers/slapd/back-asyncmeta/back-asyncmeta.h b/servers/slapd/back-asyncmeta/back-asyncmeta.h index a5ae6cd..038d2fa 100644 --- a/servers/slapd/back-asyncmeta/back-asyncmeta.h +++ b/servers/slapd/back-asyncmeta/back-asyncmeta.h @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * @@ -777,6 +777,9 @@ asyncmeta_db_has_pending_ops(a_metainfo_t *mi); int asyncmeta_db_has_mscs(a_metainfo_t *mi); +void +asyncmeta_target_free(a_metatarget_t *mt); + /* The the maximum time in seconds after a result has been received on a connection, * after which it can be reset if a sender error occurs. Should this be configurable? */ #define META_BACK_RESULT_INTERVAL (2) diff --git a/servers/slapd/back-asyncmeta/bind.c b/servers/slapd/back-asyncmeta/bind.c index 78c0e57..f0dc2a6 100644 --- a/servers/slapd/back-asyncmeta/bind.c +++ b/servers/slapd/back-asyncmeta/bind.c @@ -3,7 +3,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * diff --git a/servers/slapd/back-asyncmeta/candidates.c b/servers/slapd/back-asyncmeta/candidates.c index 5f3b228..9e22dc8 100644 --- a/servers/slapd/back-asyncmeta/candidates.c +++ b/servers/slapd/back-asyncmeta/candidates.c @@ -3,7 +3,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * diff --git a/servers/slapd/back-asyncmeta/compare.c b/servers/slapd/back-asyncmeta/compare.c index 8f56719..f649433 100644 --- a/servers/slapd/back-asyncmeta/compare.c +++ b/servers/slapd/back-asyncmeta/compare.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * diff --git a/servers/slapd/back-asyncmeta/config.c b/servers/slapd/back-asyncmeta/config.c index e4cc5ea..9271ba8 100644 --- a/servers/slapd/back-asyncmeta/config.c +++ b/servers/slapd/back-asyncmeta/config.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * @@ -496,18 +496,14 @@ asyncmeta_cfadd( Operation *op, SlapReply *rs, Entry *p, ConfigArgs *c ) static int asyncmeta_back_new_target( - a_metatarget_t **mtp, - a_metainfo_t *mi ) + a_metatarget_t *mt, + a_metainfo_t *mi, + BackendDB *db ) { - a_metatarget_t *mt; - - *mtp = NULL; int i; assert ( mi != NULL ); - mt = ch_calloc( sizeof( a_metatarget_t ), 1 ); - - ldap_pvt_thread_mutex_init( &mt->mt_uri_mutex ); + assert ( mt != NULL ); mt->mt_idassert_mode = LDAP_BACK_IDASSERT_LEGACY; mt->mt_idassert_authmethod = LDAP_AUTH_NONE; @@ -515,8 +511,9 @@ asyncmeta_back_new_target( /* by default, use proxyAuthz control on each operation */ mt->mt_idassert_flags = LDAP_BACK_AUTH_PRESCRIPTIVE; - *mtp = mt; - + if ( !SLAP_DBOPEN(db) || !(slapMode & SLAP_SERVER_MODE)) { + return 0; + } for ( i = 0; i < mi->mi_num_conns; i++ ) { a_metaconn_t *mc = &mi->mi_conns[i]; mc->mc_conns = ch_realloc( mc->mc_conns, sizeof( a_metasingleconn_t ) * mi->mi_ntargets); @@ -1884,7 +1881,6 @@ asyncmeta_back_cf_gen( ConfigArgs *c ) LDAPURLDesc *ludp; struct berval dn; int j; - char **uris = NULL; if ( c->be->be_nsuffix == NULL ) { @@ -1894,39 +1890,6 @@ asyncmeta_back_cf_gen( ConfigArgs *c ) return 1; } - i = mi->mi_ntargets++; - - mi->mi_targets = ( a_metatarget_t ** )ch_realloc( mi->mi_targets, - sizeof( a_metatarget_t * ) * mi->mi_ntargets ); - if ( mi->mi_targets == NULL ) { - snprintf( c->cr_msg, sizeof( c->cr_msg ), - "out of memory while storing server name" - " in \"%s <protocol>://<server>[:port]/<naming context>\"", - c->argv[0] ); - Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg ); - return 1; - } - - if ( asyncmeta_back_new_target( &mi->mi_targets[ i ], mi ) != 0 ) { - snprintf( c->cr_msg, sizeof( c->cr_msg ), - "unable to init server" - " in \"%s <protocol>://<server>[:port]/<naming context>\"", - c->argv[0] ); - Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg ); - return 1; - } - - mt = mi->mi_targets[ i ]; - - mt->mt_rebind_f = mi->mi_rebind_f; - mt->mt_urllist_f = mi->mi_urllist_f; - mt->mt_urllist_p = mt; - - if ( META_BACK_QUARANTINE( mi ) ) { - ldap_pvt_thread_mutex_init( &mt->mt_quarantine_mutex ); - } - mt->mt_mc = mi->mi_mc; - for ( j = 1; j < c->argc; j++ ) { char **tmpuris = ldap_str2charray( c->argv[ j ], "\t" ); @@ -1948,6 +1911,8 @@ asyncmeta_back_cf_gen( ConfigArgs *c ) } } + mt = ch_calloc( sizeof( a_metatarget_t ), 1 ); + for ( j = 0; uris[ j ] != NULL; j++ ) { char *tmpuri = NULL; @@ -1964,6 +1929,7 @@ asyncmeta_back_cf_gen( ConfigArgs *c ) j-1, c->argv[0] ); Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg ); ldap_charray_free( uris ); + asyncmeta_target_free( mt ); return 1; } @@ -1980,6 +1946,7 @@ asyncmeta_back_cf_gen( ConfigArgs *c ) Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg ); ldap_free_urllist( ludp ); ldap_charray_free( uris ); + asyncmeta_target_free( mt ); return 1; } @@ -1996,6 +1963,7 @@ asyncmeta_back_cf_gen( ConfigArgs *c ) Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg ); ldap_free_urllist( ludp ); ldap_charray_free( uris ); + asyncmeta_target_free( mt ); return( 1 ); } @@ -2018,6 +1986,7 @@ asyncmeta_back_cf_gen( ConfigArgs *c ) Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg ); ldap_free_urllist( ludp ); ldap_charray_free( uris ); + asyncmeta_target_free( mt ); return( 1 ); } @@ -2029,6 +1998,7 @@ asyncmeta_back_cf_gen( ConfigArgs *c ) Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg ); ldap_free_urllist( ludp ); ldap_charray_free( uris ); + asyncmeta_target_free( mt ); return( 1 ); } @@ -2040,6 +2010,7 @@ asyncmeta_back_cf_gen( ConfigArgs *c ) snprintf( c->cr_msg, sizeof( c->cr_msg ), "no memory?" ); Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg ); ldap_charray_free( uris ); + asyncmeta_target_free( mt ); return( 1 ); } ldap_memfree( uris[ j ] ); @@ -2051,7 +2022,10 @@ asyncmeta_back_cf_gen( ConfigArgs *c ) if ( mt->mt_uri == NULL) { snprintf( c->cr_msg, sizeof( c->cr_msg ), "no memory?" ); Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg ); + asyncmeta_target_free( mt ); return( 1 ); + } else { + ldap_pvt_thread_mutex_init( &mt->mt_uri_mutex ); } /* @@ -2067,8 +2041,47 @@ asyncmeta_back_cf_gen( ConfigArgs *c ) snprintf( c->cr_msg, sizeof( c->cr_msg ), "<naming context> of URI must be within the naming context of this database." ); Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg ); + asyncmeta_target_free( mt ); + return 1; + } + + i = mi->mi_ntargets++; + + mi->mi_targets = ( a_metatarget_t ** )ch_realloc( mi->mi_targets, + sizeof( a_metatarget_t * ) * mi->mi_ntargets ); + if ( mi->mi_targets == NULL ) { + snprintf( c->cr_msg, sizeof( c->cr_msg ), + "out of memory while storing server name" + " in \"%s <protocol>://<server>[:port]/<naming context>\"", + c->argv[0] ); + Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg ); + asyncmeta_target_free( mt ); return 1; } + + mi->mi_targets[ i ] = mt; + if ( asyncmeta_back_new_target( mt, mi, c->be ) != 0 ) { + /* does not currently happen, asyncmeta back_new_target always returns 0 */ + snprintf( c->cr_msg, sizeof( c->cr_msg ), + "unable to init server" + " in \"%s <protocol>://<server>[:port]/<naming context>\"", + c->argv[0] ); + Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg ); + asyncmeta_target_free( mt ); + mi->mi_ntargets--; + return 1; + } + + + mt->mt_rebind_f = mi->mi_rebind_f; + mt->mt_urllist_f = mi->mi_urllist_f; + mt->mt_urllist_p = mt; + + if ( META_BACK_QUARANTINE( mi ) ) { + ldap_pvt_thread_mutex_init( &mt->mt_quarantine_mutex ); + } + mt->mt_mc = mi->mi_mc; + c->ca_private = mt; config_push_cleanup( c, asyncmeta_cf_cleanup ); } break; diff --git a/servers/slapd/back-asyncmeta/conn.c b/servers/slapd/back-asyncmeta/conn.c index 19c100e..fd04d70 100644 --- a/servers/slapd/back-asyncmeta/conn.c +++ b/servers/slapd/back-asyncmeta/conn.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * diff --git a/servers/slapd/back-asyncmeta/delete.c b/servers/slapd/back-asyncmeta/delete.c index b85d463..63bd39c 100644 --- a/servers/slapd/back-asyncmeta/delete.c +++ b/servers/slapd/back-asyncmeta/delete.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * diff --git a/servers/slapd/back-asyncmeta/dncache.c b/servers/slapd/back-asyncmeta/dncache.c index a588290..89f615a 100644 --- a/servers/slapd/back-asyncmeta/dncache.c +++ b/servers/slapd/back-asyncmeta/dncache.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * diff --git a/servers/slapd/back-asyncmeta/init.c b/servers/slapd/back-asyncmeta/init.c index 2b43958..def4494 100644 --- a/servers/slapd/back-asyncmeta/init.c +++ b/servers/slapd/back-asyncmeta/init.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * @@ -275,7 +275,7 @@ asyncmeta_back_db_open( ber_dupbv ( &mi->mi_suffix, &be->be_suffix[0] ); - if ( mi->mi_ntargets > 0 ) { + if ( ( slapMode & SLAP_SERVER_MODE ) && mi->mi_ntargets > 0 ) { ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex ); mi->mi_task = ldap_pvt_runqueue_insert( &slapd_rq, 1, asyncmeta_timeout_loop, mi, "asyncmeta_timeout_loop", mi->mi_suffix.bv_val ); @@ -325,7 +325,7 @@ asyncmeta_back_clear_miconns( a_metainfo_t *mi ) free(mi->mi_conns); } -static void +void asyncmeta_target_free( a_metatarget_t *mt ) { diff --git a/servers/slapd/back-asyncmeta/map.c b/servers/slapd/back-asyncmeta/map.c index 66bb8b0..2de4915 100644 --- a/servers/slapd/back-asyncmeta/map.c +++ b/servers/slapd/back-asyncmeta/map.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * diff --git a/servers/slapd/back-asyncmeta/message_queue.c b/servers/slapd/back-asyncmeta/message_queue.c index 29087c5..3eb704c 100644 --- a/servers/slapd/back-asyncmeta/message_queue.c +++ b/servers/slapd/back-asyncmeta/message_queue.c @@ -3,7 +3,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * diff --git a/servers/slapd/back-asyncmeta/meta_result.c b/servers/slapd/back-asyncmeta/meta_result.c index 0ce279a..80a02c8 100644 --- a/servers/slapd/back-asyncmeta/meta_result.c +++ b/servers/slapd/back-asyncmeta/meta_result.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * diff --git a/servers/slapd/back-asyncmeta/modify.c b/servers/slapd/back-asyncmeta/modify.c index 14105ae..bfa9a6a 100644 --- a/servers/slapd/back-asyncmeta/modify.c +++ b/servers/slapd/back-asyncmeta/modify.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * diff --git a/servers/slapd/back-asyncmeta/modrdn.c b/servers/slapd/back-asyncmeta/modrdn.c index 6793686..3bbcf78 100644 --- a/servers/slapd/back-asyncmeta/modrdn.c +++ b/servers/slapd/back-asyncmeta/modrdn.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * diff --git a/servers/slapd/back-asyncmeta/proto-asyncmeta.h b/servers/slapd/back-asyncmeta/proto-asyncmeta.h index 54041fa..d57855a 100644 --- a/servers/slapd/back-asyncmeta/proto-asyncmeta.h +++ b/servers/slapd/back-asyncmeta/proto-asyncmeta.h @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * diff --git a/servers/slapd/back-asyncmeta/search.c b/servers/slapd/back-asyncmeta/search.c index ab32c48..bf91056 100644 --- a/servers/slapd/back-asyncmeta/search.c +++ b/servers/slapd/back-asyncmeta/search.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2016-2022 The OpenLDAP Foundation. + * Copyright 2016-2024 The OpenLDAP Foundation. * Portions Copyright 2016 Symas Corporation. * All rights reserved. * |