}
- if ( len && len < dnlen && !DN_SEPARATOR( dn[(dnlen-len)-1] ) ) {
+ if ( len && len < dnlen && ( !DN_SEPARATOR( dn[(dnlen-len)-1] ) || DN_ESCAPE( dn[(dnlen-len)-2] ) ) ) {
/* make sure we have a separator */
continue;
}
return(rc);
}
+int
+be_isupdate( Backend *be, const char *ndn )
+{
+ int rc;
+
+ if ( ndn == NULL || *ndn == '\0' ) {
+ return( 0 );
+ }
+
+ if ( be->be_update_ndn == NULL || *be->be_update_ndn == '\0' ) {
+ return( 0 );
+ }
+
+ rc = strcmp( be->be_update_ndn, ndn ) ? 0 : 1;
+
+ return(rc);
+}
+
char *
be_root_dn( Backend *be )
{
AttributeDescription *group_at
)
{
+ GroupAssertion *g;
+ int len = strlen(gr_ndn);
+ int i;
+
+ ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
+ i = op->o_abandon;
+ ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
+ if (i)
+ return SLAPD_ABANDON;
+
if( strcmp( target->e_ndn, gr_ndn ) != 0 ) {
/* we won't attempt to send it to a different backend */
}
}
+ ldap_pvt_thread_mutex_lock( &conn->c_mutex );
+ for (g = conn->c_groups; g; g=g->next) {
+ if (g->be != be || g->oc != group_oc || g->at != group_at ||
+ g->len != len)
+ continue;
+ if (strcmp( g->ndn, gr_ndn ) == 0)
+ break;
+ }
+ ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
+ if (g)
+ return g->res;
+
if( be->be_group ) {
- return be->be_group( be, conn, op,
+ int res = be->be_group( be, conn, op,
target, gr_ndn, op_ndn,
group_oc, group_at );
+
+ if (op->o_tag != LDAP_REQ_BIND) {
+ g = ch_malloc(sizeof(GroupAssertion) + len);
+ g->be = be;
+ g->oc = group_oc;
+ g->at = group_at;
+ g->res = res;
+ g->len = len;
+ strcpy(g->ndn, gr_ndn);
+ ldap_pvt_thread_mutex_lock( &conn->c_mutex );
+ g->next = conn->c_groups;
+ conn->c_groups = g;
+ ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
+ }
+
+ return res;
}
return LDAP_UNWILLING_TO_PERFORM;