[guest - Mon Aug 15 10:14:33 2005]:
Show quoted text> I've found the bug, and have fixed it as described below. I don't
> think this is the best way to fix it, but it did prove my theory
> on how the bug was occuring.
[excellent fix snip]
Show quoted text>
> This seems to have fixed it for all scenarios that I've tested.
There are two scenarios where this is isn't totally fixed:
1. when the remote peer is running OpenSSH 3.7.1p3
2. when the remote peer is running Sun's deployed SSH identified by
'SSH-1.99-Sun_SSH_1.1'
In these cases, with the DoOneLoop fix, the select() call inside
client_loop hangs indefinitely with a $stdin to cmd() that is
greater than 32768B. More interestingly, it appears that
data on STDIN is put onto the resulting channel which is then put
into the fd on the remote peer.
We've implemented the above, with the following additional changes in
SSH2.pm, Constants.pm, and Channel.pm:
diff /opt/rcs/lib/Net/SSH/Perl/Channel.pm
/opt/rcs/os_deployment/lib/Net/SSH/Perl/Channel.pm
191a192,193
Show quoted text> ## COVD FIX:
> $c->{ssh}->{DoOneLoop} = 10;
195a198,200
Show quoted text> ## COVD FIX:
> undef( $c->{ssh}->{DoOneLoop} );
> delete $c->{ssh}->{DoOneLoop};
diff /opt/rcs/lib/Net/SSH/Perl/Constants.pm
/opt/rcs/os_deployment/lib/Net/SSH/Perl/Constants.pm
138c138
< 'MAX_PACKET_SIZE' => 256000,
---
Show quoted text> 'MAX_PACKET_SIZE' => 8192,
diff /opt/rcs/lib/Net/SSH/Perl/SSH2.pm
/opt/rcs/os_deployment/lib/Net/SSH/Perl/SSH2.pm
302c303,306
< my($rready, $wready) = $select_class->select($rb, $wb);
---
Show quoted text> ## COVD FIX:
> $ssh->debug("Instantiating a select with $ssh->{DoOneLoop}
second timeout.")
Show quoted text> if (exists $ssh->{DoOneLoop} && $ssh->{DoOneLoop} > 0);
> my($rready, $wready) = $select_class->select($rb, $wb, undef,
($ssh->{DoOneLoop} || undef));
313a318,319
Show quoted text> ## COVD FIX:
> last if ($ssh->{DoOneLoop});
This workaround appears to function correctly with any filesize
for SSH implementations identifing themselves as
SSH-1.99-OpenSSH_3.7.1p2, SSH-1.99-Sun_SSH_1.0.1, and
SSH-1.99-Sun_SSH_1.1.
I'm pretty sure this shouldn't make it into an official patch; I'm
just documenting this for anyone else bitten by this. ;)
-jgilbert.