Commit fafce160 authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

consistently use dn_match macro throughout slapd

parent bcf37b44
......@@ -1602,7 +1602,7 @@ aci_mask(
}
if (aci_strbvcmp( "self", &bv ) == 0) {
if (strcmp(op->o_ndn.bv_val, e->e_ndn) == 0)
if (dn_match(&op->o_ndn, &e->e_nname))
return(1);
} else if (aci_strbvcmp( "dnattr", &bv ) == 0) {
......
......@@ -58,7 +58,7 @@ bdb_attribute(
target ? target->e_ndn : "", 0, 0 );
#endif
if (target != NULL && strcmp(target->e_ndn, entry_ndn->bv_val) == 0) {
if (target != NULL && dn_match(&target->e_nname, entry_ndn)) {
/* we already have a LOCKED copy of the entry */
e = target;
#ifdef NEW_LOGGING
......
......@@ -69,7 +69,7 @@ bdb_group(
target->e_ndn, 0, 0 );
#endif
if (strcmp(target->e_ndn, gr_ndn->bv_val) == 0) {
if (dn_match(&target->e_name, gr_ndn)) {
/* we already have a LOCKED copy of the entry */
e = target;
#ifdef NEW_LOGGING
......
......@@ -123,7 +123,7 @@ dnssrv_back_search(
}
}
if( strcmp( nrefdn.bv_val, ndn->bv_val ) != 0 ) {
if( !dn_match( &nrefdn, ndn ) ) {
/* requested dn is subordinate */
Debug( LDAP_DEBUG_TRACE,
......
......@@ -54,8 +54,7 @@ ldap_back_group(
if (group_oc_name.bv_val)
group_oc_name.bv_len = strlen(group_oc_name.bv_val);
if (target != NULL && target->e_nname.bv_len == gr_ndn->bv_len &&
strcmp(target->e_nname.bv_val, gr_ndn->bv_val) == 0) {
if (target != NULL && dn_match( &target->e_nname, gr_ndn ) ) {
/* we already have a copy of the entry */
/* attribute and objectclass mapping has already been done */
......
......@@ -59,7 +59,7 @@ ldbm_back_attribute(
target ? target->e_ndn : "", 0, 0 );
#endif
if (target != NULL && strcmp(target->e_ndn, entry_ndn->bv_val) == 0) {
if (target != NULL && dn_match( &target->e_nname, entry_ndn) ) {
/* we already have a LOCKED copy of the entry */
e = target;
#ifdef NEW_LOGGING
......
......@@ -291,8 +291,7 @@ ldbm_back_modrdn(
np_ndn = nnewSuperior;
/* newSuperior == oldParent? */
if ( p_ndn.bv_len == np_ndn->bv_len &&
strcmp( p_ndn.bv_val, np_ndn->bv_val ) == 0 ) {
if ( dn_match( &p_ndn, np_ndn ) ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO, "ldbm_back_modrdn: "
"new parent\"%s\" seems to be the same as the "
......
......@@ -105,8 +105,7 @@ meta_back_attribute(
LDAP *ld;
*vals = NULL;
if ( target != NULL && target->e_nname.bv_len == ndn->bv_len
&& strcmp( target->e_ndn, ndn->bv_val ) == 0 ) {
if ( target != NULL && dn_match( &target->e_nname, ndn ) ) {
/* we already have a copy of the entry */
/* attribute and objectclass mapping has already been done */
attr = attr_find( target->e_attrs, entry_at );
......
......@@ -235,8 +235,8 @@ meta_back_db_config(
* or worked out, at least, in some manner
*/
for ( j = 0; j < i-1; j++ ) {
if ( strcmp( li->targets[ i ]->suffix.bv_val,
li->targets[ j ]->suffix.bv_val ) == 0 ) {
if ( dn_match( &li->targets[ i ]->suffix,
&li->targets[ j ]->suffix ) ) {
fprintf( stderr,
"%s: line %d: naming context \"%s\" already used"
" in \"uri <protocol>://<server>[:port]/<naming context>\" line\n",
......
......@@ -115,7 +115,7 @@ meta_back_group(
group_oc_name.bv_len = strlen( group_oc_name.bv_val );
}
if ( target != NULL && strcmp( target->e_nname.bv_val, gr_ndn->bv_val ) == 0 ) {
if ( target != NULL && dn_match( &target->e_nname, gr_ndn ) ) {
/* we already have a copy of the entry */
/* attribute and objectclass mapping has already been done */
......
......@@ -606,7 +606,7 @@ be_isroot( Backend *be, struct berval *ndn )
return( 0 );
}
return strcmp( be->be_rootndn.bv_val, ndn->bv_val ) ? 0 : 1;
return dn_match( &be->be_rootndn, ndn );
}
int
......@@ -620,7 +620,7 @@ be_isupdate( Backend *be, struct berval *ndn )
return( 0 );
}
return strcmp( be->be_update_ndn.bv_val, ndn->bv_val ) ? 0 : 1;
return dn_match( &be->be_update_ndn, ndn );
}
struct berval *
......@@ -994,8 +994,7 @@ backend_group(
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
if (i) return SLAPD_ABANDON;
if( target->e_nname.bv_len != gr_ndn->bv_len ||
strcmp( target->e_nname.bv_val, gr_ndn->bv_val ) != 0 ) {
if ( !dn_match( &target->e_nname, gr_ndn ) ) {
/* we won't attempt to send it to a different backend */
be = select_backend( gr_ndn, 0,
......@@ -1054,9 +1053,7 @@ backend_attribute(
BVarray *vals
)
{
if( target == NULL || target->e_nname.bv_len != edn->bv_len ||
strcmp( target->e_ndn, edn->bv_val ) != 0 )
{
if ( target == NULL || !dn_match( &target->e_nname, edn ) ) {
/* we won't attempt to send it to a different backend */
be = select_backend( edn, 0,
......
......@@ -40,7 +40,7 @@ get_limits(
if ( ndn->bv_len == 0 ) {
break;
}
if ( strcmp( lm[0]->lm_dn_pat.bv_val, ndn->bv_val ) == 0 ) {
if ( dn_match( &lm[0]->lm_dn_pat, ndn ) ) {
*limit = &lm[0]->lm_limits;
return( 0 );
}
......@@ -76,7 +76,8 @@ get_limits(
}
/* in case of (sub)match ... */
if ( strcmp( lm[0]->lm_dn_pat.bv_val, &ndn->bv_val[d] ) == 0 ) {
if ( lm[0]->lm_dn_pat.bv_len == ( ndn->bv_len - d )
&& strcmp( lm[0]->lm_dn_pat.bv_val, &ndn->bv_val[d] ) == 0 ) {
/* check for exactly one rdn in case of ONE */
if ( lm[0]->lm_type == SLAP_LIMITS_ONE ) {
/*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment