Fixed typo.
[nivanova/samba-autobuild/.git] / testsuite / build_farm / basicsmb.fns
1 test_smb_conf_setup() {
2         cat basicsmb.smb.conf.template | \
3               sed "s|PREFIX|$prefix|g" | \
4               sed "s|BUILD_FARM|$pwd|g" | \
5               sed "s|WHOAMI|$whoami|g" | \
6               sed "s|LOGLEVEL|$loglevel|g" \
7         > $prefix/lib/smb.conf
8
9         echo "127.0.0.1    localhost">$prefix/lib/lmhosts
10         echo "127.0.0.1    BUILDFARM">>$prefix/lib/lmhosts
11     echo "127.0.0.1    SHARE">>$prefix/lib/lmhosts
12     echo "127.0.0.1    USER">>$prefix/lib/lmhosts
13     echo "127.0.0.1    SERVER">>$prefix/lib/lmhosts
14     echo "127.0.0.1    DOMAIN">>$prefix/lib/lmhosts
15     cp basicsmb.smb.conf.share $prefix/lib/smb.conf.share
16     cp basicsmb.smb.conf.user $prefix/lib/smb.conf.user
17     cp basicsmb.smb.conf.server $prefix/lib/smb.conf.server
18     cp basicsmb.smb.conf.domain $prefix/lib/smb.conf.domain
19     touch $prefix/lib/smb.conf.
20     touch $prefix/lib/smb.conf.localhost
21 }
22
23 test_smbpasswd() {
24         test_smbpasswd_password="$1"
25         rm -f $prefix/private/smbpasswd
26         echo "( echo $test_smbpasswd_password ; echo $test_smbpasswd_password; ) | $prefix/bin/smbpasswd -L -s -a $whoami"
27         ( echo $password ; echo $password; ) | $prefix/bin/smbpasswd -L -s -a $whoami
28         status=$?
29         if [ $status = 0 ]; then
30             echo "smbpasswd correctly set initial password ($test_smbpasswd_password)"
31         else
32             echo "smbpasswd failed to set initial password ($test_smbpasswd_password)! (status $status)"
33             return 1
34         fi
35         return 0
36 }
37
38 test_listfilesauth() {
39         remote_name="$1"
40         echo $prefix/bin/smbclient//$remote_name/samba  -n buildclient -U$whoami%$password -c 'ls'
41         $prefix/bin/smbclient //$remote_name/samba  -n buildclient -U$whoami%$password -c 'ls'
42         status=$?
43         if [ $status = 0 ]; then
44                 echo "listed files OK"
45         else 
46                 echo "listing files with smbd failed with status $status"
47                 return 1
48         fi
49         return 0
50 }
51
52 test_listfilesnpw() {
53         remote_name="$1"
54         echo $prefix/bin/smbclient //$remote_name/samba -n buildclient -U$whoami%  -c 'ls'
55         $prefix/bin/smbclient //$remote_name/samba -n buildclient -U$whoami% -c 'ls'
56         status=$?
57         if [ $status = 0 ]; then
58                 echo "smbd listed files with NO PASSWORD on an authenticated share!"
59                 return 1
60         else 
61                 echo "listing files with smbd failed with status $status (correct)"
62         fi
63         return 0
64 }
65