10

When attempting to load the following configuration

dn: olcDatabase={1}hdb,cn=config
changetype: modify
add: olcMirrorMode 
olcMirrorMode: TRUE

I get the following error:

root@box:~# ldapadd -Y EXTERNAL -H ldapi:/// -f mirrormode.ldif 
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
ldapadd: wrong attributeType at line 4, entry "olcDatabase={1}hdb,cn=config"

It looks fine to me -- what's the problem?

3 Answers 3

19

The problem turned out to be a trailing space on on this line:

add: olcMirrorMode 

Grrr!

7
  • How did you find out? May 23, 2014 at 6:01
  • 1
    Not sure if you use vim, but: github.com/itspriddle/vim-stripper Jan 22, 2016 at 15:02
  • 2
    Thanks @seb ! @RelaXNow : to see if you have any (export GREP_COLOR='0;41'; grep --col -Enm5 '\s+$' your.ldif) to remove: sed -ri 's,\s+$,,g' your.ldif
    – Boop
    Feb 24, 2017 at 18:52
  • 2
    A space in a line, which should be empty, is also fun.
    – ceving
    Feb 19, 2019 at 16:01
  • 2
    @Boop: no need for the subshell or the export (just remove the semicolon): GREP_COLOR='0;41' grep --col -Enm5 '\s+$' your.ldif Jul 25, 2019 at 17:50
2

I've stepped on the same rake today, but there were no trailing spaces, there were another hidden joke.

My colleague have sent me a sample LDIF with a question, I tried to reproduce the problem he encountered by copying the text from the colleague's message. I've been struggling to understand what is wrong for an hour, before I understood that there was Unicode symbol U+00A0 (0xC2 0xA0) instead of ASCII SPACE (0x20).

Thanks to vim and its syntax highlighting, vim was desperately trying to give me a clue: vim tries to give a clue

0

In my case I missed to put a hyphen between multiple updates.

Wrong:

dn: cn=John Doe,ou=user,dc=example,dc=com
changetype: modify
add: disabled
disabled: 0
add: activity
activity: INACTIVE
ldapmodify: wrong attributeType at line 5, entry "cn=John Doe,ou=user,dc=example,dc=com"

Correct:

dn: cn=John Doe,ou=user,dc=example,dc=com
changetype: modify
add: disabled
disabled: 0
-
add: activity
activity: INACTIVE

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .