]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/schema_init.c
Move backend_syncfreq code down into back-ldbm. Creates new configuration
[openldap] / servers / slapd / schema_init.c
index 921cab74c38fe558488296fc597ce1c0f876b3f0..00c4ca9955f793c1824c1aca09f178d8b1a81021 100644 (file)
@@ -71,7 +71,6 @@
 /* unimplemented matching routines */
 #define caseIgnoreListMatch                            NULL
 #define caseIgnoreListSubstringsMatch  NULL
-#define presentationAddressMatch               NULL
 #define protocolInformationMatch               NULL
 #define integerFirstComponentMatch             NULL
 
 #define integerIndexer                                 caseIgnoreIA5Indexer
 #define integerFilter                                  caseIgnoreIA5Filter
 
+#define telephoneNumberIndexer                 caseIgnoreIA5Indexer
+#define telephoneNumberFilter                  caseIgnoreIA5Filter
+#define telephoneNumberSubstringsIndexer       caseIgnoreIA5SubstringsIndexer
+#define telephoneNumberSubstringsFilter                caseIgnoreIA5SubstringsFilter
+
 static char *strcasechr( const char *str, int c )
 {
        char *lower = strchr( str, TOLOWER(c) );
@@ -436,6 +440,7 @@ bitStringValidate(
        if( in->bv_len < 3 ) {
                return LDAP_INVALID_SYNTAX;
        }
+
        if( in->bv_val[0] != 'B' ||
                in->bv_val[1] != '\'' ||
                in->bv_val[in->bv_len-1] != '\'' )
@@ -496,60 +501,6 @@ booleanMatch(
 }
 
 #if UTF8MATCH
-static int
-UTF8casecmp(
-       struct berval *right,
-       struct berval *left )
-{
-       ber_len_t r, l;
-       int rlen, llen;
-       ldap_unicode_t ru, lu;
-       ldap_unicode_t ruu, luu;
-
-       for( r=0, l=0;
-               r < right->bv_len && l < left->bv_len;
-               r+=rlen, l+=llen )
-       {
-               /*
-                * XXYYZ: we convert to ucs4 even though -llunicode
-                * expects ucs2 in an unsigned long
-                */
-               ru = ldap_utf8_to_ucs4( &right->bv_val[r] );
-               if( ru == LDAP_UCS4_INVALID ) {
-                       return 1;
-               }
-
-               lu = ldap_utf8_to_ucs4( &left->bv_val[l] );
-               if( lu == LDAP_UCS4_INVALID ) {
-                       return -1;
-               }
-
-               ruu = uctoupper( ru );
-               luu = uctoupper( lu );
-
-               if( ruu > luu ) {
-                       return 1;
-               } else if( luu > ruu ) {
-                       return -1;
-               }
-
-               rlen = LDAP_UTF8_CHARLEN( &right->bv_val[r] );
-               llen = LDAP_UTF8_CHARLEN( &left->bv_val[l] );
-       }
-
-       if( r < right->bv_len ) {
-               /* less left */
-               return -1;
-       }
-
-       if( l < left->bv_len ) {
-               /* less right */
-               return 1;
-       }
-
-       return 0;
-}
-
 /* case insensitive UTF8 strncmp with offset for second string */
 static int
 UTF8oncasecmp(
@@ -559,8 +510,8 @@ UTF8oncasecmp(
        ber_len_t offset )
 {
        ber_len_t r, l;
-       int rlen, llen;
-       int rslen, lslen;
+       ber_len_t rlen, llen;
+       ber_len_t rslen, lslen;
        ldap_unicode_t ru, lu;
        ldap_unicode_t ruu, luu;
 
@@ -1664,7 +1615,9 @@ caseIgnoreMatch(
        void *assertedValue )
 {
 #if UTF8MATCH
-       *matchp = UTF8casecmp( value, (struct berval *) assertedValue );
+       *matchp = UTF8normcmp( value->bv_val,
+                              ((struct berval *) assertedValue)->bv_val,
+                              UTF8_CASEFOLD );
 #else
        int match = value->bv_len - ((struct berval *) assertedValue)->bv_len;
 
@@ -2402,8 +2355,6 @@ countryStringValidate(
        Syntax *syntax,
        struct berval *val )
 {
-       ber_len_t i;
-
        if( val->bv_len != 2 ) return LDAP_INVALID_SYNTAX;
 
        if( !SLAP_PRINTABLE(val->bv_val[0]) ) {
@@ -3692,8 +3643,6 @@ numericStringValidate(
 {
        ber_len_t i;
 
-       /* disallow empty numeric strings */
-
        for(i=0; i < in->bv_len; i++) {
                if( !SLAP_NUMERIC(in->bv_val[i]) ) {
                        return LDAP_INVALID_SYNTAX;
@@ -3728,7 +3677,7 @@ numericStringNormalize(
                }
        }
 
-       assert( newval->bv_val < p );
+       assert( newval->bv_val <= p );
        assert( q <= p );
 
        /* null terminate */
@@ -4330,7 +4279,7 @@ struct syntax_defs_rec syntax_defs[] = {
 
        /* OpenLDAP Experimental Syntaxes */
        {"( 1.3.6.1.4.1.4203.666.2.1 DESC 'OpenLDAP Experimental ACI' )",
-               0, IA5StringValidate /* THIS WILL CHANGE FOR NEW ACI SYNTAX */,
+               0, UTF8StringValidate /* THIS WILL CHANGE FOR NEW ACI SYNTAX */,
                NULL, NULL},
        {"( 1.3.6.1.4.1.4203.666.2.2 DESC 'OpenLDAP authPassword' )",
                0, NULL, NULL, NULL},
@@ -4529,21 +4478,25 @@ struct mrule_defs_rec mrule_defs[] = {
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )",
                SLAP_MR_EQUALITY | SLAP_MR_EXT,
                NULL, NULL,
-               telephoneNumberMatch, NULL, NULL,
+               telephoneNumberMatch,
+               telephoneNumberIndexer,
+               telephoneNumberFilter,
                NULL},
 
        {"( 2.5.13.21 NAME 'telephoneNumberSubstringsMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
                SLAP_MR_SUBSTR | SLAP_MR_EXT,
                NULL, NULL,
-               telephoneNumberSubstringsMatch, NULL, NULL,
+               telephoneNumberSubstringsMatch,
+               telephoneNumberSubstringsIndexer,
+               telephoneNumberSubstringsFilter,
                NULL},
 
        {"( 2.5.13.22 NAME 'presentationAddressMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.43 )",
                SLAP_MR_EQUALITY | SLAP_MR_EXT,
                NULL, NULL,
-               presentationAddressMatch, NULL, NULL,
+               NULL, NULL, NULL,
                NULL},
 
        {"( 2.5.13.23 NAME 'uniqueMemberMatch' "