From: Howard Chu Date: Thu, 19 Aug 2004 23:39:45 +0000 (+0000) Subject: ITS#3289 - add SLAP_AT_DYNAMIC flag for dynamically generated attributes. X-Git-Tag: OPENLDAP_REL_ENG_2_3_0ALPHA~686 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=af8cb90ed80c5bec076d3e64fed66354afef9517;p=openldap ITS#3289 - add SLAP_AT_DYNAMIC flag for dynamically generated attributes. Set flag for hasSubordinates and subschemaSubentry. Strip dynamic attributes before storing entries in syncrepl. --- diff --git a/servers/slapd/schema_prep.c b/servers/slapd/schema_prep.c index 33366f3a10..e1c09e1daa 100644 --- a/servers/slapd/schema_prep.c +++ b/servers/slapd/schema_prep.c @@ -495,7 +495,7 @@ static struct slap_schema_ad_map { "EQUALITY booleanMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", - NULL, 0, + NULL, SLAP_AT_DYNAMIC, NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_hasSubordinates) }, @@ -504,7 +504,7 @@ static struct slap_schema_ad_map { "EQUALITY distinguishedNameMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE " "NO-USER-MODIFICATION USAGE directoryOperation )", - NULL, 0, + NULL, SLAP_AT_DYNAMIC, NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_subschemaSubentry) }, diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 7918818f9c..138622e14d 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -622,6 +622,8 @@ typedef struct slap_attribute_type { #else #define SLAP_AT_HIDE 0x8000U /* hide attribute */ #endif +#define SLAP_AT_DYNAMIC 0x0400U /* dynamically generated */ + slap_mask_t sat_flags; LDAP_SLIST_ENTRY(slap_attribute_type) sat_next; diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index ec6a067c8c..898b161f7f 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -1057,6 +1057,18 @@ syncrepl_message_to_entry( #endif goto done; } + + /* Strip out dynamically generated attrs */ + for ( modtail = modlist; *modtail ; ) { + mod = *modtail; + if ( mod->sml_desc->ad_type->sat_flags & SLAP_AT_DYNAMIC ) { + *modtail = mod->sml_next; + slap_mod_free( &mod->sml_mod, 0 ); + free( mod ); + } else { + modtail = &mod->sml_next; + } + } rc = slap_mods2entry( *modlist, &e, 1, 1, &text, txtbuf, textlen); if( rc != LDAP_SUCCESS ) {