1 /* schema_init.c - init builtin schema */
4 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
13 #include <ac/string.h>
14 #include <ac/socket.h>
24 /* any value allowed */
33 /* any value allowed */
37 #define berValidate blobValidate
46 unsigned char *u = in->bv_val;
48 for( count = in->bv_len; count > 0; count-=len, u+=len ) {
49 /* get the length indicated by the first byte */
50 len = LDAP_UTF8_CHARLEN( u );
52 /* should not be zero */
53 if( len == 0 ) return LDAP_INVALID_SYNTAX;
55 /* make sure len corresponds with the offset
56 to the next character */
57 if( LDAP_UTF8_OFFSET( u ) != len ) return LDAP_INVALID_SYNTAX;
60 if( count != 0 ) return LDAP_INVALID_SYNTAX;
69 struct berval **normalized )
71 struct berval *newval;
74 newval = ch_malloc( sizeof( struct berval ) );
78 /* Ignore initial whitespace */
79 while ( ldap_utf8_isspace( p ) ) {
85 return LDAP_INVALID_SYNTAX;
88 newval->bv_val = ch_strdup( p );
89 p = q = newval->bv_val;
95 if ( ldap_utf8_isspace( p ) ) {
96 len = LDAP_UTF8_COPY(q,p);
101 /* Ignore the extra whitespace */
102 while ( ldap_utf8_isspace( p ) ) {
106 len = LDAP_UTF8_COPY(q,p);
113 assert( *newval->bv_val );
114 assert( newval->bv_val < p );
117 /* cannot start with a space */
118 assert( !ldap_utf8_isspace(newval->bv_val) );
121 * If the string ended in space, backup the pointer one
122 * position. One is enough because the above loop collapsed
123 * all whitespace to a single space.
130 /* cannot end with a space */
131 assert( !ldap_utf8_isspace( LDAP_UTF8_PREV(q) ) );
136 newval->bv_len = q - newval->bv_val;
137 *normalized = newval;
149 if( val->bv_len == 0 ) return 0;
151 if( isdigit(val->bv_val[0]) ) {
153 for(i=1; i < val->bv_len; i++) {
154 if( val->bv_val[i] == '.' ) {
155 if( dot++ ) return 1;
156 } else if ( isdigit(val->bv_val[i]) ) {
159 return LDAP_INVALID_SYNTAX;
163 return !dot ? LDAP_SUCCESS : LDAP_INVALID_SYNTAX;
165 } else if( isalpha(val->bv_val[0]) ) {
166 for(i=1; i < val->bv_len; i++) {
167 if( !isalpha(val->bv_val[i] ) ) {
168 return LDAP_INVALID_SYNTAX;
175 return LDAP_INVALID_SYNTAX;
185 for(i=0; i < val->bv_len; i++) {
186 if( !isdigit(val->bv_val[i]) ) return LDAP_INVALID_SYNTAX;
193 printableStringValidate(
199 for(i=0; i < val->bv_len; i++) {
200 if( !isprint(val->bv_val[i]) ) return LDAP_INVALID_SYNTAX;
213 for(i=0; i < val->bv_len; i++) {
214 if( !isascii(val->bv_val[i]) ) return LDAP_INVALID_SYNTAX;
224 struct berval **out )
227 ber_len_t i, len = in->bv_len;
228 struct berval *bv = ch_malloc( sizeof(struct berval) );
230 bv->bv_len = len * sizeof( ldap_unicode_t );
231 bv->bv_val = (char *) u = ch_malloc( bv->bv_len + sizeof( ldap_unicode_t ) );;
233 for(i=0; i < len; i++ ) {
235 * IA5StringValidate should have been called to ensure
236 * input is limited to IA5.
238 u[i] = in->bv_val[i];
250 struct berval **normalized )
252 struct berval *newval;
255 newval = ch_malloc( sizeof( struct berval ) );
259 /* Ignore initial whitespace */
260 while ( isspace( *p++ ) ) {
266 return LDAP_INVALID_SYNTAX;
269 newval->bv_val = ch_strdup( p );
270 p = q = newval->bv_val;
273 if ( isspace( *p ) ) {
276 /* Ignore the extra whitespace */
277 while ( isspace( *p++ ) ) {
285 assert( *newval->bv_val );
286 assert( newval->bv_val < p );
289 /* cannot start with a space */
290 assert( !isspace(*newval->bv_val) );
293 * If the string ended in space, backup the pointer one
294 * position. One is enough because the above loop collapsed
295 * all whitespace to a single space.
298 if ( isspace( q[-1] ) ) {
302 /* cannot end with a space */
303 assert( !isspace( q[-1] ) );
308 newval->bv_len = q - newval->bv_val;
309 *normalized = newval;
320 struct berval *value,
321 void *assertedValue )
323 *match = strcmp( value->bv_val,
324 ((struct berval *) assertedValue)->bv_val );
328 #ifdef SLAPD_SCHEMA_NOT_COMPAT
330 caseExactIA5SubstringsMatch(
335 struct berval *value,
336 void *assertedValue )
339 SubstringsAssertion *sub = assertedValue;
340 struct berval left = *value;
344 if( sub->sa_initial ) {
345 inlen += sub->sa_initial->bv_len;
348 for(i=0; sub->sa_any[i]; i++) {
349 inlen += sub->sa_final->bv_len;
352 if( sub->sa_final ) {
353 inlen += sub->sa_final->bv_len;
356 if( inlen > value->bv_len ) {
361 if( sub->sa_initial ) {
362 match = strncmp( sub->sa_initial->bv_val, left.bv_val,
363 sub->sa_initial->bv_len );
369 left.bv_val += sub->sa_initial->bv_len;
370 left.bv_len -= sub->sa_initial->bv_len;
371 inlen -= sub->sa_initial->bv_len;
374 if( sub->sa_final ) {
375 match = strncmp( sub->sa_final->bv_val,
376 &left.bv_val[left.bv_len - sub->sa_final->bv_len],
377 sub->sa_final->bv_len );
383 left.bv_len -= sub->sa_final->bv_len;
384 inlen -= sub->sa_initial->bv_len;
388 for(i=0; sub->sa_any[i]; i++) {
393 if( inlen < left.bv_len ) {
394 /* not enough length */
399 if( sub->sa_any[i]->bv_len == 0 ) {
403 p = strchr( left.bv_val, *sub->sa_any[i]->bv_val );
410 idx = p - left.bv_val;
411 assert( idx < left.bv_len );
413 if( idx >= left.bv_len ) {
414 /* this shouldn't happen */
421 if( sub->sa_any[i]->bv_len > left.bv_len ) {
422 /* not enough left */
427 match = strncmp( left.bv_val,
428 sub->sa_any[i]->bv_val,
429 sub->sa_any[i]->bv_len );
436 left.bv_val += sub->sa_any[i]->bv_len;
437 left.bv_len -= sub->sa_any[i]->bv_len;
453 struct berval *value,
454 void *assertedValue )
456 *match = strcasecmp( value->bv_val,
457 ((struct berval *) assertedValue)->bv_val );
461 #ifdef SLAPD_SCHEMA_NOT_COMPAT
462 static char *strcasechr( const char *str, int c )
464 char *lower = strchr( str, TOLOWER(c) );
465 char *upper = strchr( str, TOUPPER(c) );
467 if( lower && upper ) {
468 return lower < upper ? lower : upper;
469 } else if ( lower ) {
477 caseIgnoreIA5SubstringsMatch(
482 struct berval *value,
483 void *assertedValue )
486 SubstringsAssertion *sub = assertedValue;
487 struct berval left = *value;
491 if( sub->sa_initial ) {
492 inlen += sub->sa_initial->bv_len;
495 for(i=0; sub->sa_any[i]; i++) {
496 inlen += sub->sa_final->bv_len;
499 if( sub->sa_final ) {
500 inlen += sub->sa_final->bv_len;
503 if( inlen > value->bv_len ) {
508 if( sub->sa_initial ) {
509 match = strncasecmp( sub->sa_initial->bv_val, left.bv_val,
510 sub->sa_initial->bv_len );
516 left.bv_val += sub->sa_initial->bv_len;
517 left.bv_len -= sub->sa_initial->bv_len;
520 if( sub->sa_final ) {
521 match = strncasecmp( sub->sa_final->bv_val,
522 &left.bv_val[left.bv_len - sub->sa_final->bv_len],
523 sub->sa_final->bv_len );
529 left.bv_len -= sub->sa_final->bv_len;
533 for(i=0; sub->sa_any[i]; i++) {
538 if( inlen < left.bv_len ) {
539 /* not enough length */
544 if( sub->sa_any[i]->bv_len == 0 ) {
548 p = strcasechr( left.bv_val, *sub->sa_any[i]->bv_val );
555 idx = p - left.bv_val;
556 assert( idx < left.bv_len );
558 if( idx >= left.bv_len ) {
559 /* this shouldn't happen */
566 if( sub->sa_any[i]->bv_len > left.bv_len ) {
567 /* not enough left */
572 match = strncasecmp( left.bv_val,
573 sub->sa_any[i]->bv_val,
574 sub->sa_any[i]->bv_len );
581 left.bv_val += sub->sa_any[i]->bv_len;
582 left.bv_len -= sub->sa_any[i]->bv_len;
592 struct syntax_defs_rec {
595 slap_syntax_validate_func *sd_validate;
596 slap_syntax_transform_func *sd_normalize;
597 slap_syntax_transform_func *sd_pretty;
598 #ifdef SLAPD_BINARY_CONVERSION
599 slap_syntax_transform_func *sd_ber2str;
600 slap_syntax_transform_func *sd_str2ber;
604 #define X_HIDE "X-HIDE 'TRUE' "
605 #define X_BINARY "X-BINARY-TRANSFER-REQUIRED 'TRUE' "
606 #define X_NOT_H_R "X-NOT-HUMAN-READABLE 'TRUE' "
608 struct syntax_defs_rec syntax_defs[] = {
609 {"( 1.3.6.1.4.1.1466.115.121.1.1 DESC 'ACI Item' " X_BINARY X_NOT_H_R ")",
610 SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, NULL, NULL, NULL},
611 {"( 1.3.6.1.4.1.1466.115.121.1.2 DESC 'Access Point' " X_NOT_H_R ")",
612 0, NULL, NULL, NULL},
613 {"( 1.3.6.1.4.1.1466.115.121.1.3 DESC 'Attribute Type Description' )",
614 0, NULL, NULL, NULL},
615 {"( 1.3.6.1.4.1.1466.115.121.1.4 DESC 'Audio' " X_NOT_H_R ")",
616 SLAP_SYNTAX_BLOB, blobValidate, NULL, NULL},
617 {"( 1.3.6.1.4.1.1466.115.121.1.5 DESC 'Binary' " X_BINARY X_NOT_H_R ")",
618 SLAP_SYNTAX_BER, berValidate, NULL, NULL},
619 {"( 1.3.6.1.4.1.1466.115.121.1.6 DESC 'Bit String' )",
620 0, NULL, NULL, NULL},
621 {"( 1.3.6.1.4.1.1466.115.121.1.7 DESC 'Boolean' )",
622 0, NULL, NULL, NULL},
623 {"( 1.3.6.1.4.1.1466.115.121.1.8 DESC 'Certificate' "
624 X_BINARY X_NOT_H_R ")",
625 SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, berValidate, NULL, NULL},
626 {"( 1.3.6.1.4.1.1466.115.121.1.9 DESC 'Certificate List' "
627 X_BINARY X_NOT_H_R ")",
628 SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, berValidate, NULL, NULL},
629 {"( 1.3.6.1.4.1.1466.115.121.1.10 DESC 'Certificate Pair' "
630 X_BINARY X_NOT_H_R ")",
631 SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, berValidate, NULL, NULL},
632 {"( 1.3.6.1.4.1.1466.115.121.1.11 DESC 'Country String' )",
633 0, NULL, NULL, NULL},
634 {"( 1.3.6.1.4.1.1466.115.121.1.12 DESC 'DN' )",
635 0, blobValidate, NULL, NULL},
636 {"( 1.3.6.1.4.1.1466.115.121.1.13 DESC 'Data Quality' )",
637 0, NULL, NULL, NULL},
638 {"( 1.3.6.1.4.1.1466.115.121.1.14 DESC 'Delivery Method' )",
639 0, NULL, NULL, NULL},
640 {"( 1.3.6.1.4.1.1466.115.121.1.15 DESC 'Directory String' )",
641 0, UTF8StringValidate, UTF8StringNormalize, NULL},
642 {"( 1.3.6.1.4.1.1466.115.121.1.16 DESC 'DIT Content Rule Description' )",
643 0, NULL, NULL, NULL},
644 {"( 1.3.6.1.4.1.1466.115.121.1.17 DESC 'DIT Structure Rule Description' )",
645 0, NULL, NULL, NULL},
646 {"( 1.3.6.1.4.1.1466.115.121.1.19 DESC 'DSA Quality' )",
647 0, NULL, NULL, NULL},
648 {"( 1.3.6.1.4.1.1466.115.121.1.20 DESC 'DSE Type' )",
649 0, NULL, NULL, NULL},
650 {"( 1.3.6.1.4.1.1466.115.121.1.21 DESC 'Enhanced Guide' )",
651 0, NULL, NULL, NULL},
652 {"( 1.3.6.1.4.1.1466.115.121.1.22 DESC 'Facsimile Telephone Number' )",
653 0, blobValidate, NULL, NULL},
654 {"( 1.3.6.1.4.1.1466.115.121.1.23 DESC 'Fax' " X_NOT_H_R ")",
655 SLAP_SYNTAX_BLOB, NULL, NULL, NULL},
656 {"( 1.3.6.1.4.1.1466.115.121.1.24 DESC 'Generalized Time' )",
657 0, NULL, NULL, NULL},
658 {"( 1.3.6.1.4.1.1466.115.121.1.25 DESC 'Guide' )",
659 0, NULL, NULL, NULL},
660 {"( 1.3.6.1.4.1.1466.115.121.1.26 DESC 'IA5 String' )",
661 0, IA5StringValidate, IA5StringNormalize, NULL},
662 {"( 1.3.6.1.4.1.1466.115.121.1.27 DESC 'Integer' )",
663 0, integerValidate, NULL, NULL},
664 {"( 1.3.6.1.4.1.1466.115.121.1.28 DESC 'JPEG' " X_NOT_H_R ")",
665 SLAP_SYNTAX_BLOB, NULL, NULL, NULL},
666 {"( 1.3.6.1.4.1.1466.115.121.1.29 DESC 'Master And Shadow Access Points' )",
667 0, NULL, NULL, NULL},
668 {"( 1.3.6.1.4.1.1466.115.121.1.30 DESC 'Matching Rule Description' )",
669 0, NULL, NULL, NULL},
670 {"( 1.3.6.1.4.1.1466.115.121.1.31 DESC 'Matching Rule Use Description' )",
671 0, NULL, NULL, NULL},
672 {"( 1.3.6.1.4.1.1466.115.121.1.32 DESC 'Mail Preference' )",
673 0, NULL, NULL, NULL},
674 {"( 1.3.6.1.4.1.1466.115.121.1.33 DESC 'MHS OR Address' )",
675 0, NULL, NULL, NULL},
676 {"( 1.3.6.1.4.1.1466.115.121.1.34 DESC 'Name And Optional UID' )",
677 0, NULL, NULL, NULL},
678 {"( 1.3.6.1.4.1.1466.115.121.1.35 DESC 'Name Form Description' )",
679 0, NULL, NULL, NULL},
680 {"( 1.3.6.1.4.1.1466.115.121.1.36 DESC 'Numeric String' )",
681 0, NULL, NULL, NULL},
682 {"( 1.3.6.1.4.1.1466.115.121.1.37 DESC 'Object Class Description' )",
683 0, NULL, NULL, NULL},
684 {"( 1.3.6.1.4.1.1466.115.121.1.38 DESC 'OID' )",
685 0, oidValidate, NULL, NULL},
686 {"( 1.3.6.1.4.1.1466.115.121.1.39 DESC 'Other Mailbox' )",
687 0, NULL, NULL, NULL},
688 {"( 1.3.6.1.4.1.1466.115.121.1.40 DESC 'Octet String' )",
689 0, blobValidate, NULL, NULL},
690 {"( 1.3.6.1.4.1.1466.115.121.1.41 DESC 'Postal Address' )",
691 0, blobValidate, NULL, NULL},
692 {"( 1.3.6.1.4.1.1466.115.121.1.42 DESC 'Protocol Information' )",
693 0, NULL, NULL, NULL},
694 {"( 1.3.6.1.4.1.1466.115.121.1.43 DESC 'Presentation Address' )",
695 0, NULL, NULL, NULL},
696 {"( 1.3.6.1.4.1.1466.115.121.1.44 DESC 'Printable String' )",
697 0, printableStringValidate, NULL, NULL},
698 {"( 1.3.6.1.4.1.1466.115.121.1.49 DESC 'Supported Algorithm' "
699 X_BINARY X_NOT_H_R ")",
700 SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, berValidate, NULL, NULL},
701 {"( 1.3.6.1.4.1.1466.115.121.1.50 DESC 'Telephone Number' )",
702 0, blobValidate, NULL, NULL},
703 {"( 1.3.6.1.4.1.1466.115.121.1.51 DESC 'Teletex Terminal Identifier' )",
704 0, NULL, NULL, NULL},
705 {"( 1.3.6.1.4.1.1466.115.121.1.52 DESC 'Telex Number' )",
706 0, NULL, NULL, NULL},
707 {"( 1.3.6.1.4.1.1466.115.121.1.53 DESC 'UTC Time' )",
708 0, NULL, NULL, NULL},
709 {"( 1.3.6.1.4.1.1466.115.121.1.54 DESC 'LDAP Syntax Description' )",
710 0, NULL, NULL, NULL},
711 {"( 1.3.6.1.4.1.1466.115.121.1.55 DESC 'Modify Rights' )",
712 0, NULL, NULL, NULL},
713 {"( 1.3.6.1.4.1.1466.115.121.1.56 DESC 'LDAP Schema Definition' )",
714 0, NULL, NULL, NULL},
715 {"( 1.3.6.1.4.1.1466.115.121.1.57 DESC 'LDAP Schema Description' )",
716 0, NULL, NULL, NULL},
717 {"( 1.3.6.1.4.1.1466.115.121.1.58 DESC 'Substring Assertion' )",
718 0, NULL, NULL, NULL},
720 /* OpenLDAP Experimental Syntaxes */
721 {"( 1.3.6.1.4.1.4203.666.2.1 DESC 'OpenLDAP Experimental ACI' )",
722 0, NULL, NULL, NULL},
723 {"( 1.3.6.1.4.1.4203.666.2.2 DESC 'OpenLDAP void' " X_HIDE ")" ,
724 SLAP_SYNTAX_HIDE, NULL, NULL, NULL},
725 {"( 1.3.6.1.4.1.4203.666.2.3 DESC 'OpenLDAP DN' " X_HIDE ")" ,
726 SLAP_SYNTAX_HIDE, NULL, NULL, NULL},
728 {NULL, 0, NULL, NULL, NULL}
731 struct mrule_defs_rec {
734 slap_mr_convert_func * mrd_convert;
735 slap_mr_normalize_func * mrd_normalize;
736 slap_mr_match_func * mrd_match;
737 slap_mr_indexer_func * mrd_indexer;
738 slap_mr_filter_func * mrd_filter;
742 * Other matching rules in X.520 that we do not use:
744 * 2.5.13.9 numericStringOrderingMatch
745 * 2.5.13.13 booleanMatch
746 * 2.5.13.15 integerOrderingMatch
747 * 2.5.13.18 octetStringOrderingMatch
748 * 2.5.13.19 octetStringSubstringsMatch
749 * 2.5.13.25 uTCTimeMatch
750 * 2.5.13.26 uTCTimeOrderingMatch
751 * 2.5.13.31 directoryStringFirstComponentMatch
752 * 2.5.13.32 wordMatch
753 * 2.5.13.33 keywordMatch
754 * 2.5.13.34 certificateExactMatch
755 * 2.5.13.35 certificateMatch
756 * 2.5.13.36 certificatePairExactMatch
757 * 2.5.13.37 certificatePairMatch
758 * 2.5.13.38 certificateListExactMatch
759 * 2.5.13.39 certificateListMatch
760 * 2.5.13.40 algorithmIdentifierMatch
761 * 2.5.13.41 storedPrefixMatch
762 * 2.5.13.42 attributeCertificateMatch
763 * 2.5.13.43 readerAndKeyIDMatch
764 * 2.5.13.44 attributeIntegrityMatch
767 #ifndef SLAPD_SCHEMA_NOT_COMPAT
768 #define caseIgnoreIA5SubstringsMatch NULL
769 #define caseExactIA5SubstringsMatch NULL
772 /* recycled matching functions */
773 #define caseIgnoreMatch caseIgnoreIA5Match
774 #define caseIgnoreOrderingMatch caseIgnoreMatch
775 #define caseIgnoreSubstringsMatch caseIgnoreIA5SubstringsMatch
776 #define caseExactMatch caseExactIA5Match
777 #define caseExactOrderingMatch caseExactMatch
778 #define caseExactSubstringsMatch caseExactIA5SubstringsMatch
780 /* unimplemented matching functions */
781 #define objectIdentifierMatch NULL
782 #define distinguishedNameMatch NULL
783 #define numericStringMatch NULL
784 #define numericStringSubstringsMatch NULL
785 #define caseIgnoreListMatch NULL
786 #define caseIgnoreListSubstringsMatch NULL
787 #define integerMatch NULL
788 #define bitStringMatch NULL
789 #define octetStringMatch NULL
790 #define telephoneNumberMatch NULL
791 #define telephoneNumberSubstringsMatch NULL
792 #define presentationAddressMatch NULL
793 #define uniqueMemberMatch NULL
794 #define protocolInformationMatch NULL
795 #define generalizedTimeMatch NULL
796 #define generalizedTimeOrderingMatch NULL
797 #define integerFirstComponentMatch NULL
798 #define objectIdentifierFirstComponentMatch NULL
800 struct mrule_defs_rec mrule_defs[] = {
801 {"( 2.5.13.0 NAME 'objectIdentifierMatch' "
802 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
803 SLAP_MR_EQUALITY | SLAP_MR_EXT,
804 NULL, NULL, objectIdentifierMatch, NULL, NULL},
806 {"( 2.5.13.1 NAME 'distinguishedNameMatch' "
807 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )",
808 SLAP_MR_EQUALITY | SLAP_MR_EXT,
809 NULL, NULL, distinguishedNameMatch, NULL, NULL},
811 {"( 2.5.13.2 NAME 'caseIgnoreMatch' "
812 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
813 SLAP_MR_EQUALITY | SLAP_MR_EXT,
814 NULL, NULL, caseIgnoreMatch, NULL, NULL},
816 {"( 2.5.13.3 NAME 'caseIgnoreOrderingMatch' "
817 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
819 NULL, NULL, caseIgnoreOrderingMatch, NULL, NULL},
821 {"( 2.5.13.4 NAME 'caseIgnoreSubstringsMatch' "
822 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
823 SLAP_MR_SUBSTR | SLAP_MR_EXT,
824 NULL, NULL, caseIgnoreSubstringsMatch, NULL, NULL},
826 /* Next three are not in the RFC's, but are needed for compatibility */
827 {"( 2.5.13.5 NAME 'caseExactMatch' "
828 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
829 SLAP_MR_EQUALITY | SLAP_MR_EXT,
830 NULL, NULL, caseExactMatch, NULL, NULL},
832 {"( 2.5.13.6 NAME 'caseExactOrderingMatch' "
833 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
835 NULL, NULL, caseExactOrderingMatch, NULL, NULL},
837 {"( 2.5.13.7 NAME 'caseExactSubstringsMatch' "
838 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
839 SLAP_MR_SUBSTR | SLAP_MR_EXT,
840 NULL, NULL, caseExactSubstringsMatch, NULL, NULL},
842 {"( 2.5.13.8 NAME 'numericStringMatch' "
843 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 )",
844 SLAP_MR_EQUALITY | SLAP_MR_EXT,
845 NULL, NULL, numericStringMatch, NULL, NULL},
847 {"( 2.5.13.10 NAME 'numericStringSubstringsMatch' "
848 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
849 SLAP_MR_SUBSTR | SLAP_MR_EXT,
850 NULL, NULL, numericStringSubstringsMatch, NULL, NULL},
852 {"( 2.5.13.11 NAME 'caseIgnoreListMatch' "
853 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )",
854 SLAP_MR_EQUALITY | SLAP_MR_EXT,
855 NULL, NULL, caseIgnoreListMatch, NULL, NULL},
857 {"( 2.5.13.12 NAME 'caseIgnoreListSubstringsMatch' "
858 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
859 SLAP_MR_SUBSTR | SLAP_MR_EXT,
860 NULL, NULL, caseIgnoreListSubstringsMatch, NULL, NULL},
862 {"( 2.5.13.14 NAME 'integerMatch' "
863 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )",
864 SLAP_MR_NONE | SLAP_MR_EXT,
865 NULL, NULL, integerMatch, NULL, NULL},
867 {"( 2.5.13.16 NAME 'bitStringMatch' "
868 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.6 )",
869 SLAP_MR_NONE | SLAP_MR_EXT,
870 NULL, NULL, bitStringMatch, NULL, NULL},
872 {"( 2.5.13.17 NAME 'octetStringMatch' "
873 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )",
874 SLAP_MR_EQUALITY | SLAP_MR_EXT,
875 NULL, NULL, octetStringMatch, NULL, NULL},
877 {"( 2.5.13.20 NAME 'telephoneNumberMatch' "
878 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )",
879 SLAP_MR_EQUALITY | SLAP_MR_EXT,
880 NULL, NULL, telephoneNumberMatch, NULL, NULL},
882 {"( 2.5.13.21 NAME 'telephoneNumberSubstringsMatch' "
883 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
884 SLAP_MR_SUBSTR | SLAP_MR_EXT,
885 NULL, NULL, telephoneNumberSubstringsMatch, NULL, NULL},
887 {"( 2.5.13.22 NAME 'presentationAddressMatch' "
888 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.43 )",
889 SLAP_MR_NONE | SLAP_MR_EXT,
890 NULL, NULL, presentationAddressMatch, NULL, NULL},
892 {"( 2.5.13.23 NAME 'uniqueMemberMatch' "
893 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.34 )",
894 SLAP_MR_NONE | SLAP_MR_EXT,
895 NULL, NULL, uniqueMemberMatch, NULL, NULL},
897 {"( 2.5.13.24 NAME 'protocolInformationMatch' "
898 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.42 )",
899 SLAP_MR_NONE | SLAP_MR_EXT,
900 NULL, NULL, protocolInformationMatch, NULL, NULL},
902 {"( 2.5.13.27 NAME 'generalizedTimeMatch' "
903 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )",
904 SLAP_MR_EQUALITY | SLAP_MR_EXT,
905 NULL, NULL, generalizedTimeMatch, NULL, NULL},
907 {"( 2.5.13.28 NAME 'generalizedTimeOrderingMatch' "
908 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )",
910 NULL, NULL, generalizedTimeOrderingMatch, NULL, NULL},
912 {"( 2.5.13.29 NAME 'integerFirstComponentMatch' "
913 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )",
914 SLAP_MR_EQUALITY | SLAP_MR_EXT,
915 NULL, NULL, integerFirstComponentMatch, NULL, NULL},
917 {"( 2.5.13.30 NAME 'objectIdentifierFirstComponentMatch' "
918 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
919 SLAP_MR_EQUALITY | SLAP_MR_EXT,
920 NULL, NULL, objectIdentifierFirstComponentMatch, NULL, NULL},
922 {"( 1.3.6.1.4.1.1466.109.114.1 NAME 'caseExactIA5Match' "
923 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )",
924 SLAP_MR_EQUALITY | SLAP_MR_EXT,
925 NULL, NULL, caseExactIA5Match, NULL, NULL},
927 {"( 1.3.6.1.4.1.1466.109.114.2 NAME 'caseIgnoreIA5Match' "
928 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )",
929 SLAP_MR_EQUALITY | SLAP_MR_EXT,
930 NULL, NULL, caseIgnoreIA5Match, NULL, NULL},
932 {"( 1.3.6.1.4.1.1466.109.114.3 NAME 'caseIgnoreIA5SubstringsMatch' "
933 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )",
935 NULL, NULL, caseIgnoreIA5SubstringsMatch, NULL, NULL},
937 {NULL, SLAP_MR_NONE, NULL, NULL, NULL}
946 /* we should only be called once (from main) */
947 assert( schema_init_done == 0 );
949 for ( i=0; syntax_defs[i].sd_desc != NULL; i++ ) {
950 res = register_syntax( syntax_defs[i].sd_desc,
951 syntax_defs[i].sd_flags,
952 syntax_defs[i].sd_validate,
953 syntax_defs[i].sd_normalize,
954 syntax_defs[i].sd_pretty
955 #ifdef SLAPD_BINARY_CONVERSION
957 syntax_defs[i].sd_ber2str,
958 syntax_defs[i].sd_str2ber
963 fprintf( stderr, "schema_init: Error registering syntax %s\n",
964 syntax_defs[i].sd_desc );
969 for ( i=0; mrule_defs[i].mrd_desc != NULL; i++ ) {
970 if( mrule_defs[i].mrd_usage == SLAP_MR_NONE ) {
972 "schema_init: Ingoring unusable matching rule %s\n",
973 mrule_defs[i].mrd_desc );
977 res = register_matching_rule(
978 mrule_defs[i].mrd_desc,
979 mrule_defs[i].mrd_usage,
980 mrule_defs[i].mrd_convert,
981 mrule_defs[i].mrd_normalize,
982 mrule_defs[i].mrd_match,
983 mrule_defs[i].mrd_indexer,
984 mrule_defs[i].mrd_filter );
988 "schema_init: Error registering matching rule %s\n",
989 mrule_defs[i].mrd_desc );
993 schema_init_done = 1;