SLAPD_SCHEMA_NOT_COMPAT addl. filter changes (a work in progress).

This commit is contained in:
Kurt Zeilenga 2000-05-15 00:41:29 +00:00
parent e3f3500942
commit ae7d89fa1e
6 changed files with 54 additions and 10 deletions

View file

@ -441,8 +441,9 @@ at_add(
*/ */
if ( sat->sat_sup ) { if ( sat->sat_sup ) {
sat->sat_syntax = sat->sat_sup->sat_syntax; sat->sat_syntax = sat->sat_sup->sat_syntax;
#ifndef SLAPD_SCHEMA_NOT_COMPAT
sat->sat_syntax_compat = sat->sat_sup->sat_syntax_compat; sat->sat_syntax_compat = sat->sat_sup->sat_syntax_compat;
#endif
sat->sat_equality = sat->sat_sup->sat_equality; sat->sat_equality = sat->sat_sup->sat_equality;
sat->sat_ordering = sat->sat_sup->sat_ordering; sat->sat_ordering = sat->sat_sup->sat_ordering;
sat->sat_substr = sat->sat_sup->sat_substr; sat->sat_substr = sat->sat_sup->sat_substr;

View file

@ -233,6 +233,7 @@ index_change_values(
unsigned int op unsigned int op
) )
{ {
#ifndef SLAPD_SCHEMA_NOT_COMPAT
char *val, *p, *code, *w; char *val, *p, *code, *w;
unsigned i, j, len; unsigned i, j, len;
int indexmask, syntax; int indexmask, syntax;
@ -413,6 +414,7 @@ index_change_values(
done: done:
ldbm_cache_close( be, db ); ldbm_cache_close( be, db );
#endif
return( 0 ); return( 0 );
} }

View file

@ -175,7 +175,12 @@ int ldbm_modify_internal(
for ( ml = modlist; ml != NULL; ml = ml->sml_next ) { for ( ml = modlist; ml != NULL; ml = ml->sml_next ) {
mod = &ml->sml_mod; mod = &ml->sml_mod;
switch ( mod->mod_op ) { #ifdef SLAPD_SCHEMA_NOT_COMPAT
switch ( mod->sm_op )
#else
switch ( mod->mod_op )
#endif
{
case LDAP_MOD_REPLACE: case LDAP_MOD_REPLACE:
case LDAP_MOD_ADD: case LDAP_MOD_ADD:
#ifdef SLAPD_SCHEMA_NOT_COMPAT #ifdef SLAPD_SCHEMA_NOT_COMPAT
@ -197,7 +202,6 @@ int ldbm_modify_internal(
Attribute *a = e->e_attrs Attribute *a = e->e_attrs
? attr_find( e->e_attrs, mod->mod_type ) ? attr_find( e->e_attrs, mod->mod_type )
: NULL; : NULL;
#endif
if( a != NULL ) { if( a != NULL ) {
(void) index_change_values( be, (void) index_change_values( be,
@ -206,6 +210,7 @@ int ldbm_modify_internal(
e->e_id, e->e_id,
SLAP_INDEX_ADD_OP ); SLAP_INDEX_ADD_OP );
} }
#endif
} break; } break;
} }
} }

View file

@ -220,6 +220,7 @@ int ldbm_tool_index_attr(
return 0; return 0;
} }
#endif #endif
assert( at_cn != NULL ); assert( at_cn != NULL );
attr_mask( be->be_private, at_cn, &indexmask ); attr_mask( be->be_private, at_cn, &indexmask );

View file

@ -106,10 +106,10 @@ LIBSLAPD_F (int) slap_debug;
#define SLAP_INDEX_EQUALITY 0x0002U #define SLAP_INDEX_EQUALITY 0x0002U
#define SLAP_INDEX_APPROX 0x0004U #define SLAP_INDEX_APPROX 0x0004U
#define SLAP_INDEX_SUB 0x0008U #define SLAP_INDEX_SUB 0x0008U
#define SLAP_INDEX_UNKNOWN 0x0010U #define SLAP_INDEX_EXTENDED 0x0010U
#define SLAP_INDEX_UNDEFINED 0x1000U
#define SLAP_INDEX_FROMINIT 0x8000U /* psuedo type */ #define SLAP_INDEX_FROMINIT 0x8000U /* psuedo type */
/* /*
* represents schema information for a database * represents schema information for a database
*/ */

View file

@ -145,6 +145,10 @@ str2simple( const char *str )
Filter *f; Filter *f;
char *s; char *s;
char *value, savechar; char *value, savechar;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
int rc;
char *text;
#endif
Debug( LDAP_DEBUG_FILTER, "str2simple \"%s\"\n", str, 0, 0 ); Debug( LDAP_DEBUG_FILTER, "str2simple \"%s\"\n", str, 0, 0 );
@ -152,7 +156,8 @@ str2simple( const char *str )
return( NULL ); return( NULL );
} }
value = &s[1]; value = &s[1];
*s-- = '\0';
*s-- = '\0'; /* we shouldn't be mucking with str */
savechar = *s; savechar = *s;
f = (Filter *) ch_calloc( 1, sizeof(Filter) ); f = (Filter *) ch_calloc( 1, sizeof(Filter) );
@ -182,8 +187,16 @@ str2simple( const char *str )
f->f_choice = LDAP_FILTER_PRESENT; f->f_choice = LDAP_FILTER_PRESENT;
} else { } else {
f->f_choice = LDAP_FILTER_SUBSTRINGS; f->f_choice = LDAP_FILTER_SUBSTRINGS;
#ifndef SLAPD_SCHEMA_NOT_COMPAT #ifdef SLAPD_SCHEMA_NOT_COMPAT
rc = slap_str2ad( str, &f->f_sub_desc, &text );
if( rc != LDAP_SUCCESS ) {
filter_free( f );
*(value-1) = '=';
return NULL;
}
#else
f->f_sub_type = ch_strdup( str ); f->f_sub_type = ch_strdup( str );
#endif
if ( str2subvals( value, f ) != 0 ) { if ( str2subvals( value, f ) != 0 ) {
filter_free( f ); filter_free( f );
*(value-1) = '='; *(value-1) = '=';
@ -191,24 +204,46 @@ str2simple( const char *str )
} }
*(value-1) = '='; *(value-1) = '=';
return( f ); return( f );
#endif
} }
break; break;
} }
#ifndef SLAPD_SCHEMA_NOT_COMPAT
if ( f->f_choice == LDAP_FILTER_PRESENT ) { if ( f->f_choice == LDAP_FILTER_PRESENT ) {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
rc = slap_str2ad( str, &f->f_desc, &text );
if( rc != LDAP_SUCCESS ) {
filter_free( f );
*(value-1) = '=';
return NULL;
}
#else
f->f_type = ch_strdup( str ); f->f_type = ch_strdup( str );
#endif
} else { } else {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
char *tmp;
rc = slap_str2ad( str, &f->f_av_desc, &text );
if( rc != LDAP_SUCCESS ) {
filter_free( f );
*(value-1) = '=';
return NULL;
}
tmp = ch_strdup( value );
ldap_pvt_filter_value_unescape( tmp );
f->f_av_value = ber_bvstr( tmp );
#else
f->f_avtype = ch_strdup( str ); f->f_avtype = ch_strdup( str );
f->f_avvalue.bv_val = ch_strdup( value ); f->f_avvalue.bv_val = ch_strdup( value );
ldap_pvt_filter_value_unescape( f->f_avvalue.bv_val ); ldap_pvt_filter_value_unescape( f->f_avvalue.bv_val );
f->f_avvalue.bv_len = strlen( value ); f->f_avvalue.bv_len = strlen( value );
#endif
} }
*s = savechar; *s = savechar;
*(value-1) = '='; *(value-1) = '=';
#endif
return( f ); return( f );
} }