}
{ /* naming check */
- LDAPRDN *rdn;
- const char *p;
- ber_len_t cnt;
+ LDAPRDN *rdn = NULL;
+ const char *p = NULL;
+ ber_len_t cnt;
/*
* Get attribute type(s) and attribute value(s) of our RDN
LDAP_DN_FORMAT_LDAP ) )
{
*text = "unrecongized attribute type(s) in RDN";
- return LDAP_INVALID_DN_SYNTAX;
+ rc = LDAP_INVALID_DN_SYNTAX;
+ goto rdn_check_done;
}
/* Check that each AVA of the RDN is present in the entry */
rc = slap_bv2ad( &ava->la_attr, &desc, &errtext );
if ( rc != LDAP_SUCCESS ) {
snprintf( textbuf, textlen, "%s (in RDN)", errtext );
- return rc;
+ goto rdn_check_done;
}
/* find the naming attribute */
if ( attr == NULL ) {
snprintf( textbuf, textlen,
"naming attribute '%s' is not present in entry",
- ava->la_attr );
- return LDAP_NO_SUCH_ATTRIBUTE;
+ ava->la_attr.bv_val );
+ rc = LDAP_NO_SUCH_ATTRIBUTE;
+ goto rdn_check_done;
}
if ( value_find( desc, attr->a_vals, &ava->la_value ) != 0 ) {
snprintf( textbuf, textlen,
"value of naming attribute '%s' is not present in entry",
- ava->la_attr );
- return LDAP_NO_SUCH_ATTRIBUTE;
+ ava->la_attr.bv_val );
+ rc = LDAP_NO_SUCH_ATTRIBUTE;
+ goto rdn_check_done;
}
}
+
+rdn_check_done:;
+ ldap_rdnfree( rdn );
+ if ( rc != LDAP_SUCCESS ) {
+ return rc;
+ }
}
#ifdef SLAP_EXTENDED_SCHEMA