]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/schema_init.c
add Time subsystem
[openldap] / servers / slapd / schema_init.c
index b34bcb476e45cb3bff52f11209e5b94e89b5c998..a6e68b5316721997755004752f622fd9712cbcb8 100644 (file)
 #define caseExactMatchOID                      "2.5.13.5"
 #define caseExactSubstringsMatchOID            "2.5.13.7"
 
-static char *strcasechr( const char *str, int c )
+static char *bvcasechr( struct berval *bv, int c, ber_len_t *len )
 {
-       char *lower = strchr( str, TOLOWER(c) );
-       char *upper = strchr( str, TOUPPER(c) );
+       ber_len_t i;
+       int lower = TOLOWER( c );
+       int upper = TOUPPER( c );
 
-       if( lower && upper ) {
-               return lower < upper ? lower : upper;
-       } else if ( lower ) {
-               return lower;
-       } else {
-               return upper;
+       if( c == 0 ) return NULL;
+       
+       for( i=0; i < bv->bv_len; i++ ) {
+               if( upper == bv->bv_val[i] || lower == bv->bv_val[i] ) {
+                       *len = i;
+                       return &bv->bv_val[i];
+               }
        }
+
+       return NULL;
 }
 
 static int
@@ -123,12 +127,12 @@ static int octetStringIndexer(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       BVarray values,
-       BVarray *keysp )
+       BerVarray values,
+       BerVarray *keysp )
 {
        int i;
        size_t slen, mlen;
-       BVarray keys;
+       BerVarray keys;
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
        struct berval digest;
@@ -179,10 +183,10 @@ static int octetStringFilter(
        MatchingRule *mr,
        struct berval *prefix,
        void * assertValue,
-       BVarray *keysp )
+       BerVarray *keysp )
 {
        size_t slen, mlen;
-       BVarray keys;
+       BerVarray keys;
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
        struct berval *value = (struct berval *) assertValue;
@@ -222,38 +226,38 @@ nameUIDValidate(
        struct berval *in )
 {
        int rc;
-       struct berval *dn;
+       struct berval dn;
 
        if( in->bv_len == 0 ) return LDAP_SUCCESS;
 
-       dn = ber_bvdup( in );
-       if( !dn ) return LDAP_OTHER;
+       ber_dupbv( &dn, in );
+       if( !dn.bv_val ) return LDAP_OTHER;
 
-       if( dn->bv_val[dn->bv_len-1] == 'B'
-               && dn->bv_val[dn->bv_len-2] == '\'' )
+       if( dn.bv_val[dn.bv_len-1] == 'B'
+               && dn.bv_val[dn.bv_len-2] == '\'' )
        {
                /* assume presence of optional UID */
                ber_len_t i;
 
-               for(i=dn->bv_len-3; i>1; i--) {
-                       if( dn->bv_val[i] != '0' &&     dn->bv_val[i] != '1' ) {
+               for(i=dn.bv_len-3; i>1; i--) {
+                       if( dn.bv_val[i] != '0' &&      dn.bv_val[i] != '1' ) {
                                break;
                        }
                }
-               if( dn->bv_val[i] != '\'' ||
-                   dn->bv_val[i-1] != '#' ) {
-                       ber_bvfree( dn );
+               if( dn.bv_val[i] != '\'' ||
+                   dn.bv_val[i-1] != '#' ) {
+                       ber_memfree( dn.bv_val );
                        return LDAP_INVALID_SYNTAX;
                }
 
                /* trim the UID to allow use of dnValidate */
-               dn->bv_val[i-1] = '\0';
-               dn->bv_len = i-1;
+               dn.bv_val[i-1] = '\0';
+               dn.bv_len = i-1;
        }
 
-       rc = dnValidate( NULL, dn );
+       rc = dnValidate( NULL, &dn );
 
-       ber_bvfree( dn );
+       ber_memfree( &dn );
        return rc;
 }
 
@@ -471,10 +475,36 @@ UTF8StringValidate(
 
        for( count = in->bv_len; count > 0; count-=len, u+=len ) {
                /* get the length indicated by the first byte */
-               len = LDAP_UTF8_CHARLEN( u );
+               len = LDAP_UTF8_CHARLEN2( u, len );
 
-               /* should not be zero */
-               if( len == 0 ) return LDAP_INVALID_SYNTAX;
+               /* very basic checks */
+               switch( len ) {
+                       case 6:
+                               if( (u[5] & 0xC0) != 0x80 ) {
+                                       return LDAP_INVALID_SYNTAX;
+                               }
+                       case 5:
+                               if( (u[4] & 0xC0) != 0x80 ) {
+                                       return LDAP_INVALID_SYNTAX;
+                               }
+                       case 4:
+                               if( (u[3] & 0xC0) != 0x80 ) {
+                                       return LDAP_INVALID_SYNTAX;
+                               }
+                       case 3:
+                               if( (u[2] & 0xC0 )!= 0x80 ) {
+                                       return LDAP_INVALID_SYNTAX;
+                               }
+                       case 2:
+                               if( (u[1] & 0xC0) != 0x80 ) {
+                                       return LDAP_INVALID_SYNTAX;
+                               }
+                       case 1:
+                               /* CHARLEN already validated it */
+                               break;
+                       default:
+                               return LDAP_INVALID_SYNTAX;
+               }
 
                /* make sure len corresponds with the offset
                        to the next character */
@@ -612,7 +642,7 @@ UTF8SubstringsassertionNormalize(
 
 err:
        if ( nsa->sa_final.bv_val ) free( nsa->sa_final.bv_val );
-       if ( nsa->sa_any )bvarray_free( nsa->sa_any );
+       if ( nsa->sa_any )ber_bvarray_free( nsa->sa_any );
        if ( nsa->sa_initial.bv_val ) free( nsa->sa_initial.bv_val );
        ch_free( nsa );
        return NULL;
@@ -771,13 +801,13 @@ approxIndexer(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       BVarray values,
-       BVarray *keysp )
+       BerVarray values,
+       BerVarray *keysp )
 {
        char *val, *c;
        int i,j, len, wordcount, keycount=0;
        struct berval *newkeys;
-       BVarray keys=NULL;
+       BerVarray keys=NULL;
 
        for( j=0; values[j].bv_val != NULL; j++ ) {
                /* Yes, this is necessary */
@@ -825,11 +855,11 @@ approxFilter(
        MatchingRule *mr,
        struct berval *prefix,
        void * assertValue,
-       BVarray *keysp )
+       BerVarray *keysp )
 {
        char *val, *c;
        int i, count, len;
-       BVarray keys;
+       BerVarray keys;
 
        /* Yes, this is necessary */
        val = UTF8normalize( ((struct berval *)assertValue),
@@ -923,11 +953,11 @@ approxIndexer(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       BVarray values,
-       BVarray *keysp )
+       BerVarray values,
+       BerVarray *keysp )
 {
        int i;
-       BVarray *keys;
+       BerVarray *keys;
        char *s;
 
        for( i=0; values[i].bv_val != NULL; i++ ) {
@@ -963,9 +993,9 @@ approxFilter(
        MatchingRule *mr,
        struct berval *prefix,
        void * assertValue,
-       BVarray *keysp )
+       BerVarray *keysp )
 {
-       BVarray keys;
+       BerVarray keys;
        char *s;
 
        keys = (struct berval *)ch_malloc( sizeof( struct berval * ) * 2 );
@@ -1110,7 +1140,6 @@ retry:
                        }
 
                        idx = p - left.bv_val;
-                       assert( idx < left.bv_len );
 
                        if( idx >= left.bv_len ) {
                                /* this shouldn't happen */
@@ -1118,7 +1147,7 @@ retry:
                                if ( sub->sa_final.bv_val )
                                        ch_free( sub->sa_final.bv_val );
                                if ( sub->sa_any )
-                                       bvarray_free( sub->sa_any );
+                                       ber_bvarray_free( sub->sa_any );
                                if ( sub->sa_initial.bv_val )
                                        ch_free( sub->sa_initial.bv_val );
                                ch_free( sub );
@@ -1154,7 +1183,7 @@ done:
        free( nav );
        if( sub != NULL ) {
                if ( sub->sa_final.bv_val ) free( sub->sa_final.bv_val );
-               if ( sub->sa_any ) bvarray_free( sub->sa_any );
+               if ( sub->sa_any ) ber_bvarray_free( sub->sa_any );
                if ( sub->sa_initial.bv_val ) free( sub->sa_initial.bv_val );
                ch_free( sub );
        }
@@ -1169,13 +1198,13 @@ static int caseExactIgnoreIndexer(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       BVarray values,
-       BVarray *keysp )
+       BerVarray values,
+       BerVarray *keysp )
 {
        int i;
        unsigned casefold;
        size_t slen, mlen;
-       BVarray keys;
+       BerVarray keys;
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
        struct berval digest;
@@ -1233,11 +1262,11 @@ static int caseExactIgnoreFilter(
        MatchingRule *mr,
        struct berval *prefix,
        void * assertValue,
-       BVarray *keysp )
+       BerVarray *keysp )
 {
        unsigned casefold;
        size_t slen, mlen;
-       BVarray keys;
+       BerVarray keys;
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
        struct berval value;
@@ -1291,14 +1320,14 @@ static int caseExactIgnoreSubstringsIndexer(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       BVarray values,
-       BVarray *keysp )
+       BerVarray values,
+       BerVarray *keysp )
 {
        unsigned casefold;
        ber_len_t i, nkeys;
        size_t slen, mlen;
-       BVarray keys;
-       BVarray nvalues;
+       BerVarray keys;
+       BerVarray nvalues;
 
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
@@ -1360,7 +1389,7 @@ static int caseExactIgnoreSubstringsIndexer(
        if( nkeys == 0 ) {
                /* no keys to generate */
                *keysp = NULL;
-               bvarray_free( nvalues );
+               ber_bvarray_free( nvalues );
                return LDAP_SUCCESS;
        }
 
@@ -1461,7 +1490,7 @@ static int caseExactIgnoreSubstringsIndexer(
                *keysp = NULL;
        }
 
-       bvarray_free( nvalues );
+       ber_bvarray_free( nvalues );
 
        return LDAP_SUCCESS;
 }
@@ -1473,14 +1502,14 @@ static int caseExactIgnoreSubstringsFilter(
        MatchingRule *mr,
        struct berval *prefix,
        void * assertValue,
-       BVarray *keysp )
+       BerVarray *keysp )
 {
        SubstringsAssertion *sa;
        char pre;
        unsigned casefold;
        ber_len_t nkeys = 0;
        size_t slen, mlen, klen;
-       BVarray keys;
+       BerVarray keys;
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
        struct berval *value;
@@ -1520,7 +1549,7 @@ static int caseExactIgnoreSubstringsFilter(
 
        if( nkeys == 0 ) {
                if ( sa->sa_final.bv_val ) free( sa->sa_final.bv_val );
-               if ( sa->sa_any ) bvarray_free( sa->sa_any );
+               if ( sa->sa_any ) ber_bvarray_free( sa->sa_any );
                if ( sa->sa_initial.bv_val ) free( sa->sa_initial.bv_val );
                ch_free( sa );
                *keysp = NULL;
@@ -1635,7 +1664,7 @@ static int caseExactIgnoreSubstringsFilter(
                *keysp = NULL;
        }
        if ( sa->sa_final.bv_val ) free( sa->sa_final.bv_val );
-       if ( sa->sa_any ) bvarray_free( sa->sa_any );
+       if ( sa->sa_any ) ber_bvarray_free( sa->sa_any );
        if ( sa->sa_initial.bv_val ) free( sa->sa_initial.bv_val );
        ch_free( sa );
 
@@ -1870,11 +1899,11 @@ static int integerIndexer(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       BVarray values,
-       BVarray *keysp )
+       BerVarray values,
+       BerVarray *keysp )
 {
        int i;
-       BVarray keys;
+       BerVarray keys;
 
        /* we should have at least one value at this point */
        assert( values != NULL && values[0].bv_val != NULL );
@@ -1902,9 +1931,9 @@ static int integerFilter(
        MatchingRule *mr,
        struct berval *prefix,
        void * assertValue,
-       BVarray *keysp )
+       BerVarray *keysp )
 {
-       BVarray keys;
+       BerVarray keys;
 
        keys = ch_malloc( sizeof( struct berval ) * 2 );
        integerNormalize( syntax, assertValue, &keys[0] );
@@ -2141,7 +2170,6 @@ retry:
                        }
 
                        idx = p - left.bv_val;
-                       assert( idx < left.bv_len );
 
                        if( idx >= left.bv_len ) {
                                /* this shouldn't happen */
@@ -2185,12 +2213,12 @@ static int caseExactIA5Indexer(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       BVarray values,
-       BVarray *keysp )
+       BerVarray values,
+       BerVarray *keysp )
 {
        int i;
        size_t slen, mlen;
-       BVarray keys;
+       BerVarray keys;
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
        struct berval digest;
@@ -2241,10 +2269,10 @@ static int caseExactIA5Filter(
        MatchingRule *mr,
        struct berval *prefix,
        void * assertValue,
-       BVarray *keysp )
+       BerVarray *keysp )
 {
        size_t slen, mlen;
-       BVarray keys;
+       BerVarray keys;
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
        struct berval *value;
@@ -2286,12 +2314,12 @@ static int caseExactIA5SubstringsIndexer(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       BVarray values,
-       BVarray *keysp )
+       BerVarray values,
+       BerVarray *keysp )
 {
        ber_len_t i, nkeys;
        size_t slen, mlen;
-       BVarray keys;
+       BerVarray keys;
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
        struct berval digest;
@@ -2447,13 +2475,13 @@ static int caseExactIA5SubstringsFilter(
        MatchingRule *mr,
        struct berval *prefix,
        void * assertValue,
-       BVarray *keysp )
+       BerVarray *keysp )
 {
        SubstringsAssertion *sa = assertValue;
        char pre;
        ber_len_t nkeys = 0;
        size_t slen, mlen, klen;
-       BVarray keys;
+       BerVarray keys;
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
        struct berval *value;
@@ -2698,16 +2726,14 @@ retry:
                                continue;
                        }
 
-                       p = strcasechr( left.bv_val, *sub->sa_any[i].bv_val );
+                       p = bvcasechr( &left, *sub->sa_any[i].bv_val, &idx );
 
                        if( p == NULL ) {
                                match = 1;
                                goto done;
                        }
 
-                       idx = p - left.bv_val;
                        assert( idx < left.bv_len );
-
                        if( idx >= left.bv_len ) {
                                /* this shouldn't happen */
                                return LDAP_OTHER;
@@ -2751,12 +2777,12 @@ static int caseIgnoreIA5Indexer(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       BVarray values,
-       BVarray *keysp )
+       BerVarray values,
+       BerVarray *keysp )
 {
        int i;
        size_t slen, mlen;
-       BVarray keys;
+       BerVarray keys;
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
        struct berval digest;
@@ -2811,10 +2837,10 @@ static int caseIgnoreIA5Filter(
        MatchingRule *mr,
        struct berval *prefix,
        void * assertValue,
-       BVarray *keysp )
+       BerVarray *keysp )
 {
        size_t slen, mlen;
-       BVarray keys;
+       BerVarray keys;
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
        struct berval value;
@@ -2860,12 +2886,12 @@ static int caseIgnoreIA5SubstringsIndexer(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       BVarray values,
-       BVarray *keysp )
+       BerVarray values,
+       BerVarray *keysp )
 {
        ber_len_t i, nkeys;
        size_t slen, mlen;
-       BVarray keys;
+       BerVarray keys;
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
        struct berval digest;
@@ -3025,13 +3051,13 @@ static int caseIgnoreIA5SubstringsFilter(
        MatchingRule *mr,
        struct berval *prefix,
        void * assertValue,
-       BVarray *keysp )
+       BerVarray *keysp )
 {
        SubstringsAssertion *sa = assertValue;
        char pre;
        ber_len_t nkeys = 0;
        size_t slen, mlen, klen;
-       BVarray keys;
+       BerVarray keys;
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
        struct berval value;
@@ -3575,7 +3601,7 @@ serial_and_issuer_parse(
 
        bv.bv_len = end-begin+1;
        bv.bv_val = begin;
-       *serial = ber_bvdup(&bv);
+       *serial = ber_dupbv(NULL, &bv);
 
        /* now extract the issuer, remember p was at the dollar sign */
        begin = p+1;
@@ -3684,11 +3710,11 @@ static int certificateExactIndexer(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       BVarray values,
-       BVarray *keysp )
+       BerVarray values,
+       BerVarray *keysp )
 {
        int i;
-       BVarray keys;
+       BerVarray keys;
        X509 *xcert;
        unsigned char *p;
        struct berval * serial;
@@ -3752,9 +3778,9 @@ static int certificateExactFilter(
        MatchingRule *mr,
        struct berval *prefix,
        void * assertValue,
-       BVarray *keysp )
+       BerVarray *keysp )
 {
-       BVarray keys;
+       BerVarray keys;
        struct berval *asserted_serial;
        struct berval *asserted_issuer_dn;
 
@@ -4113,15 +4139,18 @@ static struct syntax_defs_rec {
        slap_syntax_transform_func *sd_str2ber;
 #endif
 } syntax_defs[] = {
-       {"( 1.3.6.1.4.1.1466.115.121.1.1 DESC 'ACI Item' " X_BINARY X_NOT_H_R ")",
+       {"( 1.3.6.1.4.1.1466.115.121.1.1 DESC 'ACI Item' "
+               X_BINARY X_NOT_H_R ")",
                SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, NULL, NULL, NULL},
        {"( 1.3.6.1.4.1.1466.115.121.1.2 DESC 'Access Point' " X_NOT_H_R ")",
                0, NULL, NULL, NULL},
        {"( 1.3.6.1.4.1.1466.115.121.1.3 DESC 'Attribute Type Description' )",
                0, NULL, NULL, NULL},
-       {"( 1.3.6.1.4.1.1466.115.121.1.4 DESC 'Audio' " X_NOT_H_R ")",
+       {"( 1.3.6.1.4.1.1466.115.121.1.4 DESC 'Audio' "
+               X_NOT_H_R ")",
                SLAP_SYNTAX_BLOB, blobValidate, NULL, NULL},
-       {"( 1.3.6.1.4.1.1466.115.121.1.5 DESC 'Binary' " X_NOT_H_R ")",
+       {"( 1.3.6.1.4.1.1466.115.121.1.5 DESC 'Binary' "
+               X_NOT_H_R ")",
                SLAP_SYNTAX_BER, berValidate, NULL, NULL},
        {"( 1.3.6.1.4.1.1466.115.121.1.6 DESC 'Bit String' )",
                0, bitStringValidate, bitStringNormalize, NULL },
@@ -4202,6 +4231,9 @@ static struct syntax_defs_rec {
                0, NULL, NULL, NULL},
        {"( 1.3.6.1.4.1.1466.115.121.1.44 DESC 'Printable String' )",
                0, printableStringValidate, IA5StringNormalize, NULL},
+       {"( 1.3.6.1.4.1.1466.115.121.1.45 DESC 'SubtreeSpecification' "
+               X_BINARY X_NOT_H_R ")",
+               SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, NULL, NULL, NULL},
        {"( 1.3.6.1.4.1.1466.115.121.1.49 DESC 'Supported Algorithm' "
                X_BINARY X_NOT_H_R ")",
                SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, berValidate, NULL, NULL},
@@ -4246,9 +4278,11 @@ static struct syntax_defs_rec {
                UTF8StringValidate /* THIS WILL CHANGE FOR NEW ACI SYNTAX */,
                NULL, NULL},
 
+#ifdef SLAPD_AUTHPASSWD
        /* needs updating */
        {"( 1.3.6.1.4.1.4203.666.2.2 DESC 'OpenLDAP authPassword' )",
                SLAP_SYNTAX_HIDE, NULL, NULL, NULL},
+#endif
 
        /* OpenLDAP Void Syntax */
        {"( 1.3.6.1.4.1.4203.1.1.1 DESC 'OpenLDAP void' )" ,
@@ -4296,7 +4330,7 @@ static struct mrule_defs_rec {
         */
        {"( " directoryStringApproxMatchOID " NAME 'directoryStringApproxMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
-               SLAP_MR_EQUALITY_APPROX | SLAP_MR_EXT,
+               SLAP_MR_HIDE | SLAP_MR_EQUALITY_APPROX | SLAP_MR_EXT,
                NULL, NULL,
                directoryStringApproxMatch,
                directoryStringApproxIndexer, 
@@ -4305,7 +4339,7 @@ static struct mrule_defs_rec {
 
        {"( " IA5StringApproxMatchOID " NAME 'IA5StringApproxMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )",
-               SLAP_MR_EQUALITY_APPROX | SLAP_MR_EXT,
+               SLAP_MR_HIDE | SLAP_MR_EQUALITY_APPROX | SLAP_MR_EXT,
                NULL, NULL,
                IA5StringApproxMatch,
                IA5StringApproxIndexer, 
@@ -4545,6 +4579,7 @@ static struct mrule_defs_rec {
                caseExactIA5SubstringsFilter,
                NULL},
 
+#ifdef SLAPD_AUTHPASSWD
        /* needs updating */
        {"( 1.3.6.1.4.1.4203.666.4.1 NAME 'authPasswordMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )",
@@ -4552,6 +4587,7 @@ static struct mrule_defs_rec {
                NULL, NULL,
                authPasswordMatch, NULL, NULL,
                NULL},
+#endif
 
        {"( 1.3.6.1.4.1.4203.666.4.2 NAME 'OpenLDAPaciMatch' "
                "SYNTAX 1.3.6.1.4.1.4203.666.2.1 )",
@@ -4578,7 +4614,7 @@ static struct mrule_defs_rec {
 };
 
 int
-schema_init( void )
+slap_schema_init( void )
 {
        int             res;
        int             i;
@@ -4600,7 +4636,7 @@ schema_init( void )
                );
 
                if ( res ) {
-                       fprintf( stderr, "schema_init: Error registering syntax %s\n",
+                       fprintf( stderr, "slap_schema_init: Error registering syntax %s\n",
                                 syntax_defs[i].sd_desc );
                        return LDAP_OTHER;
                }
@@ -4609,7 +4645,7 @@ schema_init( void )
        for ( i=0; mrule_defs[i].mrd_desc != NULL; i++ ) {
                if( mrule_defs[i].mrd_usage == SLAP_MR_NONE ) {
                        fprintf( stderr,
-                               "schema_init: Ingoring unusable matching rule %s\n",
+                               "slap_schema_init: Ingoring unusable matching rule %s\n",
                                 mrule_defs[i].mrd_desc );
                        continue;
                }
@@ -4626,13 +4662,15 @@ schema_init( void )
 
                if ( res ) {
                        fprintf( stderr,
-                               "schema_init: Error registering matching rule %s\n",
+                               "slap_schema_init: Error registering matching rule %s\n",
                                 mrule_defs[i].mrd_desc );
                        return LDAP_OTHER;
                }
        }
+
+       res = slap_schema_load();
        schema_init_done = 1;
-       return LDAP_SUCCESS;
+       return res;
 }
 
 void