Jeremie Courreges-Anglas <[email protected]> writes: > On Wed, Nov 04, 2026 at 09:18:47PM +0100, Caspar Schutijser wrote: > [...] >> Thanks, I have committed those two changes. New, shorter diff at >> the bottom. > > Seems to work properly here. Here's a review.
Thanks for this review. >> Index: Makefile >> =================================================================== >> RCS file: /cvs/ports/x11/xscreensaver/Makefile,v >> diff -u -p -r1.127 Makefile >> --- Makefile 4 Nov 2026 19:56:11 -0000 1.127 >> +++ Makefile 4 Nov 2026 20:04:57 -0000 >> @@ -9,7 +9,7 @@ COMMENT= screen saver and locker for the >> # Ideally this wants a bsdauth driver to be written, change to being >> # installed setgid auth, and figure out any issues resulting. > > You ought to remove this comment since you're implementing bsd auth > support. :) > >> DISTNAME= xscreensaver-6.15 >> -REVISION= 3 >> +REVISION= 4 >> >> CATEGORIES= x11 >> > > [...] > >> Index: patches/patch-driver_passwd-bsdauth_c >> =================================================================== >> RCS file: patches/patch-driver_passwd-bsdauth_c >> diff -N patches/patch-driver_passwd-bsdauth_c >> --- /dev/null 1 Jan 1970 00:00:00 -0000 >> +++ patches/patch-driver_passwd-bsdauth_c 4 Nov 2026 20:04:57 -0000 >> @@ -0,0 +1,73 @@ >> +Index: driver/passwd-bsdauth.c >> +--- driver/passwd-bsdauth.c.orig >> ++++ driver/passwd-bsdauth.c >> +@@ -0,0 +1,69 @@ >> ++/* passwd-bsdauth.c --- verifying typed passwords with the BSD >> ++ * Authentication system. >> ++ * xscreensaver, Copyright © 1993-2022 Jamie Zawinski <[email protected]> >> ++ * >> ++ * Permission to use, copy, modify, distribute, and sell this software and >> its >> ++ * documentation for any purpose is hereby granted without fee, provided >> that >> ++ * the above copyright notice appear in all copies and that both that >> ++ * copyright notice and this permission notice appear in supporting >> ++ * documentation. No representations are made about the suitability of >> this >> ++ * software for any purpose. It is provided "as is" without express or >> ++ * implied warranty. >> ++ */ >> ++ >> ++#ifdef HAVE_CONFIG_H >> ++# include "config.h" >> ++#endif >> ++ >> ++#ifndef NO_LOCKING /* whole file */ >> ++ >> ++#include <stdlib.h> >> ++#ifdef HAVE_UNISTD_H >> ++# include <unistd.h> >> ++#endif >> ++ >> ++#include <stdio.h> >> ++#include <string.h> >> ++#include <sys/types.h> >> ++#include <pwd.h> >> ++#include <login_cap.h> >> ++#include <bsd_auth.h> >> ++ > >> ++#ifdef __bsdi__ >> ++# include <sys/param.h> >> ++# if _BSDI_VERSION >= 199608 >> ++# define BSD_AUTH >> ++# endif >> ++#endif /* __bsdi__ */ > > I would not cargo-cult this chunk. It is unused in the other files. > >> Index: patches/patch-driver_xscreensaver-auth_c >> =================================================================== >> RCS file: >> /cvs/ports/x11/xscreensaver/patches/patch-driver_xscreensaver-auth_c,v >> diff -u -p -r1.1 patch-driver_xscreensaver-auth_c >> --- patches/patch-driver_xscreensaver-auth_c 27 Oct 2026 06:43:30 -0000 >> 1.1 >> +++ patches/patch-driver_xscreensaver-auth_c 4 Nov 2026 20:04:57 -0000 >> @@ -1,3 +1,4 @@ >> +diff -u driver/xscreensaver-auth.c.orig driver/xscreensaver-auth.c >> Index: driver/xscreensaver-auth.c >> --- driver/xscreensaver-auth.c.orig >> +++ driver/xscreensaver-auth.c >> @@ -6,8 +7,20 @@ Index: driver/xscreensaver-auth.c >> #include "auth.h" >> >> +/* OpenBSD: set[ug]id binary MUST say so in this var */ >> -+mode_t _permit_setugid = S_ISUID; >> ++mode_t _permit_setugid = S_ISGID; >> + >> #ifdef __GNUC__ >> __extension__ /* shut up about "string length is greater than the >> length >> ISO C89 compilers are required to support" when >> including >> +@@ -340,7 +343,11 @@ main (int argc, char **argv) >> + if (!splash_p && !init_p) >> + lock_priv_init (); >> + >> ++ /* I have not found a way to drop privileges and have access to >> ++ bsdauth at least on OpenBSD. */ >> ++#if !defined(HAVE_BSDAUTH) || !defined(__OpenBSD__) >> + disavow_privileges (); >> ++#endif > > See the comment at the beginning of the file: > > * Flow of control within xscreensaver-auth: > * > * - Privileged password initialization (e.g. read /etc/shadow as root) > * - Disavow privileges > * - Unprivileged password initialization > * - Connect to X server > [...] > > disavow_privileges() calls setgroups, setgid and setuid to drop any > extra creds. In fact, if running without root creds its attempt at > calling setgroups() would fail and xscreensaver-auth would exit. > xscreensaver-auth is built around privdrop because OpenBSD isn't the > only system that restricts access to shadow passwords. > > On the other hand, to use bsdauth, you *need* to belong to the auth > group for the whole duration of the xscreensaver-auth process. I > suspect that this is the reason why upstream apparently rejected it > (unless I understood Manuel incorrectly). I don't think that upstream knows about this detail about bsdauth. He was just surprise that we were not just using PAM. For your proposed patch, I don't really have an opinion: as I've said when giving my initial patch to Caspar, I'm far from an expert on this matter so I'm especially happy that this gets some eyeballs ;-) -- Manuel Giraud
