From: Pythagoras W. <py...@ec...> - 2000-05-09 05:41:10
|
On Mon, May 08, 2000 at 10:07:48PM +0100, Graham Barr wrote: :On Mon, May 08, 2000 at 09:40:09PM +0100, Steve Haslam wrote: :> On Mon, May 08, 2000 at 09:27:54PM +0100, Graham Barr wrote: :> > On Mon, May 08, 2000 at 09:08:27PM +0100, Steve Haslam wrote: :> > > Also, sometimes I get the "$ldap received:" message and then no hex :> > > dump. Particularly if I'm requesting a large value (jpegPhoto :> > > attributes for instance). :> > :> > Hm, does this happen if you changed to using asn_read ? :> :> If I change asn_recv to asn_read then it hangs before printing that :> "$ldap received:" message. : :Is that with the patch from sourceforge ? : :Hm, that is because asn_recv is returning too early, but asn_read is waiting :for more data. THis is exactly whay someone else reported on NT. The :server says that it has sent the data. : :Now we know it is not platform specific. : :If anyone can help track this one down I would be very grateful as I :have been unable to reproduce it. I have attached a script that can be used to cause this problem. Basically, the script sits between your client and the LDAP server. Client requests are sent to the server. Server responses are sent to the client, but are split into small packets that arrive slowly. This causes asn_recv() to enter this "if" statement: 74 if ($len > length $buf) { 75 # Cannot get whole element 76 $_[1]=''; 77 return $peer; 78 } In my test, I ended up with a "$len=14", but "length $buf = 2". Since $peer is defined, the call to asn_recv in LDAP.pm succeeds: 571 defined asn_recv($sock, $pdu, 0) but $pdu is the empty string (from the "$_[1]=''" above). The debug code happily prints out nothing but the "$ldap received:" message [1], and then the call to decode: 586 my $result = $LDAPResponse->decode($pdu) fails causing an LDAP_DECODING_ERROR to be returned: 572 or return LDAP_OPERATIONS_ERROR; Normally, this is hard to notice, since packets usually arrive before they need to be processed and/or an "LDAP" packet is completely contained in a TCP packet. Note the openldap's ldapsearch does succeed even with the really small buffer size of two. Also, asn_recv goes into an infinite loop if you uncomment the XXX line in my script. With warnings on it prints: Use of uninitialized value at \ /opt/perl/lib/site_perl/5.00557/Convert/ASN1/IO.pm line 45. Out of memory! -Py [1] See the attached patch for a minor recommendation that might have made this a bit more obvious to notice. -- Py (Amateur Radio: KF6WFP) -- 3.141592653589793238462643383... Pythagoras Watson -- "Live long and may all your kernels pop." === py...@cs... ==== http://www.ecst.csuchico.edu/~py/ === |