Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running the latest version of LDAP on XUbuntu 12.4 LTS and it works pretty fine as long as I use hdb or bdb as the backend. Nevertheless when I change the backend to sql and try to restart the slapd service I receive a segfault error.

I suppose I still have a very basic understanding problem of how ldap and sql backend works. I would like to know that simply setting the backend to sql in slqpd.conf is enough to connect ldap and the backend or all tables and relationships should be first created? I am asking this because I first want to make sure that ldap and sql work together then start creating tables and filling in them with data. Otherwise I would like to know that the error I receive is because ldap cannot at all connect to the backend or because there is no table in the database?

I have followed darold.net tutorial.

I have done my installation as follows:

First I installed ldap and configured it with hdb and it works very well:

ali@server1:/sudo apt-get install slapd ldap-utils

Then I installed Postgresql and odbc drivers:

ali@server1:/sudo apt-get install postgresql
ali@server1:/sudo apt-get install unixodbc odbc-postgresql

Then I chnged the postgres password:

ali@server1:/sudo -u postgres psql postgres
postgres=#\password

Next I modified odbc.ini and odbcinst.ini in /etc/

/etc/odbc.ini:

[ODBC Data Sources]
PgSQL=PostgreSQL

[PgSQL]
; WARNING: The old psql odbc driver psqlodbc.so is now renamed psqlodbcw.so
; in version 08.x. Note that the library can also be installed under an other
; path than /usr/local/lib/ following your installation.
Driver=/usr/local/lib/psqlodbcw.so
Description=Connection to LDAP/POSTGRESQL
Servername=localhost
Port=5432
Protocol=6.4
FetchBufferSize=99
Username=test
Password=test
Database=pg_ldap
ReadOnly=no
Debug=1
CommLog=1

[ODBC]
InstallDir=/usr/local/lib
since psqlodbcw.so didn't exist after installation, I copied it manually to /usr/local/lib/

/etc/odbcinst.ini:

[PostgreSQL]
Description=ODBC for PostgreSQL
Driver=/usr/local/lib/psqlodbcw.so

[ODBC]
Trace=1
Debug=1
Pooling=No

Then I created a test user and a database:

ali@server1:/sudo –u postgres psql postgres

postgres=#CREATE DATABASE pg_ldap;
postgres=#CREATE USER test with PASSWORD ‘test’;

And I gave the password 'test' at prompt.

postgres=#GRANT ALL PRIVILEGES ON DATABASE pg_ldap to test;
postgres=#psql pg_ldap  < backsql_create.sql
postgres=#psql -d pg_ldap < testdb_create.sql
postgres=#psql -d pg_ldap < testdb_metadata.sql

I also modified 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

# Define global ACLs to disable default read access.
# Define global ACLs to disable default read access.
access to *
        by self write
        by * read
access to * by dn="cn=admin,dc=example,dc=local" write

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

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

database        sql
suffix         "dc=example,dc=local"
rootdn         "cn=admin,dc=example,dc=local"
rootpw          secret
dbname          PgSQL
dbuser          test
dbpasswd        test
insentry_stmt  "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

lastmod off

I tested odbc driver by running:

isql -v PgSQL test test

and it works.

Here is backtrace of slapd:

(gdb) start
Temporary breakpoint 1 at 0x12a86
Starting program: /usr/sbin/slapd 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".

Temporary breakpoint 1, 0x80012a86 in main ()

Slapd daemon runs under the user "openldap" and group "openldap" ldap version:

ali@server1:/tmp$ slapd -V
@(#) $OpenLDAP: slapd  (Oct 17 2012 19:48:49) $
    buildd@panlong:/build/buildd/openldap-2.4.28/debian/build/servers/slapd

I am a beginner and maybe I am making a very basic mistake or forget an important step. Any help will be highly appreciated.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.