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 ) {
374 AttributeDescription *ad = dlm->dlm_mapped_ad ? dlm->dlm_mapped_ad : dlm->dlm_member_ad;
375 if ( userattrs || ad_inlist( 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;
427 BER_BVZERO( &o.o_req_dn );
428 BER_BVZERO( &o.o_req_ndn );
431 BER_BVZERO( &o.ors_filterstr );
433 if ( ldap_url_parse( url->bv_val, &lud ) != LDAP_URL_SUCCESS ) {
438 if ( lud->lud_host != NULL ) {
439 /* FIXME: host not allowed; reject as illegal? */
440 Debug( LDAP_DEBUG_ANY, "dynlist_prepare_entry(\"%s\"): "
441 "illegal URI \"%s\"\n",
442 e->e_name.bv_val, url->bv_val, 0 );
446 if ( lud->lud_dn == NULL ) {
447 /* note that an empty base is not honored in terms
448 * of defaultSearchBase, because select_backend()
449 * is not aware of the defaultSearchBase option;
450 * this can be useful in case of a database serving
451 * the empty suffix */
452 BER_BVSTR( &dn, "" );
455 ber_str2bv( lud->lud_dn, 0, 0, &dn );
457 rc = dnPrettyNormal( NULL, &dn, &o.o_req_dn, &o.o_req_ndn, op->o_tmpmemctx );
458 if ( rc != LDAP_SUCCESS ) {
462 o.ors_scope = lud->lud_scope;
464 for ( dlm = dli->dli_dlm; dlm; dlm = dlm->dlm_next ) {
465 if ( dlm->dlm_mapped_ad != NULL ) {
470 if ( dli->dli_dlm && !dlm ) {
471 /* if ( lud->lud_attrs != NULL ),
472 * the URL should be ignored */
473 o.ors_attrs = slap_anlist_no_attrs;
475 } else if ( lud->lud_attrs == NULL ) {
476 o.ors_attrs = rs->sr_attrs;
479 for ( i = 0; lud->lud_attrs[i]; i++)
482 o.ors_attrs = op->o_tmpcalloc( i + 1, sizeof( AttributeName ), op->o_tmpmemctx );
483 for ( i = 0, j = 0; lud->lud_attrs[i]; i++) {
484 const char *text = NULL;
486 ber_str2bv( lud->lud_attrs[i], 0, 0, &o.ors_attrs[j].an_name );
487 o.ors_attrs[j].an_desc = NULL;
488 (void)slap_bv2ad( &o.ors_attrs[j].an_name, &o.ors_attrs[j].an_desc, &text );
489 /* FIXME: ignore errors... */
491 if ( rs->sr_attrs == NULL ) {
492 if ( o.ors_attrs[j].an_desc != NULL &&
493 is_at_operational( o.ors_attrs[j].an_desc->ad_type ) )
499 if ( o.ors_attrs[j].an_desc != NULL &&
500 is_at_operational( o.ors_attrs[j].an_desc->ad_type ) )
506 if ( !ad_inlist( o.ors_attrs[j].an_desc, rs->sr_attrs ) ) {
507 /* lookup if mapped -- linear search,
508 * not very efficient unless list
510 for ( dlm = dli->dli_dlm; dlm; dlm = dlm->dlm_next ) {
511 if ( dlm->dlm_member_ad == o.ors_attrs[j].an_desc ) {
523 o.ors_attrs[j].an_desc != NULL &&
524 !ad_inlist( o.ors_attrs[j].an_desc, rs->sr_attrs ) )
526 /* lookup if mapped -- linear search,
527 * not very efficient unless list
529 for ( dlm = dli->dli_dlm; dlm; dlm = dlm->dlm_next ) {
530 if ( dlm->dlm_member_ad == o.ors_attrs[j].an_desc ) {
549 BER_BVZERO( &o.ors_attrs[j].an_name );
552 if ( lud->lud_filter == NULL ) {
553 ber_dupbv_x( &o.ors_filterstr,
554 &dli->dli_default_filter, op->o_tmpmemctx );
558 ber_str2bv( lud->lud_filter, 0, 0, &flt );
559 if ( dynlist_make_filter( op, &flt, &o.ors_filterstr ) ) {
564 o.ors_filter = str2filter_x( op, o.ors_filterstr.bv_val );
565 if ( o.ors_filter == NULL ) {
569 o.o_bd = select_backend( &o.o_req_ndn, 1 );
570 if ( o.o_bd && o.o_bd->be_search ) {
572 r.sr_attr_flags = slap_attr_flags( o.ors_attrs );
573 #endif /* SLAP_OPATTRS */
574 (void)o.o_bd->be_search( &o, &r );
579 slap_op_groups_free( &o );
581 if ( o.ors_filter ) {
582 filter_free_x( &o, o.ors_filter, 1 );
584 if ( o.ors_attrs && o.ors_attrs != rs->sr_attrs
585 && o.ors_attrs != slap_anlist_no_attrs )
587 op->o_tmpfree( o.ors_attrs, op->o_tmpmemctx );
589 if ( !BER_BVISNULL( &o.o_req_dn ) ) {
590 op->o_tmpfree( o.o_req_dn.bv_val, op->o_tmpmemctx );
592 if ( !BER_BVISNULL( &o.o_req_ndn ) ) {
593 op->o_tmpfree( o.o_req_ndn.bv_val, op->o_tmpmemctx );
595 assert( BER_BVISNULL( &o.ors_filterstr )
596 || o.ors_filterstr.bv_val != lud->lud_filter );
597 op->o_tmpfree( o.ors_filterstr.bv_val, op->o_tmpmemctx );
598 ldap_free_urldesc( lud );
602 rs->sr_flags = e_flags;
604 return SLAP_CB_CONTINUE;
608 dynlist_sc_save_entry( Operation *op, SlapReply *rs )
610 /* save the entry in the private field of the callback,
611 * so it doesn't get freed (it's temporary!) */
612 if ( rs->sr_entry != NULL ) {
613 dynlist_sc_t *dlc = (dynlist_sc_t *)op->o_callback->sc_private;
614 dlc->dlc_e = rs->sr_entry;
622 dynlist_compare( Operation *op, SlapReply *rs )
624 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
625 dynlist_info_t *dli = (dynlist_info_t *)on->on_bi.bi_private;
630 for ( ; dli != NULL; dli = dli->dli_next ) {
631 for ( dlm = dli->dli_dlm; dlm; dlm = dlm->dlm_next )
632 if ( op->oq_compare.rs_ava->aa_desc == dlm->dlm_member_ad )
635 if ( dli->dli_dlm && dlm ) {
636 /* This compare is for one of the attributes we're
637 * interested in. We'll use slapd's existing dyngroup
638 * evaluator to get the answer we want.
640 BerVarray id = NULL, authz = NULL;
642 o.o_do_not_cache = 1;
644 if ( ad_dgIdentity && backend_attribute( &o, NULL, &o.o_req_ndn,
645 ad_dgIdentity, &id, ACL_READ ) == LDAP_SUCCESS )
647 /* if not rootdn and dgAuthz is present,
648 * check if user can be authorized as dgIdentity */
649 if ( ad_dgAuthz && !BER_BVISEMPTY( id ) && !be_isroot( op )
650 && backend_attribute( &o, NULL, &o.o_req_ndn,
651 ad_dgAuthz, &authz, ACL_READ ) == LDAP_SUCCESS )
654 rs->sr_err = slap_sasl_matches( op, authz,
655 &o.o_ndn, &o.o_ndn );
656 ber_bvarray_free_x( authz, op->o_tmpmemctx );
657 if ( rs->sr_err != LDAP_SUCCESS ) {
664 o.o_groups = NULL; /* authz changed, invalidate cached groups */
667 rs->sr_err = backend_group( &o, NULL, &o.o_req_ndn,
668 &o.oq_compare.rs_ava->aa_value, dli->dli_oc, dli->dli_ad );
669 switch ( rs->sr_err ) {
671 rs->sr_err = LDAP_COMPARE_TRUE;
674 case LDAP_NO_SUCH_OBJECT:
675 /* NOTE: backend_group() returns noSuchObject
676 * if op_ndn does not exist; however, since
677 * dynamic list expansion means that the
678 * member attribute is virtually present, the
679 * non-existence of the asserted value implies
680 * the assertion is FALSE rather than
682 rs->sr_err = LDAP_COMPARE_FALSE;
687 if ( id ) ber_bvarray_free_x( id, o.o_tmpmemctx );
689 return SLAP_CB_CONTINUE;
693 if ( overlay_entry_get_ov( &o, &o.o_req_ndn, NULL, NULL, 0, &e, on ) !=
694 LDAP_SUCCESS || e == NULL )
696 return SLAP_CB_CONTINUE;
699 if ( ad_dgIdentity ) {
700 Attribute *id = attrs_find( e->e_attrs, ad_dgIdentity );
704 /* if not rootdn and dgAuthz is present,
705 * check if user can be authorized as dgIdentity */
706 if ( ad_dgAuthz && !BER_BVISEMPTY( &id->a_nvals[0] ) && !be_isroot( op )
707 && ( authz = attrs_find( e->e_attrs, ad_dgAuthz ) ) )
709 if ( slap_sasl_matches( op, authz->a_nvals,
710 &o.o_ndn, &o.o_ndn ) != LDAP_SUCCESS )
716 o.o_dn = id->a_vals[0];
717 o.o_ndn = id->a_nvals[0];
722 dli = (dynlist_info_t *)on->on_bi.bi_private;
723 for ( ; dli != NULL && rs->sr_err != LDAP_COMPARE_TRUE; dli = dli->dli_next ) {
726 SlapReply r = { REP_SEARCH };
729 dynlist_sc_t dlc = { 0 };
731 if ( !is_entry_objectclass_or_sub( e, dli->dli_oc ))
734 /* if the entry has the right objectClass, generate
735 * the dynamic list and compare */
737 cb.sc_private = &dlc;
738 cb.sc_response = dynlist_sc_save_entry;
739 cb.sc_cleanup = NULL;
743 o.o_tag = LDAP_REQ_SEARCH;
745 o.ors_tlimit = SLAP_NO_LIMIT;
746 o.ors_slimit = SLAP_NO_LIMIT;
748 o.o_bd = select_backend( &o.o_req_ndn, 1 );
749 if ( !o.o_bd || !o.o_bd->be_search ) {
753 o.ors_filterstr = *slap_filterstr_objectClass_pres;
754 o.ors_filter = (Filter *) slap_filter_objectClass_pres;
756 o.ors_scope = LDAP_SCOPE_BASE;
757 o.ors_deref = LDAP_DEREF_NEVER;
758 an[0].an_name = op->orc_ava->aa_desc->ad_cname;
759 an[0].an_desc = op->orc_ava->aa_desc;
760 BER_BVZERO( &an[1].an_name );
764 o.o_acl_priv = ACL_COMPARE;
766 rc = o.o_bd->be_search( &o, &r );
768 if ( o.o_dn.bv_val != op->o_dn.bv_val ) {
769 slap_op_groups_free( &o );
776 if ( dlc.dlc_e != NULL ) {
777 r.sr_entry = dlc.dlc_e;
780 if ( r.sr_err != LDAP_SUCCESS || r.sr_entry == NULL ) {
785 for ( a = attrs_find( r.sr_entry->e_attrs, op->orc_ava->aa_desc );
787 a = attrs_find( a->a_next, op->orc_ava->aa_desc ) )
789 /* if we're here, we got a match... */
790 rs->sr_err = LDAP_COMPARE_FALSE;
792 if ( attr_valfind( a,
793 SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
794 SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
795 &op->orc_ava->aa_value, NULL, op->o_tmpmemctx ) == 0 )
797 rs->sr_err = LDAP_COMPARE_TRUE;
802 if ( r.sr_flags & REP_ENTRY_MUSTBEFREED ) {
803 entry_free( r.sr_entry );
809 overlay_entry_release_ov( op, e, 0, on );
812 return SLAP_CB_CONTINUE;
816 dynlist_response( Operation *op, SlapReply *rs )
820 switch ( op->o_tag ) {
821 case LDAP_REQ_SEARCH:
822 if ( rs->sr_type == REP_SEARCH && !get_manageDSAit( op ) )
826 for ( dli = dynlist_is_dynlist_next( op, rs, NULL );
828 dli = dynlist_is_dynlist_next( op, rs, dli ) )
830 rc = dynlist_prepare_entry( op, rs, dli );
833 if ( rc != LDAP_OTHER ) {
839 case LDAP_REQ_COMPARE:
840 switch ( rs->sr_err ) {
841 /* NOTE: we waste a few cycles running the dynamic list
842 * also when the result is FALSE, which occurs if the
843 * dynamic entry itself contains the AVA attribute */
844 /* FIXME: this approach is less than optimal; a dedicated
845 * compare op should be implemented, that fetches the
846 * entry, checks if it has the appropriate objectClass
847 * and, in case, runs a compare thru all the URIs,
848 * stopping at the first positive occurrence; see ITS#3756 */
849 case LDAP_COMPARE_FALSE:
850 case LDAP_NO_SUCH_ATTRIBUTE:
851 return dynlist_compare( op, rs );
859 return SLAP_CB_CONTINUE;
863 dynlist_build_def_filter( dynlist_info_t *dli )
867 dli->dli_default_filter.bv_len = STRLENOF( "(!(objectClass=" "))" )
868 + dli->dli_oc->soc_cname.bv_len;
869 dli->dli_default_filter.bv_val = ch_malloc( dli->dli_default_filter.bv_len + 1 );
870 if ( dli->dli_default_filter.bv_val == NULL ) {
871 Debug( LDAP_DEBUG_ANY, "dynlist_db_open: malloc failed.\n",
876 ptr = lutil_strcopy( dli->dli_default_filter.bv_val, "(!(objectClass=" );
877 ptr = lutil_strcopy( ptr, dli->dli_oc->soc_cname.bv_val );
878 ptr = lutil_strcopy( ptr, "))" );
880 assert( ptr == &dli->dli_default_filter.bv_val[dli->dli_default_filter.bv_len] );
894 slap_overinst *on = (slap_overinst *)be->bd_info;
898 if ( strcasecmp( argv[0], "dynlist-attrset" ) == 0 ) {
899 dynlist_info_t **dlip;
901 AttributeDescription *ad = NULL,
903 dynlist_map_t *dlm = NULL;
907 Debug( LDAP_DEBUG_ANY, "%s: line %d: " DYNLIST_USAGE
908 "invalid arg number #%d.\n",
909 fname, lineno, argc );
913 oc = oc_find( argv[1] );
915 Debug( LDAP_DEBUG_ANY, "%s: line %d: " DYNLIST_USAGE
916 "unable to find ObjectClass \"%s\"\n",
917 fname, lineno, argv[ 1 ] );
921 rc = slap_str2ad( argv[2], &ad, &text );
922 if ( rc != LDAP_SUCCESS ) {
923 Debug( LDAP_DEBUG_ANY, "%s: line %d: " DYNLIST_USAGE
924 "unable to find AttributeDescription \"%s\"\n",
925 fname, lineno, argv[2] );
929 if ( !is_at_subtype( ad->ad_type, slap_schema.si_ad_labeledURI->ad_type ) ) {
930 Debug( LDAP_DEBUG_ANY, "%s: line %d: " DYNLIST_USAGE
931 "AttributeDescription \"%s\" "
932 "must be a subtype of \"labeledURI\"\n",
933 fname, lineno, argv[2] );
937 for ( i = 3; i < argc; i++ ) {
940 AttributeDescription *member_ad = NULL;
941 AttributeDescription *mapped_ad = NULL;
947 * If no mapped attribute is given, dn is used
948 * for backward compatibility.
951 if ( cp = strchr( arg, (int)':' ) != NULL ) {
953 ber_str2bv( arg, cp - arg, 0, &bv );
954 rc = slap_bv2ad( &bv, &mapped_ad, &text );
955 if ( rc != LDAP_SUCCESS ) {
956 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
958 "unable to find mapped AttributeDescription \"%s\"\n",
959 fname, lineno, arg );
966 rc = slap_str2ad( arg, &member_ad, &text );
967 if ( rc != LDAP_SUCCESS ) {
968 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
970 "unable to find AttributeDescription \"%s\"\n",
971 fname, lineno, arg );
975 dlmp = (dynlist_map_t *)ch_calloc( 1, sizeof( dynlist_map_t ) );
980 dlmp->dlm_member_ad = member_ad;
981 dlmp->dlm_mapped_ad = mapped_ad;
982 dlmp->dlm_next = NULL;
985 dlml->dlm_next = dlmp;
989 for ( dlip = (dynlist_info_t **)&on->on_bi.bi_private;
990 *dlip; dlip = &(*dlip)->dli_next )
993 * The same URL attribute / member attribute pair
994 * cannot be repeated, but we enforce this only
995 * when the member attribute is unique. Performing
996 * the check for multiple values would require
997 * sorting and comparing the lists, which is left
998 * as a future improvement
1000 if ( (*dlip)->dli_ad == ad &&
1001 (*dlip)->dli_dlm->dlm_next == NULL &&
1002 dlm->dlm_next == NULL &&
1003 dlm->dlm_member_ad == (*dlip)->dli_dlm->dlm_member_ad &&
1004 dlm->dlm_mapped_ad == (*dlip)->dli_dlm->dlm_mapped_ad ) {
1005 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1007 "URL attributeDescription \"%s\" already mapped.\n",
1008 fname, lineno, ad->ad_cname.bv_val );
1010 /* make it a warning... */
1016 *dlip = (dynlist_info_t *)ch_calloc( 1, sizeof( dynlist_info_t ) );
1017 (*dlip)->dli_oc = oc;
1018 (*dlip)->dli_ad = ad;
1019 (*dlip)->dli_dlm = dlm;
1021 if ( dynlist_build_def_filter( *dlip ) ) {
1022 dynlist_map_t *dlm = (*dlip)->ldi_dlm;
1023 dynlist_map_t *dlm_next;
1025 while ( dlm != NULL ) {
1026 dlm_next = dlm->dlm_next;
1036 /* allow dyngroup syntax */
1037 } else if ( strcasecmp( argv[0], "dynlist-attrpair" ) == 0 ) {
1038 dynlist_info_t **dlip;
1040 AttributeDescription *ad = NULL,
1045 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1046 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1047 "invalid arg number #%d.\n",
1048 fname, lineno, argc );
1052 oc = oc_find( "groupOfURLs" );
1054 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1055 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1056 "unable to find default ObjectClass \"groupOfURLs\"\n",
1061 rc = slap_str2ad( argv[1], &member_ad, &text );
1062 if ( rc != LDAP_SUCCESS ) {
1063 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1064 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1065 "unable to find AttributeDescription \"%s\"\n",
1066 fname, lineno, argv[1] );
1070 rc = slap_str2ad( argv[2], &ad, &text );
1071 if ( rc != LDAP_SUCCESS ) {
1072 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1073 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1074 "unable to find AttributeDescription \"%s\"\n",
1075 fname, lineno, argv[2] );
1079 if ( !is_at_subtype( ad->ad_type, slap_schema.si_ad_labeledURI->ad_type ) ) {
1080 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1081 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1082 "AttributeDescription \"%s\" "
1083 "must be a subtype of \"labeledURI\"\n",
1084 fname, lineno, argv[2] );
1088 for ( dlip = (dynlist_info_t **)&on->on_bi.bi_private;
1089 *dlip; dlip = &(*dlip)->dli_next )
1092 * The same URL attribute / member attribute pair
1093 * cannot be repeated, but we enforce this only
1094 * when the member attribute is unique. Performing
1095 * the check for multiple values would require
1096 * sorting and comparing the lists, which is left
1097 * as a future improvement
1099 if ( (*dlip)->dli_ad == ad &&
1100 (*dlip)->dli_dlm->dlm_next == NULL &&
1101 member_ad == (*dlip)->dli_dlm->dlm_member_ad ) {
1102 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1103 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1104 "URL attributeDescription \"%s\" already mapped.\n",
1105 fname, lineno, ad->ad_cname.bv_val );
1107 /* make it a warning... */
1113 *dlip = (dynlist_info_t *)ch_calloc( 1, sizeof( dynlist_info_t ) );
1114 (*dlip)->dli_oc = oc;
1115 (*dlip)->dli_ad = ad;
1116 (*dlip)->dli_dlm = (dynlist_map_t *)ch_calloc( 1, sizeof( dynlist_map_t ) );
1117 (*dlip)->dli_dlm->dlm_member_ad = member_ad;
1118 (*dlip)->dli_dlm->dlm_mapped_ad = NULL;
1120 if ( dynlist_build_def_filter( *dlip ) ) {
1121 ch_free( (*dlip)->dli_dlm );
1128 rc = SLAP_CONF_UNKNOWN;
1142 static ConfigDriver dl_cfgen;
1144 /* XXXmanu 255 is the maximum arguments we allow. Can we go beyond? */
1145 static ConfigTable dlcfg[] = {
1146 { "dynlist-attrset", "group-oc> <URL-ad> <member-ad",
1147 3, 255, 0, ARG_MAGIC|DL_ATTRSET, dl_cfgen,
1148 "( OLcfgOvAt:8.1 NAME 'olcDLattrSet' "
1149 "DESC 'Dynamic list: <group objectClass>, <URL attributeDescription>, <member attributeDescription>' "
1150 "EQUALITY caseIgnoreMatch "
1151 "SYNTAX OMsDirectoryString "
1152 "X-ORDERED 'VALUES' )",
1154 { "dynlist-attrpair", "member-ad> <URL-ad",
1155 3, 3, 0, ARG_MAGIC|DL_ATTRPAIR, dl_cfgen,
1157 #ifdef TAKEOVER_DYNGROUP
1158 { "attrpair", "member-ad> <URL-ad",
1159 3, 3, 0, ARG_MAGIC|DL_ATTRPAIR_COMPAT, dl_cfgen,
1162 { NULL, NULL, 0, 0, 0, ARG_IGNORED }
1165 static ConfigOCs dlocs[] = {
1166 { "( OLcfgOvOc:8.1 "
1167 "NAME 'olcDynamicList' "
1168 "DESC 'Dynamic list configuration' "
1169 "SUP olcOverlayConfig "
1170 "MAY olcDLattrSet )",
1171 Cft_Overlay, dlcfg, NULL, NULL },
1176 dl_cfgen( ConfigArgs *c )
1178 slap_overinst *on = (slap_overinst *)c->bi;
1179 dynlist_info_t *dli = (dynlist_info_t *)on->on_bi.bi_private;
1183 if ( c->op == SLAP_CONFIG_EMIT ) {
1186 for ( i = 0; dli; i++, dli = dli->dli_next ) {
1188 char *ptr = c->cr_msg;
1191 assert( dli->dli_oc != NULL );
1192 assert( dli->dli_ad != NULL );
1194 ptr += snprintf( c->cr_msg, sizeof( c->cr_msg ),
1195 SLAP_X_ORDERED_FMT "%s %s", i,
1196 dli->dli_oc->soc_cname.bv_val,
1197 dli->dli_ad->ad_cname.bv_val );
1199 for ( dlm = dli->dli_dlm; dlm; dlm = dlm->dlm_next ) {
1202 if ( dlm->dlm_mapped_ad ) {
1203 ptr = lutil_strcopy( ptr, dlm->dlm_mapped_ad->ad_cname.bv_val );
1208 ptr = lutil_strcopy( ptr, dlm->dlm_member_ad->ad_cname.bv_val );
1211 bv.bv_val = c->cr_msg;
1212 bv.bv_len = ptr - bv.bv_val;
1213 value_add_one( &c->rvalue_vals, &bv );
1217 case DL_ATTRPAIR_COMPAT:
1229 } else if ( c->op == LDAP_MOD_DELETE ) {
1232 if ( c->valx < 0 ) {
1233 dynlist_info_t *dli_next;
1235 for ( dli_next = dli; dli_next; dli = dli_next ) {
1236 dynlist_map_t *dlm = dli->dli_dlm;
1237 dynlist_map_t *dlm_next;
1239 dli_next = dli->dli_next;
1241 ch_free( dli->dli_default_filter.bv_val );
1243 while ( dlm != NULL ) {
1244 dlm_next = dlm->dlm_next;
1251 on->on_bi.bi_private = NULL;
1254 dynlist_info_t **dlip;
1256 dynlist_map_t *dlm_next;
1258 for ( i = 0, dlip = (dynlist_info_t **)&on->on_bi.bi_private;
1261 if ( *dlip == NULL ) {
1264 dlip = &(*dlip)->dli_next;
1268 *dlip = dli->dli_next;
1269 ch_free( dli->dli_default_filter.bv_val );
1272 while ( dlm != NULL ) {
1273 dlm_next = dlm->dlm_next;
1279 dli = (dynlist_info_t *)on->on_bi.bi_private;
1283 case DL_ATTRPAIR_COMPAT:
1298 dynlist_info_t **dlip,
1300 ObjectClass *oc = NULL;
1301 AttributeDescription *ad = NULL;
1302 dynlist_map_t *dlm = NULL;
1305 oc = oc_find( c->argv[ 1 ] );
1307 snprintf( c->cr_msg, sizeof( c->cr_msg ), DYNLIST_USAGE
1308 "unable to find ObjectClass \"%s\"",
1310 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1311 c->log, c->cr_msg, 0 );
1315 rc = slap_str2ad( c->argv[ 2 ], &ad, &text );
1316 if ( rc != LDAP_SUCCESS ) {
1317 snprintf( c->cr_msg, sizeof( c->cr_msg ), DYNLIST_USAGE
1318 "unable to find AttributeDescription \"%s\"",
1320 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1321 c->log, c->cr_msg, 0 );
1325 if ( !is_at_subtype( ad->ad_type, slap_schema.si_ad_labeledURI->ad_type ) ) {
1326 snprintf( c->cr_msg, sizeof( c->cr_msg ), DYNLIST_USAGE
1327 "AttributeDescription \"%s\" "
1328 "must be a subtype of \"labeledURI\"",
1330 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1331 c->log, c->cr_msg, 0 );
1335 for ( i = 3; i < c->argc; i++ ) {
1338 AttributeDescription *member_ad = NULL;
1339 AttributeDescription *mapped_ad = NULL;
1340 dynlist_map_t *dlmp;
1341 dynlist_map_t *dlml;
1345 * If no mapped attribute is given, dn is used
1346 * for backward compatibility.
1349 if ( ( cp = strchr( arg, ':' ) ) != NULL ) {
1351 ber_str2bv( arg, cp - arg, 0, &bv );
1352 rc = slap_bv2ad( &bv, &mapped_ad, &text );
1353 if ( rc != LDAP_SUCCESS ) {
1354 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1356 "unable to find mapped AttributeDescription #%d \"%s\"\n",
1357 i - 3, c->argv[ i ] );
1358 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1359 c->log, c->cr_msg, 0 );
1365 rc = slap_str2ad( arg, &member_ad, &text );
1366 if ( rc != LDAP_SUCCESS ) {
1367 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1369 "unable to find AttributeDescription #%d \"%s\"\n",
1370 i - 3, c->argv[ i ] );
1371 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1372 c->log, c->cr_msg, 0 );
1376 dlmp = (dynlist_map_t *)ch_calloc( 1, sizeof( dynlist_map_t ) );
1377 if ( dlm == NULL ) {
1381 dlmp->dlm_member_ad = member_ad;
1382 dlmp->dlm_mapped_ad = mapped_ad;
1383 dlmp->dlm_next = NULL;
1386 dlml->dlm_next = dlmp;
1390 if ( c->valx > 0 ) {
1393 for ( i = 0, dlip = (dynlist_info_t **)&on->on_bi.bi_private;
1396 if ( *dlip == NULL ) {
1397 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1399 "invalid index {%d}\n",
1401 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1402 c->log, c->cr_msg, 0 );
1405 dlip = &(*dlip)->dli_next;
1410 for ( dlip = (dynlist_info_t **)&on->on_bi.bi_private;
1411 *dlip; dlip = &(*dlip)->dli_next )
1415 *dlip = (dynlist_info_t *)ch_calloc( 1, sizeof( dynlist_info_t ) );
1417 (*dlip)->dli_oc = oc;
1418 (*dlip)->dli_ad = ad;
1419 (*dlip)->dli_dlm = dlm;
1420 (*dlip)->dli_next = dli_next;
1422 rc = dynlist_build_def_filter( *dlip );
1426 case DL_ATTRPAIR_COMPAT:
1427 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1428 "warning: \"attrpair\" only supported for limited "
1429 "backward compatibility with overlay \"dyngroup\"" );
1430 Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->cr_msg, 0 );
1434 dynlist_info_t **dlip;
1435 ObjectClass *oc = NULL;
1436 AttributeDescription *ad = NULL,
1440 oc = oc_find( "groupOfURLs" );
1442 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1443 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1444 "unable to find default ObjectClass \"groupOfURLs\"" );
1445 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1446 c->log, c->cr_msg, 0 );
1450 rc = slap_str2ad( c->argv[ 1 ], &member_ad, &text );
1451 if ( rc != LDAP_SUCCESS ) {
1452 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1453 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1454 "unable to find AttributeDescription \"%s\"",
1456 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1457 c->log, c->cr_msg, 0 );
1461 rc = slap_str2ad( c->argv[ 2 ], &ad, &text );
1462 if ( rc != LDAP_SUCCESS ) {
1463 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1464 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1465 "unable to find AttributeDescription \"%s\"\n",
1467 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1468 c->log, c->cr_msg, 0 );
1472 if ( !is_at_subtype( ad->ad_type, slap_schema.si_ad_labeledURI->ad_type ) ) {
1473 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1475 "AttributeDescription \"%s\" "
1476 "must be a subtype of \"labeledURI\"",
1478 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1479 c->log, c->cr_msg, 0 );
1483 for ( dlip = (dynlist_info_t **)&on->on_bi.bi_private;
1484 *dlip; dlip = &(*dlip)->dli_next )
1487 * The same URL attribute / member attribute pair
1488 * cannot be repeated, but we enforce this only
1489 * when the member attribute is unique. Performing
1490 * the check for multiple values would require
1491 * sorting and comparing the lists, which is left
1492 * as a future improvement
1494 if ( (*dlip)->dli_ad == ad &&
1495 (*dlip)->dli_dlm->dlm_next == NULL &&
1496 member_ad == (*dlip)->dli_dlm->dlm_member_ad ) {
1497 snprintf( c->cr_msg, sizeof( c->cr_msg ),
1498 "\"dynlist-attrpair <member-ad> <URL-ad>\": "
1499 "URL attributeDescription \"%s\" already mapped.\n",
1500 ad->ad_cname.bv_val );
1501 Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
1502 c->log, c->cr_msg, 0 );
1504 /* make it a warning... */
1510 *dlip = (dynlist_info_t *)ch_calloc( 1, sizeof( dynlist_info_t ) );
1512 (*dlip)->dli_oc = oc;
1513 (*dlip)->dli_ad = ad;
1514 (*dlip)->dli_dlm = (dynlist_map_t *)ch_calloc( 1, sizeof( dynlist_map_t ) );
1515 (*dlip)->dli_dlm->dlm_member_ad = member_ad;
1516 (*dlip)->dli_dlm->dlm_mapped_ad = NULL;
1518 rc = dynlist_build_def_filter( *dlip );
1536 slap_overinst *on = (slap_overinst *) be->bd_info;
1537 dynlist_info_t *dli = (dynlist_info_t *)on->on_bi.bi_private;
1538 ObjectClass *oc = NULL;
1539 AttributeDescription *ad = NULL;
1543 if ( dli == NULL ) {
1544 dli = ch_calloc( 1, sizeof( dynlist_info_t ) );
1545 on->on_bi.bi_private = (void *)dli;
1548 for ( ; dli; dli = dli->dli_next ) {
1549 if ( dli->dli_oc == NULL ) {
1551 oc = oc_find( "groupOfURLs" );
1553 snprintf( cr->msg, sizeof( cr->msg),
1554 "unable to fetch objectClass \"groupOfURLs\"" );
1555 Debug( LDAP_DEBUG_ANY, "dynlist_db_open: %s.\n", cr->msg, 0, 0 );
1563 if ( dli->dli_ad == NULL ) {
1565 rc = slap_str2ad( "memberURL", &ad, &text );
1566 if ( rc != LDAP_SUCCESS ) {
1567 snprintf( cr->msg, sizeof( cr->msg),
1568 "unable to fetch attributeDescription \"memberURL\": %d (%s)",
1570 Debug( LDAP_DEBUG_ANY, "dynlist_db_open: %s.\n", cr->msg, 0, 0 );
1578 if ( BER_BVISNULL( &dli->dli_default_filter ) ) {
1579 rc = dynlist_build_def_filter( dli );
1586 if ( ad_dgIdentity == NULL ) {
1587 rc = slap_str2ad( "dgIdentity", &ad_dgIdentity, &text );
1588 if ( rc != LDAP_SUCCESS ) {
1589 snprintf( cr->msg, sizeof( cr->msg),
1590 "unable to fetch attributeDescription \"dgIdentity\": %d (%s)",
1592 Debug( LDAP_DEBUG_ANY, "dynlist_db_open: %s\n", cr->msg, 0, 0 );
1593 /* Just a warning */
1597 if ( ad_dgAuthz == NULL ) {
1598 rc = slap_str2ad( "dgAuthz", &ad_dgAuthz, &text );
1599 if ( rc != LDAP_SUCCESS ) {
1600 snprintf( cr->msg, sizeof( cr->msg),
1601 "unable to fetch attributeDescription \"dgAuthz\": %d (%s)",
1603 Debug( LDAP_DEBUG_ANY, "dynlist_db_open: %s\n", cr->msg, 0, 0 );
1604 /* Just a warning */
1616 slap_overinst *on = (slap_overinst *) be->bd_info;
1618 if ( on->on_bi.bi_private ) {
1619 dynlist_info_t *dli = (dynlist_info_t *)on->on_bi.bi_private,
1622 for ( dli_next = dli; dli_next; dli = dli_next ) {
1624 dynlist_map_t *dlm_next;
1626 dli_next = dli->dli_next;
1628 ch_free( dli->dli_default_filter.bv_val );
1630 while ( dlm != NULL ) {
1631 dlm_next = dlm->dlm_next;
1642 static slap_overinst dynlist = { { NULL } };
1643 #ifdef TAKEOVER_DYNGROUP
1644 static char *obsolete_names[] = {
1650 #if SLAPD_OVER_DYNLIST == SLAPD_MOD_DYNAMIC
1652 #endif /* SLAPD_OVER_DYNLIST == SLAPD_MOD_DYNAMIC */
1654 dynlist_initialize(void)
1656 #ifndef OL_2_2_COMPAT
1660 dynlist.on_bi.bi_type = "dynlist";
1662 #ifdef TAKEOVER_DYNGROUP
1663 /* makes dynlist incompatible with dyngroup */
1664 dynlist.on_bi.bi_obsolete_names = obsolete_names;
1667 #ifdef OL_2_2_COMPAT
1668 dynlist.on_bi.bi_db_config = dynlist_db_config;
1670 dynlist.on_bi.bi_db_config = config_generic_wrapper;
1672 dynlist.on_bi.bi_db_open = dynlist_db_open;
1673 dynlist.on_bi.bi_db_destroy = dynlist_db_destroy;
1675 dynlist.on_response = dynlist_response;
1677 #ifndef OL_2_2_COMPAT
1678 dynlist.on_bi.bi_cf_ocs = dlocs;
1680 rc = config_register_schema( dlcfg, dlocs );
1686 return overlay_register( &dynlist );
1689 #if SLAPD_OVER_DYNLIST == SLAPD_MOD_DYNAMIC
1691 init_module( int argc, char *argv[] )
1693 return dynlist_initialize();
1697 #endif /* SLAPD_OVER_DYNLIST */