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"]
20 foreach section [lindex $args 0] {
21 set secname [lindex $section 0]
22 set contents [lindex $section 1]
26 foreach { line } $contents {
35 # Return filename of smb.conf file
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]
51 foreach { line } $contents {
61 # Create a smb.conf file
65 [list "netbios name = testing" \
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"]
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"
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"]
95 set smbclient_output2 [util_start "bin/smbclient -L //testing -N"]
96 verbose $smbclient_output2
98 if { [regexp "tmp.*Disk" $smbclient_output2] } {
106 util_start "killall" "smbd nmbd"