#!/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"
    
    # Test        : PRNT-2302
    # Description : Check printcap file consistency
    Register --test-no PRNT-2302 --os FreeBSD --weight L --network NO --description "Check for available accounting information"
    if [ ${SKIPTEST} -eq 0 ]; then
        logtext "Test: Searching /usr/sbin/chkprintcap"
        if [ ! -f /usr/sbin/chkprintcap ]; then
            Display --indent 2 --text "- 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 "- Checking chkprintcap..." --result OK --color GREEN
	        logtext "Result: chkprintcap did NOT gave any warnings"
	      else
	        Display --indent 2 --text "- Checking chkprintcap..." --result WARNING --color RED
	        ReportWarning ${TEST_NO} "L" "Possible corrupted /etc/printcap file."
		ReportSuggestion ${TEST_NO} "Run chkprintcap manually to test printcap file."
	        logtext "Output from chkprintcap: ${FIND}"
	        logtext "Suggestion: run chkprintcap and check the /etc/printcap file."
	    fi
        fi        
    fi
#
#################################################################################
#

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

wait_for_keypress

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