Ticket 328 - make sure all internal search filters are properly escaped
Bug Description: Not all internal search fitlers are properly escaped.
Fix Description: Created a new sprintf type function, and a filter value escape function.
The sprintf function(slapi_filter_sprintf) varies from sprintf as you pass
a description argument before the value you want to escape/normalize:
ESC_NEXT_VAL - escape the next argument
NORM_NEXT_VAL - normalize the next argument
ESC_AND_NORM_NEXT_VAL - escape and normalize the next argument
In order to correctly normalize the value, the function also parses out the attribute
so we can get the syntax plugin normalization function.
As a side effect you must add an additional string format character for the description
arg(%s):
sprintf(buf,"cn=%s", value);
escaped_val = slapi_filter_sprintf("cn=%s%s", ESC_NEXT_VAL, value);
Also did some code cleanup.
https://fedorahosted.org/389/ticket/328
reviewed by: Noriko(Thanks!)