summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-09-04 13:29:11 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-09-04 13:29:11 +0000
commit2498fede76f2da713b399a4afb44a74d9b284747 (patch)
tree05100661dc212edd236fb0fe9626fe64277c924c
parent72b3f0fb6eb2c7e78f0d5c523e0671628b1d409c (diff)
Tell the user when sleeping due to password backoff.
-rw-r--r--usr.bin/tmux/server.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c
index f92a7d1c9b3..6af90ed464d 100644
--- a/usr.bin/tmux/server.c
+++ b/usr.bin/tmux/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.27 2009/09/02 21:25:57 nicm Exp $ */
+/* $OpenBSD: server.c,v 1.28 2009/09/04 13:29:10 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -605,6 +605,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);
@@ -1183,6 +1185,7 @@ void
server_second_timers(void)
{
struct window *w;
+ struct client *c;
struct window_pane *wp;
u_int i;
int xtimeout;
@@ -1191,6 +1194,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();
@@ -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. */
gmtime_r(&t, &now);
gmtime_r(&last_t, &then);