=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/auth-passwd.c,v retrieving revision 1.23 retrieving revision 1.23.2.2 diff -u -r1.23 -r1.23.2.2 --- src/usr.bin/ssh/auth-passwd.c 2001/06/26 16:15:23 1.23 +++ src/usr.bin/ssh/auth-passwd.c 2002/06/22 07:23:16 1.23.2.2 @@ -36,10 +36,9 @@ */ #include "includes.h" -RCSID("$OpenBSD: auth-passwd.c,v 1.23 2001/06/26 16:15:23 dugsong Exp $"); +RCSID("$OpenBSD: auth-passwd.c,v 1.23.2.2 2002/06/22 07:23:16 miod Exp $"); #include "packet.h" -#include "xmalloc.h" #include "log.h" #include "servconf.h" #include "auth.h" @@ -55,7 +54,6 @@ auth_password(Authctxt *authctxt, const char *password) { struct passwd * pw = authctxt->pw; - char *encrypted_password; /* deny if no user. */ if (pw == NULL) @@ -86,14 +84,20 @@ return 0; else return 1; -#endif +#else /* Check for users with no password. */ if (strcmp(password, "") == 0 && strcmp(pw->pw_passwd, "") == 0) return 1; - /* Encrypt the candidate password using the proper salt. */ - encrypted_password = crypt(password, - (pw->pw_passwd[0] && pw->pw_passwd[1]) ? pw->pw_passwd : "xx"); - - /* Authentication is accepted if the encrypted passwords are identical. */ - return (strcmp(encrypted_password, pw->pw_passwd) == 0); + else { + /* Encrypt the candidate password using the proper salt. */ + char *encrypted_password = crypt(password, + (pw->pw_passwd[0] && pw->pw_passwd[1]) ? + pw->pw_passwd : "xx"); + /* + * Authentication is accepted if the encrypted passwords + * are identical. + */ + return (strcmp(encrypted_password, pw->pw_passwd) == 0); + } +#endif }