libcli/auth: let netlogon_creds_copy() make use of ndr_deepcopy_struct()
[samba4-gss.git] / source3 / script / tests / test_rpcclientsrvsvc.sh
blobfdade1a19cb814754b30e2f24dfd9f930d05b4fd
1 #!/bin/sh
3 # Blackbox tests for the rpcclient srvsvc commands
5 # Copyright (C) 2015 Christof Schmitt
7 if [ $# -lt 5 ]; then
8 cat <<EOF
9 Usage: test_rpcclientsrvsvc.sh USERNAME PASSWORD SERVER RPCCLIENT SHARE1
10 EOF
11 exit 1
14 USERNAME="$1"
15 PASSWORD="$2"
16 SERVER="$3"
17 RPCCLIENT="$4"
18 SHARE1="$5"
20 RPCCLIENTCMD="$RPCCLIENT $SERVER -U$USERNAME%$PASSWORD"
22 SHARENAME=SRVSVCTEST
23 MAX_USERS=5
24 COMMENT="share for RPC SRVSVC testing"
26 incdir=$(dirname $0)/../../../testprogs/blackbox
27 . $incdir/subunit.sh
29 failed=0
31 # Query path from existing share
33 $RPCCLIENTCMD -c "netsharegetinfo $SHARE1"
34 RC=$?
35 testit "getinfo on S$SHARE1" test $RC = 0 || failed=$(expr $failed + 1)
37 SHAREPATH=$($RPCCLIENTCMD -c "netsharegetinfo '$SHARE1'" |
38 grep path: | sed -e 's/.*path:\t//')
39 testit "verifying $SHARE1 path" test -n "$SHAREPATH" ||
40 failed=$(expr $failed + 1)
42 # Add a new share
44 $RPCCLIENTCMD -c "netshareadd '$SHAREPATH' '$SHARENAME' '$MAX_USERS' '$COMMENT'"
45 RC=$?
46 testit "netshareadd" test $RC = 0 || failed=$(expr $failed + 1)
48 # Verify comment for new share
50 COMMENT_RET=$($RPCCLIENTCMD -c "netsharegetinfo '$SHARENAME'" |
51 grep remark: | sed -e 's/.*remark:\t//')
53 test "$COMMENT" = "$COMMENT_RET"
54 RC=$?
55 testit "verifying comment" test $RC -eq 0 || failed=$(expr $failed + 1)
57 # Verify share path for new share
59 SHAREPATH_RET=$($RPCCLIENTCMD -c "netsharegetinfo '$SHARENAME'" |
60 grep path: | sed -e 's/.*path:\t//')
61 test "$SHAREPATH" = "$SHAREPATH_RET"
62 RC=$?
63 testit "verifying share path" test $RC -eq 0 || failed=$(expr $failed + 1)
65 # Set CSC policy
67 $RPCCLIENTCMD -c "netsharesetdfsflags '$SHARENAME' 0x30"
68 RC=$?
69 testit "set csc policy" test $RC -eq 0 || failed=$(expr $failed + 1)
71 # Query CSC policy
73 CSC_CACHING_RET=$($RPCCLIENTCMD -c "netsharegetinfo '$SHARENAME' 1005" |
74 grep 'csc caching' | sed -e 's/.*csc caching: //')
75 testit "verifying csc policy" test $CSC_CACHING_RET -eq 3 ||
76 failed=$(expr $failed + 1)
78 # Delete share
80 $RPCCLIENTCMD -c "netsharedel '$SHARENAME'"
81 RC=$?
82 testit "deleting share" test $RC -eq 0 || failed=$(expr $failed + 1)
84 # Verify that query to deleted share fails
86 $RPCCLIENTCMD -c "netsharegetinfo '$SHARENAME' 1005"
87 RC=$?
88 testit "querying deleted share" test $RC -eq 1 || failed=$(expr $failed + 1)
90 testok $0 $failed