From: Pierangelo Masarati Date: Tue, 29 Nov 2005 10:02:05 +0000 (+0000) Subject: allow dynlist to take over dyngroup X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~655 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fed3c18e889eddf1a176c2105f06d926de07fea9;p=openldap allow dynlist to take over dyngroup --- diff --git a/servers/slapd/backover.c b/servers/slapd/backover.c index 1a2aa3e0e5..0aa4a72be9 100644 --- a/servers/slapd/backover.c +++ b/servers/slapd/backover.c @@ -716,6 +716,69 @@ overlay_register( slap_overinst *on ) { + slap_overinst *tmp; + + /* FIXME: check for duplicates? */ + for ( tmp = overlays; tmp != NULL; tmp = tmp->on_next ) { + if ( strcmp( on->on_bi.bi_type, tmp->on_bi.bi_type ) == 0 ) { + Debug( LDAP_DEBUG_ANY, + "overlay_register(\"%s\"): " + "name already in use.\n", + on->on_bi.bi_type, 0, 0 ); + return -1; + } + + if ( on->on_bi.bi_obsolete_names != NULL ) { + int i; + + for ( i = 0; on->on_bi.bi_obsolete_names[ i ] != NULL; i++ ) { + if ( strcmp( on->on_bi.bi_obsolete_names[ i ], tmp->on_bi.bi_type ) == 0 ) { + Debug( LDAP_DEBUG_ANY, + "overlay_register(\"%s\"): " + "obsolete name \"%s\" already in use " + "by overlay \"%s\".\n", + on->on_bi.bi_type, + on->on_bi.bi_obsolete_names[ i ], + tmp->on_bi.bi_type ); + return -1; + } + } + } + + if ( tmp->on_bi.bi_obsolete_names != NULL ) { + int i; + + for ( i = 0; tmp->on_bi.bi_obsolete_names[ i ] != NULL; i++ ) { + int j; + + if ( strcmp( on->on_bi.bi_type, tmp->on_bi.bi_obsolete_names[ i ] ) == 0 ) { + Debug( LDAP_DEBUG_ANY, + "overlay_register(\"%s\"): " + "name already in use " + "as obsolete by overlay \"%s\".\n", + on->on_bi.bi_type, + tmp->on_bi.bi_obsolete_names[ i ], 0 ); + return -1; + } + + if ( on->on_bi.bi_obsolete_names != NULL ) { + for ( j = 0; on->on_bi.bi_obsolete_names[ j ] != NULL; j++ ) { + if ( strcmp( on->on_bi.bi_obsolete_names[ j ], tmp->on_bi.bi_obsolete_names[ i ] ) == 0 ) { + Debug( LDAP_DEBUG_ANY, + "overlay_register(\"%s\"): " + "obsolete name \"%s\" already in use " + "as obsolete by overlay \"%s\".\n", + on->on_bi.bi_type, + on->on_bi.bi_obsolete_names[ j ], + tmp->on_bi.bi_type ); + return -1; + } + } + } + } + } + } + on->on_next = overlays; overlays = on; return 0; @@ -723,8 +786,8 @@ overlay_register( /* * iterator on registered overlays; overlay_next( NULL ) returns the first - * overlay; * subsequent calls with the previously returned value allow to - * iterate * over the entire list; returns NULL when no more overlays are + * overlay; subsequent calls with the previously returned value allow to + * iterate over the entire list; returns NULL when no more overlays are * registered. */ @@ -771,7 +834,6 @@ overlay_find( const char *over_type ) } } } - } foundit:; diff --git a/servers/slapd/overlays/dynlist.c b/servers/slapd/overlays/dynlist.c index 80c3835446..7e89538117 100644 --- a/servers/slapd/overlays/dynlist.c +++ b/servers/slapd/overlays/dynlist.c @@ -24,6 +24,8 @@ #if LDAP_VENDOR_VERSION_MINOR != X && LDAP_VENDOR_VERSION_MINOR < 3 #define OL_2_2_COMPAT +#elif defined(LDAP_DEVEL) && SLAPD_OVER_DYNGROUP != SLAPD_MOD_STATIC +#define TAKEOVER_DYNGROUP #endif #include @@ -867,6 +869,7 @@ dynlist_db_config( enum { DL_ATTRSET = 1, DL_ATTRPAIR, + DL_ATTRPAIR_COMPAT, DL_LAST }; @@ -884,6 +887,11 @@ static ConfigTable dlcfg[] = { { "dynlist-attrpair", "member-ad> msg, sizeof( c->msg ), + "warning: \"attrpair\" only supported for limited " + "backward compatibility with overlay \"dyngroup\"" ); + Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->msg, 0 ); + /* fallthru */ + case DL_ATTRPAIR: { dynlist_info_t **dlip; ObjectClass *oc = NULL; @@ -1231,7 +1248,11 @@ dynlist_db_destroy( return 0; } -static slap_overinst dynlist = { { NULL } }; +static slap_overinst dynlist = { { NULL } }; +static char *obsolete_names[] = { + "dyngroup", + NULL +}; #if SLAPD_OVER_DYNLIST == SLAPD_MOD_DYNAMIC static @@ -1244,6 +1265,12 @@ dynlist_initialize(void) #endif dynlist.on_bi.bi_type = "dynlist"; + +#ifdef TAKEOVER_DYNGROUP + /* makes dynlist incompatible with dyngroup */ + dynlist.on_bi.bi_obsolete_names = obsolete_names; +#endif + #ifdef OL_2_2_COMPAT dynlist.on_bi.bi_db_config = dynlist_db_config; #else