]> git.sur5r.net Git - openldap/commitdiff
Keep hardcoded schema together in lists
authorHoward Chu <hyc@openldap.org>
Fri, 17 Nov 2006 20:11:11 +0000 (20:11 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 17 Nov 2006 20:11:11 +0000 (20:11 +0000)
servers/slapd/at.c
servers/slapd/oc.c
servers/slapd/oidm.c

index 7ab6eed84fd0cf7761791aaa84a301ffd44446e1..e02acf90a026cf63d6fb2bb3252f32e0ac4c2023 100644 (file)
@@ -61,6 +61,9 @@ static Avlnode        *attr_cache = NULL;
 static LDAP_STAILQ_HEAD(ATList, slap_attribute_type) attr_list
        = LDAP_STAILQ_HEAD_INITIALIZER(attr_list);
 
+/* Last hardcoded attribute registered */
+static AttributeType *attr_sys_tail;
+
 int at_oc_cache;
 
 static int
@@ -525,6 +528,10 @@ at_insert(
                }
        }
 
+       if ( sat->sat_flags & SLAP_AT_HARDCODE ) {
+               prev = attr_sys_tail;
+               attr_sys_tail = sat;
+       }
        if ( prev ) {
                LDAP_STAILQ_INSERT_AFTER( &attr_list, prev, sat, sat_next );
        } else {
index a483922aa31b07010dd65ec5e30c1e30f7f7089c..87ced2d7cb073183b6791a7254db9eb2187b9b39 100644 (file)
@@ -134,6 +134,7 @@ static Avlnode      *oc_index = NULL;
 static Avlnode *oc_cache = NULL;
 static LDAP_STAILQ_HEAD(OCList, slap_object_class) oc_list
        = LDAP_STAILQ_HEAD_INITIALIZER(oc_list);
+static ObjectClass *oc_sys_tail;
 
 static int
 oc_index_cmp(
@@ -669,7 +670,15 @@ oc_insert(
                        names++;
                }
        }
-       LDAP_STAILQ_INSERT_TAIL( &oc_list, soc, soc_next );
+       if ( soc->soc_flags & SLAP_OC_HARDCODE ) {
+               prev = oc_sys_tail;
+               oc_sys_tail = soc;
+       }
+       if ( prev ) {
+               LDAP_STAILQ_INSERT_AFTER( &oc_list, prev, soc, soc_next );
+       } else {
+               LDAP_STAILQ_INSERT_TAIL( &oc_list, soc, soc_next );
+       }
 
        return 0;
 }
index 9d2cef857eb7e2cc512e8359bfec6f2f5b5da4d4..2fe6cc552c7f5db2ebd3e94dbbf2aa62abebcc40 100644 (file)
@@ -29,6 +29,8 @@
 static LDAP_STAILQ_HEAD(OidMacroList, slap_oid_macro) om_list
        = LDAP_STAILQ_HEAD_INITIALIZER(om_list);
 
+static OidMacro *om_sys_tail;
+
 /* Replace an OID Macro invocation with its full numeric OID.
  * If the macro is used with "macroname:suffix" append ".suffix"
  * to the expansion.
@@ -98,7 +100,7 @@ parse_oidm(
        OidMacro **rom)
 {
        char *oid;
-       OidMacro *om = NULL;
+       OidMacro *om = NULL, *prev = NULL;
        struct berval bv;
 
        oid = oidm_find( c->argv[1] );
@@ -144,10 +146,16 @@ parse_oidm(
        }
 
        om->som_oid.bv_len = strlen( om->som_oid.bv_val );
-       if ( !user )
+       if ( !user ) {
                om->som_flags |= SLAP_OM_HARDCODE;
+               prev = om_sys_tail;
+       }
 
-       LDAP_STAILQ_INSERT_TAIL( &om_list, om, som_next );
+       if ( prev ) {
+               LDAP_STAILQ_INSERT_AFTER( &om_list, prev, om, som_next );
+       } else {
+               LDAP_STAILQ_INSERT_TAIL( &om_list, om, som_next );
+       }
        if ( rom ) *rom = om;
        return 0;
 }