From: Kurt Zeilenga Date: Fri, 24 Oct 2003 04:40:32 +0000 (+0000) Subject: Add a basic DIT content rule test. X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~491 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d0c05e814dd411090f87b1e1726a19458be70105;p=openldap Add a basic DIT content rule test. Fix DIT rules to allow extensibleObject in AUX unifdef -DSLAP_EXTENDED_SCHEMA --- diff --git a/doc/man/man5/slapd.conf.5 b/doc/man/man5/slapd.conf.5 index 6a4d9a7536..f59ac00bc3 100644 --- a/doc/man/man5/slapd.conf.5 +++ b/doc/man/man5/slapd.conf.5 @@ -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 diff --git a/servers/slapd/config.c b/servers/slapd/config.c index a8b343a9ec..52c9e0a601 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -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 ) diff --git a/servers/slapd/cr.c b/servers/slapd/cr.c index 24c546e364..6e33b5a728 100644 --- a/servers/slapd/cr.c +++ b/servers/slapd/cr.c @@ -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; } diff --git a/servers/slapd/schema_check.c b/servers/slapd/schema_check.c index 1426e890a4..bc7c1e826f 100644 --- a/servers/slapd/schema_check.c +++ b/servers/slapd/schema_check.c @@ -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 ); } diff --git a/servers/slapd/schemaparse.c b/servers/slapd/schemaparse.c index 8eeba03d4d..d05d70ae8d 100644 --- a/servers/slapd/schemaparse.c +++ b/servers/slapd/schemaparse.c @@ -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, diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 28daaa70ff..c5ed67e644 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -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 diff --git a/tests/data/ditcontentrules.conf b/tests/data/ditcontentrules.conf new file mode 100644 index 0000000000..905cc15cc1 --- /dev/null +++ b/tests/data/ditcontentrules.conf @@ -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' ) diff --git a/tests/data/slapd-master.conf b/tests/data/slapd-master.conf index ea719df1d2..67cfad2c01 100644 --- a/tests/data/slapd-master.conf +++ b/tests/data/slapd-master.conf @@ -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 diff --git a/tests/data/slapd.conf b/tests/data/slapd.conf index 6603418b41..350280aa87 100644 --- a/tests/data/slapd.conf +++ b/tests/data/slapd.conf @@ -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