From: Pierangelo Masarati Date: Sat, 12 Jan 2002 18:17:13 +0000 (+0000) Subject: consistently use dn_match macro throughout slapd X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~168 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fafce1601e5bcd0eca185a2a0366cd2b198121a6;p=openldap consistently use dn_match macro throughout slapd --- diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index c81be967ef..95594f56cc 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -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) { diff --git a/servers/slapd/back-bdb/attribute.c b/servers/slapd/back-bdb/attribute.c index f9eb8edac6..96fdd1bf4a 100644 --- a/servers/slapd/back-bdb/attribute.c +++ b/servers/slapd/back-bdb/attribute.c @@ -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 diff --git a/servers/slapd/back-bdb/group.c b/servers/slapd/back-bdb/group.c index 71b001068e..9bd50a3a10 100644 --- a/servers/slapd/back-bdb/group.c +++ b/servers/slapd/back-bdb/group.c @@ -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 diff --git a/servers/slapd/back-dnssrv/search.c b/servers/slapd/back-dnssrv/search.c index 9bc266b74a..720aa179a7 100644 --- a/servers/slapd/back-dnssrv/search.c +++ b/servers/slapd/back-dnssrv/search.c @@ -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, diff --git a/servers/slapd/back-ldap/group.c b/servers/slapd/back-ldap/group.c index c519da293e..c1410d3879 100644 --- a/servers/slapd/back-ldap/group.c +++ b/servers/slapd/back-ldap/group.c @@ -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 */ diff --git a/servers/slapd/back-ldbm/attribute.c b/servers/slapd/back-ldbm/attribute.c index 5a7dfa0869..92153f34a7 100644 --- a/servers/slapd/back-ldbm/attribute.c +++ b/servers/slapd/back-ldbm/attribute.c @@ -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 diff --git a/servers/slapd/back-ldbm/modrdn.c b/servers/slapd/back-ldbm/modrdn.c index b752cd0107..1ab39ac81c 100644 --- a/servers/slapd/back-ldbm/modrdn.c +++ b/servers/slapd/back-ldbm/modrdn.c @@ -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 " diff --git a/servers/slapd/back-meta/attribute.c b/servers/slapd/back-meta/attribute.c index 02fa629324..5bc98e577c 100644 --- a/servers/slapd/back-meta/attribute.c +++ b/servers/slapd/back-meta/attribute.c @@ -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 ); diff --git a/servers/slapd/back-meta/config.c b/servers/slapd/back-meta/config.c index 3b550beb42..9c00cdc1a3 100644 --- a/servers/slapd/back-meta/config.c +++ b/servers/slapd/back-meta/config.c @@ -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 ://[:port]/\" line\n", diff --git a/servers/slapd/back-meta/group.c b/servers/slapd/back-meta/group.c index 6d6ad2bb7c..65481f71eb 100644 --- a/servers/slapd/back-meta/group.c +++ b/servers/slapd/back-meta/group.c @@ -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 */ diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 3c5d842059..e638770820 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -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, diff --git a/servers/slapd/limits.c b/servers/slapd/limits.c index 0154626903..2cddf4166b 100644 --- a/servers/slapd/limits.c +++ b/servers/slapd/limits.c @@ -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 ) { /*