Outdoing the monkeys with a little API learning
Yesterday I wrote about monkey sysadmin work and people who did things by hand instead of automating them. Today I will share a story about a time when I invaded the land of NT to show them how it was done.
Back in the days when I created a home-grown CD tower, I noticed a few interesting things about the Procom boxes they already had. They came with an odd little program that was intended to run on NT. It would export the list of users and groups and group memberships in the SAM. Their towers would then connect to this to use it for some reason I never quite identified.
Anyway, some years later, we were having our biannual vaporware talk about "how could we serve files to users without having NT". All of this stuff started fitting into place for me. I decided to write my own little hack which would extract users, groups, and their mappings from NT and then create their equivalents on my Linux boxes. This was before Samba's winbind stuff was ready for use, by the way.
Obviously, this meant getting this data out of the NT boxes. That Procom software wasn't able to do everything I needed for some reason, so that meant writing a replacement. Yep, I was actually looking at writing a program to run on Windows. More than that, it was supposed to do a bunch of system API calls. Oh, and it had to be a network server. And finally, it had to be a full-on service! No terminal windows for us.
I'd never written code for any kind of Windows system, and by extension had no idea about the Win32 API stuff, or how sockets worked on there, or anything about creating services. This was a disaster in the making, right?
Wrong. I'm not one of the monkeys. I held my breath and learned enough about Perl and ActiveState (an implementation for Windows with pretty good API support) to create a small dumb server. That plus Srvany.exe gave me a service, and that was that. The Linux side involved a lot of crazy mappings and NIS+. Ew. It worked, but it was really ugly.
This project never went anywhere, but I did manage to prove that you can easily access the user records from a program with no prior knowledge if you have the fundamentals down.
Some people do, some people don't.