BerElement *ber,
Filter **f,
char **fstr,
- char **text );
+ const char **text );
+
static int get_substring_filter(
Connection *conn,
BerElement *ber,
Filter *f,
char **fstr,
- char **text );
+ const char **text );
int
get_filter(
BerElement *ber,
Filter **filt,
char **fstr,
- char **text )
+ const char **text )
{
ber_tag_t tag;
ber_len_t len;
break;
}
+ free( ftmp );
+
if ( err != LDAP_SUCCESS ) {
- free( (char *) f );
if ( *fstr != NULL ) {
free( *fstr );
}
+
+ if( err != SLAPD_DISCONNECT ) {
+ /* ignore error */
+ f->f_choice = SLAPD_FILTER_COMPUTED;
+ f->f_result = SLAPD_COMPARE_UNDEFINED;
+ *fstr = ch_strdup( "(badfilter)" );
+ err = LDAP_SUCCESS;
+ *filt = f;
+
+ } else {
+ free(f);
+ }
} else {
*filt = f;
}
- free( ftmp );
-
Debug( LDAP_DEBUG_FILTER, "end get_filter %d\n", err, 0, 0 );
return( err );
}
static int
-get_filter_list( Connection *conn, BerElement *ber, Filter **f, char **fstr, char **text )
+get_filter_list( Connection *conn, BerElement *ber,
+ Filter **f, char **fstr,
+ const char **text )
{
Filter **new;
int err;
BerElement *ber,
Filter *f,
char **fstr,
- char **text
+ const char **text
)
{
ber_tag_t tag;
ber_len_t len;
ber_tag_t rc;
struct berval *value;
- struct berval *nvalue;
char *last;
struct berval type;
-#ifndef SLAPD_SCHEMA_NOT_COMPAT
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
+ struct berval *nvalue;
+#else
int syntax;
#endif
*text = "error decoding filter";
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
+ f->f_sub = ch_calloc( 1, sizeof(SubstringsAssertion) );
f->f_sub_desc = NULL;
rc = slap_bv2ad( &type, &f->f_sub_desc, text );
if( rc != LDAP_SUCCESS ) {
text = NULL;
+ ch_free( f->f_sub );
f->f_choice = SLAPD_FILTER_COMPUTED;
f->f_result = SLAPD_COMPARE_UNDEFINED;
*fstr = ch_strdup( "(undefined)" );
for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
tag = ber_next_element( ber, &len, last ) )
{
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
unsigned usage;
+#endif
rc = ber_scanf( ber, "O", &value );
if ( rc == LBER_ERROR ) {
ber_bvfree( f->f_sub_initial );
ber_bvecfree( f->f_sub_any );
ber_bvfree( f->f_sub_final );
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
+ ch_free( f->f_sub );
+#endif
return rc;
}
}