From: Kurt Zeilenga Date: Fri, 28 Jan 2000 00:33:29 +0000 (+0000) Subject: Put more old schema code behind SLAPD_SCHEMA_COMPAT (which still X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~3230 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e9b1012fb1e572ea93b355f15c946b8b431e0160;p=openldap Put more old schema code behind SLAPD_SCHEMA_COMPAT (which still MUST be defined). --- diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index fe3029b9c5..9753015e45 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -403,18 +403,28 @@ acl_mask( bv.bv_len = strlen( bv.bv_val ); /* see if asker is listed in dnattr */ - if ( (at = attr_find( e->e_attrs, b->a_dn_at )) != NULL && - value_find( at->a_vals, &bv, at->a_syntax, 3 ) == 0 ) + if ( (at = attr_find( e->e_attrs, b->a_dn_at )) != NULL +#ifdef SLAPD_SCHEMA_COMPAT + && value_find( at->a_vals, &bv, at->a_syntax, 3 ) == 0 +#endif + ) { if ( b->a_dn_self && - (val == NULL || value_cmp( &bv, val, at->a_syntax, 2 )) ) + (val == NULL +#ifdef SLAPD_SCHEMA_COMPAT + || value_cmp( &bv, val, at->a_syntax, 2 ) +#endif + ) ) { continue; } /* asker not listed in dnattr - check for self access */ - } else if ( ! b->a_dn_self || val == NULL || - value_cmp( &bv, val, at->a_syntax, 2 ) != 0 ) + } else if ( ! b->a_dn_self || val == NULL +#ifdef SLAPD_SCHEMA_COMPAT + || value_cmp( &bv, val, at->a_syntax, 2 ) != 0 +#endif + ) { continue; } diff --git a/servers/slapd/attr.c b/servers/slapd/attr.c index 74407d493c..f61c7b218f 100644 --- a/servers/slapd/attr.c +++ b/servers/slapd/attr.c @@ -75,7 +75,9 @@ Attribute *attr_dup( Attribute *a ) } tmp->a_type = ch_strdup( a->a_type ); +#ifdef SLAPD_SCHEMA_COMPAT tmp->a_syntax = a->a_syntax; +#endif tmp->a_next = NULL; return tmp; @@ -142,7 +144,9 @@ attr_merge_fast( **a = (Attribute *) ch_malloc( sizeof(Attribute) ); (**a)->a_type = attr_normalize( ch_strdup( type ) ); (**a)->a_vals = NULL; +#ifdef SLAPD_SCHEMA_COMPAT (**a)->a_syntax = attr_syntax( type ); +#endif (**a)->a_next = NULL; } @@ -176,7 +180,9 @@ attr_merge( *a = (Attribute *) ch_malloc( sizeof(Attribute) ); (*a)->a_type = attr_normalize( ch_strdup( type ) ); (*a)->a_vals = NULL; +#ifdef SLAPD_SCHEMA_COMPAT (*a)->a_syntax = attr_syntax( type ); +#endif (*a)->a_next = NULL; } @@ -235,6 +241,8 @@ attr_delete( return( 0 ); } +#ifdef SLAPD_SCHEMA_COMPAT + #define DEFAULT_SYNTAX SYNTAX_CIS /* @@ -253,6 +261,7 @@ attr_syntax( char *type ) return( DEFAULT_SYNTAX ); } +#endif /* * attr_syntax_config - process an attribute syntax config line diff --git a/servers/slapd/ava.c b/servers/slapd/ava.c index b3f314050a..5bc0ec3d6b 100644 --- a/servers/slapd/ava.c +++ b/servers/slapd/ava.c @@ -26,7 +26,9 @@ get_ava( return( -1 ); } attr_normalize( ava->ava_type ); +#ifdef SLAPD_SCHEMA_COMPAT value_normalize( ava->ava_value.bv_val, attr_syntax( ava->ava_type ) ); +#endif return( LDAP_SUCCESS ); } diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 3f185868d0..9aa6568a60 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -631,7 +631,11 @@ backend_group( #ifdef SLAPD_SCHEMA_DN Attribute *backend_subschemasubentry( Backend *be ) { + /* + * This routine returns points to STATIC data!!! + */ /* should be backend specific */ + static struct berval ss_val = { sizeof(SLAPD_SCHEMA_DN)-1, SLAPD_SCHEMA_DN }; @@ -639,7 +643,9 @@ Attribute *backend_subschemasubentry( Backend *be ) static Attribute ss_attr = { "subschemasubentry", ss_vals, +#ifdef SLAPD_SCHEMA_COMPAT SYNTAX_DN | SYNTAX_CIS, +#endif NULL }; diff --git a/servers/slapd/filter.c b/servers/slapd/filter.c index ad0aed6461..d02e657330 100644 --- a/servers/slapd/filter.c +++ b/servers/slapd/filter.c @@ -241,8 +241,10 @@ get_substring_filter( attr_normalize( f->f_sub_type ); +#ifdef SLAPD_SCHEMA_COMPAT /* should get real syntax and see if we have a substring matching rule */ syntax = attr_syntax( f->f_sub_type ); +#endif f->f_sub_initial = NULL; f->f_sub_any = NULL; @@ -265,8 +267,10 @@ get_substring_filter( return( LDAP_INVALID_SYNTAX ); } +#ifdef SLAPD_SCHEMA_COMPAT /* we should call a substring syntax normalization routine */ value_normalize( val->bv_val, syntax ); +#endif /* this is bogus, value_normalize should take a berval */ val->bv_len = strlen( val->bv_val ); diff --git a/servers/slapd/filterentry.c b/servers/slapd/filterentry.c index f1c54dbbfc..9c28bd2659 100644 --- a/servers/slapd/filterentry.c +++ b/servers/slapd/filterentry.c @@ -125,12 +125,19 @@ test_ava_filter( return( -1 ); } +#ifdef SLAPD_SCHEMA_COMPAT if ( a->a_syntax == 0 ) { a->a_syntax = attr_syntax( ava->ava_type ); } +#endif + for ( i = 0; a->a_vals[i] != NULL; i++ ) { +#ifdef SLAPD_SCHEMA_COMPAT rc = value_cmp( a->a_vals[i], &ava->ava_value, a->a_syntax, 3 ); +#else + rc = 0; +#endif switch ( type ) { case LDAP_FILTER_EQUALITY: @@ -340,11 +347,13 @@ test_substring_filter( return( -1 ); } +#ifdef SLAPD_SCHEMA_COMPAT if ( a->a_syntax & SYNTAX_BIN ) { Debug( LDAP_DEBUG_FILTER, "test_substring_filter bin attr\n", 0, 0, 0 ); return( -1 ); } +#endif /* * construct a regular expression corresponding to the @@ -418,7 +427,10 @@ test_substring_filter( strcpy( tmp, val->bv_val ); realval = tmp; } + +#ifdef SLAPD_SCHEMA_COMPAT value_normalize( realval, a->a_syntax ); +#endif rc = !regexec(&re, realval, 0, NULL, 0); diff --git a/servers/slapd/schema.c b/servers/slapd/schema.c index 1e5287f740..12fa72f692 100644 --- a/servers/slapd/schema.c +++ b/servers/slapd/schema.c @@ -1629,10 +1629,12 @@ int is_entry_objectclass( bv.bv_val = (char *) oc; bv.bv_len = strlen( bv.bv_val ); +#ifdef SLAPD_SCHEMA_COMPAT if( value_find(attr->a_vals, &bv, attr->a_syntax, 1) != 0) { /* entry is not of this objectclass */ return 0; } +#endif return 1; } diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index bb6c31bdee..6baf40b09c 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -199,7 +199,7 @@ typedef struct slap_attribute_type { #define sat_syntax_oid sat_atype.at_syntax_oid #define sat_single_value sat_atype.at_single_value #define sat_collective sat_atype.at_collective -#define sat_no_user_mods sat_atype.at_no_user_mods +#define sat_no_user_mod sat_atype.at_no_user_mod #define sat_usage sat_atype.at_usage } AttributeType; diff --git a/servers/slapd/value.c b/servers/slapd/value.c index 2a0ea16009..37d0e7b6dc 100644 --- a/servers/slapd/value.c +++ b/servers/slapd/value.c @@ -83,6 +83,7 @@ value_add( return( 0 ); } +#ifdef SLAPD_SCHEMA_COMPAT void value_normalize( char *s, @@ -176,3 +177,4 @@ value_find( return( 1 ); } +#endif