#!/usr/bin/perl
########################################################################
#
#
# LOMAC - Low Water-Mark Mandatory Access Control for Linux 
# Copyright (C) 1999, TIS Labs at Network Associates, Inc.
# Copyright (C) 2000 - 2001 NAI Labs
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Software Foundation.  This program
# is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
# License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write
# to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
#
# linfo - the lomac info program.  The catch-all LOMAC utility.
#         Currently, linfo can be used only to determine if the
#         LOMAC LKM is loaded and the /dev/lomac device exists.
#
# USAGE:
# lomac -c
#
# OPTIONS:
# -c  checks to make sure the LOMAC LKM is loaded and /dev/lomac exists.
# 
#
# RETURNS:
# value       condition
# -----       ---------
#  -1         Incorrect command line parameters.
#   0         The LOMAC LKM is loaded and /dev/lomac exists.
#   1         The LOMAC LKM is not loaded.
#   2         /dev/lomac does not exist or is not a character device.  
#   3         /dev/lomac has incorrect device major number.
#
# Tim Fraser <tfraser@tislabs.com>        : initial implementation
# John Thiltges <jthiltg1@bigred.unl.edu> : adapted to use lomac.pm
#
########################################################################

use lib "/opt/lomac/bin";
use lomac;

my $ret_val;

#
# Step 1 - Process command-line arguments
#

# Bomb if we didn't get the proper number of arguments
if( ( $#ARGV != 0 ) && ( $ARGV[ 0 ] ne "-c" ) ) {
    print( STDERR "USAGE: linfo -c\n" );
    exit( -1 );
}

#
# Step 2 - Call linfo() in lomac.pm to determine if the LOMAC LKM is loaded
#

$ret_val = linfo("-c");

#
# Step 3 - report results.
#

# Call the linfo subroutine in lomac.pm and return the value
exit( $ret_val );

