]> git.sur5r.net Git - openldap/commitdiff
Config should presrve OID macros in attr syntax field as well
authorQuanah Gibson-Mount <quanah@openldap.org>
Tue, 8 Jul 2008 21:01:38 +0000 (21:01 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 8 Jul 2008 21:01:38 +0000 (21:01 +0000)
servers/slapd/at.c
servers/slapd/slap.h

index 04c0d0168e3412564cf47ee0a0ae1ab6279feba1..de44c27561bc293977be91d68e80f48d01e5b03c 100644 (file)
@@ -288,6 +288,10 @@ at_clean( AttributeType *a )
                ldap_memfree( a->sat_oidmacro );
                a->sat_oidmacro = NULL;
        }
+       if ( a->sat_soidmacro ) {
+               ldap_memfree( a->sat_soidmacro );
+               a->sat_soidmacro = NULL;
+       }
        if ( a->sat_subtypes ) {
                ldap_memfree( a->sat_subtypes );
                a->sat_subtypes = NULL;
@@ -590,6 +594,7 @@ at_add(
        int             code = LDAP_SUCCESS;
        char            *cname = NULL;
        char            *oidm = NULL;
+       char            *soidm = NULL;
 
        if ( !at->at_oid ) {
                *err = "";
@@ -622,7 +627,7 @@ at_add(
                        goto error_return;
                }
                if ( oid != at->at_syntax_oid ) {
-                       ldap_memfree( at->at_syntax_oid );
+                       soidm = at->at_syntax_oid;
                        at->at_syntax_oid = oid;
                }
        }
@@ -673,6 +678,7 @@ at_add(
        sat->sat_cname.bv_val = cname;
        sat->sat_cname.bv_len = strlen( cname );
        sat->sat_oidmacro = oidm;
+       sat->sat_soidmacro = soidm;
        ldap_pvt_thread_mutex_init(&sat->sat_ad_mutex);
 
        if ( at->at_sup_oid ) {
@@ -979,9 +985,12 @@ at_unparse( BerVarray *res, AttributeType *start, AttributeType *end, int sys )
        for ( at=start; at; at=LDAP_STAILQ_NEXT(at, sat_next)) {
                LDAPAttributeType lat, *latp;
                if ( sys && !(at->sat_flags & SLAP_AT_HARDCODE)) break;
-               if ( at->sat_oidmacro ) {
+               if ( at->sat_oidmacro || at->sat_soidmacro ) {
                        lat = at->sat_atype;
-                       lat.at_oid = at->sat_oidmacro;
+                       if ( at->sat_oidmacro )
+                               lat.at_oid = at->sat_oidmacro;
+                       if ( at->sat_soidmacro )
+                               lat.at_syntax_oid = at->sat_soidmacro;
                        latp = &lat;
                } else {
                        latp = &at->sat_atype;
index cad6b7038f8712f6142248a5550e32bd69d2e680..c5135e6e1a4132535520dfa7ce5f0cd1cfde1c47 100644 (file)
@@ -680,7 +680,8 @@ struct AttributeType {
        Syntax                          *sat_syntax;
 
        AttributeTypeSchemaCheckFN      *sat_check;
-       char                            *sat_oidmacro;
+       char                            *sat_oidmacro;  /* attribute OID */
+       char                            *sat_soidmacro; /* syntax OID */
 
 #define SLAP_AT_NONE                   0x0000U
 #define SLAP_AT_ABSTRACT               0x0100U /* cannot be instantiated */