LDAP Queries That Contain the Single-Quotation Character (') Fail (265500)



The information in this article applies to:

  • Microsoft Site Server 3.0
  • Microsoft Site Server 3.0 Commerce Edition

This article was previously published under Q265500

SYMPTOMS

You may receive one of the following LDAP error messages when you delete a user (even if the user is known to exist):
LDAP_NO_SUCH_OBJECT
LDAP_OPERATIONS_ERROR
The following LDAP error message may occur when you add a user (even though the user was successfully deleted):
LDAP_ALREADY_EXISTS
The error messages occur when you perform an LDAP query similar to the following:
<BR/>
<LDAP://server:port/o=Org/ou=Members
<ldap://server:port/o=Org/ou=Members>>;(|(cn=*o'brien*)(mail=*o'brien*)); 
ADsPath, cn, mail;subtree
				
NOTE: This behavior occurs when you use either Microsoft Access or Microsoft SQL Server as the database.

CAUSE

This is caused by the single quotation mark (') that is used in the search filter. When the SQL statement is built, the code cannot process the single quotation mark, so it translates the filter into LIKE '%O'brien%', which has unbalanced quotation marks, and therefore causes a syntax error.

NOTE: The correct translation should be LIKE '%O''brien%'.

WORKAROUND

To work around this issue, specify '*O''brien*" instead of "*O'brien* when you submit the query.

RESOLUTION

To resolve this problem, obtain the latest service pack for Site Server version 3.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

219292 How to Obtain the Latest Site Server 3.0 Service Pack

STATUS

Microsoft has confirmed that this is a problem in Site Server 3.0. This problem was first corrected in Site Server 3.0 Service Pack 4.

MORE INFORMATION


For additional information about related LDAP fixes, click the article numbers below to view the articles in the Microsoft Knowledge Base:

265502 LDAP Queries That Use the ADSI NOT Character (!) in a Filter May Work Incorrectly

258670 ADSI Filters May Return Incorrect Results When Text Is Inside a Filter Match

252178 LDAP Search 'Not Present' Filter Does Not Work with Membership

247953 Error Message: The Object You Tried to Create Already Exists in the Directory

231732 Updating Member Properties Using ADSI May Cause Corruption

Steps to Reproduce this Behavior

Repeat the following steps several times (typically between two and four times):
  1. Add Members that are used for testing.
  2. Perform an LDAP query similar to the following:
    <BR/>
    <LDAP://server:port/o=Org/ou=Members
    <ldap://server:port/o=Org/ou=Members>>;(|(cn=*o'brien*)(mail=*o'brien*)); 
    ADsPath, cn, mail;subtree
    						
  3. Remove the Members that were used in testing.

Modification Type:MajorLast Reviewed:6/29/2004
Keywords:kbbug kbfix kbQFE kbSiteServ300sp4fix KB265500