Forum: Ruby Simple LDAP query

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ae8a3b78d9782603e1db84a20ac3c351?d=identicon&s=25 Chris Henderson (Guest)
on 2008-10-29 07:00
(Received via mailing list)
I'm using ruby-1.8.6 and trying to query my Windows Active Directory
LDAP server. But I'm getting connection failed. I can ping the AD
server, I can resolve the host name or the IP address and I know the
LDAP authentication is working. But I'm still getting error message
when I query it via the following script. The error message I get is
"fail!"

Could anyone please tell me what I'm doing wrong? Do I need to define
the base DN?

#!/usr/bin/ruby
require 'rubygems'
require 'net/ldap'

ldap = Net::LDAP.new
ldap.host = "ldap.domain.com"
ldap.port = 389
ldap.auth "user_ID", "password"
if ldap.bind
print "success!\n"
# authentication succeeded
else
print "fail!\n"
# authentication failed
end
9d4960f8319664f0f7896230eebace73?d=identicon&s=25 Glen Holcomb (Guest)
on 2008-10-29 14:10
(Received via mailing list)
What is the value of user_ID?

it needs to be user_name@full.base.of.domain

On Tue, Oct 28, 2008 at 11:59 PM, Chris Henderson
<henders254@gmail.com>wrote:

> #!/usr/bin/ruby
> else
> print "fail!\n"
> # authentication failed
> end
>
>


--
"Hey brother Christian with your high and mighty errand, Your actions
speak
so loud, I can't hear a word you're saying."

-Greg Graffin (Bad Religion)
9d4960f8319664f0f7896230eebace73?d=identicon&s=25 Glen Holcomb (Guest)
on 2008-10-29 14:11
(Received via mailing list)
On Wed, Oct 29, 2008 at 7:09 AM, Glen Holcomb <damnbigman@gmail.com>
wrote:

>> LDAP authentication is working. But I'm still getting error message
>> ldap = Net::LDAP.new
>>
>>
>
>
> --
> "Hey brother Christian with your high and mighty errand, Your actions speak
> so loud, I can't hear a word you're saying."
>
> -Greg Graffin (Bad Religion)
>

It probably wouldn't hurt to supply the base either.

--
"Hey brother Christian with your high and mighty errand, Your actions
speak
so loud, I can't hear a word you're saying."

-Greg Graffin (Bad Religion)
Ae8a3b78d9782603e1db84a20ac3c351?d=identicon&s=25 Chris Henderson (Guest)
on 2008-10-30 05:37
(Received via mailing list)
On Thu, Oct 30, 2008 at 12:09 AM, Glen Holcomb <damnbigman@gmail.com>
wrote:
> What is the value of user_ID?
> it needs to be user_name@full.base.of.domain

Thanks. This works.
9d4960f8319664f0f7896230eebace73?d=identicon&s=25 Glen Holcomb (Guest)
on 2008-10-30 14:15
(Received via mailing list)
On Wed, Oct 29, 2008 at 10:35 PM, Chris Henderson
<henders254@gmail.com>wrote:

> On Thu, Oct 30, 2008 at 12:09 AM, Glen Holcomb <damnbigman@gmail.com>
> wrote:
> > What is the value of user_ID?
> > it needs to be user_name@full.base.of.domain
>
> Thanks. This works.
>
>
Cool

--
"Hey brother Christian with your high and mighty errand, Your actions
speak
so loud, I can't hear a word you're saying."

-Greg Graffin (Bad Religion)
This topic is locked and can not be replied to.