getpwnam with md5 encrypted passwds
Tim Kientzle
kientzle at acm.org
Wed Nov 26 11:21:28 PST 2003
sapdb at komadev.de wrote:
> Hi,
>
> i am trying to validate a given user password against my local passwd-file with
> this piece of code :
>
> if (!strcmp( crypt(pass,pwd->pw_name), pwd->pw_passwd) ) {
The second argument to crypt here should be pwd->pw_passwd.
Otherwise, this doesn't work even with DES-encrypted passwords.
The first part of any encrypted password is the 'salt', which
effectively indicates how that password is encrypted.
You need to give the encrypted password to crypt so it
knows which encryption to use for the plaintext.
Tim Kientzle
More information about the freebsd-hackers
mailing list