version 1.4.2.4.2.1, 1999/02/03 16:39:07
|
version 1.5, 1998/10/27 01:07:12
|
Line 9
|
Line 9
|
|
|
#include "slap.h" |
#include "slap.h" |
|
|
static int get_filter_list(Connection *conn, BerElement *ber, Filter **f, char **fstr); |
static int get_filter_list(); |
static int get_substring_filter(Connection *conn, BerElement *ber, Filter *f, char **fstr); |
static int get_substring_filter(); |
|
|
|
extern int get_ava(); |
|
extern char *ch_malloc(); |
|
extern char *ch_realloc(); |
|
|
int |
int |
get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr ) |
get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr ) |
Line 47 get_filter( Connection *conn, BerElement
|
Line 51 get_filter( Connection *conn, BerElement
|
*/ |
*/ |
|
|
f = (Filter *) ch_malloc( sizeof(Filter) ); |
f = (Filter *) ch_malloc( sizeof(Filter) ); |
|
*filt = f; |
f->f_next = NULL; |
f->f_next = NULL; |
|
|
err = 0; |
err = 0; |
Line 133 get_filter( Connection *conn, BerElement
|
Line 138 get_filter( Connection *conn, BerElement
|
Debug( LDAP_DEBUG_FILTER, "AND\n", 0, 0, 0 ); |
Debug( LDAP_DEBUG_FILTER, "AND\n", 0, 0, 0 ); |
if ( (err = get_filter_list( conn, ber, &f->f_and, &ftmp )) |
if ( (err = get_filter_list( conn, ber, &f->f_and, &ftmp )) |
== 0 ) { |
== 0 ) { |
if (ftmp == NULL) ftmp = ch_strdup(""); |
if (ftmp == NULL) ftmp = strdup(""); |
*fstr = ch_malloc( 4 + strlen( ftmp ) ); |
*fstr = ch_malloc( 4 + strlen( ftmp ) ); |
sprintf( *fstr, "(&%s)", ftmp ); |
sprintf( *fstr, "(&%s)", ftmp ); |
free( ftmp ); |
free( ftmp ); |
Line 144 get_filter( Connection *conn, BerElement
|
Line 149 get_filter( Connection *conn, BerElement
|
Debug( LDAP_DEBUG_FILTER, "OR\n", 0, 0, 0 ); |
Debug( LDAP_DEBUG_FILTER, "OR\n", 0, 0, 0 ); |
if ( (err = get_filter_list( conn, ber, &f->f_or, &ftmp )) |
if ( (err = get_filter_list( conn, ber, &f->f_or, &ftmp )) |
== 0 ) { |
== 0 ) { |
if (ftmp == NULL) ftmp = ch_strdup(""); |
if (ftmp == NULL) ftmp = strdup(""); |
*fstr = ch_malloc( 4 + strlen( ftmp ) ); |
*fstr = ch_malloc( 4 + strlen( ftmp ) ); |
sprintf( *fstr, "(|%s)", ftmp ); |
sprintf( *fstr, "(|%s)", ftmp ); |
free( ftmp ); |
free( ftmp ); |
Line 155 get_filter( Connection *conn, BerElement
|
Line 160 get_filter( Connection *conn, BerElement
|
Debug( LDAP_DEBUG_FILTER, "NOT\n", 0, 0, 0 ); |
Debug( LDAP_DEBUG_FILTER, "NOT\n", 0, 0, 0 ); |
(void) ber_skip_tag( ber, &len ); |
(void) ber_skip_tag( ber, &len ); |
if ( (err = get_filter( conn, ber, &f->f_not, &ftmp )) == 0 ) { |
if ( (err = get_filter( conn, ber, &f->f_not, &ftmp )) == 0 ) { |
if (ftmp == NULL) ftmp = ch_strdup(""); |
if (ftmp == NULL) ftmp = strdup(""); |
*fstr = ch_malloc( 4 + strlen( ftmp ) ); |
*fstr = ch_malloc( 4 + strlen( ftmp ) ); |
sprintf( *fstr, "(!%s)", ftmp ); |
sprintf( *fstr, "(!%s)", ftmp ); |
free( ftmp ); |
free( ftmp ); |
Line 163 get_filter( Connection *conn, BerElement
|
Line 168 get_filter( Connection *conn, BerElement
|
break; |
break; |
|
|
default: |
default: |
Debug( LDAP_DEBUG_ANY, "unknown filter type %lu\n", |
Debug( LDAP_DEBUG_ANY, "unknown filter type %d\n", f->f_choice, |
f->f_choice, 0, 0 ); |
0, 0 ); |
err = LDAP_PROTOCOL_ERROR; |
err = LDAP_PROTOCOL_ERROR; |
break; |
break; |
} |
} |
Line 174 get_filter( Connection *conn, BerElement
|
Line 179 get_filter( Connection *conn, BerElement
|
if ( *fstr != NULL ) { |
if ( *fstr != NULL ) { |
free( *fstr ); |
free( *fstr ); |
} |
} |
} else { |
|
*filt = f; |
|
} |
} |
|
|
Debug( LDAP_DEBUG_FILTER, "end get_filter %d\n", err, 0, 0 ); |
Debug( LDAP_DEBUG_FILTER, "end get_filter %d\n", err, 0, 0 ); |
Line 372 filter_free( Filter *f )
|
Line 375 filter_free( Filter *f )
|
break; |
break; |
|
|
default: |
default: |
Debug( LDAP_DEBUG_ANY, "unknown filter type %lu\n", |
Debug( LDAP_DEBUG_ANY, "unknown filter type %d\n", f->f_choice, |
f->f_choice, 0, 0 ); |
0, 0 ); |
break; |
break; |
} |
} |
free( f ); |
free( f ); |
Line 444 filter_print( Filter *f )
|
Line 447 filter_print( Filter *f )
|
break; |
break; |
|
|
default: |
default: |
fprintf( stderr, "unknown type %lu", f->f_choice ); |
fprintf( stderr, "unknown type %d", f->f_choice ); |
break; |
break; |
} |
} |
} |
} |