- update to 0.7

- add support for BSD authentification. (patch sent upstream)
ok Will Maier (maintainer).
This commit is contained in:
matthieu 2008-01-26 18:48:19 +00:00
parent fe6870e74b
commit 5c7bf26f55
6 changed files with 107 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <X11/Xlib.h>
#include <X11/Xutil.h>
+#if HAVE_BSD_AUTH
+#include <login_cap.h>
+#include <bsd_auth.h>
+#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;

View File

@ -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