[freetds] Openldap segfaults in freetds code.

Hindrik Buining hindrik-freetds at phoenix.comms.unsw.edu.au
Tue May 20 03:19:46 EDT 2003

Hi all,

I am trying to run openldap with a sybase v12.5 backend.
The software I am running is openldap-2.1.19, unixODBC-2.2.5, freetds-0.61
on SunOS myhost 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-4

When starting up openldap segfaults.
Running the server under gdb shows that segfault occurs inside the freetds
I am using the sample table schema and data provided with openldap.
If I change my odbc connection (in odbc.ini) to a postgresql db instead of
Sybase db (with identical tables and data) then the system works.

This would seem to me to suggest that the problem is somewhere in the
freetds/unixodbc world rather than a problem with openldap.
However I can run isql compiled against unixodbc and using freetds.
This gives me no problems.
I can even run the same queries through isql that openldap passes to the sql
(I logged the queries passed to postgresql by openldap and then ran them
under isql on my sybase db).

I don't know what to try next?
I suspect the problem is somewhere in freetds because that is where the ldap
daemon seg faults.
Has anyone had similar problems?
Can anyone please help me?

I have included relevant config files below.

- Hindrik

------- begin gdb output
$ gdb servers/slapd/slapd
(gdb) set args -d 5
(gdb) run
Starting program: /home/hindrik/src/openldap-2.1.19/servers/slapd/slapd -d 5
backsql_open_db_conn(): connected, adding to tree
backsql_get_db_conn(): first call -- reading schema map
load_schma_map(): at_query
xpect_return,sel_expr_u FROM ldap_attr_mappings WHERE oc_map_id=?'
load_schema_map(): objectClass 'inetOrgPerson': keytbl='persons' keycol='id'
create_proc='select create_person()'
delete_proc='select delete_person(?)'
expect_return: add=0, del=0; attributes:
load_schema_map(): autoadding 'objectClass' and 'ref' mappings

Program received signal SIGSEGV, Segmentation fault.
0xfef5c454 in _get_param_textsize (stmt=0x158b58, param=0x120d80)
    at prepare_query.c:104
104             switch (*param->param_lenbind) {
(gdb) backtrace
#0  0xfef5c454 in _get_param_textsize (stmt=0x158b58, param=0x120d80)
    at prepare_query.c:104
#1  0xfef5c524 in _calculate_params_size (stmt=0x158b58) at
#2  0xfef5c8ac in start_parse_prepared_query (stmt=0x158b58)
    at prepare_query.c:331
#3  0xfef584f8 in SQLExecute (hstmt=0xffffffff) at odbc.c:1158
#4  0xff327d38 in SQLExecute (statement_handle=0x158580) at SQLExecute.c:288
#5  0x98900 in backsql_load_schema_map (si=0x121fe0, dbh=0x11f558)
    at schema-map.c:291
#6  0x9fb2c in backsql_get_db_conn (be=0x121f28, ldapc=0xffbef668,
    dbh=0xffbef664) at sql-wrap.c:462
#7  0x90120 in backsql_db_open (bd=0x121f28) at init.c:374
#8  0x3bcfc in backend_startup (be=0x0) at backend.c:321
#9  0x5c558 in slap_startup (be=0x0) at init.c:175
#10 0x1ddec in main (argc=3, argv=0xffbef99c) at main.c:512
----------- end gdb output ------------

---- begin snippit odbcinst.ini --------
Description  = v0.61 with TDS protocol 5.0
Driver  = /usr/local/lib/libtdsodbc.so
Setup  = /usr/local/lib/libtdsS.so
FileUsage  = 1
---- end snippit odbcinst.ini --------

----- begin snippit odbc.ini ----------
Driver  = TDS
Description  = ldap_db
TraceFile  = /tmp/odbcTrace.log
Trace   = on
Server   =  xxxxx.comms.unsw.edu.au
Database  = ldap
UID   = ldap
Port   = 4100
---------- end snippit odbc.ini ---------

--------- begin slapd.conf --------------
$OpenLDAP: pkg/ldap/servers/slapd/slapd.conf,v 2002/11/26 18:26:01
kurt Exp $
include  /usr/local/openldap/etc/openldap/schema/core.schema
include         /usr/local/openldap/etc/openldap/schema/cosine.schema
include         /usr/local/openldap/etc/openldap/schema/inetorgperson.schema

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

database        sql
suffix          "o=sql,c=RU"
rootdn          "cn=root,o=sql,c=RU"
rootpw          xxxxxx
dbname          ldap
dbuser          ldap
dbpasswd        xxxxxx
insentry_query  "insert into ldap_entries (id,dn,oc_map_id,parent,keyval)
values ((select max(id)+1 from ldap_entries),?,?,?,?)"
upper_func      "upper"
strcast_func    "text"
concat_pattern  "?||?"
has_ldapinfo_dn_ru      no
--------- end slapd.conf --------------

More information about the FreeTDS mailing list