move call to frontend API

This commit is contained in:
Pierangelo Masarati 2004-08-24 09:29:11 +00:00
parent 450b579971
commit 00f1c085cf
3 changed files with 22 additions and 23 deletions

View File

@ -45,12 +45,6 @@ meta_send_entry(
LDAPMessage *e
);
static int
is_one_level_rdn(
const char *rdn,
int from
);
int
meta_back_search( Operation *op, SlapReply *rs )
{
@ -163,9 +157,12 @@ 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
@ -176,6 +173,7 @@ meta_back_search( Operation *op, SlapReply *rs )
is_scope++;
break;
} /* else continue with the next case */
}
case LDAP_SCOPE_BASE:
/*
@ -739,18 +737,4 @@ meta_send_entry(
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;
}

View File

@ -1259,6 +1259,19 @@ dnIsSuffix(
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

View File

@ -488,6 +488,8 @@ LDAP_SLAPD_F (int) rdnMatch LDAP_P((
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 ));