Issue 7573 - back-perl not working with cn=config
Summary: back-perl not working with cn=config
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.34
Hardware: All All
: --- normal
Target Milestone: 2.4.51
Assignee: Ryan Tandy
URL:
Keywords:
: 8591 (view as issue list)
Depends on:
Blocks:
 
Reported: 2013-04-11 18:20 UTC by benintechnologies@yahoo.fr
Modified: 2020-08-19 16:22 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description benintechnologies@yahoo.fr 2013-04-11 18:20:27 UTC
Full_Name: Ben
Version: 2.4.34
OS: Debian 6.0.4
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (41.79.217.116)


Hi,

I'm unable to set up a back-perl backend directly in cn=config mode. However, if
I set it up in slapd.conf mode, and then convert it to cn=config mode, it works
fine. It's not convenient, because I have to set all my perl backends up before
converting to cn=config.

Here's the ldif file I'm using to set up a back-perl backend in cn=config mode
(it's inspired from the files I get by converting slapd.conf into cn=config with
slaptest)

# Load dynamic backend modules
dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
olcModulepath: /usr/local/libexec/openldap
olcModuleload: back_perl.la

# Database settings
dn: olcDatabase=perl,cn=config
objectClass: olcDatabaseConfig
objectClass: olcDbPerlConfig
olcDatabase: perl
olcSuffix: dc=mydomain,dc=org
olcAddContentAcl: FALSE
olcLastMod: TRUE
olcMaxDerefDepth: 15
olcReadOnly: FALSE
olcRootDN: cn=Manager,dc=mydomain,dc=org
olcRootPW:: c2VjcmV0
olcSyncUseSubentry: FALSE
olcMonitoring: FALSE
olcPerlModulePath: /usr/local/etc/openldap/perl
olcPerlModule: SampleLDAP
olcPerlFilterSearchResults: FALSE


And here's what I get when I try to load the file:
ldapadd -Y EXTERNAL -H ldapi:/// -f perl-backend.ldif
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
adding new entry "cn=module,cn=config"
adding new entry "olcDatabase=perl,cn=config"
ldap_result: Can't contact LDAP server (-1)

After that, if I start OpenLDAP I get a segmentation fault:
root@ldap:/tmp# /usr/local/libexec/slapd -u openldap -g openldap -h "ldap:///
ldapi:///" -d 16383
�.
51585496 perl backend db init
Segmentation fault

Like I said, if I set back-perl up in slapd.conf mode and then convert it to
cn=config, everything works fine.

Ben
Comment 1 Quanah Gibson-Mount 2013-04-11 18:23:33 UTC
--On Thursday, April 11, 2013 6:20 PM +0000 benintechnologies@yahoo.fr 
wrote:

> Like I said, if I set back-perl up in slapd.conf mode and then convert it
> to cn=config, everything works fine.

So how does the ldif generated by slaptest differ from what you are loading?

If you slapcat your config that doesn't work, and compare it to the slapcat 
of what was generated from slaptest, what are the differences?

Can you provide a gdb backtrace of the segmentation fault?

--Quanah


--

Quanah Gibson-Mount
Sr. Member of Technical Staff
Zimbra, Inc
A Division of VMware, Inc.
--------------------
Zimbra ::  the leader in open source messaging and collaboration

Comment 2 Howard Chu 2013-10-12 17:24:08 UTC
changed state Open to Suspended
Comment 3 Howard Chu 2013-10-13 00:18:54 UTC
benintechnologies@yahoo.fr wrote:
> Full_Name: Ben
> Version: 2.4.34
> OS: Debian 6.0.4
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (41.79.217.116)
>
>
> Hi,
>
> I'm unable to set up a back-perl backend directly in cn=config mode. However, if
> I set it up in slapd.conf mode, and then convert it to cn=config mode, it works
> fine. It's not convenient, because I have to set all my perl backends up before
> converting to cn=config.

The crash is deep inside libperl.

It appears to affect other platforms as well:
    https://bugzilla.redhat.com/show_bug.cgi?id=967719

Most likey you will need to build your own libperl in order to fix this, tho 
at the moment I have no idea what perl configuration changes will be required.

