head 1.8; access; symbols pkgsrc-2026Q2:1.7.0.12 pkgsrc-2026Q2-base:1.7 pkgsrc-2026Q1:1.7.0.10 pkgsrc-2026Q1-base:1.7 pkgsrc-2025Q4:1.7.0.8 pkgsrc-2025Q4-base:1.7 pkgsrc-2025Q3:1.7.0.6 pkgsrc-2025Q3-base:1.7 pkgsrc-2025Q2:1.7.0.4 pkgsrc-2025Q2-base:1.7 pkgsrc-2025Q1:1.7.0.2 pkgsrc-2024Q4:1.5.0.60 pkgsrc-2024Q4-base:1.5 pkgsrc-2024Q3:1.5.0.58 pkgsrc-2024Q3-base:1.5 pkgsrc-2024Q2:1.5.0.56 pkgsrc-2024Q2-base:1.5 pkgsrc-2024Q1:1.5.0.54 pkgsrc-2024Q1-base:1.5 pkgsrc-2023Q4:1.5.0.52 pkgsrc-2023Q4-base:1.5 pkgsrc-2023Q3:1.5.0.50 pkgsrc-2023Q3-base:1.5 pkgsrc-2023Q2:1.5.0.48 pkgsrc-2023Q2-base:1.5 pkgsrc-2023Q1:1.5.0.46 pkgsrc-2023Q1-base:1.5 pkgsrc-2022Q4:1.5.0.44 pkgsrc-2022Q4-base:1.5 pkgsrc-2022Q3:1.5.0.42 pkgsrc-2022Q3-base:1.5 pkgsrc-2022Q2:1.5.0.40 pkgsrc-2022Q2-base:1.5 pkgsrc-2022Q1:1.5.0.38 pkgsrc-2022Q1-base:1.5 pkgsrc-2021Q4:1.5.0.36 pkgsrc-2021Q4-base:1.5 pkgsrc-2021Q3:1.5.0.34 pkgsrc-2021Q3-base:1.5 pkgsrc-2021Q2:1.5.0.32 pkgsrc-2021Q2-base:1.5 pkgsrc-2021Q1:1.5.0.30 pkgsrc-2021Q1-base:1.5 pkgsrc-2020Q4:1.5.0.28 pkgsrc-2020Q4-base:1.5 pkgsrc-2020Q3:1.5.0.26 pkgsrc-2020Q3-base:1.5 pkgsrc-2020Q2:1.5.0.22 pkgsrc-2020Q2-base:1.5 pkgsrc-2020Q1:1.5.0.2 pkgsrc-2020Q1-base:1.5 pkgsrc-2019Q4:1.5.0.24 pkgsrc-2019Q4-base:1.5 pkgsrc-2019Q3:1.5.0.20 pkgsrc-2019Q3-base:1.5 pkgsrc-2019Q2:1.5.0.18 pkgsrc-2019Q2-base:1.5 pkgsrc-2019Q1:1.5.0.16 pkgsrc-2019Q1-base:1.5 pkgsrc-2018Q4:1.5.0.14 pkgsrc-2018Q4-base:1.5 pkgsrc-2018Q3:1.5.0.12 pkgsrc-2018Q3-base:1.5 pkgsrc-2018Q2:1.5.0.10 pkgsrc-2018Q2-base:1.5 pkgsrc-2018Q1:1.5.0.8 pkgsrc-2018Q1-base:1.5 pkgsrc-2017Q4:1.5.0.6 pkgsrc-2017Q4-base:1.5 pkgsrc-2017Q3:1.5.0.4 pkgsrc-2017Q3-base:1.5 pkgsrc-2017Q2:1.4.0.2 pkgsrc-2017Q2-base:1.4 pkgsrc-2017Q1:1.3.0.2 pkgsrc-2017Q1-base:1.3; locks; strict; comment @ * @; 1.8 date 2026.08.30.08.51.28; author ryoon; state dead; branches; next 1.7; commitid oPiP8T31qUKeJDTG; 1.7 date 2025.05.12.16.03.20; author wiz; state Exp; branches 1.7.2.1; next 1.6; commitid tq4oVgRhCy6VnDUF; 1.6 date 2025.01.09.20.07.03; author ktnb; state dead; branches; next 1.5; commitid 5NUIjIRACTuMGQEF; 1.5 date 2017.07.18.23.02.18; author kim; state Exp; branches; next 1.4; commitid 78qXotVKMo9gtLZz; 1.4 date 2017.04.15.22.31.49; author kim; state Exp; branches; next 1.3; commitid PjyNmTW5QBBYjGNz; 1.3 date 2017.01.25.01.17.16; author maya; state Exp; branches; next 1.2; commitid cRiBXWHuesYqQhDz; 1.2 date 2017.01.25.00.18.02; author maya; state Exp; branches; next 1.1; commitid MMxKgtkcbaGKvhDz; 1.1 date 2017.01.23.17.58.34; author dholland; state Exp; branches; next ; commitid JjSuTONk44Q2s7Dz; 1.7.2.1 date 2025.05.12.16.03.20; author maya; state dead; branches; next 1.7.2.2; commitid jwAIyOFXRVTOE8VF; 1.7.2.2 date 2025.05.16.14.14.45; author maya; state Exp; branches; next ; commitid jwAIyOFXRVTOE8VF; desc @@ 1.8 log @misc/screen: Update to 5.0.2 Changelog: Version 5.0.2 (12/07/26): * Add %* escape to output caret character literal ("^") * Add portable PAM conversation callback prototype (for Solaris) * Fixes: - type in screen on big-endian systems - UTF-8 combining sequences - typos - buffer overflow in SendCmdMessage() - detaching fail with empty terminfo and leave the session attached - eliminates the TOCTOU race - manpage fixes Version 5.0.1 (12/05/25): * Fixes: - CVE-2025-46805: do NOT send signals with root privileges - CVE-2025-46804: avoid file existence test information leaks - CVE-2025-46803: apply safe PTY default mode of 0620 - CVE-2025-46802: prevent temporary 0666 mode on PTYs in attacher - CVE-2025-23395: reintroduce lf_secreopen() for logfile - buffer overflow due bad strncpy() - uninitialized variables warnings - typos - combining char handling that could lead to a segfault @ text @$NetBSD: patch-screen.c,v 1.7 2025/05/12 16:03:20 wiz Exp $ https://security.opensuse.org/2025/05/12/screen-security-issues.html --- screen.c.orig 2024-08-28 19:55:03.000000000 +0000 +++ screen.c @@@@ -145,8 +145,6 @@@@ bool hastruecolor = false; char *multi; int multiattach; -int tty_mode; -int tty_oldmode = -1; char HostName[MAXSTR]; pid_t MasterPid; @@@@ -199,6 +197,21 @@@@ static int GotSigChld; /********************************************************************/ /********************************************************************/ +static int lf_secreopen(char *name, int wantfd, struct Log *l) +{ + int got_fd; + + close(wantfd); + if (((got_fd = secopen(name, O_WRONLY | O_CREAT | O_APPEND, 0666)) < 0) || lf_move_fd(got_fd, wantfd) < 0) { + logfclose(l); + return -1; + } + l->st->st_ino = l->st->st_dev = 0; + return 0; +} + + + static struct passwd *getpwbyname(char *name, struct passwd *ppp) { int n; @@@@ -349,6 +362,10 @@@@ int main(int argc, char **argv) #ifdef ENABLE_TELNET af = AF_UNSPEC; #endif + /* lf_secreopen() is vital for the secure operation in setuid-root context. + * Do not remove it + */ + logreopen_register(lf_secreopen); real_uid = getuid(); real_gid = getgid(); @@@@ -747,7 +764,6 @@@@ int main(int argc, char **argv) /* ttyname implies isatty */ SetTtyname(true, &st); - tty_mode = (int)st.st_mode & 0777; fl = fcntl(0, F_GETFL, 0); if (fl != -1 && (fl & (O_RDWR | O_RDONLY | O_WRONLY)) == O_RDWR) @@@@ -846,22 +862,47 @@@@ int main(int argc, char **argv) #endif } - if (stat(SocketPath, &st) == -1) - Panic(errno, "Cannot access %s", SocketPath); - else if (!S_ISDIR(st.st_mode)) - Panic(0, "%s is not a directory.", SocketPath); + if (stat(SocketPath, &st) == -1) { + if (eff_uid == real_uid) { + Panic(errno, "Cannot access %s", SocketPath); + } else { + Panic(0, "Error accessing %s", SocketPath); + } + } + else if (!S_ISDIR(st.st_mode)) { + if (eff_uid == real_uid || st.st_uid == real_uid) { + Panic(0, "%s is not a directory.", SocketPath); + } else { + Panic(0, "Error accessing %s", SocketPath); + } + } if (multi) { - if (st.st_uid != multi_uid) - Panic(0, "%s is not the owner of %s.", multi, SocketPath); + if (st.st_uid != multi_uid) { + if (eff_uid == real_uid || st.st_uid == real_uid) { + Panic(0, "%s is not the owner of %s.", multi, SocketPath); + } else { + Panic(0, "Error accessing %s", SocketPath); + } + } } else { #ifdef SOCKET_DIR /* if SOCKETDIR is not defined, the socket is in $HOME. in that case it does not make sense to compare uids. */ - if (st.st_uid != real_uid) - Panic(0, "You are not the owner of %s.", SocketPath); + if (st.st_uid != real_uid) { + if (eff_uid == real_uid) { + Panic(0, "You are not the owner of %s.", SocketPath); + } else { + Panic(0, "Error accessing %s", SocketPath); + } + } #endif } - if ((st.st_mode & 0777) != 0700) - Panic(0, "Directory %s must have mode 700.", SocketPath); + if ((st.st_mode & 0777) != 0700) { + if (eff_uid == real_uid || st.st_uid == real_uid) { + Panic(0, "Directory %s must have mode 700.", SocketPath); + } else { + Panic(0, "Error accessing %s", SocketPath); + } + } if (SocketMatch && strchr(SocketMatch, '/')) Panic(0, "Bad session name '%s'", SocketMatch); SocketName = SocketPath + strlen(SocketPath) + 1; @@@@ -886,8 +927,13 @@@@ int main(int argc, char **argv) else exit(9 + (fo || oth ? 1 : 0) + fo); } - if (fo == 0) - Panic(0, "No Sockets found in %s.\n", SocketPath); + if (fo == 0) { + if (eff_uid == real_uid || st.st_uid == real_uid) { + Panic(0, "No Sockets found in %s.\n", SocketPath); + } else { + Panic(0, "Error accessing %s", SocketPath); + } + } Msg(0, "%d Socket%s in %s.", fo, fo > 1 ? "s" : "", SocketPath); eexit(0); } @@@@ -1551,15 +1597,6 @@@@ void Panic(int err, const char *fmt, ... if (D_userpid) Kill(D_userpid, SIG_BYE); } - if (tty_oldmode >= 0) { -#if defined(HAVE_SETEUID) - if (setuid(own_uid)) - xseteuid(own_uid); /* may be a loop. sigh. */ -#else - setuid(own_uid); -#endif - chmod(attach_tty, tty_oldmode); - } eexit(1); } @ 1.7 log @screen: add opensuse patches for security problems For https://security.opensuse.org/2025/05/12/screen-security-issues.html Bump PKGREVISION. @ text @d1 1 a1 1 $NetBSD$ @ 1.7.2.1 log @file patch-screen.c was added on branch pkgsrc-2025Q1 on 2025-05-16 14:14:45 +0000 @ text @d1 146 @ 1.7.2.2 log @Pullup ticket #6964 - requested by bsiegert misc/screen: Security fix (PR pkg/59417) Revisions pulled up: - misc/screen/MESSAGE deleted - misc/screen/Makefile 1.128-1.129 - misc/screen/distinfo 1.67 - misc/screen/patches/patch-attacher.c 1.1 - misc/screen/patches/patch-configure 1.1 - misc/screen/patches/patch-configure.ac 1.1 - misc/screen/patches/patch-logfile.c 1.1 - misc/screen/patches/patch-logfile.h 1.1 - misc/screen/patches/patch-process.c 1.1 - misc/screen/patches/patch-screen.c 1.7 - misc/screen/patches/patch-screen.h 1.1 - misc/screen/patches/patch-socket.c 1.7 --- Module Name: pkgsrc Committed By: wiz Date: Mon May 12 15:46:06 UTC 2025 Modified Files: pkgsrc/misc/screen: Makefile Removed Files: pkgsrc/misc/screen: MESSAGE Log Message: screen: remove setuid bit because of security problems Remove MESSAGE while here. Bump PKGREVISION. --- Module Name: pkgsrc Committed By: wiz Date: Mon May 12 16:03:20 UTC 2025 Modified Files: pkgsrc/misc/screen: Makefile distinfo pkgsrc/misc/screen/patches: patch-socket.c Added Files: pkgsrc/misc/screen/patches: patch-attacher.c patch-configure patch-configure.ac patch-logfile.c patch-logfile.h patch-process.c patch-screen.c patch-screen.h Log Message: screen: add opensuse patches for security problems For https://security.opensuse.org/2025/05/12/screen-security-issues.html Bump PKGREVISION. @ text @a0 146 $NetBSD: patch-screen.c,v 1.7 2025/05/12 16:03:20 wiz Exp $ https://security.opensuse.org/2025/05/12/screen-security-issues.html --- screen.c.orig 2024-08-28 19:55:03.000000000 +0000 +++ screen.c @@@@ -145,8 +145,6 @@@@ bool hastruecolor = false; char *multi; int multiattach; -int tty_mode; -int tty_oldmode = -1; char HostName[MAXSTR]; pid_t MasterPid; @@@@ -199,6 +197,21 @@@@ static int GotSigChld; /********************************************************************/ /********************************************************************/ +static int lf_secreopen(char *name, int wantfd, struct Log *l) +{ + int got_fd; + + close(wantfd); + if (((got_fd = secopen(name, O_WRONLY | O_CREAT | O_APPEND, 0666)) < 0) || lf_move_fd(got_fd, wantfd) < 0) { + logfclose(l); + return -1; + } + l->st->st_ino = l->st->st_dev = 0; + return 0; +} + + + static struct passwd *getpwbyname(char *name, struct passwd *ppp) { int n; @@@@ -349,6 +362,10 @@@@ int main(int argc, char **argv) #ifdef ENABLE_TELNET af = AF_UNSPEC; #endif + /* lf_secreopen() is vital for the secure operation in setuid-root context. + * Do not remove it + */ + logreopen_register(lf_secreopen); real_uid = getuid(); real_gid = getgid(); @@@@ -747,7 +764,6 @@@@ int main(int argc, char **argv) /* ttyname implies isatty */ SetTtyname(true, &st); - tty_mode = (int)st.st_mode & 0777; fl = fcntl(0, F_GETFL, 0); if (fl != -1 && (fl & (O_RDWR | O_RDONLY | O_WRONLY)) == O_RDWR) @@@@ -846,22 +862,47 @@@@ int main(int argc, char **argv) #endif } - if (stat(SocketPath, &st) == -1) - Panic(errno, "Cannot access %s", SocketPath); - else if (!S_ISDIR(st.st_mode)) - Panic(0, "%s is not a directory.", SocketPath); + if (stat(SocketPath, &st) == -1) { + if (eff_uid == real_uid) { + Panic(errno, "Cannot access %s", SocketPath); + } else { + Panic(0, "Error accessing %s", SocketPath); + } + } + else if (!S_ISDIR(st.st_mode)) { + if (eff_uid == real_uid || st.st_uid == real_uid) { + Panic(0, "%s is not a directory.", SocketPath); + } else { + Panic(0, "Error accessing %s", SocketPath); + } + } if (multi) { - if (st.st_uid != multi_uid) - Panic(0, "%s is not the owner of %s.", multi, SocketPath); + if (st.st_uid != multi_uid) { + if (eff_uid == real_uid || st.st_uid == real_uid) { + Panic(0, "%s is not the owner of %s.", multi, SocketPath); + } else { + Panic(0, "Error accessing %s", SocketPath); + } + } } else { #ifdef SOCKET_DIR /* if SOCKETDIR is not defined, the socket is in $HOME. in that case it does not make sense to compare uids. */ - if (st.st_uid != real_uid) - Panic(0, "You are not the owner of %s.", SocketPath); + if (st.st_uid != real_uid) { + if (eff_uid == real_uid) { + Panic(0, "You are not the owner of %s.", SocketPath); + } else { + Panic(0, "Error accessing %s", SocketPath); + } + } #endif } - if ((st.st_mode & 0777) != 0700) - Panic(0, "Directory %s must have mode 700.", SocketPath); + if ((st.st_mode & 0777) != 0700) { + if (eff_uid == real_uid || st.st_uid == real_uid) { + Panic(0, "Directory %s must have mode 700.", SocketPath); + } else { + Panic(0, "Error accessing %s", SocketPath); + } + } if (SocketMatch && strchr(SocketMatch, '/')) Panic(0, "Bad session name '%s'", SocketMatch); SocketName = SocketPath + strlen(SocketPath) + 1; @@@@ -886,8 +927,13 @@@@ int main(int argc, char **argv) else exit(9 + (fo || oth ? 1 : 0) + fo); } - if (fo == 0) - Panic(0, "No Sockets found in %s.\n", SocketPath); + if (fo == 0) { + if (eff_uid == real_uid || st.st_uid == real_uid) { + Panic(0, "No Sockets found in %s.\n", SocketPath); + } else { + Panic(0, "Error accessing %s", SocketPath); + } + } Msg(0, "%d Socket%s in %s.", fo, fo > 1 ? "s" : "", SocketPath); eexit(0); } @@@@ -1551,15 +1597,6 @@@@ void Panic(int err, const char *fmt, ... if (D_userpid) Kill(D_userpid, SIG_BYE); } - if (tty_oldmode >= 0) { -#if defined(HAVE_SETEUID) - if (setuid(own_uid)) - xseteuid(own_uid); /* may be a loop. sigh. */ -#else - setuid(own_uid); -#endif - chmod(attach_tty, tty_oldmode); - } eexit(1); } @ 1.6 log @screen: update to 5.0.0 - Rewriten autentication mechanism - Add escape %T to show current tty for window - Add escape %O to show number of currently open windows - Use wcwdith() instead of UTF-8 hard-coded tables - New commands: - auth [on|off] Provides password protection - status [top|up|down|bottom] [left|right] The status window by default is in bottom-left corner This command can move status messages to any corner of the screen. - truecolor [on|off] - multiinput Input to multiple windows at the same time - Removed commands: - time - debug - password - maxwin - nethack - Fixes: - Screen buffers ESC keypresses indefinitely - Crashes after passing through a zmodem transfer - Fix double -U issue @ text @d1 1 a1 1 $NetBSD: patch-screen.c,v 1.5 2017/07/18 23:02:18 kim Exp $ d3 1 a3 1 Use standard headers. d5 36 a40 4 --- screen.c.orig 2017-07-10 19:26:25.000000000 +0000 +++ screen.c 2017-07-18 22:40:56.000000000 +0000 @@@@ -95,6 +95,8 @@@@ # include d42 104 a146 5 +#include + #include "screen.h" #ifdef HAVE_BRAILLE # include "braille.h" @ 1.5 log @Upgrade misc/screen to version 4.6.1 Version 4.6.1 (10/07/2017): * Fixes: - problems with starting session in some cases - parallel make install - segfault when querying info on nonUTF locale Version 4.6.0 (28/06/2017): * Update Unicode wide tables to 9.0 * Support more serial speeds * Improved namespaces support * Migrate from fifos to sockets * Start viewing scrollback at first line of output @ text @d1 1 a1 1 $NetBSD$ @ 1.4 log @Update to 4.5.1 Version 4.5.1 (25/02/2017): *Fixes: - logfile permissions problem (CVE-2017-5618) - SunOS build problem (bug #50089) - FreeBSD core dumps (bug #50143) @ text @d1 1 a1 1 $NetBSD: patch-screen.c,v 1.3 2017/01/25 01:17:16 maya Exp $ d5 3 a7 3 --- screen.c.orig 2017-01-17 19:28:29.000000000 +0000 +++ screen.c @@@@ -88,6 +88,8 @@@@ @ 1.3 log @fix previous for unpriv'd installs. from dholland. bump PKGREVISION. @ text @d1 1 a1 1 $NetBSD: patch-screen.c,v 1.2 2017/01/25 00:18:02 maya Exp $ a3 1 Don't open user-supplied paths as root. a15 18 @@@@ -674,11 +676,17 @@@@ int main(int ac, char** av) if (strlen(screenlogfile) > PATH_MAX) Panic(0, "-L: logfile name too long. (max. %d char)", PATH_MAX); + int issetugid = geteuid() == 0; + + if (issetugid && seteuid(getuid()) < 0) + Panic(0, "setuid 1"); FILE *w_check; if ((w_check = fopen(screenlogfile, "w")) == NULL) Panic(0, "-L: logfile name access problem"); else fclose(w_check); + if (issetugid && seteuid(0) < 0) + Panic(0, "setuid 2"); } nwin_options.Lflag = 1; break; @ 1.2 log @Add patch fixing root exploit. Reported here: https://lists.gnu.org/archive/html/screen-devel/2017-01/msg00025.html from dholland @ text @d1 1 a1 1 $NetBSD: patch-screen.c,v 1.1 2017/01/23 17:58:34 dholland Exp $ d17 1 a17 1 @@@@ -674,11 +676,15 @@@@ int main(int ac, char** av) d21 3 a23 1 + if (seteuid(getuid()) < 0) d30 1 a30 1 + if (seteuid(0) < 0) @ 1.1 log @PR 51911: needs limits.h @ text @d1 1 a1 1 $NetBSD$ d4 1 d6 1 a6 1 --- screen.c~ 2017-01-17 19:28:29.000000000 +0000 d17 16 @