LDAPMessage *e
);
-static int
-is_one_level_rdn(
- const char *rdn,
- int from
-);
-
int
meta_back_search( Operation *op, SlapReply *rs )
{
break;
case LDAP_SCOPE_ONELEVEL:
- if ( is_one_level_rdn( li->targets[ i ]->suffix.bv_val,
- suffixlen - op->o_req_ndn.bv_len - 1 )
- && dnIsSuffix( &li->targets[ i ]->suffix, &op->o_req_ndn ) ) {
+ {
+ struct berval rdn = li->targets[ i ]->suffix;
+ rdn.bv_len -= op->o_req_ndn.bv_len + STRLENOF( "," );
+ if ( dnIsOneLevelRDN( &rdn )
+ && dnIsSuffix( &li->targets[ i ]->suffix, &op->o_req_ndn ) )
+ {
/*
* if there is exactly one level,
* make the target suffix the new
is_scope++;
break;
} /* else continue with the next case */
+ }
case LDAP_SCOPE_BASE:
/*
return LDAP_SUCCESS;
}
-static int
-is_one_level_rdn(
- const char *rdn,
- int from
-)
-{
- for ( ; from--; ) {
- if ( DN_SEPARATOR( rdn[ from ] ) ) {
- return 0;
- }
- }
-
- return 1;
-}
return( strcmp( dn->bv_val + d, suffix->bv_val ) == 0 );
}
+int
+dnIsOneLevelRDN( struct berval *rdn )
+{
+ ber_len_t len = rdn->bv_len;
+ for ( ; len--; ) {
+ if ( DN_SEPARATOR( rdn->bv_val[ len ] ) ) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
#ifdef HAVE_TLS
/*
* Convert an X.509 DN into a normalized LDAP DN
LDAP_SLAPD_F (int) dnIsSuffix LDAP_P((
const struct berval *dn, const struct berval *suffix ));
+LDAP_SLAPD_F (int) dnIsOneLevelRDN LDAP_P(( struct berval *rdn ));
+
LDAP_SLAPD_F (int) dnExtractRdn LDAP_P((
struct berval *dn, struct berval *rdn, void *ctx ));