5259e408 conn=1000 op=1 do_add
ber_scanf fmt ({m) ber:
5259e408 conn=1000 op=1 do_add: dn (olcDatabase=perl,cn=config)
ber_scanf fmt ({m{W}}) ber:
ber_scanf fmt ({m{W}}) ber:
ber_scanf fmt ({m{W}}) ber:
ber_scanf fmt ({m{W}}) ber:
ber_scanf fmt ({m{W}}) ber:
ber_scanf fmt ({m{W}}) ber:
ber_scanf fmt ({m{W}}) ber:
ber_scanf fmt ({m{W}}) ber:
ber_scanf fmt ({m{W}}) ber:
ber_scanf fmt ({m{W}}) ber:
ber_scanf fmt ({m{W}}) ber:
ber_scanf fmt ({m{W}}) ber:
ber_scanf fmt ({m{W}}) ber:
ber_scanf fmt ({m{W}}) ber:
ber_scanf fmt (}) ber:
5259e408 >>> dnPrettyNormal: <olcDatabase=perl,cn=config>
=> ldap_bv2dn(olcDatabase=perl,cn=config,0)
<= ldap_bv2dn(olcDatabase=perl,cn=config)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(olcDatabase=perl,cn=config)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(olcDatabase=perl,cn=config)=0
5259e408 <<< dnPrettyNormal: <olcDatabase=perl,cn=config>, 
<olcDatabase=perl,cn=config>
5259e408 >>> dnPretty: <dc=mydomain,dc=org>
=> ldap_bv2dn(dc=mydomain,dc=org,0)
<= ldap_bv2dn(dc=mydomain,dc=org)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(dc=mydomain,dc=org)=0
5259e408 <<< dnPretty: <dc=mydomain,dc=org>
5259e408 >>> dnNormalize: <dc=mydomain,dc=org>
=> ldap_bv2dn(dc=mydomain,dc=org,0)
<= ldap_bv2dn(dc=mydomain,dc=org)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(dc=mydomain,dc=org)=0
5259e408 <<< dnNormalize: <dc=mydomain,dc=org>
5259e408 >>> dnPretty: <cn=Manager,dc=mydomain,dc=org>
=> ldap_bv2dn(cn=Manager,dc=mydomain,dc=org,0)
<= ldap_bv2dn(cn=Manager,dc=mydomain,dc=org)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(cn=Manager,dc=mydomain,dc=org)=0
5259e408 <<< dnPretty: <cn=Manager,dc=mydomain,dc=org>
5259e408 >>> dnNormalize: <cn=Manager,dc=mydomain,dc=org>
=> ldap_bv2dn(cn=Manager,dc=mydomain,dc=org,0)
<= ldap_bv2dn(cn=Manager,dc=mydomain,dc=org)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(cn=manager,dc=mydomain,dc=org)=0
5259e408 <<< dnNormalize: <cn=manager,dc=mydomain,dc=org>
5259e408 oc_check_required entry (olcDatabase=perl,cn=config), objectClass 
"olcDbPerlConfig"
5259e408 oc_check_allowed type "objectClass"
5259e408 oc_check_allowed type "olcDatabase"
5259e408 oc_check_allowed type "olcSuffix"
5259e408 oc_check_allowed type "olcAddContentAcl"
5259e408 oc_check_allowed type "olcLastMod"
5259e408 oc_check_allowed type "olcMaxDerefDepth"
5259e408 oc_check_allowed type "olcReadOnly"
5259e408 oc_check_allowed type "olcRootDN"
5259e408 oc_check_allowed type "olcRootPW"
5259e408 oc_check_allowed type "olcSyncUseSubentry"
5259e408 oc_check_allowed type "olcMonitoring"
5259e408 oc_check_allowed type "olcPerlModulePath"
5259e408 oc_check_allowed type "olcPerlModule"
5259e408 oc_check_allowed type "olcPerlFilterSearchResults"
5259e408 oc_check_allowed type "structuralObjectClass"
5259e408 >>> dnNormalize: <olcDatabase={3}perl>
5259e408 <<< dnNormalize: <olcDatabase={3}perl>
5259e408 >>> dnPrettyNormal: <dc=mydomain,dc=org>
=> ldap_bv2dn(dc=mydomain,dc=org,0)
<= ldap_bv2dn(dc=mydomain,dc=org)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(dc=mydomain,dc=org)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(dc=mydomain,dc=org)=0
5259e408 <<< dnPrettyNormal: <dc=mydomain,dc=org>, <dc=mydomain,dc=org>
5259e408 >>> dnPrettyNormal: <cn=Manager,dc=mydomain,dc=org>
=> ldap_bv2dn(cn=Manager,dc=mydomain,dc=org,0)
<= ldap_bv2dn(cn=Manager,dc=mydomain,dc=org)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(cn=Manager,dc=mydomain,dc=org)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(cn=manager,dc=mydomain,dc=org)=0
5259e408 <<< dnPrettyNormal: <cn=Manager,dc=mydomain,dc=org>, 
<cn=manager,dc=mydomain,dc=org>
5259e408 perl backend db init

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffebfff700 (LWP 20520)]
0x00007ffff74f5b7d in Perl_gv_fetchpvn_flags () from /usr/lib/libperl.so.5.14
(gdb) bt
#0  0x00007ffff74f5b7d in Perl_gv_fetchpvn_flags () from /usr/lib/libperl.so.5.14
#1  0x00007ffff74ea3ed in Perl_get_hv () from /usr/lib/libperl.so.5.14
#2  0x00007ffff00a1241 in boot_Fcntl () from 
/usr/lib/perl/5.14/auto/Fcntl/Fcntl.so
#3  0x00007ffff755982f in Perl_pp_entersub () from /usr/lib/libperl.so.5.14
#4  0x00007ffff7550cc6 in Perl_runops_standard () from /usr/lib/libperl.so.5.14
#5  0x00007ffff74ec5ee in Perl_call_sv () from /usr/lib/libperl.so.5.14
#6  0x00007ffff74ecc2d in Perl_call_list () from /usr/lib/libperl.so.5.14
#7  0x00007ffff74d6739 in ?? () from /usr/lib/libperl.so.5.14
#8  0x00007ffff74e3e11 in Perl_newATTRSUB () from /usr/lib/libperl.so.5.14
#9  0x00007ffff74e4518 in Perl_utilize () from /usr/lib/libperl.so.5.14
#10 0x00007ffff7512b3f in Perl_yyparse () from /usr/lib/libperl.so.5.14
#11 0x00007ffff758b38d in ?? () from /usr/lib/libperl.so.5.14
#12 0x00007ffff7595821 in Perl_pp_require () from /usr/lib/libperl.so.5.14
#13 0x00007ffff7550cc6 in Perl_runops_standard () from /usr/lib/libperl.so.5.14
#14 0x00007ffff74ec5ee in Perl_call_sv () from /usr/lib/libperl.so.5.14
#15 0x00007ffff74ecc2d in Perl_call_list () from /usr/lib/libperl.so.5.14
#16 0x00007ffff74d6739 in ?? () from /usr/lib/libperl.so.5.14
#17 0x00007ffff74e3e11 in Perl_newATTRSUB () from /usr/lib/libperl.so.5.14
#18 0x00007ffff74e4518 in Perl_utilize () from /usr/lib/libperl.so.5.14
#19 0x00007ffff7512b3f in Perl_yyparse () from /usr/lib/libperl.so.5.14
#20 0x00007ffff758b38d in ?? () from /usr/lib/libperl.so.5.14
#21 0x00007ffff7595821 in Perl_pp_require () from /usr/lib/libperl.so.5.14
#22 0x00007ffff7550cc6 in Perl_runops_standard () from /usr/lib/libperl.so.5.14
#23 0x00007ffff74ec5ee in Perl_call_sv () from /usr/lib/libperl.so.5.14
#24 0x00007ffff74ecc2d in Perl_call_list () from /usr/lib/libperl.so.5.14
#25 0x00007ffff74d6739 in ?? () from /usr/lib/libperl.so.5.14
#26 0x00007ffff74e3e11 in Perl_newATTRSUB () from /usr/lib/libperl.so.5.14
#27 0x00007ffff74e4518 in Perl_utilize () from /usr/lib/libperl.so.5.14
#28 0x00007ffff7512b3f in Perl_yyparse () from /usr/lib/libperl.so.5.14
#29 0x00007ffff758b38d in ?? () from /usr/lib/libperl.so.5.14
#30 0x00007ffff7596824 in Perl_pp_entereval () from /usr/lib/libperl.so.5.14
#31 0x00007ffff74ebd31 in Perl_eval_sv () from /usr/lib/libperl.so.5.14
#32 0x00007ffff74ebe84 in Perl_eval_pv () from /usr/lib/libperl.so.5.14
---Type <return> to continue, or q <return> to quit---
#33 0x00000000005f345a in perl_cf (c=0x7fffebffd2f0) at 
../../../../head/servers/slapd/back-perl/config.c:177
#34 0x0000000000442a7b in config_set_vals (Conf=0x90ed60, c=0x7fffebffd2f0) at 
../../../head/servers/slapd/config.c:345
#35 0x0000000000442fcf in config_add_vals (Conf=0x90ed60, c=0x7fffebffd2f0) at 
../../../head/servers/slapd/config.c:418
#36 0x0000000000443c9a in config_parse_add (ct=0x90ed60, c=0x7fffebffd2f0, 
valx=0) at ../../../head/servers/slapd/config.c:689
#37 0x0000000000439c1b in config_add_internal (cfb=0x9105e0, e=0xa52bb8, 
ca=0x7fffebffd2f0, rs=0x7fffebffe970,
     renum=0x7fffebffd2e8, op=0x7fffe4002670) at 
