From e4a9292d741516a2bdce623ce46b8a2c7c2c3ebe Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Mon, 5 Jun 2000 07:38:23 +0000 Subject: [PATCH] A simple (and correct) backend group selection. --- servers/slapd/backend.c | 46 +++++++++++------------------------------ 1 file changed, 12 insertions(+), 34 deletions(-) diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index be9b3d0647..751a056ceb 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -644,44 +644,22 @@ backend_group( #endif ) { - int dnlen, i; - Backend *gr_be = NULL; - - dnlen = strlen( gr_ndn ); - if (be != NULL && be->be_nsuffix != NULL) { - /* search through all the backend suffixes - * to see if the group dn belongs to this - * backend. - */ - for ( i = 0; - be->be_nsuffix[i] != NULL; - i++ ) - { - int len = strlen( be->be_nsuffix[i] ); - if ( len > dnlen ) - continue; + if( strcmp( target->e_ndn, gr_ndn ) != 0 ) { + /* we won't attempt to send it to a different backend */ + + be = select_backend(gr_ndn); - if (strcmp(be->be_nsuffix[i], gr_ndn + (dnlen - len)) == 0) { - gr_be = be; - break; - } + if (be == NULL) { + return LDAP_NO_SUCH_OBJECT; } + } + + if( be->be_group ) { + return be->be_group( be, target, gr_ndn, op_ndn, + group_oc, group_at ); } - if (gr_be == NULL) { - /* if the gr_ndn does not belong to - * the given backend, then find the - * backend that it does belong to. - */ - gr_be = select_backend(gr_ndn); - if (gr_be == NULL) - return(1); - } - if (gr_be->be_group) - return( gr_be->be_group(gr_be, target, gr_ndn, op_ndn, - group_oc, group_at) ); - else - return LDAP_UNWILLING_TO_PERFORM; + return LDAP_UNWILLING_TO_PERFORM; } #ifdef SLAPD_SCHEMA_DN -- 2.39.5