From dd1c7baf1a35d3bfd36cb1c283d08bbeb28f2831 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 19 Nov 1999 15:53:20 +1100 Subject: - Added non-PAM MD5 password support patch from Tudor Bosman --- auth-passwd.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'auth-passwd.c') diff --git a/auth-passwd.c b/auth-passwd.c index ea824f5f..a08bab3a 100644 --- a/auth-passwd.c +++ b/auth-passwd.c @@ -15,7 +15,10 @@ the password is valid for the user. */ #include "includes.h" -RCSID("$Id: auth-passwd.c,v 1.4 1999/11/13 04:40:10 damien Exp $"); + +#ifndef HAVE_PAM + +RCSID("$Id: auth-passwd.c,v 1.5 1999/11/19 04:53:20 damien Exp $"); #include "packet.h" #include "ssh.h" @@ -27,7 +30,10 @@ RCSID("$Id: auth-passwd.c,v 1.4 1999/11/13 04:40:10 damien Exp $"); #include #endif -#ifndef HAVE_PAM +#ifdef HAVE_MD5_PASSWORDS +#include "md5crypt.h" +#endif + /* Don't need anything from here if we are using PAM */ /* Tries to authenticate the user using password. Returns true if @@ -187,7 +193,14 @@ int auth_password(struct passwd *pw, const char *password) return(0); /* Encrypt the candidate password using the proper salt. */ +#ifdef HAVE_MD5_PASSWORDS + if (is_md5_salt(spw->sp_pwdp)) + encrypted_password = md5_crypt(password, spw->sp_pwdp); + else + encrypted_password = crypt(password, spw->sp_pwdp); +#else /* HAVE_MD5_PASSWORDS */ encrypted_password = crypt(password, spw->sp_pwdp); +#endif /* HAVE_MD5_PASSWORDS */ /* Authentication is accepted if the encrypted passwords are identical. */ return (strcmp(encrypted_password, spw->sp_pwdp) == 0); -- cgit v1.2.3