Aaron Axelsen wrote:

Greetings,

I am trying to set up LDAP with jabber, and i was wondering if anyone has
a nice little script that would help me test that the Net::LDAP module is
working correctly and that I am in fact connecting to the Active Directory
server.  Thanks,



Hi!

This should get you started :)

use Net::LDAP;

$ldap = Net::LDAP->new( 'ldap.bigfoot.com' ) or die "$@";

$mesg = $ldap->bind ; # an anonymous bind

#or with dn/password
# bind to a directory with dn and password
#$mesg = $ldap->bind( 'cn=root, o=University of Michigan, c=us',
#                     password => 'secret'
#                   );

$mesg = $ldap->search( # perform a search
                       base   => "c=US",
                       filter => "(&(sn=Barr) (o=Texas Instruments))"
                     );

$mesg->code && die $mesg->error;

foreach $entry ($mesg->all_entries) { $entry->dump; }

$mesg = $ldap->unbind; # take down session


-- Shannon Eric Peevey => "speeves" Dyno-Mite! System Administrator => [EMAIL PROTECTED] Central Web Support => (940) 369-8876 University of North Texas => http://web2.unt.edu



Reply via email to