mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
canonicalize undef objectClass names (much like attributes; ITS#5681)
This commit is contained in:
parent
8141cd4db7
commit
969a0aef0e
@ -713,11 +713,13 @@ ldap_build_entry(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( rc != LDAP_SUCCESS ) {
|
if ( rc != LDAP_SUCCESS ) {
|
||||||
|
ObjectClass *oc;
|
||||||
|
|
||||||
/* check if, by chance, it's an undefined objectClass */
|
/* check if, by chance, it's an undefined objectClass */
|
||||||
if ( attr->a_desc == slap_schema.si_ad_objectClass &&
|
if ( attr->a_desc == slap_schema.si_ad_objectClass &&
|
||||||
oc_bvfind_undef( &attr->a_vals[i] ) != NULL )
|
( oc = oc_bvfind_undef( &attr->a_vals[i] ) ) != NULL )
|
||||||
{
|
{
|
||||||
ber_dupbv( &pval, &attr->a_vals[i] );
|
ber_dupbv( &pval, &oc->soc_cname );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
attr->a_nvals = NULL;
|
attr->a_nvals = NULL;
|
||||||
|
@ -1905,6 +1905,8 @@ meta_send_entry(
|
|||||||
struct berval *bv;
|
struct berval *bv;
|
||||||
|
|
||||||
for ( bv = attr->a_vals; !BER_BVISNULL( bv ); bv++ ) {
|
for ( bv = attr->a_vals; !BER_BVISNULL( bv ); bv++ ) {
|
||||||
|
ObjectClass *oc;
|
||||||
|
|
||||||
ldap_back_map( &mi->mi_targets[ target ]->mt_rwmap.rwm_oc,
|
ldap_back_map( &mi->mi_targets[ target ]->mt_rwmap.rwm_oc,
|
||||||
bv, &mapped, BACKLDAP_REMAP );
|
bv, &mapped, BACKLDAP_REMAP );
|
||||||
if ( BER_BVISNULL( &mapped ) || mapped.bv_val[0] == '\0') {
|
if ( BER_BVISNULL( &mapped ) || mapped.bv_val[0] == '\0') {
|
||||||
@ -1936,6 +1938,12 @@ remove_oc:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
ber_bvreplace( bv, &mapped );
|
ber_bvreplace( bv, &mapped );
|
||||||
|
|
||||||
|
} else if ( ( oc = oc_bvfind_undef( bv ) ) == NULL ) {
|
||||||
|
goto remove_oc;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ber_bvreplace( bv, &oc->soc_cname );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -228,6 +228,9 @@ oc_bvfind_undef( struct berval *ocname )
|
|||||||
oc->soc_cname.bv_val = (char *)&oc[ 1 ];
|
oc->soc_cname.bv_val = (char *)&oc[ 1 ];
|
||||||
AC_MEMCPY( oc->soc_cname.bv_val, ocname->bv_val, ocname->bv_len );
|
AC_MEMCPY( oc->soc_cname.bv_val, ocname->bv_val, ocname->bv_len );
|
||||||
|
|
||||||
|
/* canonical to upper case */
|
||||||
|
ldap_pvt_str2upper( oc->soc_cname.bv_val );
|
||||||
|
|
||||||
LDAP_STAILQ_NEXT( oc, soc_next ) = NULL;
|
LDAP_STAILQ_NEXT( oc, soc_next ) = NULL;
|
||||||
ldap_pvt_thread_mutex_lock( &oc_undef_mutex );
|
ldap_pvt_thread_mutex_lock( &oc_undef_mutex );
|
||||||
LDAP_STAILQ_INSERT_HEAD( &oc_undef_list, oc, soc_next );
|
LDAP_STAILQ_INSERT_HEAD( &oc_undef_list, oc, soc_next );
|
||||||
|
Loading…
Reference in New Issue
Block a user