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;
373 if( sub->sa_final ) {
374 match = strncmp( sub->sa_final->bv_val,
375 &left.bv_val[left.bv_len - sub->sa_final->bv_len],
376 sub->sa_final->bv_len );
382 left.bv_len -= sub->sa_final->bv_len;
401 struct berval *value,
402 void *assertedValue )
404 *match = strcasecmp( value->bv_val,
405 ((struct berval *) assertedValue)->bv_val );
409 #ifdef SLAPD_SCHEMA_NOT_COMPAT
411 caseIgnoreIA5SubstringsMatch(
416 struct berval *value,
417 void *assertedValue )
420 SubstringsAssertion *sub = assertedValue;
421 struct berval left = *value;
425 if( sub->sa_initial ) {
426 inlen += sub->sa_initial->bv_len;
429 for(i=0; sub->sa_any[i]; i++) {
430 inlen += sub->sa_final->bv_len;
433 if( sub->sa_final ) {
434 inlen += sub->sa_final->bv_len;
437 if( inlen > value->bv_len ) {
442 if( sub->sa_initial ) {
443 match = strncasecmp( sub->sa_initial->bv_val, left.bv_val,
444 sub->sa_initial->bv_len );
450 left.bv_val += sub->sa_initial->bv_len;
451 left.bv_len -= sub->sa_initial->bv_len;
454 if( sub->sa_final ) {
455 match = strncasecmp( sub->sa_final->bv_val,
456 &left.bv_val[left.bv_len - sub->sa_final->bv_len],
457 sub->sa_final->bv_len );
463 left.bv_len -= sub->sa_final->bv_len;
476 struct syntax_defs_rec {
479 slap_syntax_validate_func *sd_validate;
480 slap_syntax_transform_func *sd_normalize;
481 slap_syntax_transform_func *sd_pretty;
482 #ifdef SLAPD_BINARY_CONVERSION
483 slap_syntax_transform_func *sd_ber2str;
484 slap_syntax_transform_func *sd_str2ber;
488 #define X_HIDE "X-HIDE 'TRUE' "
489 #define X_BINARY "X-BINARY-TRANSFER-REQUIRED 'TRUE' "
490 #define X_NOT_H_R "X-NOT-HUMAN-READABLE 'TRUE' "
492 struct syntax_defs_rec syntax_defs[] = {
493 {"( 1.3.6.1.4.1.1466.115.121.1.1 DESC 'ACI Item' " X_BINARY X_NOT_H_R ")",
494 SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, NULL, NULL, NULL},
495 {"( 1.3.6.1.4.1.1466.115.121.1.2 DESC 'Access Point' " X_NOT_H_R ")",
496 0, NULL, NULL, NULL},
497 {"( 1.3.6.1.4.1.1466.115.121.1.3 DESC 'Attribute Type Description' )",
498 0, NULL, NULL, NULL},
499 {"( 1.3.6.1.4.1.1466.115.121.1.4 DESC 'Audio' " X_NOT_H_R ")",
500 SLAP_SYNTAX_BLOB, blobValidate, NULL, NULL},
501 {"( 1.3.6.1.4.1.1466.115.121.1.5 DESC 'Binary' " X_BINARY X_NOT_H_R ")",
502 SLAP_SYNTAX_BER, berValidate, NULL, NULL},
503 {"( 1.3.6.1.4.1.1466.115.121.1.6 DESC 'Bit String' )",
504 0, NULL, NULL, NULL},
505 {"( 1.3.6.1.4.1.1466.115.121.1.7 DESC 'Boolean' )",
506 0, NULL, NULL, NULL},
507 {"( 1.3.6.1.4.1.1466.115.121.1.8 DESC 'Certificate' "
508 X_BINARY X_NOT_H_R ")",
509 SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, berValidate, NULL, NULL},
510 {"( 1.3.6.1.4.1.1466.115.121.1.9 DESC 'Certificate List' "
511 X_BINARY X_NOT_H_R ")",
512 SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, berValidate, NULL, NULL},
513 {"( 1.3.6.1.4.1.1466.115.121.1.10 DESC 'Certificate Pair' "
514 X_BINARY X_NOT_H_R ")",
515 SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, berValidate, NULL, NULL},
516 {"( 1.3.6.1.4.1.1466.115.121.1.11 DESC 'Country String' )",
517 0, NULL, NULL, NULL},
518 {"( 1.3.6.1.4.1.1466.115.121.1.12 DESC 'DN' )",
519 0, blobValidate, NULL, NULL},
520 {"( 1.3.6.1.4.1.1466.115.121.1.13 DESC 'Data Quality' )",
521 0, NULL, NULL, NULL},
522 {"( 1.3.6.1.4.1.1466.115.121.1.14 DESC 'Delivery Method' )",
523 0, NULL, NULL, NULL},
524 {"( 1.3.6.1.4.1.1466.115.121.1.15 DESC 'Directory String' )",
525 0, UTF8StringValidate, UTF8StringNormalize, NULL},
526 {"( 1.3.6.1.4.1.1466.115.121.1.16 DESC 'DIT Content Rule Description' )",
527 0, NULL, NULL, NULL},
528 {"( 1.3.6.1.4.1.1466.115.121.1.17 DESC 'DIT Structure Rule Description' )",
529 0, NULL, NULL, NULL},
530 {"( 1.3.6.1.4.1.1466.115.121.1.19 DESC 'DSA Quality' )",
531 0, NULL, NULL, NULL},
532 {"( 1.3.6.1.4.1.1466.115.121.1.20 DESC 'DSE Type' )",
533 0, NULL, NULL, NULL},
534 {"( 1.3.6.1.4.1.1466.115.121.1.21 DESC 'Enhanced Guide' )",
535 0, NULL, NULL, NULL},
536 {"( 1.3.6.1.4.1.1466.115.121.1.22 DESC 'Facsimile Telephone Number' )",
537 0, blobValidate, NULL, NULL},
538 {"( 1.3.6.1.4.1.1466.115.121.1.23 DESC 'Fax' " X_NOT_H_R ")",
539 SLAP_SYNTAX_BLOB, NULL, NULL, NULL},
540 {"( 1.3.6.1.4.1.1466.115.121.1.24 DESC 'Generalized Time' )",
541 0, NULL, NULL, NULL},
542 {"( 1.3.6.1.4.1.1466.115.121.1.25 DESC 'Guide' )",
543 0, NULL, NULL, NULL},
544 {"( 1.3.6.1.4.1.1466.115.121.1.26 DESC 'IA5 String' )",
545 0, IA5StringValidate, IA5StringNormalize, NULL},
546 {"( 1.3.6.1.4.1.1466.115.121.1.27 DESC 'Integer' )",
547 0, integerValidate, NULL, NULL},
548 {"( 1.3.6.1.4.1.1466.115.121.1.28 DESC 'JPEG' " X_NOT_H_R ")",
549 SLAP_SYNTAX_BLOB, NULL, NULL, NULL},
550 {"( 1.3.6.1.4.1.1466.115.121.1.29 DESC 'Master And Shadow Access Points' )",
551 0, NULL, NULL, NULL},
552 {"( 1.3.6.1.4.1.1466.115.121.1.30 DESC 'Matching Rule Description' )",
553 0, NULL, NULL, NULL},
554 {"( 1.3.6.1.4.1.1466.115.121.1.31 DESC 'Matching Rule Use Description' )",
555 0, NULL, NULL, NULL},
556 {"( 1.3.6.1.4.1.1466.115.121.1.32 DESC 'Mail Preference' )",
557 0, NULL, NULL, NULL},
558 {"( 1.3.6.1.4.1.1466.115.121.1.33 DESC 'MHS OR Address' )",
559 0, NULL, NULL, NULL},
560 {"( 1.3.6.1.4.1.1466.115.121.1.34 DESC 'Name And Optional UID' )",
561 0, NULL, NULL, NULL},
562 {"( 1.3.6.1.4.1.1466.115.121.1.35 DESC 'Name Form Description' )",
563 0, NULL, NULL, NULL},
564 {"( 1.3.6.1.4.1.1466.115.121.1.36 DESC 'Numeric String' )",
565 0, NULL, NULL, NULL},
566 {"( 1.3.6.1.4.1.1466.115.121.1.37 DESC 'Object Class Description' )",
567 0, NULL, NULL, NULL},
568 {"( 1.3.6.1.4.1.1466.115.121.1.38 DESC 'OID' )",
569 0, oidValidate, NULL, NULL},
570 {"( 1.3.6.1.4.1.1466.115.121.1.39 DESC 'Other Mailbox' )",
571 0, NULL, NULL, NULL},
572 {"( 1.3.6.1.4.1.1466.115.121.1.40 DESC 'Octet String' )",
573 0, blobValidate, NULL, NULL},
574 {"( 1.3.6.1.4.1.1466.115.121.1.41 DESC 'Postal Address' )",
575 0, blobValidate, NULL, NULL},
576 {"( 1.3.6.1.4.1.1466.115.121.1.42 DESC 'Protocol Information' )",
577 0, NULL, NULL, NULL},
578 {"( 1.3.6.1.4.1.1466.115.121.1.43 DESC 'Presentation Address' )",
579 0, NULL, NULL, NULL},
580 {"( 1.3.6.1.4.1.1466.115.121.1.44 DESC 'Printable String' )",
581 0, printableStringValidate, NULL, NULL},
582 {"( 1.3.6.1.4.1.1466.115.121.1.49 DESC 'Supported Algorithm' "
583 X_BINARY X_NOT_H_R ")",
584 SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, berValidate, NULL, NULL},
585 {"( 1.3.6.1.4.1.1466.115.121.1.50 DESC 'Telephone Number' )",
586 0, blobValidate, NULL, NULL},
587 {"( 1.3.6.1.4.1.1466.115.121.1.51 DESC 'Teletex Terminal Identifier' )",
588 0, NULL, NULL, NULL},
589 {"( 1.3.6.1.4.1.1466.115.121.1.52 DESC 'Telex Number' )",
590 0, NULL, NULL, NULL},
591 {"( 1.3.6.1.4.1.1466.115.121.1.53 DESC 'UTC Time' )",
592 0, NULL, NULL, NULL},
593 {"( 1.3.6.1.4.1.1466.115.121.1.54 DESC 'LDAP Syntax Description' )",
594 0, NULL, NULL, NULL},
595 {"( 1.3.6.1.4.1.1466.115.121.1.55 DESC 'Modify Rights' )",
596 0, NULL, NULL, NULL},
597 {"( 1.3.6.1.4.1.1466.115.121.1.56 DESC 'LDAP Schema Definition' )",
598 0, NULL, NULL, NULL},
599 {"( 1.3.6.1.4.1.1466.115.121.1.57 DESC 'LDAP Schema Description' )",
600 0, NULL, NULL, NULL},
601 {"( 1.3.6.1.4.1.1466.115.121.1.58 DESC 'Substring Assertion' )",
602 0, NULL, NULL, NULL},
604 /* OpenLDAP Experimental Syntaxes */
605 {"( 1.3.6.1.4.1.4203.666.2.1 DESC 'OpenLDAP Experimental ACI' )",
606 0, NULL, NULL, NULL},
607 {"( 1.3.6.1.4.1.4203.666.2.2 DESC 'OpenLDAP void' " X_HIDE ")" ,
608 SLAP_SYNTAX_HIDE, NULL, NULL, NULL},
609 {"( 1.3.6.1.4.1.4203.666.2.3 DESC 'OpenLDAP DN' " X_HIDE ")" ,
610 SLAP_SYNTAX_HIDE, NULL, NULL, NULL},
612 {NULL, 0, NULL, NULL, NULL}
615 struct mrule_defs_rec {
618 slap_mr_convert_func * mrd_convert;
619 slap_mr_normalize_func * mrd_normalize;
620 slap_mr_match_func * mrd_match;
621 slap_mr_indexer_func * mrd_indexer;
622 slap_mr_filter_func * mrd_filter;
626 * Other matching rules in X.520 that we do not use:
628 * 2.5.13.9 numericStringOrderingMatch
629 * 2.5.13.13 booleanMatch
630 * 2.5.13.15 integerOrderingMatch
631 * 2.5.13.18 octetStringOrderingMatch
632 * 2.5.13.19 octetStringSubstringsMatch
633 * 2.5.13.25 uTCTimeMatch
634 * 2.5.13.26 uTCTimeOrderingMatch
635 * 2.5.13.31 directoryStringFirstComponentMatch
636 * 2.5.13.32 wordMatch
637 * 2.5.13.33 keywordMatch
638 * 2.5.13.34 certificateExactMatch
639 * 2.5.13.35 certificateMatch
640 * 2.5.13.36 certificatePairExactMatch
641 * 2.5.13.37 certificatePairMatch
642 * 2.5.13.38 certificateListExactMatch
643 * 2.5.13.39 certificateListMatch
644 * 2.5.13.40 algorithmIdentifierMatch
645 * 2.5.13.41 storedPrefixMatch
646 * 2.5.13.42 attributeCertificateMatch
647 * 2.5.13.43 readerAndKeyIDMatch
648 * 2.5.13.44 attributeIntegrityMatch
651 #ifndef SLAPD_SCHEMA_NOT_COMPAT
652 #define caseIgnoreIA5SubstringsMatch NULL
653 #define caseExactIA5SubstringsMatch NULL
656 /* recycled matching functions */
657 #define caseIgnoreMatch caseIgnoreIA5Match
658 #define caseIgnoreOrderingMatch caseIgnoreMatch
659 #define caseIgnoreSubstringsMatch caseIgnoreIA5SubstringsMatch
660 #define caseExactMatch caseExactIA5Match
661 #define caseExactOrderingMatch caseExactMatch
662 #define caseExactSubstringsMatch caseExactIA5SubstringsMatch
664 /* unimplemented matching functions */
665 #define objectIdentifierMatch NULL
666 #define distinguishedNameMatch NULL
667 #define numericStringMatch NULL
668 #define numericStringSubstringsMatch NULL
669 #define caseIgnoreListMatch NULL
670 #define caseIgnoreListSubstringsMatch NULL
671 #define integerMatch NULL
672 #define bitStringMatch NULL
673 #define octetStringMatch NULL
674 #define telephoneNumberMatch NULL
675 #define telephoneNumberSubstringsMatch NULL
676 #define presentationAddressMatch NULL
677 #define uniqueMemberMatch NULL
678 #define protocolInformationMatch NULL
679 #define generalizedTimeMatch NULL
680 #define generalizedTimeOrderingMatch NULL
681 #define integerFirstComponentMatch NULL
682 #define objectIdentifierFirstComponentMatch NULL
684 struct mrule_defs_rec mrule_defs[] = {
685 {"( 2.5.13.0 NAME 'objectIdentifierMatch' "
686 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
687 SLAP_MR_EQUALITY | SLAP_MR_EXT,
688 NULL, NULL, objectIdentifierMatch, NULL, NULL},
690 {"( 2.5.13.1 NAME 'distinguishedNameMatch' "
691 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )",
692 SLAP_MR_EQUALITY | SLAP_MR_EXT,
693 NULL, NULL, distinguishedNameMatch, NULL, NULL},
695 {"( 2.5.13.2 NAME 'caseIgnoreMatch' "
696 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
697 SLAP_MR_EQUALITY | SLAP_MR_EXT,
698 NULL, NULL, caseIgnoreMatch, NULL, NULL},
700 {"( 2.5.13.3 NAME 'caseIgnoreOrderingMatch' "
701 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
703 NULL, NULL, caseIgnoreOrderingMatch, NULL, NULL},
705 {"( 2.5.13.4 NAME 'caseIgnoreSubstringsMatch' "
706 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
707 SLAP_MR_SUBSTR | SLAP_MR_EXT,
708 NULL, NULL, caseIgnoreSubstringsMatch, NULL, NULL},
710 /* Next three are not in the RFC's, but are needed for compatibility */
711 {"( 2.5.13.5 NAME 'caseExactMatch' "
712 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
713 SLAP_MR_EQUALITY | SLAP_MR_EXT,
714 NULL, NULL, caseExactMatch, NULL, NULL},
716 {"( 2.5.13.6 NAME 'caseExactOrderingMatch' "
717 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
719 NULL, NULL, caseExactOrderingMatch, NULL, NULL},
721 {"( 2.5.13.7 NAME 'caseExactSubstringsMatch' "
722 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
723 SLAP_MR_SUBSTR | SLAP_MR_EXT,
724 NULL, NULL, caseExactSubstringsMatch, NULL, NULL},
726 {"( 2.5.13.8 NAME 'numericStringMatch' "
727 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 )",
728 SLAP_MR_EQUALITY | SLAP_MR_EXT,
729 NULL, NULL, numericStringMatch, NULL, NULL},
731 {"( 2.5.13.10 NAME 'numericStringSubstringsMatch' "
732 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
733 SLAP_MR_SUBSTR | SLAP_MR_EXT,
734 NULL, NULL, numericStringSubstringsMatch, NULL, NULL},
736 {"( 2.5.13.11 NAME 'caseIgnoreListMatch' "
737 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )",
738 SLAP_MR_EQUALITY | SLAP_MR_EXT,
739 NULL, NULL, caseIgnoreListMatch, NULL, NULL},
741 {"( 2.5.13.12 NAME 'caseIgnoreListSubstringsMatch' "
742 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
743 SLAP_MR_SUBSTR | SLAP_MR_EXT,
744 NULL, NULL, caseIgnoreListSubstringsMatch, NULL, NULL},
746 {"( 2.5.13.14 NAME 'integerMatch' "
747 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )",
748 SLAP_MR_NONE | SLAP_MR_EXT,
749 NULL, NULL, integerMatch, NULL, NULL},
751 {"( 2.5.13.16 NAME 'bitStringMatch' "
752 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.6 )",
753 SLAP_MR_NONE | SLAP_MR_EXT,
754 NULL, NULL, bitStringMatch, NULL, NULL},
756 {"( 2.5.13.17 NAME 'octetStringMatch' "
757 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )",
758 SLAP_MR_EQUALITY | SLAP_MR_EXT,
759 NULL, NULL, octetStringMatch, NULL, NULL},
761 {"( 2.5.13.20 NAME 'telephoneNumberMatch' "
762 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )",
763 SLAP_MR_EQUALITY | SLAP_MR_EXT,
764 NULL, NULL, telephoneNumberMatch, NULL, NULL},
766 {"( 2.5.13.21 NAME 'telephoneNumberSubstringsMatch' "
767 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
768 SLAP_MR_SUBSTR | SLAP_MR_EXT,
769 NULL, NULL, telephoneNumberSubstringsMatch, NULL, NULL},
771 {"( 2.5.13.22 NAME 'presentationAddressMatch' "
772 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.43 )",
773 SLAP_MR_NONE | SLAP_MR_EXT,
774 NULL, NULL, presentationAddressMatch, NULL, NULL},
776 {"( 2.5.13.23 NAME 'uniqueMemberMatch' "
777 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.34 )",
778 SLAP_MR_NONE | SLAP_MR_EXT,
779 NULL, NULL, uniqueMemberMatch, NULL, NULL},
781 {"( 2.5.13.24 NAME 'protocolInformationMatch' "
782 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.42 )",
783 SLAP_MR_NONE | SLAP_MR_EXT,
784 NULL, NULL, protocolInformationMatch, NULL, NULL},
786 {"( 2.5.13.27 NAME 'generalizedTimeMatch' "
787 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )",
788 SLAP_MR_EQUALITY | SLAP_MR_EXT,
789 NULL, NULL, generalizedTimeMatch, NULL, NULL},
791 {"( 2.5.13.28 NAME 'generalizedTimeOrderingMatch' "
792 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )",
794 NULL, NULL, generalizedTimeOrderingMatch, NULL, NULL},
796 {"( 2.5.13.29 NAME 'integerFirstComponentMatch' "
797 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )",
798 SLAP_MR_EQUALITY | SLAP_MR_EXT,
799 NULL, NULL, integerFirstComponentMatch, NULL, NULL},
801 {"( 2.5.13.30 NAME 'objectIdentifierFirstComponentMatch' "
802 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
803 SLAP_MR_EQUALITY | SLAP_MR_EXT,
804 NULL, NULL, objectIdentifierFirstComponentMatch, NULL, NULL},
806 {"( 1.3.6.1.4.1.1466.109.114.1 NAME 'caseExactIA5Match' "
807 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )",
808 SLAP_MR_EQUALITY | SLAP_MR_EXT,
809 NULL, NULL, caseExactIA5Match, NULL, NULL},
811 {"( 1.3.6.1.4.1.1466.109.114.2 NAME 'caseIgnoreIA5Match' "
812 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )",
813 SLAP_MR_EQUALITY | SLAP_MR_EXT,
814 NULL, NULL, caseIgnoreIA5Match, NULL, NULL},
816 {"( 1.3.6.1.4.1.1466.109.114.3 NAME 'caseIgnoreIA5SubstringsMatch' "
817 "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )",
819 NULL, NULL, caseIgnoreIA5SubstringsMatch, NULL, NULL},
821 {NULL, SLAP_MR_NONE, NULL, NULL, NULL}
830 /* we should only be called once (from main) */
831 assert( schema_init_done == 0 );
833 for ( i=0; syntax_defs[i].sd_desc != NULL; i++ ) {
834 res = register_syntax( syntax_defs[i].sd_desc,
835 syntax_defs[i].sd_flags,
836 syntax_defs[i].sd_validate,
837 syntax_defs[i].sd_normalize,
838 syntax_defs[i].sd_pretty
839 #ifdef SLAPD_BINARY_CONVERSION
841 syntax_defs[i].sd_ber2str,
842 syntax_defs[i].sd_str2ber
847 fprintf( stderr, "schema_init: Error registering syntax %s\n",
848 syntax_defs[i].sd_desc );
853 for ( i=0; mrule_defs[i].mrd_desc != NULL; i++ ) {
854 if( mrule_defs[i].mrd_usage == SLAP_MR_NONE ) {
856 "schema_init: Ingoring unusable matching rule %s\n",
857 mrule_defs[i].mrd_desc );
861 res = register_matching_rule(
862 mrule_defs[i].mrd_desc,
863 mrule_defs[i].mrd_usage,
864 mrule_defs[i].mrd_convert,
865 mrule_defs[i].mrd_normalize,
866 mrule_defs[i].mrd_match,
867 mrule_defs[i].mrd_indexer,
868 mrule_defs[i].mrd_filter );
872 "schema_init: Error registering matching rule %s\n",
873 mrule_defs[i].mrd_desc );
877 schema_init_done = 1;