]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Such in back-meta changes and sync slap.h with HEAD
authorKurt Zeilenga <kurt@openldap.org>
Fri, 14 Feb 2003 17:16:03 +0000 (17:16 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 14 Feb 2003 17:16:03 +0000 (17:16 +0000)
servers/slapd/back-meta/add.c
servers/slapd/back-meta/compare.c
servers/slapd/back-meta/delete.c
servers/slapd/back-meta/modify.c
servers/slapd/back-meta/modrdn.c
servers/slapd/back-meta/search.c
servers/slapd/slap.h

index 61ce46deedd859847023f76e099af72056e933fd..64e1efafda8d188f6f5634c965e56e174a888f1e 100644 (file)
@@ -102,7 +102,8 @@ meta_back_add(
         */
        lc = meta_back_getconn( li, conn, op, META_OP_REQUIRE_SINGLE,
                        &e->e_nname, &candidate );
-       if ( !lc || !meta_back_dobind( lc, op ) || !meta_back_is_valid( lc, candidate ) ) {
+       if ( !lc || !meta_back_dobind( lc, op )
+                       || !meta_back_is_valid( lc, candidate ) ) {
                send_ldap_result( conn, op, LDAP_OTHER,
                                NULL, NULL, NULL, NULL );
                return -1;
index 815e515cadd6633271948233b9429a8cf340ef15..b4131c7557c667916df4003b218e67d0362cd18e 100644 (file)
@@ -96,6 +96,8 @@ meta_back_compare(
        lc = meta_back_getconn( li, conn, op, META_OP_ALLOW_MULTIPLE,
                        ndn, NULL );
        if ( !lc || !meta_back_dobind( lc, op ) ) {
+               send_ldap_result( conn, op, LDAP_OTHER,
+                               NULL, NULL, NULL, NULL );
                return -1;
        }
 
index 4909e73a6268ae60e402a6141b4c603783006a34..29520650ec7d3bec949e6dedaaf0189a22be6e41 100644 (file)
@@ -92,9 +92,10 @@ meta_back_delete(
 
        lc = meta_back_getconn( li, conn, op, META_OP_REQUIRE_SINGLE,
                        ndn, &candidate );
-       if ( !lc || !meta_back_dobind( lc, op ) || !meta_back_is_valid( lc, candidate ) ) {
-               send_ldap_result( conn, op, LDAP_OTHER,
-                               NULL, NULL, NULL, NULL );
+       if ( !lc || !meta_back_dobind( lc, op )
+                       || !meta_back_is_valid( lc, candidate ) ) {
+               send_ldap_result( conn, op, LDAP_OTHER,
+                               NULL, NULL, NULL, NULL );
                return -1;
        }
 
index 01fec49787949fe77839ed497f18c52dcd08cc12..0480d4936b02d995d546c645cd752864938699fd 100644 (file)
@@ -96,9 +96,10 @@ meta_back_modify(
 
        lc = meta_back_getconn( li, conn, op, META_OP_REQUIRE_SINGLE,
                        ndn, &candidate );
-       if ( !lc || !meta_back_dobind( lc, op ) || !meta_back_is_valid( lc, candidate ) ) {
-               send_ldap_result( conn, op, LDAP_OTHER,
-                               NULL, NULL, NULL, NULL );
+       if ( !lc || !meta_back_dobind( lc, op )
+                       || !meta_back_is_valid( lc, candidate ) ) {
+               send_ldap_result( conn, op, LDAP_OTHER,
+                               NULL, NULL, NULL, NULL );
                return -1;
        }
 
index 336001bdd2f98f87da3031c2c688102b81bdb027..ade436e58d3b365594327edf46500246dff9f50d 100644 (file)
@@ -97,9 +97,10 @@ meta_back_modrdn(
 
        lc = meta_back_getconn( li, conn, op, META_OP_REQUIRE_SINGLE,
                        ndn, &candidate );
-       if ( !lc || !meta_back_dobind( lc, op ) || !meta_back_is_valid( lc, candidate ) ) {
-               send_ldap_result( conn, op, LDAP_OTHER,
-                               NULL, NULL, NULL, NULL );
+       if ( !lc || !meta_back_dobind( lc, op ) 
+                       || !meta_back_is_valid( lc, candidate ) ) {
+               send_ldap_result( conn, op, LDAP_OTHER,
+                               NULL, NULL, NULL, NULL );
                return -1;
        }
 
index 1243ba0f288e21d7775ef67efeb029e34bd75f88..39e2114ae5c4aa9353c68d6aeb5ebdbfd97ca7a8 100644 (file)
@@ -125,24 +125,21 @@ meta_back_search(
        struct berval mfilter;
        BerVarray v2refs = NULL;
                
-       int i, last = 0, candidates = 0, op_type;
+       int i, last = 0, candidates = 0;
        struct slap_limits_set *limit = NULL;
        int isroot = 0;
 
-       if ( scope == LDAP_SCOPE_BASE ) {
-               op_type = META_OP_REQUIRE_SINGLE;
-       } else {
-               op_type = META_OP_ALLOW_MULTIPLE;
-       }
-       
        /*
         * controls are set in ldap_back_dobind()
         * 
         * FIXME: in case of values return filter, we might want
         * to map attrs and maybe rewrite value
         */
-       lc = meta_back_getconn( li, conn, op, op_type, nbase, NULL );
+       lc = meta_back_getconn( li, conn, op, META_OP_ALLOW_MULTIPLE, 
+                       nbase, NULL );
        if ( !lc || !meta_back_dobind( lc, op ) ) {
+               send_ldap_result( conn, op, LDAP_OTHER,
+                               NULL, NULL, NULL, NULL );
                return -1;
        }
 
@@ -211,7 +208,7 @@ meta_back_search(
                int     realscope = scope;
                ber_len_t suffixlen;
                char    *mapped_filter, **mapped_attrs;
-               
+
                if ( lsc->candidate != META_CANDIDATE ) {
                        msgid[ i ] = -1;
                        continue;
@@ -252,7 +249,7 @@ meta_back_search(
                                         * this target is no longer candidate
                                         */
                                        msgid[ i ] = -1;
-                                       continue;
+                                       goto new_candidate;
                                }
                                break;
 
@@ -275,7 +272,7 @@ meta_back_search(
                                 * this target is no longer candidate
                                 */
                                msgid[ i ] = -1;
-                               continue;
+                               goto new_candidate;
                        }
 
                }
@@ -292,10 +289,12 @@ meta_back_search(
                }
 #ifdef NEW_LOGGING
                LDAP_LOG( BACK_META, DETAIL1,
-                       "[rw] searchBase: \"%s\" -> \"%s\"\n", base->bv_val, mbase, 0 );
+                       "[rw] searchBase [%d]: \"%s\" -> \"%s\"\n",
+                       i, base->bv_val, mbase );
 #else /* !NEW_LOGGING */
-               Debug( LDAP_DEBUG_ARGS, "rw> searchBase: \"%s\" -> \"%s\"\n%s",
-                               base->bv_val, mbase, "" );
+               Debug( LDAP_DEBUG_ARGS,
+                       "rw> searchBase [%d]: \"%s\" -> \"%s\"\n",
+                               i, base->bv_val, mbase );
 #endif /* !NEW_LOGGING */
                break;
                
@@ -330,12 +329,12 @@ meta_back_search(
                        }
 #ifdef NEW_LOGGING
                        LDAP_LOG( BACK_META, DETAIL1,
-                               "[rw] searchFilter: \"%s\" -> \"%s\"\n",
-                               filterstr->bv_val, mfilter.bv_val, 0 );
+                               "[rw] searchFilter [%d]: \"%s\" -> \"%s\"\n",
+                               i, filterstr->bv_val, mfilter.bv_val );
 #else /* !NEW_LOGGING */
                        Debug( LDAP_DEBUG_ARGS,
-                               "rw> searchFilter: \"%s\" -> \"%s\"\n%s",
-                               filterstr->bv_val, mfilter.bv_val, "" );
+                               "rw> searchFilter [%d]: \"%s\" -> \"%s\"\n",
+                               i, filterstr->bv_val, mfilter.bv_val );
 #endif /* !NEW_LOGGING */
                        break;
                
@@ -406,6 +405,8 @@ meta_back_search(
                }
 
                ++candidates;
+
+new_candidate:;
        }
 
        /* We pull apart the ber result, stuff it into a slapd entry, and
@@ -475,6 +476,19 @@ meta_back_search(
                                                attrsonly ) == LDAP_SUCCESS ) {
                                        count++;
                                }
+
+                               /*
+                                * If scope is BASE, we need to jump out
+                                * as soon as one entry is found; if
+                                * the target pool is properly crafted,
+                                * this should correspond to the sole
+                                * entry that has the base DN
+                                */
+                               if ( scope == LDAP_SCOPE_BASE && count > 0 ) {
+                                       candidates = 0;
+                                       sres = LDAP_SUCCESS;
+                                       break;
+                               }
                                ldap_msgfree( res );
                                gotit = 1;
 
@@ -599,11 +613,12 @@ meta_back_search(
                        }
 #ifdef NEW_LOGGING
                        LDAP_LOG( BACK_META, DETAIL1,
-                               "[rw] matchedDn: \"%s\" -> \"%s\"\n", match, mmatch, 0 );
+                               "[rw] matchedDn: \"%s\" -> \"%s\"\n",
+                               match, mmatch, 0 );
 #else /* !NEW_LOGGING */
-                       Debug( LDAP_DEBUG_ARGS, "rw> matchedDn:"
-                                      " \"%s\" -> \"%s\"\n%s",
-                                      match, mmatch, "" );
+                       Debug( LDAP_DEBUG_ARGS,
+                               "rw> matchedDn: \"%s\" -> \"%s\"\n",
+                               match, mmatch, 0 );
 #endif /* !NEW_LOGGING */
                        break;
                        
index c5dff6c12610b142e4233c98c1ceaa2f525d2398..8bf8df0e4790d377036a806a337653ec4f889fa7 100644 (file)
@@ -35,7 +35,9 @@
 #include "ldap_pvt_thread.h"
 #include "ldap_queue.h"
 
+#ifdef LDAP_DEVEL
 #define SLAP_EXTENDED_SCHEMA 1
+#endif
 
 LDAP_BEGIN_DECL
 /*