| 351 | // Disable attempts to brute-force logins/passwords |
| 352 | |
| 353 | class FailedLogin |
| 354 | { |
| 355 | public: |
| 356 | string login; |
| 357 | int failCount; |
| 358 | time_t lastAttempt; |
| 359 | |
| 360 | explicit FailedLogin(const string& l) |
| 361 | : login(l), failCount(1), lastAttempt(time(0)) |
| 362 | {} |
| 363 | |
| 364 | FailedLogin(MemoryPool& p, const FailedLogin& fl) |
| 365 | : login(p, fl.login), failCount(fl.failCount), lastAttempt(fl.lastAttempt) |
| 366 | {} |
| 367 | |
| 368 | static const string* generate(const FailedLogin* f) |
| 369 | { |
| 370 | return &f->login; |
| 371 | } |
| 372 | }; |
| 373 | |
| 374 | const size_t MAX_CONCURRENT_FAILURES = 16; |
| 375 | const int MAX_FAILED_ATTEMPTS = 4; |