From: Harry Ohlsen Date: 2001-11-30T00:54:39+09:00 Subject: [ruby-talk:26916] Re: Fixed ... partly ... maybe a bug? In article <200111291526.fATFQ5323283@moulon.inra.fr>, "ts" wrote: > ruby must give an error message in this case > > pigeon% ruby -e 'Etc.getpwnam("ts")' > -e:1: uninitialized constant Etc (NameError) pigeon% Yes. I get that error message. Let me try my original code again ... Well, I can't explain why, but it just hangs. I'll have a play and see if I can work out why I don't just get the same error message in this case. It's bound to be something I'm just not seeing! > Try this program and see if it hung > > pigeon% cat a.c > #include > #include > #include > > main() > { > struct passwd *pwd = getpwnam("harryo/xyz"); if (pwd != NULL) > printf("%s\n", pwd->pw_name); > } It doesn't hang; getpwnam() just returns NULL. > pigeon% > > then try it with a valid uid .... and it works fine with a valid UID. > H> The passwd field in the object it returns contains "x", which is > what's H> in /etc/passwd to indicate that the password can be found in > /etc/shadow. > > H> Maybe the code needs to be changed to understand shadow password > files. > > why ? you want to try to crack the passwords ? :-))))) No ... trust me :-). I'm writing a web based program and I want to use the normal user names and passwords for validation purposes. I can encrypt the password, but I need to have something to compare it against. Maybe there's another way to it that I'm unaware of. Any suggestions?