Hi,

Using lastest perlldap (3202), for the following test
program I got errors using default Net::LDAP (program
does some forking and detaching, things people prob
don't do normally). Anyway I had to add
LDAP_SASL_BIND_IN_PROGRESS to the constants list in
LDAP.pm. Hope it's the right place...

use Net::LDAP::Constant qw(LDAP_SUCCESS
                           LDAP_OPERATIONS_ERROR
                           LDAP_DECODING_ERROR
                           LDAP_PROTOCOL_ERROR
                           LDAP_ENCODING_ERROR
                           LDAP_FILTER_ERROR
                           LDAP_LOCAL_ERROR
                           LDAP_PARAM_ERROR
                           LDAP_INAPPROPRIATE_AUTH
                           LDAP_SERVER_DOWN
                           LDAP_USER_CANCELED
                           LDAP_EXTENSION_START_TLS
                           LDAP_UNAVAILABLE
                           LDAP_SASL_BIND_IN_PROGRESS
                        );


Error and test program follow...


# added LDAP_SASL_BIND_IN_PROGRESS otherwise got ...
# "LDAP_SASL_BIND_IN_PROGRESS" is not exported by the
Net::LDAP::Constant module at
/opt/apache/perlextras/lib/perl5/site_perl/5.8.0/Net/LDAP/Bind.pm
line 8
# Can't continue after import errors at
/opt/apache/perlextras/lib/perl5/site_perl/5.8.0/Net/LDAP/Bind.pm
line 8
# BEGIN failed--compilation aborted at
/opt/apache/perlextras/lib/perl5/site_perl/5.8.0/Net/LDAP/Bind.pm
line 8, <DATA> line 225.
# Compilation failed in require at
/opt/apache/perlextras/lib/perl5/site_perl/5.8.0/Net/LDAP.pm
line 296, <DATA> line 225.
#

#!/usr/bin/perl
-I/opt/apache/perlextras/lib/perl5/site_perl

use strict;
use POSIX qw(setsid);
use Net::LDAP;

my $OUT_FILE ="/tmp/err";
my $ERR_FILE ="/tmp/err";

 my $openmax = POSIX::sysconf( &POSIX::_SC_OPEN_MAX )
|| 64;
 ## Fork and exit parent
 if (my $pid = fork) { exit 0; }
 ## Detach ourselves from the terminal
 die "Cannot detach from controlling terminal"
   unless my $sess_id = POSIX::setsid();
 ## Prevent possibility of acquiring a controling
terminal
 if (my $pid = fork) { exit 0; }
 ## Change working directory
 chdir "/";
 ## Close all open file descriptors
 foreach my $i (0 .. $openmax) { POSIX::close($i); }
 open(STDIN,  "+>/dev/null");
 open(STDOUT, ">>${OUT_FILE}");
 open(STDERR, ">>${ERR_FILE}");


my $ldap = Net::LDAP->new("xxxxxxxx", port => 389,
onerror => 'die', timeout => 4 );
# anon bind
my $mesg = $ldap->bind();
my $dn;
eval{
  local $SIG{ALRM} = sub { die "alarm\n" };
  alarm 10;
  $mesg=$ldap->search(
                    base   => "o=xxxxx.com",
                    scope  => 2,
                    filter => "uid=stevem02",
                    attrs  => ['uid'] );
  alarm 0;
};

$dn = $mesg->entry(0)->dn;
print "$@,$dn\n";


                
__________________________________ 
Do you Yahoo!? 
All your favorites on one personal page � Try My Yahoo!
http://my.yahoo.com 

Reply via email to