From 57ced6820ed246d3ba2602099d0c9fb5dfed8077 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Thu, 9 Mar 2017 04:35:45 -0500 Subject: [PATCH] system/vlock: New maintainer, make screensaver work. Signed-off-by: B. Watson --- system/vlock/10_fix-buffer-overflow.patch | 49 +++++++++++++++++++++++ system/vlock/README | 7 ++-- system/vlock/fix_caca.diff | 11 +++++ system/vlock/vlock.SlackBuild | 31 ++++++++++---- system/vlock/vlock.info | 4 +- 5 files changed, 89 insertions(+), 13 deletions(-) create mode 100644 system/vlock/10_fix-buffer-overflow.patch create mode 100644 system/vlock/fix_caca.diff diff --git a/system/vlock/10_fix-buffer-overflow.patch b/system/vlock/10_fix-buffer-overflow.patch new file mode 100644 index 0000000000..2fe07386fe --- /dev/null +++ b/system/vlock/10_fix-buffer-overflow.patch @@ -0,0 +1,49 @@ +Description: do not use fd_set with potentially large indices +Author: Helmut Grohne +Bug-Debian: http://bugs.debian.org/754594 +Last-Update: 2014-07-15 + +--- vlock-2.2.2.orig/src/process.c ++++ vlock-2.2.2/src/process.c +@@ -107,7 +107,7 @@ void ensure_death(pid_t pid) + + /* Close all possibly open file descriptors except the ones specified in the + * given set. */ +-static void close_fds(fd_set *except_fds) ++static void close_fds(int except_fd) + { + struct rlimit r; + int maxfd; +@@ -122,7 +122,8 @@ static void close_fds(fd_set *except_fds + /* Close all possibly open file descriptors except STDIN_FILENO, + * STDOUT_FILENO and STDERR_FILENO. */ + for (int fd = 0; fd < maxfd; fd++) +- if (!FD_ISSET(fd, except_fds)) ++ if(fd != STDIN_FILENO && fd != STDOUT_FILENO && fd != STDERR_FILENO ++ && fd != except_fd) + (void) close(fd); + } + +@@ -175,7 +176,6 @@ bool create_child(struct child_process * + + if (child->pid == 0) { + /* Child. */ +- fd_set except_fds; + + if (child->stdin_fd == REDIRECT_PIPE) + (void) dup2(stdin_pipe[0], STDIN_FILENO); +@@ -198,13 +198,7 @@ bool create_child(struct child_process * + else if (child->stderr_fd != NO_REDIRECT) + (void) dup2(child->stderr_fd, STDERR_FILENO); + +- FD_ZERO(&except_fds); +- FD_SET(STDIN_FILENO, &except_fds); +- FD_SET(STDOUT_FILENO, &except_fds); +- FD_SET(STDERR_FILENO, &except_fds); +- FD_SET(status_pipe[1], &except_fds); +- +- (void) close_fds(&except_fds); ++ (void) close_fds(status_pipe[1]); + + (void) setgid(getgid()); + (void) setuid(getuid()); diff --git a/system/vlock/README b/system/vlock/README index c095c5c968..ed377a4e41 100644 --- a/system/vlock/README +++ b/system/vlock/README @@ -7,6 +7,8 @@ allowing other users to use the system on other virtual consoles. If desired, the entire console may be locked and virtual console switching disabled. +There's also a screensaver, based on libcaca. + vlock has two particular options that this SlackBuild reserves to the wheel group: @@ -16,9 +18,9 @@ group: sessions. and - -s ,--disable-sysrq + -s,--disable-sysrq - Disable the SysRq mechanism (enabled by stock Slackware 13.37 + Disable the SysRq mechanism (enabled by stock Slackware kernels) while consoles are locked. This option only works if the -a, --all option given. @@ -26,4 +28,3 @@ If you would like to set an alternative group, you may pass the VLOCK_GROUP variable to the SlackBuild like this: VLOCK_GROUP=users ./vlock.SlackBuild - diff --git a/system/vlock/fix_caca.diff b/system/vlock/fix_caca.diff new file mode 100644 index 0000000000..e055db04d1 --- /dev/null +++ b/system/vlock/fix_caca.diff @@ -0,0 +1,11 @@ +diff -Naur vlock-2.2.3/src/vlock.sh vlock-2.2.3.patched/src/vlock.sh +--- vlock-2.2.3/src/vlock.sh 2011-09-18 11:22:35.000000000 -0400 ++++ vlock-2.2.3.patched/src/vlock.sh 2017-03-09 04:03:25.973297479 -0500 +@@ -174,6 +174,7 @@ + shift + ;; + -t|--timeout) ++ plugins="${plugins} caca" + VLOCK_TIMEOUT="$2" + if ! shift 2 ; then + echo >&2 "$0: option '$1' requires an argument" diff --git a/system/vlock/vlock.SlackBuild b/system/vlock/vlock.SlackBuild index 1bd1f04b06..a109720151 100644 --- a/system/vlock/vlock.SlackBuild +++ b/system/vlock/vlock.SlackBuild @@ -4,6 +4,7 @@ # Written by Menno E. Duursma # Modified by Robby Workman # Modified by Chris Abela +# Modified by B. Watson # # Copyright 2014 Ryan P.C. McQuen, WA, ryanpcmcquen@member.fsf.org # @@ -26,14 +27,21 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# 20170309 bkw: +# - take over maintenance +# - i486 => i586 +# - build with caca screensaver support +# - patches to make caca screensaver actually *work* +# - BUILD=3 + PRGNAM=vlock VERSION=${VERSION:-2.2.3} -BUILD=${BUILD:-2} +BUILD=${BUILD:-3} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then case "$( uname -m )" in - i?86) ARCH=i486 ;; + i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac @@ -46,8 +54,8 @@ OUTPUT=${OUTPUT:-/tmp} VLOCK_GRP=${VLOCK_GROUP:-wheel} -if [ "$ARCH" = "i486" ]; then - SLKCFLAGS="-O2 -march=i486 -mtune=i686" +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" @@ -75,19 +83,26 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +# patch by B. Watson, fixes the shell script wrapper so it loads +# the caca plugin when the -t/--timeout option is passed. +patch -p1 < $CWD/fix_caca.diff + +# patch from Debian, fixes a segfault when trying to start up the +# caca plugin. +patch -p1 < $CWD/10_fix-buffer-overflow.patch + ./configure \ --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --mandir=/usr/man \ + --with-modules="all.so new.so nosysrq.so caca.so" \ --enable-shadow make CFLAGS="$SLKCFLAGS -Wall -W -pedantic -std=gnu99" +strip vlock-main modules/*.so make install DESTDIR=$PKG VLOCK_GROUP="$VLOCK_GRP" -find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ - | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true - -find $PKG/usr/man -type f -exec gzip -9 {} \; +gzip -9 $PKG/usr/man/man?/*.? mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a [A-Z][A-Z]* ChangeLog $PKG/usr/doc/$PRGNAM-$VERSION diff --git a/system/vlock/vlock.info b/system/vlock/vlock.info index c31bbb8c73..ea91aa042e 100644 --- a/system/vlock/vlock.info +++ b/system/vlock/vlock.info @@ -6,5 +6,5 @@ MD5SUM="378175c7692a8f288e65fd4dbf8a38eb" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" -MAINTAINER="Ryan P.C. McQuen" -EMAIL="ryanpcmcquen@member.fsf.org" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com"