#!/bin/sh

#################################################################################
#
#   Lynis
# ------------------
#
# Copyright 2007-2008, Michael Boelen (michael@rootkit.nl), The Netherlands
# Web site: http://www.rootkit.nl
#
# Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
# welcome to redistribute it under the terms of the GNU General Public License.
# See LICENSE file for usage of this software.
#
#################################################################################
#
# Printers and spools
#
#################################################################################
#
InsertSection "Printers and Spools"

# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

if [ "${OS}" = "FreeBSD" ]; then
    counttests
    logtext "Test: Searching /usr/sbin/chkprintcap"
    if [ ! -f /usr/sbin/chkprintcap ]; then
	Display --indent 2 --text "- [FreeBSD] Checking chkprintcap..." --result "NOT FOUND" --color WHITE
        logtext "Result: /usr/sbin/chkprintcap not found, test skipped."
      else
        logtext "Result: /usr/sbin/chkprintcap found"
	FIND=`/usr/sbin/chkprintcap > /dev/null ; echo $?`
	# Only an exit code of zero should come back. Use string
	# instead of integer, due unexpected trash
	if [ "${FIND}" = "0" ]; then	    
	    Display --indent 2 --text "- [FreeBSD] Checking chkprintcap..." --result OK --color GREEN
	    logtext "Result: chkprintcap did NOT gave any warnings"
	  else
	    Display --indent 2 --text "- [FreeBSD] Checking chkprintcap..." --result WARNING --color RED
	    logtext "Warning: Possible corrupted /etc/printcap file."
	    logtext "Output from chkprintcap: ${FIND}"
	    logtext "Suggestion: run chkprintcap and check the /etc/printcap file."
	    logtext "Status: BAD"
	fi
    fi
    logtextbreak
fi

#YYY implement test
#if [ "${OS}" = "Linux" ]; then
#    counttests
#    echo "        - Testing printcap file... [Test not implemented yet]"
#    # Check printcap with checkpc command
#    logtextbreak
#fi

#
#================================================================================
# Lynis - Copyright 2007-2008, Michael Boelen - www.rootkit.nl - The Netherlands
