summaryrefslogtreecommitdiffstats
path: root/testsuite/build_farm/basicsmb.test
blob: 27808a434f21a76deaaed8e3825ae5ed870f42ac (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
49
50
51
52
53
54
55
56
57
test_smb_conf_setup() {
	cat basicsmb.smb.conf.template | sed "s|PREFIX|$prefix|g" | sed "s|BUILD_FARM|$pwd|g" > $prefix/lib/smb.conf
	echo "Setting up smb.conf:"
	cat $prefix/lib/smb.conf

}

test_smbpasswd() {
	( echo $password ; echo $password; ) | $prefix/bin/smbpasswd -L -s -a $whoami
	status=$?
	if [ $status = 0 ]; then
	    echo "smbpasswd correctly set inital password ($password)"
	else
	    echo "smbpasswd failed to set inital password ($password)!"
	    return 1
	fi
	return 0
}

test_sharelist() {
	if $prefix/bin/smbclient -U$whoami% -L $host; then
		echo "smbd listed shares OK"
	else
		echo "listing shares with smbd failed with $?"
		return 1
	fi
	return 0
}

test_listfiles() {
	if $prefix/bin/smbclient //$host/samba -U$whoami% -c 'ls'; then
		echo "listed files OK"
	else 
		echo "listing files with smbd failed with $?"
		return 1
	fi
	return 0
}

test_listfilesauth() {
	if $prefix/bin/smbclient //$host/samba_2_2 -U$whoami%$password -c 'ls'; then
		echo "listed files OK"
	else 
		echo "listing files with smbd failed with $?"
		return 1
	fi
	return 0
}


(test_smb_conf_setup && test_smbpasswd) || exit 1

test_sharelist
test_listfiles
test_listfilesauth