sub callbackSearch 
{
   my ( $conn, $entry) = @_;   

   if ( !defined($entry) ) { return };

   $dn = $entry->dn;
 
   @attrs = $entry->attributes; # Obtain attributes for this entry.
   my (%all_users);
   $all_users{dn} = $dn;
   foreach my $var (@attrs) {
        $attr = $entry->get_value( $var, asref => 1 );
        if ( defined($attr) ) {          
             foreach my $value (@$attr) { eval ("\$all_users{$var} = \$value; "); } 
        }                                                                       
   }
   $all_users[$i++] = \%all_users;
   $conn->pop_entry; 
}

&connect ();
    $i=0;
    my $status_con = $ldapObj->search ( base => $base,
                                          scope => "sub",
                                          filter => "(cn=" . $filter . ")",
                                          callback => \&callbackSearch
                                         );
    
if ( $conn->code ) {
    if ($conn->count == 0) {  # if conncache is not defined we have nothing.
        print "<TR><TD colspan=4>" . $text{msg_1} . "\n";   }
}
