]> git.sur5r.net Git - openldap/commitdiff
Use ASCII_*() macros and friends. Should be combined with similiar LDAP_*()
authorKurt Zeilenga <kurt@openldap.org>
Tue, 20 Jun 2000 17:05:15 +0000 (17:05 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 20 Jun 2000 17:05:15 +0000 (17:05 +0000)
macros in ldap_pvt.h.

servers/slapd/aclparse.c
servers/slapd/schema_init.c
servers/slapd/schema_prep.c
servers/slapd/schemaparse.c
servers/slapd/slap.h

index 8386adcf7935d988978dc97dba85b01cdcf89e13..a67c0b9ad825dcd14a2e8165e008b506ab034dc1 100644 (file)
@@ -864,7 +864,7 @@ str2accessmask( const char *str )
 {
        slap_access_mask_t      mask;
 
-       if( !isalpha(str[0]) ) {
+       if( !ASCII_ALPHA(str[0]) ) {
                int i;
 
                if ( str[0] == '=' ) {
index e64075a103e00b6f2c7ec0a6b9c7b99692b38147..184e97ffb08cb098ae67327cfd21872f08829996 100644 (file)
 #include "lutil_md5.h"
 
 /* recycled validatation routines */
-#define berValidate blobValidate
+#define berValidate                                            blobValidate
 
 /* recycled normalization routines */
-#define faxNumberNormalize numericStringNormalize
-#define phoneNumberNormalize numericStringNormalize
-#define telexNumberNormalize numericStringNormalize
+#define faxNumberNormalize                             numericStringNormalize
+#define phoneNumberNormalize                   numericStringNormalize
+#define telexNumberNormalize                   numericStringNormalize
 
 /* recycled matching routines */
-#define caseIgnoreMatch caseIgnoreIA5Match
-#define caseIgnoreOrderingMatch caseIgnoreMatch
-#define caseIgnoreSubstringsMatch caseIgnoreIA5SubstringsMatch
-#define caseExactMatch caseExactIA5Match
-#define caseExactOrderingMatch caseExactMatch
-#define caseExactSubstringsMatch caseExactIA5SubstringsMatch
-
-#define numericStringMatch caseIgnoreMatch
-#define objectIdentifierMatch numericStringMatch
-#define integerMatch numericStringMatch
-#define telephoneNumberMatch numericStringMatch
-#define generalizedTimeMatch numericStringMatch
-#define generalizedTimeOrderingMatch numericStringMatch
+#define caseIgnoreMatch                                        caseIgnoreIA5Match
+#define caseIgnoreOrderingMatch                        caseIgnoreMatch
+#define caseIgnoreSubstringsMatch              caseIgnoreIA5SubstringsMatch
+
+#define caseExactMatch                                 caseExactIA5Match
+#define caseExactOrderingMatch                 caseExactMatch
+#define caseExactSubstringsMatch               caseExactIA5SubstringsMatch
+
+#define numericStringMatch                             caseIgnoreMatch
+#define objectIdentifierMatch                  numericStringMatch
+#define integerMatch                                   numericStringMatch
+#define telephoneNumberMatch                   numericStringMatch
+#define generalizedTimeMatch                   numericStringMatch
+#define generalizedTimeOrderingMatch   numericStringMatch
 
 /* unimplemented matching routines */
-#define caseIgnoreListMatch NULL
-#define caseIgnoreListSubstringsMatch NULL
-#define bitStringMatch NULL
-#define telephoneNumberSubstringsMatch NULL
-#define presentationAddressMatch NULL
-#define uniqueMemberMatch NULL
-#define protocolInformationMatch NULL
-#define integerFirstComponentMatch NULL
-
-#define OpenLDAPaciMatch NULL
-#define authPasswordMatch NULL
+#define caseIgnoreListMatch                            NULL
+#define caseIgnoreListSubstringsMatch  NULL
+#define bitStringMatch                                 NULL
+#define telephoneNumberSubstringsMatch NULL
+#define presentationAddressMatch               NULL
+#define uniqueMemberMatch                              NULL
+#define protocolInformationMatch               NULL
+#define integerFirstComponentMatch             NULL
+
+#define OpenLDAPaciMatch                               NULL
+#define authPasswordMatch                              NULL
 
 /* unimplied indexer/filter routines */
-#define dnIndexer NULL
-#define dnFilter NULL
+#define dnIndexer                                              NULL
+#define dnFilter                                               NULL
+#define caseIgnoreIA5SubstringsIndexer NULL
+#define caseIgnoreIA5SubstringsFilter  NULL
 
 /* recycled indexing/filtering routines */
-#define caseIgnoreIndexer              caseIgnoreIA5Indexer
-#define caseIgnoreFilter               caseIgnoreIA5Filter
-#define caseExactIndexer               caseExactIA5Indexer
-#define caseExactFilter                        caseExactIA5Filter
-#define caseExactIA5Indexer            caseIgnoreIA5Indexer
-#define caseExactIA5Filter             caseIgnoreIA5Filter
+#define caseIgnoreIndexer                              caseIgnoreIA5Indexer
+#define caseIgnoreFilter                               caseIgnoreIA5Filter
+#define caseExactIndexer                               caseExactIA5Indexer
+#define caseExactFilter                                        caseExactIA5Filter
+#define caseExactIA5Indexer                            caseIgnoreIA5Indexer
+#define caseExactIA5Filter                             caseIgnoreIA5Filter
+
+#define caseIgnoreSubstringsIndexer            caseIgnoreIA5SubstringsIndexer
+#define caseIgnoreSubstringsFilter             caseIgnoreIA5SubstringsFilter
+#define caseExactSubstringsIndexer             caseExactIA5SubstringsIndexer
+#define caseExactSubstringsFilter              caseExactIA5SubstringsFilter
+#define caseExactIA5SubstringsFilter   caseIgnoreIA5SubstringsFilter
+#define caseExactIA5SubstringsIndexer  caseIgnoreIA5SubstringsIndexer
+
 
 static int
 octetStringMatch(
@@ -390,12 +401,12 @@ oidValidate(
 
        if( val->bv_len == 0 ) return 0;
 
-       if( isdigit(val->bv_val[0]) ) {
+       if( OID_LEADCHAR(val->bv_val[0]) ) {
                int dot = 0;
                for(i=1; i < val->bv_len; i++) {
-                       if( val->bv_val[i] == '.' ) {
+                       if( OID_SEPARATOR( val->bv_val[i] ) ) {
                                if( dot++ ) return 1;
-                       } else if ( isdigit(val->bv_val[i]) ) {
+                       } else if ( OID_CHAR( val->bv_val[i] ) ) {
                                dot = 0;
                        } else {
                                return LDAP_INVALID_SYNTAX;
@@ -404,9 +415,9 @@ oidValidate(
 
                return !dot ? LDAP_SUCCESS : LDAP_INVALID_SYNTAX;
 
-       } else if( isalpha(val->bv_val[0]) ) {
+       } else if( DESC_LEADCHAR(val->bv_val[0]) ) {
                for(i=1; i < val->bv_len; i++) {
-                       if( !isalpha(val->bv_val[i] ) ) {
+                       if( !DESC_CHAR(val->bv_val[i] ) ) {
                                return LDAP_INVALID_SYNTAX;
                        }
                }
@@ -425,7 +436,7 @@ integerValidate(
        ber_len_t i;
 
        for(i=0; i < val->bv_len; i++) {
-               if( !isdigit(val->bv_val[i]) ) return LDAP_INVALID_SYNTAX;
+               if( !ASCII_DIGIT(val->bv_val[i]) ) return LDAP_INVALID_SYNTAX;
        }
 
        return LDAP_SUCCESS;
@@ -499,7 +510,7 @@ IA5StringNormalize(
        p = val->bv_val;
 
        /* Ignore initial whitespace */
-       while ( isspace( *p ) ) {
+       while ( ASCII_SPACE( *p ) ) {
                p++;
        }
 
@@ -512,11 +523,11 @@ IA5StringNormalize(
        p = q = newval->bv_val;
 
        while ( *p ) {
-               if ( isspace( *p ) ) {
+               if ( ASCII_SPACE( *p ) ) {
                        *q++ = *p++;
 
                        /* Ignore the extra whitespace */
-                       while ( isspace( *p ) ) {
+                       while ( ASCII_SPACE( *p ) ) {
                                p++;
                        }
                } else {
@@ -529,7 +540,7 @@ IA5StringNormalize(
        assert( p <= q );
 
        /* cannot start with a space */
-       assert( !isspace(*newval->bv_val) );
+       assert( !ASCII_SPACE(*newval->bv_val) );
 
        /*
         * If the string ended in space, backup the pointer one
@@ -537,12 +548,12 @@ IA5StringNormalize(
         * all whitespace to a single space.
         */
 
-       if ( isspace( q[-1] ) ) {
+       if ( ASCII_SPACE( q[-1] ) ) {
                --q;
        }
 
        /* cannot end with a space */
-       assert( !isspace( q[-1] ) );
+       assert( !ASCII_SPACE( q[-1] ) );
 
        /* null terminate */
        *q = '\0';
@@ -979,7 +990,7 @@ numericStringNormalize(
        p = val->bv_val;
 
        /* Ignore initial whitespace */
-       while ( isspace( *p ) ) {
+       while ( ASCII_SPACE( *p ) ) {
                p++;
        }
 
@@ -992,7 +1003,7 @@ numericStringNormalize(
        p = q = newval->bv_val;
 
        while ( *p ) {
-               if ( isspace( *p ) ) {
+               if ( ASCII_SPACE( *p ) ) {
                        /* Ignore whitespace */
                        p++;
                } else {
@@ -1005,10 +1016,10 @@ numericStringNormalize(
        assert( p <= q );
 
        /* cannot start with a space */
-       assert( !isspace(*newval->bv_val) );
+       assert( !ASCII_SPACE(*newval->bv_val) );
 
        /* cannot end with a space */
-       assert( !isspace( q[-1] ) );
+       assert( !ASCII_SPACE( q[-1] ) );
 
        /* null terminate */
        *q = '\0';
@@ -1039,20 +1050,20 @@ objectIdentifierFirstComponentMatch(
        }
 
        /* trim leading white space */
-       for( i=1; isspace(value->bv_val[i]) && i < value->bv_len; i++ ) {
+       for( i=1; ASCII_SPACE(value->bv_val[i]) && i < value->bv_len; i++ ) {
                /* empty */
        }
 
        /* grab next word */
        oid.bv_val = &value->bv_val[i];
        oid.bv_len = value->bv_len - i;
-       for( i=1; isspace(value->bv_val[i]) && i < oid.bv_len; i++ ) {
+       for( i=1; ASCII_SPACE(value->bv_val[i]) && i < oid.bv_len; i++ ) {
                /* empty */
        }
        oid.bv_len = i;
 
        /* insert attributeTypes, objectclass check here */
-       if( isdigit(asserted->bv_val[0]) ) {
+       if( OID_LEADCHAR(asserted->bv_val[0]) ) {
                rc = objectIdentifierMatch( &match, use, syntax, mr, &oid, asserted );
 
        } else {
@@ -1123,7 +1134,7 @@ check_time_syntax (struct berval *val,
        e = p + val->bv_len;
 
        /* Ignore initial whitespace */
-       while ( ( p < e ) && isspace( *p ) ) {
+       while ( ( p < e ) && ASCII_SPACE( *p ) ) {
                p++;
        }
 
@@ -1205,7 +1216,7 @@ check_time_syntax (struct berval *val,
        }
 
        /* Ignore trailing whitespace */
-       while ( ( p < e ) && isspace( *p ) ) {
+       while ( ( p < e ) && ASCII_SPACE( *p ) ) {
                p++;
        }
        if (p != e)
@@ -1548,7 +1559,8 @@ struct mrule_defs_rec mrule_defs[] = {
        {"( 2.5.13.4 NAME 'caseIgnoreSubstringsMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
                SLAP_MR_SUBSTR | SLAP_MR_EXT,
-               NULL, NULL, caseIgnoreSubstringsMatch, NULL, NULL},
+               NULL, NULL, caseIgnoreSubstringsMatch,
+               caseIgnoreSubstringsIndexer, caseIgnoreSubstringsFilter},
 
        /* Next three are not in the RFC's, but are needed for compatibility */
        {"( 2.5.13.5 NAME 'caseExactMatch' "
@@ -1564,7 +1576,8 @@ struct mrule_defs_rec mrule_defs[] = {
        {"( 2.5.13.7 NAME 'caseExactSubstringsMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
                SLAP_MR_SUBSTR | SLAP_MR_EXT,
-               NULL, NULL, caseExactSubstringsMatch, NULL, NULL},
+               NULL, NULL, caseExactSubstringsMatch,
+               caseExactSubstringsIndexer, caseExactSubstringsFilter},
 
        {"( 2.5.13.8 NAME 'numericStringMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 )",
@@ -1574,7 +1587,8 @@ struct mrule_defs_rec mrule_defs[] = {
        {"( 2.5.13.10 NAME 'numericStringSubstringsMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
                SLAP_MR_SUBSTR | SLAP_MR_EXT,
-               NULL, NULL, caseIgnoreIA5SubstringsMatch, NULL, NULL},
+               NULL, NULL, caseIgnoreIA5SubstringsMatch,
+               caseIgnoreIA5SubstringsIndexer, caseIgnoreIA5SubstringsFilter},
 
        {"( 2.5.13.11 NAME 'caseIgnoreListMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )",
@@ -1659,7 +1673,8 @@ struct mrule_defs_rec mrule_defs[] = {
        {"( 1.3.6.1.4.1.1466.109.114.3 NAME 'caseIgnoreIA5SubstringsMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )",
                SLAP_MR_SUBSTR,
-               NULL, NULL, caseIgnoreIA5SubstringsMatch, NULL, NULL},
+               NULL, NULL, caseIgnoreIA5SubstringsMatch,
+               caseIgnoreIA5SubstringsIndexer, caseIgnoreIA5SubstringsFilter},
 
        {"( 1.3.6.1.4.1.4203.666.4.1 NAME 'authPasswordMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )",
index a2e479433f692ce3ff0d2b2647be31897e35d7dd..33192a6661f3704d2652d5d8ea82411c6ef370f7 100644 (file)
@@ -37,7 +37,7 @@ objectClassMatch(
        ObjectClass *asserted = oc_find( a->bv_val );
 
        if( asserted == NULL ) {
-               if( isdigit( *value->bv_val ) ) {
+               if( OID_LEADCHAR( *value->bv_val ) ) {
                        /* OID form, return FALSE */
                        *matchp = 1;
                        return LDAP_SUCCESS;
index 8350b877b7205be398de90cff19095a8190e1d68..6f00e93eef2fa297d1cbfed1887fd8d11004caca 100644 (file)
@@ -78,7 +78,7 @@ find_oidm(char *oid)
        OidMacro *om;
 
        /* OID macros must start alpha */
-       if ( isdigit( *oid ) )  {
+       if ( OID_LEADCHAR( *oid ) )     {
                return oid;
        }
 
@@ -178,7 +178,7 @@ parse_oc(
                oc_usage();
        }
        if ( oc->oc_oid ) {
-               if ( !isdigit( oc->oc_oid[0] )) {
+               if ( !OID_LEADCHAR( oc->oc_oid[0] )) {
                        /* Expand OID macros */
                        oid = find_oidm( oc->oc_oid );
                        if ( !oid ) {
@@ -272,7 +272,7 @@ parse_at(
        for (; argv[3]; argv++)
        {
                if (!strcasecmp(argv[3], "syntax") &&
-                   !isdigit(*argv[4]))
+                   !OID_LEADCHAR(*argv[4]))
                {
                        int slen;
                        Syntax *syn;
@@ -295,7 +295,7 @@ parse_at(
                at_usage();
        }
        if ( at->at_oid ) {
-               if ( !isdigit( at->at_oid[0] )) {
+               if ( !OID_LEADCHAR( at->at_oid[0] )) {
                        /* Expand OID macros */
                        oid = find_oidm( at->at_oid );
                        if ( !oid ) {
@@ -311,8 +311,7 @@ parse_at(
                }
        }
        /* at->at_oid == NULL will be an error someday */
-       if (soid)
-       {
+       if (soid) {
                ldap_memfree(at->at_syntax_oid);
                at->at_syntax_oid = soid;
        }
index 5ff77ce52e6ea05a1600945b9cd7ab0c72b1752b..0b4171126f2097ec248b73939e6bdab811791eac 100644 (file)
@@ -85,7 +85,8 @@ LDAP_BEGIN_DECL
 #define DESC_LEADCHAR(c)       ( ASCII_ALPHA(c) )
 #define DESC_CHAR(c)   ( ASCII_ALNUM(c) || (c) == '-' )
 #define OID_LEADCHAR(c)        ( ASCII_DIGIT(c) )
-#define OID_CHAR(c)    ( ASCII_DIGIT(c) || (c) == '.' )
+#define OID_SEPARATOR(c)       ( (c) == '.' )
+#define OID_CHAR(c)    ( OID_LEADCHAR(c) || OID_SEPARATOR(c) )
 
 #define ATTR_LEADCHAR(c)       ( DESC_LEADCHAR(c) || OID_LEADCHAR(c) )
 #define ATTR_CHAR(c)   ( DESC_CHAR((c)) || (c) == '.' )