While this code doesn't use the Win32 specific API, that could be considered an advantage:
Updated: In case people were not aware, a Windows Domain Controller also acts as an LDAP server.
use Net::LDAP;
$ldap = Net::LDAP->new( 'domain.controller' );
# bind to a directory with dn and password
# ActiveDirectory does not allow anonymous binds
$mesg = $ldap->bind( 'cn=a_valid_user,o=mydomain',
password => 'secret'
);
$mesg = $ldap->search( # perform a search
base => "o=mydomain",
filter => "(sAMAccountName=user_name)",
attrs => [ "whenCreated" ]
);
Net::LDAP::LDIF->new( \*STDOUT,"w" )->write( $mesg->entries );
If anyone needs me I'll be in the Angry Dome.
|