mirror of
https://github.com/tmux/tmux.git
synced 2025-01-15 05:09:04 +00:00
Sync OpenBSD patchset 148:
Display the number of failed password attempts (if any) when the server is locked. From Tom Doherty.
This commit is contained in:
parent
9a07e8f372
commit
54c6848d75
@ -1,4 +1,4 @@
|
|||||||
/* $Id: server-fn.c,v 1.75 2009-07-18 11:07:14 nicm Exp $ */
|
/* $Id: server-fn.c,v 1.76 2009-07-20 16:07:23 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -213,9 +213,11 @@ server_unlock(const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
server_locked = 0;
|
server_locked = 0;
|
||||||
|
password_failures = 0;
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
wrong:
|
wrong:
|
||||||
|
password_failures++;
|
||||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||||
c = ARRAY_ITEM(&clients, i);
|
c = ARRAY_ITEM(&clients, i);
|
||||||
if (c == NULL || c->prompt_buffer == NULL)
|
if (c == NULL || c->prompt_buffer == NULL)
|
||||||
@ -223,7 +225,7 @@ wrong:
|
|||||||
|
|
||||||
*c->prompt_buffer = '\0';
|
*c->prompt_buffer = '\0';
|
||||||
c->prompt_index = 0;
|
c->prompt_index = 0;
|
||||||
server_status_client(c);
|
server_redraw_client(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (-1);
|
return (-1);
|
||||||
|
14
server.c
14
server.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: server.c,v 1.160 2009-07-20 15:42:05 tcunha Exp $ */
|
/* $Id: server.c,v 1.161 2009-07-20 16:07:23 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -584,6 +584,7 @@ server_redraw_locked(struct client *c)
|
|||||||
{
|
{
|
||||||
struct screen_write_ctx ctx;
|
struct screen_write_ctx ctx;
|
||||||
struct screen screen;
|
struct screen screen;
|
||||||
|
struct grid_cell gc;
|
||||||
u_int colour, xx, yy, i;
|
u_int colour, xx, yy, i;
|
||||||
int style;
|
int style;
|
||||||
|
|
||||||
@ -594,10 +595,21 @@ server_redraw_locked(struct client *c)
|
|||||||
colour = options_get_number(&global_w_options, "clock-mode-colour");
|
colour = options_get_number(&global_w_options, "clock-mode-colour");
|
||||||
style = options_get_number(&global_w_options, "clock-mode-style");
|
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_init(&screen, xx, yy, 0);
|
||||||
|
|
||||||
screen_write_start(&ctx, NULL, &screen);
|
screen_write_start(&ctx, NULL, &screen);
|
||||||
clock_draw(&ctx, colour, style);
|
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);
|
screen_write_stop(&ctx);
|
||||||
|
|
||||||
for (i = 0; i < screen_size_y(&screen); i++)
|
for (i = 0; i < screen_size_y(&screen); i++)
|
||||||
|
3
tmux.c
3
tmux.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.c,v 1.146 2009-07-20 16:01:07 tcunha Exp $ */
|
/* $Id: tmux.c,v 1.147 2009-07-20 16:07:23 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -51,6 +51,7 @@ struct options global_s_options; /* session options */
|
|||||||
struct options global_w_options; /* window options */
|
struct options global_w_options; /* window options */
|
||||||
|
|
||||||
int server_locked;
|
int server_locked;
|
||||||
|
u_int password_failures;
|
||||||
char *server_password;
|
char *server_password;
|
||||||
time_t server_activity;
|
time_t server_activity;
|
||||||
|
|
||||||
|
3
tmux.h
3
tmux.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.h,v 1.373 2009-07-20 15:42:05 tcunha Exp $ */
|
/* $Id: tmux.h,v 1.374 2009-07-20 16:07:23 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -997,6 +997,7 @@ extern struct options global_s_options;
|
|||||||
extern struct options global_w_options;
|
extern struct options global_w_options;
|
||||||
extern char *cfg_file;
|
extern char *cfg_file;
|
||||||
extern int server_locked;
|
extern int server_locked;
|
||||||
|
extern u_int password_failures;
|
||||||
extern char *server_password;
|
extern char *server_password;
|
||||||
extern time_t server_activity;
|
extern time_t server_activity;
|
||||||
extern int debug_level;
|
extern int debug_level;
|
||||||
|
Loading…
Reference in New Issue
Block a user