Add a basic DIT content rule test.

Fix DIT rules to allow extensibleObject in AUX
unifdef -DSLAP_EXTENDED_SCHEMA
This commit is contained in:
Kurt Zeilenga 2003-10-24 04:40:32 +00:00
parent ac7404eabd
commit d0c05e814d
9 changed files with 26 additions and 33 deletions

View File

@ -45,9 +45,12 @@ As many backend-specific sections as desired may be included. Global
options can be overridden in a backend (for options that appear more
than once, the last appearance in the
.B slapd.conf
file is used). Blank lines and comment lines beginning with a `#'
character are ignored. If a line begins with white space, it is
considered a continuation of the previous line.
file is used).
.LP
If a line begins with white space, it is considered a continuation
of the previous line. Blank lines and comment lines beginning with
a `#' character are ignored. (Note: continuation lines are unwrapped
before comment processing is applied.)
.LP
Arguments on configuration lines are separated by white space. If an
argument contains white space, the argument should be enclosed in

View File

@ -1639,13 +1639,11 @@ read_config( const char *fname, int depth )
#endif
}
#ifdef SLAP_EXTENDED_SCHEMA
} else if ( strcasecmp( cargv[0], "ditcontentrule" ) == 0 ) {
char * p;
p = strchr(saveline,'(' /*')'*/);
rc = parse_cr( fname, lineno, p, cargv );
if( rc ) return rc;
#endif
/* specify an attribute type */
} else if (( strcasecmp( cargv[0], "attributetype" ) == 0 )

View File

@ -16,8 +16,6 @@
#include "slap.h"
#include "ldap_pvt.h"
#ifdef SLAP_EXTENDED_SCHEMA
struct cindexrec {
struct berval cir_name;
ContentRule *cir_cr;
@ -35,8 +33,7 @@ cr_index_cmp(
const struct cindexrec *cir1 = v_cir1;
const struct cindexrec *cir2 = v_cir2;
int i = cir1->cir_name.bv_len - cir2->cir_name.bv_len;
if (i)
return i;
if (i) return i;
return strcasecmp( cir1->cir_name.bv_val, cir2->cir_name.bv_val );
}
@ -48,8 +45,7 @@ cr_index_name_cmp(
const struct berval *name = v_name;
const struct cindexrec *cir = v_cir;
int i = name->bv_len - cir->cir_name.bv_len;
if (i)
return i;
if (i) return i;
return strncasecmp( name->bv_val, cir->cir_name.bv_val, name->bv_len );
}
@ -194,7 +190,11 @@ cr_add_auxiliaries(
return SLAP_SCHERR_CLASS_NOT_FOUND;
}
if( soc->soc_flags & SLAP_OC_OPERATIONAL ) (*op)++;
if( soc->soc_flags & SLAP_OC_OPERATIONAL &&
soc != slap_schema.si_oc_extensibleObject )
{
(*op)++;
}
if( soc->soc_kind != LDAP_SCHEMA_AUXILIARY ) {
*err = scr->scr_oc_oids_aux[naux];
@ -203,7 +203,6 @@ cr_add_auxiliaries(
}
scr->scr_auxiliaries[naux] = NULL;
return 0;
}
@ -387,18 +386,17 @@ cr_add(
code = cr_create_precluded( scr, &op, err );
if ( code != 0 ) return code;
if( user && op ) return SLAP_SCHERR_CR_BAD_AUX;
if( user && op ) {
return SLAP_SCHERR_CR_BAD_AUX;
}
code = cr_insert(scr,err);
return code;
}
#endif
int
cr_schema_info( Entry *e )
{
#ifdef SLAP_EXTENDED_SCHEMA
AttributeDescription *ad_ditContentRules
= slap_schema.si_ad_ditContentRules;
ContentRule *cr;
@ -428,6 +426,5 @@ cr_schema_info( Entry *e )
}
ldap_memfree( val.bv_val );
}
#endif
return 0;
}

View File

