ruby_smb 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/examples/tree_connect.rb +27 -0
- data/lib/ruby_smb/client.rb +25 -2
- data/lib/ruby_smb/client/authentication.rb +5 -6
- data/lib/ruby_smb/client/negotiation.rb +2 -3
- data/lib/ruby_smb/client/signing.rb +6 -2
- data/lib/ruby_smb/client/tree_connect.rb +86 -0
- data/lib/ruby_smb/generic_packet.rb +1 -1
- data/lib/ruby_smb/smb1.rb +1 -1
- data/lib/ruby_smb/smb1/bit_field.rb +4 -0
- data/lib/ruby_smb/smb1/bit_field/directory_access_mask.rb +38 -0
- data/lib/ruby_smb/smb1/bit_field/file_access_mask.rb +38 -0
- data/lib/ruby_smb/smb1/bit_field/optional_support.rb +19 -0
- data/lib/ruby_smb/smb1/bit_field/tree_connect_flags.rb +18 -0
- data/lib/ruby_smb/smb1/commands.rb +2 -0
- data/lib/ruby_smb/smb1/packet.rb +4 -0
- data/lib/ruby_smb/smb1/packet/tree_connect_request.rb +34 -0
- data/lib/ruby_smb/smb1/packet/tree_connect_response.rb +74 -0
- data/lib/ruby_smb/smb1/packet/tree_disconnect_request.rb +29 -0
- data/lib/ruby_smb/smb1/packet/tree_disconnect_response.rb +30 -0
- data/lib/ruby_smb/smb1/tree.rb +55 -0
- data/lib/ruby_smb/smb2.rb +1 -0
- data/lib/ruby_smb/smb2/bit_field.rb +4 -0
- data/lib/ruby_smb/smb2/bit_field/directory_access_mask.rb +38 -0
- data/lib/ruby_smb/smb2/bit_field/file_access_mask.rb +38 -0
- data/lib/ruby_smb/smb2/bit_field/share_capabailities.rb +21 -0
- data/lib/ruby_smb/smb2/bit_field/share_flags.rb +75 -0
- data/lib/ruby_smb/smb2/packet.rb +5 -0
- data/lib/ruby_smb/smb2/packet/error_packet.rb +15 -0
- data/lib/ruby_smb/smb2/packet/tree_connect_request.rb +27 -0
- data/lib/ruby_smb/smb2/packet/tree_connect_response.rb +50 -0
- data/lib/ruby_smb/smb2/packet/tree_disconnect_request.rb +21 -0
- data/lib/ruby_smb/smb2/packet/tree_disconnect_response.rb +22 -0
- data/lib/ruby_smb/smb2/smb2_header.rb +3 -3
- data/lib/ruby_smb/smb2/tree.rb +51 -0
- data/lib/ruby_smb/version.rb +1 -1
- data/ruby_smb.gemspec +1 -1
- data/spec/lib/ruby_smb/client_spec.rb +114 -4
- data/spec/lib/ruby_smb/smb1/bit_field/directory_access_mask_spec.rb +190 -0
- data/spec/lib/ruby_smb/smb1/bit_field/file_access_mask_spec.rb +190 -0
- data/spec/lib/ruby_smb/smb1/bit_field/optional_support_spec.rb +52 -0
- data/spec/lib/ruby_smb/smb1/bit_field/tree_connect_flags_spec.rb +37 -0
- data/spec/lib/ruby_smb/smb1/packet/tree_connect_request_spec.rb +53 -0
- data/spec/lib/ruby_smb/smb1/packet/tree_connect_response_spec.rb +86 -0
- data/spec/lib/ruby_smb/smb1/packet/tree_disconnect_request_spec.rb +40 -0
- data/spec/lib/ruby_smb/smb1/packet/tree_disconnect_response_spec.rb +40 -0
- data/spec/lib/ruby_smb/smb1/tree_spec.rb +55 -0
- data/spec/lib/ruby_smb/smb2/bit_field/directory_access_mask_spec.rb +190 -0
- data/spec/lib/ruby_smb/smb2/bit_field/file_access_mask_spec.rb +190 -0
- data/spec/lib/ruby_smb/smb2/bit_field/share_capabilities_spec.rb +54 -0
- data/spec/lib/ruby_smb/smb2/bit_field/share_flags_spec.rb +184 -0
- data/spec/lib/ruby_smb/smb2/packet/tree_connect_request_spec.rb +49 -0
- data/spec/lib/ruby_smb/smb2/packet/tree_connect_response_spec.rb +57 -0
- data/spec/lib/ruby_smb/smb2/packet/tree_disconnect_request_spec.rb +30 -0
- data/spec/lib/ruby_smb/smb2/packet/tree_disconnect_response_spec.rb +30 -0
- data/spec/lib/ruby_smb/smb2/tree_spec.rb +54 -0
- metadata +63 -6
- metadata.gz.sig +0 -0
@@ -0,0 +1,190 @@
|
|
1
|
+
RSpec.describe RubySMB::SMB1::BitField::FileAccessMask do
|
2
|
+
subject(:flags) { described_class.new }
|
3
|
+
|
4
|
+
it { is_expected.to respond_to :read_attr }
|
5
|
+
it { is_expected.to respond_to :delete_child }
|
6
|
+
it { is_expected.to respond_to :execute }
|
7
|
+
it { is_expected.to respond_to :write_ea }
|
8
|
+
it { is_expected.to respond_to :read_ea }
|
9
|
+
it { is_expected.to respond_to :append_data }
|
10
|
+
it { is_expected.to respond_to :write_data }
|
11
|
+
it { is_expected.to respond_to :read_data }
|
12
|
+
it { is_expected.to respond_to :write_attr }
|
13
|
+
it { is_expected.to respond_to :synchronize }
|
14
|
+
it { is_expected.to respond_to :write_owner }
|
15
|
+
it { is_expected.to respond_to :write_dac }
|
16
|
+
it { is_expected.to respond_to :read_control }
|
17
|
+
it { is_expected.to respond_to :delete_access }
|
18
|
+
it { is_expected.to respond_to :generic_read }
|
19
|
+
it { is_expected.to respond_to :generic_write }
|
20
|
+
it { is_expected.to respond_to :generic_execute }
|
21
|
+
it { is_expected.to respond_to :generic_all }
|
22
|
+
it { is_expected.to respond_to :maximum }
|
23
|
+
it { is_expected.to respond_to :system_security }
|
24
|
+
|
25
|
+
it 'is little endian' do
|
26
|
+
expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#read_data' do
|
30
|
+
it 'should be a 1-bit field per the SMB spec' do
|
31
|
+
expect(flags.read_data).to be_a BinData::Bit1
|
32
|
+
end
|
33
|
+
|
34
|
+
it_behaves_like 'bit field with one flag set', :read_data, 'V', 0x00000001
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
describe '#write_data' do
|
39
|
+
it 'should be a 1-bit field per the SMB spec' do
|
40
|
+
expect(flags.write_data).to be_a BinData::Bit1
|
41
|
+
end
|
42
|
+
|
43
|
+
it_behaves_like 'bit field with one flag set', :write_data, 'V', 0x00000002
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#append_data' do
|
47
|
+
it 'should be a 1-bit field per the SMB spec' do
|
48
|
+
expect(flags.append_data).to be_a BinData::Bit1
|
49
|
+
end
|
50
|
+
|
51
|
+
it_behaves_like 'bit field with one flag set', :append_data, 'V', 0x00000004
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#read_ea' do
|
55
|
+
it 'should be a 1-bit field per the SMB spec' do
|
56
|
+
expect(flags.read_ea).to be_a BinData::Bit1
|
57
|
+
end
|
58
|
+
|
59
|
+
it_behaves_like 'bit field with one flag set', :read_ea, 'V', 0x00000008
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#write_ea' do
|
63
|
+
it 'should be a 1-bit field per the SMB spec' do
|
64
|
+
expect(flags.write_ea).to be_a BinData::Bit1
|
65
|
+
end
|
66
|
+
|
67
|
+
it_behaves_like 'bit field with one flag set', :write_ea, 'V', 0x00000010
|
68
|
+
end
|
69
|
+
|
70
|
+
describe '#execute' do
|
71
|
+
it 'should be a 1-bit field per the SMB spec' do
|
72
|
+
expect(flags.execute).to be_a BinData::Bit1
|
73
|
+
end
|
74
|
+
|
75
|
+
it_behaves_like 'bit field with one flag set', :execute, 'V', 0x00000020
|
76
|
+
end
|
77
|
+
|
78
|
+
describe '#delete_child' do
|
79
|
+
it 'should be a 1-bit field per the SMB spec' do
|
80
|
+
expect(flags.delete_child).to be_a BinData::Bit1
|
81
|
+
end
|
82
|
+
|
83
|
+
it_behaves_like 'bit field with one flag set', :delete_child, 'V', 0x00000040
|
84
|
+
end
|
85
|
+
|
86
|
+
describe '#read_attr' do
|
87
|
+
it 'should be a 1-bit field per the SMB spec' do
|
88
|
+
expect(flags.read_attr).to be_a BinData::Bit1
|
89
|
+
end
|
90
|
+
|
91
|
+
it_behaves_like 'bit field with one flag set', :read_attr, 'V', 0x00000080
|
92
|
+
end
|
93
|
+
|
94
|
+
describe '#write_attr' do
|
95
|
+
it 'should be a 1-bit field per the SMB spec' do
|
96
|
+
expect(flags.write_attr).to be_a BinData::Bit1
|
97
|
+
end
|
98
|
+
|
99
|
+
it_behaves_like 'bit field with one flag set', :write_attr, 'V', 0x00000100
|
100
|
+
end
|
101
|
+
|
102
|
+
describe '#delete_access' do
|
103
|
+
it 'should be a 1-bit field per the SMB spec' do
|
104
|
+
expect(flags.delete_access).to be_a BinData::Bit1
|
105
|
+
end
|
106
|
+
|
107
|
+
it_behaves_like 'bit field with one flag set', :delete_access, 'V', 0x00010000
|
108
|
+
end
|
109
|
+
|
110
|
+
describe '#read_control' do
|
111
|
+
it 'should be a 1-bit field per the SMB spec' do
|
112
|
+
expect(flags.read_control).to be_a BinData::Bit1
|
113
|
+
end
|
114
|
+
|
115
|
+
it_behaves_like 'bit field with one flag set', :read_control, 'V', 0x00020000
|
116
|
+
end
|
117
|
+
|
118
|
+
describe '#write_dac' do
|
119
|
+
it 'should be a 1-bit field per the SMB spec' do
|
120
|
+
expect(flags.write_dac).to be_a BinData::Bit1
|
121
|
+
end
|
122
|
+
|
123
|
+
it_behaves_like 'bit field with one flag set', :write_dac, 'V', 0x00040000
|
124
|
+
end
|
125
|
+
|
126
|
+
describe '#write_owner' do
|
127
|
+
it 'should be a 1-bit field per the SMB spec' do
|
128
|
+
expect(flags.write_owner).to be_a BinData::Bit1
|
129
|
+
end
|
130
|
+
|
131
|
+
it_behaves_like 'bit field with one flag set', :write_owner, 'V', 0x00080000
|
132
|
+
end
|
133
|
+
|
134
|
+
describe '#synchronize' do
|
135
|
+
it 'should be a 1-bit field per the SMB spec' do
|
136
|
+
expect(flags.synchronize).to be_a BinData::Bit1
|
137
|
+
end
|
138
|
+
|
139
|
+
it_behaves_like 'bit field with one flag set', :synchronize, 'V', 0x00100000
|
140
|
+
end
|
141
|
+
|
142
|
+
describe '#system_security' do
|
143
|
+
it 'should be a 1-bit field per the SMB spec' do
|
144
|
+
expect(flags.system_security).to be_a BinData::Bit1
|
145
|
+
end
|
146
|
+
|
147
|
+
it_behaves_like 'bit field with one flag set', :system_security, 'V', 0x01000000
|
148
|
+
end
|
149
|
+
|
150
|
+
describe '#maximum' do
|
151
|
+
it 'should be a 1-bit field per the SMB spec' do
|
152
|
+
expect(flags.maximum).to be_a BinData::Bit1
|
153
|
+
end
|
154
|
+
|
155
|
+
it_behaves_like 'bit field with one flag set', :maximum, 'V', 0x02000000
|
156
|
+
end
|
157
|
+
|
158
|
+
describe '#generic_all' do
|
159
|
+
it 'should be a 1-bit field per the SMB spec' do
|
160
|
+
expect(flags.generic_all).to be_a BinData::Bit1
|
161
|
+
end
|
162
|
+
|
163
|
+
it_behaves_like 'bit field with one flag set', :generic_all, 'V', 0x10000000
|
164
|
+
end
|
165
|
+
|
166
|
+
describe '#generic_execute' do
|
167
|
+
it 'should be a 1-bit field per the SMB spec' do
|
168
|
+
expect(flags.generic_execute).to be_a BinData::Bit1
|
169
|
+
end
|
170
|
+
|
171
|
+
it_behaves_like 'bit field with one flag set', :generic_execute, 'V', 0x20000000
|
172
|
+
end
|
173
|
+
|
174
|
+
describe '#generic_write' do
|
175
|
+
it 'should be a 1-bit field per the SMB spec' do
|
176
|
+
expect(flags.generic_write).to be_a BinData::Bit1
|
177
|
+
end
|
178
|
+
|
179
|
+
it_behaves_like 'bit field with one flag set', :generic_write, 'V', 0x40000000
|
180
|
+
end
|
181
|
+
|
182
|
+
describe '#generic_read' do
|
183
|
+
it 'should be a 1-bit field per the SMB spec' do
|
184
|
+
expect(flags.generic_read).to be_a BinData::Bit1
|
185
|
+
end
|
186
|
+
|
187
|
+
it_behaves_like 'bit field with one flag set', :generic_read, 'V', 0x80000000
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
RSpec.describe RubySMB::SMB1::BitField::OptionalSupport do
|
2
|
+
subject(:flags) { described_class.new }
|
3
|
+
|
4
|
+
it { is_expected.to respond_to :search }
|
5
|
+
it { is_expected.to respond_to :dfs }
|
6
|
+
it { is_expected.to respond_to :csc_mask }
|
7
|
+
it { is_expected.to respond_to :unique_filename }
|
8
|
+
it { is_expected.to respond_to :extended_signature }
|
9
|
+
|
10
|
+
it 'is little endian' do
|
11
|
+
expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#search' do
|
15
|
+
it 'should be a 1-bit field per the SMB spec' do
|
16
|
+
expect(flags.search).to be_a BinData::Bit1
|
17
|
+
end
|
18
|
+
|
19
|
+
it_behaves_like 'bit field with one flag set', :search, 'v', 0x0001
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#dfs' do
|
23
|
+
it 'should be a 1-bit field per the SMB spec' do
|
24
|
+
expect(flags.dfs).to be_a BinData::Bit1
|
25
|
+
end
|
26
|
+
|
27
|
+
it_behaves_like 'bit field with one flag set', :dfs, 'v', 0x0002
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#csc_mask' do
|
31
|
+
it 'should be a 2-bit field per the SMB spec' do
|
32
|
+
expect(flags.csc_mask).to be_a BinData::Bit2
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#unique_filename' do
|
37
|
+
it 'should be a 1-bit field per the SMB spec' do
|
38
|
+
expect(flags.unique_filename).to be_a BinData::Bit1
|
39
|
+
end
|
40
|
+
|
41
|
+
it_behaves_like 'bit field with one flag set', :unique_filename, 'v', 0x0010
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '#extended_signature' do
|
45
|
+
it 'should be a 1-bit field per the SMB spec' do
|
46
|
+
expect(flags.extended_signature).to be_a BinData::Bit1
|
47
|
+
end
|
48
|
+
|
49
|
+
it_behaves_like 'bit field with one flag set', :extended_signature, 'v', 0x0020
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
RSpec.describe RubySMB::SMB1::BitField::TreeConnectFlags do
|
2
|
+
subject(:flags) { described_class.new }
|
3
|
+
|
4
|
+
it { is_expected.to respond_to :extended_response }
|
5
|
+
it { is_expected.to respond_to :extended_signature }
|
6
|
+
it { is_expected.to respond_to :disconnect }
|
7
|
+
|
8
|
+
it 'is little endian' do
|
9
|
+
expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#extended_response' do
|
13
|
+
it 'should be a 1-bit field per the SMB spec' do
|
14
|
+
expect(flags.extended_response).to be_a BinData::Bit1
|
15
|
+
end
|
16
|
+
|
17
|
+
it_behaves_like 'bit field with one flag set', :extended_response, 'C', 0x08
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#extended_signature' do
|
21
|
+
it 'should be a 1-bit field per the SMB spec' do
|
22
|
+
expect(flags.extended_signature).to be_a BinData::Bit1
|
23
|
+
end
|
24
|
+
|
25
|
+
it_behaves_like 'bit field with one flag set', :extended_signature, 'C', 0x04
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#disconnect' do
|
29
|
+
it 'should be a 1-bit field per the SMB spec' do
|
30
|
+
expect(flags.disconnect).to be_a BinData::Bit1
|
31
|
+
end
|
32
|
+
|
33
|
+
it_behaves_like 'bit field with one flag set', :disconnect, 'C', 0x01
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe RubySMB::SMB1::Packet::TreeConnectRequest do
|
4
|
+
|
5
|
+
subject(:packet) { described_class.new }
|
6
|
+
|
7
|
+
describe '#smb_header' do
|
8
|
+
subject(:header) { packet.smb_header }
|
9
|
+
|
10
|
+
it 'is a standard SMB Header' do
|
11
|
+
expect(header).to be_a RubySMB::SMB1::SMBHeader
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should have the command set to SMB_COM_NEGOTIATE' do
|
15
|
+
expect(header.command).to eq RubySMB::SMB1::Commands::SMB_COM_TREE_CONNECT
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should not have the response flag set' do
|
19
|
+
expect(header.flags.reply).to eq 0
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#parameter_block' do
|
24
|
+
subject(:parameter_block) { packet.parameter_block }
|
25
|
+
|
26
|
+
it 'is a standard ParameterBlock' do
|
27
|
+
expect(parameter_block).to be_a RubySMB::SMB1::ParameterBlock
|
28
|
+
end
|
29
|
+
|
30
|
+
it { is_expected.to respond_to :andx_block }
|
31
|
+
it { is_expected.to respond_to :flags }
|
32
|
+
it { is_expected.to respond_to :password_length }
|
33
|
+
|
34
|
+
it 'has an AndXBlock' do
|
35
|
+
expect(parameter_block.andx_block).to be_a RubySMB::SMB1::AndXBlock
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '#data_block' do
|
40
|
+
subject(:data_block) { packet.data_block }
|
41
|
+
|
42
|
+
it 'is a standard DataBlock' do
|
43
|
+
expect(data_block).to be_a RubySMB::SMB1::DataBlock
|
44
|
+
end
|
45
|
+
|
46
|
+
it { is_expected.to respond_to :password }
|
47
|
+
it { is_expected.to respond_to :path }
|
48
|
+
it { is_expected.to respond_to :service }
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe RubySMB::SMB1::Packet::TreeConnectResponse do
|
4
|
+
|
5
|
+
subject(:packet) { described_class.new }
|
6
|
+
|
7
|
+
describe '#smb_header' do
|
8
|
+
subject(:header) { packet.smb_header }
|
9
|
+
|
10
|
+
it 'is a standard SMB Header' do
|
11
|
+
expect(header).to be_a RubySMB::SMB1::SMBHeader
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should have the command set to SMB_COM_NEGOTIATE' do
|
15
|
+
expect(header.command).to eq RubySMB::SMB1::Commands::SMB_COM_TREE_CONNECT
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should have the response flag set' do
|
19
|
+
expect(header.flags.reply).to eq 1
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#parameter_block' do
|
24
|
+
subject(:parameter_block) { packet.parameter_block }
|
25
|
+
|
26
|
+
it 'is a standard ParameterBlock' do
|
27
|
+
expect(parameter_block).to be_a RubySMB::SMB1::ParameterBlock
|
28
|
+
end
|
29
|
+
|
30
|
+
it { is_expected.to respond_to :andx_block }
|
31
|
+
it { is_expected.to respond_to :optional_support }
|
32
|
+
it { is_expected.to respond_to :access_rights }
|
33
|
+
it { is_expected.to respond_to :guest_access_rights }
|
34
|
+
|
35
|
+
it 'has an AndXBlock' do
|
36
|
+
expect(parameter_block.andx_block).to be_a RubySMB::SMB1::AndXBlock
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#data_block' do
|
42
|
+
subject(:data_block) { packet.data_block }
|
43
|
+
|
44
|
+
it 'is a standard DataBlock' do
|
45
|
+
expect(data_block).to be_a RubySMB::SMB1::DataBlock
|
46
|
+
end
|
47
|
+
|
48
|
+
it { is_expected.to respond_to :service }
|
49
|
+
it { is_expected.to respond_to :native_file_system }
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'when the connect is to a directory' do
|
54
|
+
let(:directory_response) {
|
55
|
+
packet = described_class.new
|
56
|
+
packet.data_block.service = 'A:'
|
57
|
+
packet
|
58
|
+
}
|
59
|
+
|
60
|
+
it 'returns a DirectoryAccessMask from #access_rights' do
|
61
|
+
expect(directory_response.access_rights).to be_a RubySMB::SMB1::BitField::DirectoryAccessMask
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'returns a DirectoryAccessMask from #guest_access_rights' do
|
65
|
+
expect(directory_response.guest_access_rights).to be_a RubySMB::SMB1::BitField::DirectoryAccessMask
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'when the connect is to a named pipe' do
|
70
|
+
let(:file_response) {
|
71
|
+
packet = described_class.new
|
72
|
+
packet.data_block.service = 'IPC'
|
73
|
+
packet
|
74
|
+
}
|
75
|
+
|
76
|
+
it 'returns a FileAccessMask from #access_rights' do
|
77
|
+
expect(file_response.access_rights).to be_a RubySMB::SMB1::BitField::FileAccessMask
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'returns a FileAccessMask from #guest_access_rights' do
|
81
|
+
expect(file_response.guest_access_rights).to be_a RubySMB::SMB1::BitField::FileAccessMask
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe RubySMB::SMB1::Packet::TreeDisconnectRequest do
|
4
|
+
|
5
|
+
subject(:packet) { described_class.new }
|
6
|
+
|
7
|
+
describe '#smb_header' do
|
8
|
+
subject(:header) { packet.smb_header }
|
9
|
+
|
10
|
+
it 'is a standard SMB Header' do
|
11
|
+
expect(header).to be_a RubySMB::SMB1::SMBHeader
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should have the command set to SMB_COM_NEGOTIATE' do
|
15
|
+
expect(header.command).to eq RubySMB::SMB1::Commands::SMB_COM_TREE_DISCONNECT
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should not have the response flag set' do
|
19
|
+
expect(header.flags.reply).to eq 0
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#parameter_block' do
|
24
|
+
subject(:parameter_block) { packet.parameter_block }
|
25
|
+
|
26
|
+
it 'is a standard ParameterBlock' do
|
27
|
+
expect(parameter_block).to be_a RubySMB::SMB1::ParameterBlock
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#data_block' do
|
32
|
+
subject(:data_block) { packet.data_block }
|
33
|
+
|
34
|
+
it 'is a standard DataBlock' do
|
35
|
+
expect(data_block).to be_a RubySMB::SMB1::DataBlock
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
end
|