ctdb-daemon: Store tdb flags just after tdb is opened in ctdb_local_attach()
[Samba.git] / testprogs / blackbox / test_net_rpc_user.sh
blob64ab01b8f0c02375423c4df15c7debb89bf46c26
1 #!/bin/sh
2 # Blackbox tests for 'net rpc'
4 # Copyright (c) 2017 Andreas Schneider <asn@samba.org>
6 if [ $# -lt 4 ]; then
7 cat << EOF
8 Usage: net_rpc.sh SERVER ADMIN_ACCOUNT ADMIN_PASSWORD ADMIN_DOMAIN
9 EOF
10 exit 1
13 SERVER=$1
14 ADMIN_ACCOUNT=$2
15 ADMIN_PASSWORD=$3
16 ADMIN_DOMAIN=$4
17 shift 4
19 failed=0
20 samba_bindir="$BINDIR"
22 samba_tool="$samba_bindir/samba-tool"
23 net_tool="$samba_bindir/net"
25 TEST_USERNAME="$(mktemp -u samson-XXXXXX)"
26 TEST_PASSWORD="Passw0rd~01"
28 newuser="$samba_tool user create"
30 . `dirname $0`/subunit.sh
31 . `dirname $0`/common_test_fns.inc
33 ###########################################################
34 ### Setup
35 ###########################################################
37 testit "net rpc user add" \
38 $VALGRIND $net_tool rpc user add $TEST_USERNAME $TEST_PASSWORD -U$ADMIN_ACCOUNT%$ADMIN_PASSWORD -S $SERVER || failed=$(expr $failed + 1)
40 ###########################################################
41 ### Tests
42 ###########################################################
44 TEST_PASSWORD_NEW="Passw0rd~02"
46 testit "net rpc user password" \
47 $VALGRIND $net_tool rpc user password $TEST_USERNAME $TEST_PASSWORD_NEW -U$ADMIN_ACCOUNT%$ADMIN_PASSWORD -S $SERVER || failed=$(expr $failed + 1)
49 ###########################################################
50 ### Teardown
51 ###########################################################
53 testit "net rpc user delete" \
54 $VALGRIND $net_tool rpc user delete $TEST_USERNAME -U$ADMIN_ACCOUNT%$ADMIN_PASSWORD -S $SERVER || failed=$(expr $failed + 1)
56 exit $failed