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
|
# File 'lib/ruby_smb/server/server_client/share_io.rb', line 22
def proxy_share_io_smb2(request, session)
if request..flags.related_operations == 0
share_processor = session.tree_connect_table[request..tree_id]
@smb2_related_operations_state[:tree_id] = request..tree_id
else
if @smb2_related_operations_state.fetch(:tree_id) == 0
response = SMB2::Packet::ErrorPacket.new
response..nt_status = WindowsError::NTStatus::STATUS_INVALID_PARAMETER
return response
end
share_processor = session.tree_connect_table[@smb2_related_operations_state[:tree_id]]
end
if share_processor.nil?
response = SMB2::Packet::ErrorPacket.new
response..nt_status = WindowsError::NTStatus::STATUS_NETWORK_NAME_DELETED
return response
end
if request.field_names.include?(:file_id)
if request..flags.related_operations == 0
@smb2_related_operations_state[:file_id] = request.file_id
elsif @smb2_related_operations_state[:file_id].nil?
response = SMB2::Packet::ErrorPacket.new
response..nt_status = WindowsError::NTStatus::STATUS_INVALID_HANDLE
return response
else
request.file_id = @smb2_related_operations_state[:file_id]
end
end
logger.debug("Received #{SMB2::Commands.name(request.smb2_header.command)} request for share: #{share_processor.provider.name}")
response = share_processor.share_io(__callee__, request)
if response.field_names.include?(:file_id)
@smb2_related_operations_state[:file_id] = response.file_id
end
response
end
|