Net-SSH-Perl - Bug in Channel.pm when stdin length is just right

Posted on Fri Aug 12 00:02:11 2005 by cmv
Bug in Channel.pm when stdin length is just right
Folks-
I believe I've uncovered a bug when I try to do:
$ssh->cmd($cmd, $stdin);
...and the length of $stdin is just right.
I've narrowed it down to the process_outgoing() routine in Channel.pm, but didn't follow it any further. Here is the debug output (to which, I've added some additional debugging statements):
... nimrod.ih.lucent.com: Login completed, opening dummy shell channel. nimrod.ih.lucent.com: channel 0: new [client-session] nimrod.ih.lucent.com: Requesting channel_open for channel 0. nimrod.ih.lucent.com: channel 0: open confirm rwindow 0 rmax 32768 nimrod.ih.lucent.com: Got channel open confirmation, requesting shell. nimrod.ih.lucent.com: Requesting service shell on channel 0. nimrod.ih.lucent.com: channel 1: new [client-session] nimrod.ih.lucent.com: Requesting channel_open for channel 1. nimrod.ih.lucent.com: Entering interactive session. nimrod.ih.lucent.com: Sending command: /opt/nwstools/bin/predecode nimrod.ih.lucent.com: Requesting service exec on channel 1. nimrod.ih.lucent.com: Checking stdin... nimrod.ih.lucent.com: Draining stdin... nimrod.ih.lucent.com: channel 1: drain_outgoing - length=32769 nimrod.ih.lucent.com: channel 1: process_outgoing - remote_window=0 nimrod.ih.lucent.com: channel 1: process_outgoing - remote_maxpacket=32768 nimrod.ih.lucent.com: channel 1: process_outgoing - length=32769 len=0 nimrod.ih.lucent.com: channel 1: process_outgoing - remote_window=0 nimrod.ih.lucent.com: channel 1: process_outgoing - remote_maxpacket=32768 nimrod.ih.lucent.com: channel 1: process_outgoing - length=32769 len=0 nimrod.ih.lucent.com: channel 1: process_outgoing - remote_window=131072 nimrod.ih.lucent.com: channel 1: process_outgoing - remote_maxpacket=32768 nimrod.ih.lucent.com: channel 1: process_outgoing - length=32769 len=32768 nimrod.ih.lucent.com: channel 1: process_outgoing - remote_window=98304 nimrod.ih.lucent.com: channel 1: process_outgoing - remote_maxpacket=32768 nimrod.ih.lucent.com: channel 1: process_outgoing - length=1 len=1 nimrod.ih.lucent.com: channel 1: window 12173 sent adjust 20595

As you can see, the length of the stdin string was just one over the remote_maxpacket. If the stdin string is under remote_maxpacket, it all works fine. You can also make it work fine with particular values over remote_maxpacket, but I haven't been able to pin down a pattern.
Any help is appreciated.
Thanks
-Craig
Direct Responses: 892 | Write a response