mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Tell the user when sleeping due to password backoff.
This commit is contained in:
		
							
								
								
									
										11
									
								
								server.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								server.c
									
									
									
									
									
								
							@@ -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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user