Hello, Stuart and Lucas pushed me to switch x11/emwm-utils to use
authenticate(3) instead of SUID root in [1].

Well, this diff attached does this. I could not figure out how to get
the shutdown and reboot stuff sorted. My user is in _shutdown and I
tried setting REBOOT_CMD acccordingly, but to no avail. I'll need to
refine the reboot/shutdown/suspend later. Now, locking works properly
without SUID root. This diff is a combined update of both x11/emwm and
x11/emwm-utils, hopefully that's alright?

Tested on OpenBSD 7.7-current/amd64 and 7.7-current/arm64

Thanks. Do people have critiques/feedback?

Below is a changelog of the 1.2->1.3 changes that this diff also
provides.

On Sun, 27 Apr 2025 19:27:52 -0500
izder456 <izder...@disroot.org> wrote:

> On Sat, 19 Apr 2025 18:14:58 -0500
> izzy Meyer <izder...@disroot.org> wrote:
> 
> > On Wed, 2 Apr 2025 15:06:19 -0500
> > izzy Meyer <izder...@disroot.org> wrote:
> > 
> > > Hello ports@
> > > 
> > > This is a trivial update of 1.2 to 1.3 for the x11/emwm and
> > > x11/emwm-utils ports to 1.3.
> > > 
> > > Notable changes in the latest release (1.3):
> > > 
> > >     The Super key is now recognized as a modifier in emwmrc.
> > >     quit_wm and restart are no longer grayed out in menus non-root
> > >     window contexts. Fixed issues (popup menu and window
> > > placement) with multi-row xinerama setups. Additional
> > > configuration options in xmtoolbox/session. XmToolbox now adjusts
> > > Session menu contents according to XmSm configuration.
> > > 
> > > Changelog for x11/emwm 1.3:
> > > 
> > > Mar 04, 2025 - v1.3
> > >   - The "Super" key is now recognized as a modifier in emwmrc.
> > >   - quit_wm and restart are no longer grayed out in menus in
> > >     non-root window contexts.
> > >   - Fixed issues (popup menu and window placement) with multi-row
> > >     xinerama setups.
> > > 
> > > Changelog for x11/emwm-utils 1.3:
> > > 
> > > Mar 04, 2025 - v1.3
> > >   - Minor fixes
> > > 
> > > Both diffs are attached. 
> > > 
> > > Good to merge for 7.7?
> > > 
> > > Thanks!
> > > 

[1] https://marc.info/?l=openbsd-ports&m=174070733226556&w=2

-- 
iz (she/her)

> i like to say mundane things,
> there are too many uninteresting things
> that go unnoticed.

izder456 (dot) neocities (dot) org
diff --git a/x11/emwm-utils/Makefile b/x11/emwm-utils/Makefile
index bf5f0408873..0d8b6ba9f61 100644
--- a/x11/emwm-utils/Makefile
+++ b/x11/emwm-utils/Makefile
@@ -1,6 +1,6 @@
 COMMENT =	session manager and a toolchest-like application launcher
 
-V =		1.2
+V =		1.3
 DISTNAME =	emwm-utils-src-${V}
 PKGNAME =	emwm-utils-${V}
 
diff --git a/x11/emwm-utils/distinfo b/x11/emwm-utils/distinfo
index b5d2b75bf98..6aa1d5d124c 100644
--- a/x11/emwm-utils/distinfo
+++ b/x11/emwm-utils/distinfo
@@ -1,2 +1,2 @@
-SHA256 (emwm-utils-src-1.2.tar.xz) = sxJ2ra6x1qijkyqXH+Y5IkJwY5mTnp+dQEu81nxBXdM=
-SIZE (emwm-utils-src-1.2.tar.xz) = 28072
+SHA256 (emwm-utils-src-1.3.tar.xz) = 4TXV1ZZug/1h6JADiGdczeYtQiMBLMaDO8ouXjchoKo=
+SIZE (emwm-utils-src-1.3.tar.xz) = 28144
diff --git a/x11/emwm-utils/patches/patch-src_smmain_c b/x11/emwm-utils/patches/patch-src_smmain_c
new file mode 100644
index 00000000000..93b4326b219
--- /dev/null
+++ b/x11/emwm-utils/patches/patch-src_smmain_c
@@ -0,0 +1,63 @@
+# For bsd-auth support
+
+Index: src/smmain.c
+--- src/smmain.c.orig
++++ src/smmain.c
+@@ -60,6 +60,9 @@
+ #if defined(__linux__) || defined(__svr4__)
+ #include <crypt.h>
+ #include <shadow.h>
++#elif defined(__OpenBSD__)
++#include <bsd_auth.h>
++#include <login_cap.h>
+ #endif
+ #include "smglobal.h"
+ #include "smconf.h"
+@@ -419,6 +422,11 @@ static void lock_screen(void)
+ 		app_res.enable_locking = False;
+ 		return;
+ 	}
++
++#ifdef __OpenBSD__
++	/* BSD-auth handles authentication, no password hash check needed */
++	can_auth = True;
++#else
+ 	
+ 	if(set_privileges(True)) {
+ 
+@@ -441,7 +449,8 @@ 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,
+ 	char *upw = NULL;
+ 	
+ 	login = get_login();
++
++#ifdef __OpenBSD__
++	int auth_result = auth_userokay(login, NULL, "auth-xmsm", pwb);
++	if (auth_result) {
++         	unlock_screen();
++         	set_unlock_message(NULL);
++	} else {
++         	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,
+ 		if(!app_res.silent) XBell(XtDisplay(w),100);
+ 		set_unlock_message(MSG_NOACCESS);
+ 	}
++#endif /* __OpenBSD__ */
+ 
+ 	memset(pwb,0,strlen(pwb));
+ 	XmTextFieldSetString(wpasswd,"");
diff --git a/x11/emwm-utils/pkg/PLIST b/x11/emwm-utils/pkg/PLIST
index 1c80f2cc3a2..25d49ba2de9 100644
--- a/x11/emwm-utils/pkg/PLIST
+++ b/x11/emwm-utils/pkg/PLIST
@@ -1,5 +1,9 @@
 bin/xmsession
+@mode g+s
+@group auth
 @bin bin/xmsm
+@group
+@mode
 @bin bin/xmtoolbox
 lib/X11/app-defaults/XmSm
 lib/X11/app-defaults/XmToolbox
diff --git a/x11/emwm/Makefile b/x11/emwm/Makefile
index 14467d00969..505b63946ba 100644
--- a/x11/emwm/Makefile
+++ b/x11/emwm/Makefile
@@ -1,6 +1,6 @@
 COMMENT =	enhanced motif window manager (MWM fork)
 
-V =		1.2
+V =		1.3
 DISTNAME =	emwm-src-${V}
 PKGNAME =	emwm-${V}
 
diff --git a/x11/emwm/distinfo b/x11/emwm/distinfo
index e1d2767ed36..df51c381fcc 100644
--- a/x11/emwm/distinfo
+++ b/x11/emwm/distinfo
@@ -1,2 +1,2 @@
-SHA256 (emwm-src-1.2.tar.xz) = 7sS4djMDbNHLStVYrCNFSn95+4q/5YafZW/JiTA6zZE=
-SIZE (emwm-src-1.2.tar.xz) = 337148
+SHA256 (emwm-src-1.3.tar.xz) = Y58/q4P/a0scnHnKRr9iBIVevoNC7gUqIUiUJVQQuM0=
+SIZE (emwm-src-1.3.tar.xz) = 337648

Reply via email to