It is (apparently) legal to have attributes named 'delete', though arguably
bad design. I inhereted such a schema, and the LDIF parser treated the
'delete' attibute as a directive, even though there was no preceding
'changetype', and raised an error.
I corrected for this by modifying LDAP::LDIF.parse_entry() as follows:
(starting on line 262 in version 1.11)
when 'add', 'delete', 'replace'
if change_type == LDAP_MOD_REPLACE
mod_type = case attr
when 'add' then LDAP_MOD_ADD
when 'delete' then LDAP_MOD_DELETE
when 'replace' then LDAP_MOD_REPLACE
end
mods[mod_type] ||= {}
mods[mod_type][val] ||= []
else
hash[attr] ||= []
hash[attr] << val
comment = false
# Make a note of this attribute if value is binary.
bvalues << attr if unsafe_char?( val )
end
It's not very DRY. I'm sure it can be handled better.