tmux: only consider ACCESSPERMS for setting mode on socket_path.
authorsemarie <semarie@openbsd.org>
Thu, 7 Jul 2016 09:24:09 +0000 (09:24 +0000)
committersemarie <semarie@openbsd.org>
Thu, 7 Jul 2016 09:24:09 +0000 (09:24 +0000)
it explicitly removes any S_ISUID|S_ISGID|S_ISTXT bits, instead of letting
pledge(2) silenciously remove them.

ok nicm@ beck@ deraadt@

usr.bin/tmux/server.c

index 953708b..420f164 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.158 2016/03/30 13:20:07 nicm Exp $ */
+/* $OpenBSD: server.c,v 1.159 2016/07/07 09:24:09 semarie Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -258,7 +258,7 @@ server_update_socket(void)
 
                if (stat(socket_path, &sb) != 0)
                        return;
-               mode = sb.st_mode;
+               mode = sb.st_mode & ACCESSPERMS;
                if (n != 0) {
                        if (mode & S_IRUSR)
                                mode |= S_IXUSR;