Commit e9b1012f authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Put more old schema code behind SLAPD_SCHEMA_COMPAT (which still

MUST be defined).
parent c8892356
......@@ -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;
}
......
......@@ -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
......
......@@ -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 );
}
......
......@@ -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
};
......
......@@ -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 );
......
......@@ -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);
......
......@@ -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;
}
......@@ -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;
......
......@@ -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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment