With openldap 2.3 the following ldif would load fine with ldapmodify:
dn: uid=panderson,ou=People,dc=mdah,dc=state,dc=ms,dc=us changetype: modify sambaProfilePath: \preshs\profiles\panderson sambaHomePath: \preshs\panderson sambaLogonScript: scripts\panderson.bat sambaHomeDrive: R:
Over the weekend I upgraded to OpenLDAP 2.4.12. I was googling and I think my ldif now needs to look like this, but I get an error when trying to load it, and I'm not sure why, any ideas?
dn: uid=panderson,ou=People,dc=mdah,dc=state,dc=ms,dc=us changetype: modify replace: sambaProfilePath sambaProfilePath: \preshs\profiles\panderson - replace: sambaHomePath sambaHomePath: \preshs\panderson - replace: sambaLogonScript: sambaLogonScript: scripts\panderson.bat - replace: sambaHomeDrive sambaHomeDrive: R:
[root@roark ldap]# ldapmodify -D "cn=Manager,dc=mdah,dc=state,dc=ms,dc=us" -w xxxxxxxxxxx -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"
if I take out the lines that are only a - and run it, it only replaces the first attribute:
[root@roark ldap]# ldapmodify -D "cn=Manager,dc=mdah,dc=state,dc=ms,dc=us" -w xxxxxxxxxxx -x -v -f profilepaths.ldif ldap_initialize( <DEFAULT> ) replace sambaProfilePath: \preshs\profiles\panderson modifying entry "uid=panderson,ou=People,dc=mdah,dc=state,dc=ms,dc=us" modify complete
how can I get ldapmodify to replace all 4 lines in one ldif file?
Adam Williams awilliam@mdah.state.ms.us writes:
With openldap 2.3 the following ldif would load fine with ldapmodify:
dn: uid=panderson,ou=People,dc=mdah,dc=state,dc=ms,dc=us changetype: modify sambaProfilePath: \preshs\profiles\panderson sambaHomePath: \preshs\panderson sambaLogonScript: scripts\panderson.bat sambaHomeDrive: R:
Over the weekend I upgraded to OpenLDAP 2.4.12. I was googling and I think my ldif now needs to look like this, but I get an error when trying to load it, and I'm not sure why, any ideas?
dn: uid=panderson,ou=People,dc=mdah,dc=state,dc=ms,dc=us changetype: modify replace: sambaProfilePath sambaProfilePath: \preshs\profiles\panderson
replace: sambaHomePath sambaHomePath: \preshs\panderson
replace: sambaLogonScript:
[...] remove the colon next to sambaLogonScript
-Dieter
Dieter Kluenter wrote:
[...] remove the colon next to sambaLogonScript
-Dieter
thanks for fixing that typo, I still have the same error. ldif file is:
dn: uid=panderson,ou=People,dc=mdah,dc=state,dc=ms,dc=us changetype: modify replace: sambaProfilePath sambaProfilePath: \preshs\profiles\panderson - replace: sambaHomePath sambaHomePath: \preshs\panderson - replace: sambaLogonScript sambaLogonScript: scripts\panderson.bat - replace: sambaHomeDrive sambaHomeDrive: R:
and I run it with:
[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"
On Wed, 14 Jan 2009, Adam Williams wrote: ...
thanks for fixing that typo, I still have the same error. ldif file is:
dn: uid=panderson,ou=People,dc=mdah,dc=state,dc=ms,dc=us changetype: modify replace: sambaProfilePath sambaProfilePath: \preshs\profiles\panderson
replace: sambaHomePath sambaHomePath: \preshs\panderson
replace: sambaLogonScript sambaLogonScript: scripts\panderson.bat
replace: sambaHomeDrive sambaHomeDrive: R:
and I run it with:
[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"
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
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.
[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"
On Wed, 14 Jan 2009, Adam Williams wrote: ...
thanks, cat'ing it looks ok to me, each line ends in ^M$ with no whitespace.
That is indeed compliant with the LDIF specification. A quick check of the ldapmodify source shows that it does not comply and will fail to recognize a "-" line that has a trailing ^M.
Philip Guenther
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
Buchan Milne wrote:
In the meantime, while ldapmodify does not comply (as Philip pointed out), convert the file to unix format with dos2unix or similar.
Regards, Buchan
Thanks, that worked! I never thought to try that.
[root@roark ldap]# dos2unix profilepaths.ldif [root@roark ldap]# ldapmodify -D "cn=Manager,dc=mdah,dc=state,dc=ms,dc=us" -w xxxxxxxxx -x -v -f profilepaths.ldif ldap_initialize( <DEFAULT> ) replace sambaProfilePath: \preshs\profiles\panderson replace sambaHomePath: \preshs\panderson replace sambaLogonScript: scripts\panderson.bat replace sambaHomeDrive: R: modifying entry "uid=panderson,ou=People,dc=mdah,dc=state,dc=ms,dc=us" modify complete
openldap-software@openldap.org