aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-20 14:37:51 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-20 14:37:51 +0000
commit54afcfbfb4e0e972455b870887151cb04d29c9c7 (patch)
treec1495aaa5f8d083b6752345cdbc15b2bbbda972c
parentb292f71c49b4222b34684aee44029ca2d6aeb4dd (diff)
downloadrtmux-54afcfbfb4e0e972455b870887151cb04d29c9c7.tar.gz
rtmux-54afcfbfb4e0e972455b870887151cb04d29c9c7.tar.bz2
rtmux-54afcfbfb4e0e972455b870887151cb04d29c9c7.zip
Display the number of failed password attempts (if any) when the server is
locked. From Tom Doherty.
-rw-r--r--server-fn.c4
-rw-r--r--server.c12
-rw-r--r--tmux.c1
-rw-r--r--tmux.h1
4 files changed, 17 insertions, 1 deletions
diff --git a/server-fn.c b/server-fn.c
index 3080bed4..409f65bc 100644
--- a/server-fn.c
+++ b/server-fn.c
@@ -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/server.c b/server.c
index 250f3187..7207ae94 100644
--- a/server.c
+++ b/server.c
@@ -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/tmux.c b/tmux.c
index d8499202..9ca1783f 100644
--- a/tmux.c
+++ b/tmux.c
@@ -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/tmux.h b/tmux.h
index 22621c4c..37162f77 100644
--- a/tmux.h
+++ b/tmux.h
@@ -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;