Mercurial > dropbear
comparison svr-authpasswd.c @ 33:f789045062e6
Progressing client support
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 27 Jul 2004 16:30:46 +0000 |
parents | fe6bca95afa7 |
children | 0fe267cc9dee |
comparison
equal
deleted
inserted
replaced
32:8fd0cdbb5b1b | 33:f789045062e6 |
---|---|
33 | 33 |
34 #ifdef DROPBEAR_PASSWORD_AUTH | 34 #ifdef DROPBEAR_PASSWORD_AUTH |
35 | 35 |
36 /* Process a password auth request, sending success or failure messages as | 36 /* Process a password auth request, sending success or failure messages as |
37 * appropriate */ | 37 * appropriate */ |
38 void passwordauth() { | 38 void svr_auth_password() { |
39 | 39 |
40 #ifdef HAVE_SHADOW_H | 40 #ifdef HAVE_SHADOW_H |
41 struct spwd *spasswd; | 41 struct spwd *spasswd; |
42 #endif | 42 #endif |
43 char * passwdcrypt; /* the crypt from /etc/passwd or /etc/shadow */ | 43 char * passwdcrypt; /* the crypt from /etc/passwd or /etc/shadow */ |
45 unsigned char * password; | 45 unsigned char * password; |
46 unsigned int passwordlen; | 46 unsigned int passwordlen; |
47 | 47 |
48 unsigned char changepw; | 48 unsigned char changepw; |
49 | 49 |
50 passwdcrypt = svr_ses.authstate.pw->pw_passwd; | 50 passwdcrypt = ses.authstate.pw->pw_passwd; |
51 #ifdef HAVE_SHADOW_H | 51 #ifdef HAVE_SHADOW_H |
52 /* get the shadow password if possible */ | 52 /* get the shadow password if possible */ |
53 spasswd = getspnam(svr_ses.authstate.pw->pw_name); | 53 spasswd = getspnam(ses.authstate.pw->pw_name); |
54 if (spasswd != NULL && spasswd->sp_pwdp != NULL) { | 54 if (spasswd != NULL && spasswd->sp_pwdp != NULL) { |
55 passwdcrypt = spasswd->sp_pwdp; | 55 passwdcrypt = spasswd->sp_pwdp; |
56 } | 56 } |
57 #endif | 57 #endif |
58 | 58 |
64 /* check for empty password - need to do this again here | 64 /* check for empty password - need to do this again here |
65 * since the shadow password may differ to that tested | 65 * since the shadow password may differ to that tested |
66 * in auth.c */ | 66 * in auth.c */ |
67 if (passwdcrypt[0] == '\0') { | 67 if (passwdcrypt[0] == '\0') { |
68 dropbear_log(LOG_WARNING, "user '%s' has blank password, rejected", | 68 dropbear_log(LOG_WARNING, "user '%s' has blank password, rejected", |
69 svr_ses.authstate.printableuser); | 69 ses.authstate.printableuser); |
70 send_msg_userauth_failure(0, 1); | 70 send_msg_userauth_failure(0, 1); |
71 return; | 71 return; |
72 } | 72 } |
73 | 73 |
74 /* check if client wants to change password */ | 74 /* check if client wants to change password */ |
90 | 90 |
91 if (strcmp(testcrypt, passwdcrypt) == 0) { | 91 if (strcmp(testcrypt, passwdcrypt) == 0) { |
92 /* successful authentication */ | 92 /* successful authentication */ |
93 dropbear_log(LOG_NOTICE, | 93 dropbear_log(LOG_NOTICE, |
94 "password auth succeeded for '%s'", | 94 "password auth succeeded for '%s'", |
95 svr_ses.authstate.printableuser); | 95 ses.authstate.printableuser); |
96 send_msg_userauth_success(); | 96 send_msg_userauth_success(); |
97 } else { | 97 } else { |
98 dropbear_log(LOG_WARNING, | 98 dropbear_log(LOG_WARNING, |
99 "bad password attempt for '%s'", | 99 "bad password attempt for '%s'", |
100 svr_ses.authstate.printableuser); | 100 ses.authstate.printableuser); |
101 send_msg_userauth_failure(0, 1); | 101 send_msg_userauth_failure(0, 1); |
102 } | 102 } |
103 | 103 |
104 m_burn(password, passwordlen); | 104 m_burn(password, passwordlen); |
105 m_free(password); | 105 m_free(password); |