]> git.pld-linux.org Git - packages/pure-ftpd.git/blob - pure-ftpd-sleep.patch
- fix pureftpd.passwd and pureftpd.pdb location in manuals
[packages/pure-ftpd.git] / pure-ftpd-sleep.patch
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 @@
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;    
15 @@ -1571,27 +1576,28 @@
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);
43 +       randomsleep(tapping);
44          if (tapping >= MAX_PASSWD_TRIES) {
45 -            goto toomanytries;
46 +           addreply_noformat(530, MSG_AUTH_FAILED);
47 +           doreply();
48 +           _EXIT(EXIT_FAILURE);
49          }
50 -        addreply_noformat(530, MSG_NOTRUST);
51 -        goto randomsleep;
52 +       addreply_noformat(530, MSG_NOTRUST);
53 +       doreply();
54 +       return;
55      }
56  
57  #ifdef PER_USER_LIMITS
This page took 0.028418 seconds and 3 git commands to generate.