fixed guest account for build farm boxes
[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         > $prefix/lib/smb.conf
7
8         echo "127.0.0.1    localhost">$prefix/lib/lmhosts
9     echo "127.0.0.1    SHARE">>$prefix/lib/lmhosts
10     echo "127.0.0.1    USER">>$prefix/lib/lmhosts
11     echo "127.0.0.1    SERVER">>$prefix/lib/lmhosts
12     echo "127.0.0.1    DOMAIN">>$prefix/lib/lmhosts
13     cp -f basicsmb.smb.conf.share $prefix/lib/smb.conf.share
14     cp -f basicsmb.smb.conf.user $prefix/lib/smb.conf.user
15     cp -f basicsmb.smb.conf.server $prefix/lib/smb.conf.server
16     cp -f basicsmb.smb.conf.domain $prefix/lib/smb.conf.domain
17     touch $prefix/lib/smb.conf.
18     touch $prefix/lib/smb.conf.localhost
19 }
20
21 test_smbpasswd() {
22         test_smbpasswd_password="$1"
23         rm -f $prefix/private/smbpasswd
24         echo "( echo $test_smbpasswd_password ; echo $test_smbpasswd_password; ) | $prefix/bin/smbpasswd -L -s -a $whoami"
25         ( echo $password ; echo $password; ) | $prefix/bin/smbpasswd -L -s -a $whoami
26         status=$?
27         if [ $status = 0 ]; then
28             echo "smbpasswd correctly set inital password ($test_smbpasswd_password)"
29         else
30             echo "smbpasswd failed to set inital password ($test_smbpasswd_password)! (status $status)"
31             return 1
32         fi
33         return 0
34 }
35
36 test_listfilesauth() {
37         remote_name="$1"
38         echo $prefix/bin/smbclient//$remote_name/samba  -n buildclient -U$whoami%$password -c 'ls'
39         $prefix/bin/smbclient //$remote_name/samba  -n buildclient -U$whoami%$password -c 'ls'
40         status=$?
41         if [ $status = 0 ]; then
42                 echo "listed files OK"
43         else 
44                 echo "listing files with smbd failed with status $status"
45                 return 1
46         fi
47         return 0
48 }
49
50 test_listfilesnpw() {
51         remote_name="$1"
52         echo $prefix/bin/smbclient //$remote_name/samba -n buildclient -U$whoami%  -c 'ls'
53         $prefix/bin/smbclient //$remote_name/samba -n buildclient -U$whoami% -c 'ls'
54         status=$?
55         if [ $status = 0 ]; then
56                 echo "smbd listed files with NO PASSWORD on an authenticated share!"
57                 return 1
58         else 
59                 echo "listing files with smbd failed with status $status (correct)"
60         fi
61         return 0
62 }
63