version 1.51, 2000/07/02 15:14:37
|
version 1.52, 2000/08/28 16:38:48
|
Line 1
|
Line 1
|
/* filter.c - routines for parsing and dealing with filters */ |
/* filter.c - routines for parsing and dealing with filters */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/filter.c,v 1.50 2000/07/02 05:18:55 mrv Exp $ */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/filter.c,v 1.51 2000/07/02 15:14:37 kurt Exp $ */ |
/* |
/* |
* Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. |
* Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. |
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file |
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file |
Line 699 int filter_escape_value(
|
Line 699 int filter_escape_value(
|
out->bv_val = (char *) ch_malloc( ( in->bv_len * 3 ) + 1 ); |
out->bv_val = (char *) ch_malloc( ( in->bv_len * 3 ) + 1 ); |
out->bv_len = 0; |
out->bv_len = 0; |
|
|
#undef NIBBLE |
|
#undef ESCAPE_LO |
|
#undef ESCAPE_HI |
|
#define NIBBLE(c) ((c)&0x0f) |
|
#define ESCAPE_LO(c) ( NIBBLE(c) + ( NIBBLE(c) < 10 ? '0' : 'A' - 10 ) ) |
|
#define ESCAPE_HI(c) ( ESCAPE_LO((c)>>4) ) |
|
|
|
for( i=0; i < in->bv_len ; i++ ) { |
for( i=0; i < in->bv_len ; i++ ) { |
if( FILTER_ESCAPE(in->bv_val[i]) ) { |
if( FILTER_ESCAPE(in->bv_val[i]) ) { |
out->bv_val[out->bv_len++] = '\\'; |
out->bv_val[out->bv_len++] = SLAP_ESCAPE_CHAR; |
out->bv_val[out->bv_len++] = ESCAPE_HI( in->bv_val[i] ); |
out->bv_val[out->bv_len++] = SLAP_ESCAPE_HI( in->bv_val[i] ); |
out->bv_val[out->bv_len++] = ESCAPE_LO( in->bv_val[i] ); |
out->bv_val[out->bv_len++] = SLAP_ESCAPE_LO( in->bv_val[i] ); |
} else { |
} else { |
out->bv_val[out->bv_len++] = in->bv_val[i]; |
out->bv_val[out->bv_len++] = in->bv_val[i]; |
} |
} |
Line 719 int filter_escape_value(
|
Line 712 int filter_escape_value(
|
out->bv_val[out->bv_len] = '\0'; |
out->bv_val[out->bv_len] = '\0'; |
return LDAP_SUCCESS; |
return LDAP_SUCCESS; |
} |
} |
|
|
|
|