-#ifdef OL_2_2_COMPAT
-static int
-dynlist_db_config(
- BackendDB *be,
- const char *fname,
- int lineno,
- int argc,
- char **argv )
-{
- slap_overinst *on = (slap_overinst *)be->bd_info;
-
- int rc = 0;
-
- if ( strcasecmp( argv[0], "dynlist-attrset" ) == 0 ) {
- dynlist_info_t **dlip;
- ObjectClass *oc;
- AttributeDescription *ad = NULL,
- *member_ad = NULL;
- dynlist_map_t *dlm = NULL;
- const char *text;
-
- if ( argc < 3 ) {
- Debug( LDAP_DEBUG_ANY, "%s: line %d: " DYNLIST_USAGE
- "invalid arg number #%d.\n",
- fname, lineno, argc );
- return 1;
- }
-
- oc = oc_find( argv[1] );
- if ( oc == NULL ) {
- Debug( LDAP_DEBUG_ANY, "%s: line %d: " DYNLIST_USAGE
- "unable to find ObjectClass \"%s\"\n",
- fname, lineno, argv[ 1 ] );
- return 1;
- }
-
- rc = slap_str2ad( argv[2], &ad, &text );
- if ( rc != LDAP_SUCCESS ) {
- Debug( LDAP_DEBUG_ANY, "%s: line %d: " DYNLIST_USAGE
- "unable to find AttributeDescription \"%s\"\n",
- fname, lineno, argv[2] );
- return 1;
- }
-
- if ( !is_at_subtype( ad->ad_type, slap_schema.si_ad_labeledURI->ad_type ) ) {
- Debug( LDAP_DEBUG_ANY, "%s: line %d: " DYNLIST_USAGE
- "AttributeDescription \"%s\" "
- "must be a subtype of \"labeledURI\"\n",
- fname, lineno, argv[2] );
- return 1;
- }
-
- for ( i = 3; i < argc; i++ ) {
- char *arg;
- char *cp;
- AttributeDescription *member_ad = NULL;
- AttributeDescription *mapped_ad = NULL;
- dynlist_map_t *dlmp;
- dynlist_map_t *dlml;
-
-
- /*
- * If no mapped attribute is given, dn is used
- * for backward compatibility.
- */
- arg = argv[i];
- if ( cp = strchr( arg, (int)':' ) != NULL ) {
- struct berval bv;
- ber_str2bv( arg, cp - arg, 0, &bv );
- rc = slap_bv2ad( &bv, &mapped_ad, &text );
- if ( rc != LDAP_SUCCESS ) {
- Debug( LDAP_DEBUG_ANY, "%s: line %d: "
- DYNLIST_USAGE
- "unable to find mapped AttributeDescription \"%s\"\n",
- fname, lineno, arg );
- return 1;
- }
-
- arg = cp + 1;
- }
-
- rc = slap_str2ad( arg, &member_ad, &text );
- if ( rc != LDAP_SUCCESS ) {
- Debug( LDAP_DEBUG_ANY, "%s: line %d: "
- DYNLIST_USAGE
- "unable to find AttributeDescription \"%s\"\n",
- fname, lineno, arg );
- return 1;
- }
-
- dlmp = (dynlist_map_t *)ch_calloc( 1, sizeof( dynlist_map_t ) );
- if ( dlm == NULL ) {
- dlm = dlmp;
- dlml = NULL;
- }
- dlmp->dlm_member_ad = member_ad;
- dlmp->dlm_mapped_ad = mapped_ad;
- dlmp->dlm_next = NULL;
-
- if ( dlml != NULL )
- dlml->dlm_next = dlmp;
- dlml = dlmp;
- }
-
- for ( dlip = (dynlist_info_t **)&on->on_bi.bi_private;
- *dlip; dlip = &(*dlip)->dli_next )
- {
- /*
- * The same URL attribute / member attribute pair
- * cannot be repeated, but we enforce this only
- * when the member attribute is unique. Performing
- * the check for multiple values would require
- * sorting and comparing the lists, which is left
- * as a future improvement
- */
- if ( (*dlip)->dli_ad == ad &&
- (*dlip)->dli_dlm->dlm_next == NULL &&
- dlm->dlm_next == NULL &&
- dlm->dlm_member_ad == (*dlip)->dli_dlm->dlm_member_ad &&
- dlm->dlm_mapped_ad == (*dlip)->dli_dlm->dlm_mapped_ad ) {
- Debug( LDAP_DEBUG_ANY, "%s: line %d: "
- DYNLIST_USAGE
- "URL attributeDescription \"%s\" already mapped.\n",
- fname, lineno, ad->ad_cname.bv_val );
-#if 0
- /* make it a warning... */
- return 1;
-#endif
- }
- }
-
- *dlip = (dynlist_info_t *)ch_calloc( 1, sizeof( dynlist_info_t ) );
- (*dlip)->dli_oc = oc;
- (*dlip)->dli_ad = ad;
- (*dlip)->dli_dlm = dlm;
-
- if ( dynlist_build_def_filter( *dlip ) ) {
- dynlist_map_t *dlm = (*dlip)->ldi_dlm;
- dynlist_map_t *dlm_next;
-
- while ( dlm != NULL ) {
- dlm_next = dlm->dlm_next;
- ch_free( dlm );
- dlm = dlm_next;
- }
-
- ch_free( *dlip );
- *dlip = NULL;
- return 1;
- }
-
- /* allow dyngroup syntax */
- } else if ( strcasecmp( argv[0], "dynlist-attrpair" ) == 0 ) {
- dynlist_info_t **dlip;
- ObjectClass *oc;
- AttributeDescription *ad = NULL,
- *member_ad = NULL;
- const char *text;
-
- if ( argc != 3 ) {
- Debug( LDAP_DEBUG_ANY, "%s: line %d: "
- "\"dynlist-attrpair <member-ad> <URL-ad>\": "
- "invalid arg number #%d.\n",
- fname, lineno, argc );
- return 1;
- }
-
- oc = oc_find( "groupOfURLs" );
- if ( oc == NULL ) {
- Debug( LDAP_DEBUG_ANY, "%s: line %d: "
- "\"dynlist-attrpair <member-ad> <URL-ad>\": "
- "unable to find default ObjectClass \"groupOfURLs\"\n",
- fname, lineno, 0 );
- return 1;
- }
-
- rc = slap_str2ad( argv[1], &member_ad, &text );
- if ( rc != LDAP_SUCCESS ) {
- Debug( LDAP_DEBUG_ANY, "%s: line %d: "
- "\"dynlist-attrpair <member-ad> <URL-ad>\": "
- "unable to find AttributeDescription \"%s\"\n",
- fname, lineno, argv[1] );
- return 1;
- }
-
- rc = slap_str2ad( argv[2], &ad, &text );
- if ( rc != LDAP_SUCCESS ) {
- Debug( LDAP_DEBUG_ANY, "%s: line %d: "
- "\"dynlist-attrpair <member-ad> <URL-ad>\": "
- "unable to find AttributeDescription \"%s\"\n",
- fname, lineno, argv[2] );
- return 1;
- }
-
- if ( !is_at_subtype( ad->ad_type, slap_schema.si_ad_labeledURI->ad_type ) ) {
- Debug( LDAP_DEBUG_ANY, "%s: line %d: "
- "\"dynlist-attrpair <member-ad> <URL-ad>\": "
- "AttributeDescription \"%s\" "
- "must be a subtype of \"labeledURI\"\n",
- fname, lineno, argv[2] );
- return 1;
- }
-
- for ( dlip = (dynlist_info_t **)&on->on_bi.bi_private;
- *dlip; dlip = &(*dlip)->dli_next )
- {
- /*
- * The same URL attribute / member attribute pair
- * cannot be repeated, but we enforce this only
- * when the member attribute is unique. Performing
- * the check for multiple values would require
- * sorting and comparing the lists, which is left
- * as a future improvement
- */
- if ( (*dlip)->dli_ad == ad &&
- (*dlip)->dli_dlm->dlm_next == NULL &&
- member_ad == (*dlip)->dli_dlm->dlm_member_ad ) {
- Debug( LDAP_DEBUG_ANY, "%s: line %d: "
- "\"dynlist-attrpair <member-ad> <URL-ad>\": "
- "URL attributeDescription \"%s\" already mapped.\n",
- fname, lineno, ad->ad_cname.bv_val );
-#if 0
- /* make it a warning... */
- return 1;
-#endif
- }
- }
-
- *dlip = (dynlist_info_t *)ch_calloc( 1, sizeof( dynlist_info_t ) );
- (*dlip)->dli_oc = oc;
- (*dlip)->dli_ad = ad;
- (*dlip)->dli_dlm = (dynlist_map_t *)ch_calloc( 1, sizeof( dynlist_map_t ) );
- (*dlip)->dli_dlm->dlm_member_ad = member_ad;
- (*dlip)->dli_dlm->dlm_mapped_ad = NULL;
-
- if ( dynlist_build_def_filter( *dlip ) ) {
- ch_free( (*dlip)->dli_dlm );
- ch_free( *dlip );
- *dlip = NULL;
- return 1;
- }
-
- } else {
- rc = SLAP_CONF_UNKNOWN;
- }
-
- return rc;
-}
-
-#else