diff options
author | Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de> | 2008-04-21 23:41:42 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2011-09-03 14:05:33 +0200 |
commit | 2bba75d842fea979a467751cdc6eb60364605964 (patch) | |
tree | d1e1ce3a802c9b0031de5cc63a9c886d0b08d0fa | |
parent | 1df16381394692fe55af6b3c8d928250c6bbad3f (diff) | |
download | screen-2bba75d842fea979a467751cdc6eb60364605964.tar.gz |
Imported Debian patch 4.0.3-8debian/4.0.3-8
-rw-r--r-- | debian/README.Debian | 2 | ||||
-rw-r--r-- | debian/changelog | 16 | ||||
-rw-r--r-- | debian/compat | 2 | ||||
-rw-r--r-- | debian/control | 4 | ||||
-rw-r--r-- | debian/init | 2 | ||||
-rw-r--r-- | debian/patches/00list | 3 | ||||
-rw-r--r-- | debian/patches/07norootpassword.dpatch | 64 | ||||
-rw-r--r-- | debian/patches/15manpage_typos.dpatch | 14 | ||||
-rw-r--r-- | debian/patches/28blankerprg_callsemantics.dpatch | 28 | ||||
-rw-r--r-- | debian/patches/51EXP_session_creation_time.dpatch | 291 |
10 files changed, 420 insertions, 6 deletions
diff --git a/debian/README.Debian b/debian/README.Debian index 71ce07d..6ad59ea 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -81,7 +81,7 @@ A: Screen has to be setuid root to accomplish this. (Note the security implicati environment for exactly this reason - see ld.so(1).) If you still want to enable the feature, you may do so with the following commands: -] dpkg-statoverride --add root utmp 4755 /usr/bin/screen +] dpkg-statoverride --update --add root utmp 4755 /usr/bin/screen ] chmod 0755 /var/run/screen dpkg-statoverride will make sure that the modified permissions remain in effect diff --git a/debian/changelog b/debian/changelog index 8cbdf88..44010c4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,19 @@ +screen (4.0.3-8) unstable; urgency=low + + * The "resuming the bughunt" release. + * Bump Standards level to 3.7.3, debhelper to level 6. + * Include Ubuntu's 07norootpassword.dpatch, thanks to Martin Pitt! + See Ubuntu #6760. Closes: #447756. + * Fix another error in the info documentation. Closes: #447668. + * Fix blankerprg semantics. Closes: #330036. + * Empty Default-Stop section in the LSB initscript header. Closes: #461438. + * Fix multiuser activation howto in README.Debian. + * New feature: sort sessions by (and show) creation time, and pick the + youngest instead of an arbitrary one when called with '-rR'. + Closes: #206572. + + -- Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de> Mon, 21 Apr 2008 23:41:42 +0200 + screen (4.0.3-7) unstable; urgency=low * Completely undo the socket dir migration after discussion on #debian-devel. diff --git a/debian/compat b/debian/compat index 7ed6ff8..1e8b314 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -5 +6 diff --git a/debian/control b/debian/control index a9d3108..bfedd85 100644 --- a/debian/control +++ b/debian/control @@ -3,8 +3,8 @@ Section: misc Priority: optional Maintainer: Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de> Uploaders: Adam Lazur <zal@debian.org> -Standards-Version: 3.7.2 -Build-Depends: libncursesw5-dev, texinfo, libpam0g-dev, debhelper (>> 5), dpatch +Standards-Version: 3.7.3 +Build-Depends: libncursesw5-dev, texinfo, libpam0g-dev, debhelper (>> 6), dpatch Package: screen Architecture: any diff --git a/debian/init b/debian/init index c1d04b2..98ecd86 100644 --- a/debian/init +++ b/debian/init @@ -9,7 +9,7 @@ # Required-Start: $local_fs $remote_fs # Required-Stop: $local_fs $remote_fs # Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 +# Default-Stop: # Short-Description: screen sessions cleaning ### END INIT INFO diff --git a/debian/patches/00list b/debian/patches/00list index c730908..a1d37ef 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -4,6 +4,7 @@ 04AUTOCONF 05fix_osdef_include 06replace_linux_feature_macro +07norootpassword 11replace_doc_paths 12fix_texinfo_syntax 13split_info_files @@ -21,6 +22,8 @@ 25allow_symlink_sockdir 26source_encoding 27doc_sty_noenvpassing +28blankerprg_callsemantics 30fix_fsf_address 40cjk_eastasian 50EXP_tilde_expansion +51EXP_session_creation_time diff --git a/debian/patches/07norootpassword.dpatch b/debian/patches/07norootpassword.dpatch new file mode 100644 index 0000000..1d90afc --- /dev/null +++ b/debian/patches/07norootpassword.dpatch @@ -0,0 +1,64 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 07_norootpassword.dpatch by Martin Pitt <martin.pitt@ubuntu.com> +## +## DP: When locking a root-owned screen, check that root has a +## DP: password set. If not, ask for an unlocking key. +## DP: See https://bugs.launchpad.net/bugs/6760 + +@DPATCH@ +--- screen-4.0.3.orig/attacher.c ++++ screen-4.0.3/attacher.c +@@ -806,11 +806,15 @@ + #ifdef USE_PAM + pam_handle_t *pamh = 0; + int pam_error; +-#else +- char *pass, mypass[16 + 1], salt[3]; + #endif ++ char *pass, mypass[16 + 1], salt[3]; ++ int using_pam = 1; + +-#ifndef USE_PAM ++#ifdef USE_PAM ++ if (!ppp->pw_uid) ++ { ++#endif ++ using_pam = 0; + pass = ppp->pw_passwd; + if (pass == 0 || *pass == 0) + { +@@ -843,6 +847,8 @@ + pass = crypt(mypass, salt); + pass = ppp->pw_passwd = SaveStr(pass); + } ++#ifdef USE_PAM ++ } + #endif + + debug("screen_builtin_lck looking in gcos field\n"); +@@ -872,6 +878,8 @@ + AttacherFinit(SIGARG); + /* NOTREACHED */ + } ++ if (using_pam) ++ { + #ifdef USE_PAM + PAM_conversation.appdata_ptr = cp1; + pam_error = pam_start("screen", ppp->pw_name, &PAM_conversation, &pamh); +@@ -882,10 +890,13 @@ + PAM_conversation.appdata_ptr = 0; + if (pam_error == PAM_SUCCESS) + break; +-#else +- if (!strncmp(crypt(cp1, pass), pass, strlen(pass))) +- break; + #endif ++ } ++ else ++ { ++ if (!strncmp(crypt(cp1, pass), pass, strlen(pass))) ++ break; ++ } + debug("screen_builtin_lck: NO!!!!!\n"); + bzero(cp1, strlen(cp1)); + } diff --git a/debian/patches/15manpage_typos.dpatch b/debian/patches/15manpage_typos.dpatch index 1eabcb8..877e1ae 100644 --- a/debian/patches/15manpage_typos.dpatch +++ b/debian/patches/15manpage_typos.dpatch @@ -1,7 +1,7 @@ #! /bin/sh /usr/share/dpatch/dpatch-run ## 15manpage_typos.dpatch by <hesso@pool.math.tu-berlin.de> ## -## DP: Fix a few typos in the documentation. +## DP: Fix a few typos and groff errors in the documentation. @DPATCH@ --- screen-4.0.3.orig/doc/screen.1 2007-08-09 02:51:38.000000000 +0200 @@ -41,3 +41,15 @@ selects the blank window. As a special case for reattach, @samp{=} brings up the windowlist on the blank window. +diff -Naur doc.orig/screen.1 doc/screen.1 +--- screen-4.0.3.orig/doc/screen.1 2008-04-17 13:03:10.000000000 +0200 ++++ screen-4.0.3/doc/screen.1 2008-04-17 13:03:21.000000000 +0200 +@@ -4015,7 +4015,7 @@ + Background Black + .TP 27 + \h'\w'ESC [ Ps = 'u'\fB...\fP +-... ++\&... + .TP 27 + \h'\w'ESC [ Ps = 'u'\fB49\fP (A) + Background Default diff --git a/debian/patches/28blankerprg_callsemantics.dpatch b/debian/patches/28blankerprg_callsemantics.dpatch new file mode 100644 index 0000000..07c4bf4 --- /dev/null +++ b/debian/patches/28blankerprg_callsemantics.dpatch @@ -0,0 +1,28 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 28blankerprg_callsemantics.dpatch by <hesso@pool.math.tu-berlin.de> +## +## DP: Allow 'blankerprg' to be called without arguments (as the manpage states). + +@DPATCH@ +--- screen-4.0.3.orig/comm.c 2008-04-18 01:56:21.000000000 +0200 ++++ screen-4.0.3/comm.c 2008-04-18 01:56:27.000000000 +0200 +@@ -98,7 +98,7 @@ + #endif + { "blanker", NEED_DISPLAY|ARGS_0}, + #ifdef BLANKER_PRG +- { "blankerprg", ARGS_1|ARGS_ORMORE }, ++ { "blankerprg", ARGS_0|ARGS_ORMORE }, + #endif + { "break", NEED_FORE|ARGS_01 }, + { "breaktype", NEED_FORE|ARGS_01 }, +--- screen-4.0.3.orig/process.c 2008-04-18 02:10:35.000000000 +0200 ++++ screen-4.0.3/process.c 2008-04-18 02:10:55.000000000 +0200 +@@ -3785,7 +3785,7 @@ + free(blankerprg); + blankerprg = 0; + } +- if (args[0][0]) ++ if (args[0] && args[0][0]) + blankerprg = SaveArgs(args); + break; + #endif diff --git a/debian/patches/51EXP_session_creation_time.dpatch b/debian/patches/51EXP_session_creation_time.dpatch new file mode 100644 index 0000000..ea6be28 --- /dev/null +++ b/debian/patches/51EXP_session_creation_time.dpatch @@ -0,0 +1,291 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 51EXP_session_creation_time.dpatch by <hesso@pool.math.tu-berlin.de> +## +## DP: Add lookup code for the creation time of each session. Requires +## DP: digging in /proc/$pid and /proc/uptime, though, so it's definitely +## DP: no candidate for the Beautiful C contest. +## DP: Affects screen's behaviour in the following situations: +## DP: * 'screen -ls' lists available sessions sorted chronologically +## DP: * 'screen -RR' now picks the youngest session instead of an +## DP: arbitrary one + +@DPATCH@ +--- screen-4.0.3.orig/extern.h 2003-08-22 14:27:57.000000000 +0200 ++++ screen-4.0.3/extern.h 2008-04-21 14:25:42.000000000 +0200 +@@ -379,6 +379,8 @@ + #else + extern int xsnprintf __P(()); + #endif ++extern time_t SessionCreationTime __P((const char *)); ++extern time_t GetUptime __P((void)); + + + /* acl.c */ +--- screen-4.0.3.orig/misc.c 2003-12-05 14:45:41.000000000 +0100 ++++ screen-4.0.3/misc.c 2008-04-21 22:20:43.000000000 +0200 +@@ -24,6 +24,7 @@ + #include <sys/types.h> + #include <sys/stat.h> /* mkdir() declaration */ + #include <signal.h> ++#include <fcntl.h> + + #include "config.h" + #include "screen.h" +@@ -796,3 +797,40 @@ + } + + #endif ++ ++time_t SessionCreationTime(const char *fifo) { ++ char ppath[20]; ++ int pfd; ++ char pdata[512]; ++ char *jiffies; ++ ++ int pid = atoi(fifo); ++ if (pid <= 0) return 0; ++ sprintf(ppath, "/proc/%u/stat", pid); ++ pfd = open(ppath, O_RDONLY); ++ if (pfd < 0) return 0; ++ while (1) { ++ int R=0, RR; ++ RR = read(pfd, pdata + R, 512-R); ++ if (RR < 0) {close(pfd); return 0;} ++ else if (RR == 0) break; ++ } ++ close(pfd); ++ ++ for (pfd=21, jiffies=pdata; pfd; --pfd) { ++ jiffies = strchr(jiffies, ' '); ++ if (!jiffies) break; else ++jiffies; ++ } ++ if (!jiffies) return 0; ++ ++ return atol(jiffies) / 100; ++} ++ ++time_t GetUptime(void) { ++ char uptimestr[32]; ++ int fd = open("/proc/uptime", O_RDONLY); ++ if (fd < 0) return 0; ++ (void)read(fd, uptimestr, 32); ++ close(fd); ++ return atol(uptimestr); ++} +--- screen-4.0.3.orig/socket.c 2003-09-08 16:26:50.000000000 +0200 ++++ screen-4.0.3/socket.c 2008-04-21 22:25:16.000000000 +0200 +@@ -115,15 +115,17 @@ + int sdirlen; + int matchlen = 0; + char *name, *n; +- int firsts = -1, sockfd; +- char *firstn = NULL; ++ int sockfd; + int nfound = 0, ngood = 0, ndead = 0, nwipe = 0, npriv = 0; ++ time_t sysboot = time(NULL) - GetUptime(); + struct sent + { + struct sent *next; + int mode; + char *name; +- } *slist, **slisttail, *sent, *nsent; ++ time_t created; ++ int good; ++ } *slist, **slisttail, *sent, *nsent, *schosen = NULL; + + if (match) + { +@@ -150,7 +152,6 @@ + Panic(errno, "Cannot opendir %s", SockPath); + + slist = 0; +- slisttail = &slist; + while ((dp = readdir(dirp))) + { + name = dp->d_name; +@@ -161,7 +162,7 @@ + { + n = name; + /* if we don't want to match digits. Skip them */ +- if ((*match <= '0' || *match > '9') && (*n > '0' && *n <= '9')) ++ if ((*match < '0' || *match > '9') && (*n >= '0' && *n <= '9')) + { + while (*n >= '0' && *n <= '9') + n++; +@@ -226,11 +227,17 @@ + debug(" store it.\n"); + if ((sent = (struct sent *)malloc(sizeof(struct sent))) == 0) + continue; +- sent->next = 0; + sent->name = SaveStr(name); + sent->mode = mode; ++ sent->created = sysboot + SessionCreationTime(name); ++ sent->good = 0; ++ ++ for (slisttail = &slist; *slisttail; slisttail = &((*slisttail)->next)) { ++ if ((*slisttail)->created < sent->created) break; ++ } ++ ++ sent->next = *slisttail; + *slisttail = sent; +- slisttail = &sent->next; + nfound++; + sockfd = MakeClientSocket(0); + #ifdef USE_SETEUID +@@ -295,17 +302,9 @@ + continue; + } + ngood++; +- if (fdp && firsts == -1) +- { +- firsts = sockfd; +- firstn = sent->name; +- debug(" taken.\n"); +- } +- else +- { +- debug(" discarded.\n"); +- close(sockfd); +- } ++ sent->good = 1; ++ debug(" added to list.\n"); ++ close(sockfd); + } + (void)closedir(dirp); + if (nfound && (lsflag || ngood != 1) && !quietflag) +@@ -324,34 +323,42 @@ + } + for (sent = slist; sent; sent = sent->next) + { ++ char timestr[64]; ++ if (sent->created == 0) ++ { ++ sprintf(timestr, "???"); ++ } else { ++ strftime(timestr, 64, "%d/%m/%Y %H:%M:%S", localtime(&sent->created)); ++ } ++ printf("\t%s\t(%s)", sent->name, timestr); + switch (sent->mode) + { + case 0700: +- printf("\t%s\t(Attached)\n", sent->name); ++ printf("\t(Attached)\n"); + break; + case 0600: +- printf("\t%s\t(Detached)\n", sent->name); ++ printf("\t(Detached)\n"); + break; + #ifdef MULTIUSER + case 0701: +- printf("\t%s\t(Multi, attached)\n", sent->name); ++ printf("\t(Multi, attached)\n"); + break; + case 0601: +- printf("\t%s\t(Multi, detached)\n", sent->name); ++ printf("\t(Multi, detached)\n"); + break; + #endif + case -1: + /* No trigraphs here! */ +- printf("\t%s\t(Dead ?%c?)\n", sent->name, '?'); ++ printf("\t(Dead ?%c?)\n", '?'); + break; + case -2: +- printf("\t%s\t(Removed)\n", sent->name); ++ printf("\t(Removed)\n"); + break; + case -3: +- printf("\t%s\t(Remote or dead)\n", sent->name); ++ printf("\t(Remote or dead)\n"); + break; + case -4: +- printf("\t%s\t(Private)\n", sent->name); ++ printf("\t(Private)\n"); + break; + } + } +@@ -364,10 +371,22 @@ + else + Msg(0, m, ndead > 1 ? "s" : "", ndead > 1 ? "" : "es"); /* other args for nethack */ + } +- if (firsts != -1) ++ for (sent = slist; sent; sent = sent->next) + { +- sprintf(SockPath + sdirlen, "/%s", firstn); +- *fdp = firsts; ++ if (sent->good) ++ { ++ schosen = sent; ++ break; ++ } ++ } ++ if (schosen && fdp) ++ { ++ sprintf(SockPath + sdirlen, "/%s", schosen->name); ++ *fdp = MakeClientSocket(0); ++#ifdef USE_SETEUID ++ xseteuid(real_uid); ++ xsetegid(real_gid); ++#endif + } + else + SockPath[sdirlen] = 0; +--- screen-4.0.3.orig/doc/screen.1 2008-04-21 22:34:11.000000000 +0200 ++++ screen-4.0.3/doc/screen.1 2008-04-21 22:50:37.000000000 +0200 +@@ -238,7 +238,7 @@ + .IR screen , + but prints a list of + .I pid.tty.host +-strings identifying your ++strings and creation timestamps identifying your + .I screen + sessions. + Sessions marked `detached' can be resumed with \*Qscreen -r\*U. Those marked +@@ -317,7 +317,7 @@ + sessions in another user's directory. This requires setuid-root. + .TP 5 + .B \-R +-attempts to resume the first detached ++attempts to resume the youngest (in terms of creation time) detached + .I screen + session it finds. If successful, all other command-line options are ignored. + If no detached session exists, starts a new session using the specified +@@ -327,6 +327,8 @@ + .I screen + is run as a login-shell (actually screen uses \*Q-xRR\*U in that case). + For combinations with the \fB\-d\fP/\fB\-D\fP option see there. ++.B Note: ++Time-based session selection is a Debian addition. + .TP 5 + .B \-s + sets the default shell to the program specified, instead of the value +--- screen-4.0.3.orig/doc/screen.texinfo 2008-04-21 22:34:11.000000000 +0200 ++++ screen-4.0.3/doc/screen.texinfo 2008-04-21 22:49:45.000000000 +0200 +@@ -315,7 +315,8 @@ + @itemx -list [@var{match}] + Do not start @code{screen}, but instead print a list of session + identification strings (usually of the form @var{pid.tty.host}; +-@pxref{Session Name}). Sessions marked @samp{detached} can be resumed ++@pxref{Session Name}) and the corresponding creation timestamps. ++Sessions marked @samp{detached} can be resumed + with @code{screen -r}. Those marked @samp{attached} are running and + have a controlling terminal. If the session runs in multiuser mode, + it is marked @samp{multi}. Sessions marked as @samp{unreachable} either +@@ -376,14 +377,15 @@ + sessions in another user's directory. This requires setuid-root. + + @item -R +-Resume the first appropriate detached @code{screen} session. If +-successful, all other command-line options are ignored. If no detached ++Resume the most-recently created appropriate detached @code{screen} session. ++If successful, all other command-line options are ignored. If no detached + session exists, start a new session using the specified options, just as + if @samp{-R} had not been specified. This option is set by default if + screen is run as a login-shell (actually screen uses @samp{-xRR} in + that case). + For combinations with the + @samp{-D}/@samp{-d} option see there. ++@samp{Note:} Time-based session selection is a Debian addition. + + @item -s @var{program} + Set the default shell to be @var{program}. By default, @code{screen} |