in reply to Re^3: what is a pure perl equivalent for "net user username /domain"?
in thread what is a pure perl equivalent for "net user username /domain"?

I'm getting a failure to bind, either of the anonymous or non-anonymous kind. Perhaps I chose the wrong LDAP server. I guessed what it was on the basis of a Google search where the suggestion was to do an nslookup.

nslookup -type=srv _ldap._tcp.domain nslookup -type=srv _ldap._tcp.domain.tld (?)

I got many replies, I chose one that sounded (phonetically) like it looked geographically compatible with my location in my domain.

There's no error at the time of bind but the bind error occurs when I try to execute the search.

script:

#!/usr/bin/perl use strict; use warnings; use Net::LDAP; my $ldap_server = "svlitdc1.shoretel.com"; my $ldap = Net::LDAP->new($ldap_server) or die "$@"; my $mesg = $ldap->bind ('', password => '', version => 3) or die "FATA +L ERROR: LDAP bind did not succeed: $!\n"; my $username = "tienle"; $mesg = $ldap->search (base => "c=US", filter => "(&(sn=" . $usernam +e . ")(o=ShoreTel))"); $mesg->code && die $mesg->error; foreach my $entry ($mesg->entries) { $entry->dump; } $mesg = $ldap->unbind; print "Done!\n";

Results:

000004DC: LdapErr: DSID-0C0906E8, comment: In order to perform this op +eration a successful bind must be completed on the connection., data +0, v1db1 at ./ldap_try1.pl line 12, <DATA> line 751.
Thanks, Ken

Replies are listed 'Best First'.
Re^5: what is a pure perl equivalent for "net user username /domain"?
by Discipulus (Canon) on May 24, 2016 at 09:19 UTC
    format your code using <c>..</c> tags, THEN you can be permitted to read Simple LDAP / ActiveDirectory Authentication

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re^5: what is a pure perl equivalent for "net user username /domain"?
by MidLifeXis (Monsignor) on May 24, 2016 at 16:35 UTC

    My local hive (or whatever it is called) requires me to bind with an active user before I am allowed to do lookups. Perhaps the anonymous bind is causing you issues.

    --MidLifeXis

      I tried specifying my username and password during the ldap bind command and it failed just like the anonymous bind.