Title: AD Error Message
I'm not a perl/LDAP/AD guru by any stretch, but here are some snippets of code from a program that loads auxillary user info (phone#, address, department, etc) into AD from a file. I've only tested from win2k, but it should work under unix as well.
 
First find the user based on NT userid (which should be unique):
 
sub LookUp {
 
 my $id = shift;
 
 my $mesg = $ldap->search (
  base   => "dc=kii,dc=kimball,dc=com",
  scope => 'sub',
  filter => "samaccountname=$id"
 );
 
 $mesg->code && die $mesg->error;
 
 foreach my $entry ($mesg->all_entries) {
  return $entry->dn;
 
 }
}
Then, I pass the DN to a modify routine:
 
sub Modify {
 
 my ($dn, $addr1, $addr2, $city, $state, $zip, $company, $div, $phone) = @_;
 
 my $addr = $addr1;
 if( $addr2 ) {
  $addr .= "\r\n$addr2";
 }
 
 $ldap->modify( $dn,
 changes => [
 replace => [
  streetAddress => $addr,
  l => $city,
  postalCode => $zip,
  department => "$company/$div",
  st => $state,
   telephoneNumber => $phone
 ]
 ]);
}
 
-----Original Message-----
From: Guoben Li [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 15, 2002 6:51 PM
To: [EMAIL PROTECTED]
Cc: Guoben Li
Subject: [ActiveDir] AD Error Message

Hi everybody,

  I am new to AD but have some experience in Perl LDAP programming.
Recently I wrote a Perl script using Net::LDAP module to access an AD
server.

  When running it passed the connection and anonymous bind successfully.
But when executing:

  $msg=$ldap->search(base => "OU=xxxxxx users,DC=win,DC=mycfo,DC=com",
                scope => 'sub',
                filter => "CN=guoben");
  $msg->code && die $msg->error;

  it printed out: 0000202B: RefErr: DSID-031006A4, data 0, 1 access points
                     ref 1: 'win.mycfo.com'
  and died.

  I searched quite a few web sites including support.microsoft.com but was unable
to find what the above message means.  In one web site I saw another developer
got the same message from running a Java/LDAP code with AD.  So I don't think
it is Perl LDAP specific.

  Thank you for any advice or suggestion.

Guoben Li
P.S.  1. Our AD admin gave me my
        dn: CN=guoben,OU=xxxxxx users,DC=win,DC=mycfo,DC=com
         2. My Perl script was running on a Unix rather than Windows box.

Reply via email to