On Fri, Nov 18, 2011 at 11:23 AM, Graham Barr via RT <
bug-perl-ldap@rt.cpan.org> wrote:
Show quoted text
Okay - I (mostly) figured out what was going on....
Output from your test:
perladm@allx0001:~$ ./ldaptest.pl
Use of uninitialized value $h in substitution (s///) at ./ldaptest.pl line
9.
Use of uninitialized value $h in concatenation (.) or string at ./
ldaptest.pl line 10.
none
none abc
ldap foo
And...* *blink** I guess I'm still having troubles. This is very weird
because I successfully authenticated a short while ago after I made the
change I suggested as a patch - and I was seeing the RT4 user interface,
which means I didn't authenticate against the wrong web service.
Okay, so I can repro this outside of RT by doing precisely what RT is doing
in a short script.
RT-Authen-ExternalAuth is sending in a parameter list to new that looks
like:
Show quoted text > my $ldap = new Net::LDAP($ldap_server, @$ldap_args);
I did a Data::Dumper on those variables - here's what my logs show from
this line:
Show quoted text > $RT::Logger->critical( (caller(0))[3], ": Attempting to get new ldap
object", $ldap_server, @$ldap_args, Dumper($ldap_server),
Dumper($ldap_args));
*[Fri Nov 18 19:14:24 2011] [critical]:
RT::Authen::ExternalAuth::LDAP::_GetBoundLdapObj : Attempting to get new
ldap object hostname version => 3 $VAR1 = 'hostname';
$VAR1 = [
'version => 3'
];
*
I get a failure, and warnings:
[Fri Nov 18 18:51:53 2011] [warning]: Use of uninitialized value $h in
substitution (s///) at
/opt/perl/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP.pm line 108.
(/opt/perl/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP.pm:108)
[Fri Nov 18 18:51:53 2011] [warning]: Use of uninitialized value $h in
substitution (s///) at
/opt/perl/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP.pm line 110.
(/opt/perl/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP.pm:110)
[Fri Nov 18 18:51:53 2011] [warning]: Use of uninitialized value $h in
substitution (s///) at
/opt/perl/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP.pm line 111.
(/opt/perl/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP.pm:111)
[Fri Nov 18 18:51:53 2011] [warning]: Use of uninitialized value $host in
substitution (s///) at
/opt/perl/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP.pm line 142.
(/opt/perl/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP.pm:142)
[Fri Nov 18 18:51:53 2011] [warning]: Use of uninitialized value $_[1] in
join or string at
/opt/perl/perls/perl-5.14.2/lib/5.14.2/x86_64-linux/IO/Socket/INET.pm line
117.
(/opt/perl/perls/perl-5.14.2/lib/5.14.2/x86_64-linux/IO/Socket/INET.pm:117)
[Fri Nov 18 18:51:53 2011] [critical]:
RT::Authen::ExternalAuth::LDAP::_GetBoundLdapObj : Cannot connect to
hostname
(/opt/rt4/local/plugins/RT-Authen-ExternalAuth/lib/RT/Authen/ExternalAuth/LDAP.pm:439)
Here's a script to repro that:
#!/opt/perl/perls/perl-5.14.2/bin/perl -w
use Net::LDAP;
use Data::Dumper;
my $ldap_server='hostname';
my %config_hash;
# The following line is set precisely as it is in RT_SiteConfig.pm (as
recommended by module docs I believe).
$config_hash {'net_ldap_args'} = [ 'version => 3' ];
$ldap_args = $config_hash{'net_ldap_args'};
print Dumper($ldap_server);
print Dumper($ldap_args);
my $ldap = undef;
$ldap = new Net::LDAP($ldap_server, @$ldap_args);
if (! defined ($ldap)) {
print "did not bind\n";
}
*perladm:~$ ./repro.pl *
$VAR1 = 'hostname';
$VAR1 = [
'version => 3'
];
Use of uninitialized value $h in substitution (s///) at
/opt/perl/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP.pm line 108,
<DATA> line 522.
Use of uninitialized value $h in substitution (s///) at
/opt/perl/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP.pm line 110,
<DATA> line 522.
Use of uninitialized value $h in substitution (s///) at
/opt/perl/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP.pm line 111,
<DATA> line 522.
Use of uninitialized value $host in substitution (s///) at
/opt/perl/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP.pm line 142,
<DATA> line 522.
Use of uninitialized value $_[1] in join or string at
/opt/perl/perls/perl-5.14.2/lib/5.14.2/x86_64-linux/IO/Socket/INET.pm line
117, <DATA> line 522.
did not bind
Thing is, My RT 3.x is passing in arguments from RT::Authen::ExternalAuth
to Net::LDAP::new exactly the same way under perl 5.10 and it works.
However, changing 'net_ldap_args' to point a proper list seems to have
gotten me past this issue to a new problem that is not related to
Net::LDAP. i.e.:
$config_hash {'net_ldap_args'} = [ ('version', '3') ];
In any case I'm thinking we can close this. It would seem the issue is how
args were being passed to Net:::LDAP. Many, many thanks for your patience
and responsiveness. :)
-Rob