mirror of
https://github.com/tmux/tmux.git
synced 2024-12-14 10:58:48 +00:00
Tell the user when sleeping due to password backoff.
This commit is contained in:
parent
751a2fa915
commit
be0d6faa15
11
server.c
11
server.c
@ -605,6 +605,8 @@ server_redraw_locked(struct client *c)
|
|||||||
screen_write_cursormove(&ctx, 0, 0);
|
screen_write_cursormove(&ctx, 0, 0);
|
||||||
screen_write_puts(
|
screen_write_puts(
|
||||||
&ctx, &gc, "%u failed attempts", password_failures);
|
&ctx, &gc, "%u failed attempts", password_failures);
|
||||||
|
if (time(NULL) < password_backoff)
|
||||||
|
screen_write_puts(&ctx, &gc, "; sleeping");
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_write_stop(&ctx);
|
screen_write_stop(&ctx);
|
||||||
@ -1183,6 +1185,7 @@ void
|
|||||||
server_second_timers(void)
|
server_second_timers(void)
|
||||||
{
|
{
|
||||||
struct window *w;
|
struct window *w;
|
||||||
|
struct client *c;
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
u_int i;
|
u_int i;
|
||||||
int xtimeout;
|
int xtimeout;
|
||||||
@ -1191,6 +1194,7 @@ server_second_timers(void)
|
|||||||
time_t t;
|
time_t t;
|
||||||
|
|
||||||
t = time(NULL);
|
t = time(NULL);
|
||||||
|
|
||||||
xtimeout = options_get_number(&global_s_options, "lock-after-time");
|
xtimeout = options_get_number(&global_s_options, "lock-after-time");
|
||||||
if (xtimeout > 0 && t > server_activity + xtimeout)
|
if (xtimeout > 0 && t > server_activity + xtimeout)
|
||||||
server_lock();
|
server_lock();
|
||||||
@ -1206,6 +1210,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. */
|
/* Check for a minute having passed. */
|
||||||
gmtime_r(&t, &now);
|
gmtime_r(&t, &now);
|
||||||
gmtime_r(&last_t, &then);
|
gmtime_r(&last_t, &then);
|
||||||
|
Loading…
Reference in New Issue
Block a user