mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-23 08:09:34 -05:00
Add objectClass kind checking
Kludge NADF schema to conform
This commit is contained in:
parent
ec87e9e30f
commit
10730ca226
4 changed files with 33 additions and 15 deletions
|
|
@ -221,23 +221,23 @@ oc_add_sups(
|
||||||
int code;
|
int code;
|
||||||
ObjectClass *soc1;
|
ObjectClass *soc1;
|
||||||
int nsups;
|
int nsups;
|
||||||
char **sups1;
|
char **sups1;
|
||||||
int add_sups = 0;
|
int add_sups = 0;
|
||||||
|
|
||||||
if ( sups ) {
|
if ( sups ) {
|
||||||
if ( !soc->soc_sups ) {
|
if ( !soc->soc_sups ) {
|
||||||
/* We are at the first recursive level */
|
/* We are at the first recursive level */
|
||||||
add_sups = 1;
|
add_sups = 1;
|
||||||
nsups = 0;
|
nsups = 1;
|
||||||
sups1 = sups;
|
sups1 = sups;
|
||||||
while ( *sups1 ) {
|
while ( *sups1 ) {
|
||||||
nsups++;
|
nsups++;
|
||||||
sups1++;
|
sups1++;
|
||||||
}
|
}
|
||||||
nsups++;
|
|
||||||
soc->soc_sups = (ObjectClass **)ch_calloc(nsups,
|
soc->soc_sups = (ObjectClass **)ch_calloc(nsups,
|
||||||
sizeof(ObjectClass *));
|
sizeof(ObjectClass *));
|
||||||
}
|
}
|
||||||
|
|
||||||
nsups = 0;
|
nsups = 0;
|
||||||
sups1 = sups;
|
sups1 = sups;
|
||||||
while ( *sups1 ) {
|
while ( *sups1 ) {
|
||||||
|
|
@ -247,6 +247,18 @@ oc_add_sups(
|
||||||
return SLAP_SCHERR_CLASS_NOT_FOUND;
|
return SLAP_SCHERR_CLASS_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check object class usage
|
||||||
|
* abstract classes can only sup abstract classes
|
||||||
|
* structural classes can not sup auxiliary classes
|
||||||
|
* auxiliary classes can not sup structural classes
|
||||||
|
*/
|
||||||
|
if( soc->soc_kind != soc1->soc_kind
|
||||||
|
&& soc1->soc_kind != LDAP_SCHEMA_ABSTRACT )
|
||||||
|
{
|
||||||
|
*err = *sups1;
|
||||||
|
return SLAP_SCHERR_CLASS_BAD_USAGE;
|
||||||
|
}
|
||||||
|
|
||||||
if ( add_sups )
|
if ( add_sups )
|
||||||
soc->soc_sups[nsups] = soc1;
|
soc->soc_sups[nsups] = soc1;
|
||||||
|
|
||||||
|
|
@ -263,6 +275,7 @@ oc_add_sups(
|
||||||
sups1++;
|
sups1++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -356,6 +369,7 @@ oc_add(
|
||||||
} else {
|
} else {
|
||||||
code = oc_add_sups( soc, soc->soc_sup_oids, err );
|
code = oc_add_sups( soc, soc->soc_sup_oids, err );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( code != 0 ) return code;
|
if ( code != 0 ) return code;
|
||||||
|
|
||||||
code = oc_create_required( soc, soc->soc_at_oids_must, err );
|
code = oc_create_required( soc, soc->soc_at_oids_must, err );
|
||||||
|
|
|
||||||
|
|
@ -93,12 +93,12 @@ attributetype ( 2.6.6.5.2.4.16 NAME 'multiMediaInformation'
|
||||||
# Object classes
|
# Object classes
|
||||||
|
|
||||||
# According to the intended use described in section 3.3.1 in the spec,
|
# According to the intended use described in section 3.3.1 in the spec,
|
||||||
# this can only be AUXILIARY.
|
# this can only be ABSTRACT.
|
||||||
# We had lastModifiedTime as 'allows', but sd-04 has it as MUST.
|
# We had lastModifiedTime as 'allows', but sd-04 has it as MUST.
|
||||||
# We did not have multiMediaInformation neither on this class nor
|
# We did not have multiMediaInformation neither on this class nor
|
||||||
# on any of its derived classes.
|
# on any of its derived classes.
|
||||||
|
|
||||||
objectclass ( 2.6.6.5.2.6.7 NAME 'nadfObject' SUP top AUXILIARY
|
objectclass ( 2.6.6.5.2.6.7 NAME 'nadfObject' SUP top ABSTRACT
|
||||||
MUST lastModifiedTime
|
MUST lastModifiedTime
|
||||||
MAY ( multiMediaInformation $ nadfSearchGuide $
|
MAY ( multiMediaInformation $ nadfSearchGuide $
|
||||||
supplementaryInformation ) )
|
supplementaryInformation ) )
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,9 @@ static char *const err2text[] = {
|
||||||
"Success",
|
"Success",
|
||||||
"Out of memory",
|
"Out of memory",
|
||||||
"ObjectClass not found",
|
"ObjectClass not found",
|
||||||
|
"ObjectClass inappropriate SUPerior",
|
||||||
"AttributeType not found",
|
"AttributeType not found",
|
||||||
|
"AttributeType inappropriate USAGE",
|
||||||
"Duplicate objectClass",
|
"Duplicate objectClass",
|
||||||
"Duplicate attributeType",
|
"Duplicate attributeType",
|
||||||
"Duplicate ldapSyntax",
|
"Duplicate ldapSyntax",
|
||||||
|
|
|
||||||
|
|
@ -202,16 +202,18 @@ typedef struct slap_ssf_set {
|
||||||
*/
|
*/
|
||||||
#define SLAP_SCHERR_OUTOFMEM 1
|
#define SLAP_SCHERR_OUTOFMEM 1
|
||||||
#define SLAP_SCHERR_CLASS_NOT_FOUND 2
|
#define SLAP_SCHERR_CLASS_NOT_FOUND 2
|
||||||
#define SLAP_SCHERR_ATTR_NOT_FOUND 3
|
#define SLAP_SCHERR_CLASS_BAD_USAGE 3
|
||||||
#define SLAP_SCHERR_DUP_CLASS 4
|
#define SLAP_SCHERR_ATTR_NOT_FOUND 4
|
||||||
#define SLAP_SCHERR_DUP_ATTR 5
|
#define SLAP_SCHERR_ATTR_BAD_USAGE 5
|
||||||
#define SLAP_SCHERR_DUP_SYNTAX 6
|
#define SLAP_SCHERR_DUP_CLASS 6
|
||||||
#define SLAP_SCHERR_DUP_RULE 7
|
#define SLAP_SCHERR_DUP_ATTR 7
|
||||||
#define SLAP_SCHERR_NO_NAME 8
|
#define SLAP_SCHERR_DUP_SYNTAX 8
|
||||||
#define SLAP_SCHERR_ATTR_INCOMPLETE 9
|
#define SLAP_SCHERR_DUP_RULE 9
|
||||||
#define SLAP_SCHERR_MR_NOT_FOUND 10
|
#define SLAP_SCHERR_NO_NAME 10
|
||||||
#define SLAP_SCHERR_SYN_NOT_FOUND 11
|
#define SLAP_SCHERR_ATTR_INCOMPLETE 11
|
||||||
#define SLAP_SCHERR_MR_INCOMPLETE 12
|
#define SLAP_SCHERR_MR_NOT_FOUND 12
|
||||||
|
#define SLAP_SCHERR_SYN_NOT_FOUND 13
|
||||||
|
#define SLAP_SCHERR_MR_INCOMPLETE 14
|
||||||
|
|
||||||
typedef struct slap_oid_macro {
|
typedef struct slap_oid_macro {
|
||||||
struct berval som_oid;
|
struct berval som_oid;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue