Patch for Net::SSH::Perl

This blog entry has been originally posted on

Today I ran into an issue with one of my scripts which is generating a report and uploads it to the customer site via FTP. I lately added a SFTP features, as this was a requirement by one customer. To accomplish this, I used the Net::SFTP module which uses Net::SSH::Perl to connect to the SSH server. While I programmed the script all tests worked fine, but when I tried to get it running in production for the customer it was failing.

The debug output of Net::SFTP looked like this:

After digging a bit deeper into this, I figured that Net::SFTP was failing while calling Net::SSH::Perl's _session_channel() function- and within this function the $cmgr->new_channel() function was failing while calling the _dup() function. This function seems to hijack a stream and duplicate it into a new FH. And here is where the problem was. In the _dup() function the original code uses:

which is incorrect and caused the problem.

So I created a patch for this file to correct this issue.


, ,

No comments yet.

Leave a Reply