1#!/bin/sh
2
3if [ $# -lt 3 ]; then
4cat <<EOF
5Usage: test_net_rpc_oldjoin.sh SERVER PREFIX SMB_CONF_PATH
6EOF
7exit 1;
8fi
9
10SERVER="$1"
11PREFIX="$2"
12SMB_CONF_PATH="$3"
13shift 3
14
15incdir=`dirname $0`/../../../testprogs/blackbox
16. $incdir/subunit.sh
17maccount="OLDJOINTEST"
18privatedir="$PREFIX/private"
19
20UID_WRAPPER_ROOT=1
21export UID_WRAPPER_ROOT
22
23OPTIONS="--configfile $SMB_CONF_PATH --option=netbiosname=$maccount --option=security=domain --option=domainlogons=no --option=privatedir=$privatedir"
24
25test_smbpasswd()
26{
27	account=$1
28
29	echo "set password with smbpasswd"
30
31	cmd='UID_WRAPPER_INITIAL_RUID=0 UID_WRAPPER_INITIAL_EUID=0 $VALGRIND $BINDIR/smbpasswd -L -c $SMB_CONF_PATH -a -m "$account"'
32	eval echo "$cmd"
33	out=$(eval $cmd)
34	ret=$?
35	rm -f $tmpfile
36
37	if [ $ret -ne 0 ]; then
38		echo "Failed to change user password $user"
39		return 1
40	fi
41}
42
43
44testit "mkdir -p $privatedir" mkdir -p $privatedir || failed=`expr $failed + 1`
45testit "smbpasswd -a -m" \
46	test_smbpasswd $maccount \
47	|| failed=$(expr $failed + 1)
48testit "net_rpc_oldjoin" $VALGRIND $BINDIR/net rpc oldjoin -S $SERVER $OPTIONS || failed=`expr $failed + 1`
49testit "net_rpc_testjoin1" $VALGRIND $BINDIR/net rpc testjoin -S $SERVER $OPTIONS || failed=`expr $failed + 1`
50testit "net_rpc_changetrustpw" $VALGRIND $BINDIR/net rpc changetrustpw -S $SERVER $OPTIONS || failed=`expr $failed + 1`
51testit "net_rpc_testjoin2" $VALGRIND $BINDIR/net rpc testjoin -S $SERVER $OPTIONS || failed=`expr $failed + 1`
52
53testok $0 $failed
54