00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "includes.h"
00026 RCSID("$OpenBSD: auth2-passwd.c,v 1.5 2003/12/31 00:24:50 dtucker Exp $");
00027
00028 #include "xmalloc.h"
00029 #include "packet.h"
00030 #include "log.h"
00031 #include "auth.h"
00032 #include "monitor_wrap.h"
00033 #include "servconf.h"
00034
00035
00036 extern ServerOptions options;
00037
00038 static int
00039 userauth_passwd(Authctxt *authctxt)
00040 {
00041 char *password, *newpass;
00042 int authenticated = 0;
00043 int change;
00044 u_int len, newlen;
00045
00046 change = packet_get_char();
00047 password = packet_get_string(&len);
00048 if (change) {
00049
00050 newpass = packet_get_string(&newlen);
00051 memset(newpass, 0, newlen);
00052 xfree(newpass);
00053 }
00054 packet_check_eom();
00055
00056 if (change)
00057 logit("password change not supported");
00058 else if (PRIVSEP(auth_password(authctxt, password)) == 1)
00059 authenticated = 1;
00060 #ifdef HAVE_CYGWIN
00061 if (check_nt_auth(1, authctxt->pw) == 0)
00062 authenticated = 0;
00063 #endif
00064 memset(password, 0, len);
00065 xfree(password);
00066 return authenticated;
00067 }
00068
00069 Authmethod method_passwd = {
00070 "password",
00071 userauth_passwd,
00072 &options.password_authentication
00073 };