summaryrefslogtreecommitdiffhomepage
path: root/svr-auth.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2010-02-27 11:53:18 +0000
committerMatt Johnston <matt@ucc.asn.au>2010-02-27 11:53:18 +0000
commitddbfdb079991e9705c8874ae2d2dbd64394f269c (patch)
tree6358929d48902659b423493edf17831541c732ac /svr-auth.c
parent85288d7b6174b78af903fb55593bccd0014e5f30 (diff)
parent3b078445482f42dabfe4922e67a958dc607b166f (diff)
merge of '48fdaa8706d1acda35e9d564adc9a1fbc96c18c8'
and '658fd03abd21e0da7c4c89b9fff9dc693c72daae' --HG-- extra : convert_revision : 8064882fcaa13d586651021462b9014b74332107
Diffstat (limited to 'svr-auth.c')
-rw-r--r--svr-auth.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/svr-auth.c b/svr-auth.c
index 5da0aa7..9e468fa 100644
--- a/svr-auth.c
+++ b/svr-auth.c
@@ -33,6 +33,7 @@
#include "packet.h"
#include "auth.h"
#include "runopts.h"
+#include "random.h"
static void authclear();
static int checkusername(unsigned char *username, unsigned int userlen);
@@ -337,7 +338,12 @@ void send_msg_userauth_failure(int partial, int incrfail) {
encrypt_packet();
if (incrfail) {
- usleep(300000); /* XXX improve this */
+ unsigned int delay;
+ genrandom((unsigned char*)&delay, sizeof(delay));
+ /* We delay for 300ms +- 50ms, 0.1ms granularity */
+ delay = 250000 + (delay % 1000)*100;
+ usleep(delay);
+ dropbear_log(LOG_INFO, "delay is %d", delay);
ses.authstate.failcount++;
}