From ce4be58eef1852562c49714c9c9d031cb2166a33 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 2 Oct 2024 11:48:16 +0000 Subject: [PATCH 1/2] Add a define for the socket permissions check so it can be overridden more easily (for Cgywin). --- tmux.c | 2 +- tmux.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tmux.c b/tmux.c index d8985159..38ffa05c 100644 --- a/tmux.c +++ b/tmux.c @@ -226,7 +226,7 @@ make_label(const char *label, char **cause) xasprintf(cause, "%s is not a directory", base); goto fail; } - if (sb.st_uid != uid || (sb.st_mode & S_IRWXO) != 0) { + if (sb.st_uid != uid || (sb.st_mode & TMUX_SOCK_PERM) != 0) { xasprintf(cause, "directory %s has unsafe permissions", base); goto fail; } diff --git a/tmux.h b/tmux.h index 5e86dac9..3cd882a3 100644 --- a/tmux.h +++ b/tmux.h @@ -78,6 +78,9 @@ struct winlink; #ifndef TMUX_SOCK #define TMUX_SOCK "$TMUX_TMPDIR:" _PATH_TMP #endif +#ifndef TMUX_SOCK_PERM +#define TMUX_SOCK_PERM (7 /* o+rwx */) +#endif #ifndef TMUX_TERM #define TMUX_TERM "screen" #endif From 05116cefe60a488e04a956b3f2396fddf787cf22 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 2 Oct 2024 11:51:15 +0000 Subject: [PATCH 2/2] Add MSYSTEM to default update-environment. --- options-table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options-table.c b/options-table.c index 40fe3b45..c6b2695f 100644 --- a/options-table.c +++ b/options-table.c @@ -824,7 +824,7 @@ const struct options_table_entry options_table[] = { .type = OPTIONS_TABLE_STRING, .scope = OPTIONS_TABLE_SESSION, .flags = OPTIONS_TABLE_IS_ARRAY, - .default_str = "DISPLAY KRB5CCNAME SSH_ASKPASS SSH_AUTH_SOCK " + .default_str = "DISPLAY KRB5CCNAME MSYSTEM SSH_ASKPASS SSH_AUTH_SOCK " "SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY", .text = "List of environment variables to update in the session " "environment when a client is attached."