From 17b308fb67c2374e43d5dcaf20e38da1b8798f9d Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 2 Oct 2024 11:48:16 +0000 Subject: [PATCH] Add a define for the socket permissions check so it can be overridden more easily (for Cgywin). --- usr.bin/tmux/tmux.c | 4 ++-- usr.bin/tmux/tmux.h | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index 9514860c4e8..47cae7b012e 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.213 2024/09/29 20:05:42 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.214 2024/10/02 11:48:16 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -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/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 5a927860dfa..e904e8e80f6 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1231 2024/10/01 08:01:19 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1232 2024/10/02 11:48:16 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -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 -- 2.20.1