[email protected] wrote:
> Yes @Howard Chu.
> 
> The code in the file libraries/libldap/filter.c file: In function 
> put_filter_list:
> 
>       if( tag == LDAP_FILTER_NOT && ( next == NULL || *str )) {
>               return -1;
>       }
> This code is only for NOT filters. If there is a trailing space, *str will be 
> true, and the function will incorrectly return an error (-1). 
> To handle trailing spaces for NOT filters, we should add some code to 
> check/skip for tailing spaces performing the final check for a NOT filter.
> 
> //New code - start
> if( tag == LDAP_FILTER_NOT && next != NULL ) {
>               while ( *str && LDAP_SPACE( (unsigned char) *str ) ) {
>                       str++;
>               }
>       }
> //New code - end
> 
> if( tag == LDAP_FILTER_NOT && ( next == NULL || *str )) {
>       return -1;
> }
> 
> The above new code ensures that filters with spaces between components are 
> parsed correctly for NOT filters.
> 
> Share your thoughts on these code changes.

It would be better to fix the apps to stop generating invalid filters, rather 
than add special cases
to the library. Adding special cases is how bloat grows over time.

-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

Reply via email to