case '\\':
if( s[1] == '\0' ) return NULL;
+
if( LDAP_HEX( s[1] ) && LDAP_HEX( s[2] ) ) {
s+=2;
- }
- switch( s[1] ) {
+ } else switch( s[1] ) {
default:
return NULL;
}
}
- return NULL;
+ return (char *) s;
}
/* unescape filter value */
if ( fval[v] == '\0' ) {
/* escape at end of string */
return -1;
-
}
if (( v1 = hex2value( fval[v] )) >= 0 ) {
* Note: tags in a choice are always explicit
*/
- Debug( LDAP_DEBUG_TRACE, "put_filter \"%s\"\n", str, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "put_filter: \"%s\"\n", str, 0, 0 );
parens = 0;
while ( *str ) {
Debug( LDAP_DEBUG_TRACE, "put_filter: AND\n",
0, 0, 0 );
- if ( (str = put_complex_filter( ber, str,
- LDAP_FILTER_AND, 0 )) == NULL )
- return( -1 );
+ str = put_complex_filter( ber, str,
+ LDAP_FILTER_AND, 0 );
+ if( str == NULL ) return( -1 );
parens--;
break;
Debug( LDAP_DEBUG_TRACE, "put_filter: OR\n",
0, 0, 0 );
- if ( (str = put_complex_filter( ber, str,
- LDAP_FILTER_OR, 0 )) == NULL )
- return( -1 );
+ str = put_complex_filter( ber, str,
+ LDAP_FILTER_OR, 0 );
+ if( str == NULL ) return( -1 );
parens--;
break;
Debug( LDAP_DEBUG_TRACE, "put_filter: NOT\n",
0, 0, 0 );
- if ( (str = put_complex_filter( ber, str,
- LDAP_FILTER_NOT, 1 )) == NULL )
- return( -1 );
+ str = put_complex_filter( ber, str,
+ LDAP_FILTER_NOT, 0 );
+ if( str == NULL ) return( -1 );
parens--;
break;
ber_tag_t ftype;
int rc = -1;
- Debug( LDAP_DEBUG_TRACE, "put_simple_filter \"%s\"\n",
+ Debug( LDAP_DEBUG_TRACE, "put_simple_filter: \"%s\"\n",
str, 0, 0 );
str = LDAP_STRDUP( str );
if( rc != -1 && *str != '\0' ) {
rc = ber_printf( ber, "ts", LDAP_FILTER_EXT_TYPE, str );
}
-
if( rc != -1 ) {
ber_slen_t len = ldap_pvt_filter_value_unescape( value );
if( len >= 0 ) {
- rc = ber_printf( ber, "totbN}",
- LDAP_FILTER_EXT_VALUE, value, len,
- LDAP_FILTER_EXT_DNATTRS, dn != NULL);
+ rc = ber_printf( ber, "to",
+ LDAP_FILTER_EXT_VALUE, value, len );
} else {
rc = -1;
}
}
+ if( rc != -1 && dn ) {
+ rc = ber_printf( ber, "tb",
+ LDAP_FILTER_EXT_DNATTRS, (ber_int_t) 1 );
+ }
+ if( rc != -1 ) {
+ rc = ber_printf( ber, /*"{"*/ "N}" );
+ }
}
goto done;
{
char *nextstar = ldap_pvt_find_wildcard( value );
if ( nextstar == NULL ) {
- rc = -1;
goto done;
} else if ( *nextstar == '\0' ) {
ftype = LDAP_FILTER_EQUALITY;
}
}
- if( rc != -1 ) rc = 0;
-
done:
+ if( rc != -1 ) rc = 0;
LDAP_FREE( str );
return rc;
}
*nextstar++ = '\0';
- if ( *val != '\0' ) {
+ if ( *val != '\0' || ftype == LDAP_SUBSTRING_ANY ) {
ber_slen_t len = ldap_pvt_filter_value_unescape( val );
if ( len < 0 ) {
}
if ( ber_printf( ber, /*"{{"*/ "N}N}" ) == -1 )
- return( -1 );
+ return -1;
return 0;
-}
\ No newline at end of file
+}