[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
back-sql quote characters in query
- To: openldap-technical@openldap.org
- Subject: back-sql quote characters in query
- From: Anatoly <tolich.arz@gmail.com>
- Date: Sun, 24 Jan 2010 04:56:39 +0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=v7/rn5NKKjpX/pBVI3aspi+Pq6+JlHDJ2K2BaEMa7nw=; b=a8w29u/PF+xFFaM7mzszC0VRZaaMAbCsw/5N3AhM1oTRnD14BEtUEswQfIc1Y8ReN1 VfzBGE1Xxp8MD+SEn88QI8Lx7uOJER2vJQc0Yn1Kn0zC8nI+1K7eh3grpODMbI/rFa6i Ew3oyYUHPtw5GPXKvmgr6A2d1amQF3m3BkdL8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=oXjFCzfPWSp3CA+jwanqbulOMba8iQ2EL0f7fN59lc3vRFQnukUb8oIrdlMWyUHqdX UeXlBRCQPLYlqTfKipXIzLM1d6vF+0M9xU9/sHAJhP/+8TASjbU4Uu08+tS5dlCZVHI+ 8rnhVVilbvVRP/S9t8NKVhSy18TBto3zbZww0=
Hello.
I'm using openldap 2.4.19 with sql backend. I have a troubles with
queries that contains single-quote ( ' ) character.
For example, if I searching for (cn=Zool'man):
<==backsql_srch_query() returns SELECT DISTINCT
ldap_entries.id,phpbb_users.user_id,varchar_ci('phpbbUser') AS
objectClass,ldap_entries.dn AS dn FROM ldap_entries,phpbb_users WHERE
phpbb_users.user_id=ldap_entries.keyval AND ldap_entries.oc_map_id=?
AND 9=9 AND (varchar_ci(phpbb_users.username)='ZOOL'MAN')
Constructed query: SELECT DISTINCT
ldap_entries.id,phpbb_users.user_id,varchar_ci('phpbbUser') AS
objectClass,ldap_entries.dn AS dn FROM ldap_entries,phpbb_users WHERE
phpbb_users.user_id=ldap_entries.keyval AND ldap_entries.oc_map_id=?
AND 9=9 AND (varchar_ci(phpbb_users.username)='ZOOL'MAN')
id: '2'
backsql_oc_get_candidates(): error executing query
Return code: -1
nativeErrCode=7 SQLengineState=S1000 msg="[unixODBC]ERROR: syntax
error at or near "MAN" at character 271;
In this case query should be like
varchar_ci(phpbb_users.username)='ZOOL\'MAN' instead of 'ZOOL'MAN'
How to solve this issue? Thanks.