Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

export missing field most records

Status
Not open for further replies.

daisymay

Programmer
Oct 24, 2008
3
0
0
US
I'm using perl to export records from LDAP. I did not write the script, so I don't even fully understand it. What I do know is that it binds to LDAP and exports records, but the 'lastlogin' field only exports on records 4 through 26. The other 14,000 records do not export that field. I've used Console1 to check records that did not export the lastlogin field, and a last login date does exist.
I'm completely puzzled, here is some code - I hope someone can offer a hint?

Should I be posting this in the perl section??

Code:
# ldap directory connection
$ldap=Net::LDAP->new($ldap_server);

open(OUTFILE,">Ldap_out.txt")
  or die "Cannot open output file\n";


#bind 
$ldap->bind(
  dn         =>  $ldap_dn,
  password   =>  $ldap_pw
);

$psearch=$ldap->search(
  base   =>  $ldap_basedn,
  attr   =>  ["uid","sn","givenname","location","cn","title","dn","mail","employeenumber","title","location","departmentnumber","uidNumber","telephoneNumber","logintime"],
filter => "(&(objectclass=Person)(objectClass=mailRecipient))"
);

foreach $pentry($psearch->all_entries){
  $uid=$pentry->get("uid");
  $sn=$pentry->get("sn");
  $givenname=$pentry->get("givenname");
  $location=$pentry->get("location");
  $cn=$pentry->get("cn");
  $title=$pentry->get("title");
  $dn=$pentry->dn;                                   
  $mail=$pentry->get("mail");
  $employeenumber=$pentry->get("employeenumber");
  $departmentnumber=$pentry->get("departmentnumber"); 
  $uidNumber=$pentry->get("uidNumber");
  $phone=$pentry->get("telephoneNumber");
  $login=$pentry->get("logintime");

Thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top