for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
tag = ber_next_element( ber, &len, last ) )
{
+ unsigned usage;
+
rc = ber_scanf( ber, "O", &val );
if ( rc == LBER_ERROR ) {
rc = SLAPD_DISCONNECT;
goto return_error;
}
- rc = LDAP_PROTOCOL_ERROR;
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
+ switch ( tag ) {
+ case LDAP_SUBSTRING_INITIAL:
+ usage = SLAP_MR_SUBSTR_INITIAL;
+ break;
+
+ case LDAP_SUBSTRING_ANY:
+ usage = SLAP_MR_SUBSTR_ANY;
+ break;
+
+ case LDAP_SUBSTRING_FINAL:
+ usage = SLAP_MR_SUBSTR_FINAL;
+ break;
+
+ default:
+ rc = LDAP_PROTOCOL_ERROR;
+
+ Debug( LDAP_DEBUG_FILTER,
+ " unknown substring choice=%ld\n",
+ (long) tag, 0, 0 );
+
+ ber_bvfree( val );
+ goto return_error;
+ }
+
+ rc = value_normalize( f->f_sub_desc, usage, val, text );
+
+ if( rc != LDAP_SUCCESS ) {
+ ber_bvfree( val );
+ goto return_error;
+ }
+#else
-#ifndef SLAPD_SCHEMA_NOT_COMPAT
/* we should call a substring syntax normalization routine */
value_normalize( val->bv_val, syntax );
/* this is bogus, value_normalize should take a berval */
val->bv_len = strlen( val->bv_val );
#endif
+ rc = LDAP_PROTOCOL_ERROR;
+
switch ( tag ) {
case LDAP_SUBSTRING_INITIAL:
Debug( LDAP_DEBUG_FILTER, " INITIAL\n", 0, 0, 0 );
ber_bvfree( val );
goto return_error;
}
+
+
f->f_sub_initial = val;
if( fstr ) {
typedef struct slap_matching_rule {
LDAP_MATCHING_RULE smr_mrule;
unsigned smr_usage;
-#define SLAP_MR_NONE 0x00U
-#define SLAP_MR_EQUALITY 0x01U
-#define SLAP_MR_APPROX 0x02U
-#define SLAP_MR_ORDERING 0x04U
-#define SLAP_MR_SUBSTR 0x08U
-#define SLAP_MR_EXT 0x10U
+
+#define SLAP_MR_TYPE_MASK 0xFF00U
+#define SLAP_MR_SUBTYPE_MASK 0x00FFU
+
+#define SLAP_MR_NONE 0x0000U
+#define SLAP_MR_EQUALITY 0x0100U
+#define SLAP_MR_APPROX 0x0200U
+#define SLAP_MR_ORDERING 0x0400U
+#define SLAP_MR_SUBSTR 0x0800U
+#define SLAP_MR_EXT 0x1000U
+
+#define SLAP_MR_SUBSTR_INITIAL (SLAP_MR_SUBSTR | 0x0001U )
+#define SLAP_MR_SUBSTR_ANY (SLAP_MR_SUBSTR | 0x0002U )
+#define SLAP_MR_SUBSTR_FINAL (SLAP_MR_SUBSTR | 0x0004U )
+
Syntax *smr_syntax;
slap_mr_convert_func *smr_convert;
slap_mr_normalize_func *smr_normalize;