Modifications *mods = NULL;
const char *text;
int rc = LDAP_SUCCESS;
+ int manageDSAit;
Debug( LDAP_DEBUG_TRACE, "do_add\n", 0, 0, 0 );
goto done;
}
+ manageDSAit = get_manageDSAit( op ) &&
+ is_entry_referral( e );
+
/*
* We could be serving multiple database backends. Select the
* appropriate one, or send a referral to our "referral server"
* if we don't hold it.
*/
- be = select_backend( e->e_ndn );
+ be = select_backend( e->e_ndn, manageDSAit );
if ( be == NULL ) {
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, default_referral, NULL );
Debug(LDAP_DEBUG_TRACE, "=> ldbm_back_search\n", 0, 0, 0);
- /* get entry with reader lock */
- if ( deref & LDAP_DEREF_FINDING ) {
+ if ( *nbase == '\0' ) {
+ /* DIT root special case */
+ static const Entry root = { NOID, "", "", NULL, NULL };
+ e = (Entry *) &root;
+
+ /* need normalized dn below */
+ realbase = ch_strdup( e->e_ndn );
+
+ candidates = search_candidates( be, e, filter,
+ scope, deref, manageDSAit );
+
+ goto searchit;
+
+ } else if ( deref & LDAP_DEREF_FINDING ) {
+ /* deref dn and get entry with reader lock */
e = deref_dn_r( be, nbase, &err, &matched, &text );
} else {
+ /* get entry with reader lock */
e = dn2entry_r( be, nbase, &matched );
err = e != NULL ? LDAP_SUCCESS : LDAP_REFERRAL;
text = NULL;
deref = LDAP_DEREF_NEVER;
}
- if ( tlimit == 0 && be_isroot( be, op->o_ndn ) ) {
- tlimit = -1; /* allow root to set no limit */
- } else {
- tlimit = (tlimit > be->be_timelimit || tlimit < 1) ?
- be->be_timelimit : tlimit;
- stoptime = op->o_time + tlimit;
- }
-
- if ( slimit == 0 && be_isroot( be, op->o_ndn ) ) {
- slimit = -1; /* allow root to set no limit */
- } else {
- slimit = (slimit > be->be_sizelimit || slimit < 1) ?
- be->be_sizelimit : slimit;
- }
-
if ( scope == LDAP_SCOPE_BASE ) {
candidates = base_candidate( be, e );
cache_return_entry_r( &li->li_cache, e );
+searchit:
if ( candidates == NULL ) {
/* no candidates */
Debug( LDAP_DEBUG_TRACE, "ldbm_search: no candidates\n",
goto done;
}
+ if ( tlimit == 0 && be_isroot( be, op->o_ndn ) ) {
+ tlimit = -1; /* allow root to set no limit */
+ } else {
+ tlimit = (tlimit > be->be_timelimit || tlimit < 1) ?
+ be->be_timelimit : tlimit;
+ stoptime = op->o_time + tlimit;
+ }
+
+ if ( slimit == 0 && be_isroot( be, op->o_ndn ) ) {
+ slimit = -1; /* allow root to set no limit */
+ } else {
+ slimit = (slimit > be->be_sizelimit || slimit < 1) ?
+ be->be_sizelimit : slimit;
+ }
+
for ( id = idl_firstid( candidates, &cursor ); id != NOID;
id = idl_nextid( candidates, &cursor ) )
{
}
Backend *
-select_backend( const char * dn )
+select_backend(
+ const char * dn,
+ int manageDSAit )
{
int i, j, len, dnlen;
+ Backend *be = NULL;
dnlen = strlen( dn );
for ( i = 0; i < nbackends; i++ ) {
}
if ( strcmp( backends[i].be_nsuffix[j],
- dn + (dnlen - len) ) == 0 ) {
- return( &backends[i] );
+ dn + (dnlen - len) ) == 0 )
+ {
+ if( be == NULL ) {
+ be = &backends[i];
+
+ if( manageDSAit && len == dnlen ) {
+ continue;
+ }
+ } else {
+ be = &backends[i];
+ }
+ return be;
}
}
}
- return( NULL );
+ return be;
}
int
if( strcmp( target->e_ndn, gr_ndn ) != 0 ) {
/* we won't attempt to send it to a different backend */
- be = select_backend(gr_ndn);
+ be = select_backend(gr_ndn, 0);
if (be == NULL) {
return LDAP_NO_SUCH_OBJECT;
if( target == NULL || strcmp( target->e_ndn, e_ndn ) != 0 ) {
/* we won't attempt to send it to a different backend */
- be = select_backend(e_ndn);
+ be = select_backend(e_ndn, 0);
if (be == NULL) {
return LDAP_NO_SUCH_OBJECT;
* if we don't hold it.
*/
- if ( (be = select_backend( ndn )) == NULL ) {
+ if ( (be = select_backend( ndn, 0 )) == NULL ) {
if ( default_referral ) {
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, default_referral, NULL );
Backend *be;
int rc = LDAP_SUCCESS;
const char *text = NULL;
+ int manageDSAit;
ava.aa_desc = NULL;
desc.bv_val = NULL;
goto cleanup;
}
+ manageDSAit = get_manageDSAit( op );
+
/*
* We could be serving multiple database backends. Select the
* appropriate one, or send a referral to our "referral server"
* if we don't hold it.
*/
- if ( (be = select_backend( ndn )) == NULL ) {
+ if ( (be = select_backend( ndn, manageDSAit )) == NULL ) {
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, default_referral, NULL );
rc = 1;
Debug( LDAP_DEBUG_ANY,
"%s: line %d: suffix line must appear inside a database definition (ignored)\n",
fname, lineno, 0 );
- } else if ( ( tmp_be = select_backend( cargv[1] ) ) == be ) {
+ } else if ( ( tmp_be = select_backend( cargv[1], 0 ) ) == be ) {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: suffix already served by this backend (ignored)\n",
fname, lineno, 0 );
"%s: line %d: suffixAlias line"
" must appear inside a database definition (ignored)\n",
fname, lineno, 0 );
- } else if ( (tmp_be = select_backend( cargv[1] )) != NULL ) {
+ } else if ( (tmp_be = select_backend( cargv[1], 0 )) != NULL ) {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: suffixAlias served by"
" a preceeding backend \"%s\" (ignored)\n",
fname, lineno, tmp_be->be_suffix[0] );
- } else if ( (tmp_be = select_backend( cargv[2] )) != NULL ) {
+ } else if ( (tmp_be = select_backend( cargv[2], 0 )) != NULL ) {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: suffixAlias derefs to differnet backend"
" a preceeding backend \"%s\" (ignored)\n",
const char *text;
Backend *be;
int rc;
+ int manageDSAit;
Debug( LDAP_DEBUG_TRACE, "do_delete\n", 0, 0, 0 );
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d DEL dn=\"%s\"\n",
op->o_connid, op->o_opid, dn, 0, 0 );
+ manageDSAit = get_manageDSAit( op );
+
/*
* We could be serving multiple database backends. Select the
* appropriate one, or send a referral to our "referral server"
* if we don't hold it.
*/
- if ( (be = select_backend( ndn )) == NULL ) {
+ if ( (be = select_backend( ndn, manageDSAit )) == NULL ) {
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, default_referral, NULL );
goto cleanup;
Backend *be;
int rc;
const char *text;
+ int manageDSAit;
Debug( LDAP_DEBUG_TRACE, "do_modify\n", 0, 0, 0 );
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d MOD dn=\"%s\"\n",
op->o_connid, op->o_opid, dn, 0, 0 );
+ manageDSAit = get_manageDSAit( op );
+
/*
* We could be serving multiple database backends. Select the
* appropriate one, or send a referral to our "referral server"
* if we don't hold it.
*/
- if ( (be = select_backend( ndn )) == NULL ) {
+ if ( (be = select_backend( ndn, manageDSAit )) == NULL ) {
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, default_referral, NULL );
goto cleanup;
ber_len_t length;
int rc;
const char *text;
+ int manageDSAit;
Debug( LDAP_DEBUG_TRACE, "do_modrdn\n", 0, 0, 0 );
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d MODRDN dn=\"%s\"\n",
op->o_connid, op->o_opid, dn, 0, 0 );
+ manageDSAit = get_manageDSAit( op );
+
/*
* We could be serving multiple database backends. Select the
* appropriate one, or send a referral to our "referral server"
* if we don't hold it.
*/
-
- if ( (be = select_backend( ndn )) == NULL ) {
+ if ( (be = select_backend( ndn, manageDSAit )) == NULL ) {
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, default_referral, NULL );
goto cleanup;
* the same backend, otherwise we return an error.
*/
if( newSuperior != NULL ) {
- newSuperior_be = select_backend( nnewSuperior );
+ newSuperior_be = select_backend( nnewSuperior, 0 );
if ( newSuperior_be != be ) {
/* newSuperior is in same backend */
LDAP_SLAPD_F (BackendInfo *) backend_info LDAP_P(( const char *type ));
LDAP_SLAPD_F (BackendDB *) backend_db_init LDAP_P(( const char *type ));
-LDAP_SLAPD_F (BackendDB *) select_backend LDAP_P(( const char * dn ));
+LDAP_SLAPD_F (BackendDB *) select_backend LDAP_P((
+ const char * dn,
+ int manageDSAit ));
LDAP_SLAPD_F (int) be_issuffix LDAP_P(( Backend *be, const char *suffix ));
LDAP_SLAPD_F (int) be_isroot LDAP_P(( Backend *be, const char *ndn ));
char *desc,
unsigned flags,
slap_syntax_validate_func *validate,
- slap_syntax_transform_func *ber2str,
- slap_syntax_transform_func *str2ber ));
+ slap_syntax_transform_func *normalize,
+ slap_syntax_transform_func *pretty ));
LDAP_SLAPD_F (int) register_matching_rule LDAP_P((
char * desc,
Backend *be;
int rc;
const char *text;
+ int manageDSAit;
Debug( LDAP_DEBUG_TRACE, "do_search\n", 0, 0, 0 );
nbase = ch_strdup( default_search_nbase );
}
+ manageDSAit = get_manageDSAit( op );
+
/*
* We could be serving multiple database backends. Select the
* appropriate one, or send a referral to our "referral server"
* if we don't hold it.
*/
- if ( (be = select_backend( nbase )) == NULL ) {
+ if ( (be = select_backend( nbase, manageDSAit )) == NULL ) {
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, default_referral, NULL );
}
/* check backend */
- if( select_backend( e->e_ndn ) != be ) {
+ if( select_backend( e->e_ndn, is_entry_referral(e) ) != be )
+ {
fprintf( stderr, "%s: database (%s) not configured to "
"hold dn=\"%s\" (line=%d)\n",
progname,
exit( EXIT_FAILURE );
}
- be = select_backend( tbase );
+ be = select_backend( tbase, 0 );
free( tbase );
if( be == NULL ) {