#include "slap.h"
#include "ldap_pvt.h"
+#include "ldap_pvt_uc.h"
int schema_init_done = 0;
static int
objectClassMatch(
int *matchp,
- unsigned use,
+ slap_mask_t flags,
Syntax *syntax,
MatchingRule *mr,
struct berval *value,
ObjectClass *asserted = oc_find( a->bv_val );
if( asserted == NULL ) {
- if( isdigit( *value->bv_val ) ) {
+ if( OID_LEADCHAR( *a->bv_val ) ) {
/* OID form, return FALSE */
*matchp = 1;
return LDAP_SUCCESS;
return SLAPD_COMPARE_UNDEFINED;
}
+ if( flags & SLAP_MR_MODIFY_MATCHING ) {
+ *matchp = ( asserted != oc );
+ } else {
+ *matchp = !is_object_subclass( asserted, oc );
+ }
+
#if 0
- Debug( LDAP_DEBUG_TRACE, "objectClassMatch(%s,%s)\n",
- value->bv_val, a->bv_val, NULL );
+ Debug( LDAP_DEBUG_TRACE, "objectClassMatch(%s,%s) = %d\n",
+ value->bv_val, a->bv_val, *matchp );
#endif
- *matchp = !is_object_subclass( asserted, oc );
+ return LDAP_SUCCESS;
+}
+
+#define structuralObjectClassIndexer NULL
+#define structuralObjectClassFilter NULL
+
+static int
+structuralObjectClassMatch(
+ int *matchp,
+ slap_mask_t flags,
+ Syntax *syntax,
+ MatchingRule *mr,
+ struct berval *value,
+ void *assertedValue )
+{
+ struct berval *a = (struct berval *) assertedValue;
+ ObjectClass *oc = oc_find( value->bv_val );
+ ObjectClass *asserted = oc_find( a->bv_val );
+
+ if( asserted == NULL ) {
+ if( OID_LEADCHAR( *a->bv_val ) ) {
+ /* OID form, return FALSE */
+ *matchp = 1;
+ return LDAP_SUCCESS;
+ }
+
+ /* desc form, return undefined */
+ return SLAPD_COMPARE_UNDEFINED;
+ }
- Debug( LDAP_DEBUG_TRACE, "\treturns %d\n",
- *matchp, NULL, NULL );
+ if ( oc == NULL ) {
+ /* unrecognized stored value */
+ return SLAPD_COMPARE_UNDEFINED;
+ }
+
+ *matchp = ( asserted != oc );
+
+#if 0
+ Debug( LDAP_DEBUG_TRACE, "structuralObjectClassMatch(%s,%s) = %d\n",
+ value->bv_val, a->bv_val, *matchp );
+#endif
return LDAP_SUCCESS;
}
{ "objectClass",
objectClassMatch, objectClassIndexer, objectClassFilter,
offsetof(struct slap_internal_schema, si_ad_objectClass) },
+ { "structuralObjectClass",
+ structuralObjectClassMatch,
+ structuralObjectClassIndexer, structuralObjectClassFilter,
+ offsetof(struct slap_internal_schema, si_ad_structuralObjectClass) },
/* user entry operational attributes */
{ "creatorsName", NULL, NULL, NULL,
{ NULL, NULL, NULL, NULL, 0 }
};
+static AttributeType slap_at_undefined = {
+ "UNDEFINED", /* cname */
+ { "1.1.1", NULL, NULL, 1, NULL,
+ NULL, NULL, NULL, NULL,
+ 0, 0, 0, 1, 3 },
+ NULL, /* sup */
+ NULL, /* subtypes */
+ NULL, NULL, NULL, NULL, /* matching rules */
+ NULL, /* syntax (this may need to be defined) */
+ NULL /* next */
+};
int
schema_prep( void )
/* we should only be called once after schema_init() was called */
assert( schema_init_done == 1 );
+ ucdata_load( global_ucdata_path ? global_ucdata_path :
+ SLAPD_DEFAULT_UCDATA, UCDATA_CASE|UCDATA_CTYPE|UCDATA_NUM );
+
for( i=0; oc_map[i].ssom_name; i++ ) {
ObjectClass ** ocp = (ObjectClass **)
&(((char *) &slap_schema)[oc_map[i].ssom_offset]);
}
}
+ slap_at_undefined.sat_syntax = syn_find( SLAPD_OCTETSTRING_SYNTAX );
+ if( slap_at_undefined.sat_syntax == NULL ) {
+ fprintf( stderr,
+ "No octetString syntax \"" SLAPD_OCTETSTRING_SYNTAX "\"\n" );
+ return LDAP_INVALID_SYNTAX;
+ }
+ slap_schema.si_at_undefined = &slap_at_undefined;
+
++schema_init_done;
return LDAP_SUCCESS;
}