../../../head/servers/slapd/bconfig.c:5439
#38 0x000000000043a83e in config_back_add (op=0x7fffe4002670, 
rs=0x7fffebffe970) at ../../../head/servers/slapd/bconfig.c:5666
#39 0x000000000045ba65 in fe_op_add (op=0x7fffe4002670, rs=0x7fffebffe970) at 
../../../head/servers/slapd/add.c:334
#40 0x000000000045b2e2 in do_add (op=0x7fffe4002670, rs=0x7fffebffe970) at 
../../../head/servers/slapd/add.c:194
#41 0x00000000004524a1 in connection_operation (ctx=0x7fffebffeb60, 
arg_v=0x7fffe4002670)
     at ../../../head/servers/slapd/connection.c:1134
#42 0x0000000000452b1b in connection_read_thread (ctx=0x7fffebffeb60, 
argv=<optimized out>)
     at ../../../head/servers/slapd/connection.c:1270
#43 0x000000000061435a in ldap_int_thread_pool_wrapper (xpool=0x9e4d00) at 
../../../head/libraries/libldap_r/tpool.c:945
#44 0x00007ffff728ee9a in start_thread (arg=0x7fffebfff700) at 
pthread_create.c:308
#45 0x00007ffff62f6cbd in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#46 0x0000000000000000 in ?? ()


