Em 25 de abril de 2011 21:30, Inácio Alves <inacioc.alves@gmail.com> escreveu:
Hi to all,

I'm trying write a script shell to simplifies the change of pass of users.
Then I write

function verificaSenha(){
  whoAmI=`whoami`
  param=`echo "ldapsearch -x -W -D \"uid=$whoAmI,ou=People,dc=ifce,dc=edu,dc=br\" -b \"dc=ifce,dc=edu,dc=br\" \"(uid=$whoAmI)\""`
  exec `echo "$param"`
}
You may use directly : $param without exec.

the line param=... produces a command line that when I write directly in the term it works, however in the line exec "$param" I am solicitated my LDAP pass (like in directly term) but when I type I get

ldapsearch -x -W -D "uid=inacio,ou=People,dc=ifce,dc=edu,dc=br" -b "dc=ifce,dc=edu,dc=br" "(uid=inacio)"
Enter LDAP Password: 
ldap_bind: Invalid DN syntax (34)
additional info: invalid DN

what is wrong?

Another way is use the command "ldapwhoami" directly. Se above:

$ ldapwhoami -x -W -D uid=jarbas.peixoto,ou=pessoas,ou=usuarios,dc=teste,dc=br -H ldap://ip-of-ldap-server
Enter LDAP Password: 
dn:uid=jarbas.peixoto,ou=Pessoas,ou=Usuarios,dc=teste,dc=br

Best regards!!

--
Atenciosamente,

prof. Inácio Alves
IFCE/Campus Maracanaú
Bacharel em Matemática (UFC)/ Técnico em Conectividade(IFCE)
http://www.polluxweb.com/inacioalves/site/