Thursday, May 22, 2025

MAINTAINER REGRESSION FIX: x11/emwm-utils

diff --git a/Makefile b/Makefile
index 6a5e5822b36..127fceca498 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ COMMENT = session manager and a toolchest-like application launcher
V = 1.3
DISTNAME = emwm-utils-src-${V}
PKGNAME = emwm-utils-${V}
-REVISION = 0
+REVISION = 1

CATEGORIES = x11
HOMEPAGE = https://fastestcode.org/emwm.html
diff --git a/patches/patch-src_smmain_c b/patches/patch-src_smmain_c
index cf6ad7122bf..32ca62c615b 100644
--- a/patches/patch-src_smmain_c
+++ b/patches/patch-src_smmain_c
@@ -61,21 +61,18 @@ Index: src/smmain.c

memset(pwb,0,strlen(pwb));
XmTextFieldSetString(wpasswd,"");
-@@ -988,7 +1009,8 @@ static Boolean set_privileges(Boolean elevate)
+@@ -988,10 +1009,13 @@ static Boolean set_privileges(Boolean elevate)
if(!initialized){
orig_uid = geteuid();
orig_gid = getegid();
-
-+ /* BSD-auth handles authentication, no SUID needed. */
-+#ifndef __OpenBSD__
if(orig_uid != 0){
++ /* BSD-auth handles authentication, no SUID needed. */
++#ifndef __OpenBSD__
log_msg("%s must be setuid root to enable "
"screen locking capabilities.\n",bin_name);
-@@ -996,6 +1018,7 @@ static Boolean set_privileges(Boolean elevate)
++#endif /* __OpenBSD__ */
++
+ initialized = True;
can_elevate = False;
return False;
- }
-+#endif /* __OpenBSD__ */
- initialized = True;
- can_elevate = True;
- }
diff --git a/patches/patch-src_smmain_c.orig b/patches/patch-src_smmain_c.orig
new file mode 100644
index 00000000000..cf6ad7122bf
--- /dev/null
+++ b/patches/patch-src_smmain_c.orig
@@ -0,0 +1,81 @@
+# 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,"");
+@@ -988,7 +1009,8 @@ static Boolean set_privileges(Boolean elevate)
+ if(!initialized){
+ orig_uid = geteuid();
+ orig_gid = getegid();
+-
++ /* BSD-auth handles authentication, no SUID needed. */
++#ifndef __OpenBSD__
+ if(orig_uid != 0){
+ log_msg("%s must be setuid root to enable "
+ "screen locking capabilities.\n",bin_name);
+@@ -996,6 +1018,7 @@ static Boolean set_privileges(Boolean elevate)
+ can_elevate = False;
+ return False;
+ }
++#endif /* __OpenBSD__ */
+ initialized = True;
+ can_elevate = True;
+ }
Hello ports@,

In a previous mail, I was asked to suppress a warning about xmsm lacking
suid root. [1]

I patched too much in my #ifndef/

No comments:

Post a Comment