A few changes to the handling of operational attributes.

Small preparation for applying tighter semantics to operational attributes.
This commit is contained in:
Kurt Zeilenga 2002-01-08 20:22:41 +00:00
parent 319b92202b
commit 587d36e18b
2 changed files with 36 additions and 1 deletions

View file

@ -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;
}
}
/*

View file

@ -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",