s3/locking: pass file_id instead of lck to share_mode_watch_send()
[samba4-gss.git] / testsuite / smbd / sighup.exp
bloba9e1bffe11d4929576d923c790b45744ac9c51b9
2 # @(#) Check services file reloaded after SIGHUP
5 load_lib "util-defs.exp"
7 # Create a smb.conf file from a list of sections. Each section consists of
8 # a name and a list of lines which are the contents of that section.
9 # Returns a temporary filename which must be deleted after use.
11 proc write_smb_conf { args } {
13 # Set up temporary file
15 set name "/tmp/smb.conf-test-[pid]"
16 set f [open $name "w"]
18 # Parse sections
20 foreach section [lindex $args 0] {
21 set secname [lindex $section 0]
22 set contents [lindex $section 1]
24 puts $f "\[$secname]"
26 foreach { line } $contents {
27 puts $f "\t$line"
30 puts $f ""
33 close $f
35 # Return filename of smb.conf file
37 return $name
40 proc append_smb_conf { args } {
42 set name [lindex $args 0]
43 set f [open $name "a"]
45 foreach section [lindex $args 1] {
46 set secname [lindex $section 0]
47 set contents [lindex $section 1]
49 puts $f "\[$secname]"
51 foreach { line } $contents {
52 puts $f "\t$line"
55 puts $f ""
58 close $f
61 # Create a smb.conf file
63 set smb_conf [list \
64 [list "global" \
65 [list "netbios name = testing" \
66 "guest ok = true"]]]
68 set name [write_smb_conf $smb_conf]
70 # Run smbd and smbclient output
72 set smbd_output [util_start "bin/smbd" "-s $name"]
73 set nmbd_output [util_start "bin/nmbd" "-s $name"]
75 sleep 5
77 set smbclient_output [util_start "bin/smbclient -L //testing -N"]
78 verbose $smbclient_output
80 if { ![regexp "Anonymous login successful" $smbclient_output] } {
81 untested "smbd could not be started"
82 util_start "killall" "smbd nmbd"
83 file delete $name
84 return
87 # Append another share and sighup
89 append_smb_conf $name [list [list "tmp" [list "browseable = true"]]]
90 set output [util_start "killall" "-HUP smbd"]
91 verbose $output
93 sleep 2
95 set smbclient_output2 [util_start "bin/smbclient -L //testing -N"]
96 verbose $smbclient_output2
98 if { [regexp "tmp.*Disk" $smbclient_output2] } {
99 pass "sighup reload"
100 } else {
101 fail "sighup reload"
104 # Clean up
106 util_start "killall" "smbd nmbd"
107 file delete $name