]> git.sur5r.net Git - openldap/commitdiff
Use add_merge_one to add schema elements to subschema
authorKurt Zeilenga <kurt@openldap.org>
Fri, 28 Feb 2003 07:06:06 +0000 (07:06 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 28 Feb 2003 07:06:06 +0000 (07:06 +0000)
servers/slapd/at.c
servers/slapd/cr.c
servers/slapd/mr.c
servers/slapd/oc.c
servers/slapd/syntax.c

index d0b3e241d77f6dc95f46529dd4eee5019e222d0d..45aaae32da567d5fa833315fcbe3c29876f6580c 100644 (file)
@@ -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;
 }
index 30384e0376cc0f222b972f3f5caa05b2284c820a..478687863ee4fbb495b5c15d9a2eb3ed7a0d3869 100644 (file)
@@ -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;
index 3f6e9ea4c0c87199002c2dbff46317707b9273e7..6a85025abb581a39a1c909cc2d57a06788520aee 100644 (file)
@@ -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
index 9b901ca475e74744f7f329f2fd4fcd50bcc4b6b5..9159a8ed705a6b4b614dbeacb7f1317f9364e286 100644 (file)
@@ -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;
 }
index f8468a91aa00dd3b25471cf7a319fd241b87a816..a255ad42d28d467b8f7f6483a7ed32439110ead2 100644 (file)
@@ -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;
 }