I am using following code to perform an operation. But everytime "ldap_bind: Invalid credentials (49)" is getting printed on the console. I dont want this to be printed on the console and rather it should be suppressed. How to achieve it? code:
LDAP_CONF="/etc/opt/nokia/ldapserver.conf"
bindError="ldap_bind: Invalid credentials (49)"
basedn=`cat $LDAP_CONF | grep basedn | cut -d " " -f2`
verify=`su - omc -c "ldapsearch -x -n -D
"uid=$userName,ou=people,ou=accounts,$basedn" -w $newPswd"`
if echo "$verify" | grep -q "$bindError"; then
printPasswdLog "${ERR}" "bind to ldap server failed"
else
printPasswdLog "${INF}" "bind to ldap server Successful for $userName "
fi
I am getting the below output:
ldap_bind: Invalid credentials (49) Wed Jun 3 12:45:56 EEST 2015| INFO | bind to ldap server Successful for nwi3system
basedn=`cat $LDAP_CONF | grep basedn | cut -d " " -f2`is better written asbasedn=$(grep based $LDAP_CONFIG) | cut -d" " -f2. See also smallo.ruhr.de/award.html