You are trying to translate code using ADSI (Microsoft's proprietery interface to AD and other services) to LDAP.
LDAP doesn't know the internal NETBIOS representation of your domain name. In LDAP you can't bind to a domain itself have to bind to bind with a specific domain controller by using it's fqdn (hostname may or may not work depending on client's DNS configuration). In addition there is AFAIK no way way to inherit user credentials from logged in user. This is a payoff for using more general interface - magic provided by ADSI is lost.
The code below successfully connects to AD but you need to provide a dc server fqdn, user name and password:
my $ad_ldap = Net::LDAP->new( $ad_ldap_server ) or die ($@);
my $ad_mesg = $ad_ldap->bind ( $ad_ldap_user, password => $ad_ldap_pwd
+, version =>3, onerror => 'die');
die ( $ad_mesg->error ) if $ad_mesg->code;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.