[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: how to replace multiple attributes?



On Thursday 15 January 2009 03:46:00 Adam Williams wrote:
> Philip Guenther wrote:
> > That input looks okay to me and similar looking input works with
> > ldapmodify in my testing.  My guess is that there's something invisible
> > in the file that's breaking the parse.  For example, trailing whitespace
> > on the "-" lines is invalid and will result in errors like the above.  I
> > suggest you look at the output of
> > 	cat -vet profilepaths.ldif
> >
> > and make sure the '$' that that command puts at the end of each line is
> > where you expect it to be and that there's no otherwise hidden control
> > characters.
> >
> >
> > Philip Guenther
>
> thanks, cat'ing it looks ok to me, each line ends in ^M$ with no
> whitespace.

While LDIF may allow ^M, in general it is probably a good idea to not consider 
the presence of DOS line endings as "ok" (e.g., you will have problems with 
executing scripts by abusing the "hashbang" to invoke the interpreter etc.).

> [root@roark ldap]# cat -vet profilepaths.ldif
> dn: uid=panderson,ou=People,dc=mdah,dc=state,dc=ms,dc=us^M$
> changetype: modify^M$
> replace: sambaProfilePath^M$
> sambaProfilePath: \\preshs\profiles\panderson^M$
> -^M$
> replace: sambaHomePath^M$
> sambaHomePath: \\preshs\panderson^M$
> -^M$
> replace: sambaLogonScript^M$
> sambaLogonScript: scripts\panderson.bat^M$
> -^M$
> replace: sambaHomeDrive^M$
> sambaHomeDrive: R:^M$
> [root@roark ldap]# ldapmodify -D
> "cn=Manager,dc=mdah,dc=state,dc=ms,dc=us" -w xxxxxxxxxx -x -v -f
> profilepaths.ldif
> ldap_initialize( <DEFAULT> )
> ldapmodify: invalid format (line 5) entry:
> "uid=panderson,ou=People,dc=mdah,dc=state,dc=ms,dc=us"

In the meantime, while ldapmodify does not comply (as Philip pointed out), 
convert the file to unix format with dos2unix or similar.

Regards,
Buchan