]> git.sur5r.net Git - openldap/commitdiff
move call to frontend API
authorPierangelo Masarati <ando@openldap.org>
Tue, 24 Aug 2004 09:29:11 +0000 (09:29 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 24 Aug 2004 09:29:11 +0000 (09:29 +0000)
servers/slapd/back-meta/search.c
servers/slapd/dn.c
servers/slapd/proto-slap.h

index 91311fbe5152dbd07c7cb39ae2cd4b6b7c9f233a..b118680126b2f905126131bf71770164d2ba8082 100644 (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;
-}
 
index 44528fa2f63271998e13026268bcd5bc3dc4fb24..388ea12366907c731c54b2dcb023db20297ec439 100644 (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
index 8f398a7d43617d13c4cd1e254f68ae0fa0e2f721..87a62dfba8241709dac5dfc9d1554cf90cbe9331 100644 (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 ));