diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-07-20 14:37:52 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-07-20 14:37:52 +0000 |
commit | c5010f25a2520c3cd8c6c70fe8e441d91d0c6442 (patch) | |
tree | 73037a2cc5ac5b601758e9861a362e8bc3374726 /usr.bin/tmux | |
parent | 90f8049d951a1efee3c9711526e0c6b05cbd24a9 (diff) |
Display the number of failed password attempts (if any) when the server is
locked. From Tom Doherty.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/server-fn.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/server.c | 14 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.c | 3 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 3 |
4 files changed, 21 insertions, 5 deletions
diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c index 6d3df51b6af..8beef15e7e3 100644 --- a/usr.bin/tmux/server-fn.c +++ b/usr.bin/tmux/server-fn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-fn.c,v 1.8 2009/07/17 20:37:03 nicm Exp $ */ +/* $OpenBSD: server-fn.c,v 1.9 2009/07/20 14:37:51 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -213,9 +213,11 @@ server_unlock(const char *s) } server_locked = 0; + password_failures = 0; return (0); wrong: + password_failures++; for (i = 0; i < ARRAY_LENGTH(&clients); i++) { c = ARRAY_ITEM(&clients, i); if (c == NULL || c->prompt_buffer == NULL) @@ -223,7 +225,7 @@ wrong: *c->prompt_buffer = '\0'; c->prompt_index = 0; - server_status_client(c); + server_redraw_client(c); } return (-1); diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index a33a5ff91bc..3964394d89a 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.11 2009/07/19 13:21:40 nicm Exp $ */ +/* $OpenBSD: server.c,v 1.12 2009/07/20 14:37:51 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -579,6 +579,7 @@ server_redraw_locked(struct client *c) { struct screen_write_ctx ctx; struct screen screen; + struct grid_cell gc; u_int colour, xx, yy, i; int style; @@ -589,10 +590,21 @@ server_redraw_locked(struct client *c) colour = options_get_number(&global_w_options, "clock-mode-colour"); style = options_get_number(&global_w_options, "clock-mode-style"); + memcpy(&gc, &grid_default_cell, sizeof gc); + gc.fg = colour; + gc.attr |= GRID_ATTR_BRIGHT; + screen_init(&screen, xx, yy, 0); screen_write_start(&ctx, NULL, &screen); clock_draw(&ctx, colour, style); + + if (password_failures != 0) { + screen_write_cursormove(&ctx, 0, 0); + screen_write_puts( + &ctx, &gc, "%u failed attempts", password_failures); + } + screen_write_stop(&ctx); for (i = 0; i < screen_size_y(&screen); i++) diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index d0260a1ffe3..446433e5dad 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.18 2009/07/20 14:32:09 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.19 2009/07/20 14:37:51 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -46,6 +46,7 @@ struct options global_s_options; /* session options */ struct options global_w_options; /* window options */ int server_locked; +u_int password_failures; char *server_password; time_t server_activity; diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index be72774fb6d..3f22823be5a 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.39 2009/07/19 13:21:40 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.40 2009/07/20 14:37:51 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -998,6 +998,7 @@ extern struct options global_s_options; extern struct options global_w_options; extern char *cfg_file; extern int server_locked; +extern u_int password_failures; extern char *server_password; extern time_t server_activity; extern int debug_level; |