>
> Here's the ldif file I'm using to set up a back-perl backend in cn=config mode
> (it's inspired from the files I get by converting slapd.conf into cn=config with
> slaptest)
>
> # Load dynamic backend modules
> dn: cn=module,cn=config
> objectClass: olcModuleList
> cn: module
> olcModulepath: /usr/local/libexec/openldap
> olcModuleload: back_perl.la
>
> # Database settings
> dn: olcDatabase=perl,cn=config
> objectClass: olcDatabaseConfig
> objectClass: olcDbPerlConfig
> olcDatabase: perl
> olcSuffix: dc=mydomain,dc=org
> olcAddContentAcl: FALSE
> olcLastMod: TRUE
> olcMaxDerefDepth: 15
> olcReadOnly: FALSE
> olcRootDN: cn=Manager,dc=mydomain,dc=org
> olcRootPW:: c2VjcmV0
> olcSyncUseSubentry: FALSE
> olcMonitoring: FALSE
> olcPerlModulePath: /usr/local/etc/openldap/perl
> olcPerlModule: SampleLDAP
> olcPerlFilterSearchResults: FALSE
>
>
> And here's what I get when I try to load the file:
> ldapadd -Y EXTERNAL -H ldapi:/// -f perl-backend.ldif
> SASL/EXTERNAL authentication started
> SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
> SASL SSF: 0
> adding new entry "cn=module,cn=config"
> adding new entry "olcDatabase=perl,cn=config"
> ldap_result: Can't contact LDAP server (-1)
>
> After that, if I start OpenLDAP I get a segmentation fault:
> root@ldap:/tmp# /usr/local/libexec/slapd -u openldap -g openldap -h "ldap:///
> ldapi:///" -d 16383
> ….
> 51585496 perl backend db init
> Segmentation fault
>
> Like I said, if I set back-perl up in slapd.conf mode and then convert it to
> cn=config, everything works fine.
>
> Ben
>
>


-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 4 Quanah Gibson-Mount 2017-04-13 15:27:47 UTC
moved from Incoming to Software Bugs
Comment 5 Ryan Tandy 2020-04-26 17:36:51 UTC
*** Issue 8591 has been marked as a duplicate of this issue. ***
Comment 7 Quanah Gibson-Mount 2020-04-27 21:55:44 UTC
commit 8f174209e112d6937d871de7eb410105e076d3d4
Author: Ryan Tandy <ryan@nardis.ca>
Date:   Sun Apr 26 10:46:22 2020 -0700

    ITS#7573 Fix back-perl dynamic config with threaded slapd

commit 10cc52ca4cbaa2d3ac365c6223969b42725c9854
Author: Ryan Tandy <ryan@nardis.ca>
Date:   Sun Apr 26 17:38:29 2020 +0000

    ITS#7573 Create regression test
Comment 8 Quanah Gibson-Mount 2020-05-12 15:09:55 UTC
RE24:

  • 8c7f26b1 
by Ryan Tandy at 2020-05-12T15:07:21+00:00 
ITS#7573 Fix back-perl dynamic config with threaded slapd