Hi people,

On Fri, May 06, 2016 at 03:03:52PM +0100, Stuart Henderson wrote:
> [...]
> Feel free to investigate the ports I mentioned then. Diffs to
> ports@ please - you can test that they work using tedu's diff
> that will avoid filling in pw_passwd in the struct, it's usually
> just a case of s/(getpwuid|getpwnam)/\1_shadow/.
> [...]

The attached patch fixes x11/xscreensaver to work with the new
shadow-only pwd. I think the patch is straightforward, but given the
sensitive nature of xscreensaver, it'd probably be good if more than one
other person could test this before it gets applied.

Without this patch, `xscreensaver-command -lock` will just return
stating that locking isn't available. `xscreensaver` itself will
complain about its inability to get PWD data for the current user and
root (what's up with that?) and not lock the screen. The screensaver
does start though, so this might be a trap for unaware users.

I'm not sure if the warning that's visible in the patch to the port
Makefile needs to be heeded since this isn't an update that changes the
plist.

-- 
        Gregor

Index: Makefile
===================================================================
RCS file: /mnt/media/cvs/ports/x11/xscreensaver/Makefile,v
retrieving revision 1.86
diff -u -p -r1.86 Makefile
--- Makefile    31 Oct 2015 22:58:16 -0000      1.86
+++ Makefile    11 May 2016 22:26:25 -0000
@@ -11,6 +11,8 @@ HOMEPAGE=             http://www.jwz.org/xscreensav
 # After updating this port, remember to make update-plist in
 # x11/kde/artwork and x11/kde4/artwork, too.
 
+REVISION=              1
+
 # BSD
 PERMIT_PACKAGE_CDROM=  Yes
 
Index: patches/patch-driver_passwd-pwent_c
===================================================================
RCS file: patches/patch-driver_passwd-pwent_c
diff -N patches/patch-driver_passwd-pwent_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-driver_passwd-pwent_c 11 May 2016 21:43:14 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+--- driver/passwd-pwent.c.orig Sat Dec 27 11:17:26 2008
++++ driver/passwd-pwent.c      Wed May 11 23:43:04 2016
+@@ -133,7 +133,7 @@ user_name (void)
+      still work.  Right?) */
+   if (!u || !*u)
+     {
+-      struct passwd *p = getpwuid (getuid ());
++      struct passwd *p = getpwuid_shadow (getuid ());
+       u = (p ? p->pw_name : 0);
+     }
+ 
+@@ -177,7 +177,7 @@ get_encrypted_passwd(const char *user)
+ 
+   if (user && *user && !result)
+     {                                 /* Check non-shadow passwords too. */
+-      struct passwd *p = getpwnam(user);
++      struct passwd *p = getpwnam_shadow(user);
+       if (p && passwd_known_p (p->pw_passwd))
+       result = strdup(p->pw_passwd);
+     }

Reply via email to