ruby-ldap: bind authentication problem

B

Boris Glawe

Hi,

first of all: my problem is connected with ldap, but maybe you can help me
without knowing LDAP :)

I'm trying to bind (authenticate) to our Active Directory Server (=LDAP Server)
with the ruby-ldap module ( http://sourceforge.net/projects/ruby-ldap/ ).

The bind method expects the user's distinguished name (kind of username) and a
password:

conn = LDAP::Conn.open("cn=ldapserver,dc=mydomain,dc=com")
conn.simple_bind("cn=username,dc=mydomain,dc=com", "mysecret") {
# ...
}

When I hardcode the password as in the example above, the binding succeeds.
When I read the password from the keyboard, the binding does not succeed, though
it's the same:


password = $stdin.gets
password.chomp

conn = LDAP::Conn.open("cn=ldapserver,dc=mydomain,dc=com")
conn.simple_bind("cn=username,dc=mydomain,dc=com", password) {
# ...
}


This code results in an "Invalid credentials Error" (which means something like
"username or password is wrong").

Can someone please explain me, what the difference between the two versions is?
Maybe there's something with the security level ($SAVE), that refuses to send
strings that origins from stdin!?

What else can be the reason?

thanks in advance

Boris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,817
Latest member
AdalbertoT

Latest Threads

Top