summaryrefslogtreecommitdiffstats
path: root/source/script/tests/t_001.sh
blob: 7db2abe226e8d20218d73ee7195c796b86fd595e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh

. $SCRIPTDIR/functions

cat >$CONFFILE<<EOF
[global]
	include = $LIBDIR/common.conf
	smb ports = 139

[test]
	path = $PREFIX_ABS/tmp
	read only = no
EOF

##
## Test code 
##

/bin/rm -rf $PREFIX_ABS/tmp
mkdir $PREFIX_ABS/tmp
chmod 1777 $PREFIX_ABS/tmp

start_smbd || exit $?

## share enumeration

smbclient $CONFIGURATION -L localhost -N -p 139
check_ret_value $? 

testfile=`echo $CONFIGURATION | awk '{print $2}'`
filename=`basename $testfile`
dirname=`dirname $testfile`


# file get/put

smbclient //localhost/test $PASSWORD $CONFIGURATION -c "lcd $dirname; put $filename"
check_ret_value $? 

smbclient //localhost/test $PASSWORD $CONFIGURATION -c "get $filename; rm $filename"
check_ret_value $? 

diff $filename $testfile 2> /dev/null > /dev/null
check_ret_value $?

stop_smbd
exit 0