comparison svr-authpasswd.c @ 676:0edf08895a33

Return immediate success for blank passwords if allowed
author Matt Johnston <matt@ucc.asn.au>
date Wed, 09 May 2012 22:37:04 +0800
parents d40f3cc47aed
children 55b84e59aaad
comparison
equal deleted inserted replaced
675:dfdb9d9189ff 676:0edf08895a33
34 34
35 /* Process a password auth request, sending success or failure messages as 35 /* Process a password auth request, sending success or failure messages as
36 * appropriate */ 36 * appropriate */
37 void svr_auth_password() { 37 void svr_auth_password() {
38 38
39 #ifdef HAVE_SHADOW_H
40 struct spwd *spasswd = NULL;
41 #endif
42 char * passwdcrypt = NULL; /* the crypt from /etc/passwd or /etc/shadow */ 39 char * passwdcrypt = NULL; /* the crypt from /etc/passwd or /etc/shadow */
43 char * testcrypt = NULL; /* crypt generated from the user's password sent */ 40 char * testcrypt = NULL; /* crypt generated from the user's password sent */
44 unsigned char * password; 41 unsigned char * password;
45 int success_blank = 0; 42 int success_blank = 0;
46 unsigned int passwordlen; 43 unsigned int passwordlen;
47 44
48 unsigned int changepw; 45 unsigned int changepw;
49 46
50 passwdcrypt = ses.authstate.pw_passwd; 47 passwdcrypt = ses.authstate.pw_passwd;
51 #ifdef HAVE_SHADOW_H
52 /* get the shadow password if possible */
53 spasswd = getspnam(ses.authstate.pw_name);
54 if (spasswd != NULL && spasswd->sp_pwdp != NULL) {
55 passwdcrypt = spasswd->sp_pwdp;
56 }
57 #endif
58 48
59 #ifdef DEBUG_HACKCRYPT 49 #ifdef DEBUG_HACKCRYPT
60 /* debugging crypt for non-root testing with shadows */ 50 /* debugging crypt for non-root testing with shadows */
61 passwdcrypt = DEBUG_HACKCRYPT; 51 passwdcrypt = DEBUG_HACKCRYPT;
62 #endif 52 #endif