@ -42,10 +42,8 @@ entry_schema_check(
{
Attribute *a, *asc, *aoc;
ObjectClass *sc, *oc;
#ifdef SLAP_EXTENDED_SCHEMA
AttributeType *at;
ContentRule *cr;
#endif
int rc, i;
struct berval nsc;
AttributeDescription *ad_structuralObjectClass
@ -238,7 +236,6 @@ entry_schema_check(
/* Glue Entry */
}
#ifdef SLAP_EXTENDED_SCHEMA
/* find the content rule for the structural class */
cr = cr_find( sc->soc_oid );
@ -322,7 +319,6 @@ entry_schema_check(
}
}
}
#endif /* SLAP_EXTENDED_SCHEMA */
/* check that the entry has required attrs for each oc */
for ( i = 0; aoc->a_vals[i].bv_val != NULL; i++ ) {
@ -434,7 +430,6 @@ entry_schema_check(
} else if ( oc->soc_kind != LDAP_SCHEMA_STRUCTURAL || oc == sc ) {
char *s;
#ifdef SLAP_EXTENDED_SCHEMA
if( oc->soc_kind == LDAP_SCHEMA_AUXILIARY ) {
int k;
@ -475,7 +470,6 @@ entry_schema_check(
return LDAP_OBJECT_CLASS_VIOLATION;
}
}
#endif /* SLAP_EXTENDED_SCHEMA */
s = oc_check_required( e, oc, &aoc->a_vals[i] );
if (s != NULL) {
@ -509,7 +503,6 @@ entry_schema_check(
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
int ret;
#ifdef SLAP_EXTENDED_SCHEMA
ret = LDAP_OBJECT_CLASS_VIOLATION;
if( cr && cr->scr_required ) {
@ -531,7 +524,6 @@ entry_schema_check(
}
if( ret != LDAP_SUCCESS )
#endif /* SLAP_EXTENDED_SCHEMA */
{
ret = oc_check_allowed( a->a_desc->ad_type, aoc->a_vals, sc );
}

View File

@ -45,7 +45,7 @@ static char *const err2text[] = {
"OID could not be expanded",
"Duplicate Content Rule",
"Content Rule not for STRUCTURAL object class",
"Content Rule AUX contains non-AUXILIARY object class"
"Content Rule AUX contains inappropriate object class",
"Content Rule attribute type list contains duplicate"
};
@ -96,8 +96,6 @@ dscompare(const char *s1, const char *s2, char delim)
return 0;
}
#ifdef SLAP_EXTENDED_SCHEMA
static void
cr_usage( void )
{
@ -153,8 +151,6 @@ parse_cr(
return 0;
}
#endif
int
parse_oc(
const char *fname,

View File

@ -36,8 +36,6 @@
#include "ldap_pvt_thread.h"
#include "ldap_queue.h"
#define SLAP_EXTENDED_SCHEMA 1
LDAP_BEGIN_DECL
/*
* SLAPD Memory allocation macros

View File

@ -0,0 +1,5 @@
# $OpenLDAP$
ditcontentrule ( 2.5.6.4 NAME 'organization' AUX domainRelatedObject )
ditcontentrule ( 2.5.6.5 NAME 'organizationalUnit' AUX extensibleObject )
ditcontentrule ( 2.5.6.9 NAME 'groupOfNames' )
ditcontentrule ( 2.5.6.17 NAME 'groupOfUniqueNames' )

View File

@ -8,6 +8,9 @@ include ./schema/cosine.schema
include ./schema/inetorgperson.schema
include ./schema/openldap.schema
include ./schema/nis.schema
include ./testdata/ditcontentrules.conf
pidfile ./testrun/slapd.1.pid
argsfile ./testrun/slapd.1.args

View File

@ -9,6 +9,7 @@ include ./schema/cosine.schema
include ./schema/inetorgperson.schema
include ./schema/openldap.schema
include ./schema/nis.schema
#
pidfile ./testrun/slapd.1.pid
argsfile ./testrun/slapd.1.args