mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-23 16:19:35 -05:00
A simple (and correct) backend group selection.
This commit is contained in:
parent
7dc76e7139
commit
e4a9292d74
1 changed files with 12 additions and 34 deletions
|
|
@ -644,44 +644,22 @@ backend_group(
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int dnlen, i;
|
if( strcmp( target->e_ndn, gr_ndn ) != 0 ) {
|
||||||
Backend *gr_be = NULL;
|
/* we won't attempt to send it to a different backend */
|
||||||
|
|
||||||
|
be = select_backend(gr_ndn);
|
||||||
|
|
||||||
dnlen = strlen( gr_ndn );
|
if (be == NULL) {
|
||||||
if (be != NULL && be->be_nsuffix != NULL) {
|
return LDAP_NO_SUCH_OBJECT;
|
||||||
/* 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(be->be_nsuffix[i], gr_ndn + (dnlen - len)) == 0) {
|
|
||||||
gr_be = be;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( be->be_group ) {
|
||||||
|
return be->be_group( be, target, gr_ndn, op_ndn,
|
||||||
|
group_oc, group_at );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gr_be == NULL) {
|
return LDAP_UNWILLING_TO_PERFORM;
|
||||||
/* 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLAPD_SCHEMA_DN
|
#ifdef SLAPD_SCHEMA_DN
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue