X-Git-Url: http://andersk.mit.edu/gitweb/gssapi-openssh.git/blobdiff_plain/884dc78b37d30d2afc7a88c60fd6a88563d126d7..255d7550082d59ec8f69f57b122d8fcfe179f4f9:/openssh/auth2-passwd.c diff --git a/openssh/auth2-passwd.c b/openssh/auth2-passwd.c index ffa2795..421c5c2 100644 --- a/openssh/auth2-passwd.c +++ b/openssh/auth2-passwd.c @@ -1,3 +1,4 @@ +/* $OpenBSD: auth2-passwd.c,v 1.9 2006/08/03 03:34:41 deraadt Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * @@ -23,12 +24,22 @@ */ #include "includes.h" -RCSID("$OpenBSD: auth2-passwd.c,v 1.2 2002/05/31 11:35:15 markus Exp $"); + +#include + +#include +#include #include "xmalloc.h" #include "packet.h" #include "log.h" +#include "key.h" +#include "hostfile.h" #include "auth.h" +#include "buffer.h" +#ifdef GSSAPI +#include "ssh-gss.h" +#endif #include "monitor_wrap.h" #include "servconf.h" @@ -38,21 +49,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) - log("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 (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 - PRIVSEP(auth_password(authctxt, password)) == 1) - authenticated = 1; memset(password, 0, len); xfree(password); return authenticated;