From: Pierangelo Masarati Date: Sat, 9 Sep 2006 17:01:28 +0000 (+0000) Subject: ld may legitimately be NULL if another operation freed it because of a failure while... X-Git-Tag: OPENLDAP_REL_ENG_2_3_MP~174 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0e13519191e7f467ed8fa4d0bc12c8a7acd824dd;p=openldap ld may legitimately be NULL if another operation freed it because of a failure while binding --- diff --git a/servers/slapd/back-meta/search.c b/servers/slapd/back-meta/search.c index 6b39b491b5..95f3cd3fb1 100644 --- a/servers/slapd/back-meta/search.c +++ b/servers/slapd/back-meta/search.c @@ -113,6 +113,24 @@ meta_search_dobind_init( return retcode; } + if ( msc->msc_ld == NULL ) { + /* for some reason (e.g. because formerly in "binding" + * state, with eventual connection expiration or invalidation, + * it was not initialized as expected */ + rc = meta_back_init_one_conn( op, rs, *mcp, candidate, + LDAP_BACK_CONN_ISPRIV( *mcp ), LDAP_BACK_DONTSEND ); + switch ( rc ) { + case LDAP_SUCCESS: + break; + + case LDAP_SERVER_DOWN: + goto down; + + default: + goto other; + } + } + /* NOTE: this obsoletes pseudorootdn */ if ( op->o_conn != NULL && !op->o_do_not_cache && @@ -156,8 +174,6 @@ meta_search_dobind_init( } } - assert( msc->msc_ld != NULL ); - rc = ldap_sasl_bind( msc->msc_ld, binddn.bv_val, LDAP_SASL_SIMPLE, &cred, NULL, NULL, &candidates[ candidate ].sr_msgid ); switch ( rc ) { @@ -180,6 +196,7 @@ down:; } /* fall thru */ +other:; default: rs->sr_err = rc; rc = slap_map_api2result( rs );