Date: Wed, 26 Nov 2003 11:21:24 -0800 From: Tim Kientzle <kientzle@acm.org> To: "sapdb@komadev.de" <kai@freshx.de> Cc: freebsd-hackers@freebsd.org Subject: Re: getpwnam with md5 encrypted passwds Message-ID: <3FC4FD34.2060807@acm.org> In-Reply-To: <1069810210.3fc40222e2bca@localhost> References: <1069810210.3fc40222e2bca@localhost>
next in thread | previous in thread | raw e-mail | index | archive | help
sapdb@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3FC4FD34.2060807>