mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Add an option (default off) to control the passthrough escape sequence.
Like set-clipboard and allow-rename it is safer to forbid this by default.
This commit is contained in:
		
							
								
								
									
										6
									
								
								input.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								input.c
									
									
									
									
									
								
							@@ -2235,15 +2235,19 @@ input_enter_dcs(struct input_ctx *ictx)
 | 
				
			|||||||
static int
 | 
					static int
 | 
				
			||||||
input_dcs_dispatch(struct input_ctx *ictx)
 | 
					input_dcs_dispatch(struct input_ctx *ictx)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct window_pane	*wp = ictx->wp;
 | 
				
			||||||
	struct screen_write_ctx	*sctx = &ictx->ctx;
 | 
						struct screen_write_ctx	*sctx = &ictx->ctx;
 | 
				
			||||||
	u_char			*buf = ictx->input_buf;
 | 
						u_char			*buf = ictx->input_buf;
 | 
				
			||||||
	size_t			 len = ictx->input_len;
 | 
						size_t			 len = ictx->input_len;
 | 
				
			||||||
	const char		 prefix[] = "tmux;";
 | 
						const char		 prefix[] = "tmux;";
 | 
				
			||||||
	const u_int		 prefixlen = (sizeof prefix) - 1;
 | 
						const u_int		 prefixlen = (sizeof prefix) - 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (wp == NULL)
 | 
				
			||||||
 | 
							return (0);
 | 
				
			||||||
	if (ictx->flags & INPUT_DISCARD)
 | 
						if (ictx->flags & INPUT_DISCARD)
 | 
				
			||||||
		return (0);
 | 
							return (0);
 | 
				
			||||||
 | 
						if (!options_get_number(ictx->wp->options, "allow-passthrough"))
 | 
				
			||||||
 | 
							return (0);
 | 
				
			||||||
	log_debug("%s: \"%s\"", __func__, buf);
 | 
						log_debug("%s: \"%s\"", __func__, buf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (len >= prefixlen && strncmp(buf, prefix, prefixlen) == 0)
 | 
						if (len >= prefixlen && strncmp(buf, prefix, prefixlen) == 0)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -302,7 +302,7 @@ const struct options_table_entry options_table[] = {
 | 
				
			|||||||
	  .choices = options_table_extended_keys_list,
 | 
						  .choices = options_table_extended_keys_list,
 | 
				
			||||||
	  .default_num = 0,
 | 
						  .default_num = 0,
 | 
				
			||||||
	  .text = "Whether to request extended key sequences from terminals "
 | 
						  .text = "Whether to request extended key sequences from terminals "
 | 
				
			||||||
	          "that support it."
 | 
							  "that support it."
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{ .name = "focus-events",
 | 
						{ .name = "focus-events",
 | 
				
			||||||
@@ -801,6 +801,14 @@ const struct options_table_entry options_table[] = {
 | 
				
			|||||||
		  "linked to ('off')."
 | 
							  "linked to ('off')."
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{ .name = "allow-passthrough",
 | 
				
			||||||
 | 
						  .type = OPTIONS_TABLE_FLAG,
 | 
				
			||||||
 | 
						  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
 | 
				
			||||||
 | 
						  .default_num = 0,
 | 
				
			||||||
 | 
						  .text = "Whether applications are allowed to use the escape sequence "
 | 
				
			||||||
 | 
						          "to bypass tmux."
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{ .name = "allow-rename",
 | 
						{ .name = "allow-rename",
 | 
				
			||||||
	  .type = OPTIONS_TABLE_FLAG,
 | 
						  .type = OPTIONS_TABLE_FLAG,
 | 
				
			||||||
	  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
 | 
						  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
 | 
				
			||||||
@@ -989,7 +997,7 @@ const struct options_table_entry options_table[] = {
 | 
				
			|||||||
	  .choices = options_table_pane_border_lines_list,
 | 
						  .choices = options_table_pane_border_lines_list,
 | 
				
			||||||
	  .default_num = PANE_LINES_SINGLE,
 | 
						  .default_num = PANE_LINES_SINGLE,
 | 
				
			||||||
	  .text = "Type of characters used to draw pane border lines. Some of "
 | 
						  .text = "Type of characters used to draw pane border lines. Some of "
 | 
				
			||||||
	          "these are only supported on terminals with UTF-8 support."
 | 
							  "these are only supported on terminals with UTF-8 support."
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{ .name = "pane-border-status",
 | 
						{ .name = "pane-border-status",
 | 
				
			||||||
@@ -1041,7 +1049,7 @@ const struct options_table_entry options_table[] = {
 | 
				
			|||||||
	  .choices = options_table_popup_border_lines_list,
 | 
						  .choices = options_table_popup_border_lines_list,
 | 
				
			||||||
	  .default_num = BOX_LINES_SINGLE,
 | 
						  .default_num = BOX_LINES_SINGLE,
 | 
				
			||||||
	  .text = "Type of characters used to draw popup border lines. Some of "
 | 
						  .text = "Type of characters used to draw popup border lines. Some of "
 | 
				
			||||||
	          "these are only supported on terminals with UTF-8 support."
 | 
							  "these are only supported on terminals with UTF-8 support."
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{ .name = "remain-on-exit",
 | 
						{ .name = "remain-on-exit",
 | 
				
			||||||
@@ -1171,7 +1179,7 @@ const struct options_table_entry options_table[] = {
 | 
				
			|||||||
	  .scope = OPTIONS_TABLE_WINDOW,
 | 
						  .scope = OPTIONS_TABLE_WINDOW,
 | 
				
			||||||
	  .default_num = 1,
 | 
						  .default_num = 1,
 | 
				
			||||||
	  .text = "Whether xterm-style function key sequences should be sent. "
 | 
						  .text = "Whether xterm-style function key sequences should be sent. "
 | 
				
			||||||
	          "This option is no longer used."
 | 
							  "This option is no longer used."
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Hook options. */
 | 
						/* Hook options. */
 | 
				
			||||||
@@ -1219,8 +1227,8 @@ const struct options_table_entry options_table[] = {
 | 
				
			|||||||
	OPTIONS_TABLE_HOOK("client-active", ""),
 | 
						OPTIONS_TABLE_HOOK("client-active", ""),
 | 
				
			||||||
	OPTIONS_TABLE_HOOK("client-attached", ""),
 | 
						OPTIONS_TABLE_HOOK("client-attached", ""),
 | 
				
			||||||
	OPTIONS_TABLE_HOOK("client-detached", ""),
 | 
						OPTIONS_TABLE_HOOK("client-detached", ""),
 | 
				
			||||||
 	OPTIONS_TABLE_HOOK("client-focus-in", ""),
 | 
						OPTIONS_TABLE_HOOK("client-focus-in", ""),
 | 
				
			||||||
 	OPTIONS_TABLE_HOOK("client-focus-out", ""),
 | 
						OPTIONS_TABLE_HOOK("client-focus-out", ""),
 | 
				
			||||||
	OPTIONS_TABLE_HOOK("client-resized", ""),
 | 
						OPTIONS_TABLE_HOOK("client-resized", ""),
 | 
				
			||||||
	OPTIONS_TABLE_HOOK("client-session-changed", ""),
 | 
						OPTIONS_TABLE_HOOK("client-session-changed", ""),
 | 
				
			||||||
	OPTIONS_TABLE_PANE_HOOK("pane-died", ""),
 | 
						OPTIONS_TABLE_PANE_HOOK("pane-died", ""),
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										7
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								tmux.1
									
									
									
									
									
								
							@@ -4403,6 +4403,13 @@ The default is on.
 | 
				
			|||||||
Available pane options are:
 | 
					Available pane options are:
 | 
				
			||||||
.Pp
 | 
					.Pp
 | 
				
			||||||
.Bl -tag -width Ds -compact
 | 
					.Bl -tag -width Ds -compact
 | 
				
			||||||
 | 
					.It Xo Ic allow-passthrough
 | 
				
			||||||
 | 
					.Op Ic on | off
 | 
				
			||||||
 | 
					.Xc
 | 
				
			||||||
 | 
					Allow programs in the pane to bypass
 | 
				
			||||||
 | 
					.Nm
 | 
				
			||||||
 | 
					using a terminal escape sequence (\eePtmux;...\ee\e\e).
 | 
				
			||||||
 | 
					.Pp
 | 
				
			||||||
.It Xo Ic allow-rename
 | 
					.It Xo Ic allow-rename
 | 
				
			||||||
.Op Ic on | off
 | 
					.Op Ic on | off
 | 
				
			||||||
.Xc
 | 
					.Xc
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user