Net::SSH::Perl and Windows 2000

djberg96 on 2002-02-04T14:08:27

So, last night I decided to kill two birds with one stone and watch the Superbowl at the same time I was working on getting sshd, and Net::SSH::Perl, up and running on my Win2k box at home. Having an ATI video card with a built-in TV tuner is pretty handy sometimes.

Anyway, the first step is getting ssh from cygwin. Ok - I forgot to grab that package, so I went out and installed it. Then I had to figure out how to get sshd running properly. I managed to find two different sets of instructions which were not the same.

First hitch - something has barfed my cygwin environment. It suddenly doesn't know who I am anymore, which I first notice when I try to run ssh-keygen. Screw it - I reinstall cygwin from scratch, including openssh this time. Problem solved.

Next, there's a bug in the openssh that comes with cygwin (cygregex.dll problem). Fine - I get the patch for that and it's fixed.

Next, following the first set of instructions was probably a mistake, as it had me doing things manually (like editing the registry) that the second set of instructions said I could do automatically. I'm also worried that editing the registry will hose up my computer. If that happens, the girlfriend will effing kill me!

Next, I seem to be done, but I'm getting some weird logon error when I try to start sshd. After going to the second set of instructions, I manage to get sshd up and running (though it doesn't seem to work in debug mode because it can't fork). Hooray!

Ok - then I go back to modifying the Net::SSH::Perl module, manually grep'ing through all the files looking for instances of Math::GMP. I add conditional code for Math::BigInt as a replacement everywhere I can find it if it detects the MSWin32 platform.

The moment finally arrives - I launch my problem and...IT CONNECTS!

Uhhhh....Houston, we have a problem.

I'm not getting anything back. Hmmm. The ps command definitely shows a connection, but there's a slight problem - the "F_SETFL" flag is not defined for Windows (at least, not in the ActiveState distro), and Ben makes an fnctl call that uses this flag. What does that mean for us? No non-blocking sockets in Windows.

AAAARRRRGGGGGHHHHHH!

I manage to find a post out on the web that provides a coded solution, using ioctl instead of fcntl. I try it, crossing my fingers - it doesn't work. Phooey.

So, uh, now what? Well, I've contacted Ben about this. I've also contacted ActiveState and asked if they plan on providing a definition for the "F_SETFL" flag anytime soon.

I'm not holding my breath...