2008-05-03 03:50:20 +04:00
#!/bin/sh
# various tests for the "net" command
2011-02-21 08:01:44 +03:00
if [ $# -lt 3 ] ; then
cat <<EOF
2011-09-11 02:16:50 +04:00
Usage: test_net_misc.sh SCRIPTDIR SERVERCONFFILE NET CONFIGURATION
2011-02-21 08:01:44 +03:00
EOF
exit 1;
fi
SCRIPTDIR = " $1 "
SERVERCONFFILE = " $2 "
2011-09-11 02:16:50 +04:00
NET = " $3 "
CONFIGURATION = " $4 "
2011-02-21 08:01:44 +03:00
2019-11-19 17:11:21 +03:00
# optional protocl, default to NT1
if [ $# -gt 4 ] ; then
PROTOCOL = " $5 "
else
PROTOCOL = "NT1"
fi
2008-05-03 03:50:20 +04:00
2019-11-19 17:11:21 +03:00
NET = " $VALGRIND ${ NET :- $BINDIR /net } $CONFIGURATION "
NETTIME = " ${ NET } --option=clientmaxprotocol= ${ PROTOCOL } time "
NETLOOKUP = " ${ NET } --option=clientmaxprotocol= ${ PROTOCOL } lookup "
2019-11-22 19:53:08 +03:00
NETSHARE = " ${ NET } -U ${ USERNAME } % ${ PASSWORD } --option=clientmaxprotocol= ${ PROTOCOL } -S ${ SERVER } share "
2008-05-03 03:50:20 +04:00
2011-02-16 00:54:06 +03:00
incdir = ` dirname $0 ` /../../../testprogs/blackbox
. $incdir /subunit.sh
2008-05-03 03:50:20 +04:00
failed = 0
test_time( )
{
PARAM = " $1 "
2009-01-28 22:30:16 +03:00
${ NETTIME } -S ${ SERVER } ${ PARAM }
2008-05-03 03:50:20 +04:00
}
test_lookup( )
{
PARAM = " $1 "
${ NETLOOKUP } ${ PARAM }
}
2019-11-22 19:53:08 +03:00
test_share( )
{
PARAM = " $1 "
${ NETSHARE } ${ PARAM }
}
2008-05-03 03:50:20 +04:00
testit "get the time" \
test_time || \
failed = ` expr $failed + 1`
testit "get the system time" \
test_time system || \
failed = ` expr $failed + 1`
2008-06-19 13:59:55 +04:00
testit "get the time zone" \
2008-05-03 03:50:20 +04:00
test_time zone || \
failed = ` expr $failed + 1`
testit "lookup the PDC" \
test_lookup pdc || \
failed = ` expr $failed + 1`
testit "lookup the master browser" \
test_lookup master || \
failed = ` expr $failed + 1`
2019-11-22 19:53:08 +03:00
# This test attempts to lookup shares
testit "lookup share list" \
test_share list || \
failed = ` expr $failed + 1`
2008-05-03 03:50:20 +04:00
testok $0 $failed