3 # Test rpcclient netfileenum
5 # Copyright (C) 2020 Volker Lendecke
9 SMBCLIENT RPCCLIENT NET SERVER SHARE
24 # Do not let deprecated option warnings muck this up
25 SAMBA_DEPRECATED_SUPPRESS
=1
26 export SAMBA_DEPRECATED_SUPPRESS
28 incdir
=$
(dirname $0)/..
/..
/..
/testprogs
/blackbox
33 cd $SELFTEST_TMPDIR ||
exit 1
35 rm -f smbclient-stdin smbclient-stdout smbclient-stderr
36 mkfifo smbclient-stdin smbclient-stdout smbclient-stderr
38 CLI_FORCE_INTERACTIVE
=1
39 export CLI_FORCE_INTERACTIVE
41 ${SMBCLIENT} //${SERVER}/${SHARE} ${CONF} -U${USER}%${PASSWORD} \
42 <smbclient-stdin
>smbclient-stdout
2>smbclient-stderr
&
47 exec 100>smbclient-stdin
101<smbclient-stdout
102<smbclient-stderr
49 # consume the smbclient startup messages
54 printf "open %s\\n" "$FILE" >&100
58 testit
"Create builtin\\administrators group" \
59 "${NET}" groupmap add \
60 sid
=S-1-5-32-544 unixgroup
="${USER}"-group type=builtin ||
61 failed
=$
((failed
+ 1))
62 testit
"Add ${USER} to builtin\\administrators" \
63 "${NET}" groupmap addmem S-1-5-32-544 \
64 $
("${NET}" lookup name
"${USER}" | cut
-d' ' -f1) ||
65 failed
=$
((failed
+ 1))
67 "${RPCCLIENT}" "${SERVER}" -U"${USER}"%"${PASSWORD}" -c netfileenum |
70 testit
"netfileenum" test $RC = 0 || failed
=$
((failed
+ 1))
73 rm -f smbclient-stdin smbclient-stdout smbclient-stderr
75 testit
"Remove ${USER} from builtin\\administrators" \
76 "${NET}" groupmap delmem S-1-5-32-544 \
77 $
("${NET}" lookup name
"${USER}" | cut
-d' ' -f1) ||
78 failed
=$
((failed
+ 1))
79 testit
"Remove builtin\\administrators group" \
80 "${NET}" groupmap delete \
82 failed
=$
((failed
+ 1))