Commit 0f440f89 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Such in back-meta changes and sync slap.h with HEAD

parent 3fb4e8ed
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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
/*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment