Hi, all,

I wanna set "backend perl" in my OpenLDAP configuration. 

I used "--enable-perl" option to enable the perl programming backend. From the config.log, it seems everything is fine. I list all the perl-related entries in the config.log as below. I also attach my config.log in case you want to check it.

---------------------------------------------------

configure:12106: checking for perl
configure:12124: found /usr/bin/perl
configure:12137: result: /usr/bin/perl
......
ac_cv_path_PERLBIN=/usr/bin/perl
.....
PERLBIN='/usr/bin/perl'
PERL_CPPFLAGS=' -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -I/usr/lib/perl/5.10/CORE '
......
SLAPD_PERL_LDFLAGS='-Wl,-E  -fstack-protector -L/usr/local/lib  -L/usr/lib/perl/5.10/CORE -lperl -ldl -lm -lpthread -lcrypt'

---------------------------------------------------

However, when I start the slapd, the server fails to start with the following message printed:

Mar 26 00:37:32 tianyin-desktop slapd[11062]: /home/tianyin/openldap-2.4.30/etc/openldap/slapd.conf: line 103: <backend> failed init (perl)!

I used GDB to trace the code and find the bomb point is in backend_info() as follows. slapd failed to find the corresponding backend information, and finally return NULL.

BackendInfo* backend_info(const char *type)
{
        BackendInfo *bi;

/* search for the backend type */
=>      LDAP_STAILQ_FOREACH(bi,&backendInfo,bi_next) {
                if( strcasecmp(bi->bi_type, type) == 0 ) {
                        return bi;
                }
        }

        return NULL;
}

The backtrace is:

#0  backend_info (type=0x91fb88 "perl") at backend.c:533
#1  0x000000000041f627 in config_generic (c=0x9201f0) at bconfig.c:1502
#2  0x0000000000434674 in config_set_vals (Conf=0x81a460, c=0x9201f0) at config.c:345
#3  0x0000000000434bd3 in config_add_vals (Conf=0x81a460, c=0x9201f0) at config.c:418
#4  0x0000000000435e27 in read_config_file (fname=0x5a5c40 "/home/tianyin/openldap-2.4.30/etc/openldap/slapd.conf", depth=0, cf=0x0, cft=0x81a1a0) at config.c:783
#5  0x00000000004290de in read_config (fname=0x0, dir=0x0) at bconfig.c:4213
#6  0x000000000041ccf7 in main (argc=1, argv=0x7fffffffe2f8) at main.c:792

Does anyone use the perl programmable backend before?

Thanks in advance!
Tianyin


--
Tianyin XU,
http://cseweb.ucsd.edu/~tixu/