389ds / 389-ds-base

The enterprise-class Open Source LDAP server for Linux
https://www.port389.org/
Other
213 stars 93 forks source link

dsctl ldif2db should fail if suffix in LDIF doesn't correspond with the suffix in the destination database #2914

Open 389-ds-bot opened 4 years ago

389-ds-bot commented 4 years ago

Cloned from Pagure issue: https://pagure.io/389-ds-base/issue/49855


Issue Description

Previously, importing data using the "ldif2db" script failed when then specified database name didn't correspond with the suffix contained in the LDIF file. See also the in step 2: https://access.redhat.com/documentation/en-us/red_hat_directory_server/10/html/administration_guide/populating_directory_databases#Importing_from_the_Command_Line-Importing_Using_the_ldif2db_Command_Line_Script

The "dsctl ldif2db" imports the LDIF file in the mentioned scenario but, understandably, the data isn't accessible.

Package Version and Platform

389-Directory/1.4.0.11.20180716git6d4caac04 B2018.197.1151

Steps to reproduce

  1. Create a new instance with dc=example,dc=com suffix (default database name is "userRoot")
  2. Stop the instance
  3. Import the attached LDIF (contains dc=demo,dc=de entries) into the "userRoot" database.
  4. Start the instance

Actual results

Import is successful. No warning/error is displayed. Instance can be started. Imported data isn't accessible.

Expected results

Import should fail with an error.

demo.ldif

389-ds-bot commented 4 years ago

Comment from vashirov (@vashirov) at 2018-07-18 12:58:06

Hey Marc, could you please reattach demo.ldif file? I can't download it for some reason.

Thanks!

389-ds-bot commented 4 years ago

Comment from vashirov (@vashirov) at 2018-07-18 12:58:07

Metadata Update from @vashirov:

389-ds-bot commented 4 years ago

Comment from mmuehlfeldrh at 2018-07-18 13:34:54

demo.ldif.txt

I attached the file as a *.txt file.

I meanwhile noticed that the following message is shown when importing the file: INFO - import_main_offline - import userroot: Import complete. Processed 0 entries in 0 seconds. (0.00 entries/sec)

However, it's not very obvious that nothing was imported. And if the LDIF file contains multiple suffixes (e. g. dc=demo,dc=de and dc=example,dc=com), then the message lists only the number of imported dc=example,dc=com entries and nothing about the ignored records, which are not part of this suffix. This is confusing, if I expected that the whole file was imported, because I got no error.

389-ds-bot commented 4 years ago

Comment from mreynolds (@mreynolds389) at 2018-07-19 17:57:49

Metadata Update from @mreynolds389:

389-ds-bot commented 4 years ago

Comment from mreynolds (@mreynolds389) at 2018-11-26 15:58:06

FYI - ldif2db and "dsctl ldif2db" behave the same way. They both allow the LDIF file, and do not report any errors.

389-ds-bot commented 4 years ago

Comment from mreynolds (@mreynolds389) at 2020-02-12 17:01:32

Metadata Update from @mreynolds389: