From ae7d89fa1e98eebb5e123569ac7c698bf1fc6af2 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Mon, 15 May 2000 00:41:29 +0000 Subject: [PATCH] SLAPD_SCHEMA_NOT_COMPAT addl. filter changes (a work in progress). --- servers/slapd/at.c | 3 ++- servers/slapd/back-ldbm/index.c | 2 ++ servers/slapd/back-ldbm/modify.c | 9 +++++-- servers/slapd/back-ldbm/tools.c | 1 + servers/slapd/slap.h | 4 +-- servers/slapd/str2filter.c | 45 ++++++++++++++++++++++++++++---- 6 files changed, 54 insertions(+), 10 deletions(-) diff --git a/servers/slapd/at.c b/servers/slapd/at.c index deb586a95c..9a7872db7a 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -441,8 +441,9 @@ at_add( */ if ( sat->sat_sup ) { sat->sat_syntax = sat->sat_sup->sat_syntax; +#ifndef SLAPD_SCHEMA_NOT_COMPAT sat->sat_syntax_compat = sat->sat_sup->sat_syntax_compat; - +#endif sat->sat_equality = sat->sat_sup->sat_equality; sat->sat_ordering = sat->sat_sup->sat_ordering; sat->sat_substr = sat->sat_sup->sat_substr; diff --git a/servers/slapd/back-ldbm/index.c b/servers/slapd/back-ldbm/index.c index f724292680..05afcf2dcc 100644 --- a/servers/slapd/back-ldbm/index.c +++ b/servers/slapd/back-ldbm/index.c @@ -233,6 +233,7 @@ index_change_values( unsigned int op ) { +#ifndef SLAPD_SCHEMA_NOT_COMPAT char *val, *p, *code, *w; unsigned i, j, len; int indexmask, syntax; @@ -413,6 +414,7 @@ index_change_values( done: ldbm_cache_close( be, db ); +#endif return( 0 ); } diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index ba85fd435a..d7a98d6f1e 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -175,7 +175,12 @@ int ldbm_modify_internal( for ( ml = modlist; ml != NULL; ml = ml->sml_next ) { 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_ADD: #ifdef SLAPD_SCHEMA_NOT_COMPAT @@ -197,7 +202,6 @@ int ldbm_modify_internal( Attribute *a = e->e_attrs ? attr_find( e->e_attrs, mod->mod_type ) : NULL; -#endif if( a != NULL ) { (void) index_change_values( be, @@ -206,6 +210,7 @@ int ldbm_modify_internal( e->e_id, SLAP_INDEX_ADD_OP ); } +#endif } break; } } diff --git a/servers/slapd/back-ldbm/tools.c b/servers/slapd/back-ldbm/tools.c index fd1b0683a2..0d96f70049 100644 --- a/servers/slapd/back-ldbm/tools.c +++ b/servers/slapd/back-ldbm/tools.c @@ -220,6 +220,7 @@ int ldbm_tool_index_attr( return 0; } #endif + assert( at_cn != NULL ); attr_mask( be->be_private, at_cn, &indexmask ); diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index ae5e535397..391c9e9745 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -106,10 +106,10 @@ LIBSLAPD_F (int) slap_debug; #define SLAP_INDEX_EQUALITY 0x0002U #define SLAP_INDEX_APPROX 0x0004U #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 */ - /* * represents schema information for a database */ diff --git a/servers/slapd/str2filter.c b/servers/slapd/str2filter.c index ebc26fe499..4b371f46d0 100644 --- a/servers/slapd/str2filter.c +++ b/servers/slapd/str2filter.c @@ -145,6 +145,10 @@ str2simple( const char *str ) Filter *f; char *s; char *value, savechar; +#ifdef SLAPD_SCHEMA_NOT_COMPAT + int rc; + char *text; +#endif Debug( LDAP_DEBUG_FILTER, "str2simple \"%s\"\n", str, 0, 0 ); @@ -152,7 +156,8 @@ str2simple( const char *str ) return( NULL ); } value = &s[1]; - *s-- = '\0'; + + *s-- = '\0'; /* we shouldn't be mucking with str */ savechar = *s; f = (Filter *) ch_calloc( 1, sizeof(Filter) ); @@ -182,8 +187,16 @@ str2simple( const char *str ) f->f_choice = LDAP_FILTER_PRESENT; } else { 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 ); +#endif if ( str2subvals( value, f ) != 0 ) { filter_free( f ); *(value-1) = '='; @@ -191,24 +204,46 @@ str2simple( const char *str ) } *(value-1) = '='; return( f ); -#endif } break; } -#ifndef SLAPD_SCHEMA_NOT_COMPAT 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 ); +#endif } 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_avvalue.bv_val = ch_strdup( value ); ldap_pvt_filter_value_unescape( f->f_avvalue.bv_val ); f->f_avvalue.bv_len = strlen( value ); +#endif } *s = savechar; *(value-1) = '='; -#endif + return( f ); } -- 2.39.5