Played some more with it, and I can definitely point at authentication as the source of the problems. I got it to work. Not too well - because it lacks any security whatsoever - but at least it works.
First, about the problems:
When mistyping the password one of the times, smbpasswd shows correct error message and gracefully exits.
When doing everything correctly, it crashes - but writes /private/smbpasswd file before that.
I've tried to run it with debug level = 9, it showed lots of info when starting, and after changing passwords - just the regular "Segmentation fault" crash.
in smb.conf, setting password encryption = off causes the Windows to throw "this user isn't authorized to login from this station" error instead of asking for username.
But, how I got things to work?
Well, since I was certain that it's the authentication mechanisms that prevent it from working, I prevented those authentication mechanisms from functioning. At first I wanted to ask Jimmy for a test version that would ignore user/password checking, but then I thought that I might do it in smb.conf file. So here is what I did:
security = SHARE # instead of USER
guest ok = yes # instead of no
With these settings, I get no password prompts and Samba works! I see SD card share, and can copy to/from it.
* The main script (samba-rc) works well in killing all the smbd processes on stop/restart.
* Server still runs when the phone is in sleep mode, just much slower.
Jimmy, could you please test smbpasswd compilation to find out why it crashes on 2.1 (I'm running Cyanogen 5.0.6)? Once it's done, I believe that this will work anywhere.
Also, something could probably be done to make it speed up CPU / network on demand when the phone is sleeping, or to prevent the phone from sleeping while it's running - and a GUI can be made for controlling it, since it'll be fully functional.