summaryrefslogtreecommitdiff
path: root/auth-passwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'auth-passwd.c')
-rw-r--r--auth-passwd.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/auth-passwd.c b/auth-passwd.c
index ea824f5f4..a08bab3af 100644
--- a/auth-passwd.c
+++ b/auth-passwd.c
@@ -15,7 +15,10 @@ the password is valid for the user.
15*/ 15*/
16 16
17#include "includes.h" 17#include "includes.h"
18RCSID("$Id: auth-passwd.c,v 1.4 1999/11/13 04:40:10 damien Exp $"); 18
19#ifndef HAVE_PAM
20
21RCSID("$Id: auth-passwd.c,v 1.5 1999/11/19 04:53:20 damien Exp $");
19 22
20#include "packet.h" 23#include "packet.h"
21#include "ssh.h" 24#include "ssh.h"
@@ -27,7 +30,10 @@ RCSID("$Id: auth-passwd.c,v 1.4 1999/11/13 04:40:10 damien Exp $");
27#include <shadow.h> 30#include <shadow.h>
28#endif 31#endif
29 32
30#ifndef HAVE_PAM 33#ifdef HAVE_MD5_PASSWORDS
34#include "md5crypt.h"
35#endif
36
31/* Don't need anything from here if we are using PAM */ 37/* Don't need anything from here if we are using PAM */
32 38
33/* Tries to authenticate the user using password. Returns true if 39/* Tries to authenticate the user using password. Returns true if
@@ -187,7 +193,14 @@ int auth_password(struct passwd *pw, const char *password)
187 return(0); 193 return(0);
188 194
189 /* Encrypt the candidate password using the proper salt. */ 195 /* Encrypt the candidate password using the proper salt. */
196#ifdef HAVE_MD5_PASSWORDS
197 if (is_md5_salt(spw->sp_pwdp))
198 encrypted_password = md5_crypt(password, spw->sp_pwdp);
199 else
200 encrypted_password = crypt(password, spw->sp_pwdp);
201#else /* HAVE_MD5_PASSWORDS */
190 encrypted_password = crypt(password, spw->sp_pwdp); 202 encrypted_password = crypt(password, spw->sp_pwdp);
203#endif /* HAVE_MD5_PASSWORDS */
191 204
192 /* Authentication is accepted if the encrypted passwords are identical. */ 205 /* Authentication is accepted if the encrypted passwords are identical. */
193 return (strcmp(encrypted_password, spw->sp_pwdp) == 0); 206 return (strcmp(encrypted_password, spw->sp_pwdp) == 0);