1

I have a LDIF file which has a multi-value Base64-encoded attribute, and I'd like to convert it in non-Base64-encoded syntax. How can this be done?

Context

The LDIF file is as such:

dn: cn=johndoe,ou=clients,ou=management,dc=example,dc=com
changetype: modify
replace: foobarStatus
foobarStatus:: ZW5hYmxl... (Base64 string) ...ZCA9IHRydWU

where the decoded Base64 string is as such:

market = "US"
mgmt.account.mode = "X12"
foo.field = "Something"
bar.field = "Something else" 
...

Problem

When I try to import this LDIF file into a LDAP server via ldapmodify, I get an error:

ldapmodify: invalid format (line 4) entry: "cn=johndoe,ou=clients,ou=management,dc=example,dc=com"

I've been trying to solve this for a while but couldn't find the error. It could be some spurious character somewhere. Therefore I thought of converting the Base64 part of the LDIF and importing it on this format. The attribute values don't contain any non-printable ASCII (e.g. accented letters) so it should work fine.

Note

This could be a XY problem so if anyone has another suggestion, I'm eager to read it.

dr_
  • 2,400
  • 1
  • 25
  • 39

1 Answers1

0

It turns out ldapmodify doesn't like long lines. Therefore, after splitting the Base64 code here

foobarStatus:: ZW5hYmxl... (Base64 string) ...ZCA9IHRydWU

into multiple lines of 79 chars or less, ldapmodify was able to import it.

This solved my original problem. I'm leaving the solution here for future readers.

dr_
  • 2,400
  • 1
  • 25
  • 39