When an attempt is made to use the InstallLdifFile option when scripting the installation of an LDAP server, the ns-slapd ldif2db command segfaults as follows:
(gdb) bt full #0 0x0000000000000000 in ?? () No symbol table info available. #1 0x00007ffff7b32180 in str2entry_dupcheck (rawdn=0x0, s=<value optimized out>, flags=3275, read_stateinfo=-1) at ldap/servers/slapd/entry.c:1103 valuecsnset = 0x0 value_state = 2 freeval = 0 attr_state = 2 bv_null = {bv_len = 0, bv_val = 0x0} e = 0x7fffd40009a0 stack_attrs = {{sa_type = 0x7fffd4000980 "changetype", sa_state = 2, sa_present_values = {num = 1, max = 4, va = 0x7fffd4000b50}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0x7ffff3c3d090 <cis_compare>, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = { a_type = 0x7fffd4000a80 "changeType", a_present_values = { va = 0x0}, a_flags = 4, a_plugin = 0x681700, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, { sa_type = 0x7fffd4000b80 "replace", sa_state = 2, sa_present_values = {num = 1, max = 4, va = 0x7fffd4000cd0}, ---Type <return> to continue, or q <return> to quit--- sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0, sa_vtree = 0x7fffd4000ca0, sa_attributedeletioncsn = 0x0, sa_attr = { a_type = 0x7fffd4000ba0 "replace", a_present_values = { va = 0x0}, a_flags = 4, a_plugin = 0x68fc80, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x68c280, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, { sa_type = 0x7fffd4000c10 "nsSSL3", sa_state = 2, sa_present_values = {num = 1, max = 4, va = 0x7fffd4000d70}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0x7ffff3c3d090 <cis_compare>, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = { a_type = 0x7fffd4000d00 "nsSSL3", a_present_values = {va = 0x0}, a_flags = 4, a_plugin = 0x681700, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, {sa_type = 0x0, sa_state = 0, sa_present_values = {num = 0, max = 0, va = 0x0}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = {a_type = 0x0, a_present_values = {va = 0x0}, a_flags = 0, a_plugin = 0x0, a_deleted_values = {va = 0x0}, ---Type <return> to continue, or q <return> to quit--- a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, {sa_type = 0x0, sa_state = 0, sa_present_values = {num = 0, max = 0, va = 0x0}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = {a_type = 0x0, a_present_values = {va = 0x0}, a_flags = 0, a_plugin = 0x0, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, {sa_type = 0x0, sa_state = 0, sa_present_values = {num = 0, max = 0, va = 0x0}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = {a_type = 0x0, a_present_values = {va = 0x0}, a_flags = 0, a_plugin = 0x0, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, {sa_type = 0x0, sa_state = 0, sa_present_values = {num = 0, max = 0, va = 0x0}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = {a_type = 0x0, a_present_values = {va = 0x0}, ---Type <return> to continue, or q <return> to quit--- a_flags = 0, a_plugin = 0x0, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, {sa_type = 0x0, sa_state = 0, sa_present_values = {num = 0, max = 0, va = 0x0}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0x7433c0, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = {a_type = 0x0, a_present_values = {va = 0x0}, a_flags = 0, a_plugin = 0x0, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, {sa_type = 0x0, sa_state = 0, sa_present_values = {num = 0, max = 0, va = 0x0}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = {a_type = 0x0, a_present_values = {va = 0x0}, a_flags = 0, a_plugin = 0x0, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}} <repeats 47 times>, {sa_type = 0x0, sa_state = -738194464, sa_present_values = {num = 7615424, max = 0, va = 0x7ffff7ddc280}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0, ---Type <return> to continue, or q <return> to quit--- sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = { a_type = 0x0, a_present_values = {va = 0x0}, a_flags = 0, a_plugin = 0x7fffd4000be0, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x7fffd4000910, a_mr_eq_plugin = 0x7ffff7ba7c72, a_mr_ord_plugin = 0xffffffff00000001, a_mr_sub_plugin = 0xffffffffffffffff}}, { sa_type = 0xffffffff <Address 0xffffffff out of bounds>, sa_state = 1, sa_present_values = {num = 0, max = -1, va = 0x100000002}, sa_deleted_values = {num = 0, max = 1, va = 0x100000000}, sa_numdups = 0, sa_comparefn = 0, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = { a_type = 0x0, a_present_values = {va = 0x0}, a_flags = 0, a_plugin = 0x0, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, {sa_type = 0x0, sa_state = 0, sa_present_values = {num = 0, max = 0, va = 0x0}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = {a_type = 0x0, a_present_values = {va = 0x0}, a_flags = 0, a_plugin = 0x0, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, ---Type <return> to continue, or q <return> to quit--- a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, {sa_type = 0x0, sa_state = 0, sa_present_values = {num = 0, max = 0, va = 0x0}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = {a_type = 0x0, a_present_values = {va = 0x0}, a_flags = 0, a_plugin = 0x0, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, {sa_type = 0x0, sa_state = 0, sa_present_values = {num = 0, max = 0, va = 0x0}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = {a_type = 0x0, a_present_values = {va = 0x0}, a_flags = 0, a_plugin = 0x0, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, {sa_type = 0x0, sa_state = 0, sa_present_values = {num = 0, max = 0, va = 0x0}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = {a_type = 0x0, a_present_values = {va = 0x0}, a_flags = 0, a_plugin = 0x0, a_deleted_values = {va = 0x0}, ---Type <return> to continue, or q <return> to quit--- a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, {sa_type = 0x0, sa_state = 0, sa_present_values = {num = 0, max = 0, va = 0x0}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = {a_type = 0x0, a_present_values = {va = 0x0}, a_flags = 0, a_plugin = 0x0, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, {sa_type = 0x0, sa_state = 0, sa_present_values = {num = 0, max = 0, va = 0x0}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = {a_type = 0x0, a_present_values = {va = 0x0}, a_flags = 0, a_plugin = 0x0, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}, {sa_type = 0x0, sa_state = 0, sa_present_values = {num = 0, max = 0, va = 0x0}, sa_deleted_values = {num = 0, max = 0, va = 0x0}, sa_numdups = 0, sa_comparefn = 0, sa_vtree = 0x0, sa_attributedeletioncsn = 0x0, sa_attr = {a_type = 0x0, a_present_values = {va = 0x0}, ---Type <return> to continue, or q <return> to quit--- a_flags = 0, a_plugin = 0x0, a_deleted_values = {va = 0x0}, a_listtofree = 0x0, a_next = 0x0, a_deletioncsn = 0x0, a_mr_eq_plugin = 0x0, a_mr_ord_plugin = 0x0, a_mr_sub_plugin = 0x0}}} dyn_attrs = 0x0 attrs = 0x7fffeada1100 prev_attr = 0x7fffeada11a8 nattrs = 3 maxattrs = 64 type = <value optimized out> bvtype = {bv_len = 7, bv_val = 0x7fffd4003e65 "replace"} sa = 0x7fffeada11a8 i = <value optimized out> j = <value optimized out> next = 0x7fffd4003e7e "nsSSLClientAuth: allowed\n-\nadd: nsSSL3Ciphers\nnsSSL3Ciphers: -rsa_null_md5,+rsa_rc4_128_md5,+rsa_rc4_40_md5,+rsa_rc2_40_md5,\n+rsa_des_sha,+rsa_fips_des_sha,+rsa_3des_sha,+rsa_fips_3des_sha,+fortezza,\n"... valuecharptr = 0x7fffeada3b20 "\017" bvvalue = {bv_len = 15, bv_val = 0x7fffd4003e6e "nsSSLClientAuth"} rc = 0 fast_dup_check = 1 ea = 0x0 ---Type <return> to continue, or q <return> to quit--- tree_attr_checking = 0 big_entry_attr_presence_check = 0 check_for_duplicate_values = 1 value = 0x7fffd4000da0 attributedeletioncsn = 0x0 maxcsn = 0x0 normdn = 0x7fffd4000930 "cn=encryption,cn=config" strict = 0 #2 0x00007ffff7b32800 in slapi_str2entry_ext ( normdn=0x7fffd4000950 "cn=encryption,cn=config", s=0x7fffd4003e00 "# enable SSL3 encryption", flags=1227) at ldap/servers/slapd/entry.c:1407 e = <value optimized out> read_stateinfo = -1 #3 0x00007fffecf502d1 in import_producer (param=<value optimized out>) at ldap/servers/slapd/back-ldbm/import-threads.c:547 dn = 0x0 normdn = 0x7fffd4000950 "cn=encryption,cn=config" rc = <value optimized out> flags = 203 prev_lineno = 12 lines_in_entry = 15 syntax_err = 0 ---Type <return> to continue, or q <return> to quit--- info = <value optimized out> job = 0x8abce0 id = <value optimized out> id_filestart = <value optimized out> e = <value optimized out> ep = 0x0 old_ep = 0x0 inst = 0x829700 be = 0x829620 sleeptime = <value optimized out> estr = 0x7fffd4003e00 "# enable SSL3 encryption" str2entry_flags = <value optimized out> finished = 0 fd = 14 curr_file = 0 curr_lineno = 27 curr_filename = <value optimized out> idx = 0 c = { b = 0x7fffd4001df0 "# set the IP address for unencrypted access\ndn: cn=config\nchangetype: modify\nreplace: nsslapd-listenhost\nnsslapd-listenhost: 127.0.0.1\n\n# set the IP address for encrypted access\ndn: cn=config\nchangety"..., size = 1712, offset = 766} ---Type <return> to continue, or q <return> to quit--- my_version = -1 newesize = <value optimized out> attr = 0x0 #4 0x00007ffff5fa29e3 in ?? () from /usr/lib64/libnspr4.so No symbol table info available. #5 0x00007ffff5945851 in start_thread () from /lib64/libpthread.so.0 No symbol table info available. #6 0x00007ffff569311d in clone () from /lib64/libc.so.6 No symbol table info available.
The LDIF file being imported looks like this:
# set the IP address for unencrypted access dn: cn=config changetype: modify replace: nsslapd-listenhost nsslapd-listenhost: 127.0.0.1 # set the IP address for encrypted access dn: cn=config changetype: modify replace: nsslapd-securelistenhost nsslapd-securelistenhost: 127.0.0.1 # enable SSL3 encryption dn: cn=encryption,cn=config changetype: modify replace: nsSSL3 nsSSL3: on - replace: nsSSLClientAuth nsSSLClientAuth: allowed - add: nsSSL3Ciphers nsSSL3Ciphers: -rsa_null_md5,+rsa_rc4_128_md5,+rsa_rc4_40_md5,+rsa_rc2_40_md5, +rsa_des_sha,+rsa_fips_des_sha,+rsa_3des_sha,+rsa_fips_3des_sha,+fortezza, +fortezza_rc4_128_sha,+fortezza_null,+tls_rsa_export1024_with_rc4_56_sha, +tls_rsa_export1024_with_des_cbc_sha,-rc4,-rc4export,-rc2,-rc2export,-des,-desede3 # turn on security dn: cn=config changetype: modify add: nsslapd-security nsslapd-security: on # set the identity of the server certificate to use dn: cn=RSA,cn=encryption,cn=config changetype: add objectclass: top objectclass: nsEncryptionModule cn: RSA nsSSLPersonalitySSL: ldap.example.com-cert nsSSLToken: internal (software) nsSSLActivation: on # enable the changelog for replication dn: cn=changelog5,cn=config objectclass: top objectclass: extensibleObject cn: changelog5 nsslapd-changelogdir: /var/lib/dirsrv/slapd-template/changelogdb nsslapd-changelogmaxage: 10d # enable the supplier replica dn: cn=replica,cn="dc=devel,dc=example,dc=com",cn=mapping tree,cn=config objectclass: top objectclass: nsds5replica objectclass: extensibleObject cn: replica nsds5replicaroot: dc=devel,dc=example,dc=com nsds5replicaid: 7 nsds5replicatype: 3 nsds5flags: 1 nsds5ReplicaPurgeDelay: 604800 nsds5ReplicaBindDN: cn=replication manager,cn=config
The segfault occurs on the following line:
if (0 == sa->sa_comparefn(slapi_value_get_berval(value),slapi_value_get_berval(sa->sa_present_values.va[j])))/* JCM innards */
The file you are trying to "import" is not the right format for import. Please use ldapmodify command. ldapmodify <option> -f /path/to/LDIF_file
The ldif2db does not take "changetype". Also, ldif2db is for the entries in the database. "cn=config" is one of the special DIT's which are not stored in the database, but it is in the config file /etc/dirsrv/slapd-<YOURID>/dse.ldif.
We should fix this so an error message is reported instead of crashing.
Bug description: If an attribute type having multiple values exists in an entry, and any compare function is not associated with the attribute type, fast_dup_check flag was not disabled from the second time. Since fast_dup_check requires the compare function based on the attribute syntax, it causes the segfault.
Fix description: This patch checks whether a compare function is associated with the multi-valued attribute not just at the first time the attribute type appears but at the second time and after, and disable fast_dup_check properly if needed.
git patch file (master) 0001-Ticket-545-Segfault-during-initial-LDIF-import-str2e.patch
Reviewed by Rich (Thank you!!)
Pushed to master: commit 8bea554
Ticket has been cloned to Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=918713
Metadata Update from @nhosoi: - Issue assigned to nhosoi - Issue set to the milestone: 1.3.1
389-ds-base is moving from Pagure to Github. This means that new issues and pull requests will be accepted only in 389-ds-base's github repository.
This issue has been cloned to Github and is available here: - https://github.com/389ds/389-ds-base/issues/545
If you want to receive further updates on the issue, please navigate to the github issue and click on subscribe button.
subscribe
Thank you for understanding. We apologize for all inconvenience.
Metadata Update from @spichugi: - Issue close_status updated to: wontfix (was: Fixed)
Login to comment on this ticket.