Add FIXME comment regarding improper return of unavailableCriticalExtension

Misc Clean.
This commit is contained in:
Kurt Zeilenga 2004-08-28 13:45:53 +00:00
parent 1ccb936170
commit 429be3c137
3 changed files with 46 additions and 22 deletions

View file

@ -978,6 +978,20 @@ backend_check_controls(
if( (*ctrls)->ldctl_iscritical && !ldap_charray_inlist(
op->o_bd->be_controls, (*ctrls)->ldctl_oid ) )
{
/* FIXME: standards compliance issue
*
* Per RFC 2251 (and LDAPBIS discussions), if the control
* is recognized and appropriate for the operation (which
* we've already verified), then the server should make
* use of the control when performing the operation
* (without regard to criticality). This code is incorrect
* on two counts.
* 1) a service error (e.g., unwillingToPerform) should be
* returned where a particular backend cannot service the
* operation,
* 2) this error should be returned irregardless of the
* criticality of the control.
*/
rs->sr_text = "control unavailable in context";
rs->sr_err = LDAP_UNAVAILABLE_CRITICAL_EXTENSION;
break;

View file

@ -154,14 +154,11 @@ register_supported_control(const char *controloid,
struct slap_control *sc;
int i;
if ( controloid == NULL ) {
return LDAP_PARAM_ERROR;
}
if ( controloid == NULL ) return LDAP_PARAM_ERROR;
sc = (struct slap_control *)SLAP_MALLOC( sizeof( *sc ) );
if ( sc == NULL ) {
return LDAP_NO_MEMORY;
}
if ( sc == NULL ) return LDAP_NO_MEMORY;
sc->sc_oid = ch_strdup( controloid );
sc->sc_mask = controlmask;
if ( controlexops != NULL ) {
@ -179,28 +176,39 @@ register_supported_control(const char *controloid,
if ( slap_known_controls == NULL ) {
slap_known_controls = (char **)SLAP_MALLOC( 2 * sizeof(char *) );
if ( slap_known_controls == NULL ) {
if ( sc->sc_extendedops != NULL ) ldap_charray_free( sc->sc_extendedops );
if ( sc->sc_extendedops != NULL ) {
ldap_charray_free( sc->sc_extendedops );
}
ch_free( sc );
return LDAP_NO_MEMORY;
}
slap_known_controls[0] = ch_strdup( sc->sc_oid );
slap_known_controls[1] = NULL;
} else {
for ( i = 0; slap_known_controls[i] != NULL; i++ )
;
slap_known_controls = (char **)SLAP_REALLOC( slap_known_controls, (i + 2) * sizeof(char *) );
if ( slap_known_controls == NULL ) {
if ( sc->sc_extendedops != NULL ) ldap_charray_free( sc->sc_extendedops );
char **new_known_controls;
for ( i = 0; slap_known_controls[i] != NULL; i++ ) {
/* EMPTY */ ;
}
new_known_controls = (char **)SLAP_REALLOC(
slap_known_controls, (i + 2) * sizeof(char *) );
if ( new_known_controls == NULL ) {
if ( sc->sc_extendedops != NULL ) {
ldap_charray_free( sc->sc_extendedops );
}
ch_free( sc );
return LDAP_NO_MEMORY;
}
slap_known_controls = new_known_controls;
slap_known_controls[i++] = ch_strdup( sc->sc_oid );
slap_known_controls[i] = NULL;
}
LDAP_SLIST_NEXT( sc, sc_next ) = NULL;
LDAP_SLIST_INSERT_HEAD( &controls_list, sc, sc_next );
return LDAP_SUCCESS;
}
@ -219,8 +227,7 @@ slap_controls_init( void )
rc = register_supported_control( control_defs[i].sc_oid,
control_defs[i].sc_mask, control_defs[i].sc_extendedops,
control_defs[i].sc_parse );
if ( rc != LDAP_SUCCESS )
break;
if ( rc != LDAP_SUCCESS ) break;
}
return rc;
@ -607,8 +614,8 @@ int get_ctrls(
}
rc = sc->sc_parse( op, rs, c );
assert( rc != LDAP_UNAVAILABLE_CRITICAL_EXTENSION );
if ( rc ) {
assert( rc != LDAP_UNAVAILABLE_CRITICAL_EXTENSION );
rs->sr_err = rc;
goto return_results;
}

View file

@ -235,7 +235,9 @@ fe_extended( Operation *op, SlapReply *rs )
}
#ifdef LDAP_SLAPI
slapi_int_get_extop_plugin( &op->ore_reqoid, &funcAddr ); /* NS-SLAPI extended operation */
/* NS-SLAPI extended operation */
slapi_int_get_extop_plugin( &op->ore_reqoid, &funcAddr );
if( !funcAddr && !(ext = find_extop(supp_ext_list, &op->ore_reqoid )))
#else
if( !(ext = find_extop(supp_ext_list, &op->ore_reqoid )))
@ -256,9 +258,11 @@ fe_extended( Operation *op, SlapReply *rs )
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, DETAIL1,
"do_extended: conn %d oid=%s\n.", op->o_connid, op->ore_reqoid.bv_val, 0 );
"do_extended: conn %d oid=%s\n.",
op->o_connid, op->ore_reqoid.bv_val, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "do_extended: oid=%s\n", op->ore_reqoid.bv_val, 0 ,0 );
Debug( LDAP_DEBUG_ARGS, "do_extended: oid=%s\n",
op->ore_reqoid.bv_val, 0 ,0 );
#endif
#if defined(LDAP_SLAPI)
@ -321,8 +325,9 @@ done2:;
if ( rs->sr_rspdata != NULL ) {
ber_bvfree( rs->sr_rspdata );
}
} else { /* start of OpenLDAP extended operation */
} else
#endif /* defined( LDAP_SLAPI ) */
{ /* start of OpenLDAP extended operation */
rs->sr_err = (ext->ext_main)( op, rs );
if( rs->sr_err != SLAPD_ABANDON ) {
@ -351,9 +356,7 @@ done2:;
if ( rs->sr_rspdata != NULL ) {
ber_bvfree( rs->sr_rspdata );
}
#ifdef LDAP_SLAPI
} /* end of OpenLDAP extended operation */
#endif /* LDAP_SLAPI */
done:;
return rs->sr_err;