]>
Commit | Line | Data |
---|---|---|
a665a761 AM |
1 | --- pure-ftpd/src/ftpd.c.orig 2007-12-20 09:59:10.629736723 +0100 |
2 | +++ pure-ftpd/src/ftpd.c 2007-12-20 10:02:06.655676098 +0100 | |
3 | @@ -1531,6 +1531,11 @@ | |
9f27bb17 AM |
4 | return chdir(home); |
5 | } | |
6 | ||
7 | +static void randomsleep(unsigned int t) { | |
8 | + usleep2((unsigned long) (zrand() % PASSWD_FAILURE_DELAY)); | |
9 | + usleep2(t * PASSWD_FAILURE_DELAY); | |
10 | +} | |
11 | + | |
12 | void dopass(char *password) | |
13 | { | |
14 | static unsigned int tapping; | |
a665a761 | 15 | @@ -1571,27 +1576,28 @@ |
9f27bb17 AM |
16 | } |
17 | } | |
18 | if (authresult.auth_ok != 1) { | |
19 | - addreply_noformat(530, MSG_AUTH_FAILED); | |
20 | - doreply(); | |
21 | - if (tapping >= MAX_PASSWD_TRIES) { | |
22 | - toomanytries: | |
23 | - logfile(LOG_ERR, MSG_AUTH_TOOMANY); | |
24 | - _EXIT(EXIT_FAILURE); | |
25 | - } | |
26 | - logfile(LOG_WARNING, MSG_AUTH_FAILED_LOG, account); | |
27 | - randomsleep: | |
28 | tapping++; | |
29 | - usleep2((unsigned long) (zrand() % PASSWD_FAILURE_DELAY)); | |
30 | - usleep2(tapping * PASSWD_FAILURE_DELAY); | |
31 | + randomsleep(tapping); | |
32 | + addreply_noformat(530, MSG_AUTH_FAILED); | |
33 | + doreply(); | |
34 | + if (tapping > MAX_PASSWD_TRIES) { | |
35 | + logfile(LOG_ERR, MSG_AUTH_TOOMANY); | |
36 | + _EXIT(EXIT_FAILURE); | |
37 | + } | |
38 | + logfile(LOG_WARNING, MSG_AUTH_FAILED_LOG, account); | |
39 | return; | |
40 | } | |
41 | if (authresult.uid < useruid) { | |
42 | logfile(LOG_WARNING, MSG_ACCOUNT_DISABLED, account); | |
a665a761 AM |
43 | + randomsleep(tapping); |
44 | if (tapping >= MAX_PASSWD_TRIES) { | |
9f27bb17 | 45 | - goto toomanytries; |
a665a761 AM |
46 | + addreply_noformat(530, MSG_AUTH_FAILED); |
47 | + doreply(); | |
48 | + _EXIT(EXIT_FAILURE); | |
49 | } | |
9f27bb17 AM |
50 | - addreply_noformat(530, MSG_NOTRUST); |
51 | - goto randomsleep; | |
a665a761 | 52 | + addreply_noformat(530, MSG_NOTRUST); |
9f27bb17 | 53 | + doreply(); |
a665a761 | 54 | + return; |
9f27bb17 AM |
55 | } |
56 | ||
57 | #ifdef PER_USER_LIMITS |