Put type;option trimming codes behind SLAPD_SCHEMA_COMPAT.

Attribute subtyping, especially that using attribute description
options, will have to reengineered.
This commit is contained in:
Kurt Zeilenga 2000-01-31 17:59:10 +00:00
parent d298e35514
commit 10fdd7ff7c
4 changed files with 20 additions and 14 deletions

View File

@ -75,9 +75,7 @@ Attribute *attr_dup( Attribute *a )
}
tmp->a_type = ch_strdup( a->a_type );
#ifdef SLAPD_SCHEMA_NOT_COMPAT
tmp->a_at = a->a_at;
#else
#ifdef SLAPD_SCHEMA_COMPAT
tmp->a_syntax = a->a_syntax;
#endif
tmp->a_next = NULL;
@ -407,19 +405,23 @@ at_find(
const char *name
)
{
struct aindexrec *air = NULL;
char *p, *tmpname = NULL;
struct aindexrec *air;
char *tmpname;
#ifdef SLAPD_SCHEMA_COMPAT
/*
* The name may actually be an AttributeDescription, i.e. it may
* contain options. Let's deal with it.
* contain options.
*/
p = strchr( name, ';' );
/* Treat any attribute type with option as an unknown attribute type */
char *p = strchr( name, ';' );
if ( p ) {
tmpname = ch_malloc( p-name+1 );
strncpy( tmpname, name, p-name );
tmpname[p-name] = '\0';
} else {
} else
#endif
{
tmpname = (char *)name;
}

View File

@ -127,6 +127,7 @@ do_compare(
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
NULL, "Function not implemented", NULL, NULL );
}
cleanup:
free( dn );
free( ndn );

View File

@ -201,7 +201,7 @@ static char *oc_op_no_usermod_attrs[] = {
int
oc_check_op_attr( const char *type )
{
#ifdef SLAPD_SCHEMA_COMPAT
#ifndef SLAPD_SCHEMA_NOT_COMPAT
return charray_inlist( oc_op_attrs, type )
|| charray_inlist( oc_op_usermod_attrs, type )
|| charray_inlist( oc_op_no_usermod_attrs, type );
@ -210,7 +210,7 @@ oc_check_op_attr( const char *type )
if( at == NULL ) return 0;
return at->sat_usage != 0;
return at->sat_usage != LDAP_SCHEMA_USER_APPLICATIONS;
#endif
}
@ -263,6 +263,8 @@ oc_check_allowed( char *type, struct berval **ocl )
return( 0 );
}
#ifdef SLAPD_SCHEMA_COMPAT
/* Treat any attribute type with option as an unknown attribute type */
/*
* The "type" we have received is actually an AttributeDescription.
* Let's find out the corresponding type.
@ -276,10 +278,13 @@ oc_check_allowed( char *type, struct berval **ocl )
"oc_check_allowed type \"%s\" from \"%s\"\n",
t, type, 0 );
} else {
} else
#endif
{
t = type;
}
/*
* All operational attributions are allowed by schema rules.
*/

View File

@ -339,9 +339,7 @@ typedef struct slap_filter {
typedef struct slap_attr {
char *a_type; /* description */
struct berval **a_vals;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeType *a_at; /* attribute type */
#else
#ifdef SLAPD_SCHEMA_COMPAT
int a_syntax;
#endif
struct slap_attr *a_next;