Skip Menu |

This queue is for tickets about the perl-ldap CPAN distribution.

Report information
The Basics
Id: 72528
Status: rejected
Priority: 0/
Queue: perl-ldap

People
Owner: Nobody in particular
Requestors: nesius [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.43
Fixed in: (no value)



Subject: Net::LDAP - Broken under perl 5.14.2
The new operator appears to be broken under perl 5.14.2. my $ldap = new Net::LDAP($ldap_server, @$ldap_args); leads to complaints about $h on line 107 of LDAP.pm (and subsequent lines) being undefined. LDAP.pm:107: (my $h = $uri) =~ s,^(\w+)://,, and $scheme = $1; Changing line 107 to two statements resolved the problem: my $h = $uri; $h =~ s,^(\w+)://,, and $scheme = $1; Kind of weird but here is a patch. -Rob
Subject: LDAP.pm.patch
*** LDAP.pm 2011-11-18 10:21:56.003429920 -0600 --- LDAP.pm.works 2011-11-18 10:21:02.734066616 -0600 *************** *** 104,110 **** foreach my $uri (ref($host) ? @$host : ($host)) { my $scheme = $arg->{scheme} || 'ldap'; ! (my $h = $uri) =~ s,^(\w+)://,, and $scheme = $1; my $meth = $obj->can("connect_$scheme") or next; $h =~ s,/.*,,; # remove path part $h =~ s/%([A-Fa-f0-9]{2})/chr(hex($1))/eg; # unescape --- 104,111 ---- foreach my $uri (ref($host) ? @$host : ($host)) { my $scheme = $arg->{scheme} || 'ldap'; ! my $h = $uri; ! $h =~ s,^(\w+)://,, and $scheme = $1; my $meth = $obj->can("connect_$scheme") or next; $h =~ s,/.*,,; # remove path part $h =~ s/%([A-Fa-f0-9]{2})/chr(hex($1))/eg; # unescape
Subject: Re: [rt.cpan.org #72528] Net::LDAP - Broken under perl 5.14.2
Date: Fri, 18 Nov 2011 10:26:58 -0600
To: bug-perl-ldap [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
Wow, if 5.14.2 has broken the idiom (my $h = $uri) =~ s,^(\w+)://,, and $scheme = $1; then there is a serious issue with 5.14.2 not in Net::LDAP Graham.
Subject: Re: [rt.cpan.org #72528] Net::LDAP - Broken under perl 5.14.2
Date: Fri, 18 Nov 2011 10:54:24 -0600
To: bug-perl-ldap [...] rt.cpan.org
From: Robert Nesius <nesius [...] gmail.com>
On Fri, Nov 18, 2011 at 10:27 AM, Graham Barr via RT < bug-perl-ldap@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=72528 > > > Wow, if 5.14.2 has broken the idiom > > (my $h = $uri) =~ s,^(\w+)://,, and $scheme = $1; > > then there is a serious issue with 5.14.2 not in Net::LDAP >
Well, I was using perl 5.14.2 from perlbrew. Maybe I should build my own perl 5.14.2 and test without optimizations turned on in the c compiler first. Thoughts? -Rob
Subject: Re: [rt.cpan.org #72528] Net::LDAP - Broken under perl 5.14.2
Date: Fri, 18 Nov 2011 11:03:32 -0600
To: bug-perl-ldap [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
On Nov 18, 2011, at 10:54 , Robert Nesius via RT wrote: Show quoted text
> Queue: perl-ldap > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=72528 > > > On Fri, Nov 18, 2011 at 10:27 AM, Graham Barr via RT < > bug-perl-ldap@rt.cpan.org> wrote: >
>> <URL: https://rt.cpan.org/Ticket/Display.html?id=72528 > >> >> Wow, if 5.14.2 has broken the idiom >> >> (my $h = $uri) =~ s,^(\w+)://,, and $scheme = $1; >> >> then there is a serious issue with 5.14.2 not in Net::LDAP >>
> > Well, I was using perl 5.14.2 from perlbrew. > > Maybe I should build my own perl 5.14.2 and test without optimizations > turned on in the c compiler first. Thoughts?
I would attempt to reproduce the issue directly with your build of 5.14.2 the try that same code with earlier versions of perl. The above code certainly should not ever leave $h as undefined unless $uri was undefined. Graham.
Subject: Re: [rt.cpan.org #72528] Net::LDAP - Broken under perl 5.14.2
Date: Fri, 18 Nov 2011 11:10:32 -0600
To: bug-perl-ldap [...] rt.cpan.org
From: Robert Nesius <nesius [...] gmail.com>
On Fri, Nov 18, 2011 at 11:03 AM, Graham Barr via RT < bug-perl-ldap@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=72528 > > > > On Nov 18, 2011, at 10:54 , Robert Nesius via RT wrote: >
> > Queue: perl-ldap > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=72528 > > > > > On Fri, Nov 18, 2011 at 10:27 AM, Graham Barr via RT < > > bug-perl-ldap@rt.cpan.org> wrote: > >
> >> <URL: https://rt.cpan.org/Ticket/Display.html?id=72528 > > >> > >> Wow, if 5.14.2 has broken the idiom > >> > >> (my $h = $uri) =~ s,^(\w+)://,, and $scheme = $1; > >> > >> then there is a serious issue with 5.14.2 not in Net::LDAP > >>
> > > > Well, I was using perl 5.14.2 from perlbrew. > > > > Maybe I should build my own perl 5.14.2 and test without optimizations > > turned on in the c compiler first. Thoughts?
> > I would attempt to reproduce the issue directly with your build of 5.14.2 > > the try that same code with earlier versions of perl. > > The above code certainly should not ever leave $h as undefined unless $uri > was undefined. > >
It works against Ubuntu's 5.10 and 5.10.1. The specific invocation that was blowing up for me comes out of RT::Authen::ExternalAuth so there's a fair bit involved in testing all of that. I'll give it a try. -Rob
Subject: Re: [rt.cpan.org #72528] Net::LDAP - Broken under perl 5.14.2
Date: Fri, 18 Nov 2011 11:18:22 -0600
To: bug-perl-ldap [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
On Nov 18, 2011, at 11:10 , Robert Nesius via RT wrote: Show quoted text
> Queue: perl-ldap > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=72528 > > > On Fri, Nov 18, 2011 at 11:03 AM, Graham Barr via RT < > bug-perl-ldap@rt.cpan.org> wrote: >
>> <URL: https://rt.cpan.org/Ticket/Display.html?id=72528 > >> >> >> On Nov 18, 2011, at 10:54 , Robert Nesius via RT wrote: >>
>>> Queue: perl-ldap >>> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=72528 > >>> >>> On Fri, Nov 18, 2011 at 10:27 AM, Graham Barr via RT < >>> bug-perl-ldap@rt.cpan.org> wrote: >>>
>>>> <URL: https://rt.cpan.org/Ticket/Display.html?id=72528 > >>>> >>>> Wow, if 5.14.2 has broken the idiom >>>> >>>> (my $h = $uri) =~ s,^(\w+)://,, and $scheme = $1; >>>> >>>> then there is a serious issue with 5.14.2 not in Net::LDAP >>>>
>>> >>> Well, I was using perl 5.14.2 from perlbrew. >>> >>> Maybe I should build my own perl 5.14.2 and test without optimizations >>> turned on in the c compiler first. Thoughts?
>> >> I would attempt to reproduce the issue directly with your build of 5.14.2 >> >> the try that same code with earlier versions of perl. >> >> The above code certainly should not ever leave $h as undefined unless $uri >> was undefined. >> >>
> It works against Ubuntu's 5.10 and 5.10.1. > > The specific invocation that was blowing up for me comes out of > RT::Authen::ExternalAuth so there's a fair bit involved in testing all of > that. I'll give it a try.
If this is a real 5.14.2 issue it should be reproducible with a small script just a few lines long #!perl -w use warnings; use strict; sub test { my $uri = shift; my $scheme = "none"; (my $h = $uri) =~ s,^(\w+)://,, and $scheme = $1; print "$scheme $h\n"; } test(); # this one should warn test("abc"); # none abc test("ldap://foo"); # ldap foo If that does not reproduce it then I suspect that $uri being passed in is undef. Graham.
On Fri Nov 18 12:23:29 2011, gbarr@pobox.com wrote: Show quoted text
> > On Nov 18, 2011, at 11:10 , Robert Nesius via RT wrote: >
> > Queue: perl-ldap > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=72528 > > > > > On Fri, Nov 18, 2011 at 11:03 AM, Graham Barr via RT < > > bug-perl-ldap@rt.cpan.org> wrote: > >
> >> <URL: https://rt.cpan.org/Ticket/Display.html?id=72528 > > >> > >> > >> On Nov 18, 2011, at 10:54 , Robert Nesius via RT wrote: > >>
> >>> Queue: perl-ldap > >>> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=72528 > > >>> > >>> On Fri, Nov 18, 2011 at 10:27 AM, Graham Barr via RT < > >>> bug-perl-ldap@rt.cpan.org> wrote: > >>>
> >>>> <URL: https://rt.cpan.org/Ticket/Display.html?id=72528 > > >>>> > >>>> Wow, if 5.14.2 has broken the idiom > >>>> > >>>> (my $h = $uri) =~ s,^(\w+)://,, and $scheme = $1; > >>>> > >>>> then there is a serious issue with 5.14.2 not in Net::LDAP > >>>>
> >>> > >>> Well, I was using perl 5.14.2 from perlbrew. > >>> > >>> Maybe I should build my own perl 5.14.2 and test without
> optimizations
> >>> turned on in the c compiler first. Thoughts?
> >> > >> I would attempt to reproduce the issue directly with your build of
> 5.14.2
> >> > >> the try that same code with earlier versions of perl. > >> > >> The above code certainly should not ever leave $h as undefined
> unless $uri
> >> was undefined. > >> > >>
> > It works against Ubuntu's 5.10 and 5.10.1. > > > > The specific invocation that was blowing up for me comes out of > > RT::Authen::ExternalAuth so there's a fair bit involved in testing
> all of
> > that. I'll give it a try.
> > If this is a real 5.14.2 issue it should be reproducible with a small > script just a few lines long > > #!perl -w > use warnings; > use strict; > > sub test { > my $uri = shift; > my $scheme = "none"; > (my $h = $uri) =~ s,^(\w+)://,, and $scheme = $1; > print "$scheme $h\n"; > } > > test(); # this one should warn > test("abc"); # none abc > test("ldap://foo"); # ldap foo > > If that does not reproduce it then I suspect that $uri being passed in > is undef.
That gives me the same results from 5.6.2 to 5.15.4 (except for the variable name in the warning).
Subject: Re: [rt.cpan.org #72528] Net::LDAP - Broken under perl 5.14.2
Date: Fri, 18 Nov 2011 15:26:03 -0600
To: bug-perl-ldap [...] rt.cpan.org
From: Robert Nesius <nesius [...] gmail.com>
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
Subject: Re: [rt.cpan.org #72528] Net::LDAP - Broken under perl 5.14.2
Date: Fri, 18 Nov 2011 15:36:33 -0600
To: bug-perl-ldap [...] rt.cpan.org
From: Robert Nesius <nesius [...] gmail.com>
p.s. I figured out how I was fooled into thinking my patch suggestion worked. It appears RT became confused from me authenticating to a different RT, or something in my environment threw it off because when I reloaded the site after a failed auth it let me in and gave me a working session. Again, not a Net::LDAP problem, just another issue that threw me off track.
On Fri Nov 18 16:36:41 2011, nesius@gmail.com wrote: Show quoted text
> > ... Again, not a Net::LDAP problem, just another issue that threw me > off track.
O.K., closing as rejected.