From: Kurt Zeilenga Date: Fri, 28 Feb 2003 07:06:06 +0000 (+0000) Subject: Use add_merge_one to add schema elements to subschema X-Git-Tag: NO_SLAP_OP_BLOCKS~252 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7735c44167acf9a149ce5eaf2cfc34a76db5ea4a;p=openldap Use add_merge_one to add schema elements to subschema --- diff --git a/servers/slapd/at.c b/servers/slapd/at.c index d0b3e241d7..45aaae32da 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -597,29 +597,32 @@ at_index_print( void ) int at_schema_info( Entry *e ) { - struct berval vals[2]; - AttributeType *at; - AttributeDescription *ad_attributeTypes = slap_schema.si_ad_attributeTypes; - - vals[1].bv_val = NULL; + AttributeType *at; + struct berval val; +#ifdef SLAP_NVALUES + struct berval nval; +#endif LDAP_SLIST_FOREACH(at,&attr_list,sat_next) { if( at->sat_flags & SLAP_AT_HIDE ) continue; - if ( ldap_attributetype2bv( &at->sat_atype, vals ) == NULL ) { + if ( ldap_attributetype2bv( &at->sat_atype, &val ) == NULL ) { return -1; } #ifdef SLAP_NVALUES - if( attr_merge( e, ad_attributeTypes, vals, NULL /* FIXME */ ) ) + nval.bv_val = at->sat_oid; + nval.bv_len = strlen(at->sat_oid); + + if( attr_merge_one( e, ad_attributeTypes, &val, &nval ) ) #else - if( attr_merge( e, ad_attributeTypes, vals ) ) + if( attr_merge_one( e, ad_attributeTypes, &val ) ) #endif { return -1; } - ldap_memfree( vals[0].bv_val ); + ldap_memfree( val.bv_val ); } return 0; } diff --git a/servers/slapd/cr.c b/servers/slapd/cr.c index 30384e0376..478687863e 100644 --- a/servers/slapd/cr.c +++ b/servers/slapd/cr.c @@ -399,36 +399,40 @@ int cr_schema_info( Entry *e ) { #ifdef SLAP_EXTENDED_SCHEMA - struct berval vals[2]; - ContentRule *cr; - AttributeDescription *ad_ditContentRules = slap_schema.si_ad_ditContentRules; + ContentRule *cr; - vals[1].bv_val = NULL; + struct berval val; +#ifdef SLAP_NVALUES + struct berval nval; +#endif LDAP_SLIST_FOREACH(cr, &cr_list, scr_next) { - if ( ldap_contentrule2bv( &cr->scr_crule, vals ) == NULL ) { + if ( ldap_contentrule2bv( &cr->scr_crule, &val ) == NULL ) { return -1; } #if 0 if( cr->scr_flags & SLAP_CR_HIDE ) continue; #endif - #if 0 Debug( LDAP_DEBUG_TRACE, "Merging cr [%ld] %s\n", - (long) vals[0].bv_len, vals[0].bv_val, 0 ); + (long) val.bv_len, val.bv_val, 0 ); #endif + #ifdef SLAP_NVALUES - if( attr_merge( e, ad_ditContentRules, vals, NULL ) ) + nval.bv_val = cr->scr_oid; + nval.bv_len = strlen(cr->scr_oid); + + if( attr_merge_one( e, ad_ditContentRules, &val, &nval ) ) #else - if( attr_merge( e, ad_ditContentRules, vals ) ) + if( attr_merge_one( e, ad_ditContentRules, &val ) ) #endif { return -1; } - ldap_memfree( vals[0].bv_val ); + ldap_memfree( val.bv_val ); } #endif return 0; diff --git a/servers/slapd/mr.c b/servers/slapd/mr.c index 3f6e9ea4c0..6a85025abb 100644 --- a/servers/slapd/mr.c +++ b/servers/slapd/mr.c @@ -442,9 +442,11 @@ int mr_usable_with_at( int mr_schema_info( Entry *e ) { - MatchingRule *mr; - AttributeDescription *ad_matchingRules = slap_schema.si_ad_matchingRules; + MatchingRule *mr; +#ifdef SLAP_NVALUES + struct berval nval; +#endif LDAP_SLIST_FOREACH(mr, &mr_list, smr_next ) { if ( mr->smr_usage & SLAP_MR_HIDE ) { @@ -467,7 +469,9 @@ int mr_schema_info( Entry *e ) mr->smr_str.bv_len, mr->smr_str.bv_val, 0 ); #endif #ifdef SLAP_NVALUES - if( attr_merge_one( e, ad_matchingRules, &mr->smr_str, NULL /* FIXME */ ) ) + nval.bv_val = mr->smr_oid; + nval.bv_len = strlen(mr->smr_oid); + if( attr_merge_one( e, ad_matchingRules, &mr->smr_str, &nval ) ) #else if( attr_merge_one( e, ad_matchingRules, &mr->smr_str ) ) #endif @@ -480,10 +484,12 @@ int mr_schema_info( Entry *e ) int mru_schema_info( Entry *e ) { - MatchingRuleUse *mru; - AttributeDescription *ad_matchingRuleUse = slap_schema.si_ad_matchingRuleUse; + MatchingRuleUse *mru; +#ifdef SLAP_NVALUES + struct berval nval; +#endif LDAP_SLIST_FOREACH( mru, &mru_list, smru_next ) { @@ -501,7 +507,9 @@ int mru_schema_info( Entry *e ) mru->smru_str.bv_len, mru->smru_str.bv_val, 0 ); #endif #ifdef SLAP_NVALUES - if( attr_merge_one( e, ad_matchingRuleUse, &mru->smru_str, NULL /* FIXME */ ) ) + nval.bv_val = mru->smru_oid; + nval.bv_len = strlen(mru->smru_oid); + if( attr_merge_one( e, ad_matchingRuleUse, &mru->smru_str, &nval ) ) #else if( attr_merge_one( e, ad_matchingRuleUse, &mru->smru_str ) ) #endif diff --git a/servers/slapd/oc.c b/servers/slapd/oc.c index 9b901ca475..9159a8ed70 100644 --- a/servers/slapd/oc.c +++ b/servers/slapd/oc.c @@ -480,33 +480,36 @@ oc_add( int oc_schema_info( Entry *e ) { - struct berval vals[2]; - ObjectClass *oc; - AttributeDescription *ad_objectClasses = slap_schema.si_ad_objectClasses; - - vals[1].bv_val = NULL; + ObjectClass *oc; + struct berval val; +#ifdef SLAP_NVALUES + struct berval nval; +#endif LDAP_SLIST_FOREACH( oc, &oc_list, soc_next ) { if( oc->soc_flags & SLAP_OC_HIDE ) continue; - if ( ldap_objectclass2bv( &oc->soc_oclass, vals ) == NULL ) { + if ( ldap_objectclass2bv( &oc->soc_oclass, &val ) == NULL ) { return -1; } #if 0 Debug( LDAP_DEBUG_TRACE, "Merging oc [%ld] %s\n", - (long) vals[0].bv_len, vals[0].bv_val, 0 ); + (long) val.bv_len, val.bv_val, 0 ); #endif #ifdef SLAP_NVALUES - if( attr_merge( e, ad_objectClasses, vals, NULL /* FIXME */ ) ) + nval.bv_val = oc->soc_oid; + nval.bv_len = strlen(oc->soc_oid); + + if( attr_merge_one( e, ad_objectClasses, &val, &nval ) ) #else - if( attr_merge( e, ad_objectClasses, vals ) ) + if( attr_merge_one( e, ad_objectClasses, &val ) ) #endif { return -1; } - ldap_memfree( vals[0].bv_val ); + ldap_memfree( val.bv_val ); } return 0; } diff --git a/servers/slapd/syntax.c b/servers/slapd/syntax.c index f8468a91aa..a255ad42d2 100644 --- a/servers/slapd/syntax.c +++ b/servers/slapd/syntax.c @@ -210,12 +210,12 @@ register_syntax( int syn_schema_info( Entry *e ) { - struct berval vals[2]; - Syntax *syn; - AttributeDescription *ad_ldapSyntaxes = slap_schema.si_ad_ldapSyntaxes; - - vals[1].bv_val = NULL; + Syntax *syn; + struct berval val; +#ifdef SLAP_NVALUES + struct berval nval; +#endif LDAP_SLIST_FOREACH(syn, &syn_list, ssyn_next ) { if ( ! syn->ssyn_validate ) { @@ -227,29 +227,32 @@ syn_schema_info( Entry *e ) continue; } - if ( ldap_syntax2bv( &syn->ssyn_syn, vals ) == NULL ) { + if ( ldap_syntax2bv( &syn->ssyn_syn, &val ) == NULL ) { return -1; } #if 0 #ifdef NEW_LOGGING LDAP_LOG( config, ENTRY, "syn_schema_info: Merging syn [%ld] %s\n", - (long)vals[0].bv_len, vals[0].bv_val, 0 ); + (long)val.bv_len, val.bv_val, 0 ); #else Debug( LDAP_DEBUG_TRACE, "Merging syn [%ld] %s\n", - (long) vals[0].bv_len, vals[0].bv_val, 0 ); + (long) val.bv_len, val.bv_val, 0 ); #endif - #endif + #ifdef SLAP_NVALUES - if( attr_merge( e, ad_ldapSyntaxes, vals, NULL /* FIXME */ ) ) + nval.bv_val = syn->ssyn_oid; + nval.bv_len = strlen(syn->ssyn_oid); + + if( attr_merge_one( e, ad_ldapSyntaxes, &val, &nval ) ) #else - if( attr_merge( e, ad_ldapSyntaxes, vals ) ) + if( attr_merge_one( e, ad_ldapSyntaxes, &val ) ) #endif { return -1; } - ldap_memfree( vals[0].bv_val ); + ldap_memfree( val.bv_val ); } return 0; }