comparison svr-authpasswd.c @ 1122:aaf576b27a10

Merge pull request #13 from gazoo74/fix-warnings Fix warnings
author Matt Johnston <matt@ucc.asn.au>
date Thu, 04 Jun 2015 23:08:50 +0800
parents 50f8a24953e6
children 750ec4ec4cbe
comparison
equal deleted inserted replaced
1087:1e486f368ec3 1122:aaf576b27a10
50 * appropriate */ 50 * appropriate */
51 void svr_auth_password() { 51 void svr_auth_password() {
52 52
53 char * passwdcrypt = NULL; /* the crypt from /etc/passwd or /etc/shadow */ 53 char * passwdcrypt = NULL; /* the crypt from /etc/passwd or /etc/shadow */
54 char * testcrypt = NULL; /* crypt generated from the user's password sent */ 54 char * testcrypt = NULL; /* crypt generated from the user's password sent */
55 unsigned char * password; 55 char * password;
56 unsigned int passwordlen; 56 unsigned int passwordlen;
57 57
58 unsigned int changepw; 58 unsigned int changepw;
59 59
60 passwdcrypt = ses.authstate.pw_passwd; 60 passwdcrypt = ses.authstate.pw_passwd;
73 } 73 }
74 74
75 password = buf_getstring(ses.payload, &passwordlen); 75 password = buf_getstring(ses.payload, &passwordlen);
76 76
77 /* the first bytes of passwdcrypt are the salt */ 77 /* the first bytes of passwdcrypt are the salt */
78 testcrypt = crypt((char*)password, passwdcrypt); 78 testcrypt = crypt(password, passwdcrypt);
79 m_burn(password, passwordlen); 79 m_burn(password, passwordlen);
80 m_free(password); 80 m_free(password);
81 81
82 if (testcrypt == NULL) { 82 if (testcrypt == NULL) {
83 /* crypt() with an invalid salt like "!!" */ 83 /* crypt() with an invalid salt like "!!" */