#!/bin/sh
# (C) Copyright 2001 The Free Standards Group  Inc
# ./tset/LSB-usersgroups/usersgroups/names/names-tc.sh
# names-tc.sh : test case for uses and groups NAMES
# This is 1.0
#
# names-tc.sh,v
# Revision 1.0  2001/01/02 08:15:33  kcaunt
# 
#
#

# 
# 
tet_startup="startup"			# startup function
tet_cleanup="cleanup"			# cleanup function
iclist="ic1 ic2 ic3 ic4 ic5 ic6 ic7 ic8 ic9 ic10 ic11 ic12 ic13 ic14"
ic1="tp1"
ic2="tp2"
ic3="tp3"
ic4="tp4"
ic5="tp5"
ic6="tp6"
ic7="tp7"
ic8="tp8"
ic9="tp9"
ic10="tp10"
ic11="tp11"
ic12="tp12"
ic13="tp13"
ic14="tp14"

tp1()
{
	tpstart "Reference User & Group Names  16-1"
	tet_infoline "Does User Name (root) exists and is it in the Group (root)"
        usersgroups_names_exist root root 
        check_exit_value $? 0		# should be zero
       
        if [ "$FAIL" = "N" ]; then
           tet_infoline "Is the gid for user name (root) equal to zero"
           if [ `id -g root` != 0 >/dev/null 2>@1 ]; then  
              tet_infoline "The gid for user name (root) is NOT equal to zero"
              FAIL=Y       
           fi
        fi

	tpresult	                # set result code
}

tp2()
{
	tpstart "Reference User & Group Names  16-1"
	tet_infoline "Does User Name (bin) exists and is it in the Group (bin)"
        usersgroups_names_exist bin bin
        check_exit_value $? 0		# should be zero
       
	tpresult	                # set result code	
	
}

tp3()
{
	tpstart "Reference User & Group Names  16-1"
	tet_infoline "Does User Name (daemon) exists and is it in the Group (daemon)"
        usersgroups_names_exist daemon daemon
        check_exit_value $? 0       	# should be zero	
	tpresult	                # set result code
}

tp4()
{
	tpstart "Reference User & Group Names  16-1"
	tet_infoline "If User Name (adm) exists it should be in the Group (adm)"
        usersgroups_exist adm adm
	if [ $? -eq 0 ]; then
		tpresult	                # set result code
	else
		return
	fi
}

tp5()
{
	tpstart "Reference User & Group Names  16-1"
	tet_infoline "If User Name (lp) exists it should be in the Group (lp)"
        usersgroups_exist lp lp
	if [ $? -eq 0 ]; then
		tpresult	                # set result code
	else
		return
	fi
}

tp6()
{
	tpstart "Reference User & Group Names  16-1"
	tet_infoline "If User Name (sync) exists it should be in the Group (sync)"
        usersgroups_exist sync sync
	if [ $? -eq 0 ]; then
		tpresult	                # set result code
	else
		return
	fi
}

tp7()
{
	tpstart "Reference User & Group Names  16-1"
	tet_infoline "If User Name (shutdown) exists it should be in the Group (shutdown)"
        usersgroups_exist shutdown shutdown
	if [ $? -eq 0 ]; then
		tpresult	                # set result code
	else
		return
	fi
}

tp8()
{
	tpstart "Reference User & Group Names  16-1"
	tet_infoline "If User Name (halt) exists it should be in the Group (halt)"
        usersgroups_exist halt halt
	if [ $? -eq 0 ]; then
		tpresult	                # set result code
	else
		return
	fi
}

tp9()
{
	tpstart "Reference User & Group Names  16-1"
	tet_infoline "If User Name (mail) exists it should be in the Group (mail)"
        usersgroups_exist mail mail
	if [ $? -eq 0 ]; then
		tpresult	                # set result code
	else
		return
	fi
}

tp10()
{
	tpstart "Reference User & Group Names  16-1"
	tet_infoline "If User Name (news) exists it should be in the Group (news)"
        usersgroups_exist news news
	if [ $? -eq 0 ]; then
		tpresult	                # set result code
	else
		return
	fi
}

tp11()
{
	tpstart "Reference User & Group Names  16-1"
	tet_infoline "If User Name (uucp) exists it should be in the Group (uucp)"
        usersgroups_exist uucp uucp
	if [ $? -eq 0 ]; then
		tpresult	                # set result code
	else
		return
	fi
}

tp12()
{
	tpstart "Reference User & Group Names  16-1"
	tet_infoline "If User Name (operator) exists it should be in the Group (root)"
        usersgroups_exist operator root
	if [ $? -eq 0 ]; then
		tpresult	                # set result code
	else
		return
	fi
}

tp13()
{
	tpstart "Reference User & Group Names  16-1"
	tet_infoline "If User Name (man) exists it should be in the Group (man)"
        usersgroups_exist man man
	if [ $? -eq 0 ]; then
		tpresult	                # set result code
	else
		return
	fi
}

tp14()
{
	tpstart "Reference User & Group Names  16-1"
	tet_infoline "If User Name (nobody) exists it should be in the Group (nobody)"
        usersgroups_exist nobody nobody
	if [ $? -eq 0 ]; then
		tpresult	                # set result code
	else
		return
	fi
}


startup() # startup function
{
     rm -f out.stdout out.stderr out.experr >/dev/null 2>&1
}


cleanup() # clean-up function
{
     rm -f out.stdout out.stderr out.experr >/dev/null 2>&1
}

# source common shell functions

. $TET_EXECUTE/LIB/shfuncs.sh
. $TET_EXECUTE/LIB/usersgroups_funcs.sh



# execute shell test case manager - must be last line
. $TET_ROOT/lib/xpg3sh/tcm.sh
