1 /* dynlist.c - dynamic list overlay */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2003-2008 The OpenLDAP Foundation.
6 * Portions Copyright 2004-2005 Pierangelo Masarati.
7 * Portions Copyright 2008 Emmanuel Dreyfus.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted only as authorized by the OpenLDAP
14 * A copy of this license is available in the file LICENSE in the
15 * top-level directory of the distribution or, alternatively, at
16 * <http://www.OpenLDAP.org/license.html>.
19 * This work was initially developed by Pierangelo Masarati
20 * for SysNet s.n.c., for inclusion in OpenLDAP Software.
25 #ifdef SLAPD_OVER_DYNLIST
27 #if LDAP_VENDOR_VERSION_MINOR == X || LDAP_VENDOR_VERSION_MINOR > 3
28 #if SLAPD_OVER_DYNGROUP != SLAPD_MOD_STATIC
29 #define TAKEOVER_DYNGROUP
32 #if LDAP_VENDOR_VERSION_MINOR < 3
39 #include <ac/string.h>
47 /* FIXME: the code differs if SLAP_OPATTRS is defined or not;
48 * SLAP_OPATTRS is not defined in 2.2 yet, while this overlay
49 * expects HEAD code at least later than August 6, 2004. */
50 /* FIXME: slap_anlist_no_attrs was introduced in 2.3; here it
51 * is anticipated to allow using this overlay with 2.2. */
54 static AttributeName anlist_no_attrs[] = {
55 { BER_BVC( LDAP_NO_ATTRS ), NULL, 0, NULL },
56 { BER_BVNULL, NULL, 0, NULL }
59 static AttributeName *slap_anlist_no_attrs = anlist_no_attrs;
62 static AttributeDescription *ad_dgIdentity, *ad_dgAuthz;
64 typedef struct dynlist_map_t {
65 AttributeDescription *dlm_member_ad;
66 AttributeDescription *dlm_mapped_ad;
67 struct dynlist_map_t *dlm_next;
70 typedef struct dynlist_info_t {
72 AttributeDescription *dli_ad;
73 struct dynlist_map_t *dli_dlm;
74 struct berval dli_default_filter;
75 struct dynlist_info_t *dli_next;
78 #define DYNLIST_USAGE \
79 "\"dynlist-attrset <oc> <URL-ad> [[<mapped-ad>:]<member-ad> ...]\": "
81 static dynlist_info_t *
82 dynlist_is_dynlist_next( Operation *op, SlapReply *rs, dynlist_info_t *old_dli )
84 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
89 if ( old_dli == NULL ) {
90 dli = (dynlist_info_t *)on->on_bi.bi_private;
93 dli = old_dli->dli_next;
96 a = attrs_find( rs->sr_entry->e_attrs, slap_schema.si_ad_objectClass );
98 /* FIXME: objectClass must be present; for non-storage
99 * backends, like back-ldap, it needs to be added
100 * to the requested attributes */
104 for ( ; dli; dli = dli->dli_next ) {
105 if ( attr_valfind( a,
106 SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
107 SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
108 &dli->dli_oc->soc_cname, NULL,
109 op->o_tmpmemctx ) == 0 )
119 dynlist_make_filter( Operation *op, struct berval *oldf, struct berval *newf )
121 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
122 dynlist_info_t *dli = (dynlist_info_t *)on->on_bi.bi_private;
126 assert( oldf != NULL );
127 assert( newf != NULL );
128 assert( !BER_BVISNULL( oldf ) );
129 assert( !BER_BVISEMPTY( oldf ) );
131 newf->bv_len = STRLENOF( "(&(!(objectClass=" "))" ")" )
132 + dli->dli_oc->soc_cname.bv_len + oldf->bv_len;
133 newf->bv_val = op->o_tmpalloc( newf->bv_len + 1, op->o_tmpmemctx );
134 if ( newf->bv_val == NULL ) {
137 ptr = lutil_strcopy( newf->bv_val, "(&(!(objectClass=" );
138 ptr = lutil_strcopy( ptr, dli->dli_oc->soc_cname.bv_val );
139 ptr = lutil_strcopy( ptr, "))" );
140 ptr = lutil_strcopy( ptr, oldf->bv_val );
141 ptr = lutil_strcopy( ptr, ")" );
142 newf->bv_len = ptr - newf->bv_val;
147 typedef struct dynlist_sc_t {
148 dynlist_info_t *dlc_dli;
153 dynlist_sc_update( Operation *op, SlapReply *rs )
159 AccessControlState acl_state = ACL_STATE_INIT;
164 if ( rs->sr_type != REP_SEARCH ) {
168 dlc = (dynlist_sc_t *)op->o_callback->sc_private;
172 assert( rs->sr_entry != NULL );
174 /* test access to entry */
175 if ( !access_allowed( op, rs->sr_entry, slap_schema.si_ad_entry,
176 NULL, ACL_READ, NULL ) )
181 /* if there is only one member_ad, and it's not mapped,
182 * consider it as old-style member listing */
183 dlm = dlc->dlc_dli->dli_dlm;
184 if ( dlm && dlm->dlm_mapped_ad == NULL && dlm->dlm_next == NULL ) {
185 /* if access allowed, try to add values, emulating permissive
186 * control to silently ignore duplicates */
187 if ( access_allowed( op, rs->sr_entry, slap_schema.si_ad_entry,
188 NULL, ACL_READ, NULL ) )
191 const char *text = NULL;
193 struct berval vals[ 2 ], nvals[ 2 ];
195 vals[ 0 ] = rs->sr_entry->e_name;
196 BER_BVZERO( &vals[ 1 ] );
197 nvals[ 0 ] = rs->sr_entry->e_nname;
198 BER_BVZERO( &nvals[ 1 ] );
200 mod.sm_op = LDAP_MOD_ADD;
201 mod.sm_desc = dlm->dlm_member_ad;
202 mod.sm_type = dlm->dlm_member_ad->ad_cname;
203 mod.sm_values = vals;
204 mod.sm_nvalues = nvals;
207 (void)modify_add_values( e, &mod, /* permissive */ 1,
208 &text, textbuf, sizeof( textbuf ) );
215 opattrs = ( rs->sr_attrs == NULL ) ? 0 : an_find( rs->sr_attrs, &AllOper );
216 userattrs = ( rs->sr_attrs == NULL ) ? 1 : an_find( rs->sr_attrs, &AllUser );
217 #else /* SLAP_OPATTRS */
218 opattrs = SLAP_OPATTRS( rs->sr_attr_flags );
219 userattrs = SLAP_USERATTRS( rs->sr_attr_flags );
220 #endif /* SLAP_OPATTRS */
222 for ( a = rs->sr_entry->e_attrs; a != NULL; a = a->a_next ) {
223 BerVarray vals, nvals = NULL;
225 is_oc = a->a_desc == slap_schema.si_ad_objectClass;
227 /* if attribute is not requested, skip it */
228 if ( rs->sr_attrs == NULL ) {
229 if ( is_at_operational( a->a_desc->ad_type ) ) {
234 if ( is_at_operational( a->a_desc->ad_type ) ) {
235 if ( !opattrs && !ad_inlist( a->a_desc, rs->sr_attrs ) )
241 if ( !userattrs && !ad_inlist( a->a_desc, rs->sr_attrs ) )
248 /* test access to attribute */
249 if ( op->ors_attrsonly ) {
250 if ( !access_allowed( op, rs->sr_entry, a->a_desc, NULL,
251 ACL_READ, &acl_state ) )
257 /* single-value check: keep first only */
258 if ( is_at_single_value( a->a_desc->ad_type ) ) {
259 if ( attr_find( e->e_attrs, a->a_desc ) != NULL ) {
264 /* test access to attribute */
267 vals = op->o_tmpalloc( ( i + 1 ) * sizeof( struct berval ), op->o_tmpmemctx );
268 if ( a->a_nvals != a->a_vals ) {
269 nvals = op->o_tmpalloc( ( i + 1 ) * sizeof( struct berval ), op->o_tmpmemctx );
272 for ( i = 0, j = 0; !BER_BVISNULL( &a->a_vals[i] ); i++ ) {
274 ObjectClass *soc = oc_bvfind( &a->a_vals[i] );
276 if ( soc->soc_kind == LDAP_SCHEMA_STRUCTURAL ) {
281 if ( access_allowed( op, rs->sr_entry, a->a_desc,
282 &a->a_nvals[i], ACL_READ, &acl_state ) )
284 vals[j] = a->a_vals[i];
286 nvals[j] = a->a_nvals[i];
292 /* if access allowed, try to add values, emulating permissive
293 * control to silently ignore duplicates */
296 const char *text = NULL;
299 AttributeDescription *ad;
301 BER_BVZERO( &vals[j] );
303 BER_BVZERO( &nvals[j] );
307 for ( dlm = dlc->dlc_dli->dli_dlm; dlm; dlm = dlm->dlm_next ) {
308 if ( dlm->dlm_member_ad == a->a_desc ) {
309 if ( dlm->dlm_mapped_ad ) {
310 ad = dlm->dlm_mapped_ad;
316 mod.sm_op = LDAP_MOD_ADD;
318 mod.sm_type = ad->ad_cname;
319 mod.sm_values = vals;
320 mod.sm_nvalues = nvals;
323 (void)modify_add_values( e, &mod, /* permissive */ 1,
324 &text, textbuf, sizeof( textbuf ) );
327 op->o_tmpfree( vals, op->o_tmpmemctx );
329 op->o_tmpfree( nvals, op->o_tmpmemctx );
334 if ( rs->sr_flags & REP_ENTRY_MUSTBEFREED ) {
335 entry_free( rs->sr_entry );
337 rs->sr_flags ^= REP_ENTRY_MUSTBEFREED;
344 dynlist_prepare_entry( Operation *op, SlapReply *rs, dynlist_info_t *dli )
346 Attribute *a, *id = NULL;
349 SlapReply r = { REP_SEARCH };
355 dynlist_sc_t dlc = { 0 };
358 a = attrs_find( rs->sr_entry->e_attrs, dli->dli_ad );
361 return SLAP_CB_CONTINUE;
365 opattrs = ( rs->sr_attrs == NULL ) ? 0 : an_find( rs->sr_attrs, &AllOper );
366 userattrs = ( rs->sr_attrs == NULL ) ? 1 : an_find( rs->sr_attrs, &AllUser );
367 #else /* SLAP_OPATTRS */
368 opattrs = SLAP_OPATTRS( rs->sr_attr_flags );
369 userattrs = SLAP_USERATTRS( rs->sr_attr_flags );
370 #endif /* SLAP_OPATTRS */
372 /* Don't generate member list if it wasn't requested */
373 for ( dlm = dli->dli_dlm; dlm; dlm = dlm->dlm_next ) {
375 ad_inlist( dlm->dlm_member_ad, rs->sr_attrs ) )
378 if ( dli->dli_dlm && !dlm )
379 return SLAP_CB_CONTINUE;
381 if ( ad_dgIdentity && ( id = attrs_find( rs->sr_entry->e_attrs, ad_dgIdentity ))) {
382 Attribute *authz = NULL;
384 /* if not rootdn and dgAuthz is present,
385 * check if user can be authorized as dgIdentity */
386 if ( ad_dgAuthz && !BER_BVISEMPTY( &id->a_nvals[0] ) && !be_isroot( op )
387 && ( authz = attrs_find( rs->sr_entry->e_attrs, ad_dgAuthz ) ) )
389 if ( slap_sasl_matches( op, authz->a_nvals,
390 &o.o_ndn, &o.o_ndn ) != LDAP_SUCCESS )
392 return SLAP_CB_CONTINUE;
396 o.o_dn = id->a_vals[0];
397 o.o_ndn = id->a_nvals[0];
401 if ( !( rs->sr_flags & REP_ENTRY_MODIFIABLE ) ) {
402 e = entry_dup( rs->sr_entry );
406 e_flags = rs->sr_flags | ( REP_ENTRY_MODIFIABLE | REP_ENTRY_MUSTBEFREED );
410 cb.sc_private = &dlc;
411 cb.sc_response = dynlist_sc_update;
412 cb.sc_cleanup = NULL;
416 o.ors_deref = LDAP_DEREF_NEVER;
418 o.ors_tlimit = SLAP_NO_LIMIT;
419 o.ors_slimit = SLAP_NO_LIMIT;
421 for ( url = a->a_nvals; !BER_BVISNULL( url ); url++ ) {
422 LDAPURLDesc *lud = NULL;
428 BER_BVZERO( &o.o_req_dn );
429 BER_BVZERO( &o.o_req_ndn );
432 BER_BVZERO( &o.ors_filterstr );
434 if ( ldap_url_parse( url->bv_val, &lud ) != LDAP_URL_SUCCESS ) {
439 if ( lud->lud_host != NULL ) {
440 /* FIXME: host not allowed; reject as illegal? */
441 Debug( LDAP_DEBUG_ANY, "dynlist_prepare_entry(\"%s\"): "
442 "illegal URI \"%s\"\n",
443 e->e_name.bv_val, url->bv_val, 0 );
447 if ( lud->lud_dn == NULL ) {
448 /* note that an empty base is not honored in terms
449 * of defaultSearchBase, because select_backend()
450 * is not aware of the defaultSearchBase option;
451 * this can be useful in case of a database serving
452 * the empty suffix */
453 BER_BVSTR( &dn, "" );
456 ber_str2bv( lud->lud_dn, 0, 0, &dn );
458 rc = dnPrettyNormal( NULL, &dn, &o.o_req_dn, &o.o_req_ndn, op->o_tmpmemctx );
459 if ( rc != LDAP_SUCCESS ) {
463 o.ors_scope = lud->lud_scope;
465 for ( dlm = dli->dli_dlm; dlm; dlm = dlm->dlm_next ) {
466 if ( dlm->dlm_mapped_ad != NULL ) {
471 if ( dli->dli_dlm && !dlm ) {
472 /* if ( lud->lud_attrs != NULL ),
473 * the URL should be ignored */
474 o.ors_attrs = slap_anlist_no_attrs;
476 } else if ( lud->lud_attrs == NULL ) {
477 o.ors_attrs = rs->sr_attrs;
480 for ( i = 0; lud->lud_attrs[i]; i++)
483 o.ors_attrs = op->o_tmpcalloc( i + 1, sizeof( AttributeName ), op->o_tmpmemctx );
484 for ( i = 0, j = 0; lud->lud_attrs[i]; i++) {
485 const char *text = NULL;
487 ber_str2bv( lud->lud_attrs[i], 0, 0, &o.ors_attrs[j].an_name );
488 o.ors_attrs[j].an_desc = NULL;
489 (void)slap_bv2ad( &o.ors_attrs[j].an_name, &o.ors_attrs[j].an_desc, &text );
490 /* FIXME: ignore errors... */
492 if ( rs->sr_attrs == NULL ) {
493 if ( o.ors_attrs[j].an_desc != NULL &&
494 is_at_operational( o.ors_attrs[j].an_desc->ad_type ) )
500 if ( o.ors_attrs[j].an_desc != NULL &&
501 is_at_operational( o.ors_attrs[j].an_desc->ad_type ) )
503 if ( !opattrs && !ad_inlist( o.ors_attrs[j].an_desc, rs->sr_attrs ) )
510 o.ors_attrs[j].an_desc != NULL &&
511 !ad_inlist( o.ors_attrs[j].an_desc, rs->sr_attrs ) )
525 BER_BVZERO( &o.ors_attrs[j].an_name );
528 if ( lud->lud_filter == NULL ) {
529 ber_dupbv_x( &o.ors_filterstr,
530 &dli->dli_default_filter, op->o_tmpmemctx );
534 ber_str2bv( lud->lud_filter, 0, 0, &flt );
535 if ( dynlist_make_filter( op, &flt, &o.ors_filterstr ) ) {
540 o.ors_filter = str2filter_x( op, o.ors_filterstr.bv_val );
541 if ( o.ors_filter == NULL ) {
545 o.o_bd = select_backend( &o.o_req_ndn, 1 );
546 if ( o.o_bd && o.o_bd->be_search ) {
548 r.sr_attr_flags = slap_attr_flags( o.ors_attrs );
549 #endif /* SLAP_OPATTRS */
550 (void)o.o_bd->be_search( &o, &r );
555 slap_op_groups_free( &o );
557 if ( o.ors_filter ) {
558 filter_free_x( &o, o.ors_filter );
560 if ( o.ors_attrs && o.ors_attrs != rs->sr_attrs
561 && o.ors_attrs != slap_anlist_no_attrs )
563 op->o_tmpfree( o.ors_attrs, op->o_tmpmemctx );
565 if ( !BER_BVISNULL( &o.o_req_dn ) ) {
566 op->o_tmpfree( o.o_req_dn.bv_val, op->o_tmpmemctx );
568 if ( !BER_BVISNULL( &o.o_req_ndn ) ) {
569 op->o_tmpfree( o.o_req_ndn.bv_val, op->o_tmpmemctx );
571 assert( BER_BVISNULL( &o.ors_filterstr )
572 || o.ors_filterstr.bv_val != lud->lud_filter );
573 op->o_tmpfree( o.ors_filterstr.bv_val, op->o_tmpmemctx );
574 ldap_free_urldesc( lud );
578 rs->sr_flags = e_flags;
580 return SLAP_CB_CONTINUE;
584 dynlist_sc_save_entry( Operation *op, SlapReply *rs )
586 /* save the entry in the private field of the callback,
587 * so it doesn't get freed (it's temporary!) */
588 if ( rs->sr_entry != NULL ) {
589 dynlist_sc_t *dlc = (dynlist_sc_t *)op->o_callback->sc_private;
590 dlc->dlc_e = rs->sr_entry;
598 dynlist_compare( Operation *op, SlapReply *rs )
600 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
601 dynlist_info_t *dli = (dynlist_info_t *)on->on_bi.bi_private;
606 for ( ; dli != NULL; dli = dli->dli_next ) {
607 for ( dlm = dli->dli_dlm; dlm; dlm = dlm->dlm_next )
608 if ( op->oq_compare.rs_ava->aa_desc == dlm->dlm_member_ad )
611 if ( dli->dli_dlm && dlm ) {
612 /* This compare is for one of the attributes we're
613 * interested in. We'll use slapd's existing dyngroup
614 * evaluator to get the answer we want.
616 BerVarray id = NULL, authz = NULL;
618 o.o_do_not_cache = 1;
620 if ( ad_dgIdentity && backend_attribute( &o, NULL, &o.o_req_ndn,
621 ad_dgIdentity, &id, ACL_READ ) == LDAP_SUCCESS )
623 /* if not rootdn and dgAuthz is present,
624 * check if user can be authorized as dgIdentity */
625 if ( ad_dgAuthz && !BER_BVISEMPTY( id ) && !be_isroot( op )
626 && backend_attribute( &o, NULL, &o.o_req_ndn,
627 ad_dgAuthz, &authz, ACL_READ ) == LDAP_SUCCESS )
630 rs->sr_err = slap_sasl_matches( op, authz,
631 &o.o_ndn, &o.o_ndn );
632 ber_bvarray_free_x( authz, op->o_tmpmemctx );
633 if ( rs->sr_err != LDAP_SUCCESS ) {
640 o.o_groups = NULL; /* authz changed, invalidate cached groups */
643 rs->sr_err = backend_group( &o, NULL, &o.o_req_ndn,
644 &o.oq_compare.rs_ava->aa_value, dli->dli_oc, dli->dli_ad );
645 switch ( rs->sr_err ) {
647 rs->sr_err = LDAP_COMPARE_TRUE;
650 case LDAP_NO_SUCH_OBJECT:
651 /* NOTE: backend_group() returns noSuchObject
652 * if op_ndn does not exist; however, since
653 * dynamic list expansion means that the
654 * member attribute is virtually present, the
655 * non-existence of the asserted value implies
656 * the assertion is FALSE rather than
658 rs->sr_err = LDAP_COMPARE_FALSE;
663 if ( id ) ber_bvarray_free_x( id, o.o_tmpmemctx );
665 return SLAP_CB_CONTINUE;
669 if ( overlay_entry_get_ov( &o, &o.o_req_ndn, NULL, NULL, 0, &e, on ) !=
670 LDAP_SUCCESS || e == NULL )
672 return SLAP_CB_CONTINUE;
675 if ( ad_dgIdentity ) {
676 Attribute *id = attrs_find( e->e_attrs, ad_dgIdentity );
680 /* if not rootdn and dgAuthz is present,
681 * check if user can be authorized as dgIdentity */
682 if ( ad_dgAuthz && !BER_BVISEMPTY( &id->a_nvals[0] ) && !be_isroot( op )
683 && ( authz = attrs_find( e->e_attrs, ad_dgAuthz ) ) )
685 if ( slap_sasl_matches( op, authz->a_nvals,
686 &o.o_ndn, &o.o_ndn ) != LDAP_SUCCESS )
692 o.o_dn = id->a_vals[0];
693 o.o_ndn = id->a_nvals[0];
698 dli = (dynlist_info_t *)on->on_bi.bi_private;
699 for ( ; dli != NULL && rs->sr_err != LDAP_COMPARE_TRUE; dli = dli->dli_next ) {
702 SlapReply r = { REP_SEARCH };
705 dynlist_sc_t dlc = { 0 };
707 if ( !is_entry_objectclass_or_sub( e, dli->dli_oc ))
710 /* if the entry has the right objectClass, generate
711 * the dynamic list and compare */
713 cb.sc_private = &dlc;
714 cb.sc_response = dynlist_sc_save_entry;
715 cb.sc_cleanup = NULL;
719 o.o_tag = LDAP_REQ_SEARCH;
721 o.ors_tlimit = SLAP_NO_LIMIT;
722 o.ors_slimit = SLAP_NO_LIMIT;
724 o.o_bd = select_backend( &o.o_req_ndn, 1 );
725 if ( !o.o_bd || !o.o_bd->be_search ) {
729 o.ors_filterstr = *slap_filterstr_objectClass_pres;
730 o.ors_filter = (Filter *) slap_filter_objectClass_pres;
732 o.ors_scope = LDAP_SCOPE_BASE;
733 o.ors_deref = LDAP_DEREF_NEVER;
734 an[0].an_name = op->orc_ava->aa_desc->ad_cname;
735 an[0].an_desc = op->orc_ava->aa_desc;
736 BER_BVZERO( &an[1].an_name );
740 o.o_acl_priv = ACL_COMPARE;
742 rc = o.o_bd->be_search( &o, &r );
744 if ( o.o_dn.bv_val != op->o_dn.bv_val ) {
745 slap_op_groups_free( &o );
752 if ( dlc.dlc_e != NULL ) {
753 r.sr_entry = dlc.dlc_e;
756 if ( r.sr_err != LDAP_SUCCESS || r.sr_entry == NULL ) {
761 for ( a = attrs_find( r.sr_entry->e_attrs, op->orc_ava->aa_desc );
763 a = attrs_find( a->a_next, op->orc_ava->aa_desc ) )
765 /* if we're here, we got a match... */
766 rs->sr_err = LDAP_COMPARE_FALSE;
768 if ( attr_valfind( a,
769 SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
770 SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
771 &op->orc_ava->aa_value, NULL, op->o_tmpmemctx ) == 0 )
773 rs->sr_err = LDAP_COMPARE_TRUE;
778 if ( r.sr_flags & REP_ENTRY_MUSTBEFREED ) {
779 entry_free( r.sr_entry );
785 overlay_entry_release_ov( op, e, 0, on );
788 return SLAP_CB_CONTINUE;
792 dynlist_response( Operation *op, SlapReply *rs )
796 switch ( op->o_tag ) {
797 case LDAP_REQ_SEARCH:
798 if ( rs->sr_type == REP_SEARCH && !get_manageDSAit( op ) )
802 for ( dli = dynlist_is_dynlist_next( op, rs, NULL );
804 dli = dynlist_is_dynlist_next( op, rs, dli ) )
806 rc = dynlist_prepare_entry( op, rs, dli );
809 if ( rc != LDAP_OTHER ) {
815 case LDAP_REQ_COMPARE:
816 switch ( rs->sr_err ) {
817 /* NOTE: we waste a few cycles running the dynamic list
818 * also when the result is FALSE, which occurs if the
819 * dynamic entry itself contains the AVA attribute */
820 /* FIXME: this approach is less than optimal; a dedicated
821 * compare op should be implemented, that fetches the
822 * entry, checks if it has the appropriate objectClass
823 * and, in case, runs a compare thru all the URIs,
824 * stopping at the first positive occurrence; see ITS#3756 */
825 case LDAP_COMPARE_FALSE:
826 case LDAP_NO_SUCH_ATTRIBUTE:
827 return dynlist_compare( op, rs );
835 return SLAP_CB_CONTINUE;
839 dynlist_build_def_filter( dynlist_info_t *dli )
843 dli->dli_default_filter.bv_len = STRLENOF( "(!(objectClass=" "))" )
844 + dli->dli_oc->soc_cname.bv_len;
845 dli->dli_default_filter.bv_val = ch_malloc( dli->dli_default_filter.bv_len + 1 );
846 if ( dli->dli_default_filter.bv_val == NULL ) {
847 Debug( LDAP_DEBUG_ANY, "dynlist_db_open: malloc failed.\n",
852 ptr = lutil_strcopy( dli->dli_default_filter.bv_val, "(!(objectClass=" );
853 ptr = lutil_strcopy( ptr, dli->dli_oc->soc_cname.bv_val );
854 ptr = lutil_strcopy( ptr, "))" );
856 assert( dli->dli_default_filter.bv_len == ptr - dli->dli_default_filter.bv_val );
870 slap_overinst *on = (slap_overinst *)be->bd_info;
874 if ( strcasecmp( argv[0], "dynlist-attrset" ) == 0 ) {
875 dynlist_info_t **dlip;
877 AttributeDescription *ad = NULL,
879 dynlist_map_t *dlm = NULL;
883 Debug( LDAP_DEBUG_ANY, "%s: line %d: " DYNLIST_USAGE
884 "invalid arg number #%d.\n",
885 fname, lineno, argc );
889 oc = oc_find( argv[1] );
891 Debug( LDAP_DEBUG_ANY, "%s: line %d: " DYNLIST_USAGE
892 "unable to find ObjectClass \"%s\"\n",
893 fname, lineno, argv[ 1 ] );
897 rc = slap_str2ad( argv[2], &ad, &text );
898 if ( rc != LDAP_SUCCESS ) {
899 Debug( LDAP_DEBUG_ANY, "%s: line %d: " DYNLIST_USAGE
900 "unable to find AttributeDescription \"%s\"\n",
901 fname, lineno, argv[2] );
905 if ( !is_at_subtype( ad->ad_type, slap_schema.si_ad_labeledURI->ad_type ) ) {
906 Debug( LDAP_DEBUG_ANY, "%s: line %d: " DYNLIST_USAGE
907 "AttributeDescription \"%s\" "
908 "must be a subtype of \"labeledURI\"\n",
909 fname, lineno, argv[2] );
913 for ( i = 3; i < argc; i++ ) {
916 AttributeDescription *member_ad = NULL;
917 AttributeDescription *mapped_ad = NULL;
923 * If no mapped attribute is given, dn is used
924 * for backward compatibility.
927 if ( cp = strchr( arg, (int)':' ) != NULL ) {
929 ber_str2bv( arg, cp - arg, 0, &bv );
930 rc = slap_bv2ad( &bv, &mapped_ad, &text );
931 if ( rc != LDAP_SUCCESS ) {
932 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
934 "unable to find mapped AttributeDescription \"%s\"\n",
935 fname, lineno, arg );
942 rc = slap_str2ad( arg, &member_ad, &text );
943 if ( rc != LDAP_SUCCESS ) {
944 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
946 "unable to find AttributeDescription \"%s\"\n",
947 fname, lineno, arg );
951 dlmp = (dynlist_map_t *)ch_calloc( 1, sizeof( dynlist_map_t ) );
956 dlmp->dlm_member_ad = member_ad;
957 dlmp->dlm_mapped_ad = mapped_ad;
958 dlmp->dlm_next = NULL;
961 dlml->dlm_next = dlmp;
965 for ( dlip = (dynlist_info_t **)&on->on_bi.bi_private;
966 *dlip; dlip = &(*dlip)->dli_next )
969 * The same URL attribute / member attribute pair
970 * cannot be repeated, but we enforce this only
971 * when the member attribute is unique. Performing
972 * the check for multiple values would require
973 * sorting and comparing the lists, which is left
974 * as a future improvement
976 if ( (*dlip)->dli_ad == ad &&
977 (*dlip)->dli_dlm->dlm_next == NULL &&
978 dlm->dlm_next == NULL &&
979 dlm->dlm_member_ad == (*dlip)->dli_dlm->dlm_member_ad &&
980 dlm->dlm_mapped_ad == (*dlip)->dli_dlm->dlm_mapped_ad ) {
981 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
983 "URL attributeDescription \"%s\" already mapped.\n",
984 fname, lineno, ad->ad_cname.bv_val );
986 /* make it a warning... */
992 *dlip = (dynlist_info_t *)ch_calloc( 1, sizeof( dynlist_info_t ) );
993 (*dlip)->dli_oc = oc;
994 (*dlip)->dli_ad = ad;
995 (*dlip)->dli_dlm = dlm;
997 if ( dynlist_build_def_filter( *dlip ) ) {
998 dynlist_map_t *dlm = (*dlip)->ldi_dlm;
999 dynlist_map_t *dlm_next;
1001 while ( dlm != NULL ) {
1002 dlm_next = dlm->dlm_next;
1012 /* allow dyngroup syntax */
1013 } else if ( strcasecmp( argv[0], "dynlist-attrpair" ) == 0 ) {
1014 dynlist_info_t **dlip;
1016 AttributeDescription *ad = NULL,
1021 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1022 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1023 "invalid arg number #%d.\n",
1024 fname, lineno, argc );
1028 oc = oc_find( "groupOfURLs" );
1030 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1031 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1032 "unable to find default ObjectClass \"groupOfURLs\"\n",
1037 rc = slap_str2ad( argv[1], &member_ad, &text );
1038 if ( rc != LDAP_SUCCESS ) {
1039 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1040 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1041 "unable to find AttributeDescription \"%s\"\n",
1042 fname, lineno, argv[1] );
1046 rc = slap_str2ad( argv[2], &ad, &text );
1047 if ( rc != LDAP_SUCCESS ) {
1048 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1049 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1050 "unable to find AttributeDescription \"%s\"\n",
1051 fname, lineno, argv[2] );
1055 if ( !is_at_subtype( ad->ad_type, slap_schema.si_ad_labeledURI->ad_type ) ) {
1056 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1057 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1058 "AttributeDescription \"%s\" "
1059 "must be a subtype of \"labeledURI\"\n",
1060 fname, lineno, argv[2] );
1064 for ( dlip = (dynlist_info_t **)&on->on_bi.bi_private;
1065 *dlip; dlip = &(*dlip)->dli_next )
1068 * The same URL attribute / member attribute pair
1069 * cannot be repeated, but we enforce this only
1070 * when the member attribute is unique. Performing
1071 * the check for multiple values would require
1072 * sorting and comparing the lists, which is left
1073 * as a future improvement
1075 if ( (*dlip)->dli_ad == ad &&
1076 (*dlip)->dli_dlm->dlm_next == NULL &&
1077 member_ad == (*dlip)->dli_dlm->dlm_member_ad ) {
1078 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1079 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1080 "URL attributeDescription \"%s\" already mapped.\n",
1081 fname, lineno, ad->ad_cname.bv_val );
1083 /* make it a warning... */
1089 *dlip = (dynlist_info_t *)ch_calloc( 1, sizeof( dynlist_info_t ) );
1090 (*dlip)->dli_oc = oc;
1091 (*dlip)->dli_ad = ad;
1092 (*dlip)->dli_dlm = (dynlist_map_t *)ch_calloc( 1, sizeof( dynlist_map_t ) );
1093 (*dlip)->dli_dlm->dlm_member_ad = member_ad;
1094 (*dlip)->dli_dlm->dlm_mapped_ad = NULL;
1096 if ( dynlist_build_def_filter( *dlip ) ) {
1097 ch_free( (*dlip)->dli_dlm );
1104 rc = SLAP_CONF_UNKNOWN;
1118 static ConfigDriver dl_cfgen;
1120 /* XXXmanu 255 is the maximum arguments we allow. Can we go beyond? */
1121 static ConfigTable dlcfg[] = {
1122 { "dynlist-attrset", "group-oc> <URL-ad> <member-ad",
1123 3, 255, 0, ARG_MAGIC|DL_ATTRSET, dl_cfgen,
1124 "( OLcfgOvAt:8.1 NAME 'olcDLattrSet' "
1125 "DESC 'Dynamic list: <group objectClass>, <URL attributeDescription>, <member attributeDescription>' "
1126 "EQUALITY caseIgnoreMatch "
1127 "SYNTAX OMsDirectoryString "
1128 "X-ORDERED 'VALUES' )",
1130 { "dynlist-attrpair", "member-ad> <URL-ad",
1131 3, 3, 0, ARG_MAGIC|DL_ATTRPAIR, dl_cfgen,
1133 #ifdef TAKEOVER_DYNGROUP
1134 { "attrpair", "member-ad> <URL-ad",
1135 3, 3, 0, ARG_MAGIC|DL_ATTRPAIR_COMPAT, dl_cfgen,
1138 { NULL, NULL, 0, 0, 0, ARG_IGNORED }
1141 static ConfigOCs dlocs[] = {
1142 { "( OLcfgOvOc:8.1 "
1143 "NAME 'olcDynamicList' "
1144 "DESC 'Dynamic list configuration' "
1145 "SUP olcOverlayConfig "
1146 "MAY olcDLattrSet )",
1147 Cft_Overlay, dlcfg, NULL, NULL },
1152 dl_cfgen( ConfigArgs *c )
1154 slap_overinst *on = (slap_overinst *)c->bi;
1155 dynlist_info_t *dli = (dynlist_info_t *)on->on_bi.bi_private;
1159 if ( c->op == SLAP_CONFIG_EMIT ) {
1162 for ( i = 0; dli; i++, dli = dli->dli_next ) {
1164 char *ptr = c->cr_msg;
1167 assert( dli->dli_oc != NULL );
1168 assert( dli->dli_ad != NULL );
1170 ptr += snprintf( c->cr_msg, sizeof( c->cr_msg ),
1171 SLAP_X_ORDERED_FMT "%s %s", i,
1172 dli->dli_oc->soc_cname.bv_val,
1173 dli->dli_ad->ad_cname.bv_val );
1175 for ( dlm = dli->dli_dlm; dlm; dlm = dlm->dlm_next ) {
1178 if ( dlm->dlm_mapped_ad ) {
1179 ptr = lutil_strcopy( ptr, dlm->dlm_mapped_ad->ad_cname.bv_val );
1184 ptr = lutil_strcopy( ptr, dlm->dlm_member_ad->ad_cname.bv_val );
1187 bv.bv_val = c->cr_msg;
1188 bv.bv_len = ptr - bv.bv_val;
1189 value_add_one( &c->rvalue_vals, &bv );
1193 case DL_ATTRPAIR_COMPAT:
1205 } else if ( c->op == LDAP_MOD_DELETE ) {
1208 if ( c->valx < 0 ) {
1209 dynlist_info_t *dli_next;
1211 for ( dli_next = dli; dli_next; dli = dli_next ) {
1212 dynlist_map_t *dlm = dli->dli_dlm;
1213 dynlist_map_t *dlm_next;
1215 dli_next = dli->dli_next;
1217 ch_free( dli->dli_default_filter.bv_val );
1219 while ( dlm != NULL ) {
1220 dlm_next = dlm->dlm_next;
1227 on->on_bi.bi_private = NULL;
1230 dynlist_info_t **dlip;
1232 dynlist_map_t *dlm_next;
1234 for ( i = 0, dlip = (dynlist_info_t **)&on->on_bi.bi_private;
1237 if ( *dlip == NULL ) {
1240 dlip = &(*dlip)->dli_next;
1244 *dlip = dli->dli_next;
1245 ch_free( dli->dli_default_filter.bv_val );
1248 while ( dlm != NULL ) {
1249 dlm_next = dlm->dlm_next;
1255 dli = (dynlist_info_t *)on->on_bi.bi_private;
1259 case DL_ATTRPAIR_COMPAT:
1274 dynlist_info_t **dlip,
1276 ObjectClass *oc = NULL;
1277 AttributeDescription *ad = NULL;
1278 dynlist_map_t *dlm = NULL;
1281 oc = oc_find( c->argv[ 1 ] );
1283 snprintf( c->cr_msg, sizeof( c->cr_msg ), DYNLIST_USAGE
1284 "unable to find ObjectClass \"%s\"",
1286 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1287 c->log, c->cr_msg, 0 );
1291 rc = slap_str2ad( c->argv[ 2 ], &ad, &text );
1292 if ( rc != LDAP_SUCCESS ) {
1293 snprintf( c->cr_msg, sizeof( c->cr_msg ), DYNLIST_USAGE
1294 "unable to find AttributeDescription \"%s\"",
1296 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1297 c->log, c->cr_msg, 0 );
1301 if ( !is_at_subtype( ad->ad_type, slap_schema.si_ad_labeledURI->ad_type ) ) {
1302 snprintf( c->cr_msg, sizeof( c->cr_msg ), DYNLIST_USAGE
1303 "AttributeDescription \"%s\" "
1304 "must be a subtype of \"labeledURI\"",
1306 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1307 c->log, c->cr_msg, 0 );
1311 for ( i = 3; i < c->argc; i++ ) {
1314 AttributeDescription *member_ad = NULL;
1315 AttributeDescription *mapped_ad = NULL;
1316 dynlist_map_t *dlmp;
1317 dynlist_map_t *dlml;
1321 * If no mapped attribute is given, dn is used
1322 * for backward compatibility.
1325 if ( ( cp = strchr( arg, ':' ) ) != NULL ) {
1327 ber_str2bv( arg, cp - arg, 0, &bv );
1328 rc = slap_bv2ad( &bv, &mapped_ad, &text );
1329 if ( rc != LDAP_SUCCESS ) {
1330 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1332 "unable to find mapped AttributeDescription #%d \"%s\"\n",
1333 i - 3, c->argv[ i ] );
1334 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1335 c->log, c->cr_msg, 0 );
1341 rc = slap_str2ad( arg, &member_ad, &text );
1342 if ( rc != LDAP_SUCCESS ) {
1343 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1345 "unable to find AttributeDescription #%d \"%s\"\n",
1346 i - 3, c->argv[ i ] );
1347 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1348 c->log, c->cr_msg, 0 );
1352 dlmp = (dynlist_map_t *)ch_calloc( 1, sizeof( dynlist_map_t ) );
1353 if ( dlm == NULL ) {
1357 dlmp->dlm_member_ad = member_ad;
1358 dlmp->dlm_mapped_ad = mapped_ad;
1359 dlmp->dlm_next = NULL;
1362 dlml->dlm_next = dlmp;
1366 if ( c->valx > 0 ) {
1369 for ( i = 0, dlip = (dynlist_info_t **)&on->on_bi.bi_private;
1372 if ( *dlip == NULL ) {
1373 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1375 "invalid index {%d}\n",
1377 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1378 c->log, c->cr_msg, 0 );
1381 dlip = &(*dlip)->dli_next;
1386 for ( dlip = (dynlist_info_t **)&on->on_bi.bi_private;
1387 *dlip; dlip = &(*dlip)->dli_next )
1391 *dlip = (dynlist_info_t *)ch_calloc( 1, sizeof( dynlist_info_t ) );
1393 (*dlip)->dli_oc = oc;
1394 (*dlip)->dli_ad = ad;
1395 (*dlip)->dli_dlm = dlm;
1396 (*dlip)->dli_next = dli_next;
1398 rc = dynlist_build_def_filter( *dlip );
1402 case DL_ATTRPAIR_COMPAT:
1403 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1404 "warning: \"attrpair\" only supported for limited "
1405 "backward compatibility with overlay \"dyngroup\"" );
1406 Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg, 0 );
1410 dynlist_info_t **dlip;
1411 ObjectClass *oc = NULL;
1412 AttributeDescription *ad = NULL,
1416 oc = oc_find( "groupOfURLs" );
1418 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1419 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1420 "unable to find default ObjectClass \"groupOfURLs\"" );
1421 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1422 c->log, c->cr_msg, 0 );
1426 rc = slap_str2ad( c->argv[ 1 ], &member_ad, &text );
1427 if ( rc != LDAP_SUCCESS ) {
1428 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1429 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1430 "unable to find AttributeDescription \"%s\"",
1432 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1433 c->log, c->cr_msg, 0 );
1437 rc = slap_str2ad( c->argv[ 2 ], &ad, &text );
1438 if ( rc != LDAP_SUCCESS ) {
1439 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1440 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1441 "unable to find AttributeDescription \"%s\"\n",
1443 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1444 c->log, c->cr_msg, 0 );
1448 if ( !is_at_subtype( ad->ad_type, slap_schema.si_ad_labeledURI->ad_type ) ) {
1449 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1451 "AttributeDescription \"%s\" "
1452 "must be a subtype of \"labeledURI\"",
1454 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1455 c->log, c->cr_msg, 0 );
1459 for ( dlip = (dynlist_info_t **)&on->on_bi.bi_private;
1460 *dlip; dlip = &(*dlip)->dli_next )
1463 * The same URL attribute / member attribute pair
1464 * cannot be repeated, but we enforce this only
1465 * when the member attribute is unique. Performing
1466 * the check for multiple values would require
1467 * sorting and comparing the lists, which is left
1468 * as a future improvement
1470 if ( (*dlip)->dli_ad == ad &&
1471 (*dlip)->dli_dlm->dlm_next == NULL &&
1472 member_ad == (*dlip)->dli_dlm->dlm_member_ad ) {
1473 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1474 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1475 "URL attributeDescription \"%s\" already mapped.\n",
1476 ad->ad_cname.bv_val );
1477 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1478 c->log, c->cr_msg, 0 );
1480 /* make it a warning... */
1486 *dlip = (dynlist_info_t *)ch_calloc( 1, sizeof( dynlist_info_t ) );
1488 (*dlip)->dli_oc = oc;
1489 (*dlip)->dli_ad = ad;
1490 (*dlip)->dli_dlm = (dynlist_map_t *)ch_calloc( 1, sizeof( dynlist_map_t ) );
1491 (*dlip)->dli_dlm->dlm_member_ad = member_ad;
1492 (*dlip)->dli_dlm->dlm_mapped_ad = NULL;
1494 rc = dynlist_build_def_filter( *dlip );
1512 slap_overinst *on = (slap_overinst *) be->bd_info;
1513 dynlist_info_t *dli = (dynlist_info_t *)on->on_bi.bi_private;
1514 ObjectClass *oc = NULL;
1515 AttributeDescription *ad = NULL;
1519 if ( dli == NULL ) {
1520 dli = ch_calloc( 1, sizeof( dynlist_info_t ) );
1521 on->on_bi.bi_private = (void *)dli;
1524 for ( ; dli; dli = dli->dli_next ) {
1525 if ( dli->dli_oc == NULL ) {
1527 oc = oc_find( "groupOfURLs" );
1529 snprintf( cr->msg, sizeof( cr->msg),
1530 "unable to fetch objectClass \"groupOfURLs\"" );
1531 Debug( LDAP_DEBUG_ANY, "dynlist_db_open: %s.\n", cr->msg, 0, 0 );
1539 if ( dli->dli_ad == NULL ) {
1541 rc = slap_str2ad( "memberURL", &ad, &text );
1542 if ( rc != LDAP_SUCCESS ) {
1543 snprintf( cr->msg, sizeof( cr->msg),
1544 "unable to fetch attributeDescription \"memberURL\": %d (%s)",
1546 Debug( LDAP_DEBUG_ANY, "dynlist_db_open: %s.\n", cr->msg, 0, 0 );
1554 if ( BER_BVISNULL( &dli->dli_default_filter ) ) {
1555 rc = dynlist_build_def_filter( dli );
1562 if ( ad_dgIdentity == NULL ) {
1563 rc = slap_str2ad( "dgIdentity", &ad_dgIdentity, &text );
1564 if ( rc != LDAP_SUCCESS ) {
1565 snprintf( cr->msg, sizeof( cr->msg),
1566 "unable to fetch attributeDescription \"dgIdentity\": %d (%s)",
1568 Debug( LDAP_DEBUG_ANY, "dynlist_db_open: %s\n", cr->msg, 0, 0 );
1569 /* Just a warning */
1573 if ( ad_dgAuthz == NULL ) {
1574 rc = slap_str2ad( "dgAuthz", &ad_dgAuthz, &text );
1575 if ( rc != LDAP_SUCCESS ) {
1576 snprintf( cr->msg, sizeof( cr->msg),
1577 "unable to fetch attributeDescription \"dgAuthz\": %d (%s)",
1579 Debug( LDAP_DEBUG_ANY, "dynlist_db_open: %s\n", cr->msg, 0, 0 );
1580 /* Just a warning */
1592 slap_overinst *on = (slap_overinst *) be->bd_info;
1594 if ( on->on_bi.bi_private ) {
1595 dynlist_info_t *dli = (dynlist_info_t *)on->on_bi.bi_private,
1598 for ( dli_next = dli; dli_next; dli = dli_next ) {
1600 dynlist_map_t *dlm_next;
1602 dli_next = dli->dli_next;
1604 ch_free( dli->dli_default_filter.bv_val );
1606 while ( dlm != NULL ) {
1607 dlm_next = dlm->dlm_next;
1618 static slap_overinst dynlist = { { NULL } };
1619 #ifdef TAKEOVER_DYNGROUP
1620 static char *obsolete_names[] = {
1626 #if SLAPD_OVER_DYNLIST == SLAPD_MOD_DYNAMIC
1628 #endif /* SLAPD_OVER_DYNLIST == SLAPD_MOD_DYNAMIC */
1630 dynlist_initialize(void)
1632 #ifndef OL_2_2_COMPAT
1636 dynlist.on_bi.bi_type = "dynlist";
1638 #ifdef TAKEOVER_DYNGROUP
1639 /* makes dynlist incompatible with dyngroup */
1640 dynlist.on_bi.bi_obsolete_names = obsolete_names;
1643 #ifdef OL_2_2_COMPAT
1644 dynlist.on_bi.bi_db_config = dynlist_db_config;
1646 dynlist.on_bi.bi_db_config = config_generic_wrapper;
1648 dynlist.on_bi.bi_db_open = dynlist_db_open;
1649 dynlist.on_bi.bi_db_destroy = dynlist_db_destroy;
1651 dynlist.on_response = dynlist_response;
1653 #ifndef OL_2_2_COMPAT
1654 dynlist.on_bi.bi_cf_ocs = dlocs;
1656 rc = config_register_schema( dlcfg, dlocs );
1662 return overlay_register( &dynlist );
1665 #if SLAPD_OVER_DYNLIST == SLAPD_MOD_DYNAMIC
1667 init_module( int argc, char *argv[] )
1669 return dynlist_initialize();
1673 #endif /* SLAPD_OVER_DYNLIST */