Index | Thread | Search

From:
Andrew Kloet <andrew@kloet.net>
Subject:
x11/slock: 1.5.0 -> 1.7.0
To:
ports@openbsd.org
Cc:
Gleydson Soares <gsoares@openbsd.org>
Date:
Sat, 10 Oct 2026 22:17:43 -0400

Download raw body.

Thread
Hello ports@

This diff updates x11/slock 1.5.0 -> 1.7.0

Port changes:
* Most Makefile nits have been upstreamed.
* Moved HAVE_BSD_AUTH guard to mask unused variables.
* Added pledge/unveil...
  Due to post-lock cmd we have to lock unveil late.
  HEAD removed post-lock cmd which will let us lock immediately.

OK?

Andrew

diff --git a/x11/slock/Makefile b/x11/slock/Makefile
index 33b2d85ec..96c4054fe 100644
--- a/x11/slock/Makefile
+++ b/x11/slock/Makefile
@@ -1,6 +1,6 @@
 COMMENT=		simple X screen locker
 
-DISTNAME=		slock-1.5
+DISTNAME=		slock-1.7
 
 CATEGORIES=		x11
 
@@ -11,6 +11,7 @@ MAINTAINER=		Gleydson Soares <gsoares@openbsd.org>
 # BSD
 PERMIT_PACKAGE=	Yes
 
+# uses pledge() and unveil()
 WANTLIB=		X11 c Xext Xrandr
 
 SITES=			http://dl.suckless.org/tools/
diff --git a/x11/slock/distinfo b/x11/slock/distinfo
index 733233143..3f2ac7d95 100644
--- a/x11/slock/distinfo
+++ b/x11/slock/distinfo
@@ -1,2 +1,2 @@
-SHA256 (slock-1.5.tar.gz) = ruHj+/aid/tiWjg4BzuXm2SD57rKTOgvVt4f8ZLbDk0=
-SIZE (slock-1.5.tar.gz) = 6898
+SHA256 (slock-1.7.tar.gz) = mXEea0GbIhrp/D6cjzHmsWjbURVCeJlvPQLOZcwZgwE=
+SIZE (slock-1.7.tar.gz) = 7240
diff --git a/x11/slock/patches/patch-Makefile b/x11/slock/patches/patch-Makefile
index 0274d88e7..05473e614 100644
--- a/x11/slock/patches/patch-Makefile
+++ b/x11/slock/patches/patch-Makefile
@@ -1,39 +1,17 @@
 Index: Makefile
 --- Makefile.orig
 +++ Makefile
-@@ -15,8 +15,7 @@ options:
- 	@echo "CC       = ${CC}"
- 
- .c.o:
--	@echo CC $<
--	@${CC} -c ${CFLAGS} $<
-+	${CC} -c ${CFLAGS} $<
- 
- ${OBJ}: config.h config.mk arg.h util.h
- 
-@@ -25,8 +24,7 @@ config.h:
- 	@cp config.def.h $@
- 
- slock: ${OBJ}
--	@echo CC -o $@
--	@${CC} -o $@ ${OBJ} ${LDFLAGS}
-+	${CC} -o $@ ${OBJ} ${LDFLAGS}
- 
- clean:
- 	@echo cleaning
-@@ -42,15 +40,12 @@ dist: clean
- 	@rm -rf slock-${VERSION}
+@@ -31,13 +31,12 @@ dist: clean
+ 	rm -rf slock-${VERSION}
  
  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
--	@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
--	@mkdir -p ${DESTDIR}${MANPREFIX}/man1
--	@sed "s/VERSION/${VERSION}/g" <slock.1 >${DESTDIR}${MANPREFIX}/man1/slock.1
--	@chmod 644 ${DESTDIR}${MANPREFIX}/man1/slock.1
+-	mkdir -p ${DESTDIR}${PREFIX}/bin
+-	cp -f slock ${DESTDIR}${PREFIX}/bin
+-	chmod 755 ${DESTDIR}${PREFIX}/bin/slock
+-	chmod u+s ${DESTDIR}${PREFIX}/bin/slock
+-	mkdir -p ${DESTDIR}${MANPREFIX}/man1
+-	sed "s/VERSION/${VERSION}/g" <slock.1 >${DESTDIR}${MANPREFIX}/man1/slock.1
+-	chmod 644 ${DESTDIR}${MANPREFIX}/man1/slock.1
 +	${BSD_INSTALL_PROGRAM_DIR} ${DESTDIR}${PREFIX}/bin
 +	${BSD_INSTALL_PROGRAM} slock ${DESTDIR}${PREFIX}/bin
 +	${BSD_INSTALL_MAN_DIR} ${DESTDIR}${MANPREFIX}/man1
