[Date Prev][Date Next]
(ITS#6149) ldapsearch is not really script-friendly (patch included)
Version: 2.4.15 (LDAP library: OpenLDAP 20415)
OS: Debian GNU/Linux
Submission from: (NULL) (22.214.171.124)
Good day, everyone.
ldapsearch have such important (mis)feature, like output format conforming to
LDIF standard in some or other way.
You should already know, that line length in LDIF-output is limited to 76
characters and if line is larger, it is wrapped with space-padding.
Also output is sometimes base64 encoded, based on it's "printability".
Printability is tested, using single-byte functions, like isgraph(), but when
values is multibyte encoded with UTF-8, that sometimes produce random results.
That together makes ldapsearch very script-unfriendly and here is why:
to limit randomness in output's encoding, one would use -tt switch to always
field values to files and then use some simple script to parse the output and
substitute file urls with their contents.
But here comes to play line length limit, that will sometimes wrap urls for
fields with long names (that is common for AD).
Here is example:
End of example.
That introduces extra unneeded complexity in otherwise simple script, since now
it should parse LDIF, combine whole lines from broken ones, etc. Making it no
longer an one-line script.
Since wrapping of -tt output is nonsense, but changing that may seem unfeasible
for some of you,
let me suggest additional option -ttt, that does the same as -tt, but without
line wrapping (perhaps, violating some standard).
Patch is here, as your ITS asks:
PS: manpage does not changed to reflect additional option
Thanks a lot.