From: Graham B. <gb...@po...> - 2000-06-08 17:41:40
|
This is already fixed in 0.19 which was released today. It will be on CPAN soon, or you can get it from http://download.sourceforge.net/perl-ldap/perl-ldap-0.19.tar.gz Graham. On Thu, Jun 08, 2000 at 05:44:26PM +0200, Felix the double Helix wrote: > Hi, > > Sampo (sa...@ik...) and I have found and fixed a tricky bug in > Net::LDAP version 0.18. > > The problem occurs when you try to bind two times in a row to an > LDAP server using a bind DN and a password. In LDAP.pm, a "last" > statement leaves the iterator in the %ptype associative array in a "bad" > state, so next time the "bind" function is called and the "each" > statement iterates on %ptype it will just see the elements on %ptype > that are left over from the previous operation. > > In my opinion a simple way to fix this is to call the "keys" statement > on %ptype in order to reset the iterator. > > Thanks to Sampo (sa...@ik...) for helping me track this one down! > > Regards, > > - Felix > > > > Here's the context diff: > > > > diff -c lib/Net/LDAP.pm /usr/local/lib/perl5/site_perl/5.005/Net/LDAP.pm > > *** lib/Net/LDAP.pm Mon May 22 13:16:25 2000 > --- /usr/local/lib/perl5/site_perl/5.005/Net/LDAP.pm Thu Jun 8 > 17:38:44 2000 > *************** > *** 168,173 **** > --- 168,174 ---- > > my($auth_type,$passwd) = (simple => ""); > > + > while(my($param,$type) = each %ptype) { > if (exists $arg->{$param}) { > ($auth_type,$passwd) = ($type,$arg->{$param}); > *************** > *** 174,179 **** > --- 175,183 ---- > last; > } > } > + # Reset the iterator on %ptype, otherwise we'll get screwed next > time we > + # run the loop > + keys %ptype; > > if ($auth_type eq 'sasl') { > # if ($version < 3) { > > > |