X-Git-Url: http://andersk.mit.edu/gitweb/openssh.git/blobdiff_plain/0608f8a76d47cd2ad0269dfa506e040cce5454bd..ef4d1846b878bfb37c1725433f152b749bd16480:/auth2-passwd.c diff --git a/auth2-passwd.c b/auth2-passwd.c index 8eb18f2e..a1e77c41 100644 --- a/auth2-passwd.c +++ b/auth2-passwd.c @@ -1,3 +1,4 @@ +/* $OpenBSD: auth2-passwd.c,v 1.7 2006/03/25 13:17:01 djm Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * @@ -23,7 +24,6 @@ */ #include "includes.h" -RCSID("$OpenBSD: auth2-passwd.c,v 1.3 2003/04/08 20:21:28 itojun Exp $"); #include "xmalloc.h" #include "packet.h" @@ -38,21 +38,29 @@ extern ServerOptions options; static int userauth_passwd(Authctxt *authctxt) { - char *password; + char *password, *newpass; int authenticated = 0; int change; - u_int len; + u_int len, newlen; + change = packet_get_char(); - if (change) - logit("password change not supported"); password = packet_get_string(&len); + if (change) { + /* discard new password from packet */ + newpass = packet_get_string(&newlen); + memset(newpass, 0, newlen); + xfree(newpass); + } packet_check_eom(); - if (PRIVSEP(auth_password(authctxt, password)) == 1 && authctxt->valid + + if (change) + logit("password change not supported"); + else if (PRIVSEP(auth_password(authctxt, password)) == 1) + authenticated = 1; #ifdef HAVE_CYGWIN - && check_nt_auth(1, authctxt->pw) + if (check_nt_auth(1, authctxt->pw) == 0) + authenticated = 0; #endif - ) - authenticated = 1; memset(password, 0, len); xfree(password); return authenticated;