[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
assertion in servers/slapd/bind.c, development tree
Hi,
a question for you about an assertion in server/slapd/bind.c,
In server/slapd/sasl.c, the sasl_bind function makes following calls when the
session wraps up when either it concluded successfully or when it can not go
anymore. (in my case, I did not setup my server environment properly)
>
> if ( sc != SASL_CONTINUE && conn->c_sasl_bind_context != NULL ) {
> sasl_dispose( &conn->c_sasl_bind_context );
> conn->c_sasl_bind_context = NULL;
> }
>
where the binding context is disposed and the conn->c_sasl_bind_context is set to NULL.
and in server/slapd/bind.c, after do_bind calls sasl_bind, it checks for
the state of thing like this,
> edn = NULL;
> rc = sasl_bind( conn, op, dn, ndn, mech, &cred, &edn );
>
> if( rc == LDAP_SUCCESS ) {
> ldap_pvt_thread_mutex_lock( &conn->c_mutex );
>#ifdef HAVE_CYRUS_SASL
> assert( conn->c_sasl_bind_context == NULL );
>#endif
> conn->c_dn = edn;
> if(dn!=NULL) {
> conn->c_cdn = ch_malloc( sizeof( "dn" ) );
> strcpy( conn->c_cdn, dn );
> }
> ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
>
> } else if ( rc == LDAP_SASL_BIND_IN_PROGRESS ) {
>#ifdef HAVE_CYRUS_SASL
> assert( conn->c_sasl_bind_context != NULL );
>#endif
> conn->c_sasl_bind_mech = mech;
> mech = NULL;
>
>#ifdef HAVE_CYRUS_SASL
> } else {
> assert( conn->c_sasl_bind_context != NULL ); <<<----
>#endif
> }
> goto cleanup;
In my case, the assertion failed and dropped core because conn->c_sasl_bind_context
got set to NULL in sasl_bind but rc is not LDAP_SUCCESS. Shouldn't this be checking
for (== NULL) ?? rest of the ldap sasl related code works perfectly (reporting the
error etc) when there is a failure during the handshaking.
mei