/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2005 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#define IA5StringApproxIndexer approxIndexer
#define IA5StringApproxFilter approxFilter
+/* Change Sequence Number (CSN) - much of this will change */
+#define csnValidate blobValidate
+#define csnMatch octetStringMatch
+#define csnOrderingMatch octetStringOrderingMatch
+#define csnIndexer generalizedTimeIndexer
+#define csnFilter generalizedTimeFilter
+
+unsigned int index_substr_if_minlen = SLAP_INDEX_SUBSTR_IF_MINLEN_DEFAULT;
+unsigned int index_substr_if_maxlen = SLAP_INDEX_SUBSTR_IF_MAXLEN_DEFAULT;
+unsigned int index_substr_any_len = SLAP_INDEX_SUBSTR_ANY_LEN_DEFAULT;
+unsigned int index_substr_any_step = SLAP_INDEX_SUBSTR_ANY_STEP_DEFAULT;
+
static int
inValidate(
Syntax *syntax,
for( i=0; values[i].bv_val != NULL; i++ ) {
/* count number of indices to generate */
if( flags & SLAP_INDEX_SUBSTR_INITIAL ) {
- if( values[i].bv_len >= SLAPD_GLOBAL(index_substr_if_maxlen) ) {
- nkeys += SLAPD_GLOBAL(index_substr_if_maxlen) -
- (SLAPD_GLOBAL(index_substr_if_minlen) - 1);
- } else if( values[i].bv_len >= SLAPD_GLOBAL(index_substr_if_minlen) ) {
- nkeys += values[i].bv_len - (SLAPD_GLOBAL(index_substr_if_minlen) - 1);
+ if( values[i].bv_len >= index_substr_if_maxlen ) {
+ nkeys += index_substr_if_maxlen -
+ (index_substr_if_minlen - 1);
+ } else if( values[i].bv_len >= index_substr_if_minlen ) {
+ nkeys += values[i].bv_len - (index_substr_if_minlen - 1);
}
}
if( flags & SLAP_INDEX_SUBSTR_ANY ) {
- if( values[i].bv_len >= SLAPD_GLOBAL(index_substr_any_len) ) {
- nkeys += values[i].bv_len - (SLAPD_GLOBAL(index_substr_any_len) - 1);
+ if( values[i].bv_len >= index_substr_any_len ) {
+ nkeys += values[i].bv_len - (index_substr_any_len - 1);
}
}
if( flags & SLAP_INDEX_SUBSTR_FINAL ) {
- if( values[i].bv_len >= SLAPD_GLOBAL(index_substr_if_maxlen) ) {
- nkeys += SLAPD_GLOBAL(index_substr_if_maxlen) -
- (SLAPD_GLOBAL(index_substr_if_minlen) - 1);
- } else if( values[i].bv_len >= SLAPD_GLOBAL(index_substr_if_minlen) ) {
- nkeys += values[i].bv_len - (SLAPD_GLOBAL(index_substr_if_minlen) - 1);
+ if( values[i].bv_len >= index_substr_if_maxlen ) {
+ nkeys += index_substr_if_maxlen -
+ (index_substr_if_minlen - 1);
+ } else if( values[i].bv_len >= index_substr_if_minlen ) {
+ nkeys += values[i].bv_len - (index_substr_if_minlen - 1);
}
}
}
ber_len_t j,max;
if( ( flags & SLAP_INDEX_SUBSTR_ANY ) &&
- ( values[i].bv_len >= SLAPD_GLOBAL(index_substr_any_len) ) )
+ ( values[i].bv_len >= index_substr_any_len ) )
{
char pre = SLAP_INDEX_SUBSTR_PREFIX;
- max = values[i].bv_len - (SLAPD_GLOBAL(index_substr_any_len) - 1);
+ max = values[i].bv_len - (index_substr_any_len - 1);
for( j=0; j<max; j++ ) {
hashDigestify( &HASHcontext, HASHdigest, prefix, pre,
- syntax, mr, (unsigned char *)&values[i].bv_val[j], SLAPD_GLOBAL(index_substr_any_len));
+ syntax, mr, (unsigned char *)&values[i].bv_val[j], index_substr_any_len);
ber_dupbv_x( &keys[nkeys++], &digest, ctx );
}
}
/* skip if too short */
- if( values[i].bv_len < SLAPD_GLOBAL(index_substr_if_minlen) ) continue;
+ if( values[i].bv_len < index_substr_if_minlen ) continue;
- max = SLAPD_GLOBAL(index_substr_if_maxlen) < values[i].bv_len
- ? SLAPD_GLOBAL(index_substr_if_maxlen) : values[i].bv_len;
+ max = index_substr_if_maxlen < values[i].bv_len
+ ? index_substr_if_maxlen : values[i].bv_len;
- for( j=SLAPD_GLOBAL(index_substr_if_minlen); j<=max; j++ ) {
+ for( j=index_substr_if_minlen; j<=max; j++ ) {
char pre;
if( flags & SLAP_INDEX_SUBSTR_INITIAL ) {
if( flags & SLAP_INDEX_SUBSTR_INITIAL &&
sa->sa_initial.bv_val != NULL &&
- sa->sa_initial.bv_len >= SLAPD_GLOBAL(index_substr_if_minlen) )
+ sa->sa_initial.bv_len >= index_substr_if_minlen )
{
nkeys++;
- if ( sa->sa_initial.bv_len > SLAPD_GLOBAL(index_substr_if_maxlen) &&
+ if ( sa->sa_initial.bv_len > index_substr_if_maxlen &&
( flags & SLAP_INDEX_SUBSTR_ANY ))
{
- nkeys += (sa->sa_initial.bv_len - SLAPD_GLOBAL(index_substr_if_maxlen)) / SLAPD_GLOBAL(index_substr_any_step);
+ nkeys += (sa->sa_initial.bv_len - index_substr_if_maxlen) / index_substr_any_step;
}
}
if( flags & SLAP_INDEX_SUBSTR_ANY && sa->sa_any != NULL ) {
ber_len_t i;
for( i=0; sa->sa_any[i].bv_val != NULL; i++ ) {
- if( sa->sa_any[i].bv_len >= SLAPD_GLOBAL(index_substr_any_len) ) {
+ if( sa->sa_any[i].bv_len >= index_substr_any_len ) {
/* don't bother accounting with stepping */
nkeys += sa->sa_any[i].bv_len -
- ( SLAPD_GLOBAL(index_substr_any_len) - 1 );
+ ( index_substr_any_len - 1 );
}
}
}
if( flags & SLAP_INDEX_SUBSTR_FINAL &&
sa->sa_final.bv_val != NULL &&
- sa->sa_final.bv_len >= SLAPD_GLOBAL(index_substr_if_minlen) )
+ sa->sa_final.bv_len >= index_substr_if_minlen )
{
nkeys++;
- if ( sa->sa_final.bv_len > SLAPD_GLOBAL(index_substr_if_maxlen) &&
+ if ( sa->sa_final.bv_len > index_substr_if_maxlen &&
( flags & SLAP_INDEX_SUBSTR_ANY ))
{
- nkeys += (sa->sa_final.bv_len - SLAPD_GLOBAL(index_substr_if_maxlen)) / SLAPD_GLOBAL(index_substr_any_step);
+ nkeys += (sa->sa_final.bv_len - index_substr_if_maxlen) / index_substr_any_step;
}
}
if( flags & SLAP_INDEX_SUBSTR_INITIAL &&
sa->sa_initial.bv_val != NULL &&
- sa->sa_initial.bv_len >= SLAPD_GLOBAL(index_substr_if_minlen) )
+ sa->sa_initial.bv_len >= index_substr_if_minlen )
{
pre = SLAP_INDEX_SUBSTR_INITIAL_PREFIX;
value = &sa->sa_initial;
- klen = SLAPD_GLOBAL(index_substr_if_maxlen) < value->bv_len
- ? SLAPD_GLOBAL(index_substr_if_maxlen) : value->bv_len;
+ klen = index_substr_if_maxlen < value->bv_len
+ ? index_substr_if_maxlen : value->bv_len;
hashDigestify( &HASHcontext, HASHdigest, prefix, pre,
syntax, mr, (unsigned char *)value->bv_val, klen );
/* If initial is too long and we have subany indexed, use it
* to match the excess...
*/
- if (value->bv_len > SLAPD_GLOBAL(index_substr_if_maxlen) && (flags & SLAP_INDEX_SUBSTR_ANY))
+ if (value->bv_len > index_substr_if_maxlen && (flags & SLAP_INDEX_SUBSTR_ANY))
{
ber_len_t j;
pre = SLAP_INDEX_SUBSTR_PREFIX;
- for ( j=SLAPD_GLOBAL(index_substr_if_maxlen)-1; j <= value->bv_len - SLAPD_GLOBAL(index_substr_any_len); j+=SLAPD_GLOBAL(index_substr_any_step) )
+ for ( j=index_substr_if_maxlen-1; j <= value->bv_len - index_substr_any_len; j+=index_substr_any_step )
{
hashDigestify( &HASHcontext, HASHdigest, prefix, pre,
- syntax, mr, (unsigned char *)&value->bv_val[j], SLAPD_GLOBAL(index_substr_any_len) );
+ syntax, mr, (unsigned char *)&value->bv_val[j], index_substr_any_len );
ber_dupbv_x( &keys[nkeys++], &digest, ctx );
}
}
if( flags & SLAP_INDEX_SUBSTR_ANY && sa->sa_any != NULL ) {
ber_len_t i, j;
pre = SLAP_INDEX_SUBSTR_PREFIX;
- klen = SLAPD_GLOBAL(index_substr_any_len);
+ klen = index_substr_any_len;
for( i=0; sa->sa_any[i].bv_val != NULL; i++ ) {
- if( sa->sa_any[i].bv_len < SLAPD_GLOBAL(index_substr_any_len) ) {
+ if( sa->sa_any[i].bv_len < index_substr_any_len ) {
continue;
}
value = &sa->sa_any[i];
for(j=0;
- j <= value->bv_len - SLAPD_GLOBAL(index_substr_any_len);
- j += SLAPD_GLOBAL(index_substr_any_step) )
+ j <= value->bv_len - index_substr_any_len;
+ j += index_substr_any_step )
{
hashDigestify( &HASHcontext, HASHdigest, prefix, pre,
syntax, mr, (unsigned char *)&value->bv_val[j], klen );
if( flags & SLAP_INDEX_SUBSTR_FINAL &&
sa->sa_final.bv_val != NULL &&
- sa->sa_final.bv_len >= SLAPD_GLOBAL(index_substr_if_minlen) )
+ sa->sa_final.bv_len >= index_substr_if_minlen )
{
pre = SLAP_INDEX_SUBSTR_FINAL_PREFIX;
value = &sa->sa_final;
- klen = SLAPD_GLOBAL(index_substr_if_maxlen) < value->bv_len
- ? SLAPD_GLOBAL(index_substr_if_maxlen) : value->bv_len;
+ klen = index_substr_if_maxlen < value->bv_len
+ ? index_substr_if_maxlen : value->bv_len;
hashDigestify( &HASHcontext, HASHdigest, prefix, pre,
syntax, mr, (unsigned char *)&value->bv_val[value->bv_len-klen], klen );
/* If final is too long and we have subany indexed, use it
* to match the excess...
*/
- if (value->bv_len > SLAPD_GLOBAL(index_substr_if_maxlen) && (flags & SLAP_INDEX_SUBSTR_ANY))
+ if (value->bv_len > index_substr_if_maxlen && (flags & SLAP_INDEX_SUBSTR_ANY))
{
ber_len_t j;
pre = SLAP_INDEX_SUBSTR_PREFIX;
- for ( j=0; j <= value->bv_len - SLAPD_GLOBAL(index_substr_if_maxlen); j+=SLAPD_GLOBAL(index_substr_any_step) )
+ for ( j=0; j <= value->bv_len - index_substr_if_maxlen; j+=index_substr_any_step )
{
hashDigestify( &HASHcontext, HASHdigest, prefix, pre,
- syntax, mr, (unsigned char *)&value->bv_val[j], SLAPD_GLOBAL(index_substr_any_len) );
+ syntax, mr, (unsigned char *)&value->bv_val[j], index_substr_any_len );
ber_dupbv_x( &keys[nkeys++], &digest, ctx );
}
}
bvtmp.bv_len = sizeof(tmp);
bvtmp.bv_val = tmp;
- keys = slap_sl_malloc( sizeof( struct berval ) * 2, ctx );
-
/* GeneralizedTime YYYYmmddHH[MM[SS]][(./,)d...](Z|(+/-)HH[MM]) */
- assert(value->bv_val != NULL && value->bv_len >= 10);
/* Use 40 bits of time for key */
- if ( lutil_parsetime( value->bv_val, &tm ) == 0 ) {
+ if ( value->bv_val && value->bv_len >= 10 &&
+ lutil_parsetime( value->bv_val, &tm ) == 0 ) {
+
lutil_tm2time( &tm, &tt );
tmp[0] = tt.tt_gsec & 0xff;
tmp[4] = tt.tt_sec & 0xff;
tt.tt_sec >>= 8;
tmp[1] = tt.tt_sec & 0xff;
+ keys = slap_sl_malloc( sizeof( struct berval ) * 2, ctx );
ber_dupbv_x(keys, &bvtmp, ctx );
+ keys[1].bv_val = NULL;
+ keys[1].bv_len = 0;
} else {
- keys[0].bv_val = NULL;
- keys[0].bv_len = 0;
+ keys = NULL;
}
- keys[1].bv_val = NULL;
- keys[1].bv_len = 0;
-
*keysp = keys;
return LDAP_SUCCESS;
{"( 1.2.36.79672281.1.5.0 DESC 'RDN' )",
0, rdnValidate, rdnPretty},
#ifdef LDAP_COMP_MATCH
- {"( 1.2.36.79672281.1.5.2 DESC 'ComponentFilter' )",
+ {"( 1.2.36.79672281.1.5.3 DESC 'allComponents' )",
+ 0, allComponentsValidate, NULL},
+ {"( 1.2.36.79672281.1.5.2 DESC 'componentFilterMatch assertion') ",
0, componentFilterValidate, NULL},
#endif
{"( 1.3.6.1.4.1.1466.115.121.1.13 DESC 'Data Quality' )",
{"( 1.3.6.1.4.1.4203.666.2.6 DESC 'UUID' )",
SLAP_SYNTAX_HIDE, UUIDValidate, NULL},
+ {"( 1.3.6.1.4.1.4203.666.11.2.1 DESC 'CSN' )",
+ SLAP_SYNTAX_HIDE, csnValidate, NULL},
+
/* OpenLDAP Void Syntax */
{"( 1.3.6.1.4.1.4203.1.1.1 DESC 'OpenLDAP void' )" ,
SLAP_SYNTAX_HIDE, inValidate, NULL},
"1.3.6.1.4.1.1466.115.121.1.8" /* certificate */,
NULL
};
+#ifdef LDAP_COMP_MATCH
+char *componentFilterMatchSyntaxes[] = {
+ "1.3.6.1.4.1.1466.115.121.1.8" /* certificate */,
+ NULL
+};
+#endif
char *directoryStringSyntaxes[] = {
"1.3.6.1.4.1.1466.115.121.1.44" /* printableString */,
NULL
#ifdef LDAP_COMP_MATCH
{"( 1.2.36.79672281.1.13.2 NAME 'componentFilterMatch' "
"SYNTAX 1.2.36.79672281.1.5.2 )",
- SLAP_MR_EQUALITY|SLAP_MR_EXT|SLAP_MR_COMPONENT, NULL,
+ SLAP_MR_EXT|SLAP_MR_COMPONENT, componentFilterMatchSyntaxes,
NULL, NULL , componentFilterMatch,
octetStringIndexer, octetStringFilter,
NULL },
+
+ {"( 1.2.36.79672281.1.13.6 NAME 'allComponentsMatch' "
+ "SYNTAX 1.2.36.79672281.1.5.3 )",
+ SLAP_MR_EQUALITY|SLAP_MR_EXT|SLAP_MR_COMPONENT, NULL,
+ NULL, NULL , allComponentsMatch,
+ octetStringIndexer, octetStringFilter,
+ NULL },
+
+ {"( 1.2.36.79672281.1.13.7 NAME 'directoryComponentsMatch' "
+ "SYNTAX 1.2.36.79672281.1.5.3 )",
+ SLAP_MR_EQUALITY|SLAP_MR_EXT|SLAP_MR_COMPONENT, NULL,
+ NULL, NULL , directoryComponentsMatch,
+ octetStringIndexer, octetStringFilter,
+ NULL },
#endif
{"( 2.5.13.2 NAME 'caseIgnoreMatch' "
octetStringIndexer, octetStringFilter,
"UUIDMatch"},
+ {"( 1.3.6.1.4.1.4203.666.11.2.2 NAME 'CSNMatch' "
+ "SYNTAX 1.3.6.1.4.1.4203.666.11.2.1 )",
+ SLAP_MR_HIDE | SLAP_MR_EQUALITY | SLAP_MR_ORDERED_INDEX, NULL,
+ NULL, NULL, csnMatch,
+ csnIndexer, csnFilter,
+ NULL},
+
+ {"( 1.3.6.1.4.1.4203.666.11.2.3 NAME 'CSNOrderingMatch' "
+ "SYNTAX 1.3.6.1.4.1.4203.666.11.2.1 )",
+ SLAP_MR_HIDE | SLAP_MR_ORDERING | SLAP_MR_ORDERED_INDEX, NULL,
+ NULL, NULL, csnOrderingMatch,
+ NULL, NULL,
+ "CSNMatch" },
+
{NULL, SLAP_MR_NONE, NULL,
NULL, NULL, NULL, NULL, NULL,
NULL }
int i;
/* we should only be called once (from main) */
- assert( SLAPD_GLOBAL(schema_init_done) == 0 );
+ assert( schema_init_done == 0 );
for ( i=0; syntax_defs[i].sd_desc != NULL; i++ ) {
res = register_syntax( &syntax_defs[i] );
}
res = slap_schema_load();
- SLAPD_GLOBAL(schema_init_done) = 1;
+ schema_init_done = 1;
return res;
}