blob: ccf5d06ea9ee0c86d4dff1f7663114daf60e2b8b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# An expect script to create a temporary file, map a share, copy the file to the share,
# and compare the contents of the two files.
# Copyright Brad Henry <brad@samba.org> 2006
# Released under the GNU GPL version 3 or later.
proc run_test { remote_prompt tmp_filename share_drive host_drive buildhost_ip buildhost_share username domain password } {
# Create the temp file on the windows host and connect to the samba share.
set host_tmpfile "$host_drive\\$tmp_filename"
set err_str [create_tmp_file $remote_prompt $host_tmpfile]
if { $err_str != "OK" } {
return $err_str
}
set buildhost_sharepoint "\\\\$buildhost_ip\\$buildhost_share"
set err_str [map_share $remote_prompt $share_drive $buildhost_sharepoint $username $domain $password]
if { $err_str != "OK" } {
return $err_str
}
# Copy the temp file to the share and compare its contents with the original.
set share_tmpfile "$share_drive\\$tmp_filename"
set xcopy_options ""
set err_str [xcopy_file $remote_prompt $host_tmpfile $share_tmpfile $xcopy_options]
if { $err_str != "OK" } {
return $err_str
}
set err_str [compare_files $remote_prompt $host_tmpfile $share_tmpfile]
if { $err_str != "OK" } {
return $err_str
}
# Remove files and unmap share.
set err_str [delete_file $remote_prompt $share_tmpfile]
if { $err_str != "OK" } {
return $err_str
}
set err_str [delete_file $remote_prompt $host_tmpfile]
if { $err_str != "OK" } {
return $err_str
}
set err_str [unmap_share $remote_prompt $share_drive]
if {$err_str != "OK" } {
return $err_str
}
return $err_str
}
# Read parameters.
set remote_prompt $env(SMBTORTURE_REMOTE_PROMPT)
set remote_host $env(SMBTORTURE_REMOTE_HOST)
set username $env(SMBTORTURE_USERNAME)
set password $env(SMBTORTURE_PASSWORD)
set timeout $env(SMBTORTURE_EXPECT_TIMEOUT)
set tmp_filename $env(SMBTORTURE_TMP_FILENAME)
set share_drive $env(SMBTORTURE_REMOTE_DRIVE_LETTER)
set host_drive "%HOMEDRIVE%"
set buildhost_ip $env(SMBTORTURE_LOCAL_IP)
set buildhost_share $env(SMBTORTURE_LOCAL_SHARE_NAME)
set buildhost_username $env(SMBTORTURE_LOCAL_USERNAME)
set buildhost_domain $env(SMBTORTURE_LOCAL_DOMAIN)
set buildhost_password $env(SMBTORTURE_LOCAL_PASSWORD)
set err_val [spawn $env(SHELL)]
if {$err_val == 0} {
puts stderr "Expect failed while spawning a shell process."
exit $err_val
}
set err_str [telnet_login $remote_prompt $remote_host $username $password]
if {$err_str != "OK"} {
puts stderr "\nFunction telnet_login failed during Samba server testing."
puts stderr "Error was: $err_str."
exit 1
}
set err_str [run_test $remote_prompt $tmp_filename $share_drive $host_drive $buildhost_ip $buildhost_share $buildhost_username $buildhost_domain $buildhost_password]
if {$err_str != "OK"} {
puts stderr "\nFunction run_test failed during Samba server testing."
puts stderr "Error was: $err_str."
# Log off from the telnet server.
send "exit\r\n"
exit 1
}
# Log off from the telnet server.
send "exit\r\n"
exit 0
|