- for( i=0; syn_map[i].sssm_name; i++ ) {
- Syntax ** synp = (Syntax **)
- &(((char *) &slap_schema)[syn_map[i].sssm_offset]);
-
- assert( *synp == NULL );
-
- *synp = syn_find( syn_map[i].sssm_name );
-
- if( *synp == NULL ) {
- fprintf( stderr, "slap_schema_check: "
- "No syntax \"%s\" defined in schema\n",
- syn_map[i].sssm_name );
- return LDAP_INVALID_SYNTAX;
- }
- }
-
- for( i=0; mr_map[i].ssmm_name; i++ ) {
- MatchingRule ** mrp = (MatchingRule **)
- &(((char *) &slap_schema)[mr_map[i].ssmm_offset]);
-
- assert( *mrp == NULL );
-
- *mrp = mr_find( mr_map[i].ssmm_name );
-
- if( *mrp == NULL ) {
- fprintf( stderr, "slap_schema_check: "
- "No matching rule \"%s\" defined in schema\n",
- mr_map[i].ssmm_name );
- return LDAP_INAPPROPRIATE_MATCHING;
- }
- }
-
- slap_at_undefined.sat_syntax = syn_find( SLAPD_OCTETSTRING_SYNTAX );
- if( slap_at_undefined.sat_syntax == NULL ) {
- fprintf( stderr, "slap_schema_check: "
- "No octetString syntax \"" SLAPD_OCTETSTRING_SYNTAX "\"\n" );
- return LDAP_INVALID_SYNTAX;
- }
- slap_schema.si_at_undefined = &slap_at_undefined;
-
- for( i=0; ad_map[i].ssam_name; i++ ) {
- int rc;
- const char *text;
-
- AttributeDescription ** adp = (AttributeDescription **)
- &(((char *) &slap_schema)[ad_map[i].ssam_offset]);
-
- assert( *adp == NULL );
-
- rc = slap_str2ad( ad_map[i].ssam_name, adp, &text );
- if( rc != LDAP_SUCCESS ) {
- fprintf( stderr, "slap_schema_check: "
- "No attribute \"%s\" defined in schema\n",
- ad_map[i].ssam_name );
- return rc;
- }
-
- if( ad_map[i].ssam_check ) {
- /* install check routine */
- (*adp)->ad_type->sat_check = ad_map[i].ssam_check;
- }
- /* install flags */
- (*adp)->ad_type->sat_flags |= ad_map[i].ssam_flags;
-
- if( ad_map[i].ssam_match ) {
- /* install custom matching routine */
- (*adp)->ad_type->sat_equality->smr_match = ad_map[i].ssam_match;
- }
- }
-
- for( i=0; oc_map[i].ssom_name; i++ ) {
- ObjectClass ** ocp = (ObjectClass **)
- &(((char *) &slap_schema)[oc_map[i].ssom_offset]);
-
- assert( *ocp == NULL );
-
- *ocp = oc_find( oc_map[i].ssom_name );
- if( *ocp == NULL ) {
- fprintf( stderr, "slap_schema_check: "
- "No objectClass \"%s\" defined in schema\n",
- oc_map[i].ssom_name );
- return LDAP_OBJECT_CLASS_VIOLATION;
- }
-
- if( oc_map[i].ssom_check ) {
- /* install check routine */
- (*ocp)->sco_check = oc_map[i].ssom_check;
- }
- /* install flags */
- (*ocp)->sco_flags |= oc_map[i].ssom_flags;
- }
-