From: Kurt Zeilenga Date: Sat, 4 Nov 2000 22:51:42 +0000 (+0000) Subject: Import schema updates from devel X-Git-Tag: OPENLDAP_REL_ENG_2_0_7~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4e9af40b5b77dc16d4eafc237e6eab9687201cd;p=thirdparty%2Fopenldap.git Import schema updates from devel --- diff --git a/servers/slapd/at.c b/servers/slapd/at.c index 25c1d7589b..5a618ae296 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -275,6 +275,7 @@ at_add( if ( sat->sat_sup ) { sat->sat_syntax = sat->sat_sup->sat_syntax; sat->sat_equality = sat->sat_sup->sat_equality; + sat->sat_approx = sat->sat_sup->sat_approx; sat->sat_ordering = sat->sat_sup->sat_ordering; sat->sat_substr = sat->sat_sup->sat_substr; } diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index cbbd6d77a9..0925fc5998 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -20,11 +20,6 @@ /* recycled validatation routines */ #define berValidate blobValidate -/* recycled normalization routines */ -#define faxNumberNormalize numericStringNormalize -#define phoneNumberNormalize numericStringNormalize -#define telexNumberNormalize numericStringNormalize - /* unimplemented pretters */ #define dnPretty NULL #define integerPretty NULL @@ -1881,6 +1876,25 @@ done: return LDAP_SUCCESS; } +static int +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]) ) { + return LDAP_INVALID_SYNTAX; + } + if( !SLAP_PRINTABLE(val->bv_val[1]) ) { + return LDAP_INVALID_SYNTAX; + } + + return LDAP_SUCCESS; +} + static int printableStringValidate( Syntax *syntax, @@ -1891,7 +1905,27 @@ printableStringValidate( if( !val->bv_len ) return LDAP_INVALID_SYNTAX; for(i=0; i < val->bv_len; i++) { - if( !isprint(val->bv_val[i]) ) return LDAP_INVALID_SYNTAX; + if( !SLAP_PRINTABLE(val->bv_val[i]) ) { + return LDAP_INVALID_SYNTAX; + } + } + + return LDAP_SUCCESS; +} + +static int +printablesStringValidate( + Syntax *syntax, + struct berval *val ) +{ + ber_len_t i; + + if( !val->bv_len ) return LDAP_INVALID_SYNTAX; + + for(i=0; i < val->bv_len; i++) { + if( !SLAP_PRINTABLES(val->bv_val[i]) ) { + return LDAP_INVALID_SYNTAX; + } } return LDAP_SUCCESS; @@ -3673,7 +3707,7 @@ struct syntax_defs_rec syntax_defs[] = { X_BINARY X_NOT_H_R ")", SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, berValidate, NULL, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.11 DESC 'Country String' )", - 0, NULL, NULL, NULL}, + 0, countryStringValidate, IA5StringNormalize, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.12 DESC 'Distinguished Name' )", 0, dnValidate, dnNormalize, dnPretty}, {"( 1.3.6.1.4.1.1466.115.121.1.13 DESC 'Data Quality' )", @@ -3693,7 +3727,7 @@ struct syntax_defs_rec syntax_defs[] = { {"( 1.3.6.1.4.1.1466.115.121.1.21 DESC 'Enhanced Guide' )", 0, NULL, NULL, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.22 DESC 'Facsimile Telephone Number' )", - 0, IA5StringValidate, faxNumberNormalize, NULL}, + 0, printablesStringValidate, IA5StringNormalize, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.23 DESC 'Fax' " X_NOT_H_R ")", SLAP_SYNTAX_BLOB, NULL, NULL, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.24 DESC 'Generalized Time' )", @@ -3727,26 +3761,26 @@ struct syntax_defs_rec syntax_defs[] = { {"( 1.3.6.1.4.1.1466.115.121.1.38 DESC 'OID' )", 0, oidValidate, NULL, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.39 DESC 'Other Mailbox' )", - 0, NULL, NULL, NULL}, + 0, IA5StringValidate, IA5StringNormalize, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.40 DESC 'Octet String' )", 0, blobValidate, NULL, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.41 DESC 'Postal Address' )", - 0, blobValidate, NULL, NULL}, + 0, UTF8StringValidate, UTF8StringNormalize, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.42 DESC 'Protocol Information' )", 0, NULL, NULL, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.43 DESC 'Presentation Address' )", 0, NULL, NULL, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.44 DESC 'Printable String' )", - 0, printableStringValidate, NULL, NULL}, + 0, printableStringValidate, IA5StringNormalize, 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}, {"( 1.3.6.1.4.1.1466.115.121.1.50 DESC 'Telephone Number' )", - 0, IA5StringValidate, phoneNumberNormalize, NULL}, + 0, printableStringValidate, IA5StringNormalize, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.51 DESC 'Teletex Terminal Identifier' )", 0, NULL, NULL, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.52 DESC 'Telex Number' )", - 0, IA5StringValidate, telexNumberNormalize, NULL}, + 0, printableStringValidate, IA5StringNormalize, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.53 DESC 'UTC Time' )", 0, utcTimeValidate, utcTimeNormalize, NULL}, {"( 1.3.6.1.4.1.1466.115.121.1.54 DESC 'LDAP Syntax Description' )", diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index c198a003b7..e87a194e49 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -101,6 +101,13 @@ LDAP_BEGIN_DECL #define AD_LEADCHAR(c) ( ATTR_CHAR(c) ) #define AD_CHAR(c) ( ATTR_CHAR(c) || (c) == ';' ) +#define SLAP_PRINTABLE(c) ( ASCII_ALNUM(c) || (c) == '\'' || \ + (c) == '(' || (c) == ')' || (c) == '+' || (c) == ',' || \ + (c) == '-' || (c) == '.' || (c) == '/' || (c) == ':' || \ + (c) == '?' || (c) == ' ' ) + +#define SLAP_PRINTABLES(c) ( SLAP_PRINTABLE(c) || (c) == '$' ) + /* must match in schema_init.c */ #define SLAPD_DN_SYNTAX "1.3.6.1.4.1.1466.115.121.1.12" #define SLAPD_NAMEUID_SYNTAX "1.3.6.1.4.1.1466.115.121.1.34"