From 5c7bf26f5576c57eec8647f28734a5a17d1790d1 Mon Sep 17 00:00:00 2001 From: matthieu Date: Sat, 26 Jan 2008 18:48:19 +0000 Subject: [PATCH] - update to 0.7 - add support for BSD authentification. (patch sent upstream) ok Will Maier (maintainer). --- x11/slock/Makefile | 4 +- x11/slock/distinfo | 10 ++--- x11/slock/patches/patch-Makefile | 14 +++++++ x11/slock/patches/patch-config_mk | 25 ++++++++---- x11/slock/patches/patch-slock_c | 65 +++++++++++++++++++++++++++++++ x11/slock/pkg/PLIST | 5 ++- 6 files changed, 107 insertions(+), 16 deletions(-) create mode 100644 x11/slock/patches/patch-Makefile create mode 100644 x11/slock/patches/patch-slock_c diff --git a/x11/slock/Makefile b/x11/slock/Makefile index 1f58a704955..087a00b6786 100644 --- a/x11/slock/Makefile +++ b/x11/slock/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.3 2007/09/15 20:04:24 merdely Exp $ +# $OpenBSD: Makefile,v 1.4 2008/01/26 18:48:19 matthieu Exp $ COMMENT= simple X screen locker -DISTNAME= slock-0.6 +DISTNAME= slock-0.7 CATEGORIES= x11 diff --git a/x11/slock/distinfo b/x11/slock/distinfo index 11baf8a404c..0ebb6809c95 100644 --- a/x11/slock/distinfo +++ b/x11/slock/distinfo @@ -1,5 +1,5 @@ -MD5 (slock-0.6.tar.gz) = hdEqdLtdl1xLO39udgBl7A== -RMD160 (slock-0.6.tar.gz) = /Ne2lyLo0qaH9hUBvbBZxbbTEbg= -SHA1 (slock-0.6.tar.gz) = tzQ19hVJw+UnCHJONNzLZLdiwrw= -SHA256 (slock-0.6.tar.gz) = +m+rsymvLqvf88+pxqDpZfQ4R2NFykH/BJzvlgO0XoU= -SIZE (slock-0.6.tar.gz) = 3446 +MD5 (slock-0.7.tar.gz) = JZ5Z/Xo72xpa1IWOKJxVPQ== +RMD160 (slock-0.7.tar.gz) = V2X/oGIauvKHGFE+gRkGlt8oe74= +SHA1 (slock-0.7.tar.gz) = NRNV1uCb5zkRnl/WsWBsebW153c= +SHA256 (slock-0.7.tar.gz) = YupuOnSAim03Xdc505NqUo5/0wMFDPcC5pcgWlzU5Gw= +SIZE (slock-0.7.tar.gz) = 3487 diff --git a/x11/slock/patches/patch-Makefile b/x11/slock/patches/patch-Makefile new file mode 100644 index 00000000000..6f68d24ca05 --- /dev/null +++ b/x11/slock/patches/patch-Makefile @@ -0,0 +1,14 @@ +$OpenBSD: patch-Makefile,v 1.1 2008/01/26 18:48:19 matthieu Exp $ +--- Makefile.orig Sat Nov 24 21:18:01 2007 ++++ Makefile Fri Jan 25 21:46:27 2008 +@@ -41,9 +41,7 @@ + install: all + @echo installing executable file to ${DESTDIR}${PREFIX}/bin + @mkdir -p ${DESTDIR}${PREFIX}/bin +- @cp -f slock ${DESTDIR}${PREFIX}/bin +- @chmod 755 ${DESTDIR}${PREFIX}/bin/slock +- @chmod u+s ${DESTDIR}${PREFIX}/bin/slock ++ @install -c -m ${MODE} -o root -g ${GROUP} slock ${DESTDIR}${PREFIX}/bin + + uninstall: + @echo removing executable file from ${DESTDIR}${PREFIX}/bin diff --git a/x11/slock/patches/patch-config_mk b/x11/slock/patches/patch-config_mk index ced42f4a830..e663f0659c4 100644 --- a/x11/slock/patches/patch-config_mk +++ b/x11/slock/patches/patch-config_mk @@ -1,14 +1,12 @@ -$OpenBSD: patch-config_mk,v 1.1.1.1 2007/01/19 05:24:08 steven Exp $ ---- config.mk.orig Sat Jan 13 08:12:11 2007 -+++ config.mk Sat Jan 13 08:16:20 2007 -@@ -4,18 +4,18 @@ VERSION = 0.4 +$OpenBSD: patch-config_mk,v 1.2 2008/01/26 18:48:19 matthieu Exp $ +--- config.mk.orig Fri Jan 25 21:48:50 2008 ++++ config.mk Fri Jan 25 21:48:38 2008 +@@ -4,24 +4,29 @@ # Customize below to fit your system # paths -PREFIX = /usr/local --MANPREFIX = ${PREFIX}/share/man +#PREFIX = /usr/local -+MANPREFIX = ${PREFIX}/man -X11INC = /usr/X11R6/include -X11LIB = /usr/X11R6/lib @@ -23,7 +21,20 @@ $OpenBSD: patch-config_mk,v 1.1.1.1 2007/01/19 05:24:08 steven Exp $ # flags -CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\" -DHAVE_SHADOW_H -+CFLAGS += ${INCS} -DVERSION=\"${VERSION}\" ++CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\" -DHAVE_BSD_AUTH LDFLAGS = ${LIBS} #CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\" -DHAVE_SHADOW_H #LDFLAGS = -g ${LIBS} + +-# On *BSD remove -DHAVE_SHADOW_H from CFLAGS ++# On *BSD remove -DHAVE_SHADOW_H from CFLAGS and add -DHAVE_BSD_AUTH + # On OpenBSD and Darwin remove -lcrypt from LIBS + + # compiler and linker + CC = cc + LD = ${CC} ++ ++# Install mode. On BSD systems MODE=2755 and GROUP=auth ++# On others MODE=4755 and GROUP=root ++MODE=2755 ++GROUP=auth diff --git a/x11/slock/patches/patch-slock_c b/x11/slock/patches/patch-slock_c new file mode 100644 index 00000000000..198826972ab --- /dev/null +++ b/x11/slock/patches/patch-slock_c @@ -0,0 +1,65 @@ +$OpenBSD: patch-slock_c,v 1.1 2008/01/26 18:48:19 matthieu Exp $ +--- slock.c.orig Sat Nov 24 21:18:01 2007 ++++ slock.c Fri Jan 25 21:43:05 2008 +@@ -17,6 +17,11 @@ + #include + #include + ++#if HAVE_BSD_AUTH ++#include ++#include ++#endif ++ + void + eprint(const char *errstr, ...) { + va_list ap; +@@ -27,6 +32,7 @@ + exit(EXIT_FAILURE); + } + ++#ifndef HAVE_BSD_AUTH + const char * + get_password() { /* only run as root */ + const char *rval; +@@ -51,13 +57,16 @@ + eprint("slock: cannot drop privileges\n"); + return rval; + } ++#endif + + int + main(int argc, char **argv) { + char curs[] = {0, 0, 0, 0, 0, 0, 0, 0}; + char buf[32], passwd[256]; + int num, screen; ++#ifndef HAVE_BSD_AUTH + const char *pws; ++#endif + unsigned int len; + Bool running = True; + Cursor invisible; +@@ -71,7 +80,9 @@ + + if((argc > 1) && !strncmp(argv[1], "-v", 3)) + eprint("slock-"VERSION", © 2006-2007 Anselm R. Garbe, Sander van Dijk\n"); ++#ifndef HAVE_BSD_AUTH + pws = get_password(); ++#endif + if(!(dpy = XOpenDisplay(0))) + eprint("slock: cannot open display\n"); + screen = DefaultScreen(dpy); +@@ -118,7 +129,13 @@ + switch(ksym) { + case XK_Return: + passwd[len] = 0; +- if((running = strcmp(crypt(passwd, pws), pws)) != 0) ++#ifndef HAVE_BSD_AUTH ++ running = strcmp(crypt(passwd, pws), pws); ++#else ++ running = !auth_userokay(getlogin(), NULL, ++ "auth-xlock", passwd); ++#endif ++ if (running != 0) + XBell(dpy, 100); + len = 0; + break; diff --git a/x11/slock/pkg/PLIST b/x11/slock/pkg/PLIST index dcd3505a8c7..f88e34489f9 100644 --- a/x11/slock/pkg/PLIST +++ b/x11/slock/pkg/PLIST @@ -1,3 +1,4 @@ -@comment $OpenBSD: PLIST,v 1.1.1.1 2007/01/19 05:24:08 steven Exp $ -@mode u+s +@comment $OpenBSD: PLIST,v 1.2 2008/01/26 18:48:19 matthieu Exp $ +@mode g+s +@group auth bin/slock