Howdy, gurus.
I am working on a project that requires me to connect to an instance of Active Directory / Application Mode (ADAM) using credentials from an unreleated Active Directory.
I am entirely unfamiliar with using Win32::OLE, so I have been struggling to get Net::LDAP with and without Authen::SASL to work.
I have had no luck.
Sample code?
I'll try.
Let's say I have an ADAM server adam.domain.com and an AD server ad.domain.com.
The application instance on ADAM is OU=BaseLevel,DC=Generic.
My user account in the Active Directory domain could be CN=jrdepriest,CN=Users,DC=domain,DC=com.
First failure
#!/usr/bin/perl -w use Net::LDAP; $dn = 'CN=jrdepriest,CN=Users,DC=domain,DC=com'; $password = 'password'; $ldap = Net::LDAP->new( 'adam.domain.com', debug => 2) or die $@; $result = $ldap->bind( $dn, password => $password ); die $result->error if $result->code;
result: 80090304: LdapErr: DSID-0C090336, comment: AcceptSecurityContext error, data 20ee, vece

Second failure:
#!/usr/bin/perl -w use Net::LDAP; use Authen::SASL; $dn = 'CN=jrdepriest,CN=Users,DC=domain,DC=com'; $user = 'domain\jrdepriest'; $password = 'password'; $sasl = Authen::SASL->new( mechanism => 'DIGEST-MD5', callback => { user => $user, pass => $password } ); $ldap = Net::LDAP->new( 'adam.domain.com', debug => 2) or die $@; $result = $ldap->bind( $dn, sasl => $sasl ); die $result->error if $result->code;
result: 8009030C: LdapErr: DSID-0C090441, comment: AcceptSecurityContext error, data 52e, vece

I have tried many different variations (such as connecting to 'adam.domain.com/OU=BaseLevel,DC=Generic' instead of just 'adam.domain.com'), but the errors are always one of the two listed above.
I am sure it is just a simple matter of putting the proper values in the correct locations; I just haven't stumbled across the right approach yet.

Can anyone assist me?

Thanks!
Jason

In reply to perl, adsi, ADAM, and AD by jrdepriest

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.