comparison svr-auth.c @ 579:8c737cd7c1af

merge of '48fdaa8706d1acda35e9d564adc9a1fbc96c18c8' and '658fd03abd21e0da7c4c89b9fff9dc693c72daae'
author Matt Johnston <matt@ucc.asn.au>
date Sat, 27 Feb 2010 11:53:18 +0000
parents d3ea8b9672f0
children a98a2138364a
comparison
equal deleted inserted replaced
577:69e98c45db7c 579:8c737cd7c1af
31 #include "buffer.h" 31 #include "buffer.h"
32 #include "ssh.h" 32 #include "ssh.h"
33 #include "packet.h" 33 #include "packet.h"
34 #include "auth.h" 34 #include "auth.h"
35 #include "runopts.h" 35 #include "runopts.h"
36 #include "random.h"
36 37
37 static void authclear(); 38 static void authclear();
38 static int checkusername(unsigned char *username, unsigned int userlen); 39 static int checkusername(unsigned char *username, unsigned int userlen);
39 static void send_msg_userauth_banner(); 40 static void send_msg_userauth_banner();
40 41
335 336
336 buf_putbyte(ses.writepayload, partial ? 1 : 0); 337 buf_putbyte(ses.writepayload, partial ? 1 : 0);
337 encrypt_packet(); 338 encrypt_packet();
338 339
339 if (incrfail) { 340 if (incrfail) {
340 usleep(300000); /* XXX improve this */ 341 unsigned int delay;
342 genrandom((unsigned char*)&delay, sizeof(delay));
343 /* We delay for 300ms +- 50ms, 0.1ms granularity */
344 delay = 250000 + (delay % 1000)*100;
345 usleep(delay);
346 dropbear_log(LOG_INFO, "delay is %d", delay);
341 ses.authstate.failcount++; 347 ses.authstate.failcount++;
342 } 348 }
343 349
344 if (ses.authstate.failcount >= MAX_AUTH_TRIES) { 350 if (ses.authstate.failcount >= MAX_AUTH_TRIES) {
345 char * userstr; 351 char * userstr;