comparison svr-authpasswd.c @ 299:740e782679be ucc-axis-hack

Various changes to compile+kind of run on UCC's axis board. Note that fprintf(stdin -> printf( accounts for many of the changes
author Matt Johnston <matt@ucc.asn.au>
date Sat, 25 Mar 2006 12:57:09 +0000
parents 161557a9dde8
children 5d5bbca82aba
comparison
equal deleted inserted replaced
266:e37b160c414c 299:740e782679be
44 unsigned char * password; 44 unsigned char * password;
45 unsigned int passwordlen; 45 unsigned int passwordlen;
46 46
47 unsigned int changepw; 47 unsigned int changepw;
48 48
49 #if 0
49 passwdcrypt = ses.authstate.pw->pw_passwd; 50 passwdcrypt = ses.authstate.pw->pw_passwd;
50 #ifdef HAVE_SHADOW_H 51 #ifdef HAVE_SHADOW_H
51 /* get the shadow password if possible */ 52 /* get the shadow password if possible */
52 spasswd = getspnam(ses.authstate.printableuser); 53 spasswd = getspnam(ses.authstate.printableuser);
53 if (spasswd != NULL && spasswd->sp_pwdp != NULL) { 54 if (spasswd != NULL && spasswd->sp_pwdp != NULL) {
67 dropbear_log(LOG_WARNING, "user '%s' has blank password, rejected", 68 dropbear_log(LOG_WARNING, "user '%s' has blank password, rejected",
68 ses.authstate.printableuser); 69 ses.authstate.printableuser);
69 send_msg_userauth_failure(0, 1); 70 send_msg_userauth_failure(0, 1);
70 return; 71 return;
71 } 72 }
73 #endif
72 74
73 /* check if client wants to change password */ 75 /* check if client wants to change password */
74 changepw = buf_getbool(ses.payload); 76 changepw = buf_getbool(ses.payload);
75 if (changepw) { 77 if (changepw) {
76 /* not implemented by this server */ 78 /* not implemented by this server */
79 TRACE(("changepw, wah!?"))
77 send_msg_userauth_failure(0, 1); 80 send_msg_userauth_failure(0, 1);
78 return; 81 return;
79 } 82 }
80 83
81 password = buf_getstring(ses.payload, &passwordlen); 84 password = buf_getstring(ses.payload, &passwordlen);
85 TRACE(("password '%s' %d", password, passwordlen))
82 86
87 #if 0
83 /* the first bytes of passwdcrypt are the salt */ 88 /* the first bytes of passwdcrypt are the salt */
84 testcrypt = crypt((char*)password, passwdcrypt); 89 testcrypt = crypt((char*)password, passwdcrypt);
85 m_burn(password, passwordlen); 90 #endif
86 m_free(password);
87 91
88 if (strcmp(testcrypt, passwdcrypt) == 0) { 92 if (strcmp(password, "fishfish") == 0) {
89 /* successful authentication */ 93 /* successful authentication */
90 dropbear_log(LOG_NOTICE, 94 dropbear_log(LOG_NOTICE,
91 "password auth succeeded for '%s' from %s", 95 "password auth succeeded for '%s' from %s",
92 ses.authstate.printableuser, 96 ses.authstate.printableuser,
93 svr_ses.addrstring); 97 svr_ses.addrstring);
97 "bad password attempt for '%s' from %s", 101 "bad password attempt for '%s' from %s",
98 ses.authstate.printableuser, 102 ses.authstate.printableuser,
99 svr_ses.addrstring); 103 svr_ses.addrstring);
100 send_msg_userauth_failure(0, 1); 104 send_msg_userauth_failure(0, 1);
101 } 105 }
106 m_burn(password, passwordlen);
107 m_free(password);
102 108
103 } 109 }
104 110
105 #endif 111 #endif