LDAP SEARCH

Anderson Meneses
Anderson Meneses used Ask the Experts™
on
Hi People,

I want to list the users in AD 2003.

I'm using this code

 #!/bin/bash

LDAPSEARCH=/usr/bin/ldapsearch
FILTER="(&(sAMAccountName=*)(objectClass=user)(givenName=*))"
FIELDS="displayName"
 
 # Extract users from ADS
  echo -n "Quering ADS... "
  echo $($LDAPSEARCH -x -H $LDAP_SERVER -b $BASEDN -D "$BINDDN" -w $BINDPW "$FILTER" $FIELDS ) >> $ADS_TMP

When the displayName has any utf8 character like 'ç','á',é' the query return a code like

displayName:: Q0xFQkVSIEFOVMOUTklPIERBIFNJTFZB #

My locale is set like this:

LANG=pt_BR.UTF-8
LANGUAGE=pt_BR:pt:en
LC_CTYPE="pt_BR.UTF-8"
LC_NUMERIC="pt_BR.UTF-8"
LC_TIME="pt_BR.UTF-8"
LC_COLLATE="pt_BR.UTF-8"
LC_MONETARY="pt_BR.UTF-8"
LC_MESSAGES="pt_BR.UTF-8"
LC_PAPER="pt_BR.UTF-8"
LC_NAME="pt_BR.UTF-8"
LC_ADDRESS="pt_BR.UTF-8"
LC_TELEPHONE="pt_BR.UTF-8"
LC_MEASUREMENT="pt_BR.UTF-8"
LC_IDENTIFICATION="pt_BR.UTF-8"


My SO is Debian6 or RHEL, I have tried in both SO, but it didn't work!

How I can convert this answer to utf8 code?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
echo Q0xFQkVSIEFOVMOUTklPIERBIFNJTFZB | base64 -d

Open in new window


Note two colons right after 'displayName'. Two colons means that output is base64 encoded.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial