You've already forked macports-base
mirror of
https://github.com/macports/macports-base.git
synced 2026-07-12 18:18:43 -07:00
Avoid dscl commands entirely if not root
Apparently Crowdstrike only cares that the shell script being executed
mentions 'dscl' and 'Password', regardless of whether it's in a
conditional branch that never gets executed.
See: https://trac.macports.org/ticket/69187
(cherry picked from commit a215377381)
This commit is contained in:
@@ -45,6 +45,7 @@ install::
|
||||
$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 $(srcdir)/keys/archives/*.pub "$(DESTDIR)${datadir}/macports/keys/archives/"
|
||||
# Only run these scripts when not building in a destroot
|
||||
ifeq ($(DESTDIR),)
|
||||
ifeq (@NO_ROOTPRIVS@,)
|
||||
# create run user if it doesn't exist
|
||||
@if test `id -u` -eq 0; then \
|
||||
if test -n "${DSCL}" -a -n "${DSEDITGROUP}" ; then \
|
||||
@@ -93,6 +94,7 @@ ifeq ($(DESTDIR),)
|
||||
else \
|
||||
echo "Not creating or updating user or group \"${RUNUSR}\" (not root)" ; \
|
||||
fi
|
||||
endif
|
||||
# Move ping cache to new location
|
||||
@if [ -f "${localstatedir}/macports/pingtimes" ]; then \
|
||||
mv "${localstatedir}/macports/pingtimes" "${localstatedir}/macports/cache/pingtimes"; \
|
||||
|
||||
Vendored
+2
-3
@@ -554,12 +554,11 @@ AC_DEFUN([MP_CHECK_OLDLAYOUT],[
|
||||
AC_DEFUN([MP_CHECK_NOROOTPRIVILEGES],[
|
||||
dnl if the user specifies --with-no-root-privileges,
|
||||
dnl use current user and group.
|
||||
dnl use ~/Library/Tcl as Tcl package directory
|
||||
AC_REQUIRE([MP_PATH_MPCONFIGDIR])
|
||||
|
||||
AC_ARG_WITH(no-root-privileges, [AS_HELP_STRING([--with-no-root-privileges],[specify that MacPorts should be installed in your home directory])], [ROOTPRIVS=$withval] )
|
||||
AC_ARG_WITH(no-root-privileges, [AS_HELP_STRING([--with-no-root-privileges],[specify that MacPorts should be installed in your home directory])], [NO_ROOTPRIVS=$withval] )
|
||||
|
||||
if test "${ROOTPRIVS+set}" = set; then
|
||||
if test "${NO_ROOTPRIVS+set}" = set; then
|
||||
# Set install-user to current user
|
||||
AC_MSG_CHECKING([for install user])
|
||||
DSTUSR=`id -un`
|
||||
|
||||
@@ -705,6 +705,7 @@ MPFRAMEWORKSDIR
|
||||
MPAPPLICATIONSDIR
|
||||
MTREE_GNAME
|
||||
DSTMODE
|
||||
NO_ROOTPRIVS
|
||||
RUNUSR
|
||||
DSTGRP
|
||||
DSTUSR
|
||||
@@ -7060,11 +7061,11 @@ printf "%s\n" "$mpconfigdir" >&6; }
|
||||
# Check whether --with-no-root-privileges was given.
|
||||
if test ${with_no_root_privileges+y}
|
||||
then :
|
||||
withval=$with_no_root_privileges; ROOTPRIVS=$withval
|
||||
withval=$with_no_root_privileges; NO_ROOTPRIVS=$withval
|
||||
fi
|
||||
|
||||
|
||||
if test "${ROOTPRIVS+set}" = set; then
|
||||
if test "${NO_ROOTPRIVS+set}" = set; then
|
||||
# Set install-user to current user
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for install user" >&5
|
||||
printf %s "checking for install user... " >&6; }
|
||||
@@ -7092,6 +7093,7 @@ printf "%s\n" "$RUNUSR" >&6; }
|
||||
|
||||
|
||||
|
||||
|
||||
# Check for install ownership
|
||||
|
||||
|
||||
|
||||
@@ -222,6 +222,7 @@ MP_PATH_MPCONFIGDIR
|
||||
|
||||
# Check whether to install without root privileges
|
||||
MP_CHECK_NOROOTPRIVILEGES
|
||||
AC_SUBST(NO_ROOTPRIVS)
|
||||
|
||||
# Check for install ownership
|
||||
MP_CHECK_INSTALLUSER
|
||||
|
||||
Reference in New Issue
Block a user