Hanno Böck commited on 2026-06-25 11:45:22
Zeige 9 geänderte Dateien mit 637 Einfügungen und 3 Löschungen.
| ... | ... |
@@ -0,0 +1,18 @@ |
| 1 |
+https://bugs.gentoo.org/953896 |
|
| 2 |
+ |
|
| 3 |
+pty.h is necessary on some Linux, but it isn't in POSIX, so it breaks |
|
| 4 |
+systems like macOS, *BSD, HPUX, AIX and Solaris. Basically everywhere |
|
| 5 |
+not-Linux, so add guard to only apply on Linux. |
|
| 6 |
+ |
|
| 7 |
+--- a/pty.c |
|
| 8 |
++++ b/pty.c |
|
| 9 |
+@@ -29,6 +29,9 @@ |
|
| 10 |
+ #include <sys/types.h> |
|
| 11 |
+ #include <sys/stat.h> |
|
| 12 |
+ #include <fcntl.h> |
|
| 13 |
++#if defined(__linux__) || defined(__linux) || defined(linux) || defined(__GNU__) |
|
| 14 |
++#include <pty.h> |
|
| 15 |
++#endif |
|
| 16 |
+ #include <signal.h> |
|
| 17 |
+ |
|
| 18 |
+ #if defined(__OpenBSD__) |
| ... | ... |
@@ -0,0 +1,141 @@ |
| 1 |
+Adapted from https://git.savannah.gnu.org/cgit/screen.git/patch/?id=049b26b22e197ba3be9c46e5c193032e01a4724a |
|
| 2 |
+ |
|
| 3 |
+From 049b26b22e197ba3be9c46e5c193032e01a4724a Mon Sep 17 00:00:00 2001 |
|
| 4 |
+From: Matthias Gerstner <matthias.gerstner@suse.de> |
|
| 5 |
+Date: Mon, 12 May 2025 15:15:38 +0200 |
|
| 6 |
+Subject: fix CVE-2025-46802: attacher.c - prevent temporary 0666 mode on PTYs |
|
| 7 |
+ |
|
| 8 |
+This temporary chmod of the PTY to mode 0666 is most likely a remnant of |
|
| 9 |
+past times, before the PTY file descriptor was passed to the target |
|
| 10 |
+session via the UNIX domain socket. |
|
| 11 |
+ |
|
| 12 |
+This chmod() causes a race condition during which any other user in the |
|
| 13 |
+system can open the PTY for reading and writing, and thus allows PTY |
|
| 14 |
+hijacking. |
|
| 15 |
+ |
|
| 16 |
+Simply remove this logic completely. |
|
| 17 |
+--- |
|
| 18 |
+ attacher.c | 27 --------------------------- |
|
| 19 |
+ screen.c | 19 ------------------- |
|
| 20 |
+ 2 files changed, 46 deletions(-) |
|
| 21 |
+ |
|
| 22 |
+diff --git a/attacher.c b/attacher.c |
|
| 23 |
+index c35ae7a..16b151e 100644 |
|
| 24 |
+--- a/attacher.c |
|
| 25 |
++++ b/attacher.c |
|
| 26 |
+@@ -73,7 +73,6 @@ extern int MasterPid, attach_fd; |
|
| 27 |
+ #ifdef MULTIUSER |
|
| 28 |
+ extern char *multi; |
|
| 29 |
+ extern int multiattach, multi_uid, own_uid; |
|
| 30 |
+-extern int tty_mode, tty_oldmode; |
|
| 31 |
+ # ifndef USE_SETEUID |
|
| 32 |
+ static int multipipe[2]; |
|
| 33 |
+ # endif |
|
| 34 |
+@@ -160,9 +159,6 @@ int how; |
|
| 35 |
+ |
|
| 36 |
+ if (pipe(multipipe)) |
|
| 37 |
+ Panic(errno, "pipe"); |
|
| 38 |
+- if (chmod(attach_tty, 0666)) |
|
| 39 |
+- Panic(errno, "chmod %s", attach_tty); |
|
| 40 |
+- tty_oldmode = tty_mode; |
|
| 41 |
+ eff_uid = -1; /* make UserContext fork */ |
|
| 42 |
+ real_uid = multi_uid; |
|
| 43 |
+ if ((ret = UserContext()) <= 0) |
|
| 44 |
+@@ -174,11 +170,6 @@ int how; |
|
| 45 |
+ Panic(errno, "UserContext"); |
|
| 46 |
+ close(multipipe[1]); |
|
| 47 |
+ read(multipipe[0], &dummy, 1); |
|
| 48 |
+- if (tty_oldmode >= 0) |
|
| 49 |
+- {
|
|
| 50 |
+- chmod(attach_tty, tty_oldmode); |
|
| 51 |
+- tty_oldmode = -1; |
|
| 52 |
+- } |
|
| 53 |
+ ret = UserStatus(); |
|
| 54 |
+ #ifdef LOCK |
|
| 55 |
+ if (ret == SIG_LOCK) |
|
| 56 |
+@@ -224,9 +215,6 @@ int how; |
|
| 57 |
+ xseteuid(multi_uid); |
|
| 58 |
+ xseteuid(own_uid); |
|
| 59 |
+ #endif |
|
| 60 |
+- if (chmod(attach_tty, 0666)) |
|
| 61 |
+- Panic(errno, "chmod %s", attach_tty); |
|
| 62 |
+- tty_oldmode = tty_mode; |
|
| 63 |
+ } |
|
| 64 |
+ # endif /* USE_SETEUID */ |
|
| 65 |
+ #endif /* MULTIUSER */ |
|
| 66 |
+@@ -423,13 +411,6 @@ int how; |
|
| 67 |
+ ContinuePlease = 0; |
|
| 68 |
+ # ifndef USE_SETEUID |
|
| 69 |
+ close(multipipe[1]); |
|
| 70 |
+-# else |
|
| 71 |
+- xseteuid(own_uid); |
|
| 72 |
+- if (tty_oldmode >= 0) |
|
| 73 |
+- if (chmod(attach_tty, tty_oldmode)) |
|
| 74 |
+- Panic(errno, "chmod %s", attach_tty); |
|
| 75 |
+- tty_oldmode = -1; |
|
| 76 |
+- xseteuid(real_uid); |
|
| 77 |
+ # endif |
|
| 78 |
+ } |
|
| 79 |
+ #endif |
|
| 80 |
+@@ -505,14 +486,6 @@ AttacherFinit SIGDEFARG |
|
| 81 |
+ close(s); |
|
| 82 |
+ } |
|
| 83 |
+ } |
|
| 84 |
+-#ifdef MULTIUSER |
|
| 85 |
+- if (tty_oldmode >= 0) |
|
| 86 |
+- {
|
|
| 87 |
+- if (setuid(own_uid)) |
|
| 88 |
+- Panic(errno, "setuid"); |
|
| 89 |
+- chmod(attach_tty, tty_oldmode); |
|
| 90 |
+- } |
|
| 91 |
+-#endif |
|
| 92 |
+ exit(0); |
|
| 93 |
+ SIGRETURN; |
|
| 94 |
+ } |
|
| 95 |
+diff --git a/screen.c b/screen.c |
|
| 96 |
+index 7653cd1..1a23e1a 100644 |
|
| 97 |
+--- a/screen.c |
|
| 98 |
++++ b/screen.c |
|
| 99 |
+@@ -230,8 +230,6 @@ char *multi_home; |
|
| 100 |
+ int multi_uid; |
|
| 101 |
+ int own_uid; |
|
| 102 |
+ int multiattach; |
|
| 103 |
+-int tty_mode; |
|
| 104 |
+-int tty_oldmode = -1; |
|
| 105 |
+ #endif |
|
| 106 |
+ |
|
| 107 |
+ char HostName[MAXSTR]; |
|
| 108 |
+@@ -1009,9 +1007,6 @@ int main(int ac, char** av) |
|
| 109 |
+ |
|
| 110 |
+ /* ttyname implies isatty */ |
|
| 111 |
+ SetTtyname(true, &st); |
|
| 112 |
+-#ifdef MULTIUSER |
|
| 113 |
+- tty_mode = (int)st.st_mode & 0777; |
|
| 114 |
+-#endif |
|
| 115 |
+ |
|
| 116 |
+ fl = fcntl(0, F_GETFL, 0); |
|
| 117 |
+ if (fl != -1 && (fl & (O_RDWR|O_RDONLY|O_WRONLY)) == O_RDWR) |
|
| 118 |
+@@ -2170,20 +2165,6 @@ DEFINE_VARARGS_FN(Panic) |
|
| 119 |
+ if (D_userpid) |
|
| 120 |
+ Kill(D_userpid, SIG_BYE); |
|
| 121 |
+ } |
|
| 122 |
+-#ifdef MULTIUSER |
|
| 123 |
+- if (tty_oldmode >= 0) {
|
|
| 124 |
+- |
|
| 125 |
+-# ifdef USE_SETEUID |
|
| 126 |
+- if (setuid(own_uid)) |
|
| 127 |
+- xseteuid(own_uid); /* may be a loop. sigh. */ |
|
| 128 |
+-# else |
|
| 129 |
+- setuid(own_uid); |
|
| 130 |
+-# endif |
|
| 131 |
+- |
|
| 132 |
+- debug1("Panic: changing back modes from %s\n", attach_tty);
|
|
| 133 |
+- chmod(attach_tty, tty_oldmode); |
|
| 134 |
+- } |
|
| 135 |
+-#endif |
|
| 136 |
+ eexit(1); |
|
| 137 |
+ } |
|
| 138 |
+ |
|
| 139 |
+-- |
|
| 140 |
+cgit v1.1 |
|
| 141 |
+ |
| ... | ... |
@@ -0,0 +1,126 @@ |
| 1 |
+Adapted from https://git.savannah.gnu.org/cgit/screen.git/patch/?id=e0eef5aac453fa98a2664416a56c50ad1d00cb30 |
|
| 2 |
+ |
|
| 3 |
+From e0eef5aac453fa98a2664416a56c50ad1d00cb30 Mon Sep 17 00:00:00 2001 |
|
| 4 |
+From: Matthias Gerstner <matthias.gerstner@suse.de> |
|
| 5 |
+Date: Mon, 12 May 2025 15:26:11 +0200 |
|
| 6 |
+Subject: fix CVE-2025-46804: avoid file existence test information leaks |
|
| 7 |
+ |
|
| 8 |
+In setuid-root context the current error messages give away whether |
|
| 9 |
+certain paths not accessible by the real user exist and what type they |
|
| 10 |
+have. To prevent this only output generic error messages in setuid-root |
|
| 11 |
+context. |
|
| 12 |
+ |
|
| 13 |
+In some situations, when an error is pertaining a directory and the |
|
| 14 |
+directory is owner by the real user then we can still output more |
|
| 15 |
+detailed diagnostics. |
|
| 16 |
+ |
|
| 17 |
+This change can lead to less helpful error messages when Screen is |
|
| 18 |
+install setuid-root. More complex changes would be needed to avoid this |
|
| 19 |
+(e.g. only open the `SocketPath` with raised privileges when |
|
| 20 |
+multi-attach is requested). |
|
| 21 |
+ |
|
| 22 |
+There might still be lingering some code paths that allow such |
|
| 23 |
+information leaks, since `SocketPath` is a global variable that is used |
|
| 24 |
+across the code base. The majority of issues should be caught with this |
|
| 25 |
+fix, however. |
|
| 26 |
+--- |
|
| 27 |
+ screen.c | 45 ++++++++++++++++++++++++++++++++++----------- |
|
| 28 |
+ socket.c | 9 +++++++-- |
|
| 29 |
+ 2 files changed, 41 insertions(+), 13 deletions(-) |
|
| 30 |
+ |
|
| 31 |
+diff --git a/screen.c b/screen.c |
|
| 32 |
+index 1a23e1a..6eec151 100644 |
|
| 33 |
+--- a/screen.c |
|
| 34 |
++++ b/screen.c |
|
| 35 |
+@@ -1122,15 +1122,28 @@ int main(int ac, char** av) |
|
| 36 |
+ #endif |
|
| 37 |
+ } |
|
| 38 |
+ |
|
| 39 |
+- if (stat(SockPath, &st) == -1) |
|
| 40 |
+- Panic(errno, "Cannot access %s", SockPath); |
|
| 41 |
+- else |
|
| 42 |
+- if (!S_ISDIR(st.st_mode)) |
|
| 43 |
++ if (stat(SockPath, &st) == -1) {
|
|
| 44 |
++ if (eff_uid == real_uid) {
|
|
| 45 |
++ Panic(errno, "Cannot access %s", SockPath); |
|
| 46 |
++ } else {
|
|
| 47 |
++ Panic(0, "Error accessing %s", SockPath); |
|
| 48 |
++ } |
|
| 49 |
++ } else if (!S_ISDIR(st.st_mode)) {
|
|
| 50 |
++ if (eff_uid == real_uid || st.st_uid == real_uid) {
|
|
| 51 |
+ Panic(0, "%s is not a directory.", SockPath); |
|
| 52 |
++ } else {
|
|
| 53 |
++ Panic(0, "Error accessing %s", SockPath); |
|
| 54 |
++ } |
|
| 55 |
++ } |
|
| 56 |
+ #ifdef MULTIUSER |
|
| 57 |
+ if (multi) {
|
|
| 58 |
+- if ((int)st.st_uid != multi_uid) |
|
| 59 |
+- Panic(0, "%s is not the owner of %s.", multi, SockPath); |
|
| 60 |
++ if ((int)st.st_uid != multi_uid) {
|
|
| 61 |
++ if (eff_uid == real_uid || st.st_uid == real_uid) {
|
|
| 62 |
++ Panic(0, "%s is not the owner of %s.", multi, SockPath); |
|
| 63 |
++ } else {
|
|
| 64 |
++ Panic(0, "Error accessing %s", SockPath); |
|
| 65 |
++ } |
|
| 66 |
++ } |
|
| 67 |
+ } |
|
| 68 |
+ else |
|
| 69 |
+ #endif |
|
| 70 |
+@@ -1144,9 +1157,13 @@ int main(int ac, char** av) |
|
| 71 |
+ Panic(0, "You are not the owner of %s.", SockPath); |
|
| 72 |
+ #endif |
|
| 73 |
+ } |
|
| 74 |
+- |
|
| 75 |
+- if ((st.st_mode & 0777) != 0700) |
|
| 76 |
+- Panic(0, "Directory %s must have mode 700.", SockPath); |
|
| 77 |
++ if ((st.st_mode & 0777) != 0700) {
|
|
| 78 |
++ if (eff_uid == real_uid || st.st_uid == real_uid) {
|
|
| 79 |
++ Panic(0, "Directory %s must have mode 700.", SockPath); |
|
| 80 |
++ } else {
|
|
| 81 |
++ Panic(0, "Error accessing %s", SockPath); |
|
| 82 |
++ } |
|
| 83 |
++ } |
|
| 84 |
+ if (SockMatch && index(SockMatch, '/')) |
|
| 85 |
+ Panic(0, "Bad session name '%s'", SockMatch); |
|
| 86 |
+ SockName = SockPath + strlen(SockPath) + 1; |
|
| 87 |
+@@ -1184,8 +1201,14 @@ int main(int ac, char** av) |
|
| 88 |
+ else |
|
| 89 |
+ exit(9 + (fo || oth ? 1 : 0) + fo); |
|
| 90 |
+ } |
|
| 91 |
+- if (fo == 0) |
|
| 92 |
+- Panic(0, "No Sockets found in %s.\n", SockPath); |
|
| 93 |
++ if (fo == 0) {
|
|
| 94 |
++ if (eff_uid == real_uid || st.st_uid == real_uid) {
|
|
| 95 |
++ Panic(0, "No Sockets found in %s.\n", SockPath); |
|
| 96 |
++ } else {
|
|
| 97 |
++ Panic(0, "Error accessing %s", SockPath); |
|
| 98 |
++ } |
|
| 99 |
++ } |
|
| 100 |
++ |
|
| 101 |
+ Msg(0, "%d Socket%s in %s.", fo, fo > 1 ? "s" : "", SockPath); |
|
| 102 |
+ eexit(0); |
|
| 103 |
+ } |
|
| 104 |
+diff --git a/socket.c b/socket.c |
|
| 105 |
+index 54d8cb8..6c3502f 100644 |
|
| 106 |
+--- a/socket.c |
|
| 107 |
++++ b/socket.c |
|
| 108 |
+@@ -169,8 +169,13 @@ bool *is_sock; |
|
| 109 |
+ xsetegid(real_gid); |
|
| 110 |
+ #endif |
|
| 111 |
+ |
|
| 112 |
+- if ((dirp = opendir(SockPath)) == 0) |
|
| 113 |
+- Panic(errno, "Cannot opendir %s", SockPath); |
|
| 114 |
++ if ((dirp = opendir(SockPath)) == 0) {
|
|
| 115 |
++ if (eff_uid == real_uid) {
|
|
| 116 |
++ Panic(errno, "Cannot opendir %s", SockPath); |
|
| 117 |
++ } else {
|
|
| 118 |
++ Panic(0, "Error accessing %s", SockPath); |
|
| 119 |
++ } |
|
| 120 |
++ } |
|
| 121 |
+ |
|
| 122 |
+ slist = 0; |
|
| 123 |
+ slisttail = &slist; |
|
| 124 |
+-- |
|
| 125 |
+cgit v1.1 |
|
| 126 |
+ |
| ... | ... |
@@ -0,0 +1,119 @@ |
| 1 |
+Adapted from https://git.savannah.gnu.org/cgit/screen.git/patch/?id=161f85b98b7e1d5e4893aeed20f4cdb5e3dfaaa4 |
|
| 2 |
+ |
|
| 3 |
+From 161f85b98b7e1d5e4893aeed20f4cdb5e3dfaaa4 Mon Sep 17 00:00:00 2001 |
|
| 4 |
+From: Matthias Gerstner <matthias.gerstner@suse.de> |
|
| 5 |
+Date: Mon, 12 May 2025 15:38:19 +0200 |
|
| 6 |
+Subject: fix CVE-2025-46805: socket.c - don't send signals with root |
|
| 7 |
+ privileges |
|
| 8 |
+ |
|
| 9 |
+The CheckPid() function was introduced to address CVE-2023-24626, to |
|
| 10 |
+prevent sending SIGCONT and SIGHUP to arbitrary PIDs in the system. This |
|
| 11 |
+fix still suffers from a TOCTOU race condition. The client can replace |
|
| 12 |
+itself by a privileged process, or try to cycle PIDs until a privileged |
|
| 13 |
+process receives the original PID. |
|
| 14 |
+ |
|
| 15 |
+To prevent this, always send signals using the real privileges. Keep |
|
| 16 |
+CheckPid() for error diagnostics. If sending the actual signal fails |
|
| 17 |
+later on then there will be no more error reporting. |
|
| 18 |
+ |
|
| 19 |
+It seems the original bugfix already introduced a regression when |
|
| 20 |
+attaching to another's user session that is not owned by root. In this |
|
| 21 |
+case the target sessions runs with real uid X, while for sending a |
|
| 22 |
+signal to the `pid` provided by the client real uid Y (or root |
|
| 23 |
+privileges) are required. |
|
| 24 |
+ |
|
| 25 |
+This is hard to properly fix without this regression. On Linux pidfds |
|
| 26 |
+could be used to allow safely sending signals to other PIDs as root |
|
| 27 |
+without involving race conditions. In this case the client PID should |
|
| 28 |
+also be obtained via the UNIX domain socket's SO_PEERCRED option, |
|
| 29 |
+though. |
|
| 30 |
+--- |
|
| 31 |
+ socket.c | 21 +++++++++++++-------- |
|
| 32 |
+ 1 file changed, 13 insertions(+), 8 deletions(-) |
|
| 33 |
+ |
|
| 34 |
+diff --git a/socket.c b/socket.c |
|
| 35 |
+index 6c3502f..d6621fa 100644 |
|
| 36 |
+--- a/socket.c |
|
| 37 |
++++ b/socket.c |
|
| 38 |
+@@ -831,6 +831,11 @@ int pid; |
|
| 39 |
+ return UserStatus(); |
|
| 40 |
+ } |
|
| 41 |
+ |
|
| 42 |
++static void KillUnpriv(pid_t pid, int sig) {
|
|
| 43 |
++ UserContext(); |
|
| 44 |
++ UserReturn(kill(pid, sig)); |
|
| 45 |
++} |
|
| 46 |
++ |
|
| 47 |
+ #ifdef hpux |
|
| 48 |
+ /* |
|
| 49 |
+ * From: "F. K. Bruner" <napalm@ugcs.caltech.edu> |
|
| 50 |
+@@ -916,14 +921,14 @@ struct win *wi; |
|
| 51 |
+ {
|
|
| 52 |
+ Msg(errno, "Could not perform necessary sanity checks on pts device."); |
|
| 53 |
+ close(i); |
|
| 54 |
+- Kill(pid, SIG_BYE); |
|
| 55 |
++ KillUnpriv(pid, SIG_BYE); |
|
| 56 |
+ return -1; |
|
| 57 |
+ } |
|
| 58 |
+ if (strcmp(ttyname_in_ns, m->m_tty)) |
|
| 59 |
+ {
|
|
| 60 |
+ Msg(errno, "Attach: passed fd does not match tty: %s - %s!", ttyname_in_ns, m->m_tty[0] != '\0' ? m->m_tty : "(null)"); |
|
| 61 |
+ close(i); |
|
| 62 |
+- Kill(pid, SIG_BYE); |
|
| 63 |
++ KillUnpriv(pid, SIG_BYE); |
|
| 64 |
+ return -1; |
|
| 65 |
+ } |
|
| 66 |
+ /* m->m_tty so far contains the actual name of the pts device in the |
|
| 67 |
+@@ -940,19 +945,19 @@ struct win *wi; |
|
| 68 |
+ {
|
|
| 69 |
+ Msg(errno, "Attach: passed fd does not match tty: %s - %s!", m->m_tty, myttyname ? myttyname : "NULL"); |
|
| 70 |
+ close(i); |
|
| 71 |
+- Kill(pid, SIG_BYE); |
|
| 72 |
++ KillUnpriv(pid, SIG_BYE); |
|
| 73 |
+ return -1; |
|
| 74 |
+ } |
|
| 75 |
+ } |
|
| 76 |
+ else if ((i = secopen(m->m_tty, O_RDWR | O_NONBLOCK, 0)) < 0) |
|
| 77 |
+ {
|
|
| 78 |
+ Msg(errno, "Attach: Could not open %s!", m->m_tty); |
|
| 79 |
+- Kill(pid, SIG_BYE); |
|
| 80 |
++ KillUnpriv(pid, SIG_BYE); |
|
| 81 |
+ return -1; |
|
| 82 |
+ } |
|
| 83 |
+ #ifdef MULTIUSER |
|
| 84 |
+ if (attach) |
|
| 85 |
+- Kill(pid, SIGCONT); |
|
| 86 |
++ KillUnpriv(pid, SIGCONT); |
|
| 87 |
+ #endif |
|
| 88 |
+ |
|
| 89 |
+ #if defined(ultrix) || defined(pyr) || defined(NeXT) |
|
| 90 |
+@@ -965,7 +970,7 @@ struct win *wi; |
|
| 91 |
+ {
|
|
| 92 |
+ write(i, "Attaching from inside of screen?\n", 33); |
|
| 93 |
+ close(i); |
|
| 94 |
+- Kill(pid, SIG_BYE); |
|
| 95 |
++ KillUnpriv(pid, SIG_BYE); |
|
| 96 |
+ Msg(0, "Attach msg ignored: coming from inside."); |
|
| 97 |
+ return -1; |
|
| 98 |
+ } |
|
| 99 |
+@@ -976,7 +981,7 @@ struct win *wi; |
|
| 100 |
+ {
|
|
| 101 |
+ write(i, "Access to session denied.\n", 26); |
|
| 102 |
+ close(i); |
|
| 103 |
+- Kill(pid, SIG_BYE); |
|
| 104 |
++ KillUnpriv(pid, SIG_BYE); |
|
| 105 |
+ Msg(0, "Attach: access denied for user %s.", user); |
|
| 106 |
+ return -1; |
|
| 107 |
+ } |
|
| 108 |
+@@ -1294,7 +1299,7 @@ ReceiveMsg() |
|
| 109 |
+ Msg(0, "Query attempt with bad pid(%d)!", m.m.command.apid); |
|
| 110 |
+ } |
|
| 111 |
+ else {
|
|
| 112 |
+- Kill(m.m.command.apid, |
|
| 113 |
++ KillUnpriv(m.m.command.apid, |
|
| 114 |
+ (queryflag >= 0) |
|
| 115 |
+ ? SIGCONT |
|
| 116 |
+ : SIG_BYE); /* Send SIG_BYE if an error happened */ |
|
| 117 |
+-- |
|
| 118 |
+cgit v1.1 |
|
| 119 |
+ |
| ... | ... |
@@ -0,0 +1,41 @@ |
| 1 |
+https://salsa.debian.org/debian/screen/-/raw/master/debian/patches/61-default-PATH_MAX-if-undefined-for-hurd.patch?ref_type=heads |
|
| 2 |
+ |
|
| 3 |
+Description: Set PATH_MAX to 4096 if undefined |
|
| 4 |
+ Fixes FTBFS since 4.4.0 on GNU/Hurd. Updated to add one more occurrence for 4.5.0. |
|
| 5 |
+Author: Axel Beckert <abe@debian.org> |
|
| 6 |
+Bug: https://savannah.gnu.org/bugs/?50089 |
|
| 7 |
+Last-Updated: 2017-01-18 |
|
| 8 |
+ |
|
| 9 |
+--- a/tty.sh |
|
| 10 |
++++ b/tty.sh |
|
| 11 |
+@@ -1526,6 +1526,13 @@ |
|
| 12 |
+ return 0; |
|
| 13 |
+ } |
|
| 14 |
+ |
|
| 15 |
++/* |
|
| 16 |
++ * Define PATH_MAX to 4096 if it's not defined, like on GNU/Hurd |
|
| 17 |
++ */ |
|
| 18 |
++ |
|
| 19 |
++#ifndef PATH_MAX |
|
| 20 |
++#define PATH_MAX 4096 |
|
| 21 |
++#endif |
|
| 22 |
+ |
|
| 23 |
+ int CheckTtyname (char *tty) |
|
| 24 |
+ {
|
|
| 25 |
+--- a/screen.h |
|
| 26 |
++++ b/screen.h |
|
| 27 |
+@@ -109,6 +109,13 @@ |
|
| 28 |
+ # define DEFAULT_BUFFERFILE "/tmp/screen-exchange" |
|
| 29 |
+ #endif |
|
| 30 |
+ |
|
| 31 |
++/* |
|
| 32 |
++ * Define PATH_MAX to 4096 if it's not defined, like on GNU/Hurd |
|
| 33 |
++ */ |
|
| 34 |
++ |
|
| 35 |
++#ifndef PATH_MAX |
|
| 36 |
++#define PATH_MAX 4096 |
|
| 37 |
++#endif |
|
| 38 |
+ |
|
| 39 |
+ #if defined(hpux) && !(defined(VSUSP) && defined(VDSUSP) && defined(VWERASE) && defined(VLNEXT)) |
|
| 40 |
+ # define HPUX_LTCHARS_HACK |
|
| 41 |
+ |
| ... | ... |
@@ -0,0 +1,13 @@ |
| 1 |
+ |
|
| 2 |
+Patch from: https://github.com/void-linux/void-packages/commit/0f6da07 |
|
| 3 |
+ |
|
| 4 |
+--- a/utmp.c |
|
| 5 |
++++ b/utmp.c |
|
| 6 |
+@@ -30,6 +30,7 @@ |
|
| 7 |
+ |
|
| 8 |
+ #include "utmp.h" |
|
| 9 |
+ |
|
| 10 |
++#include <signal.h> |
|
| 11 |
+ #include <sys/types.h> |
|
| 12 |
+ #include <sys/stat.h> |
|
| 13 |
+ #include <fcntl.h> |
|
| 0 | 14 |
\ No newline at end of file |
| ... | ... |
@@ -0,0 +1,27 @@ |
| 1 |
+https://cgit.git.savannah.gnu.org/cgit/screen.git/commit/?h=screen-v5&id=7333452aa52d61a170b1fc199869ea6059849058 |
|
| 2 |
+ |
|
| 3 |
+From 7333452aa52d61a170b1fc199869ea6059849058 Mon Sep 17 00:00:00 2001 |
|
| 4 |
+From: Holger Hoffstätte <holger@applied-asynchrony.com> |
|
| 5 |
+Date: Thu, 15 May 2025 13:54:44 +0200 |
|
| 6 |
+Subject: Fix: unescaped @ in email address |
|
| 7 |
+ |
|
| 8 |
+bug#67126 |
|
| 9 |
+--- |
|
| 10 |
+ doc/screen.texinfo | 2 +- |
|
| 11 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
|
| 12 |
+ |
|
| 13 |
+diff --git a/doc/screen.texinfo b/doc/screen.texinfo |
|
| 14 |
+index b3568b9..76d0588 100644 |
|
| 15 |
+--- a/doc/screen.texinfo |
|
| 16 |
++++ b/doc/screen.texinfo |
|
| 17 |
+@@ -5940,7 +5940,7 @@ of @code{Screen} which you are using. Also include in your message the
|
|
| 18 |
+ hardware and operating system, the compiler used to compile, a |
|
| 19 |
+ description of the bug behavior, and the conditions that triggered the |
|
| 20 |
+ bug. In case of security issue please send an mail to |
|
| 21 |
+-@w{@samp{alexander_naumov@opensuse.org}}.
|
|
| 22 |
++@w{@samp{alexander_naumov@@opensuse.org}}.
|
|
| 23 |
+ |
|
| 24 |
+ @node Availability, , Reporting Bugs, Bugs |
|
| 25 |
+ @section Availability |
|
| 26 |
+-- |
|
| 27 |
+cgit v1.2.3 |
| ... | ... |
@@ -0,0 +1,152 @@ |
| 1 |
+# Copyright 1999-2026 Gentoo Authors |
|
| 2 |
+# Distributed under the terms of the GNU General Public License v2 |
|
| 3 |
+ |
|
| 4 |
+EAPI=8 |
|
| 5 |
+ |
|
| 6 |
+inherit autotools flag-o-matic pam tmpfiles |
|
| 7 |
+ |
|
| 8 |
+DESCRIPTION="screen manager with VT100/ANSI terminal emulation" |
|
| 9 |
+HOMEPAGE="https://www.gnu.org/software/screen/" |
|
| 10 |
+ |
|
| 11 |
+if [[ ${PV} != 9999 ]] ; then
|
|
| 12 |
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
|
|
| 13 |
+ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos ~x64-macos ~x64-solaris" |
|
| 14 |
+else |
|
| 15 |
+ inherit git-r3 |
|
| 16 |
+ EGIT_REPO_URI="https://git.savannah.gnu.org/git/screen.git" |
|
| 17 |
+ EGIT_CHECKOUT_DIR="${WORKDIR}/${P}" # needed for setting S later on
|
|
| 18 |
+ S="${WORKDIR}"/${P}/src
|
|
| 19 |
+fi |
|
| 20 |
+ |
|
| 21 |
+LICENSE="GPL-3+" |
|
| 22 |
+SLOT="0" |
|
| 23 |
+IUSE="debug nethack pam selinux multiuser" |
|
| 24 |
+ |
|
| 25 |
+DEPEND=">=sys-libs/ncurses-5.2:= |
|
| 26 |
+ virtual/libcrypt:= |
|
| 27 |
+ pam? ( sys-libs/pam )" |
|
| 28 |
+RDEPEND="${DEPEND}
|
|
| 29 |
+ acct-group/utmp |
|
| 30 |
+ selinux? ( sec-policy/selinux-screen )" |
|
| 31 |
+BDEPEND="sys-apps/texinfo" |
|
| 32 |
+ |
|
| 33 |
+PATCHES=( |
|
| 34 |
+ # Don't use utempter even if it is found on the system. |
|
| 35 |
+ "${FILESDIR}"/${PN}-4.3.0-no-utempter.patch
|
|
| 36 |
+ "${FILESDIR}"/${PN}-4.9.1-utmp-exit.patch
|
|
| 37 |
+ "${FILESDIR}"/${PN}-4.9.1-add-missing-pty.h-header.patch
|
|
| 38 |
+ "${FILESDIR}"/${PN}-4.9.1-fix_CVE-2025-46802.patch
|
|
| 39 |
+ "${FILESDIR}"/${PN}-4.9.1-fix_CVE-2025-46804.patch
|
|
| 40 |
+ "${FILESDIR}"/${PN}-4.9.1-fix_CVE-2025-46805.patch
|
|
| 41 |
+ "${FILESDIR}"/${PN}-4.9.1-hurd-path-max.patch
|
|
| 42 |
+) |
|
| 43 |
+ |
|
| 44 |
+src_prepare() {
|
|
| 45 |
+ default |
|
| 46 |
+ |
|
| 47 |
+ # sched.h is a system header and causes problems with some C libraries |
|
| 48 |
+ mv sched.h _sched.h || die |
|
| 49 |
+ sed -i '/include/ s:sched.h:_sched.h:' screen.h || die |
|
| 50 |
+ |
|
| 51 |
+ # Fix manpage |
|
| 52 |
+ sed -i \ |
|
| 53 |
+ -e "s:/usr/local/etc/screenrc:${EPREFIX}/etc/screenrc:g" \
|
|
| 54 |
+ -e "s:/usr/local/screens:${EPREFIX}/tmp/screen:g" \
|
|
| 55 |
+ -e "s:/local/etc/screenrc:${EPREFIX}/etc/screenrc:g" \
|
|
| 56 |
+ -e "s:/etc/utmp:${EPREFIX}/var/run/utmp:g" \
|
|
| 57 |
+ -e "s:/local/screens/S\\\-:${EPREFIX}/tmp/screen/S\\\-:g" \
|
|
| 58 |
+ doc/screen.1 || die |
|
| 59 |
+ |
|
| 60 |
+ if [[ ${CHOST} == *-darwin* ]] || use elibc_musl; then
|
|
| 61 |
+ sed -i -e '/^#define UTMPOK/s/define/undef/' acconfig.h || die |
|
| 62 |
+ fi |
|
| 63 |
+ |
|
| 64 |
+ # disable musl dummy headers for utmp[x] |
|
| 65 |
+ use elibc_musl && append-cppflags "-D_UTMP_H -D_UTMPX_H" |
|
| 66 |
+ |
|
| 67 |
+ # reconfigure |
|
| 68 |
+ eautoreconf |
|
| 69 |
+} |
|
| 70 |
+ |
|
| 71 |
+src_configure() {
|
|
| 72 |
+ # bug #944429 (revisit this on >= 5.0.0) |
|
| 73 |
+ append-cflags -std=gnu17 |
|
| 74 |
+ append-lfs-flags |
|
| 75 |
+ append-cppflags "-DMAXWIN=${MAX_SCREEN_WINDOWS:-100}"
|
|
| 76 |
+ |
|
| 77 |
+ if [[ ${CHOST} == *-solaris* ]]; then
|
|
| 78 |
+ # enable msg_header by upping the feature standard compatible |
|
| 79 |
+ # with c99 mode |
|
| 80 |
+ append-cppflags -D_XOPEN_SOURCE=600 |
|
| 81 |
+ fi |
|
| 82 |
+ |
|
| 83 |
+ use nethack || append-cppflags "-DNONETHACK" |
|
| 84 |
+ use debug && append-cppflags "-DDEBUG" |
|
| 85 |
+ |
|
| 86 |
+ local myeconfargs=( |
|
| 87 |
+ --with-sys-screenrc="${EPREFIX}/etc/screenrc"
|
|
| 88 |
+ --with-pty-mode=0620 |
|
| 89 |
+ --with-pty-group=5 |
|
| 90 |
+ --enable-rxvt_osc |
|
| 91 |
+ --enable-telnet |
|
| 92 |
+ --enable-colors256 |
|
| 93 |
+ $(use_enable pam) |
|
| 94 |
+ ) |
|
| 95 |
+ econf "${myeconfargs[@]}"
|
|
| 96 |
+} |
|
| 97 |
+ |
|
| 98 |
+src_compile() {
|
|
| 99 |
+ LC_ALL=POSIX emake comm.h term.h |
|
| 100 |
+ emake osdef.h |
|
| 101 |
+ |
|
| 102 |
+ emake -C doc screen.info |
|
| 103 |
+ default |
|
| 104 |
+} |
|
| 105 |
+ |
|
| 106 |
+src_install() {
|
|
| 107 |
+ local DOCS=( |
|
| 108 |
+ README ChangeLog INSTALL TODO NEWS* patchlevel.h |
|
| 109 |
+ doc/{FAQ,README.DOTSCREEN,fdpat.ps,window_to_display.ps}
|
|
| 110 |
+ ) |
|
| 111 |
+ |
|
| 112 |
+ emake DESTDIR="${D}" SCREEN="${P}" install
|
|
| 113 |
+ |
|
| 114 |
+ local tmpfiles_perms tmpfiles_group |
|
| 115 |
+ |
|
| 116 |
+ if use multiuser || use prefix ; then |
|
| 117 |
+ fperms 4755 /usr/bin/${P}
|
|
| 118 |
+ tmpfiles_perms="0755" |
|
| 119 |
+ tmpfiles_group="root" |
|
| 120 |
+ else |
|
| 121 |
+ fowners root:utmp /usr/bin/${P}
|
|
| 122 |
+ fperms 2755 /usr/bin/${P}
|
|
| 123 |
+ tmpfiles_perms="0775" |
|
| 124 |
+ tmpfiles_group="utmp" |
|
| 125 |
+ fi |
|
| 126 |
+ |
|
| 127 |
+ newtmpfiles - screen.conf <<<"d /tmp/screen ${tmpfiles_perms} root ${tmpfiles_group}"
|
|
| 128 |
+ |
|
| 129 |
+ insinto /usr/share/${PN}
|
|
| 130 |
+ doins terminfo/{screencap,screeninfo.src}
|
|
| 131 |
+ |
|
| 132 |
+ insinto /etc |
|
| 133 |
+ doins "${FILESDIR}"/screenrc
|
|
| 134 |
+ |
|
| 135 |
+ if use pam; then |
|
| 136 |
+ pamd_mimic_system screen auth |
|
| 137 |
+ fi |
|
| 138 |
+ |
|
| 139 |
+ dodoc "${DOCS[@]}"
|
|
| 140 |
+} |
|
| 141 |
+ |
|
| 142 |
+pkg_postinst() {
|
|
| 143 |
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
|
|
| 144 |
+ elog "Some dangerous key bindings have been removed or changed to more safe values." |
|
| 145 |
+ elog "We enable some xterm hacks in our default screenrc, which might break some" |
|
| 146 |
+ elog "applications. Please check /etc/screenrc for information on these changes." |
|
| 147 |
+ fi |
|
| 148 |
+ |
|
| 149 |
+ tmpfiles_process screen.conf |
|
| 150 |
+ |
|
| 151 |
+ ewarn "This revision changes the screen socket location to ${EROOT}/tmp/${PN}"
|
|
| 152 |
+} |
|
| 0 | 153 |