From: Luke Howard Date: Tue, 23 Sep 2003 07:40:29 +0000 (+0000) Subject: Fix for Howard's fix for ITS #2704 X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~672 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=114d0081c19ceeeba4455a1d679178ae305112d1;p=openldap Fix for Howard's fix for ITS #2704 The oblique SLAPI interface requires that preop bind plugins return 1 in the case that they have authoritatively handled the bind; of course, this is the same return value that doPluginFNs() returns in the case of no plugins being called. This patch should distinguish between the two cases... --- diff --git a/servers/slapd/bind.c b/servers/slapd/bind.c index 80c1081acb..b4095cf56b 100644 --- a/servers/slapd/bind.c +++ b/servers/slapd/bind.c @@ -47,6 +47,7 @@ do_bind( #ifdef LDAP_SLAPI Slapi_PBlock *pb = op->o_pb; + int rc; #endif #ifdef NEW_LOGGING @@ -526,8 +527,9 @@ do_bind( slapi_pblock_set( pb, SLAPI_BIND_METHOD, (void *)method ); slapi_pblock_set( pb, SLAPI_BIND_CREDENTIALS, (void *)&op->orb_cred ); slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(0) ); + slapi_pblock_set( pb, SLAPI_CONN_DN, (void *)(0) ); - rs->sr_err = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_BIND_FN, pb ); + rc = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_BIND_FN, pb ); #ifdef NEW_LOGGING LDAP_LOG( OPERATION, INFO, @@ -539,9 +541,7 @@ do_bind( rs->sr_err, 0, 0); #endif - switch ( rs->sr_err ) { - case 1: /* no plugins present, continue normally */ - break; + switch ( rc ) { case SLAPI_BIND_SUCCESS: /* Continue with backend processing */ break; @@ -554,7 +554,7 @@ do_bind( case SLAPI_BIND_ANONYMOUS: /* SLAPI_BIND_ANONYMOUS is undocumented XXX */ default: - /* Authoritative, plugin sent result */ + /* Authoritative, plugin sent result, or no plugins called. */ if ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err) != 0 ) { @@ -566,7 +566,12 @@ do_bind( if ( rs->sr_err == LDAP_SUCCESS ) { slapi_pblock_get( pb, SLAPI_CONN_DN, (void *)&op->orb_edn.bv_val ); - if ( op->orb_edn.bv_val != NULL ) { + if ( op->orb_edn.bv_val == NULL ) { + if ( rc == 1 ) { + /* No plugins were called; continue. */ + break; + } + } else { op->orb_edn.bv_len = strlen( op->orb_edn.bv_val ); } rs->sr_err = dnPrettyNormal( NULL, &op->orb_edn,