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