[Date Prev][Date Next] [Chronological] [Thread] [Top]

How to correctly escape search filters



I've been trying to research how to correctly escape search filters, and I can't find any single
reliable source that makes sense.

I look at RFC 2253 (http://www.ietf.org/rfc/rfc2253.txt) section 2.4,
and this IBM webpage (http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/rzahy/rzahyunderdn.htm),
and they both seem to suggest that you need to escape (for example) the '+' sign.

But when I escape a search filter like this:
(&(objectclass=person)(facsimileTelephoneNumber=+1234))
to this:
(&(objectclass=person)(facsimileTelephoneNumber=\+1234))
it results in a bad filter.

My hunch is that perhaps DNs, attribute names, and attribute values are all escaped different.

Is there a simple explanation online on how to escape search filters?

Thanks,
 - Jeremiah