from input. This likely needs to be done by the frontend instead.
Add structuralObjectClass to the root and subschema dses.
int i, j;
char ** supportedSASLMechanisms;
- AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
- AttributeDescription *ad_namingContexts = slap_schema.si_ad_namingContexts;
- AttributeDescription *ad_supportedControl = slap_schema.si_ad_supportedControl;
- AttributeDescription *ad_supportedExtension = slap_schema.si_ad_supportedExtension;
- AttributeDescription *ad_supportedLDAPVersion = slap_schema.si_ad_supportedLDAPVersion;
- AttributeDescription *ad_supportedSASLMechanisms = slap_schema.si_ad_supportedSASLMechanisms;
- AttributeDescription *ad_supportedFeatures = slap_schema.si_ad_supportedFeatures;
- AttributeDescription *ad_ref = slap_schema.si_ad_ref;
+ AttributeDescription *ad_structuralObjectClass
+ = slap_schema.si_ad_structuralObjectClass;
+ AttributeDescription *ad_objectClass
+ = slap_schema.si_ad_objectClass;
+ AttributeDescription *ad_namingContexts
+ = slap_schema.si_ad_namingContexts;
+ AttributeDescription *ad_supportedControl
+ = slap_schema.si_ad_supportedControl;
+ AttributeDescription *ad_supportedExtension
+ = slap_schema.si_ad_supportedExtension;
+ AttributeDescription *ad_supportedLDAPVersion
+ = slap_schema.si_ad_supportedLDAPVersion;
+ AttributeDescription *ad_supportedSASLMechanisms
+ = slap_schema.si_ad_supportedSASLMechanisms;
+ AttributeDescription *ad_supportedFeatures
+ = slap_schema.si_ad_supportedFeatures;
+ AttributeDescription *ad_ref
+ = slap_schema.si_ad_ref;
Attribute *a;
(void) dn_normalize( e->e_ndn );
e->e_private = NULL;
+ val.bv_val = "OpenLDAProotDSE";
+ val.bv_len = sizeof("OpenLDAProotDSE")-1;
+ attr_merge( e, ad_structuralObjectClass, vals );
+
val.bv_val = "top";
val.bv_len = sizeof("top")-1;
attr_merge( e, ad_objectClass, vals );
int
schema_info( Entry **entry, const char **text )
{
- AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
+ AttributeDescription *ad_structuralObjectClass
+ = slap_schema.si_ad_structuralObjectClass;
+ AttributeDescription *ad_objectClass
+ = slap_schema.si_ad_objectClass;
Entry *e;
struct berval val;
(void) dn_normalize( e->e_ndn );
e->e_private = NULL;
+ val.bv_val = "LDAPsubentry";
+ val.bv_len = sizeof("LDAPsubentry")-1;
+ attr_merge( e, ad_structuralObjectClass, vals );
+
val.bv_val = "top";
val.bv_len = sizeof("top")-1;
attr_merge( e, ad_objectClass, vals );
/*
* Determine the structural object class from a set of OIDs
*/
-static int structural_class(
+int structural_class(
struct berval **ocs,
struct berval *scbv,
const char **text )
if( !global_schemacheck ) return LDAP_SUCCESS;
-#if 1
/* find the object class attribute - could error out here */
asc = attr_find( e->e_attrs, ad_structuralObjectClass );
if ( asc == NULL ) {
return LDAP_OBJECT_CLASS_VIOLATION;
}
-#endif
/* find the object class attribute */
aoc = attr_find( e->e_attrs, ad_objectClass );
}
/* check backend */
- if( select_backend( e->e_ndn, is_entry_referral(e), nosubs ) != be )
- {
+ if( select_backend( e->e_ndn, is_entry_referral(e), nosubs ) != be ) {
fprintf( stderr, "%s: database (%s) not configured to "
"hold dn=\"%s\" (line=%d)\n",
progname,
break;
}
+ {
+ Attribute *sc = attr_find( e->e_attrs,
+ slap_schema.si_ad_structuralObjectClass );
+ Attribute *oc = attr_find( e->e_attrs,
+ slap_schema.si_ad_objectClass );
+
+ if( oc == NULL ) {
+ fprintf( stderr, "%s: dn=\"%s\" (line=%d): %s\n",
+ progname, e->e_dn, lineno,
+ "no objectClass attribute");
+ rc = EXIT_FAILURE;
+ entry_free( e );
+ if( continuemode ) continue;
+ break;
+ }
+
+ if( sc == NULL ) {
+ struct berval *vals[2];
+ struct berval scbv;
+ const char *text;
+ int ret = structural_class(
+ oc->a_vals, &scbv, &text );
+
+ if( scbv.bv_len == 0 ) {
+ fprintf( stderr, "%s: dn=\"%s\" (line=%d): %s\n",
+ progname, e->e_dn, lineno, text );
+ rc = EXIT_FAILURE;
+ entry_free( e );
+ if( continuemode ) continue;
+ break;
+ }
+
+ vals[0] = &scbv;
+ vals[1] = NULL;
+ attr_merge( e, slap_schema.si_ad_structuralObjectClass,
+ vals );
+ }
+ }
+
if( global_schemacheck ) {
/* check schema */
const char *text;