Matthew Backes wrote:
Opening the correct db based on entries present in the file seems fairly reasonable. I'd even consider re-opening different db's as necessary through the file if they include multiple suffixes, though that's more work.
As far as error messages, this removes the number of cases where someone would see a message, so it should help on the bad questions front. While delivering simple messages is good, it's rather silly to present errors when we can clearly identify what the user wants, the semantics are unambiguous, and there is a straightforward path to implementation.
In part, I favor Michael's argument. In fact, the only reason for preferring a picky slapadd is to avoid trouble. An experienced user will not likely get in trouble, like using a wrong ldif file instead of the right one. The inexperienced or incautious user would probably erroneously feel safe when the wrong ldif happens to load in the right, yet unintended database.
My favorite approach would be to have slapadd return more sophisticated and useful messages, like
the first entry "cn=foo,dc=z" seems to belong to database #X, whose suffix is "dc=z"; did you mean to use -n X (or -b "dc=z")?
With respect to the "smart" behavior Matthew suggests (loading multiple databases within one execution of slapadd), it looks definitely intriguing, but since it quite departs from the current behavior, I'd protect it behind an explicit switch (e.g. -b "", or -n "detect").
p.
Ing. Pierangelo Masarati OpenLDAP Core Team
SysNet s.r.l. via Dossi, 8 - 27100 Pavia - ITALIA http://www.sys-net.it ----------------------------------- Office: +39 02 23998309 Mobile: +39 333 4963172 Fax: +39 0382 476497 Email: ando@sys-net.it -----------------------------------