pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

xtrlock: simplify and lint Makefile. Apprarently, the shadow file is group-redable only on Linux. Making xtrlock sgid shadow only on Linux allows to simplify the Makefile significantly and make it more robust.



Module Name:	pkgsrc-wip
Committed By:	Paolo Vincenzo Olivo <vms%retrobsd.ddns.net@localhost>
Pushed By:	vms
Date:		Sat Oct 29 13:02:30 2022 +0200
Changeset:	b0e3fb5d5ce525c063f6d8de37c77559b38e96b5

Modified Files:
	xtrlock/MESSAGE
	xtrlock/Makefile

Log Message:
xtrlock: simplify and lint Makefile.
Apprarently, the shadow file is group-redable only on Linux.
Making xtrlock sgid shadow only on Linux allows to simplify the Makefile
significantly and make it more robust.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=b0e3fb5d5ce525c063f6d8de37c77559b38e96b5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 xtrlock/MESSAGE  |  7 +++----
 xtrlock/Makefile | 12 +++++-------
 2 files changed, 8 insertions(+), 11 deletions(-)

diffs:
diff --git a/xtrlock/MESSAGE b/xtrlock/MESSAGE
index d7841bea70..53fe0ca8a2 100644
--- a/xtrlock/MESSAGE
+++ b/xtrlock/MESSAGE
@@ -4,10 +4,9 @@ $NetBSD$
 By default, xtrlock(1) is installed suid root, this is required to inspect
 the user database when locking the screen.
 
-On systems relying on a special group to grant read permission to the
-password file (by default `shadow'), xtrlock is installed sgid shadow.
-Define SHADOWGRP if you want to change this behaviour.
+On Linux, where the shadow file is generally made group-redable by the
+`shadow' group, xtrlock will be installed sgid shadow instead.
 
-Privileges are dropped at startup and are reacquired only upon unlocking.
+Privileges are dropped at startup and reacquired only upon unlocking.
 
 ===========================================================================
diff --git a/xtrlock/Makefile b/xtrlock/Makefile
index 40f8bad6f7..a4cfb85dbc 100644
--- a/xtrlock/Makefile
+++ b/xtrlock/Makefile
@@ -13,19 +13,17 @@ LICENSE=	gnu-gpl-v3
 
 USE_IMAKE=	yes
 
-.if exists(/etc/shadow)
+.include "../../mk/bsd.prefs.mk"
+
+.if exists(/etc/shadow) && !(${OPSYS:M*BSD} != "" || ${OPSYS} == "Darwin" || ${OPSYS} == "DragonFly")
 MAKE_FLAGS+=		CCOPTIONS="-DSHADOW_PWD ${CFLAGS}"
 .else
 MAKE_FLAGS+=		CCOPTIONS=${CFLAGS:Q}
-SETUID_ROOT_PERMS?=	${REAL_ROOT_USER} ${BINGRP} 4555
 .endif
 MAKE_FLAGS+=		LOCAL_LDFLAGS=${LDFLAGS:Q}
 
-SHADOWGRP?=		shadow
-CHECK_SHADOWGRP:=	${GREP} ${SHADOWGRP} /etc/group
-
-.if !empty(CHECK_SHADOWGRP)
-SETUID_ROOT_PERMS?=	${REAL_ROOT_USER} ${SHADOWGRP} 2555
+.if	${OPSYS} == "Linux"
+SETUID_ROOT_PERMS?=	${REAL_ROOT_USER} shadow 2555
 .else
 SETUID_ROOT_PERMS?=	${REAL_ROOT_USER} ${BINGRP} 4555
 .endif


Home | Main Index | Thread Index | Old Index