aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/periodic
diff options
context:
space:
mode:
authorEugene Grosbein <eugen@FreeBSD.org>2018-11-10 14:21:26 +0000
committerEugene Grosbein <eugen@FreeBSD.org>2018-11-10 14:21:26 +0000
commitab478b01852736ca87946a6bbc73f94001c09f07 (patch)
tree1ed6c3353c27283ca42dd9f8b1781cd7a8e9c443 /usr.sbin/periodic
parent7b3c65ba1c6185f579dbd08ec2392ea380f65b2e (diff)
downloadsrc-ab478b01852736ca87946a6bbc73f94001c09f07.tar.gz
src-ab478b01852736ca87946a6bbc73f94001c09f07.zip
Notes
Diffstat (limited to 'usr.sbin/periodic')
-rwxr-xr-xusr.sbin/periodic/etc/weekly/340.noid20
1 files changed, 19 insertions, 1 deletions
diff --git a/usr.sbin/periodic/etc/weekly/340.noid b/usr.sbin/periodic/etc/weekly/340.noid
index 11a5f53ea25d..047fdd52f313 100755
--- a/usr.sbin/periodic/etc/weekly/340.noid
+++ b/usr.sbin/periodic/etc/weekly/340.noid
@@ -16,8 +16,26 @@ case "$weekly_noid_enable" in
echo ""
echo "Check for files with an unknown user or group:"
+ # Host should not test jailed subtrees as jails have their own
+ # databases of users and groups. Leave them for jailed invocations
+ # of this script.
+
+ exclude=''
+ if [ $(sysctl -n security.jail.jailed) = 0 ]; then
+ sep=:
+ OIFS="$IFS"
+ IFS="$sep"
+ for param in $(jail -f "`syscrc jail_conf`" -e "$sep")
+ do
+ case "$param" in
+ path=*) exclude="$exclude -path ${param#path=} -prune -or"
+ esac
+ done
+ IFS="$OIFS"
+ fi
+
rc=$(find -H ${weekly_noid_dirs:-/} \
- \( ! -fstype local -prune -or -name \* \) -and \
+ \( $exclude ! -fstype local -prune -or -name \* \) -and \
\( -nogroup -o -nouser \) -print | sed 's/^/ /' |
tee /dev/stderr | wc -l)
[ $rc -gt 1 ] && rc=1