]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/at.c
Prepare for unifdef -DSLAPD_SCHEMA_NOT_COMPAT
[openldap] / servers / slapd / at.c
index 9a7872db7a7241182d2e373d2dd5ef79f7e6ac84..3271ed303ea89db5f564674e9dc1b1422c2f844f 100644 (file)
@@ -92,7 +92,7 @@ at_config(
 #define SYNTAX_DSCE_OID        "2.5.13.5"
 #define SYNTAX_IA5_OID "1.3.6.1.4.1.1466.115.121.1.26"
 #define SYNTAX_IA5CE_OID       "1.3.6.1.4.1.1466.109.114.1"
-#define SYNTAX_DN_OID  SLAPD_OID_DN_SYNTAX
+#define SYNTAX_DN_OID  "1.3.6.1.4.1.1466.115.121.1.12"
 #define SYNTAX_TEL_OID "1.3.6.1.4.1.1466.115.121.1.50"
 #define SYNTAX_BIN_OID "1.3.6.1.4.1.1466.115.121.1.40" /* octetString */
 
@@ -173,6 +173,19 @@ at_fake_if_needed(
 
 #endif
 
+int is_at_syntax(
+       AttributeType *at,
+       const char *oid )
+{
+       for( ; at != NULL; at = at->sat_sup ) {
+               if( at->sat_syntax_oid ) {
+                       return ( strcmp( at->sat_syntax_oid, oid ) == 0 );
+               }
+       }
+
+       return 0;
+}
+
 int is_at_subtype(
        AttributeType *sub,
        AttributeType *sup )
@@ -203,7 +216,7 @@ attr_index_cmp(
 
 static int
 attr_index_name_cmp(
-    char               *type,
+    const char                 *type,
     struct aindexrec   *air
 )
 {
@@ -554,20 +567,27 @@ at_schema_info( Entry *e )
        struct berval   *vals[2];
        AttributeType   *at;
 
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
+       AttributeDescription *ad_attributeTypes = slap_schema.si_ad_attributeTypes;
+#else
+       char *ad_attributeTypes = "attributeTypes";
+#endif
+
        vals[0] = &val;
        vals[1] = NULL;
 
        for ( at = attr_list; at; at = at->sat_next ) {
                val.bv_val = ldap_attributetype2str( &at->sat_atype );
-               if ( val.bv_val ) {
-                       val.bv_len = strlen( val.bv_val );
-                       Debug( LDAP_DEBUG_TRACE, "Merging at [%ld] %s\n",
-                              (long) val.bv_len, val.bv_val, 0 );
-                       attr_merge( e, "attributeTypes", vals );
-                       ldap_memfree( val.bv_val );
-               } else {
+               if ( val.bv_val == NULL ) {
                        return -1;
                }
+               val.bv_len = strlen( val.bv_val );
+#if 0
+               Debug( LDAP_DEBUG_TRACE, "Merging at [%ld] %s\n",
+                      (long) val.bv_len, val.bv_val, 0 );
+#endif
+               attr_merge( e, ad_attributeTypes, vals );
+               ldap_memfree( val.bv_val );
        }
        return 0;
 }