通过基于PostgreSQL的语法Slapd生成SQL

时间:2018-09-05 23:10:45

标签: openldap slapd

我已经在服务器故障中发布了相同的文章。 https://serverfault.com/q/926093/161067

我在CentoS 6.9上使用openldap slapd 2.4.40 + MySQL5.5作为back-sql

Slapd生成基于PostgreSQL的语法SQL

这是ldapsearch -x -b "dc=example,dc=com" '(objectClass=*)'的错误消息

5b70e25c <==backsql_srch_query() returns SELECT DISTINCT ldap_entries.id,eduperson.id,text('inetOrgPerson') AS objectClass,ldap_entries.dn AS dn FROM ldap_entries,eduperson WHERE eduperson.id=ldap_entries.keyval AND ldap_entries.oc_map_id=? AND 9=9 AND 3=3
5b70e25c Constructed query: SELECT DISTINCT ldap_entries.id,eduperson.id,text('inetOrgPerson') AS objectClass,ldap_entries.dn AS dn FROM ldap_entries,eduperson WHERE eduperson.id=ldap_entries.keyval AND ldap_entries.oc_map_id=? AND 9=9 AND 3=3
5b70e25c id: '3'
5b70e25c backsql_oc_get_candidates(): error executing query
5b70e25c Return code: -1
5b70e25c    nativeErrCode=1064 SQLengineState=37000 msg="[unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.5.57]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('inetOrgPerson') AS objectClass,ldap_entries.dn AS dn FROM ldap_entries,edupers' at line 1"
5b70e25c send_ldap_result: conn=1000 op=1 p=3
5b70e25c send_ldap_result: err=80 matched="" text=""
5b70e25c send_ldap_response: msgid=2 tag=101 err=80

我可以在text('inetOrgPerson')生成的SQL中看到slapd,但是MySQL不支持SQL中的text() function

我收到与从MySQL控制台执行的消息相同的消息。

SELECT DISTINCT 
 ldap_entries.id,
 eduperson.id,
 text('inetOrgPerson') AS objectClass,
 ldap_entries.dn AS dn 
FROM ldap_entries,eduperson 
WHERE eduperson.id=ldap_entries.keyval
 AND ldap_entries.oc_map_id=3 
 AND 9=9 
 AND 3=3

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('inetOrgPerson') AS objectClass,
 ldap_entries.dn AS dn 
FROM ldap_entries,edup' at line 4

可以将postgresql用作back-sql,我的意思是ldapsearch返回相应的anwar,并且psql控制台也会重新调整。

SELECT DISTINCT ldap_entries.id,persons.id,text('inetOrgPerson') AS objectClass,ldap_entries.dn AS dn
 FROM ldap_entries,persons 
 WHERE persons.id=ldap_entries.keyval 
 AND ldap_entries.oc_map_id=1 
 AND 9=9 
 AND 3=3;




 id | id |  objectclass  |                   dn                    
----+----+---------------+-----------------------------------------
  3 |  2 | inetOrgPerson | cn=Torvlobnor Puzdoy,dc=example,dc=com
  2 |  1 | inetOrgPerson | cn=Mitya Kovalev,dc=example,dc=com
  4 |  3 | inetOrgPerson | cn=Akakiy Zinberstein,dc=example,dc=com

有人知道如何告诉Slapd生成基于MySQL的语法SQL吗?

0 个答案:

没有答案