187514Scjc#!/bin/sh -
287514Scjc#
387514Scjc# Copyright (c) 2001  The FreeBSD Project
487514Scjc# All rights reserved.
587514Scjc#
687514Scjc# Redistribution and use in source and binary forms, with or without
787514Scjc# modification, are permitted provided that the following conditions
887514Scjc# are met:
987514Scjc# 1. Redistributions of source code must retain the above copyright
1087514Scjc#    notice, this list of conditions and the following disclaimer.
1187514Scjc# 2. Redistributions in binary form must reproduce the above copyright
1287514Scjc#    notice, this list of conditions and the following disclaimer in the
1387514Scjc#    documentation and/or other materials provided with the distribution.
1487514Scjc#
1587514Scjc# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1687514Scjc# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1787514Scjc# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1887514Scjc# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1987514Scjc# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2087514Scjc# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2187514Scjc# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2287514Scjc# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2387514Scjc# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2487514Scjc# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2587514Scjc# SUCH DAMAGE.
2687514Scjc#
2787514Scjc# $FreeBSD: releng/10.3/etc/periodic/security/300.chkuid0 254974 2013-08-27 21:20:28Z jlh $
2887514Scjc#
2987514Scjc
3087514Scjc
3187514Scjc# If there is a global system configuration file, suck it in.
3287514Scjc#
3387514Scjcif [ -r /etc/defaults/periodic.conf ]
3487514Scjcthen
3587514Scjc    . /etc/defaults/periodic.conf
3687514Scjc    source_periodic_confs
3787514Scjcfi
3887514Scjc
39254974Sjlhsecurity_daily_compat_var security_status_chkuid0_enable
40254974Sjlh
41254974Sjlhrc=0
42254974Sjlh
43254974Sjlhif check_yesno_period security_status_chkuid0_enable
44254974Sjlhthen
4587514Scjc	echo ""
4687514Scjc	echo 'Checking for uids of 0:'
4787514Scjc	n=$(awk -F: '/^#/ {next} $3==0 {print $1,$3}' /etc/master.passwd |
4887514Scjc	tee /dev/stderr |
4987514Scjc	sed -e '/^root 0$/d' -e '/^toor 0$/d' |
5087514Scjc	wc -l)
51254974Sjlh	[ $n -gt 0 ] && rc=1 || rc=0
52254974Sjlhfi
5387514Scjc
5487514Scjcexit "$rc"
55