comparison svr-auth.c @ 35:0ad5fb979f42

set the isserver flag (oops) fix password auth for the server
author Matt Johnston <matt@ucc.asn.au>
date Thu, 29 Jul 2004 02:19:03 +0000
parents f789045062e6
children 3b2a5a1c4347 eee77ac31ccc
comparison
equal deleted inserted replaced
34:e2a1eaa19f22 35:0ad5fb979f42
56 memset(&ses.authstate, 0, sizeof(ses.authstate)); 56 memset(&ses.authstate, 0, sizeof(ses.authstate));
57 #ifdef DROPBEAR_PUBKEY_AUTH 57 #ifdef DROPBEAR_PUBKEY_AUTH
58 ses.authstate.authtypes |= AUTH_TYPE_PUBKEY; 58 ses.authstate.authtypes |= AUTH_TYPE_PUBKEY;
59 #endif 59 #endif
60 #ifdef DROPBEAR_PASSWORD_AUTH 60 #ifdef DROPBEAR_PASSWORD_AUTH
61 if (svr_opts.noauthpass) { 61 if (!svr_opts.noauthpass) {
62 ses.authstate.authtypes |= AUTH_TYPE_PASSWORD; 62 ses.authstate.authtypes |= AUTH_TYPE_PASSWORD;
63 } 63 }
64 #endif 64 #endif
65 65
66 } 66 }
98 98
99 TRACE(("enter recv_msg_userauth_request")); 99 TRACE(("enter recv_msg_userauth_request"));
100 100
101 /* ignore packets if auth is already done */ 101 /* ignore packets if auth is already done */
102 if (ses.authstate.authdone == 1) { 102 if (ses.authstate.authdone == 1) {
103 TRACE(("leave recv_msg_userauth_request: authdone already"));
103 return; 104 return;
104 } 105 }
105 106
106 /* send the banner if it exists, it will only exist once */ 107 /* send the banner if it exists, it will only exist once */
107 if (svr_opts.banner) { 108 if (svr_opts.banner) {
127 128
128 /* user wants to know what methods are supported */ 129 /* user wants to know what methods are supported */
129 if (methodlen == AUTH_METHOD_NONE_LEN && 130 if (methodlen == AUTH_METHOD_NONE_LEN &&
130 strncmp(methodname, AUTH_METHOD_NONE, 131 strncmp(methodname, AUTH_METHOD_NONE,
131 AUTH_METHOD_NONE_LEN) == 0) { 132 AUTH_METHOD_NONE_LEN) == 0) {
133 TRACE(("recv_msg_userauth_request: 'none' request"));
132 send_msg_userauth_failure(0, 0); 134 send_msg_userauth_failure(0, 0);
133 goto out; 135 goto out;
134 } 136 }
135 137
136 /* check username is good before continuing */ 138 /* check username is good before continuing */
303 buf_free(typebuf); 305 buf_free(typebuf);
304 306
305 buf_putbyte(ses.writepayload, partial ? 1 : 0); 307 buf_putbyte(ses.writepayload, partial ? 1 : 0);
306 encrypt_packet(); 308 encrypt_packet();
307 309
310 TRACE(("auth fail: methods %d, '%s'", ses.authstate.authtypes,
311 buf_getptr(typebuf, typebuf->len)));
312
308 if (incrfail) { 313 if (incrfail) {
309 usleep(300000); /* XXX improve this */ 314 usleep(300000); /* XXX improve this */
310 ses.authstate.failcount++; 315 ses.authstate.failcount++;
311 } 316 }
312 317