Random Project

unable to use an authenticated account

There is an error in the sript which isn’t able to use an authenticated connection.
If USER (-u) and PASS (-p) are provided, they aren’t used in the ldapsearch generated command and the connection is still anonymous.

Suggestion
the LDAP query should be modified as follow:

# do the ldap query
if [ “${USER}” = “” ];
then
# maybe you need the -Z here if you have the simple authentication deactivated
ldapsearch -H ${TYPE}://${HOST}:${PORT} -x -b “” -s base ${LDAPATTR} >${TMPFILE} 2>${ERRFILE}
EXITCODE=$?
else
# maybe you need the -Z here if you have the simple authentication deactivated
ldapsearch -H ${TYPE}://${HOST}:${PORT} -x -b “” -s base ${LDAPATTR} -D ${USER} -w ${PASS} >${TMPFILE} 2>${ERRFILE}
EXITCODE=$?
fi

Best regards
Jean-Marc