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

back-sql wrong SQL construction



Hi All,

Ok so I've got back-sql working with my MySQL database of users when
using 

ldapsearch -x -b 'o=CO2CRC,c=AU' 'objectclass=*'

It will successfully list all the users and their attributes correctly.
The problem is when I attempt any other type of search.

ldapsearch -x -b 'o=CO2CRC,c=AU' 'sn=smith'

I get "80 Internal (implementation specific) error"
>From the log I can see that back-sql is not constructing the SQL
statement correctly. It keeps inserting ? in weird places.

SELECT DISTINCT ldap_entries.id,users.id,'inetOrgPerson' AS
objectClass,ldap_entries.dn AS dn FROM ldap_entries,users WHERE
users.id=ldap_entries.keyval AND ldap_entries.oc_map_id=? AND
ldap_entries.dn LIKE ? AND (='SMITH')

MySQL of course doesn't know what to do with this ? in the middle of the
SQL and dies. I'm sure this is not a bug because I've read how many
others have got this working so what could I possible be doing wrong
that causes back-sql to construct such flawed SQL?

MySQL 4.0.16
OpenLDAP 2.2.26

slapd.conf

#
include         /usr/local/etc/openldap/schema/core.schema
include         /usr/local/etc/openldap/schema/cosine.schema
include         /usr/local/etc/openldap/schema/inetorgperson.schema

pidfile         /usr/local/var/run/slapd.pid
argsfile        /usr/local/var/run/slapd.args


#######################################################################
# sql database definitions
#######################################################################

database        sql
suffix          "o=CO2CRC,c=AU"
rootdn          "cn=CO2CRC Admin,o=CO2CRC,c=AU"
rootpw          {SSHA}Mvose37nTlQrz9PGDttnHv02n6IAl8gs
dbname          xxxxxxxxxxx
dbuser          xxxxxxxxxxx
dbpasswd        xxxxxxxxxxx
subtree_cond    "ldap_entries.dn LIKE CONCAT('%',?)"
insentry_query  "INSERT INTO ldap_entries (dn,oc_map_id,parent,keyval)
VALUES (?,?,?,?)"
has_ldapinfo_dn_ru      no



Regards,

Daniel Neal
ITS Manager
Cooperative Research Centre for Greenhouse Gas Technologies

"When Microsoft is your only hammer, pretty much everything begins to
look like a nail.......Or a thumb."

<CENTER><font size<FONT face<BR>
<BR>
<BR>**********************************************<BR>
<B>Commercial-in-Confidence</B>
<BR>**********************************************<BR>
This message contains confidential information
and is intended only for the individual named. If you are not the named
addressee you should not disseminate, print, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received this e-mail
by mistake and delete this e-mail from your system. E-mail transmission cannot
be guaranteed to be secure or error-free as information
could arrive late or be intercepted, corrupted, lost, destroyed, incomplete, or
contain viruses. The sender therefore does not accept liability for any damage,
errors or omissions in the contents of this message, which arise as a result of
e-mail transmission. If verification is required please request a hard-copy
version.
<BR> <BR>Cooperative Research Centre for Greenhouse Gas
Technologies
<BR><A
hrefhref</font></CENTER><BR>
</html>