@@ -42,4 +20,4 @@ Index: Makefile
 +	${BSD_INSTALL_MAN} slock.1 ${DESTDIR}${MANPREFIX}/man1
  
  uninstall:
- 	@echo removing executable file from ${DESTDIR}${PREFIX}/bin
+ 	rm -f ${DESTDIR}${PREFIX}/bin/slock
diff --git a/x11/slock/patches/patch-slock_c b/x11/slock/patches/patch-slock_c
index fa650f778..df39b14b1 100644
--- a/x11/slock/patches/patch-slock_c
+++ b/x11/slock/patches/patch-slock_c
@@ -3,7 +3,7 @@ Add back bsd-auth support, removed in 04143fd68dbc
 Index: slock.c
 --- slock.c.orig
 +++ slock.c
-@@ -19,6 +19,11 @@
+@@ -20,6 +20,11 @@
  #include <X11/Xlib.h>
  #include <X11/Xutil.h>
  
@@ -15,7 +15,7 @@ Index: slock.c
  #include "arg.h"
  #include "util.h"
  
-@@ -83,6 +88,7 @@ dontkillme(void)
+@@ -84,6 +89,7 @@ dontkillme(void)
  }
  #endif
  
@@ -23,7 +23,7 @@ Index: slock.c
  static const char *
  gethash(void)
  {
-@@ -123,13 +129,21 @@ gethash(void)
+@@ -124,13 +130,21 @@ gethash(void)
  
  	return hash;
  }
@@ -46,7 +46,7 @@ Index: slock.c
  	int num, screen, running, failure, oldc;
  	unsigned int len, color;
  	KeySym ksym;
-@@ -160,10 +174,14 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **
+@@ -161,10 +175,14 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **
  			case XK_Return:
  				passwd[len] = '\0';
  				errno = 0;
@@ -61,17 +61,41 @@ Index: slock.c
  				if (running) {
  					XBell(dpy, 100);
  					failure = 1;
-@@ -303,7 +321,9 @@ main(int argc, char **argv) {
+@@ -311,14 +329,19 @@ int
+ main(int argc, char **argv) {
+ 	struct xrandr rr;
+ 	struct lock **locks;
++#ifndef HAVE_BSD_AUTH
+ 	struct passwd *pwd;
  	struct group *grp;
  	uid_t duid;
  	gid_t dgid;
-+#ifndef HAVE_BSD_AUTH
  	const char *hash;
 +#endif
  	Display *dpy;
  	int s, nlocks, nscreens;
  
-@@ -331,14 +351,23 @@ main(int argc, char **argv) {
++	if (pledge("stdio rpath tty proc exec getpw", NULL) == -1)
++		die("slock: pledge: %s\n", strerror(errno));
++
+ 	ARGBEGIN {
+ 	case 'v':
+ 		puts("slock-"VERSION);
+@@ -327,6 +350,7 @@ main(int argc, char **argv) {
+ 		usage();
+ 	} ARGEND
+ 
++#ifndef HAVE_BSD_AUTH
+ 	/* validate drop-user and -group */
+ 	errno = 0;
+ 	if (!(pwd = getpwnam(user)))
+@@ -338,19 +362,29 @@ main(int argc, char **argv) {
+ 		die("slock: getgrnam %s: %s\n", group,
+ 		    errno ? strerror(errno) : "group entry not found");
+ 	dgid = grp->gr_gid;
++#endif
+ 
+ #ifdef __linux__
  	dontkillme();
  #endif
  
@@ -95,7 +119,7 @@ Index: slock.c
  	/* drop privileges */
  	if (setgroups(0, NULL) < 0)
  		die("slock: setgroups: %s\n", strerror(errno));
-@@ -346,6 +375,7 @@ main(int argc, char **argv) {
+@@ -358,6 +392,7 @@ main(int argc, char **argv) {
  		die("slock: setgid: %s\n", strerror(errno));
  	if (setuid(duid) < 0)
  		die("slock: setuid: %s\n", strerror(errno));
@@ -103,9 +127,13 @@ Index: slock.c
  
  	/* check for Xrandr support */
  	rr.active = XRRQueryExtension(dpy, &rr.evbase, &rr.errbase);
-@@ -381,7 +411,11 @@ main(int argc, char **argv) {
+@@ -389,8 +424,15 @@ main(int argc, char **argv) {
+ 		}
  	}
  
++	if (unveil(NULL, NULL) == -1)
++		die("slock: unveil: %s\n", strerror(errno));
++
  	/* everything is now blank. Wait for the correct password */
 +#ifdef HAVE_BSD_AUTH
 +	readpw(dpy, &rr, locks, nscreens);