From: David Uhden Collado Subject: Re: [UPDATE] x11/emwm 1.3 -> 2.1 & x11/emwm-utils 1.3 -> 2.0 To: izder456@disroot.org Cc: ports@openbsd.org Date: Fri, 28 Aug 2026 00:59:00 +0000 izzy Meyer wrote: > Hi, > > I used to maintain these packages. Does the 2.0 version of emwm-utils > fix needing SUID root for lock/unlock & suspend/reboot/poweroff > functionality? I dropped maintainership due to the development burden > of maintaining patches that I couldn't upstream that made it use > bsd-auth instead as the ports tree strips SUID root by default. > > If this update does not fix it, please consider updating my patches to > work in those areas again, as this would be beneficial to users of this > port. > > Thanks. > Hi iz, Thanks for pointing this out. I checked the 2.0 sources more closely, and upstream still expects xmsm to be setuid root for screen authentication and for privileged system operations. So no, upstream 2.0 does not solve this by itself. My first revision of the update did not correctly carry forward all of the existing OpenBSD-specific privilege and BSD Authentication work. I've fixed that in the new patches attached to this mail. The updated emwm-utils patch now refreshes the existing BSD Authentication support for the 2.0 source. On OpenBSD, screen unlocking uses auth_userokay(3) with the auth-xmsm authentication style rather than reading password hashes through getpwnam_shadow(3) and crypt(3). As a result, xmsm does not need to be setuid root. It remains installed setgid auth, as in the existing OpenBSD port, which gives BSD Authentication the access it requires without giving the whole session manager root privileges. I also restored the unprivileged shutdown model. emwm-utils is built with UNPRIVILEGED_SHUTDOWN, so shutdown/reboot/suspend commands execute with the invoking user's privileges rather than temporarily regaining root privileges. The OpenBSD patch uses shutdown(8), matching the _shutdown group authorization mechanism. For suspend, the existing OpenBSD setup using zzz(8), apmd(8), and wheel membership is retained and documented in pkg-readme. I also patched the upstream install rule and xmsm(1) documentation so they no longer describe or install xmsm as setuid root on OpenBSD. The manual page now documents the BSD Authentication/setgid-auth model and the fact that system commands run with the user's privileges. There were a few related cleanup changes as well. The OpenBSD makefile now preserves the ports framework CFLAGS instead of replacing them, and -lcrypt is disabled because crypt(3) is part of libc on OpenBSD and the OpenBSD authentication path no longer uses it directly. The second revision also includes some additional material distributed by the EMWM project: tellmwm for runtime workspace control, the application icon set, the core-hr Xcursor theme, alternative Motif dialog icons, and example X resources and GTK 2/3 configuration. These are installed as data/examples rather than modifying user configuration automatically. For the emwm port itself, I made a smaller follow-up adjustment. I added a pkg-readme explaining that users upgrading from EMWM 1.x may need to update an existing ~/.emwmrc to get the workspace menu and key bindings restored in EMWM 2.x. I also cleaned up the OpenBSD build patch so it preserves the compiler flags supplied by the ports infrastructure. So the new revision should preserve the important security properties of your previous OpenBSD patches while adapting them to the current 2.0 codebase. Thanks for bringing this up; it caught an important omission in my first version of the update. Best regards, David. Index: x11/emwm/Makefile =================================================================== RCS file: /cvs/ports/x11/emwm/Makefile,v diff -u -p -u -p -r1.3 Makefile --- x11/emwm/Makefile 30 Oct 2025 21:34:15 -0000 1.3 +++ x11/emwm/Makefile 28 Aug 2026 00:31:17 -0000 @@ -1,31 +1,48 @@ -COMMENT = enhanced motif window manager (MWM fork) +COMMENT= enhanced motif window manager (MWM fork) -V = 1.3 -DISTNAME = emwm-src-${V} -PKGNAME = emwm-${V} -REVISION = 0 +V= 2.1 +DISTNAME= emwm-src-${V} +PKGNAME= emwm-${V} -CATEGORIES = x11 -HOMEPAGE = https://fastestcode.org/emwm.html +CATEGORIES= x11 +HOMEPAGE= https://fastestcode.org/emwm.html -# LGPL v2.1 -PERMIT_PACKAGE = Yes +SITES= https://fastestcode.org/dl/ +EXTRACT_SUFX= .tar.xz -SITES = https://fastestcode.org/dl/ -EXTRACT_SUFX = .tar.xz +# LGPL v2.1 +PERMIT_PACKAGE= Yes WANTLIB += X11 Xext Xinerama Xm Xrandr Xt c m -LIB_DEPENDS = x11/motif +LIB_DEPENDS= x11/motif -MAKE_FLAGS = RCDIR=${PREFIX}/lib/X11 \ - CFLAGS="${CFLAGS}" +WRKDIST= ${WRKDIR}/emwm-src-${V} -FAKE_FLAGS = PREFIX=${WRKINST}${PREFIX} \ - APPLRESDIR=${WRKINST}${PREFIX}/lib/X11/app-defaults \ - MANDIR=${WRKINST}${PREFIX}/man \ - RCDIR=${WRKINST}${PREFIX}/lib/X11 +MAKE_ENV= CC='${CC}' \ + CFLAGS='${CFLAGS}' \ + LDFLAGS='${LDFLAGS}' + +MAKE_FLAGS= PREFIX='${PREFIX}' \ + MANDIR='${PREFIX}/man' \ + RCDIR='${PREFIX}/lib/X11' \ + APPLRESDIR='${PREFIX}/lib/X11/app-defaults' \ + INCDIRS='-I${X11BASE}/include -I${LOCALBASE}/include' \ + LIBDIRS='-L${X11BASE}/lib -L${LOCALBASE}/lib' + +do-build: + cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \ + ${MAKE_PROGRAM} ${MAKE_FLAGS} OpenBSD + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/src/emwm ${PREFIX}/bin/emwm + ${INSTALL_MAN} ${WRKSRC}/src/emwm.1 ${PREFIX}/man/man1/emwm.1 + ${INSTALL_MAN} ${WRKSRC}/src/emwmrc.4 ${PREFIX}/man/man4/emwmrc.4 + ${INSTALL_DATA} ${WRKSRC}/src/Emwm.ad \ + ${PREFIX}/lib/X11/app-defaults/Emwm + ${INSTALL_DATA} ${WRKSRC}/src/system.emwmrc \ + ${PREFIX}/lib/X11/system.emwmrc -NO_TEST = Yes +NO_TEST= Yes .include Index: x11/emwm/distinfo =================================================================== RCS file: /cvs/ports/x11/emwm/distinfo,v diff -u -p -u -p -r1.2 distinfo --- x11/emwm/distinfo 8 May 2025 14:18:13 -0000 1.2 +++ x11/emwm/distinfo 28 Aug 2026 00:31:17 -0000 @@ -1,2 +1,2 @@ -SHA256 (emwm-src-1.3.tar.xz) = Y58/q4P/a0scnHnKRr9iBIVevoNC7gUqIUiUJVQQuM0= -SIZE (emwm-src-1.3.tar.xz) = 337648 +SHA256 (emwm-src-2.1.tar.xz) = 1EDIKgHP92ZwxLstR6cy4k/+7fh7uM+iMMYgk34K+Es= +SIZE (emwm-src-2.1.tar.xz) = 298340 Index: x11/emwm/patches/patch-mf_Makefile_OpenBSD =================================================================== RCS file: x11/emwm/patches/patch-mf_Makefile_OpenBSD diff -N x11/emwm/patches/patch-mf_Makefile_OpenBSD --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ x11/emwm/patches/patch-mf_Makefile_OpenBSD 28 Aug 2026 00:31:17 -0000 @@ -0,0 +1,19 @@ +Preserve compiler flags supplied by the ports framework. Avoid adding +the platform definitions twice; common.mf already appends them. + +Index: mf/Makefile.OpenBSD +--- mf/Makefile.OpenBSD.orig ++++ mf/Makefile.OpenBSD +@@ -8,10 +8,10 @@ APPLRESDIR = /usr/X11R6/lib/X11/app-defaults + INCDIRS = -I/usr/X11R6/include -I/usr/local/include + LIBDIRS = -L/usr/X11R6/lib -L/usr/local/lib + +-CFLAGS = -O2 -Wall $(INCDIRS) ++CFLAGS += -Wall + + .c.o: +- $(CC) $(CFLAGS) $(DEFINES) $(INCDIRS) -c -o $(@D)/$(@F) $< ++ $(CC) $(CFLAGS) $(INCDIRS) -c -o $(@D)/$(@F) $< + + include common.mf + Index: x11/emwm/pkg/DESCR =================================================================== RCS file: /cvs/ports/x11/emwm/pkg/DESCR,v diff -u -p -u -p -r1.1.1.1 DESCR --- x11/emwm/pkg/DESCR 23 Aug 2024 05:58:19 -0000 1.1.1.1 +++ x11/emwm/pkg/DESCR 28 Aug 2026 00:31:17 -0000 @@ -3,5 +3,5 @@ The idea behind this is to provide compa extensions and applications, without changing the way the window manager looks and behaves. This includes support for multi-monitor setups through Xinerama/Xrandr, UTF-8 support with Xft fonts, and -overall better compatibility with software that requires Extended -Window Manager Hints. +multiple workspaces with configurable backdrops. It also provides better +compatibility with software that requires Extended Window Manager Hints. Index: x11/emwm/pkg/PLIST =================================================================== RCS file: /cvs/ports/x11/emwm/pkg/PLIST,v diff -u -p -u -p -r1.1.1.1 PLIST --- x11/emwm/pkg/PLIST 23 Aug 2024 05:58:19 -0000 1.1.1.1 +++ x11/emwm/pkg/PLIST 28 Aug 2026 00:31:17 -0000 @@ -3,3 +3,4 @@ lib/X11/app-defaults/Emwm lib/X11/system.emwmrc @man man/man1/emwm.1 @man man/man4/emwmrc.4 +share/doc/pkg-readmes/${PKGSTEM} Index: x11/emwm/pkg/README =================================================================== RCS file: x11/emwm/pkg/README diff -N x11/emwm/pkg/README --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ x11/emwm/pkg/README 28 Aug 2026 00:31:17 -0000 @@ -0,0 +1,12 @@ ++------------------------------------------------------------------------------- +| Running ${PKGSTEM} on OpenBSD ++------------------------------------------------------------------------------- + +EMWM 2.x restored workspace management. Configuration files copied from +EMWM 1.x do not contain the corresponding workspace menu and key bindings. + +Users with an existing ~/.emwmrc should compare it with: + + ${PREFIX}/lib/X11/system.emwmrc + +See emwmrc(4) for the available workspace functions and binding syntax. Index: x11/emwm-utils/Makefile =================================================================== RCS file: /cvs/ports/x11/emwm-utils/Makefile,v diff -u -p -u -p -r1.5 Makefile --- x11/emwm-utils/Makefile 30 Oct 2025 21:34:15 -0000 1.5 +++ x11/emwm-utils/Makefile 28 Aug 2026 00:34:06 -0000 @@ -1,32 +1,125 @@ -COMMENT = session manager and a toolchest-like application launcher +COMMENT= utilities for Enhanced Motif Window Manager -V = 1.3 -DISTNAME = emwm-utils-src-${V} -PKGNAME = emwm-utils-${V} -REVISION = 2 +DISTNAME= emwm-utils-src-2.0 +PKGNAME= emwm-utils-2.0 -CATEGORIES = x11 -HOMEPAGE = https://fastestcode.org/emwm.html +CATEGORIES= x11 +HOMEPAGE= https://fastestcode.org/emwm.html -# MIT -PERMIT_PACKAGE = Yes +SITES= https://fastestcode.org/dl/ +SITES.misc= https://fastestcode.org/misc/ + +DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \ + tellmwm-src-20260721{tellmwm-src}.tar.xz \ + app-icons-20250710{app-icons}.tar.xz \ + xc-core-hr-20241226{xc-core-hr}.tar.xz \ + xmdlgicons-20250717{xmdlgicons}.tar.xz \ + gtk-configs.tar.xz +DISTFILES.misc= Xresources-sample +DIST_SUBDIR= emwm-utils +EXTRACT_SUFX= .tar.xz +EXTRACT_ONLY= emwm-utils-src-2.0.tar.xz \ + tellmwm-src-20260721.tar.xz \ + app-icons-20250710.tar.xz \ + xc-core-hr-20241226.tar.xz \ + xmdlgicons-20250717.tar.xz \ + gtk-configs.tar.xz + +# emwm-utils: MIT; tellmwm: permissive; artwork: CC BY-SA 3.0; +# gtk-configs and Xresources-sample: public domain. +PERMIT_PACKAGE= Yes + +WANTLIB += X11 Xinerama Xrandr Xss Xt Xm c + +LIB_DEPENDS= x11/motif +BUILD_DEPENDS= x11/xcursorgen +RUN_DEPENDS= x11/emwm>=2.0 + +WRKDIST= ${WRKDIR}/emwm-utils-src-2.0 + +# run shutdown(8)/zzz(8) with the invoking user's privileges; bsd.port.mk +# also appends its own CFLAGS to MAKE_ENV, so putting the define in MAKE_ENV +# would be overridden +CFLAGS += -DUNPRIVILEGED_SHUTDOWN + +MAKE_ENV= CC='${CC}' \ + LDFLAGS='${LDFLAGS}' + +MAKE_FLAGS= PREFIX='${PREFIX}' \ + MANDIR='${PREFIX}/man' \ + RCDIR='${PREFIX}/lib/X11' \ + APPLRESDIR='${PREFIX}/lib/X11/app-defaults' \ + INCDIRS='-I${X11BASE}/include -I${LOCALBASE}/include' \ + LIBDIRS='-L${X11BASE}/lib -L${LOCALBASE}/lib' + +do-build: + cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} OpenBSD + cd ${WRKDIR}/tellmwm && ${CC} ${CFLAGS} \ + -I${X11BASE}/include -I${LOCALBASE}/include \ + -c tellmwm.c -o tellmwm.o + cd ${WRKDIR}/tellmwm && ${CC} ${CFLAGS} \ + -I${X11BASE}/include -I${LOCALBASE}/include \ + -c wsmutil.c -o wsmutil.o + cd ${WRKDIR}/tellmwm && ${CC} ${LDFLAGS} \ + -L${X11BASE}/lib -L${LOCALBASE}/lib \ + -o tellmwm tellmwm.o wsmutil.o -lX11 + cd ${WRKDIR}/xc-core-hr && ${SETENV} ${MAKE_ENV} \ + /bin/sh ./build.sh core-hr + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/src/xmsession ${PREFIX}/bin/xmsession + ${INSTALL_PROGRAM} ${WRKDIR}/tellmwm/tellmwm ${PREFIX}/bin/tellmwm + ${INSTALL_PROGRAM} ${WRKSRC}/src/xmtoolbox ${PREFIX}/bin/xmtoolbox + ${INSTALL_PROGRAM} ${WRKSRC}/src/xmsm ${PREFIX}/bin/xmsm + ${INSTALL_MAN} ${WRKDIR}/tellmwm/tellmwm.1 \ + ${PREFIX}/man/man1/tellmwm.1 + ${INSTALL_MAN} ${WRKSRC}/src/xmtoolbox.1 ${PREFIX}/man/man1/xmtoolbox.1 + ${INSTALL_MAN} ${WRKSRC}/src/xmsm.1 ${PREFIX}/man/man1/xmsm.1 + ${INSTALL_DATA} ${WRKSRC}/src/XmSm.ad \ + ${PREFIX}/lib/X11/app-defaults/XmSm + ${INSTALL_DATA} ${WRKSRC}/src/XmToolbox.ad \ + ${PREFIX}/lib/X11/app-defaults/XmToolbox + ${INSTALL_DATA} ${WRKSRC}/src/toolboxrc ${PREFIX}/lib/X11/toolboxrc + ${INSTALL_DATA_DIR} ${PREFIX}/share/emwm/icons + ${INSTALL_DATA} ${WRKDIR}/icons/*.xpm ${PREFIX}/share/emwm/icons/ + ${INSTALL_DATA_DIR} ${PREFIX}/share/icons/core-hr/cursors + for f in ${WRKDIR}/xc-core-hr/core-hr/cursors/*; do \ + if test -L $$f; then \ + ln -s $$(readlink $$f) \ + ${PREFIX}/share/icons/core-hr/cursors/$${f##*/}; \ + else \ + ${INSTALL_DATA} $$f \ + ${PREFIX}/share/icons/core-hr/cursors/; \ + fi; \ + done + ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/emwm/xmdlgicons/32px + ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/emwm/xmdlgicons/48px + ${INSTALL_DATA} ${WRKDIR}/dlgicons/32px/* \ + ${PREFIX}/share/examples/emwm/xmdlgicons/32px/ + ${INSTALL_DATA} ${WRKDIR}/dlgicons/48px/* \ + ${PREFIX}/share/examples/emwm/xmdlgicons/48px/ + ${INSTALL_DATA} ${WRKDIR}/dlgicons/README \ + ${PREFIX}/share/examples/emwm/xmdlgicons/ + ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/emwm/gtk-2.0 + ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/emwm/gtk-3.0 + ${INSTALL_DATA} ${WRKDIR}/gtk-configs/gtkrc-2.0 \ + ${PREFIX}/share/examples/emwm/gtk-2.0/ + ${INSTALL_DATA} ${WRKDIR}/gtk-configs/gtk.css \ + ${PREFIX}/share/examples/emwm/gtk-3.0/ + ${INSTALL_DATA} ${FULLDISTDIR}/Xresources-sample \ + ${PREFIX}/share/examples/emwm/Xresources + ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/emwm-utils + ${INSTALL_DATA} ${WRKDIR}/tellmwm/COPYING \ + ${PREFIX}/share/doc/emwm-utils/COPYING.tellmwm + ${INSTALL_DATA} ${WRKDIR}/tellmwm/README \ + ${PREFIX}/share/doc/emwm-utils/README.tellmwm + ${INSTALL_DATA} ${WRKDIR}/icons/COPYING \ + ${PREFIX}/share/doc/emwm-utils/COPYING.app-icons + ${INSTALL_DATA} ${WRKDIR}/xc-core-hr/COPYING \ + ${PREFIX}/share/doc/emwm-utils/COPYING.xc-core-hr + ${INSTALL_DATA} ${WRKDIR}/xc-core-hr/README \ + ${PREFIX}/share/doc/emwm-utils/README.xc-core-hr -SITES = https://fastestcode.org/dl/ -EXTRACT_SUFX = .tar.xz - -WANTLIB += X11 Xinerama Xm Xrandr Xss Xt c - -LIB_DEPENDS = x11/motif - -MAKE_FLAGS = RCDIR=${PREFIX}/lib/X11 \ - CFLAGS="${CFLAGS} -DUNPRIVILEGED_SHUTDOWN \ - -I./Xm -I${X11BASE}/include -I${LOCALBASE}/include" - -FAKE_FLAGS = PREFIX=${WRKINST}${PREFIX} \ - APPLRESDIR=${WRKINST}${PREFIX}/lib/X11/app-defaults \ - MANDIR=${WRKINST}${PREFIX}/man \ - RCDIR=${WRKINST}${PREFIX}/lib/X11 - -NO_TEST = Yes +NO_TEST= Yes .include Index: x11/emwm-utils/distinfo =================================================================== RCS file: /cvs/ports/x11/emwm-utils/distinfo,v diff -u -p -u -p -r1.2 distinfo --- x11/emwm-utils/distinfo 8 May 2025 14:19:24 -0000 1.2 +++ x11/emwm-utils/distinfo 28 Aug 2026 00:34:06 -0000 @@ -1,2 +1,14 @@ -SHA256 (emwm-utils-src-1.3.tar.xz) = 4TXV1ZZug/1h6JADiGdczeYtQiMBLMaDO8ouXjchoKo= -SIZE (emwm-utils-src-1.3.tar.xz) = 28144 +SHA256 (emwm-utils/Xresources-sample) = SBQ6n+zWgIa2Yy4fq6nDcDWO/cmbjrvKRQN8FqqZk28= +SHA256 (emwm-utils/app-icons-20250710.tar.xz) = b1uLErJddLIbEM5ucT1YqjDOuQkbXoDJo+9TiF6Z4o0= +SHA256 (emwm-utils/emwm-utils-src-2.0.tar.xz) = FwA0yLQb9If6PgiXmIzUjzZrqOvzCJN+1Enfhbm/B14= +SHA256 (emwm-utils/gtk-configs.tar.xz) = mOAMvwAZktu8s5gie3t+pDZcmJ58p3TZZFO6c/rAqJM= +SHA256 (emwm-utils/tellmwm-src-20260721.tar.xz) = 0TIzqcrxcIyH8uGEENP5aa8t3ZcHJ6OgUsXhqNrwWu4= +SHA256 (emwm-utils/xc-core-hr-20241226.tar.xz) = 4MM0Iqcm1/w5ih++KIRpzCW2x01ifaXQTLE0u2QS0jU= +SHA256 (emwm-utils/xmdlgicons-20250717.tar.xz) = aRQP3xMc8OXPf2ZD4b8nVwjDTRAkeODJd1lxxqpq5AQ= +SIZE (emwm-utils/Xresources-sample) = 3775 +SIZE (emwm-utils/app-icons-20250710.tar.xz) = 7400 +SIZE (emwm-utils/emwm-utils-src-2.0.tar.xz) = 34840 +SIZE (emwm-utils/gtk-configs.tar.xz) = 1828 +SIZE (emwm-utils/tellmwm-src-20260721.tar.xz) = 5824 +SIZE (emwm-utils/xc-core-hr-20241226.tar.xz) = 11368 +SIZE (emwm-utils/xmdlgicons-20250717.tar.xz) = 2292 Index: x11/emwm-utils/patches/patch-mf_Makefile_OpenBSD =================================================================== RCS file: x11/emwm-utils/patches/patch-mf_Makefile_OpenBSD diff -N x11/emwm-utils/patches/patch-mf_Makefile_OpenBSD --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ x11/emwm-utils/patches/patch-mf_Makefile_OpenBSD 28 Aug 2026 00:34:06 -0000 @@ -0,0 +1,30 @@ +Honor variables supplied by the ports framework and append to its +CFLAGS. Clear SYSLIBS because OpenBSD provides crypt(3) in libc, while +xmsm uses BSD Authentication instead of crypt(3) to unlock the screen. + +Index: mf/Makefile.OpenBSD +--- mf/Makefile.OpenBSD.orig ++++ mf/Makefile.OpenBSD +@@ -1,14 +1,15 @@ + # OpenBSD Makefile + +-PREFIX = /usr/local +-MANDIR = /usr/local/man +-RCDIR = /usr/X11R6/lib/X11 +-APPLRESDIR = /usr/X11R6/lib/X11/app-defaults ++PREFIX ?= ${PREFIX} ++MANDIR ?= ${PREFIX}/man ++RCDIR ?= ${PREFIX}/lib/X11 ++APPLRESDIR ?= ${PREFIX}/lib/X11/app-defaults + +-INCDIRS = -I./Xm -I/usr/X11R6/include -I/usr/local/include +-LIBDIRS = -L/usr/X11R6/lib -L/usr/local/lib ++INCDIRS += -I./Xm -I${X11BASE}/include -I${LOCALBASE}/include ++LIBDIRS += -L${X11BASE}/lib -L${LOCALBASE}/lib ++SYSLIBS = + +-CFLAGS = -O2 -Wall $(INCDIRS) ++CFLAGS += -Wall $(INCDIRS) + + include common.mf + Index: x11/emwm-utils/patches/patch-src_common_mf =================================================================== RCS file: x11/emwm-utils/patches/patch-src_common_mf diff -N x11/emwm-utils/patches/patch-src_common_mf --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ x11/emwm-utils/patches/patch-src_common_mf 28 Aug 2026 00:34:06 -0000 @@ -0,0 +1,15 @@ +Keep the unused upstream install target consistent with this port's +non-setuid privilege model. The package list later applies setgid auth. + +Index: src/common.mf +--- src/common.mf.orig ++++ src/common.mf +@@ -35,7 +35,7 @@ XmToolbox.ad: XmToolbox.ad.src + common_install: + install -m755 xmsession $(PREFIX)/bin/xmsession + install -m755 xmtoolbox $(PREFIX)/bin/xmtoolbox +- install -m4755 xmsm $(PREFIX)/bin/xmsm ++ install -m755 xmsm $(PREFIX)/bin/xmsm + install -m755 -d $(MANDIR)/man1 + install -m644 xmtoolbox.1 $(MANDIR)/man1/xmtoolbox.1 + install -m644 xmsm.1 $(MANDIR)/man1/xmsm.1 Index: x11/emwm-utils/patches/patch-src_smconf_h =================================================================== RCS file: /cvs/ports/x11/emwm-utils/patches/patch-src_smconf_h,v diff -u -p -u -p -r1.1 patch-src_smconf_h --- x11/emwm-utils/patches/patch-src_smconf_h 14 May 2025 08:01:57 -0000 1.1 +++ x11/emwm-utils/patches/patch-src_smconf_h 28 Aug 2026 00:34:06 -0000 @@ -1,3 +1,6 @@ +Use shutdown(8) rather than reboot(8), matching OpenBSD's _shutdown +group authorization path when xmsm runs without elevated privileges. + Index: src/smconf.h --- src/smconf.h.orig +++ src/smconf.h Index: x11/emwm-utils/patches/patch-src_smmain_c =================================================================== RCS file: /cvs/ports/x11/emwm-utils/patches/patch-src_smmain_c,v diff -u -p -u -p -r1.3 patch-src_smmain_c --- x11/emwm-utils/patches/patch-src_smmain_c 24 May 2025 05:54:57 -0000 1.3 +++ x11/emwm-utils/patches/patch-src_smmain_c 28 Aug 2026 00:34:06 -0000 @@ -1,4 +1,10 @@ -# For bsd-auth support +Use BSD Authentication for screen unlocking on OpenBSD. This avoids +reading password hashes with getpwnam_shadow(3) and crypt(3), so xmsm +does not need setuid-root privileges. The package installs xmsm setgid +auth so auth_userokay(3) can use the auth-xmsm authentication style. + +Keep upstream authentication and privilege handling unchanged for other +operating systems. Index: src/smmain.c --- src/smmain.c.orig @@ -13,7 +19,17 @@ Index: src/smmain.c #endif #include "smglobal.h" #include "smconf.h" -@@ -419,6 +422,11 @@ static void lock_screen(void) +@@ -417,7 +420,9 @@ static void lock_screen(void) + { + Boolean can_auth = False; + char *login; ++#ifndef __OpenBSD__ + struct passwd *passwd; ++#endif + + if(scr_locked) return; + +@@ -429,6 +434,11 @@ static void lock_screen(void) app_res.enable_locking = False; return; } @@ -25,35 +41,46 @@ Index: src/smmain.c if(set_privileges(True)) { -@@ -441,7 +449,8 @@ static void lock_screen(void) +@@ -451,6 +461,7 @@ static void lock_screen(void) set_privileges(False); } -- +#endif /* __OpenBSD__ */ -+ + if(!can_auth){ if(!app_res.silent) XBell(XtDisplay(wshell), 100); - log_msg("Cannot authenticate. Screen locking disabled!\n"); -@@ -861,6 +870,17 @@ static void passwd_enter_cb(Widget w, +@@ -873,13 +884,30 @@ static int local_x_err_handler(Display *dpy, XErrorEve + static void passwd_enter_cb(Widget w, + XtPointer client_data, XtPointer call_data) + { ++#ifdef __OpenBSD__ ++ int auth_result; ++#else + struct passwd *passwd; ++#endif + char *login; + char *pwb = (char*)client_data; ++#ifndef __OpenBSD__ + char *cpw = NULL; char *upw = NULL; ++#endif login = get_login(); + +#ifdef __OpenBSD__ -+ int auth_result = auth_userokay(login, NULL, "auth-xmsm", pwb); ++ auth_result = auth_userokay(login, NULL, "auth-xmsm", pwb); + if (auth_result) { -+ unlock_screen(); -+ set_unlock_message(NULL); ++ unlock_screen(); ++ set_unlock_message(NULL); + } else { -+ if(!app_res.silent) XBell(XtDisplay(w), 100); -+ set_unlock_message(MSG_NOACCESS); ++ if(!app_res.silent) XBell(XtDisplay(w), 100); ++ set_unlock_message(MSG_NOACCESS); + } +#else set_privileges(True); -@@ -896,6 +916,7 @@ static void passwd_enter_cb(Widget w, +@@ -915,6 +943,7 @@ static void passwd_enter_cb(Widget w, if(!app_res.silent) XBell(XtDisplay(w),100); set_unlock_message(MSG_NOACCESS); } @@ -61,7 +88,7 @@ Index: src/smmain.c memset(pwb,0,strlen(pwb)); XmTextFieldSetString(wpasswd,""); -@@ -990,8 +1011,12 @@ static Boolean set_privileges(Boolean elevate) +@@ -1009,8 +1038,12 @@ static Boolean set_privileges(Boolean elevate) orig_gid = getegid(); if(orig_uid != 0){ Index: x11/emwm-utils/patches/patch-src_xmsm_1 =================================================================== RCS file: x11/emwm-utils/patches/patch-src_xmsm_1 diff -N x11/emwm-utils/patches/patch-src_xmsm_1 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ x11/emwm-utils/patches/patch-src_xmsm_1 28 Aug 2026 00:34:06 -0000 @@ -0,0 +1,20 @@ +Replace upstream's setuid-root requirement with the privilege model used +by this port: BSD Authentication through group auth, and system commands +run as the invoking user. + +Index: src/xmsm.1 +--- src/xmsm.1.orig ++++ src/xmsm.1 +@@ -133,9 +133,9 @@ and black bits in a darker shade of that color. + xmsm responds to SIGUSR1 by engaging screen lock. + xmsm responds to SIGUSR2 by displaying logout/shutdown options. + .SH CAVEATS +-The xmsm binary must be setuid root for screen locking and shutdown/reboot +-functionality, it discards root privileges at startup and restores them only +-during password check and when executing system commands. ++On OpenBSD, xmsm uses BSD Authentication when unlocking the screen and is ++installed setgid auth; it does not need to be setuid root. Shutdown, reboot, ++and suspend commands are executed with the invoking user's privileges. + .PP + XmSm does not implement the ICCCM session save/restore protocol. + .PP Index: x11/emwm-utils/pkg/DESCR =================================================================== RCS file: /cvs/ports/x11/emwm-utils/pkg/DESCR,v diff -u -p -u -p -r1.1.1.1 DESCR --- x11/emwm-utils/pkg/DESCR 23 Aug 2024 06:03:38 -0000 1.1.1.1 +++ x11/emwm-utils/pkg/DESCR 28 Aug 2026 00:34:06 -0000 @@ -1,10 +1,14 @@ -xmsm is simple session manager that provides session configuration -and screen locking and also launches the window manager and the -toolbox. +Utilities for the Enhanced Motif Window Manager (EMWM): -xmtoolbox is an application launcher/menu configured with a simple -text file. It also communicates with the session manager to provide -lock, log out, and shutdown commands. +- xmtoolbox: An application launcher/menu configured with a simple text + file (~/.toolboxrc). Can optionally include a workspace switcher widget. -An example toolbox configuration file can be copied from -${PREFIX}/lib/X11/toolboxrc. +- xmsm: Simple session manager that provides session configuration, + screen locking, logout and shutdown/suspend options. + +- xmsession: Session script for launching EMWM with xmsm from XDM or xinit. + +- tellmwm: Command-line control of EMWM workspace configuration at runtime. + +The package also provides application icons, a 24/32-pixel Xcursor theme, +Motif dialog icons, and sample X resources and GTK 2/3 configuration. Index: x11/emwm-utils/pkg/PLIST =================================================================== RCS file: /cvs/ports/x11/emwm-utils/pkg/PLIST,v diff -u -p -u -p -r1.3 PLIST --- x11/emwm-utils/pkg/PLIST 14 May 2025 08:01:57 -0000 1.3 +++ x11/emwm-utils/pkg/PLIST 28 Aug 2026 00:34:07 -0000 @@ -1,3 +1,4 @@ +@bin bin/tellmwm bin/xmsession @mode g+s @group auth @@ -8,6 +9,123 @@ bin/xmsession lib/X11/app-defaults/XmSm lib/X11/app-defaults/XmToolbox lib/X11/toolboxrc +@man man/man1/tellmwm.1 @man man/man1/xmsm.1 @man man/man1/xmtoolbox.1 +share/doc/emwm-utils/ +share/doc/emwm-utils/COPYING.app-icons +share/doc/emwm-utils/COPYING.tellmwm +share/doc/emwm-utils/COPYING.xc-core-hr +share/doc/emwm-utils/README.tellmwm +share/doc/emwm-utils/README.xc-core-hr share/doc/pkg-readmes/${PKGSTEM} +share/emwm/ +share/emwm/icons/ +share/emwm/icons/base.xpm +share/emwm/icons/calc.xpm +share/emwm/icons/cdrtool.xpm +share/emwm/icons/draw.xpm +share/emwm/icons/emwm.xpm +share/emwm/icons/emwm2.xpm +share/emwm/icons/hardware.xpm +share/emwm/icons/java.xpm +share/emwm/icons/mailbox.xpm +share/emwm/icons/mplayer.xpm +share/emwm/icons/navigator.xpm +share/emwm/icons/ofwp.xpm +share/emwm/icons/osview.xpm +share/emwm/icons/pdftool.xpm +share/emwm/icons/pickrgb.xpm +share/emwm/icons/python.xpm +share/emwm/icons/qemu.xpm +share/emwm/icons/rdesktop.xpm +share/emwm/icons/sndmix.xpm +share/emwm/icons/strmedia.xpm +share/emwm/icons/stylus.xpm +share/emwm/icons/terminal.xpm +share/emwm/icons/textedit.xpm +share/emwm/icons/viewer.xpm +share/emwm/icons/workstation.xpm +share/examples/emwm/ +share/examples/emwm/Xresources +share/examples/emwm/gtk-2.0/ +share/examples/emwm/gtk-2.0/gtkrc-2.0 +share/examples/emwm/gtk-3.0/ +share/examples/emwm/gtk-3.0/gtk.css +share/examples/emwm/xmdlgicons/ +share/examples/emwm/xmdlgicons/32px/ +share/examples/emwm/xmdlgicons/32px/xm_error +share/examples/emwm/xmdlgicons/32px/xm_information +share/examples/emwm/xmdlgicons/32px/xm_question +share/examples/emwm/xmdlgicons/32px/xm_warning +share/examples/emwm/xmdlgicons/32px/xm_working +share/examples/emwm/xmdlgicons/48px/ +share/examples/emwm/xmdlgicons/48px/xm_error +share/examples/emwm/xmdlgicons/48px/xm_information +share/examples/emwm/xmdlgicons/48px/xm_question +share/examples/emwm/xmdlgicons/48px/xm_warning +share/examples/emwm/xmdlgicons/48px/xm_working +share/examples/emwm/xmdlgicons/README +share/icons/ +share/icons/core-hr/ +share/icons/core-hr/cursors/ +share/icons/core-hr/cursors/00000000000000020006000e7e9ffc3f +share/icons/core-hr/cursors/08e8e1c95fe2fc01f976f1e063a24ccd +share/icons/core-hr/cursors/1081e37283d90000800003c07f3ef6bf +share/icons/core-hr/cursors/3085a0e285430894940527032f8b26df +share/icons/core-hr/cursors/3ecb610c1bf2410f44200f48c40d3599 +share/icons/core-hr/cursors/4498f0e0c1937ffe01fd06f973665830 +share/icons/core-hr/cursors/5c6cd98b3f3ebcb1f9c7f1c204630408 +share/icons/core-hr/cursors/9081237383d90e509aa00f00170e968f +share/icons/core-hr/cursors/9d800788f1b08800ae810202380a0822 +share/icons/core-hr/cursors/arrow +share/icons/core-hr/cursors/based_arrow_down +share/icons/core-hr/cursors/based_arrow_up +share/icons/core-hr/cursors/bottom_left_corner +share/icons/core-hr/cursors/bottom_right_corner +share/icons/core-hr/cursors/bottom_side +share/icons/core-hr/cursors/center_ptr +share/icons/core-hr/cursors/closedhand +share/icons/core-hr/cursors/cross +share/icons/core-hr/cursors/crosshair +share/icons/core-hr/cursors/d9ce0ab605698f320427677b458ad60b +share/icons/core-hr/cursors/dnd-move +share/icons/core-hr/cursors/dnd-none +share/icons/core-hr/cursors/dotbox +share/icons/core-hr/cursors/double_arrow +share/icons/core-hr/cursors/draft_large +share/icons/core-hr/cursors/draft_small +share/icons/core-hr/cursors/e29285e634086352946a0e7090d73106 +share/icons/core-hr/cursors/fcf21c00b30f7e3f83fe0dfd12e71cff +share/icons/core-hr/cursors/fleur +share/icons/core-hr/cursors/half-busy +share/icons/core-hr/cursors/hand1 +share/icons/core-hr/cursors/hand2 +share/icons/core-hr/cursors/hand3 +share/icons/core-hr/cursors/help +share/icons/core-hr/cursors/ibeam +share/icons/core-hr/cursors/left_ptr +share/icons/core-hr/cursors/left_ptr_watch +share/icons/core-hr/cursors/left_side +share/icons/core-hr/cursors/move +share/icons/core-hr/cursors/openhand +share/icons/core-hr/cursors/pencil +share/icons/core-hr/cursors/pointer +share/icons/core-hr/cursors/progress +share/icons/core-hr/cursors/question_arrow +share/icons/core-hr/cursors/right_side +share/icons/core-hr/cursors/sb_down_arrow +share/icons/core-hr/cursors/sb_h_double_arrow +share/icons/core-hr/cursors/sb_left_arrow +share/icons/core-hr/cursors/sb_right_arrow +share/icons/core-hr/cursors/sb_up_arrow +share/icons/core-hr/cursors/sb_v_double_arrow +share/icons/core-hr/cursors/target +share/icons/core-hr/cursors/tcross +share/icons/core-hr/cursors/top_left_arrow +share/icons/core-hr/cursors/top_left_corner +share/icons/core-hr/cursors/top_right_corner +share/icons/core-hr/cursors/top_side +share/icons/core-hr/cursors/wait +share/icons/core-hr/cursors/watch +share/icons/core-hr/cursors/xterm Index: x11/emwm-utils/pkg/README =================================================================== RCS file: /cvs/ports/x11/emwm-utils/pkg/README,v diff -u -p -u -p -r1.1 README --- x11/emwm-utils/pkg/README 14 May 2025 08:01:57 -0000 1.1 +++ x11/emwm-utils/pkg/README 28 Aug 2026 00:34:07 -0000 @@ -2,6 +2,9 @@ | Running ${PKGSTEM} on OpenBSD +------------------------------------------------------------------------------- +xmsm uses BSD Authentication for screen unlocking. It is installed setgid +auth and does not need to be setuid root. + To enable shutdown and reboot, the user should be in _shutdown group: # usermod -G _shutdown @@ -13,3 +16,48 @@ must be running: # rcctl enable apmd # rcctl start apmd # usermod -G wheel + +Additional resources +==================== + +Generic 48x48 application icons are installed in: + + ${TRUEPREFIX}/share/emwm/icons + +Applications can refer to an icon by its complete path, for example with +the emwm(1) iconImage resource. + +The core-hr Xcursor theme provides both 24 and 32 pixel cursors. Select it +with X resources such as: + + Xcursor.theme: core-hr + Xcursor.size: 24 + +Use 32 instead of 24 for the larger variant. + +Alternative 32 and 48 pixel Motif dialog icons are installed as examples +under: + + ${TRUEPREFIX}/share/examples/emwm/xmdlgicons + +Select the desired size through XBMLANGPATH. Its value should include a +path such as: + + ${TRUEPREFIX}/share/examples/emwm/xmdlgicons/32px/%B + +Do not copy these files over the dialog icons installed by x11/motif. + +Sample GTK 2 and GTK 3 configurations are installed under: + + ${TRUEPREFIX}/share/examples/emwm/gtk-2.0 + ${TRUEPREFIX}/share/examples/emwm/gtk-3.0 + +Copy or merge them into the corresponding per-user GTK configuration only +if desired. The package does not modify files in users' home directories. + +An X resources example is installed as: + + ${TRUEPREFIX}/share/examples/emwm/Xresources + +Merge it manually into the desired X resources file. The package neither +changes ~/.Xresources or ~/.Xdefaults nor runs xrdb(1).