James
James

Reputation: 591

CFLDAP filter with equal sign

I'm stuck on a problem where I need to make a filter to find a DN that doesn't have a "DC=blah" string.

so I have:

(!(distinguishedName='*DC=blah*'))

But that is not getting through well.

Help please!

EDIT: Sorry I forgot to put asterisk in the search string.

Upvotes: 0

Views: 1140

Answers (3)

James
James

Reputation: 591

It seemed like there was NO WAY to get the DN filtered to way I like it so I had to use second filtering method using CFQUERY.

<cfquery dbtype="query" name="secondFilter">
SELECT * FROM firstFilter WHERE dn NOT LIKE '%DC=blah%'
</cfquery>

Upvotes: 0

Terry Gardner
Terry Gardner

Reputation: 11132

An excellent question. The negation filter you seek is (!(distinguishedName=dc=blah*)). A backslash cannot be used in an assertion unless it is followed by two hexadecimal characters. The quotes are not necessary unless they are part of the assertion.

This will work if distinguishedName is an attribute. Otherwise, DN components must be used in an extensible match filter. For more information, see "LDAP: ldapsearch", "LDAP: Mastering search filters", and "LDAP: Programming Practices".

Upvotes: 1

Jason Dean
Jason Dean

Reputation: 9615

I can't test it here, but maybe try this

(!(distinguishedName='DC\=blah'))

Upvotes: 0

Related Questions