From: Kurt Zeilenga Date: Tue, 8 Jan 2002 20:22:41 +0000 (+0000) Subject: A few changes to the handling of operational attributes. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~237 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=587d36e18b923f47b4b56288df2b26821c2a7750;p=openldap A few changes to the handling of operational attributes. Small preparation for applying tighter semantics to operational attributes. --- diff --git a/servers/slapd/at.c b/servers/slapd/at.c index 29cc14df25..90c58551c2 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -281,6 +281,7 @@ at_add( for( i=0; at->at_names[i]; i++ ) { if( !slap_valid_descr( at->at_names[i] ) ) { + *err = at->at_names[i]; return SLAP_SCHERR_BAD_DESCR; } } @@ -289,12 +290,32 @@ at_add( } else if ( at->at_oid ) { cname = at->at_oid; + } else { + *err = ""; return SLAP_SCHERR_ATTR_INCOMPLETE; } + *err = cname; + + if ( !at->at_usage && at->at_no_user_mod ) { + /* user attribute must be modifable */ + return SLAP_SCHERR_ATTR_BAD_USAGE; + } + if ( at->at_collective ) { +#ifdef SLAP_COLLECTIVE + if( at->at_usage ) { + /* collective attributes cannot be operational */ + return SLAP_SCHERR_NOT_SUPPORTED; + } + if( at->at_single_value ) { + /* collective attributes cannot be single-valued */ + return SLAP_SCHERR_NOT_SUPPORTED; + } +#else return SLAP_SCHERR_NOT_SUPPORTED; +#endif } sat = (AttributeType *) ch_calloc( 1, sizeof(AttributeType) ); @@ -315,9 +336,13 @@ at_add( sat->sat_sup = supsat; if ( at_append_to_list(sat, &supsat->sat_subtypes) ) { - *err = cname; return SLAP_SCHERR_OUTOFMEM; } + + if ( sat->sat_usage != supsat->sat_usage ) { + /* subtypes must have same usage as their SUP */ + return SLAP_SCHERR_ATTR_BAD_USAGE; + } } /* diff --git a/servers/slapd/schemaparse.c b/servers/slapd/schemaparse.c index b77db304a9..4517b78647 100644 --- a/servers/slapd/schemaparse.c +++ b/servers/slapd/schemaparse.c @@ -322,6 +322,15 @@ parse_at( return 1; } +#if 0 + /* operational attributes should be defined internally */ + if ( at->at_usage ) { + fprintf( stderr, "%s: line %d: attribute type \"%s\" is operational\n", + fname, lineno, at->at_oid ); + return 1; + } +#endif + if ( !OID_LEADCHAR( at->at_oid[0] )) { /* Expand OID macros */ oid = find_oidm( at->at_oid ); @@ -352,6 +361,7 @@ parse_at( } } + code = at_add(at,&err); if ( code ) { fprintf( stderr, "%s: line %d: %s: \"%s\"\n",