mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Sync OpenBSD patchset 314:
Tell the user when sleeping due to password backoff.
This commit is contained in:
parent
895efe7b05
commit
51a1f25247
13
server.c
13
server.c
@ -1,4 +1,4 @@
|
||||
/* $Id: server.c,v 1.178 2009-09-02 21:36:00 nicm Exp $ */
|
||||
/* $Id: server.c,v 1.179 2009-09-04 20:27:06 tcunha Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -608,6 +608,8 @@ server_redraw_locked(struct client *c)
|
||||
screen_write_cursormove(&ctx, 0, 0);
|
||||
screen_write_puts(
|
||||
&ctx, &gc, "%u failed attempts", password_failures);
|
||||
if (time(NULL) < password_backoff)
|
||||
screen_write_puts(&ctx, &gc, "; sleeping");
|
||||
}
|
||||
|
||||
screen_write_stop(&ctx);
|
||||
@ -1186,6 +1188,7 @@ void
|
||||
server_second_timers(void)
|
||||
{
|
||||
struct window *w;
|
||||
struct client *c;
|
||||
struct window_pane *wp;
|
||||
u_int i;
|
||||
int xtimeout;
|
||||
@ -1194,6 +1197,7 @@ server_second_timers(void)
|
||||
time_t t;
|
||||
|
||||
t = time(NULL);
|
||||
|
||||
xtimeout = options_get_number(&global_s_options, "lock-after-time");
|
||||
if (xtimeout > 0 && t > server_activity + xtimeout)
|
||||
server_lock();
|
||||
@ -1209,6 +1213,13 @@ server_second_timers(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (t > password_backoff) {
|
||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||
if ((c = ARRAY_ITEM(&clients, i)) != NULL)
|
||||
server_redraw_client(c);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for a minute having passed. */
|
||||
gmtime_r(&t, &now);
|
||||
gmtime_r(&last_t, &then);
|
||||
|
Loading…
Reference in New Issue
Block a user