This all looks correct. You simply have to correctly parse the LDIF
See RFC 2849 for the details. And use a decent LDIF parser for your
scripting language and not some home-grown bash/sed/awk/whatever
fail for such a simple thing.
I am not quite sure, if I understand it correctly.
I made the ldif using slapcat. Slapcat used to Base64 encode the
188.8.131.52.4.1.14184.108.40.206.5 syntax. Now it doesn't do that anymore. But
due to this change slapadd is not able to import this file.
So I simply use slapcat and slapadd, but now slapadd fails.
I am not using any other tools, only OpenLDAP tools.
And if I only use OpenLDAP tools everything should work correctly,
That's why I think there is a bug in slapcat. But if you think slapcat
works correctly I could also say: There is a bug in slapadd, because it
can't import the ldif generated by slapcat.