rs->sr_err = get_filter( op, ber, (Filter **)&(op->o_assertion),
&rs->sr_text);
+ (void) ber_free( ber, 1 );
if( rs->sr_err != LDAP_SUCCESS ) {
if( rs->sr_err == SLAPD_DISCONNECT ) {
rs->sr_err = LDAP_PROTOCOL_ERROR;
return LDAP_OTHER;
}
+ rs->sr_err = LDAP_SUCCESS;
+
siz = sizeof( AttributeName );
off = offsetof( AttributeName, an_name );
if ( ber_scanf( ber, "{M}", &an, &siz, off ) == LBER_ERROR ) {
rs->sr_text = "preread control: decoding error";
- return LDAP_PROTOCOL_ERROR;
+ rs->sr_err = LDAP_PROTOCOL_ERROR;
+ goto done;
}
for( i=0; i<siz; i++ ) {
- int rc = LDAP_SUCCESS;
const char *dummy = NULL;
an[i].an_desc = NULL;
an[i].an_oc = NULL;
an[i].an_oc_exclude = 0;
- rc = slap_bv2ad( &an[i].an_name, &an[i].an_desc, &dummy );
- if ( rc != LDAP_SUCCESS && ctrl->ldctl_iscritical ) {
+ rs->sr_err = slap_bv2ad( &an[i].an_name, &an[i].an_desc, &dummy );
+ if ( rs->sr_err != LDAP_SUCCESS && ctrl->ldctl_iscritical ) {
rs->sr_text = dummy
? dummy
: "postread control: unknown attributeType";
- return rc;
+ goto done;
}
}
op->o_preread_attrs = an;
- rs->sr_err = LDAP_SUCCESS;
- return LDAP_SUCCESS;
+done:
+ (void) ber_free( ber, 1 );
+ return rs->sr_err;
}
static int parsePostRead (
return LDAP_OTHER;
}
+ rs->sr_err = LDAP_SUCCESS;
siz = sizeof( AttributeName );
off = offsetof( AttributeName, an_name );
if ( ber_scanf( ber, "{M}", &an, &siz, off ) == LBER_ERROR ) {
rs->sr_text = "postread control: decoding error";
- return LDAP_PROTOCOL_ERROR;
+ rs->sr_err = LDAP_PROTOCOL_ERROR;
+ goto done;
}
for( i=0; i<siz; i++ ) {
- int rc = LDAP_SUCCESS;
const char *dummy = NULL;
an[i].an_desc = NULL;
an[i].an_oc = NULL;
an[i].an_oc_exclude = 0;
- rc = slap_bv2ad( &an[i].an_name, &an[i].an_desc, &dummy );
- if ( rc != LDAP_SUCCESS && ctrl->ldctl_iscritical ) {
+ rs->sr_err = slap_bv2ad( &an[i].an_name, &an[i].an_desc, &dummy );
+ if ( rs->sr_err != LDAP_SUCCESS && ctrl->ldctl_iscritical ) {
rs->sr_text = dummy
? dummy
: "postread control: unknown attributeType";
- return rc;
+ goto done;
}
}
op->o_postread_attrs = an;
- rs->sr_err = LDAP_SUCCESS;
- return LDAP_SUCCESS;
+done:
+ (void) ber_free( ber, 1 );
+ return rs->sr_err;
}
static int parseValuesReturnFilter (
rs->sr_err = get_vrFilter( op, ber,
(ValuesReturnFilter **)&(op->o_vrFilter), &rs->sr_text);
+ (void) ber_free( ber, 1 );
+
if( rs->sr_err != LDAP_SUCCESS ) {
if( rs->sr_err == SLAPD_DISCONNECT ) {
rs->sr_err = LDAP_PROTOCOL_ERROR;
return LDAP_OTHER;
}
- if ( (tag = ber_scanf( ber, "{i}", &search_flags )) == LBER_ERROR ) {
+ tag = ber_scanf( ber, "{i}", &search_flags );
+ (void) ber_free( ber, 1 );
+
+ if ( tag == LBER_ERROR ) {
rs->sr_text = "searchOptions control decoding error";
return LDAP_PROTOCOL_ERROR;
}
- (void) ber_free( ber, 1 );
-
if ( search_flags & LDAP_SEARCH_FLAG_DOMAIN_SCOPE ) {
if ( op->o_domain_scope != SLAP_CONTROL_NONE ) {
rs->sr_text = "searchOptions control specified multiple times "
/* FIXME: is this really needed? */
BER_BVSTR( &val, "top" );
if( attr_merge_one( e, ad_objectClass, &val, NULL ) ) {
+fail:
+ entry_free( e );
return LDAP_OTHER;
}
BER_BVSTR( &val, "OpenLDAProotDSE" );
if( attr_merge_one( e, ad_objectClass, &val, NULL ) ) {
- return LDAP_OTHER;
+ goto fail;
}
if( attr_merge_one( e, ad_structuralObjectClass, &val, NULL ) ) {
- return LDAP_OTHER;
+ goto fail;
}
LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
&be->be_suffix[0],
&be->be_nsuffix[0] ) )
{
- return LDAP_OTHER;
+ goto fail;
}
continue;
}
&be->be_suffix[0],
& be->be_nsuffix[0] ) )
{
- return LDAP_OTHER;
+ goto fail;
}
continue;
}
&be->be_suffix[j],
&be->be_nsuffix[0] ) )
{
- return LDAP_OTHER;
+ goto fail;
}
}
}
/* supportedControl */
if ( controls_root_dse_info( e ) != 0 ) {
- return LDAP_OTHER;
+ goto fail;
}
/* supportedExtension */
if ( exop_root_dse_info( e ) != 0 ) {
- return LDAP_OTHER;
+ goto fail;
}
#ifdef LDAP_SLAPI
/* netscape supportedExtension */
for ( i = 0; (bv = slapi_int_get_supported_extop(i)) != NULL; i++ ) {
if( attr_merge_one( e, ad_supportedExtension, bv, NULL ) ) {
- return LDAP_OTHER;
+ goto fail;
}
}
#endif /* LDAP_SLAPI */
}
if( attr_merge( e, ad_supportedFeatures, supportedFeatures, NULL ) ) {
- return LDAP_OTHER;
+ goto fail;
}
/* supportedLDAPVersion */
val.bv_val = buf;
val.bv_len = strlen( val.bv_val );
if( attr_merge_one( e, ad_supportedLDAPVersion, &val, NULL ) ) {
- return LDAP_OTHER;
+ goto fail;
}
}
val.bv_val = supportedSASLMechanisms[i];
val.bv_len = strlen( val.bv_val );
if( attr_merge_one( e, ad_supportedSASLMechanisms, &val, NULL ) ) {
- return LDAP_OTHER;
+ ldap_charray_free( supportedSASLMechanisms );
+ goto fail;
}
}
ldap_charray_free( supportedSASLMechanisms );
if ( default_referral != NULL ) {
if( attr_merge( e, ad_ref, default_referral, NULL /* FIXME */ ) ) {
- return LDAP_OTHER;
+ goto fail;
}
}
if( attr_merge( e, a->a_desc, a->a_vals,
(a->a_nvals == a->a_vals) ? NULL : a->a_nvals ) )
{
- return LDAP_OTHER;
+ goto fail;
}
}
}