[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

ldapsearch in scripts need perl filter to work properly with long values



I just ran into a problem with the LDAP structure in squeeze-test at
the moment.  The ldap-createuser-krb5 script uses ldapsearch to find
the sambaDomain object in LDAP, and its command caused the output to
be wrapped like this:

  dn: sambaDomainName=SKOLELINUX,ou=samba,ou=services,dc=skole,dc=skolelinux,dc=
   no

This again caused the shell script to use an incomplete dn value when
trying to modify LDAP.  The fix, as there is no option in ldapsearch
from openldap (there is -T in the one from Sun), is to filter the
output using 'perl -p0e 's/\n //g'.

Thought it best to mention it here, as we have several shell scripts
using ldapsearch to locate LDAP objects, and these will start to fail
when the lines get more than 80 characters. :(

I just fixed ldap-createuser-krb5 in svn, but expect there are other
scripts that need this fix as well.

JFYI.

Happy hacking,
-- 
Petter Reinholdtsen


Reply to: