libnet: Fix Coverity ID 1634803 Dereference after null check
[samba4-gss.git] / source3 / script / tests / test_rofs.sh
blob72901e5845a7b31af292eb249b60d1d1323ad6dc
1 #!/usr/bin/env bash
2 # Test smbd handling EROFS when creating a file
3 # Copyright (C) 2023 Volker Lendecke
5 if [ $# -ne 4 ]; then
6 echo Usage: $0 SERVERCONFFILE SMBCLIENT SERVER SHARE
7 exit 1
8 fi
10 CONF=$1
11 shift 1
12 SMBCLIENT=$1
13 shift 1
14 SERVER=$1
15 shift 1
16 SHARE=$1
17 shift 1
19 incdir=$(dirname $0)/../../../testprogs/blackbox
20 . $incdir/subunit.sh
22 error_inject_conf=$(dirname ${SERVERCONFFILE})/error_inject.conf
23 echo "error_inject:openat_create = EROFS" >${error_inject_conf}
25 failed=0
27 out=$(${SMBCLIENT} //${SERVER}/${SHARE} ${CONF} -U${USER}%${PASSWORD} \
28 -c "put VERSION")
29 testit_grep "Expect MEDIA_WRITE_PROTECTED" NT_STATUS_MEDIA_WRITE_PROTECTED \
30 echo "$out" || failed=$(expr $failed + 1)
32 >${error_inject_conf}
34 testok $0 $failed