/src/wireshark/epan/dissectors/packet-smb2.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* packet-smb2.c |
2 | | * Routines for smb2 packet dissection |
3 | | * Ronnie Sahlberg 2005 |
4 | | * |
5 | | * For documentation of this protocol, see: |
6 | | * |
7 | | * https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/ |
8 | | * https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/ |
9 | | * https://gitlab.com/wireshark/wireshark/-/wikis/SMB2 |
10 | | * |
11 | | * If you edit this file, keep the wiki updated as well. |
12 | | * |
13 | | * Wireshark - Network traffic analyzer |
14 | | * By Gerald Combs <gerald@wireshark.org> |
15 | | * Copyright 1998 Gerald Combs |
16 | | * |
17 | | * SPDX-License-Identifier: GPL-2.0-or-later |
18 | | */ |
19 | | |
20 | 0 | #define WS_LOG_DOMAIN "packet-smb2" |
21 | | #include "config.h" |
22 | | #include <wireshark.h> |
23 | | |
24 | | #include <epan/packet.h> |
25 | | #include <epan/exceptions.h> |
26 | | #include <epan/prefs.h> |
27 | | #include <epan/expert.h> |
28 | | #include <epan/tap.h> |
29 | | #include <epan/srt_table.h> |
30 | | #include <epan/aftypes.h> |
31 | | #include <epan/to_str.h> |
32 | | #include <epan/strutil.h> |
33 | | #include <epan/asn1.h> |
34 | | #include <epan/reassemble.h> |
35 | | #include <epan/uat.h> |
36 | | #include <epan/tfs.h> |
37 | | #include <wsutil/array.h> |
38 | | |
39 | | #include "packet-smb2.h" |
40 | | #include "packet-ntlmssp.h" |
41 | | #include "packet-kerberos.h" |
42 | | #include "packet-windows-common.h" |
43 | | #include "packet-dcerpc-nt.h" |
44 | | |
45 | | #include "read_keytab_file.h" |
46 | | |
47 | | #include <wsutil/wsgcrypt.h> |
48 | | #include <wsutil/ws_roundup.h> |
49 | | #include <wsutil/crc32.h> |
50 | | |
51 | | |
52 | | #ifdef _WIN32 |
53 | | #include <windows.h> |
54 | | #else |
55 | | /* Defined in winnt.h */ |
56 | 14 | #define OWNER_SECURITY_INFORMATION 0x00000001 |
57 | 14 | #define GROUP_SECURITY_INFORMATION 0x00000002 |
58 | 14 | #define DACL_SECURITY_INFORMATION 0x00000004 |
59 | 14 | #define SACL_SECURITY_INFORMATION 0x00000008 |
60 | 14 | #define LABEL_SECURITY_INFORMATION 0x00000010 |
61 | 14 | #define ATTRIBUTE_SECURITY_INFORMATION 0x00000020 |
62 | 14 | #define SCOPE_SECURITY_INFORMATION 0x00000040 |
63 | 14 | #define BACKUP_SECURITY_INFORMATION 0x00010000 |
64 | | #endif |
65 | | |
66 | 0 | #define NT_STATUS_PENDING 0x00000103 |
67 | 0 | #define NT_STATUS_BUFFER_TOO_SMALL 0xC0000023 |
68 | 0 | #define NT_STATUS_STOPPED_ON_SYMLINK 0x8000002D |
69 | 0 | #define NT_STATUS_BAD_NETWORK_NAME 0xC00000CC |
70 | | |
71 | | void proto_register_smb2(void); |
72 | | void proto_reg_handoff_smb2(void); |
73 | | |
74 | 47 | #define SMB2_NORM_HEADER 0xFE |
75 | 48 | #define SMB2_ENCR_HEADER 0xFD |
76 | 49 | #define SMB2_COMP_HEADER 0xFC |
77 | | |
78 | | static wmem_map_t *smb2_sessions; |
79 | | |
80 | | static const char smb_header_label[] = "SMB2 Header"; |
81 | | static const char smb_transform_header_label[] = "SMB2 Transform Header"; |
82 | | static const char smb_comp_transform_header_label[] = "SMB2 Compression Transform Header"; |
83 | | static const char smb_bad_header_label[] = "Bad SMB2 Header"; |
84 | | |
85 | | static int proto_smb2; |
86 | | static int hf_smb2_cmd; |
87 | | static int hf_smb2_nt_status; |
88 | | static int hf_smb2_response_to; |
89 | | static int hf_smb2_response_in; |
90 | | static int hf_smb2_time_req; |
91 | | static int hf_smb2_time_resp; |
92 | | static int hf_smb2_preauth_hash; |
93 | | static int hf_smb2_header_len; |
94 | | static int hf_smb2_msg_id; |
95 | | static int hf_smb2_header_reserved; |
96 | | static int hf_smb2_tid; |
97 | | static int hf_smb2_aid; |
98 | | static int hf_smb2_sesid; |
99 | | static int hf_smb2_previous_sesid; |
100 | | static int hf_smb2_flags_response; |
101 | | static int hf_smb2_flags_async_cmd; |
102 | | static int hf_smb2_flags_dfs_op; |
103 | | static int hf_smb2_flags_chained; |
104 | | static int hf_smb2_flags_signature; |
105 | | static int hf_smb2_flags_replay_operation; |
106 | | static int hf_smb2_flags_priority_mask; |
107 | | static int hf_smb2_chain_offset; |
108 | | static int hf_smb2_security_blob; |
109 | | static int hf_smb2_ioctl_in_data; |
110 | | static int hf_smb2_ioctl_out_data; |
111 | | static int hf_smb2_unknown; |
112 | | static int hf_smb2_root_directory_mbz; |
113 | | static int hf_smb2_twrp_timestamp; |
114 | | static int hf_smb2_mxac_timestamp; |
115 | | static int hf_smb2_mxac_status; |
116 | | static int hf_smb2_qfid_fid; |
117 | | static int hf_smb2_create_timestamp; |
118 | | static int hf_smb2_oplock; |
119 | | static int hf_smb2_close_flags; |
120 | | static int hf_smb2_notify_flags; |
121 | | static int hf_smb2_last_access_timestamp; |
122 | | static int hf_smb2_last_write_timestamp; |
123 | | static int hf_smb2_last_change_timestamp; |
124 | | static int hf_smb2_current_time; |
125 | | static int hf_smb2_boot_time; |
126 | | static int hf_smb2_filename; |
127 | | static int hf_smb2_filename_len; |
128 | | static int hf_frame_handle_opened; |
129 | | static int hf_frame_handle_closed; |
130 | | static int hf_smb2_replace_if; |
131 | | static int hf_smb2_nlinks; |
132 | | static int hf_smb2_delete_pending; |
133 | | static int hf_smb2_is_directory; |
134 | | static int hf_smb2_file_id; |
135 | | static int hf_smb2_allocation_size; |
136 | | static int hf_smb2_end_of_file; |
137 | | static int hf_smb2_tree; |
138 | | static int hf_smb2_find_pattern; |
139 | | static int hf_smb2_find_info_level; |
140 | | static int hf_smb2_find_info_blob; |
141 | | static int hf_smb2_client_guid; |
142 | | static int hf_smb2_server_guid; |
143 | | static int hf_smb2_object_id; |
144 | | static int hf_smb2_birth_volume_id; |
145 | | static int hf_smb2_birth_object_id; |
146 | | static int hf_smb2_domain_id; |
147 | | static int hf_smb2_class; |
148 | | static int hf_smb2_infolevel; |
149 | | static int hf_smb2_infolevel_file_info; |
150 | | static int hf_smb2_infolevel_fs_info; |
151 | | static int hf_smb2_infolevel_sec_info; |
152 | | static int hf_smb2_max_response_size; |
153 | | static int hf_smb2_max_ioctl_in_size; |
154 | | static int hf_smb2_max_ioctl_out_size; |
155 | | static int hf_smb2_flags; |
156 | | static int hf_smb2_required_buffer_size; |
157 | | static int hf_smb2_getinfo_input_size; |
158 | | static int hf_smb2_getinfo_input_offset; |
159 | | static int hf_smb2_getsetinfo_additional; |
160 | | static int hf_smb2_getsetinfo_additionals; |
161 | | static int hf_smb2_getsetinfo_additional_owner; |
162 | | static int hf_smb2_getsetinfo_additional_group; |
163 | | static int hf_smb2_getsetinfo_additional_dacl; |
164 | | static int hf_smb2_getsetinfo_additional_sacl; |
165 | | static int hf_smb2_getsetinfo_additional_label; |
166 | | static int hf_smb2_getsetinfo_additional_attribute; |
167 | | static int hf_smb2_getsetinfo_additional_scope; |
168 | | static int hf_smb2_getsetinfo_additional_backup; |
169 | | static int hf_smb2_getinfo_flags; |
170 | | static int hf_smb2_setinfo_size; |
171 | | static int hf_smb2_setinfo_offset; |
172 | | static int hf_smb2_setinfo_reserved; |
173 | | static int hf_smb2_file_basic_info; |
174 | | static int hf_smb2_file_standard_info; |
175 | | static int hf_smb2_file_internal_info; |
176 | | static int hf_smb2_file_ea_info; |
177 | | static int hf_smb2_file_access_info; |
178 | | static int hf_smb2_file_rename_info; |
179 | | static int hf_smb2_file_link_info; |
180 | | static int hf_smb2_file_disposition_info; |
181 | | static int hf_smb2_file_position_info; |
182 | | static int hf_smb2_file_full_ea_info; |
183 | | static int hf_smb2_file_mode_info; |
184 | | static int hf_smb2_file_alignment_info; |
185 | | static int hf_smb2_file_all_info; |
186 | | static int hf_smb2_file_allocation_info; |
187 | | static int hf_smb2_file_endoffile_info; |
188 | | static int hf_smb2_file_alternate_name_info; |
189 | | static int hf_smb2_file_stream_info; |
190 | | static int hf_smb2_file_pipe_info; |
191 | | static int hf_smb2_file_pipe_local_info; |
192 | | static int hf_smb2_file_pipe_remote_info; |
193 | | static int hf_smb2_file_compression_info; |
194 | | static int hf_smb2_file_network_open_info; |
195 | | static int hf_smb2_file_attribute_tag_info; |
196 | | static int hf_smb2_file_normalized_name_info; |
197 | | static int hf_smb2_fs_info_01; |
198 | | static int hf_smb2_fs_info_03; |
199 | | static int hf_smb2_fs_info_04; |
200 | | static int hf_smb2_fs_info_05; |
201 | | static int hf_smb2_fs_info_06; |
202 | | static int hf_smb2_fs_info_07; |
203 | | static int hf_smb2_fs_objectid_info; |
204 | | static int hf_smb2_fs_posix_info; |
205 | | static int hf_smb2_fs_posix_optimal_transfer_size; |
206 | | static int hf_smb2_fs_posix_block_size; |
207 | | static int hf_smb2_fs_posix_total_blocks; |
208 | | static int hf_smb2_fs_posix_blocks_available; |
209 | | static int hf_smb2_fs_posix_user_blocks_available; |
210 | | static int hf_smb2_fs_posix_total_file_nodes; |
211 | | static int hf_smb2_fs_posix_free_file_nodes; |
212 | | static int hf_smb2_fs_posix_fs_identifier; |
213 | | static int hf_smb2_sec_info_00; |
214 | | static int hf_smb2_quota_info; |
215 | | static int hf_smb2_query_quota_info; |
216 | | static int hf_smb2_qq_single; |
217 | | static int hf_smb2_qq_restart; |
218 | | static int hf_smb2_qq_sidlist_len; |
219 | | static int hf_smb2_qq_start_sid_len; |
220 | | static int hf_smb2_qq_start_sid_offset; |
221 | | static int hf_smb2_fid; |
222 | | static int hf_smb2_write_length; |
223 | | static int hf_smb2_write_data; |
224 | | static int hf_smb2_write_flags; |
225 | | static int hf_smb2_write_flags_write_through; |
226 | | static int hf_smb2_write_flags_write_unbuffered; |
227 | | static int hf_smb2_write_count; |
228 | | static int hf_smb2_write_remaining; |
229 | | static int hf_smb2_read_blob; |
230 | | static int hf_smb2_read_length; |
231 | | static int hf_smb2_read_remaining; |
232 | | static int hf_smb2_read_padding; |
233 | | static int hf_smb2_read_flags; |
234 | | static int hf_smb2_read_flags_unbuffered; |
235 | | static int hf_smb2_read_flags_compressed; |
236 | | static int hf_smb2_file_offset; |
237 | | static int hf_smb2_qfr_length; |
238 | | static int hf_smb2_qfr_usage; |
239 | | static int hf_smb2_qfr_flags; |
240 | | static int hf_smb2_qfr_total_region_entry_count; |
241 | | static int hf_smb2_qfr_region_entry_count; |
242 | | static int hf_smb2_read_data; |
243 | | static int hf_smb2_disposition_delete_on_close; |
244 | | static int hf_smb2_create_disposition; |
245 | | static int hf_smb2_create_chain_offset; |
246 | | static int hf_smb2_create_chain_data; |
247 | | static int hf_smb2_data_offset; |
248 | | static int hf_smb2_extrainfo; |
249 | | static int hf_smb2_create_action; |
250 | | static int hf_smb2_create_rep_flags; |
251 | | static int hf_smb2_create_rep_flags_reparse_point; |
252 | | static int hf_smb2_next_offset; |
253 | | static int hf_smb2_negotiate_context_type; |
254 | | static int hf_smb2_negotiate_context_data_length; |
255 | | static int hf_smb2_negotiate_context_offset; |
256 | | static int hf_smb2_negotiate_context_reserved; |
257 | | static int hf_smb2_negotiate_context_reserved2; |
258 | | static int hf_smb2_negotiate_context_count; |
259 | | static int hf_smb2_hash_alg_count; |
260 | | static int hf_smb2_hash_algorithm; |
261 | | static int hf_smb2_salt_length; |
262 | | static int hf_smb2_salt; |
263 | | static int hf_smb2_cipher_count; |
264 | | static int hf_smb2_cipher_id; |
265 | | static int hf_smb2_signing_alg_count; |
266 | | static int hf_smb2_signing_alg_id; |
267 | | static int hf_smb2_comp_alg_count; |
268 | | static int hf_smb2_comp_alg_id; |
269 | | static int hf_smb2_comp_alg_flags; |
270 | | static int hf_smb2_comp_alg_flags_chained; |
271 | | static int hf_smb2_comp_alg_flags_reserved; |
272 | | static int hf_smb2_netname_neg_id; |
273 | | static int hf_smb2_transport_ctx_flags; |
274 | | static int hf_smb2_rdma_transform_count; |
275 | | static int hf_smb2_rdma_transform_reserved1; |
276 | | static int hf_smb2_rdma_transform_reserved2; |
277 | | static int hf_smb2_rdma_transform_id; |
278 | | static int hf_smb2_posix_reserved; |
279 | | static int hf_smb2_dev; |
280 | | static int hf_smb2_inode; |
281 | | static int hf_smb2_ea_size; |
282 | | static int hf_smb2_ea_flags; |
283 | | static int hf_smb2_ea_name_len; |
284 | | static int hf_smb2_ea_data_len; |
285 | | static int hf_smb2_ea_name; |
286 | | static int hf_smb2_ea_data; |
287 | | static int hf_smb2_position_information; |
288 | | static int hf_smb2_mode_information; |
289 | | static int hf_smb2_mode_file_write_through; |
290 | | static int hf_smb2_mode_file_sequential_only; |
291 | | static int hf_smb2_mode_file_no_intermediate_buffering; |
292 | | static int hf_smb2_mode_file_synchronous_io_alert; |
293 | | static int hf_smb2_mode_file_synchronous_io_nonalert; |
294 | | static int hf_smb2_mode_file_delete_on_close; |
295 | | static int hf_smb2_alignment_information; |
296 | | static int hf_smb2_buffer_code; |
297 | | static int hf_smb2_buffer_code_len; |
298 | | static int hf_smb2_buffer_code_flags_dyn; |
299 | | static int hf_smb2_olb_offset; |
300 | | static int hf_smb2_olb_length; |
301 | | static int hf_smb2_tag; |
302 | | static int hf_smb2_impersonation_level; |
303 | | static int hf_smb2_ioctl_function; |
304 | | static int hf_smb2_ioctl_function_device; |
305 | | static int hf_smb2_ioctl_function_access; |
306 | | static int hf_smb2_ioctl_function_function; |
307 | | static int hf_smb2_fsctl_pipe_wait_timeout; |
308 | | static int hf_smb2_fsctl_pipe_wait_name; |
309 | | |
310 | | static int hf_smb2_fsctl_odx_token_type; |
311 | | static int hf_smb2_fsctl_odx_token_idlen; |
312 | | static int hf_smb2_fsctl_odx_token_idraw; |
313 | | static int hf_smb2_fsctl_odx_token_ttl; |
314 | | static int hf_smb2_fsctl_odx_size; |
315 | | static int hf_smb2_fsctl_odx_flags; |
316 | | static int hf_smb2_fsctl_odx_file_offset; |
317 | | static int hf_smb2_fsctl_odx_copy_length; |
318 | | static int hf_smb2_fsctl_odx_xfer_length; |
319 | | static int hf_smb2_fsctl_odx_token_offset; |
320 | | |
321 | | static int hf_smb2_fsctl_infoex_enable_integrity; |
322 | | static int hf_smb2_fsctl_infoex_keep_integrity_state; |
323 | | static int hf_smb2_fsctl_infoex_reserved; |
324 | | static int hf_smb2_fsctl_infoex_reserved2; |
325 | | static int hf_smb2_fsctl_infoex_flags; |
326 | | static int hf_smb2_fsctl_infoex_version; |
327 | | |
328 | | static int hf_smb2_fsctl_sparse_flag; |
329 | | static int hf_smb2_fsctl_range_offset; |
330 | | static int hf_smb2_fsctl_range_length; |
331 | | static int hf_smb2_ioctl_function_method; |
332 | | static int hf_smb2_ioctl_resiliency_timeout; |
333 | | static int hf_smb2_ioctl_resiliency_reserved; |
334 | | static int hf_smb2_ioctl_shared_virtual_disk_support; |
335 | | static int hf_smb2_ioctl_shared_virtual_disk_handle_state; |
336 | | static int hf_smb2_ioctl_sqos_protocol_version; |
337 | | static int hf_smb2_ioctl_sqos_reserved; |
338 | | static int hf_smb2_ioctl_sqos_options; |
339 | | static int hf_smb2_ioctl_sqos_op_set_logical_flow_id; |
340 | | static int hf_smb2_ioctl_sqos_op_set_policy; |
341 | | static int hf_smb2_ioctl_sqos_op_probe_policy; |
342 | | static int hf_smb2_ioctl_sqos_op_get_status; |
343 | | static int hf_smb2_ioctl_sqos_op_update_counters; |
344 | | static int hf_smb2_ioctl_sqos_logical_flow_id; |
345 | | static int hf_smb2_ioctl_sqos_policy_id; |
346 | | static int hf_smb2_ioctl_sqos_initiator_id; |
347 | | static int hf_smb2_ioctl_sqos_limit; |
348 | | static int hf_smb2_ioctl_sqos_reservation; |
349 | | static int hf_smb2_ioctl_sqos_initiator_name; |
350 | | static int hf_smb2_ioctl_sqos_initiator_node_name; |
351 | | static int hf_smb2_ioctl_sqos_io_count_increment; |
352 | | static int hf_smb2_ioctl_sqos_normalized_io_count_increment; |
353 | | static int hf_smb2_ioctl_sqos_latency_increment; |
354 | | static int hf_smb2_ioctl_sqos_lower_latency_increment; |
355 | | static int hf_smb2_ioctl_sqos_bandwidth_limit; |
356 | | static int hf_smb2_ioctl_sqos_kilobyte_count_increment; |
357 | | static int hf_smb2_ioctl_sqos_time_to_live; |
358 | | static int hf_smb2_ioctl_sqos_status; |
359 | | static int hf_smb2_ioctl_sqos_maximum_io_rate; |
360 | | static int hf_smb2_ioctl_sqos_minimum_io_rate; |
361 | | static int hf_smb2_ioctl_sqos_base_io_size; |
362 | | static int hf_smb2_ioctl_sqos_reserved2; |
363 | | static int hf_smb2_ioctl_sqos_maximum_bandwidth; |
364 | | static int hf_windows_sockaddr_family; |
365 | | static int hf_windows_sockaddr_port; |
366 | | static int hf_windows_sockaddr_in_addr; |
367 | | static int hf_windows_sockaddr_in6_flowinfo; |
368 | | static int hf_windows_sockaddr_in6_addr; |
369 | | static int hf_windows_sockaddr_in6_scope_id; |
370 | | static int hf_smb2_ioctl_network_interface_next_offset; |
371 | | static int hf_smb2_ioctl_network_interface_index; |
372 | | static int hf_smb2_ioctl_network_interface_reserved; |
373 | | static int hf_smb2_ioctl_network_interface_capabilities; |
374 | | static int hf_smb2_ioctl_network_interface_capability_rss; |
375 | | static int hf_smb2_ioctl_network_interface_capability_rdma; |
376 | | static int hf_smb2_ioctl_network_interface_link_speed; |
377 | | static int hf_smb2_ioctl_enumerate_snapshots_num_snapshots; |
378 | | static int hf_smb2_ioctl_enumerate_snapshots_num_snapshots_returned; |
379 | | static int hf_smb2_ioctl_enumerate_snapshots_snapshot_array_size; |
380 | | static int hf_smb2_ioctl_enumerate_snapshots_snapshot; |
381 | | static int hf_smb2_ioctl_get_ntfs_volume_data_volume_serial; |
382 | | static int hf_smb2_ioctl_get_ntfs_volume_data_num_sectors; |
383 | | static int hf_smb2_ioctl_get_ntfs_volume_data_total_clusters; |
384 | | static int hf_smb2_ioctl_get_ntfs_volume_data_free_clusters; |
385 | | static int hf_smb2_ioctl_get_ntfs_volume_data_total_reserved; |
386 | | static int hf_smb2_ioctl_get_ntfs_volume_data_bytes_per_sector; |
387 | | static int hf_smb2_ioctl_get_ntfs_volume_data_bytes_per_cluster; |
388 | | static int hf_smb2_ioctl_get_ntfs_volume_data_bytes_per_file_record_segment; |
389 | | static int hf_smb2_ioctl_get_ntfs_volume_data_clusters_per_file_record_segment; |
390 | | static int hf_smb2_ioctl_get_ntfs_volume_data_mft_valid_data_length; |
391 | | static int hf_smb2_ioctl_get_ntfs_volume_data_mft_start_lcn; |
392 | | static int hf_smb2_ioctl_get_ntfs_volume_data_mft2_start_lcn; |
393 | | static int hf_smb2_ioctl_get_ntfs_volume_data_mft_zone_start; |
394 | | static int hf_smb2_ioctl_get_ntfs_volume_data_mft_zone_end; |
395 | | static int hf_smb2_compression_format; |
396 | | static int hf_smb2_checksum_algorithm; |
397 | | static int hf_smb2_integrity_reserved; |
398 | | static int hf_smb2_integrity_flags; |
399 | | static int hf_smb2_integrity_flags_enforcement_off; |
400 | | static int hf_smb2_integrity_crc_chunk_size; |
401 | | static int hf_smb2_integrity_cluster_size; |
402 | | static int hf_smb2_FILE_OBJECTID_BUFFER; |
403 | | static int hf_smb2_lease_key; |
404 | | static int hf_smb2_lease_state; |
405 | | static int hf_smb2_lease_state_read_caching; |
406 | | static int hf_smb2_lease_state_handle_caching; |
407 | | static int hf_smb2_lease_state_write_caching; |
408 | | static int hf_smb2_lease_flags; |
409 | | static int hf_smb2_lease_flags_break_ack_required; |
410 | | static int hf_smb2_lease_flags_parent_lease_key_set; |
411 | | static int hf_smb2_lease_flags_break_in_progress; |
412 | | static int hf_smb2_lease_duration; |
413 | | static int hf_smb2_parent_lease_key; |
414 | | static int hf_smb2_lease_epoch; |
415 | | static int hf_smb2_lease_reserved; |
416 | | static int hf_smb2_lease_break_reason; |
417 | | static int hf_smb2_lease_access_mask_hint; |
418 | | static int hf_smb2_lease_share_mask_hint; |
419 | | static int hf_smb2_acct_name; |
420 | | static int hf_smb2_domain_name; |
421 | | static int hf_smb2_host_name; |
422 | | static int hf_smb2_auth_frame; |
423 | | static int hf_smb2_tcon_frame; |
424 | | static int hf_smb2_tdcon_frame; |
425 | | static int hf_smb2_share_type; |
426 | | static int hf_smb2_signature; |
427 | | static int hf_smb2_credit_charge; |
428 | | static int hf_smb2_credits_requested; |
429 | | static int hf_smb2_credits_granted; |
430 | | static int hf_smb2_channel_sequence; |
431 | | static int hf_smb2_dialect_count; |
432 | | static int hf_smb2_security_mode; |
433 | | static int hf_smb2_secmode_flags_sign_required; |
434 | | static int hf_smb2_secmode_flags_sign_enabled; |
435 | | static int hf_smb2_ses_req_flags; |
436 | | static int hf_smb2_ses_req_flags_session_binding; |
437 | | static int hf_smb2_capabilities; |
438 | | static int hf_smb2_cap_dfs; |
439 | | static int hf_smb2_cap_leasing; |
440 | | static int hf_smb2_cap_large_mtu; |
441 | | static int hf_smb2_cap_multi_channel; |
442 | | static int hf_smb2_cap_persistent_handles; |
443 | | static int hf_smb2_cap_directory_leasing; |
444 | | static int hf_smb2_cap_encryption; |
445 | | static int hf_smb2_cap_notifications; |
446 | | static int hf_smb2_dialect; |
447 | | static int hf_smb2_max_trans_size; |
448 | | static int hf_smb2_max_read_size; |
449 | | static int hf_smb2_max_write_size; |
450 | | static int hf_smb2_channel; |
451 | | static int hf_smb2_rdma_v1_offset; |
452 | | static int hf_smb2_rdma_v1_token; |
453 | | static int hf_smb2_rdma_v1_length; |
454 | | static int hf_smb2_session_flags; |
455 | | static int hf_smb2_ses_flags_guest; |
456 | | static int hf_smb2_ses_flags_null; |
457 | | static int hf_smb2_ses_flags_encrypt; |
458 | | static int hf_smb2_share_flags; |
459 | | static int hf_smb2_share_flags_dfs; |
460 | | static int hf_smb2_share_flags_dfs_root; |
461 | | static int hf_smb2_share_flags_restrict_exclusive_opens; |
462 | | static int hf_smb2_share_flags_force_shared_delete; |
463 | | static int hf_smb2_share_flags_allow_namespace_caching; |
464 | | static int hf_smb2_share_flags_access_based_dir_enum; |
465 | | static int hf_smb2_share_flags_force_levelii_oplock; |
466 | | static int hf_smb2_share_flags_enable_hash_v1; |
467 | | static int hf_smb2_share_flags_enable_hash_v2; |
468 | | static int hf_smb2_share_flags_encrypt_data; |
469 | | static int hf_smb2_share_flags_identity_remoting; |
470 | | static int hf_smb2_share_flags_compress_data; |
471 | | static int hf_smb2_share_flags_isolated_transport; |
472 | | static int hf_smb2_share_caching; |
473 | | static int hf_smb2_share_caps; |
474 | | static int hf_smb2_share_caps_dfs; |
475 | | static int hf_smb2_share_caps_continuous_availability; |
476 | | static int hf_smb2_share_caps_scaleout; |
477 | | static int hf_smb2_share_caps_cluster; |
478 | | static int hf_smb2_share_caps_asymmetric; |
479 | | static int hf_smb2_share_caps_redirect_to_owner; |
480 | | static int hf_smb2_create_flags; |
481 | | static int hf_smb2_lock_count; |
482 | | static int hf_smb2_lock_sequence_number; |
483 | | static int hf_smb2_lock_sequence_index; |
484 | | static int hf_smb2_min_count; |
485 | | static int hf_smb2_remaining_bytes; |
486 | | static int hf_smb2_channel_info_offset; |
487 | | static int hf_smb2_channel_info_length; |
488 | | static int hf_smb2_channel_info_blob; |
489 | | static int hf_smb2_ioctl_flags; |
490 | | static int hf_smb2_ioctl_is_fsctl; |
491 | | static int hf_smb2_close_pq_attrib; |
492 | | static int hf_smb2_notify_watch_tree; |
493 | | static int hf_smb2_output_buffer_len; |
494 | | static int hf_smb2_notify_out_data; |
495 | | static int hf_smb2_notify_info; |
496 | | static int hf_smb2_notify_next_offset; |
497 | | static int hf_smb2_notify_action; |
498 | | static int hf_smb2_find_flags; |
499 | | static int hf_smb2_find_flags_restart_scans; |
500 | | static int hf_smb2_find_flags_single_entry; |
501 | | static int hf_smb2_find_flags_index_specified; |
502 | | static int hf_smb2_find_flags_reopen; |
503 | | static int hf_smb2_file_index; |
504 | | static int hf_smb2_file_directory_info; |
505 | | static int hf_smb2_both_directory_info; |
506 | | static int hf_smb2_posix_info; |
507 | | static int hf_smb2_short_name_len; |
508 | | static int hf_smb2_short_name; |
509 | | static int hf_smb2_id_both_directory_info; |
510 | | static int hf_smb2_full_directory_info; |
511 | | static int hf_smb2_lock_info; |
512 | | static int hf_smb2_lock_length; |
513 | | static int hf_smb2_lock_flags; |
514 | | static int hf_smb2_lock_flags_shared; |
515 | | static int hf_smb2_lock_flags_exclusive; |
516 | | static int hf_smb2_lock_flags_unlock; |
517 | | static int hf_smb2_lock_flags_fail_immediately; |
518 | | static int hf_smb2_dhnq_buffer_reserved; |
519 | | static int hf_smb2_dh2x_buffer_timeout; |
520 | | static int hf_smb2_dh2x_buffer_flags; |
521 | | static int hf_smb2_dh2x_buffer_flags_persistent_handle; |
522 | | static int hf_smb2_dh2x_buffer_reserved; |
523 | | static int hf_smb2_dh2x_buffer_create_guid; |
524 | | static int hf_smb2_APP_INSTANCE_buffer_struct_size; |
525 | | static int hf_smb2_APP_INSTANCE_buffer_reserved; |
526 | | static int hf_smb2_APP_INSTANCE_buffer_app_guid; |
527 | | static int hf_smb2_svhdx_open_device_context_version; |
528 | | static int hf_smb2_svhdx_open_device_context_has_initiator_id; |
529 | | static int hf_smb2_svhdx_open_device_context_reserved; |
530 | | static int hf_smb2_svhdx_open_device_context_initiator_id; |
531 | | static int hf_smb2_svhdx_open_device_context_flags; |
532 | | static int hf_smb2_svhdx_open_device_context_originator_flags; |
533 | | static int hf_smb2_svhdx_open_device_context_open_request_id; |
534 | | static int hf_smb2_svhdx_open_device_context_initiator_host_name_len; |
535 | | static int hf_smb2_svhdx_open_device_context_initiator_host_name; |
536 | | static int hf_smb2_svhdx_open_device_context_virtual_disk_properties_initialized; |
537 | | static int hf_smb2_svhdx_open_device_context_server_service_version; |
538 | | static int hf_smb2_svhdx_open_device_context_virtual_sector_size; |
539 | | static int hf_smb2_svhdx_open_device_context_physical_sector_size; |
540 | | static int hf_smb2_svhdx_open_device_context_virtual_size; |
541 | | static int hf_smb2_app_instance_version_struct_size; |
542 | | static int hf_smb2_app_instance_version_reserved; |
543 | | static int hf_smb2_app_instance_version_padding; |
544 | | static int hf_smb2_app_instance_version_high; |
545 | | static int hf_smb2_app_instance_version_low; |
546 | | static int hf_smb2_posix_perms; |
547 | | static int hf_smb2_aapl_command_code; |
548 | | static int hf_smb2_aapl_reserved; |
549 | | static int hf_smb2_aapl_server_query_bitmask; |
550 | | static int hf_smb2_aapl_server_query_bitmask_server_caps; |
551 | | static int hf_smb2_aapl_server_query_bitmask_volume_caps; |
552 | | static int hf_smb2_aapl_server_query_bitmask_model_info; |
553 | | static int hf_smb2_aapl_server_query_caps; |
554 | | static int hf_smb2_aapl_server_query_caps_supports_read_dir_attr; |
555 | | static int hf_smb2_aapl_server_query_caps_supports_osx_copyfile; |
556 | | static int hf_smb2_aapl_server_query_caps_unix_based; |
557 | | static int hf_smb2_aapl_server_query_caps_supports_nfs_ace; |
558 | | static int hf_smb2_aapl_server_query_volume_caps; |
559 | | static int hf_smb2_aapl_server_query_volume_caps_support_resolve_id; |
560 | | static int hf_smb2_aapl_server_query_volume_caps_case_sensitive; |
561 | | static int hf_smb2_aapl_server_query_volume_caps_supports_full_sync; |
562 | | static int hf_smb2_aapl_server_query_model_string; |
563 | | static int hf_smb2_aapl_server_query_server_path; |
564 | | static int hf_smb2_error_context_count; |
565 | | static int hf_smb2_error_reserved; |
566 | | static int hf_smb2_error_byte_count; |
567 | | static int hf_smb2_error_data; |
568 | | static int hf_smb2_error_context; |
569 | | static int hf_smb2_error_context_length; |
570 | | static int hf_smb2_error_context_id; |
571 | | static int hf_smb2_error_min_buf_length; |
572 | | static int hf_smb2_error_redir_context; |
573 | | static int hf_smb2_error_redir_struct_size; |
574 | | static int hf_smb2_error_redir_notif_type; |
575 | | static int hf_smb2_error_redir_flags; |
576 | | static int hf_smb2_error_redir_target_type; |
577 | | static int hf_smb2_error_redir_ip_count; |
578 | | static int hf_smb2_error_redir_ip_list; |
579 | | static int hf_smb2_error_redir_res_name; |
580 | | static int hf_smb2_reserved; |
581 | | static int hf_smb2_reserved_random; |
582 | | static int hf_smb2_transform_signature; |
583 | | static int hf_smb2_transform_nonce; |
584 | | static int hf_smb2_transform_msg_size; |
585 | | static int hf_smb2_transform_reserved; |
586 | | static int hf_smb2_transform_flags; |
587 | | static int hf_smb2_transform_flags_encrypted; |
588 | | static int hf_smb2_transform_encrypted_data; |
589 | | static int hf_smb2_protocol_id; |
590 | | static int hf_smb2_comp_transform_orig_size; |
591 | | static int hf_smb2_comp_transform_comp_alg; |
592 | | static int hf_smb2_comp_transform_flags; |
593 | | static int hf_smb2_comp_transform_offset; |
594 | | static int hf_smb2_comp_transform_length; |
595 | | static int hf_smb2_comp_transform_data; |
596 | | static int hf_smb2_comp_transform_orig_payload_size; |
597 | | static int hf_smb2_comp_pattern_v1_pattern; |
598 | | static int hf_smb2_comp_pattern_v1_reserved1; |
599 | | static int hf_smb2_comp_pattern_v1_reserved2; |
600 | | static int hf_smb2_comp_pattern_v1_repetitions; |
601 | | static int hf_smb2_truncated; |
602 | | static int hf_smb2_pipe_fragments; |
603 | | static int hf_smb2_pipe_fragment; |
604 | | static int hf_smb2_pipe_fragment_overlap; |
605 | | static int hf_smb2_pipe_fragment_overlap_conflict; |
606 | | static int hf_smb2_pipe_fragment_multiple_tails; |
607 | | static int hf_smb2_pipe_fragment_too_long_fragment; |
608 | | static int hf_smb2_pipe_fragment_error; |
609 | | static int hf_smb2_pipe_fragment_count; |
610 | | static int hf_smb2_pipe_reassembled_in; |
611 | | static int hf_smb2_pipe_reassembled_length; |
612 | | static int hf_smb2_pipe_reassembled_data; |
613 | | static int hf_smb2_cchunk_resume_key; |
614 | | static int hf_smb2_cchunk_count; |
615 | | static int hf_smb2_cchunk_src_offset; |
616 | | static int hf_smb2_cchunk_dst_offset; |
617 | | static int hf_smb2_cchunk_xfer_len; |
618 | | static int hf_smb2_cchunk_chunks_written; |
619 | | static int hf_smb2_cchunk_bytes_written; |
620 | | static int hf_smb2_cchunk_total_written; |
621 | | |
622 | | static int hf_smb2_dupext_src_offset; |
623 | | static int hf_smb2_dupext_dst_offset; |
624 | | static int hf_smb2_dupext_byte_count; |
625 | | |
626 | | static int hf_smb2_reparse_data_buffer; |
627 | | static int hf_smb2_reparse_tag; |
628 | | static int hf_smb2_reparse_guid; |
629 | | static int hf_smb2_reparse_data_length; |
630 | | static int hf_smb2_nfs_type; |
631 | | static int hf_smb2_nfs_symlink_target; |
632 | | static int hf_smb2_nfs_chr_major; |
633 | | static int hf_smb2_nfs_chr_minor; |
634 | | static int hf_smb2_nfs_blk_major; |
635 | | static int hf_smb2_nfs_blk_minor; |
636 | | static int hf_smb2_symlink_error_response; |
637 | | static int hf_smb2_symlink_length; |
638 | | static int hf_smb2_symlink_error_tag; |
639 | | static int hf_smb2_unparsed_path_length; |
640 | | static int hf_smb2_symlink_substitute_name; |
641 | | static int hf_smb2_symlink_print_name; |
642 | | static int hf_smb2_symlink_flags; |
643 | | static int hf_smb2_bad_signature; |
644 | | static int hf_smb2_good_signature; |
645 | | static int hf_smb2_fscc_file_attr; |
646 | | static int hf_smb2_fscc_file_attr_archive; |
647 | | static int hf_smb2_fscc_file_attr_compressed; |
648 | | static int hf_smb2_fscc_file_attr_directory; |
649 | | static int hf_smb2_fscc_file_attr_encrypted; |
650 | | static int hf_smb2_fscc_file_attr_hidden; |
651 | | static int hf_smb2_fscc_file_attr_normal; |
652 | | static int hf_smb2_fscc_file_attr_not_content_indexed; |
653 | | static int hf_smb2_fscc_file_attr_offline; |
654 | | static int hf_smb2_fscc_file_attr_read_only; |
655 | | static int hf_smb2_fscc_file_attr_reparse_point; |
656 | | static int hf_smb2_fscc_file_attr_sparse_file; |
657 | | static int hf_smb2_fscc_file_attr_system; |
658 | | static int hf_smb2_fscc_file_attr_temporary; |
659 | | static int hf_smb2_fscc_file_attr_integrity_stream; |
660 | | static int hf_smb2_fscc_file_attr_no_scrub_data; |
661 | | static int hf_smb2_fscc_file_attr_recall_on_open; |
662 | | static int hf_smb2_fscc_file_attr_pinned; |
663 | | static int hf_smb2_fscc_file_attr_unpinned; |
664 | | static int hf_smb2_fscc_file_attr_recall_on_data_access; |
665 | | static int hf_smb2_tree_connect_flags; |
666 | | static int hf_smb2_tc_cluster_reconnect; |
667 | | static int hf_smb2_tc_redirect_to_owner; |
668 | | static int hf_smb2_tc_extension_present; |
669 | | static int hf_smb2_tc_reserved; |
670 | | static int hf_smb2_notification_type; |
671 | | static int hf_smb2_query_info_flags; |
672 | | static int hf_smb2_query_info_flag_restart_scan; |
673 | | static int hf_smb2_query_info_flag_return_single_entry; |
674 | | static int hf_smb2_query_info_flag_index_specified; |
675 | | static int hf_smb2_fscc_refs_snapshot_mgmt_operation; |
676 | | static int hf_smb2_fscc_refs_snapshot_mgmt_namelen; |
677 | | static int hf_smb2_fscc_refs_snapshot_mgmt_input_buffer_len; |
678 | | static int hf_smb2_fscc_refs_snapshot_mgmt_reserved; |
679 | | static int hf_smb2_fscc_refs_snapshot_mgmt_name; |
680 | | static int hf_smb2_fscc_refs_snapshot_query_delta_buffer_startvcn; |
681 | | static int hf_smb2_fscc_refs_snapshot_query_delta_buffer_flags; |
682 | | static int hf_smb2_fscc_refs_snapshot_query_delta_buffer_reserved; |
683 | | static int hf_smb2_flush_reserved2; |
684 | | static int hf_smb2_file_id_hash; |
685 | | static int hf_smb2_num_matched; |
686 | | static int hf_smb2_blobs; |
687 | | static int hf_smb2_dfs_max_referral_level; |
688 | | static int hf_smb2_dfs_request_flags; |
689 | | static int hf_smb2_dfs_request_data_len; |
690 | | static int hf_smb2_dfs_request_data; |
691 | | static int hf_smb2_dfs_request_data_file; |
692 | | static int hf_smb2_dfs_filename_len; |
693 | | static int hf_smb2_dfs_request_data_site; |
694 | | static int hf_smb2_dfs_sitename_len; |
695 | | static int hf_smb2_dfs_sitename; |
696 | | |
697 | | static int ett_smb2; |
698 | | static int ett_smb2_olb; |
699 | | static int ett_smb2_ea; |
700 | | static int ett_smb2_header; |
701 | | static int ett_smb2_encrypted; |
702 | | static int ett_smb2_compressed; |
703 | | static int ett_smb2_decompressed; |
704 | | static int ett_smb2_command; |
705 | | static int ett_smb2_secblob; |
706 | | static int ett_smb2_negotiate_context_element; |
707 | | static int ett_smb2_file_basic_info; |
708 | | static int ett_smb2_file_standard_info; |
709 | | static int ett_smb2_file_internal_info; |
710 | | static int ett_smb2_file_ea_info; |
711 | | static int ett_smb2_file_access_info; |
712 | | static int ett_smb2_file_position_info; |
713 | | static int ett_smb2_file_mode_info; |
714 | | static int ett_smb2_file_alignment_info; |
715 | | static int ett_smb2_file_all_info; |
716 | | static int ett_smb2_file_allocation_info; |
717 | | static int ett_smb2_file_endoffile_info; |
718 | | static int ett_smb2_file_alternate_name_info; |
719 | | static int ett_smb2_file_stream_info; |
720 | | static int ett_smb2_file_pipe_info; |
721 | | static int ett_smb2_file_pipe_local_info; |
722 | | static int ett_smb2_file_pipe_remote_info; |
723 | | static int ett_smb2_file_compression_info; |
724 | | static int ett_smb2_file_network_open_info; |
725 | | static int ett_smb2_file_attribute_tag_info; |
726 | | static int ett_smb2_file_rename_info; |
727 | | static int ett_smb2_file_link_info; |
728 | | static int ett_smb2_file_disposition_info; |
729 | | static int ett_smb2_file_full_ea_info; |
730 | | static int ett_smb2_file_normalized_name_info; |
731 | | static int ett_smb2_fs_info_01; |
732 | | static int ett_smb2_fs_info_03; |
733 | | static int ett_smb2_fs_info_04; |
734 | | static int ett_smb2_fs_info_05; |
735 | | static int ett_smb2_fs_info_06; |
736 | | static int ett_smb2_fs_info_07; |
737 | | static int ett_smb2_fs_objectid_info; |
738 | | static int ett_smb2_fs_posix_info; |
739 | | static int ett_smb2_sec_info_00; |
740 | | static int ett_smb2_additional_information_sec_mask; |
741 | | static int ett_smb2_quota_info; |
742 | | static int ett_smb2_query_quota_info; |
743 | | static int ett_smb2_tid_tree; |
744 | | static int ett_smb2_sesid_tree; |
745 | | static int ett_smb2_create_chain_element; |
746 | | static int ett_smb2_MxAc_buffer; |
747 | | static int ett_smb2_QFid_buffer; |
748 | | static int ett_smb2_RqLs_buffer; |
749 | | static int ett_smb2_ioctl_function; |
750 | | static int ett_smb2_FILE_OBJECTID_BUFFER; |
751 | | static int ett_smb2_flags; |
752 | | static int ett_smb2_sec_mode; |
753 | | static int ett_smb2_capabilities; |
754 | | static int ett_smb2_ses_req_flags; |
755 | | static int ett_smb2_ses_flags; |
756 | | static int ett_smb2_lease_state; |
757 | | static int ett_smb2_lease_flags; |
758 | | static int ett_smb2_share_flags; |
759 | | static int ett_smb2_create_rep_flags; |
760 | | static int ett_smb2_share_caps; |
761 | | static int ett_smb2_comp_alg_flags; |
762 | | static int ett_smb2_ioctl_flags; |
763 | | static int ett_smb2_ioctl_network_interface; |
764 | | static int ett_smb2_ioctl_sqos_opeations; |
765 | | static int ett_smb2_fsctl_range_data; |
766 | | static int ett_windows_sockaddr; |
767 | | static int ett_smb2_close_flags; |
768 | | static int ett_smb2_notify_info; |
769 | | static int ett_smb2_notify_flags; |
770 | | static int ett_smb2_write_flags; |
771 | | static int ett_smb2_rdma_v1; |
772 | | static int ett_smb2_DH2Q_buffer; |
773 | | static int ett_smb2_DH2C_buffer; |
774 | | static int ett_smb2_dh2x_flags; |
775 | | static int ett_smb2_APP_INSTANCE_buffer; |
776 | | static int ett_smb2_svhdx_open_device_context; |
777 | | static int ett_smb2_app_instance_version_buffer; |
778 | | static int ett_smb2_app_instance_version_buffer_version; |
779 | | static int ett_smb2_aapl_create_context_request; |
780 | | static int ett_smb2_aapl_server_query_bitmask; |
781 | | static int ett_smb2_aapl_server_query_caps; |
782 | | static int ett_smb2_aapl_create_context_response; |
783 | | static int ett_smb2_aapl_server_query_volume_caps; |
784 | | static int ett_smb2_integrity_flags; |
785 | | static int ett_smb2_find_flags; |
786 | | static int ett_smb2_file_directory_info; |
787 | | static int ett_smb2_both_directory_info; |
788 | | static int ett_smb2_id_both_directory_info; |
789 | | static int ett_smb2_full_directory_info; |
790 | | static int ett_smb2_posix_info; |
791 | | static int ett_smb2_file_name_info; |
792 | | static int ett_smb2_lock_info; |
793 | | static int ett_smb2_lock_flags; |
794 | | static int ett_smb2_buffercode; |
795 | | static int ett_smb2_ioctl_network_interface_capabilities; |
796 | | static int ett_smb2_tree_connect_flags; |
797 | | static int ett_qfr_entry; |
798 | | static int ett_smb2_pipe_fragment; |
799 | | static int ett_smb2_pipe_fragments; |
800 | | static int ett_smb2_cchunk_entry; |
801 | | static int ett_smb2_fsctl_odx_token; |
802 | | static int ett_smb2_symlink_error_response; |
803 | | static int ett_smb2_reparse_data_buffer; |
804 | | static int ett_smb2_error_data; |
805 | | static int ett_smb2_error_context; |
806 | | static int ett_smb2_error_redir_context; |
807 | | static int ett_smb2_error_redir_ip_list; |
808 | | static int ett_smb2_read_flags; |
809 | | static int ett_smb2_signature; |
810 | | static int ett_smb2_transform_flags; |
811 | | static int ett_smb2_fscc_file_attributes; |
812 | | static int ett_smb2_comp_payload; |
813 | | static int ett_smb2_comp_pattern_v1; |
814 | | static int ett_smb2_query_info_flags; |
815 | | static int ett_smb2_server_notification; |
816 | | static int ett_smb2_fscc_refs_snapshot_query_delta_buffer; |
817 | | static int ett_smb2_fid_str; |
818 | | static int ett_smb2_fsctl_dfs_get_referrals_ex_request_data; |
819 | | static int ett_smb2_fsctl_dfs_get_referrals_ex_filename; |
820 | | static int ett_smb2_fsctl_dfs_get_referrals_ex_sitename; |
821 | | |
822 | | static expert_field ei_smb2_invalid_length; |
823 | | static expert_field ei_smb2_bad_response; |
824 | | static expert_field ei_smb2_bad_negprot_negotiate_context_count; |
825 | | static expert_field ei_smb2_bad_negprot_negotiate_context_offset; |
826 | | static expert_field ei_smb2_bad_negprot_reserved; |
827 | | static expert_field ei_smb2_bad_negprot_reserved2; |
828 | | static expert_field ei_smb2_invalid_getinfo_offset; |
829 | | static expert_field ei_smb2_invalid_getinfo_size; |
830 | | static expert_field ei_smb2_empty_getinfo_buffer; |
831 | | static expert_field ei_smb2_invalid_signature; |
832 | | |
833 | | static int smb2_tap; |
834 | | static int smb2_eo_tap; |
835 | | |
836 | | static dissector_handle_t gssapi_handle; |
837 | | static dissector_handle_t ntlmssp_handle; |
838 | | static dissector_handle_t rsvd_handle; |
839 | | |
840 | | static heur_dissector_list_t smb2_pipe_subdissector_list; |
841 | | |
842 | | static const fragment_items smb2_pipe_frag_items = { |
843 | | &ett_smb2_pipe_fragment, |
844 | | &ett_smb2_pipe_fragments, |
845 | | &hf_smb2_pipe_fragments, |
846 | | &hf_smb2_pipe_fragment, |
847 | | &hf_smb2_pipe_fragment_overlap, |
848 | | &hf_smb2_pipe_fragment_overlap_conflict, |
849 | | &hf_smb2_pipe_fragment_multiple_tails, |
850 | | &hf_smb2_pipe_fragment_too_long_fragment, |
851 | | &hf_smb2_pipe_fragment_error, |
852 | | &hf_smb2_pipe_fragment_count, |
853 | | &hf_smb2_pipe_reassembled_in, |
854 | | &hf_smb2_pipe_reassembled_length, |
855 | | &hf_smb2_pipe_reassembled_data, |
856 | | "Fragments" |
857 | | }; |
858 | | |
859 | | #define FILE_BYTE_ALIGNMENT 0x00 |
860 | | #define FILE_WORD_ALIGNMENT 0x01 |
861 | | #define FILE_LONG_ALIGNMENT 0x03 |
862 | | #define FILE_QUAD_ALIGNMENT 0x07 |
863 | | #define FILE_OCTA_ALIGNMENT 0x0f |
864 | | #define FILE_32_BYTE_ALIGNMENT 0x1f |
865 | | #define FILE_64_BYTE_ALIGNMENT 0x3f |
866 | | #define FILE_128_BYTE_ALIGNMENT 0x7f |
867 | | #define FILE_256_BYTE_ALIGNMENT 0xff |
868 | | #define FILE_512_BYTE_ALIGNMENT 0x1ff |
869 | | static const value_string smb2_alignment_vals[] = { |
870 | | { FILE_BYTE_ALIGNMENT, "FILE_BYTE_ALIGNMENT" }, |
871 | | { FILE_WORD_ALIGNMENT, "FILE_WORD_ALIGNMENT" }, |
872 | | { FILE_LONG_ALIGNMENT, "FILE_LONG_ALIGNMENT" }, |
873 | | { FILE_OCTA_ALIGNMENT, "FILE_OCTA_ALIGNMENT" }, |
874 | | { FILE_32_BYTE_ALIGNMENT, "FILE_32_BYTE_ALIGNMENT" }, |
875 | | { FILE_64_BYTE_ALIGNMENT, "FILE_64_BYTE_ALIGNMENT" }, |
876 | | { FILE_128_BYTE_ALIGNMENT, "FILE_128_BYTE_ALIGNMENT" }, |
877 | | { FILE_256_BYTE_ALIGNMENT, "FILE_256_BYTE_ALIGNMENT" }, |
878 | | { FILE_512_BYTE_ALIGNMENT, "FILE_512_BYTE_ALIGNMENT" }, |
879 | | { 0, NULL } |
880 | | }; |
881 | | |
882 | | |
883 | 0 | #define SMB2_CLASS_FILE_INFO 0x01 |
884 | 0 | #define SMB2_CLASS_FS_INFO 0x02 |
885 | 0 | #define SMB2_CLASS_SEC_INFO 0x03 |
886 | 0 | #define SMB2_CLASS_QUOTA_INFO 0x04 |
887 | | static const value_string smb2_class_vals[] = { |
888 | | { SMB2_CLASS_FILE_INFO, "FILE_INFO"}, |
889 | | { SMB2_CLASS_FS_INFO, "FS_INFO"}, |
890 | | { SMB2_CLASS_SEC_INFO, "SEC_INFO"}, |
891 | | { SMB2_CLASS_QUOTA_INFO, "QUOTA_INFO"}, |
892 | | { 0, NULL } |
893 | | }; |
894 | | |
895 | | #define SMB2_SHARE_TYPE_DISK 0x01 |
896 | | #define SMB2_SHARE_TYPE_PIPE 0x02 |
897 | | #define SMB2_SHARE_TYPE_PRINT 0x03 |
898 | | static const value_string smb2_share_type_vals[] = { |
899 | | { SMB2_SHARE_TYPE_DISK, "Physical disk" }, |
900 | | { SMB2_SHARE_TYPE_PIPE, "Named pipe" }, |
901 | | { SMB2_SHARE_TYPE_PRINT, "Printer" }, |
902 | | { 0, NULL } |
903 | | }; |
904 | | |
905 | | |
906 | 0 | #define SMB2_FILE_BASIC_INFO 0x04 |
907 | 0 | #define SMB2_FILE_STANDARD_INFO 0x05 |
908 | 0 | #define SMB2_FILE_INTERNAL_INFO 0x06 |
909 | 0 | #define SMB2_FILE_EA_INFO 0x07 |
910 | 0 | #define SMB2_FILE_ACCESS_INFO 0x08 |
911 | 0 | #define SMB2_FILE_RENAME_INFO 0x0a |
912 | | #define SMB2_FILE_LINK_INFO 0x0b |
913 | 0 | #define SMB2_FILE_DISPOSITION_INFO 0x0d |
914 | 0 | #define SMB2_FILE_POSITION_INFO 0x0e |
915 | 0 | #define SMB2_FILE_FULL_EA_INFO 0x0f |
916 | 0 | #define SMB2_FILE_MODE_INFO 0x10 |
917 | 0 | #define SMB2_FILE_ALIGNMENT_INFO 0x11 |
918 | 0 | #define SMB2_FILE_ALL_INFO 0x12 |
919 | 0 | #define SMB2_FILE_ALLOCATION_INFO 0x13 |
920 | 0 | #define SMB2_FILE_ENDOFFILE_INFO 0x14 |
921 | 0 | #define SMB2_FILE_ALTERNATE_NAME_INFO 0x15 |
922 | 0 | #define SMB2_FILE_STREAM_INFO 0x16 |
923 | 0 | #define SMB2_FILE_PIPE_INFO 0x17 |
924 | 0 | #define SMB2_FILE_PIPE_LOCAL_INFO 0x18 |
925 | 0 | #define SMB2_FILE_PIPE_REMOTE_INFO 0x19 |
926 | 0 | #define SMB2_FILE_COMPRESSION_INFO 0x1c |
927 | 0 | #define SMB2_FILE_NETWORK_OPEN_INFO 0x22 |
928 | 0 | #define SMB2_FILE_ATTRIBUTE_TAG_INFO 0x23 |
929 | 0 | #define SMB2_FILE_NORMALIZED_NAME_INFO 0x30 |
930 | 0 | #define SMB2_FILE_POSIX_INFO 0x64 |
931 | | #define SMB2_FILE_ID_INFO 0x3b |
932 | | #define SMB2_FILE_BOTH_DIRECTORY_INFO 0x03 |
933 | | #define SMB2_FILE_DIRECTORY_INFO 0x01 |
934 | | #define SMB2_FILE_FULL_DIRECTORY_INFO 0x02 |
935 | | #define SMB2_FILE_FULL_HARD_LINK_INFO 0x2e |
936 | | #define SMB2_FILE_ID_BOTH_DIRECTORY_INFO 0x25 |
937 | | #define SMB2_FILE_ID_EXTD_DIRECTORY_INFO 0x3c |
938 | | #define SMB2_FILE_ID_FULL_DIRECTORY_INFO 0x26 |
939 | | #define SMB2_FILE_ID_GLOBAL_TX_DIRECTORY_INFO 0x32 |
940 | 0 | #define SMB2_FILE_LINK_INFO 0x0b |
941 | | #define SMB2_FILE_MAIL_SLOT_SET_INFO 0x1b |
942 | | #define SMB2_FILE_MOVE_CLUSTER_INFO 0x1f |
943 | | #define SMB2_FILE_NAME_INFO 0x09 |
944 | | #define SMB2_FILE_NAMES_INFO 0x0c |
945 | | #define SMB2_FILE_OBJECTID_INFO 0x1d |
946 | | #define SMB2_FILE_QUOTA_INFO 0x20 |
947 | | #define SMB2_FILE_REPARSE_POINT_INFO 0x21 |
948 | | #define SMB2_FILE_SFIO_RESERVE_INFO 0x2c |
949 | | #define SMB2_FILE_SFIO_VOLUME_INFO 0x2d |
950 | | #define SMB2_FILE_SHORT_NAME_INFO 0x28 |
951 | | #define SMB2_FILE_STANDARD_LINK_INFO 0x36 |
952 | | #define SMB2_FILE_TRACKING_INFO 0x24 |
953 | | #define SMB2_VALID_DATA_LENGTH_INFO 0x27 |
954 | | |
955 | | static const value_string smb2_file_info_levels[] = { |
956 | | {SMB2_FILE_DIRECTORY_INFO, "SMB2_FILE_DIRECTORY_INFO"}, |
957 | | {SMB2_FILE_FULL_DIRECTORY_INFO, "SMB2_FILE_FULL_DIRECTORY_INFO"}, |
958 | | {SMB2_FILE_BOTH_DIRECTORY_INFO, "SMB2_FILE_BOTH_DIRECTORY_INFO"}, |
959 | | {SMB2_FILE_BASIC_INFO, "SMB2_FILE_BASIC_INFO" }, |
960 | | {SMB2_FILE_STANDARD_INFO, "SMB2_FILE_STANDARD_INFO" }, |
961 | | {SMB2_FILE_INTERNAL_INFO, "SMB2_FILE_INTERNAL_INFO" }, |
962 | | {SMB2_FILE_EA_INFO, "SMB2_FILE_EA_INFO" }, |
963 | | {SMB2_FILE_ACCESS_INFO, "SMB2_FILE_ACCESS_INFO" }, |
964 | | {SMB2_FILE_NAME_INFO, "SMB2_FILE_NAME_INFO"}, |
965 | | {SMB2_FILE_RENAME_INFO, "SMB2_FILE_RENAME_INFO" }, |
966 | | {SMB2_FILE_LINK_INFO, "SMB2_FILE_LINK_INFO" }, |
967 | | {SMB2_FILE_NAMES_INFO, "SMB2_FILE_NAMES_INFO"}, |
968 | | {SMB2_FILE_DISPOSITION_INFO, "SMB2_FILE_DISPOSITION_INFO" }, |
969 | | {SMB2_FILE_POSITION_INFO, "SMB2_FILE_POSITION_INFO" }, |
970 | | {SMB2_FILE_FULL_EA_INFO, "SMB2_FILE_FULL_EA_INFO" }, |
971 | | {SMB2_FILE_MODE_INFO, "SMB2_FILE_MODE_INFO" }, |
972 | | {SMB2_FILE_ALIGNMENT_INFO, "SMB2_FILE_ALIGNMENT_INFO" }, |
973 | | {SMB2_FILE_ALL_INFO, "SMB2_FILE_ALL_INFO" }, |
974 | | {SMB2_FILE_ALLOCATION_INFO, "SMB2_FILE_ALLOCATION_INFO" }, |
975 | | {SMB2_FILE_ENDOFFILE_INFO, "SMB2_FILE_ENDOFFILE_INFO" }, |
976 | | {SMB2_FILE_ALTERNATE_NAME_INFO, "SMB2_FILE_ALTERNATE_NAME_INFO" }, |
977 | | {SMB2_FILE_STREAM_INFO, "SMB2_FILE_STREAM_INFO" }, |
978 | | {SMB2_FILE_PIPE_INFO, "SMB2_FILE_PIPE_INFO" }, |
979 | | {SMB2_FILE_PIPE_LOCAL_INFO, "SMB2_FILE_PIPE_LOCAL_INFO"}, |
980 | | {SMB2_FILE_PIPE_REMOTE_INFO, "SMB2_FILE_PIPE_REMOTE_INFO"}, |
981 | | {SMB2_FILE_MAIL_SLOT_SET_INFO, "SMB2_FILE_MAIL_SLOT_SET_INFO"}, |
982 | | {SMB2_FILE_COMPRESSION_INFO, "SMB2_FILE_COMPRESSION_INFO" }, |
983 | | {SMB2_FILE_OBJECTID_INFO, "SMB2_FILE_OBJECTID_INFO"}, |
984 | | {SMB2_FILE_MOVE_CLUSTER_INFO, "SMB2_FILE_MOVE_CLUSTER_INFO"}, |
985 | | {SMB2_FILE_QUOTA_INFO, "SMB2_FILE_QUOTA_INFO"}, |
986 | | {SMB2_FILE_REPARSE_POINT_INFO, "SMB2_FILE_REPARSE_POINT_INFO"}, |
987 | | {SMB2_FILE_NETWORK_OPEN_INFO, "SMB2_FILE_NETWORK_OPEN_INFO" }, |
988 | | {SMB2_FILE_ATTRIBUTE_TAG_INFO, "SMB2_FILE_ATTRIBUTE_TAG_INFO" }, |
989 | | {SMB2_FILE_TRACKING_INFO, "SMB2_FILE_TRACKING_INFO"}, |
990 | | {SMB2_FILE_ID_BOTH_DIRECTORY_INFO,"SMB2_FILE_ID_BOTH_DIRECTORY_INFO" }, |
991 | | {SMB2_FILE_ID_FULL_DIRECTORY_INFO, "SMB2_FILE_ID_FULL_DIRECTORY_INFO"}, |
992 | | {SMB2_VALID_DATA_LENGTH_INFO, "SMB2_VALID_DATA_LENGTH_INFO"}, |
993 | | {SMB2_FILE_SHORT_NAME_INFO, "SMB2_FILE_SHORT_NAME_INFO"}, |
994 | | {SMB2_FILE_SFIO_RESERVE_INFO, "SMB2_FILE_SFIO_RESERVE_INFO"}, |
995 | | {SMB2_FILE_SFIO_VOLUME_INFO, "SMB2_FILE_SFIO_VOLUME_INFO"}, |
996 | | {SMB2_FILE_FULL_HARD_LINK_INFO, "SMB2_FILE_FULL_HARD_LINK_INFO"}, |
997 | | {SMB2_FILE_NORMALIZED_NAME_INFO,"SMB2_FILE_NORMALIZED_NAME_INFO" }, |
998 | | {SMB2_FILE_ID_GLOBAL_TX_DIRECTORY_INFO, "SMB2_FILE_ID_GLOBAL_TX_DIRECTORY_INFO"}, |
999 | | {SMB2_FILE_STANDARD_LINK_INFO, "SMB2_FILE_STANDARD_LINK_INFO"}, |
1000 | | {SMB2_FILE_ID_INFO, "SMB2_FILE_ID_INFO"}, |
1001 | | {SMB2_FILE_ID_EXTD_DIRECTORY_INFO,"SMB2_FILE_ID_EXTD_DIRECTORY_INFO"}, |
1002 | | {SMB2_FILE_POSIX_INFO, "SMB2_FILE_POSIX_INFO" }, |
1003 | | { 0, NULL } |
1004 | | }; |
1005 | | static value_string_ext smb2_file_info_levels_ext = VALUE_STRING_EXT_INIT(smb2_file_info_levels); |
1006 | | |
1007 | | |
1008 | | |
1009 | 0 | #define SMB2_FS_INFO_01 0x01 |
1010 | | #define SMB2_FS_LABEL_INFO 0x02 |
1011 | 0 | #define SMB2_FS_INFO_03 0x03 |
1012 | 0 | #define SMB2_FS_INFO_04 0x04 |
1013 | 0 | #define SMB2_FS_INFO_05 0x05 |
1014 | 0 | #define SMB2_FS_INFO_06 0x06 |
1015 | 0 | #define SMB2_FS_INFO_07 0x07 |
1016 | 0 | #define SMB2_FS_OBJECTID_INFO 0x08 |
1017 | | #define SMB2_FS_DRIVER_PATH_INFO 0x09 |
1018 | | #define SMB2_FS_VOLUME_FLAGS_INFO 0x0a |
1019 | | #define SMB2_FS_SECTOR_SIZE_INFO 0x0b |
1020 | 0 | #define SMB2_FS_POSIX_INFO 0x64 |
1021 | | |
1022 | | static const value_string smb2_fs_info_levels[] = { |
1023 | | {SMB2_FS_INFO_01, "FileFsVolumeInformation" }, |
1024 | | {SMB2_FS_LABEL_INFO, "FileFsLabelInformation" }, |
1025 | | {SMB2_FS_INFO_03, "FileFsSizeInformation" }, |
1026 | | {SMB2_FS_INFO_04, "FileFsDeviceInformation" }, |
1027 | | {SMB2_FS_INFO_05, "FileFsAttributeInformation" }, |
1028 | | {SMB2_FS_INFO_06, "FileFsControlInformation" }, |
1029 | | {SMB2_FS_INFO_07, "FileFsFullSizeInformation" }, |
1030 | | {SMB2_FS_OBJECTID_INFO, "FileFsObjectIdInformation" }, |
1031 | | {SMB2_FS_DRIVER_PATH_INFO, "FileFsDriverPathInformation" }, |
1032 | | {SMB2_FS_VOLUME_FLAGS_INFO, "FileFsVolumeFlagsInformation" }, |
1033 | | {SMB2_FS_SECTOR_SIZE_INFO, "FileFsSectorSizeInformation" }, |
1034 | | {SMB2_FS_POSIX_INFO, "FileFsPosixInformation" }, |
1035 | | { 0, NULL } |
1036 | | }; |
1037 | | static value_string_ext smb2_fs_info_levels_ext = VALUE_STRING_EXT_INIT(smb2_fs_info_levels); |
1038 | | |
1039 | 0 | #define SMB2_SEC_INFO_00 0x00 |
1040 | | static const value_string smb2_sec_info_levels[] = { |
1041 | | {SMB2_SEC_INFO_00, "SMB2_SEC_INFO_00" }, |
1042 | | { 0, NULL } |
1043 | | }; |
1044 | | static value_string_ext smb2_sec_info_levels_ext = VALUE_STRING_EXT_INIT(smb2_sec_info_levels); |
1045 | | |
1046 | | #define SMB2_FIND_DIRECTORY_INFO 0x01 |
1047 | | #define SMB2_FIND_FULL_DIRECTORY_INFO 0x02 |
1048 | | #define SMB2_FIND_BOTH_DIRECTORY_INFO 0x03 |
1049 | | #define SMB2_FIND_INDEX_SPECIFIED 0x04 |
1050 | | #define SMB2_FIND_NAME_INFO 0x0C |
1051 | | #define SMB2_FIND_ID_BOTH_DIRECTORY_INFO 0x25 |
1052 | | #define SMB2_FIND_ID_FULL_DIRECTORY_INFO 0x26 |
1053 | | #define SMB2_FIND_POSIX_INFO 0x64 |
1054 | | static const value_string smb2_find_info_levels[] = { |
1055 | | { SMB2_FIND_DIRECTORY_INFO, "SMB2_FIND_DIRECTORY_INFO" }, |
1056 | | { SMB2_FIND_FULL_DIRECTORY_INFO, "SMB2_FIND_FULL_DIRECTORY_INFO" }, |
1057 | | { SMB2_FIND_BOTH_DIRECTORY_INFO, "SMB2_FIND_BOTH_DIRECTORY_INFO" }, |
1058 | | { SMB2_FIND_INDEX_SPECIFIED, "SMB2_FIND_INDEX_SPECIFIED" }, |
1059 | | { SMB2_FIND_NAME_INFO, "SMB2_FIND_NAME_INFO" }, |
1060 | | { SMB2_FIND_ID_BOTH_DIRECTORY_INFO, "SMB2_FIND_ID_BOTH_DIRECTORY_INFO" }, |
1061 | | { SMB2_FIND_ID_FULL_DIRECTORY_INFO, "SMB2_FIND_ID_FULL_DIRECTORY_INFO" }, |
1062 | | { SMB2_FIND_POSIX_INFO, "SMB2_FIND_POSIX_INFO" }, |
1063 | | { 0, NULL } |
1064 | | }; |
1065 | | |
1066 | 0 | #define SMB2_PREAUTH_INTEGRITY_CAPABILITIES 0x0001 |
1067 | 0 | #define SMB2_ENCRYPTION_CAPABILITIES 0x0002 |
1068 | 0 | #define SMB2_COMPRESSION_CAPABILITIES 0x0003 |
1069 | 0 | #define SMB2_NETNAME_NEGOTIATE_CONTEXT_ID 0x0005 |
1070 | 0 | #define SMB2_TRANSPORT_CAPABILITIES 0x0006 |
1071 | 0 | #define SMB2_RDMA_TRANSFORM_CAPABILITIES 0x0007 |
1072 | 0 | #define SMB2_SIGNING_CAPABILITIES 0x0008 |
1073 | 0 | #define SMB2_POSIX_EXTENSIONS_CAPABILITIES 0x0100 |
1074 | | static const value_string smb2_negotiate_context_types[] = { |
1075 | | { SMB2_PREAUTH_INTEGRITY_CAPABILITIES, "SMB2_PREAUTH_INTEGRITY_CAPABILITIES" }, |
1076 | | { SMB2_ENCRYPTION_CAPABILITIES, "SMB2_ENCRYPTION_CAPABILITIES" }, |
1077 | | { SMB2_COMPRESSION_CAPABILITIES, "SMB2_COMPRESSION_CAPABILITIES" }, |
1078 | | { SMB2_NETNAME_NEGOTIATE_CONTEXT_ID, "SMB2_NETNAME_NEGOTIATE_CONTEXT_ID" }, |
1079 | | { SMB2_TRANSPORT_CAPABILITIES, "SMB2_TRANSPORT_CAPABILITIES" }, |
1080 | | { SMB2_RDMA_TRANSFORM_CAPABILITIES, "SMB2_RDMA_TRANSFORM_CAPABILITIES" }, |
1081 | | { SMB2_SIGNING_CAPABILITIES, "SMB2_SIGNING_CAPABILITIES" }, |
1082 | | { SMB2_POSIX_EXTENSIONS_CAPABILITIES, "SMB2_POSIX_EXTENSIONS_CAPABILITIES" }, |
1083 | | { 0, NULL } |
1084 | | }; |
1085 | | |
1086 | | #define SMB2_HASH_ALGORITHM_SHA_512 0x0001 |
1087 | | static const value_string smb2_hash_algorithm_types[] = { |
1088 | | { SMB2_HASH_ALGORITHM_SHA_512, "SHA-512" }, |
1089 | | { 0, NULL } |
1090 | | }; |
1091 | | |
1092 | 0 | #define SMB2_SIGNING_ALG_HMAC_SHA256 0x0000 |
1093 | 0 | #define SMB2_SIGNING_ALG_AES_CMAC 0x0001 |
1094 | | #define SMB2_SIGNING_ALG_AES_GMAC 0x0002 |
1095 | | static const value_string smb2_signing_alg_types[] = { |
1096 | | { SMB2_SIGNING_ALG_HMAC_SHA256, "HMAC-SHA256" }, |
1097 | | { SMB2_SIGNING_ALG_AES_CMAC, "AES-CMAC" }, |
1098 | | { SMB2_SIGNING_ALG_AES_GMAC, "AES-GMAC" }, |
1099 | | { 0, NULL }, |
1100 | | }; |
1101 | | |
1102 | 0 | #define SMB2_CIPHER_AES_128_CCM 0x0001 |
1103 | 0 | #define SMB2_CIPHER_AES_128_GCM 0x0002 |
1104 | 0 | #define SMB2_CIPHER_AES_256_CCM 0x0003 |
1105 | 0 | #define SMB2_CIPHER_AES_256_GCM 0x0004 |
1106 | | static const value_string smb2_cipher_types[] = { |
1107 | | { SMB2_CIPHER_AES_128_CCM, "AES-128-CCM" }, |
1108 | | { SMB2_CIPHER_AES_128_GCM, "AES-128-GCM" }, |
1109 | | { SMB2_CIPHER_AES_256_CCM, "AES-256-CCM" }, |
1110 | | { SMB2_CIPHER_AES_256_GCM, "AES-256-GCM" }, |
1111 | | { 0, NULL } |
1112 | | }; |
1113 | | |
1114 | 14 | #define SMB2_TRANSFORM_FLAGS_ENCRYPTED 0x0001 |
1115 | | static int * const smb2_transform_flags[] = { |
1116 | | &hf_smb2_transform_flags_encrypted, |
1117 | | NULL, |
1118 | | }; |
1119 | | |
1120 | 14 | #define SMB2_COMP_ALG_FLAGS_CHAINED 0x00000001 |
1121 | | |
1122 | 0 | #define SMB2_COMP_ALG_NONE 0x0000 |
1123 | 0 | #define SMB2_COMP_ALG_LZNT1 0x0001 |
1124 | 0 | #define SMB2_COMP_ALG_LZ77 0x0002 |
1125 | 0 | #define SMB2_COMP_ALG_LZ77HUFF 0x0003 |
1126 | 0 | #define SMB2_COMP_ALG_PATTERN_V1 0x0004 |
1127 | | static const value_string smb2_comp_alg_types[] = { |
1128 | | { SMB2_COMP_ALG_NONE, "None" }, |
1129 | | { SMB2_COMP_ALG_LZNT1, "LZNT1" }, |
1130 | | { SMB2_COMP_ALG_LZ77, "LZ77" }, |
1131 | | { SMB2_COMP_ALG_LZ77HUFF, "LZ77+Huffman" }, |
1132 | | { SMB2_COMP_ALG_PATTERN_V1, "Pattern_V1" }, |
1133 | | { 0, NULL } |
1134 | | }; |
1135 | | |
1136 | | #define SMB2_COMP_FLAG_NONE 0x0000 |
1137 | 0 | #define SMB2_COMP_FLAG_CHAINED 0x0001 |
1138 | | static const value_string smb2_comp_transform_flags_vals[] = { |
1139 | | { SMB2_COMP_FLAG_NONE, "None" }, |
1140 | | { SMB2_COMP_FLAG_CHAINED, "Chained" }, |
1141 | | { 0, NULL } |
1142 | | }; |
1143 | | |
1144 | | #define SMB2_RDMA_TRANSFORM_NONE 0x0000 |
1145 | | #define SMB2_RDMA_TRANSFORM_ENCRYPTION 0x0001 |
1146 | | #define SMB2_RDMA_TRANSFORM_SIGNING 0x0002 |
1147 | | static const value_string smb2_rdma_transform_types[] = { |
1148 | | { SMB2_RDMA_TRANSFORM_NONE, "None" }, |
1149 | | { SMB2_RDMA_TRANSFORM_ENCRYPTION, "Encryption" }, |
1150 | | { SMB2_RDMA_TRANSFORM_SIGNING, "Signing" }, |
1151 | | { 0, NULL } |
1152 | | }; |
1153 | | |
1154 | 0 | #define OPLOCK_BREAK_OPLOCK_STRUCTURE_SIZE 24 /* [MS-SMB2] 2.2.23.1, 2.2.24.1 and 2.2.25.1 */ |
1155 | 0 | #define OPLOCK_BREAK_LEASE_NOTIFICATION_STRUCTURE_SIZE 44 /* [MS-SMB2] 2.2.23.2 Lease Break Notification */ |
1156 | 0 | #define OPLOCK_BREAK_LEASE_ACKNOWLEDGMENT_STRUCTURE_SIZE 36 /* [MS-SMB2] 2.2.24.2 Lease Break Acknowledgment */ |
1157 | 0 | #define OPLOCK_BREAK_LEASE_RESPONSE_STRUCTURE_SIZE 36 /* [MS-SMB2] 2.2.25.2 Lease Break Response */ |
1158 | | |
1159 | | static const val64_string unique_unsolicited_response[] = { |
1160 | | { 0xffffffffffffffff, "unsolicited response" }, |
1161 | | { 0, NULL } |
1162 | | }; |
1163 | | |
1164 | | #define SMB2_ERROR_ID_DEFAULT 0x00000000 |
1165 | 0 | #define SMB2_ERROR_ID_SHARE_REDIRECT 0x72645253 |
1166 | | static const value_string smb2_error_id_vals[] = { |
1167 | | { SMB2_ERROR_ID_DEFAULT, "ERROR_ID_DEFAULT" }, |
1168 | | { SMB2_ERROR_ID_SHARE_REDIRECT, "ERROR_ID_SHARE_REDIRECT" }, |
1169 | | { 0, NULL } |
1170 | | }; |
1171 | | |
1172 | | #define SMB2_ACCEPT_TRANSPORT_LEVEL_SECURITY 0x00000001 |
1173 | | static const value_string smb2_transport_ctx_flags_vals[] = { |
1174 | | { SMB2_ACCEPT_TRANSPORT_LEVEL_SECURITY, "SMB2_ACCEPT_TRANSPORT_LEVEL_SECURITY" }, |
1175 | | { 0, NULL } |
1176 | | }; |
1177 | | |
1178 | | #define REPARSE_TAG_RESERVED_ZERO 0x00000000 /* Reserved reparse tag value. */ |
1179 | | #define REPARSE_TAG_RESERVED_ONE 0x00000001 /* Reserved reparse tag value. */ |
1180 | | #define REPARSE_TAG_MOUNT_POINT 0xA0000003 /* Used for mount point */ |
1181 | | #define REPARSE_TAG_HSM 0xC0000004 /* Obsolete. Used by legacy Hierarchical Storage Manager Product. */ |
1182 | | #define REPARSE_TAG_DRIVER_EXTENDER 0x80000005 /* Home server drive extender. */ |
1183 | | #define REPARSE_TAG_HSM2 0x80000006 /* Obsolete. Used by legacy Hierarchical Storage Manager Product. */ |
1184 | | #define REPARSE_TAG_SIS 0x80000007 /* Used by single-instance storage (SIS) filter driver. */ |
1185 | | #define REPARSE_TAG_DFS 0x8000000A /* Used by the DFS filter. */ |
1186 | | #define REPARSE_TAG_FILTER_MANAGER 0x8000000B /* Used by filter manager test harness */ |
1187 | 0 | #define REPARSE_TAG_SYMLINK 0xA000000C /* Used for symbolic link support. */ |
1188 | | #define REPARSE_TAG_DFSR 0x80000012 /* Used by the DFS filter. */ |
1189 | 0 | #define REPARSE_TAG_NFS 0x80000014 /* Used by the Network File System (NFS) component. */ |
1190 | | #define REPARSE_TAG_LX_SYMLINK 0xA000001D /* WSL symbolic link */ |
1191 | | #define REPARSE_TAG_AF_UNIX 0x80000023 /* WSL unix socket */ |
1192 | | #define REPARSE_TAG_LX_FIFO 0x80000024 /* WSL fifo pipe */ |
1193 | | #define REPARSE_TAG_LX_CHR 0x80000025 /* WSL char device */ |
1194 | | #define REPARSE_TAG_LX_BLK 0x80000026 /* WSL block device */ |
1195 | | static const value_string reparse_tag_vals[] = { |
1196 | | { REPARSE_TAG_RESERVED_ZERO, "REPARSE_TAG_RESERVED_ZERO"}, |
1197 | | { REPARSE_TAG_RESERVED_ONE, "REPARSE_TAG_RESERVED_ONE"}, |
1198 | | { REPARSE_TAG_MOUNT_POINT, "REPARSE_TAG_MOUNT_POINT"}, |
1199 | | { REPARSE_TAG_HSM, "REPARSE_TAG_HSM"}, |
1200 | | { REPARSE_TAG_DRIVER_EXTENDER, "REPARSE_TAG_DRIVER_EXTENDER"}, |
1201 | | { REPARSE_TAG_HSM2, "REPARSE_TAG_HSM2"}, |
1202 | | { REPARSE_TAG_SIS, "REPARSE_TAG_SIS"}, |
1203 | | { REPARSE_TAG_DFS, "REPARSE_TAG_DFS"}, |
1204 | | { REPARSE_TAG_FILTER_MANAGER, "REPARSE_TAG_FILTER_MANAGER"}, |
1205 | | { REPARSE_TAG_SYMLINK, "REPARSE_TAG_SYMLINK"}, |
1206 | | { REPARSE_TAG_DFSR, "REPARSE_TAG_DFSR"}, |
1207 | | { REPARSE_TAG_NFS, "REPARSE_TAG_NFS"}, |
1208 | | { REPARSE_TAG_LX_SYMLINK, "REPARSE_TAG_LX_SYMLINK"}, |
1209 | | { REPARSE_TAG_AF_UNIX, "REPARSE_TAG_AF_UNIX"}, |
1210 | | { REPARSE_TAG_LX_FIFO, "REPARSE_TAG_LX_FIFO"}, |
1211 | | { REPARSE_TAG_LX_CHR, "REPARSE_TAG_LX_CHR"}, |
1212 | | { REPARSE_TAG_LX_BLK, "REPARSE_TAG_LX_BLK"}, |
1213 | | { 0, NULL } |
1214 | | }; |
1215 | | |
1216 | 0 | #define NFS_SPECFILE_LNK 0x00000000014B4E4C |
1217 | 0 | #define NFS_SPECFILE_CHR 0x0000000000524843 |
1218 | 0 | #define NFS_SPECFILE_BLK 0x00000000004B4C42 |
1219 | 0 | #define NFS_SPECFILE_FIFO 0x000000004F464946 |
1220 | 0 | #define NFS_SPECFILE_SOCK 0x000000004B434F53 |
1221 | | static const val64_string nfs_type_vals[] = { |
1222 | | { NFS_SPECFILE_LNK, "Symbolic Link" }, |
1223 | | { NFS_SPECFILE_CHR, "Character Device" }, |
1224 | | { NFS_SPECFILE_BLK, "Block Device" }, |
1225 | | { NFS_SPECFILE_FIFO, "FIFO" }, |
1226 | | { NFS_SPECFILE_SOCK, "UNIX Socket" }, |
1227 | | { 0, NULL } |
1228 | | }; |
1229 | | |
1230 | 0 | #define SMB2_NUM_PROCEDURES 256 |
1231 | 0 | #define MAX_UNCOMPRESSED_SIZE (1<<24) /* 16MB */ |
1232 | | |
1233 | | #define SMB2_DIALECT_202 0x0202 |
1234 | 0 | #define SMB2_DIALECT_210 0x0210 |
1235 | | #define SMB2_DIALECT_2FF 0x02FF |
1236 | | #define SMB2_DIALECT_222 0x0222 |
1237 | | #define SMB2_DIALECT_224 0x0224 |
1238 | 0 | #define SMB2_DIALECT_300 0x0300 |
1239 | 0 | #define SMB2_DIALECT_302 0x0302 |
1240 | 0 | #define SMB2_DIALECT_310 0x0310 |
1241 | 0 | #define SMB2_DIALECT_311 0x0311 |
1242 | | |
1243 | | static const value_string smb2_dialect_vals[] = { |
1244 | | { SMB2_DIALECT_202, "SMB 2.0.2" }, |
1245 | | { SMB2_DIALECT_210, "SMB 2.1" }, |
1246 | | { SMB2_DIALECT_2FF, "SMB2 wildcard" }, |
1247 | | { SMB2_DIALECT_222, "SMB 2.2.2 (deprecated; should be 3.0)" }, |
1248 | | { SMB2_DIALECT_224, "SMB 2.2.4 (deprecated; should be 3.0)" }, |
1249 | | { SMB2_DIALECT_300, "SMB 3.0" }, |
1250 | | { SMB2_DIALECT_302, "SMB 3.0.2" }, |
1251 | | { SMB2_DIALECT_310, "SMB 3.1.0 (deprecated; should be 3.1.1)" }, |
1252 | | { SMB2_DIALECT_311, "SMB 3.1.1" }, |
1253 | | { 0, NULL } |
1254 | | }; |
1255 | | |
1256 | | static const value_string smb2_fsctl_infoex_integrity_modes[] = { |
1257 | | { 0x00, "CHECKSUM_TYPE_NONE" }, |
1258 | | { 0x01, "CHECKSUM_TYPE_CRC32_OR_CRC64" }, |
1259 | | { 0, NULL } |
1260 | | }; |
1261 | | |
1262 | | static const value_string smb2_fsctl_infoex_integrity_state[] = { |
1263 | | { 0x00, "Change state" }, |
1264 | | { 0x01, "No state change" }, |
1265 | | { 0, NULL } |
1266 | | }; |
1267 | | |
1268 | 14 | #define SMB2_SL_RESTART_SCAN 0x00000001 |
1269 | 14 | #define SMB2_SL_RETURN_SINGLE_ENTRY 0x00000002 |
1270 | 14 | #define SL_INDEX_SPECIFIED 0x00000004 |
1271 | | |
1272 | 0 | #define NOTIFY_SESSION_CLOSED 0x0 |
1273 | | static const value_string server_notification_types[] = { |
1274 | | { NOTIFY_SESSION_CLOSED, "SmbNotifySessionClosed" }, |
1275 | | { 0, NULL } |
1276 | | }; |
1277 | | |
1278 | | #define REFS_STREAM_SNAPSHOT_OPERATION_INVALID 0x00000000 |
1279 | | #define REFS_STREAM_SNAPSHOT_OPERATION_CREATE 0x00000001 |
1280 | | #define REFS_STREAM_SNAPSHOT_OPERATION_LIST 0x00000002 |
1281 | 0 | #define REFS_STREAM_SNAPSHOT_OPERATION_QUERY_DELTAS 0x00000003 |
1282 | | #define REFS_STREAM_SNAPSHOT_OPERATION_REVERT 0x00000004 |
1283 | | #define REFS_STREAM_SNAPSHOT_OPERATION_SET_SHADOW_BTREE 0x00000005 |
1284 | | #define REFS_STREAM_SNAPSHOT_OPERATION_CLEAR_SHADOW_BTREE 0x00000006 |
1285 | | |
1286 | | static const value_string refs_stream_snapshot_operation_types[] = { |
1287 | | { REFS_STREAM_SNAPSHOT_OPERATION_INVALID, "Invalid" }, |
1288 | | { REFS_STREAM_SNAPSHOT_OPERATION_CREATE, "Create" }, |
1289 | | { REFS_STREAM_SNAPSHOT_OPERATION_LIST, "List" }, |
1290 | | { REFS_STREAM_SNAPSHOT_OPERATION_QUERY_DELTAS, "Query Deltas" }, |
1291 | | { REFS_STREAM_SNAPSHOT_OPERATION_REVERT, "Revert" }, |
1292 | | { REFS_STREAM_SNAPSHOT_OPERATION_SET_SHADOW_BTREE, "Set Shadow Btree" }, |
1293 | | { REFS_STREAM_SNAPSHOT_OPERATION_CLEAR_SHADOW_BTREE, "Clear Shadow Btree" }, |
1294 | | { 0, NULL } |
1295 | | }; |
1296 | | |
1297 | | #define FILE_FULL_EA_INFORMATION_FLAG_NONE 0x00000000 |
1298 | | #define FILE_FULL_EA_INFORMATION_FLAG_NEED_EA 0x00000001 |
1299 | | |
1300 | | static const value_string file_full_ea_information_flags[] = { |
1301 | | { FILE_FULL_EA_INFORMATION_FLAG_NONE, "None" }, |
1302 | | { FILE_FULL_EA_INFORMATION_FLAG_NEED_EA, "Need EA" }, |
1303 | | { 0, NULL } |
1304 | | }; |
1305 | | |
1306 | | static int dissect_windows_sockaddr_storage(tvbuff_t *, packet_info *, proto_tree *, int, int); |
1307 | | static void dissect_smb2_error_data(tvbuff_t *, packet_info *, proto_tree *, int, int, smb2_info_t *); |
1308 | | static unsigned smb2_eo_files_hash(const void *k); |
1309 | | static int smb2_eo_files_equal(const void *k1, const void *k2); |
1310 | | |
1311 | | static void update_preauth_hash(void *buf, packet_info *pinfo, tvbuff_t *tvb) |
1312 | 0 | { |
1313 | 0 | gcry_error_t err; |
1314 | 0 | gcry_md_hd_t md; |
1315 | 0 | void *pkt; |
1316 | |
|
1317 | 0 | err = gcry_md_open(&md, GCRY_MD_SHA512, 0); |
1318 | 0 | if (err) |
1319 | 0 | return; |
1320 | | |
1321 | | /* we dup in case of non-contiguous packet */ |
1322 | 0 | pkt = tvb_memdup(pinfo->pool, tvb, 0, tvb_captured_length(tvb)); |
1323 | 0 | gcry_md_write(md, buf, SMB2_PREAUTH_HASH_SIZE); |
1324 | 0 | gcry_md_write(md, pkt, tvb_captured_length(tvb)); |
1325 | 0 | gcry_md_final(md); |
1326 | 0 | memcpy(buf, gcry_md_read(md, 0), SMB2_PREAUTH_HASH_SIZE); |
1327 | 0 | gcry_md_close(md); |
1328 | 0 | } |
1329 | | |
1330 | | static void |
1331 | | smb2stat_init(struct register_srt* srt _U_, GArray* srt_array) |
1332 | 0 | { |
1333 | 0 | srt_stat_table *smb2_srt_table; |
1334 | 0 | uint32_t i; |
1335 | |
|
1336 | 0 | smb2_srt_table = init_srt_table("SMB2", NULL, srt_array, SMB2_NUM_PROCEDURES, "Commands", "smb2.cmd", NULL); |
1337 | 0 | for (i = 0; i < SMB2_NUM_PROCEDURES; i++) |
1338 | 0 | { |
1339 | 0 | init_srt_table_row(smb2_srt_table, i, val_to_str_ext_const(i, &smb2_cmd_vals_ext, "<unknown>")); |
1340 | 0 | } |
1341 | 0 | } |
1342 | | |
1343 | | static tap_packet_status |
1344 | | smb2stat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *prv, tap_flags_t flags _U_) |
1345 | 0 | { |
1346 | 0 | unsigned i = 0; |
1347 | 0 | srt_stat_table *smb2_srt_table; |
1348 | 0 | srt_data_t *data = (srt_data_t *)pss; |
1349 | 0 | const smb2_info_t *si=(const smb2_info_t *)prv; |
1350 | | |
1351 | | /* we are only interested in response packets */ |
1352 | 0 | if(!(si->flags&SMB2_FLAGS_RESPONSE)){ |
1353 | 0 | return TAP_PACKET_DONT_REDRAW; |
1354 | 0 | } |
1355 | | /* We should not include cancel and oplock break requests either */ |
1356 | 0 | if (si->opcode == SMB2_COM_CANCEL || si->opcode == SMB2_COM_BREAK) { |
1357 | 0 | return TAP_PACKET_DONT_REDRAW; |
1358 | 0 | } |
1359 | | |
1360 | | /* if we haven't seen the request, just ignore it */ |
1361 | 0 | if(!si->saved){ |
1362 | 0 | return TAP_PACKET_DONT_REDRAW; |
1363 | 0 | } |
1364 | | |
1365 | | /* SMB2 SRT can be very inaccurate in the presence of retransmissions. Retransmitted responses |
1366 | | * not only add additional (bogus) transactions but also the latency associated with them. |
1367 | | * This can greatly inflate the maximum and average SRT stats especially in the case of |
1368 | | * retransmissions triggered by the expiry of the rexmit timer (RTOs). Only calculating SRT |
1369 | | * for the last received response accomplishes this goal without requiring the TCP pref |
1370 | | * "Do not call subdissectors for error packets" to be set. */ |
1371 | 0 | if (si->saved->frame_res != pinfo->num) |
1372 | 0 | return TAP_PACKET_DONT_REDRAW; |
1373 | | |
1374 | 0 | smb2_srt_table = g_array_index(data->srt_array, srt_stat_table*, i); |
1375 | 0 | add_srt_table_data(smb2_srt_table, si->opcode, &si->saved->req_time, pinfo); |
1376 | 0 | return TAP_PACKET_REDRAW; |
1377 | 0 | } |
1378 | | |
1379 | | /* Structure for SessionID <=> SessionKey mapping for decryption. */ |
1380 | | typedef struct _smb2_seskey_field_t { |
1381 | | /* session id */ |
1382 | | unsigned char *id; /* *little-endian* - not necessarily host-endian! */ |
1383 | | unsigned id_len; |
1384 | | /* session key */ |
1385 | | unsigned char *seskey; |
1386 | | unsigned seskey_len; |
1387 | | /* server to client key */ |
1388 | | unsigned char *s2ckey; |
1389 | | unsigned s2ckey_len; |
1390 | | /* client to server key */ |
1391 | | unsigned char *c2skey; |
1392 | | unsigned c2skey_len; |
1393 | | } smb2_seskey_field_t; |
1394 | | |
1395 | | static smb2_seskey_field_t *seskey_list; |
1396 | | static unsigned num_seskey_list; |
1397 | | |
1398 | | static const int8_t zeros[NTLMSSP_KEY_LEN] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; |
1399 | | |
1400 | | /* Callbacks for SessionID <=> SessionKey mapping. */ |
1401 | | UAT_BUFFER_CB_DEF(seskey_list, id, smb2_seskey_field_t, id, id_len) |
1402 | | UAT_BUFFER_CB_DEF(seskey_list, seskey, smb2_seskey_field_t, seskey, seskey_len) |
1403 | | UAT_BUFFER_CB_DEF(seskey_list, s2ckey, smb2_seskey_field_t, s2ckey, s2ckey_len) |
1404 | | UAT_BUFFER_CB_DEF(seskey_list, c2skey, smb2_seskey_field_t, c2skey, c2skey_len) |
1405 | | |
1406 | 0 | #define SMB_SESSION_ID_SIZE 8 |
1407 | | |
1408 | | static bool seskey_list_update_cb(void *r, char **err) |
1409 | 0 | { |
1410 | 0 | smb2_seskey_field_t *rec = (smb2_seskey_field_t *)r; |
1411 | 0 | bool has_seskey = rec->seskey_len != 0; |
1412 | 0 | bool has_s2ckey = rec->s2ckey_len != 0; |
1413 | 0 | bool has_c2skey = rec->c2skey_len != 0; |
1414 | |
|
1415 | 0 | *err = NULL; |
1416 | |
|
1417 | 0 | if (rec->id_len != SMB_SESSION_ID_SIZE) { |
1418 | 0 | *err = g_strdup("Session ID must be " G_STRINGIFY(SMB_SESSION_ID_SIZE) " bytes long and in hexadecimal"); |
1419 | 0 | return false; |
1420 | 0 | } |
1421 | | |
1422 | 0 | if (!has_seskey && !(has_c2skey || has_s2ckey)) { |
1423 | 0 | *err = g_strdup("Decryption requires either the Session Key or at least one of the client-server AES keys"); |
1424 | 0 | return false; |
1425 | 0 | } |
1426 | | |
1427 | | |
1428 | 0 | if (rec->seskey_len > NTLMSSP_KEY_LEN) { |
1429 | 0 | *err = g_strdup("Session Key must be a hexadecimal string representing at most " G_STRINGIFY(NTLMSSP_KEY_LEN) " bytes"); |
1430 | 0 | return false; |
1431 | 0 | } |
1432 | | |
1433 | 0 | if (has_s2ckey && ((rec->s2ckey_len != AES_KEY_SIZE) && (rec->s2ckey_len != AES_KEY_SIZE*2))) { |
1434 | 0 | *err = g_strdup("Server-to-Client key must be a hexadecimal string representing " |
1435 | 0 | G_STRINGIFY(AES_KEY_SIZE) " or " G_STRINGIFY(AES_KEY_SIZE*2)); |
1436 | 0 | return false; |
1437 | 0 | } |
1438 | | |
1439 | 0 | if (has_c2skey && ((rec->c2skey_len != AES_KEY_SIZE) && (rec->c2skey_len != AES_KEY_SIZE*2))) { |
1440 | 0 | *err = g_strdup("Client-to-Server key must be a hexadecimal string representing " |
1441 | 0 | G_STRINGIFY(AES_KEY_SIZE) " or " G_STRINGIFY(AES_KEY_SIZE*2)); |
1442 | 0 | return false; |
1443 | 0 | } |
1444 | | |
1445 | 0 | return true; |
1446 | 0 | } |
1447 | | |
1448 | | static void* seskey_list_copy_cb(void *n, const void *o, size_t siz _U_) |
1449 | 0 | { |
1450 | 0 | smb2_seskey_field_t *new_rec = (smb2_seskey_field_t *)n; |
1451 | 0 | const smb2_seskey_field_t *old_rec = (const smb2_seskey_field_t *)o; |
1452 | |
|
1453 | 0 | new_rec->id_len = old_rec->id_len; |
1454 | 0 | new_rec->id = old_rec->id ? (unsigned char *)g_memdup2(old_rec->id, old_rec->id_len) : NULL; |
1455 | 0 | new_rec->seskey_len = old_rec->seskey_len; |
1456 | 0 | new_rec->seskey = old_rec->seskey ? (unsigned char *)g_memdup2(old_rec->seskey, old_rec->seskey_len) : NULL; |
1457 | 0 | new_rec->s2ckey_len = old_rec->s2ckey_len; |
1458 | 0 | new_rec->s2ckey = old_rec->s2ckey ? (unsigned char *)g_memdup2(old_rec->s2ckey, old_rec->s2ckey_len) : NULL; |
1459 | 0 | new_rec->c2skey_len = old_rec->c2skey_len; |
1460 | 0 | new_rec->c2skey = old_rec->c2skey ? (unsigned char *)g_memdup2(old_rec->c2skey, old_rec->c2skey_len) : NULL; |
1461 | |
|
1462 | 0 | return new_rec; |
1463 | 0 | } |
1464 | | |
1465 | | static void seskey_list_free_cb(void *r) |
1466 | 0 | { |
1467 | 0 | smb2_seskey_field_t *rec = (smb2_seskey_field_t *)r; |
1468 | |
|
1469 | 0 | g_free(rec->id); |
1470 | 0 | g_free(rec->seskey); |
1471 | 0 | g_free(rec->s2ckey); |
1472 | 0 | g_free(rec->c2skey); |
1473 | 0 | } |
1474 | | |
1475 | | static bool seskey_find_sid_key(uint64_t sesid, uint8_t *out_seskey, |
1476 | | unsigned *out_seskey_len, |
1477 | | uint8_t *out_s2ckey16, |
1478 | | uint8_t *out_c2skey16, |
1479 | | uint8_t *out_s2ckey32, |
1480 | | uint8_t *out_c2skey32) |
1481 | 0 | { |
1482 | 0 | unsigned i; |
1483 | 0 | uint64_t sesid_le; |
1484 | | |
1485 | | /* |
1486 | | * The session IDs in the UAT are octet arrays, in little-endian |
1487 | | * byte order (as it appears on the wire); they have been |
1488 | | * checked to make sure they're 8 bytes (SMB_SESSION_ID_SIZE) |
1489 | | * long. They're *probably* aligned on an appropriate boundary, |
1490 | | * but let's not assume that - let's just use memcmp(). |
1491 | | * |
1492 | | * The session ID passed to us, however, is in *host* byte order. |
1493 | | * This is *NOT* necessarily little-endian; it's big-endian on, |
1494 | | * for example, System/390 and z/Architecture ("s390" and "s390x" |
1495 | | * in Linuxland), SPARC, and most PowerPC systems. We must, |
1496 | | * therefore, put it into little-endian byte order before |
1497 | | * comparing it with the IDs in the UAT values. |
1498 | | */ |
1499 | 0 | sesid_le = GUINT64_TO_LE(sesid); |
1500 | |
|
1501 | 0 | for (i = 0; i < num_seskey_list; i++) { |
1502 | 0 | const smb2_seskey_field_t *p = &seskey_list[i]; |
1503 | 0 | if (memcmp(&sesid_le, p->id, SMB_SESSION_ID_SIZE) == 0) { |
1504 | 0 | *out_seskey_len = 0; |
1505 | 0 | memset(out_seskey, 0, NTLMSSP_KEY_LEN*2); |
1506 | 0 | memset(out_s2ckey16, 0, AES_KEY_SIZE); |
1507 | 0 | memset(out_c2skey16, 0, AES_KEY_SIZE); |
1508 | 0 | memset(out_s2ckey32, 0, AES_KEY_SIZE*2); |
1509 | 0 | memset(out_c2skey32, 0, AES_KEY_SIZE*2); |
1510 | |
|
1511 | 0 | if (p->seskey_len > 0 && p->seskey_len <= NTLMSSP_KEY_LEN*2) { |
1512 | 0 | memcpy(out_seskey, p->seskey, p->seskey_len); |
1513 | 0 | *out_seskey_len = p->seskey_len; |
1514 | 0 | } |
1515 | 0 | if (p->s2ckey_len == AES_KEY_SIZE) |
1516 | 0 | memcpy(out_s2ckey16, p->s2ckey, p->s2ckey_len); |
1517 | 0 | if (p->s2ckey_len == AES_KEY_SIZE*2) |
1518 | 0 | memcpy(out_s2ckey32, p->s2ckey, p->s2ckey_len); |
1519 | 0 | if (p->c2skey_len == AES_KEY_SIZE) |
1520 | 0 | memcpy(out_c2skey16, p->c2skey, p->c2skey_len); |
1521 | 0 | if (p->c2skey_len == AES_KEY_SIZE*2) |
1522 | 0 | memcpy(out_c2skey32, p->c2skey, p->c2skey_len); |
1523 | |
|
1524 | 0 | return true; |
1525 | 0 | } |
1526 | 0 | } |
1527 | | |
1528 | 0 | return false; |
1529 | 0 | } |
1530 | | |
1531 | | /* ExportObject preferences variable */ |
1532 | | bool eosmb2_take_name_as_fid = false ; |
1533 | | |
1534 | | /* unmatched smb_saved_info structures. |
1535 | | For unmatched smb_saved_info structures we store the smb_saved_info |
1536 | | structure using the msg_id field. |
1537 | | */ |
1538 | | static int |
1539 | | smb2_saved_info_equal_unmatched(const void *k1, const void *k2) |
1540 | 0 | { |
1541 | 0 | const smb2_saved_info_t *key1 = (const smb2_saved_info_t *)k1; |
1542 | 0 | const smb2_saved_info_t *key2 = (const smb2_saved_info_t *)k2; |
1543 | 0 | return key1->msg_id == key2->msg_id; |
1544 | 0 | } |
1545 | | static unsigned |
1546 | | smb2_saved_info_hash_unmatched(const void *k) |
1547 | 0 | { |
1548 | 0 | const smb2_saved_info_t *key = (const smb2_saved_info_t *)k; |
1549 | 0 | uint32_t hash; |
1550 | |
|
1551 | 0 | hash = (uint32_t) (key->msg_id&0xffffffff); |
1552 | 0 | return hash; |
1553 | 0 | } |
1554 | | |
1555 | | /* matched smb_saved_info structures. |
1556 | | For matched smb_saved_info structures we store the smb_saved_info |
1557 | | structure using the msg_id field. |
1558 | | */ |
1559 | | static int |
1560 | | smb2_saved_info_equal_matched(const void *k1, const void *k2) |
1561 | 0 | { |
1562 | 0 | const smb2_saved_info_t *key1 = (const smb2_saved_info_t *)k1; |
1563 | 0 | const smb2_saved_info_t *key2 = (const smb2_saved_info_t *)k2; |
1564 | 0 | return key1->msg_id == key2->msg_id; |
1565 | 0 | } |
1566 | | static unsigned |
1567 | | smb2_saved_info_hash_matched(const void *k) |
1568 | 0 | { |
1569 | 0 | const smb2_saved_info_t *key = (const smb2_saved_info_t *)k; |
1570 | 0 | uint32_t hash; |
1571 | |
|
1572 | 0 | hash = (uint32_t) (key->msg_id&0xffffffff); |
1573 | 0 | return hash; |
1574 | 0 | } |
1575 | | |
1576 | | /* For Tids of a specific conversation. |
1577 | | This keeps track of tid->sharename mappings and other information about the |
1578 | | tid. |
1579 | | qqq |
1580 | | We might need to refine this if it occurs that tids are reused on a single |
1581 | | conversation. we don't worry about that yet for simplicity |
1582 | | */ |
1583 | | static int |
1584 | | smb2_tid_info_equal(const void *k1, const void *k2) |
1585 | 0 | { |
1586 | 0 | const smb2_tid_info_t *key1 = (const smb2_tid_info_t *)k1; |
1587 | 0 | const smb2_tid_info_t *key2 = (const smb2_tid_info_t *)k2; |
1588 | 0 | return key1->tid == key2->tid; |
1589 | 0 | } |
1590 | | static unsigned |
1591 | | smb2_tid_info_hash(const void *k) |
1592 | 0 | { |
1593 | 0 | const smb2_tid_info_t *key = (const smb2_tid_info_t *)k; |
1594 | 0 | uint32_t hash; |
1595 | |
|
1596 | 0 | hash = key->tid; |
1597 | 0 | return hash; |
1598 | 0 | } |
1599 | | |
1600 | | /* For Uids of a specific conversation. |
1601 | | This keeps track of uid->acct_name mappings and other information about the |
1602 | | uid. |
1603 | | qqq |
1604 | | We might need to refine this if it occurs that uids are reused on a single |
1605 | | conversation. we don't worry about that yet for simplicity |
1606 | | */ |
1607 | | static int |
1608 | | smb2_sesid_info_equal(const void *k1, const void *k2) |
1609 | 0 | { |
1610 | 0 | const smb2_sesid_info_t *key1 = (const smb2_sesid_info_t *)k1; |
1611 | 0 | const smb2_sesid_info_t *key2 = (const smb2_sesid_info_t *)k2; |
1612 | 0 | return key1->sesid == key2->sesid; |
1613 | 0 | } |
1614 | | static unsigned |
1615 | | smb2_sesid_info_hash(const void *k) |
1616 | 0 | { |
1617 | 0 | const smb2_sesid_info_t *key = (const smb2_sesid_info_t *)k; |
1618 | 0 | uint32_t hash; |
1619 | |
|
1620 | 0 | hash = (uint32_t)( ((key->sesid>>32)&0xffffffff)+((key->sesid)&0xffffffff) ); |
1621 | 0 | return hash; |
1622 | 0 | } |
1623 | | |
1624 | | /* |
1625 | | * For File IDs of a specific conversation. |
1626 | | * This keeps track of fid to name mapping and application level conversations |
1627 | | * over named pipes. |
1628 | | * |
1629 | | * This handles implementation bugs, where the fid_persitent is 0 or |
1630 | | * the fid_persitent/fid_volative is not unique per conversation. |
1631 | | */ |
1632 | | static int |
1633 | | smb2_fid_info_equal(const void *k1, const void *k2) |
1634 | 0 | { |
1635 | 0 | const smb2_fid_info_t *key = (const smb2_fid_info_t *)k1; |
1636 | 0 | const smb2_fid_info_t *val = (const smb2_fid_info_t *)k2; |
1637 | |
|
1638 | 0 | if (!key->frame_key) { |
1639 | 0 | key = (const smb2_fid_info_t *)k2; |
1640 | 0 | val = (const smb2_fid_info_t *)k1; |
1641 | 0 | } |
1642 | |
|
1643 | 0 | if (key->fid_persistent != val->fid_persistent) { |
1644 | 0 | return 0; |
1645 | 0 | } |
1646 | | |
1647 | 0 | if (key->fid_volatile != val->fid_volatile) { |
1648 | 0 | return 0; |
1649 | 0 | } |
1650 | | |
1651 | 0 | if (key->sesid != val->sesid) { |
1652 | 0 | return 0; |
1653 | 0 | } |
1654 | | |
1655 | 0 | if (key->tid != val->tid) { |
1656 | 0 | return 0; |
1657 | 0 | } |
1658 | | |
1659 | 0 | if (!(val->frame_beg <= key->frame_key && key->frame_key <= val->frame_end)) { |
1660 | 0 | return 0; |
1661 | 0 | } |
1662 | | |
1663 | 0 | return 1; |
1664 | 0 | } |
1665 | | |
1666 | | static unsigned |
1667 | | smb2_fid_info_hash(const void *k) |
1668 | 0 | { |
1669 | 0 | const smb2_fid_info_t *key = (const smb2_fid_info_t *)k; |
1670 | 0 | uint32_t hash; |
1671 | |
|
1672 | 0 | if (key->fid_persistent != 0) { |
1673 | 0 | hash = (uint32_t)( ((key->fid_persistent>>32)&0xffffffff)+((key->fid_persistent)&0xffffffff) ); |
1674 | 0 | } else { |
1675 | 0 | hash = (uint32_t)( ((key->fid_volatile>>32)&0xffffffff)+((key->fid_volatile)&0xffffffff) ); |
1676 | 0 | } |
1677 | |
|
1678 | 0 | return hash; |
1679 | 0 | } |
1680 | | |
1681 | | /* Callback for destroying the glib hash tables associated with a conversation |
1682 | | * struct. */ |
1683 | | static bool |
1684 | | smb2_conv_destroy(wmem_allocator_t *allocator _U_, wmem_cb_event_t event _U_, |
1685 | | void *user_data) |
1686 | 0 | { |
1687 | 0 | smb2_conv_info_t *conv = (smb2_conv_info_t *)user_data; |
1688 | |
|
1689 | 0 | g_hash_table_destroy(conv->matched); |
1690 | 0 | g_hash_table_destroy(conv->unmatched); |
1691 | | |
1692 | | /* This conversation is gone, return false to indicate we don't |
1693 | | * want to be called again for this conversation. */ |
1694 | 0 | return false; |
1695 | 0 | } |
1696 | | |
1697 | | static smb2_sesid_info_t * |
1698 | | smb2_get_session(smb2_conv_info_t *conv _U_, uint64_t id, packet_info *pinfo, smb2_info_t *si) |
1699 | 0 | { |
1700 | 0 | smb2_sesid_info_t key = {.sesid = id}; |
1701 | 0 | smb2_sesid_info_t *ses = (smb2_sesid_info_t *)wmem_map_lookup(smb2_sessions, &key); |
1702 | |
|
1703 | 0 | if (!ses) { |
1704 | 0 | ses = wmem_new0(wmem_file_scope(), smb2_sesid_info_t); |
1705 | 0 | ses->sesid = id; |
1706 | 0 | ses->auth_frame = (uint32_t)-1; |
1707 | 0 | ses->tids = wmem_map_new(wmem_file_scope(), smb2_tid_info_hash, smb2_tid_info_equal); |
1708 | 0 | ses->fids = wmem_map_new(wmem_file_scope(), smb2_fid_info_hash, smb2_fid_info_equal); |
1709 | 0 | ses->files = wmem_map_new(wmem_file_scope(), smb2_eo_files_hash, smb2_eo_files_equal); |
1710 | |
|
1711 | 0 | ses->session_key_frame = UINT32_MAX; |
1712 | 0 | seskey_find_sid_key(id, |
1713 | 0 | ses->session_key, |
1714 | 0 | &ses->session_key_len, |
1715 | 0 | ses->client_decryption_key16, |
1716 | 0 | ses->server_decryption_key16, |
1717 | 0 | ses->client_decryption_key32, |
1718 | 0 | ses->server_decryption_key32); |
1719 | 0 | if (pinfo && si) { |
1720 | 0 | if (ses->session_key_len != 0) { |
1721 | 0 | ses->session_key_frame = pinfo->num; |
1722 | 0 | } |
1723 | 0 | if (si->flags & SMB2_FLAGS_RESPONSE) { |
1724 | 0 | ses->server_port = pinfo->srcport; |
1725 | 0 | } else { |
1726 | 0 | ses->server_port = pinfo->destport; |
1727 | 0 | } |
1728 | 0 | } |
1729 | 0 | wmem_map_insert(smb2_sessions, ses, ses); |
1730 | 0 | } |
1731 | |
|
1732 | 0 | return ses; |
1733 | 0 | } |
1734 | | |
1735 | | static void |
1736 | | smb2_add_session_info(proto_tree *ses_tree, proto_item *ses_item, tvbuff_t *tvb, int start, smb2_sesid_info_t *ses) |
1737 | 0 | { |
1738 | 0 | proto_item *new_item; |
1739 | 0 | if (!ses) |
1740 | 0 | return; |
1741 | | |
1742 | 0 | if (ses->acct_name) { |
1743 | 0 | new_item = proto_tree_add_string(ses_tree, hf_smb2_acct_name, tvb, start, 0, ses->acct_name); |
1744 | 0 | proto_item_set_generated(new_item); |
1745 | 0 | proto_item_append_text(ses_item, " Acct:%s", ses->acct_name); |
1746 | 0 | } |
1747 | |
|
1748 | 0 | if (ses->domain_name) { |
1749 | 0 | new_item = proto_tree_add_string(ses_tree, hf_smb2_domain_name, tvb, start, 0, ses->domain_name); |
1750 | 0 | proto_item_set_generated(new_item); |
1751 | 0 | proto_item_append_text(ses_item, " Domain:%s", ses->domain_name); |
1752 | 0 | } |
1753 | |
|
1754 | 0 | if (ses->host_name) { |
1755 | 0 | new_item = proto_tree_add_string(ses_tree, hf_smb2_host_name, tvb, start, 0, ses->host_name); |
1756 | 0 | proto_item_set_generated(new_item); |
1757 | 0 | proto_item_append_text(ses_item, " Host:%s", ses->host_name); |
1758 | 0 | } |
1759 | |
|
1760 | 0 | if (ses->auth_frame != (uint32_t)-1) { |
1761 | 0 | new_item = proto_tree_add_uint(ses_tree, hf_smb2_auth_frame, tvb, start, 0, ses->auth_frame); |
1762 | 0 | proto_item_set_generated(new_item); |
1763 | 0 | } |
1764 | 0 | } |
1765 | | |
1766 | | static void smb2_key_derivation(const uint8_t *KI, uint32_t KI_len, |
1767 | | const uint8_t *Label, uint32_t Label_len, |
1768 | | const uint8_t *Context, uint32_t Context_len, |
1769 | | uint8_t *KO, uint32_t KO_len) |
1770 | 0 | { |
1771 | 0 | gcry_md_hd_t hd = NULL; |
1772 | 0 | uint8_t buf[4]; |
1773 | 0 | uint8_t *digest = NULL; |
1774 | 0 | uint32_t L; |
1775 | | |
1776 | | /* |
1777 | | * a simplified version of |
1778 | | * "NIST Special Publication 800-108" section 5.1 |
1779 | | * using hmac-sha256. |
1780 | | */ |
1781 | | /* XXX This routine should indicate a success/failure indication, so that the failure of gcry_md_open() |
1782 | | * can be reported to the caller. |
1783 | | */ |
1784 | 0 | if (gcry_md_open(&hd, GCRY_MD_SHA256, GCRY_MD_FLAG_HMAC) != 0) |
1785 | 0 | return; |
1786 | 0 | gcry_md_setkey(hd, KI, KI_len); |
1787 | |
|
1788 | 0 | memset(buf, 0, sizeof(buf)); |
1789 | 0 | buf[3] = 1; |
1790 | 0 | gcry_md_write(hd, buf, sizeof(buf)); |
1791 | 0 | gcry_md_write(hd, Label, Label_len); |
1792 | 0 | gcry_md_write(hd, buf, 1); |
1793 | 0 | gcry_md_write(hd, Context, Context_len); |
1794 | 0 | L = KO_len * 8; |
1795 | 0 | memset(buf, 0, sizeof(buf)); |
1796 | 0 | buf[3] = ((L) >> (0)) & 0xff; |
1797 | 0 | buf[2] = ((L) >> (8)) & 0xff; |
1798 | 0 | gcry_md_write(hd, buf, sizeof(buf)); |
1799 | |
|
1800 | 0 | digest = gcry_md_read(hd, GCRY_MD_SHA256); |
1801 | |
|
1802 | 0 | memcpy(KO, digest, KO_len); |
1803 | |
|
1804 | 0 | gcry_md_close(hd); |
1805 | 0 | } |
1806 | | |
1807 | | /* for export-object-smb2 */ |
1808 | 0 | static char *policy_hnd_to_file_id(wmem_allocator_t *pool, const e_ctx_hnd *hnd) { |
1809 | 0 | return guid_to_str(pool, &hnd->uuid); |
1810 | 0 | } |
1811 | 0 | static unsigned smb2_eo_files_hash(const void *k) { |
1812 | 0 | char* file_id = policy_hnd_to_file_id(NULL, (const e_ctx_hnd*)k); |
1813 | 0 | unsigned hash = g_str_hash(file_id); |
1814 | 0 | wmem_free(NULL, file_id); |
1815 | 0 | return hash; |
1816 | 0 | } |
1817 | 0 | static int smb2_eo_files_equal(const void *k1, const void *k2) { |
1818 | 0 | int are_equal; |
1819 | 0 | const e_ctx_hnd *key1 = (const e_ctx_hnd *)k1; |
1820 | 0 | const e_ctx_hnd *key2 = (const e_ctx_hnd *)k2; |
1821 | |
|
1822 | 0 | are_equal = (key1->uuid.data1==key2->uuid.data1 && |
1823 | 0 | key1->uuid.data2==key2->uuid.data2 && |
1824 | 0 | key1->uuid.data3==key2->uuid.data3 && |
1825 | 0 | key1->uuid.data4[0]==key2->uuid.data4[0] && |
1826 | 0 | key1->uuid.data4[1]==key2->uuid.data4[1] && |
1827 | 0 | key1->uuid.data4[2]==key2->uuid.data4[2] && |
1828 | 0 | key1->uuid.data4[3]==key2->uuid.data4[3] && |
1829 | 0 | key1->uuid.data4[4]==key2->uuid.data4[4] && |
1830 | 0 | key1->uuid.data4[5]==key2->uuid.data4[5] && |
1831 | 0 | key1->uuid.data4[6]==key2->uuid.data4[6] && |
1832 | 0 | key1->uuid.data4[7]==key2->uuid.data4[7]); |
1833 | |
|
1834 | 0 | return are_equal; |
1835 | 0 | } |
1836 | | |
1837 | | static void |
1838 | 0 | feed_eo_smb2(tvbuff_t * tvb,packet_info *pinfo,smb2_info_t * si, uint16_t dataoffset,uint32_t length, uint64_t file_offset) { |
1839 | |
|
1840 | 0 | char *fid_name = NULL; |
1841 | 0 | uint32_t open_frame = 0, close_frame = 0; |
1842 | 0 | tvbuff_t *data_tvb = NULL; |
1843 | 0 | smb_eo_t *eo_info; |
1844 | 0 | char *file_id; |
1845 | 0 | char *auxstring; |
1846 | 0 | char **aux_string_v; |
1847 | |
|
1848 | 0 | DISSECTOR_ASSERT(si->saved != NULL); |
1849 | | |
1850 | | /* Create a new tvb to point to the payload data */ |
1851 | 0 | data_tvb = tvb_new_subset_length(tvb, dataoffset, length); |
1852 | | /* Create the eo_info to pass to the listener */ |
1853 | 0 | eo_info = wmem_new(pinfo->pool, smb_eo_t); |
1854 | | /* Fill in eo_info */ |
1855 | 0 | eo_info->smbversion=2; |
1856 | | /* cmd == opcode */ |
1857 | 0 | eo_info->cmd=si->opcode; |
1858 | | /* We don't keep track of uid in SMB v2 */ |
1859 | 0 | eo_info->uid=0; |
1860 | | |
1861 | | /* Try to get file id and filename */ |
1862 | 0 | file_id=policy_hnd_to_file_id(pinfo->pool, &si->saved->policy_hnd); |
1863 | 0 | dcerpc_fetch_polhnd_data(&si->saved->policy_hnd, &fid_name, NULL, &open_frame, &close_frame, pinfo->num); |
1864 | 0 | if (fid_name && g_strcmp0(fid_name,"File: ")!=0) { |
1865 | 0 | auxstring=fid_name; |
1866 | | /* Remove "File: " from filename */ |
1867 | 0 | if (g_str_has_prefix(auxstring, "File: ")) { |
1868 | 0 | aux_string_v = g_strsplit(auxstring, "File: ", -1); |
1869 | 0 | eo_info->filename = wmem_strdup_printf(pinfo->pool, "\\%s",aux_string_v[g_strv_length(aux_string_v)-1]); |
1870 | 0 | g_strfreev(aux_string_v); |
1871 | 0 | } else { |
1872 | 0 | if (g_str_has_prefix(auxstring, "\\")) { |
1873 | 0 | eo_info->filename = wmem_strdup(pinfo->pool, auxstring); |
1874 | 0 | } else { |
1875 | 0 | eo_info->filename = wmem_strdup_printf(pinfo->pool, "\\%s",auxstring); |
1876 | 0 | } |
1877 | 0 | } |
1878 | 0 | } else { |
1879 | 0 | auxstring=wmem_strdup_printf(pinfo->pool, "File_Id_%s", file_id); |
1880 | 0 | eo_info->filename=auxstring; |
1881 | 0 | } |
1882 | |
|
1883 | 0 | if (eosmb2_take_name_as_fid) { |
1884 | 0 | eo_info->fid = g_str_hash(eo_info->filename); |
1885 | 0 | } else { |
1886 | 0 | eo_info->fid = g_str_hash(file_id); |
1887 | 0 | } |
1888 | | |
1889 | | /* tid, hostname, tree_id */ |
1890 | 0 | if (si->tree) { |
1891 | 0 | eo_info->tid=si->tree->tid; |
1892 | 0 | if (strlen(si->tree->name)>0 && strlen(si->tree->name)<=256) { |
1893 | 0 | eo_info->hostname = wmem_strdup(pinfo->pool, si->tree->name); |
1894 | 0 | } else { |
1895 | 0 | eo_info->hostname = wmem_strdup_printf(pinfo->pool, "\\\\%s\\TREEID_%i",tree_ip_str(pinfo,si->opcode),si->tree->tid); |
1896 | 0 | } |
1897 | 0 | } else { |
1898 | 0 | eo_info->tid=0; |
1899 | 0 | eo_info->hostname = wmem_strdup_printf(pinfo->pool, "\\\\%s\\TREEID_UNKNOWN",tree_ip_str(pinfo,si->opcode)); |
1900 | 0 | } |
1901 | | |
1902 | | /* packet number */ |
1903 | 0 | eo_info->pkt_num = pinfo->num; |
1904 | | |
1905 | | /* fid type */ |
1906 | 0 | if (si->eo_file_info->attr_mask & SMB2_FLAGS_ATTR_DIRECTORY) { |
1907 | 0 | eo_info->fid_type=SMB2_FID_TYPE_DIR; |
1908 | 0 | } else { |
1909 | 0 | if (si->eo_file_info->attr_mask & |
1910 | 0 | (SMB2_FLAGS_ATTR_ARCHIVE | SMB2_FLAGS_ATTR_NORMAL | |
1911 | 0 | SMB2_FLAGS_ATTR_HIDDEN | SMB2_FLAGS_ATTR_READONLY | |
1912 | 0 | SMB2_FLAGS_ATTR_SYSTEM) ) { |
1913 | 0 | eo_info->fid_type=SMB2_FID_TYPE_FILE; |
1914 | 0 | } else { |
1915 | 0 | eo_info->fid_type=SMB2_FID_TYPE_OTHER; |
1916 | 0 | } |
1917 | 0 | } |
1918 | | |
1919 | | /* end_of_file */ |
1920 | 0 | eo_info->end_of_file=si->eo_file_info->end_of_file; |
1921 | | |
1922 | | /* data offset and chunk length */ |
1923 | 0 | eo_info->smb_file_offset=file_offset; |
1924 | 0 | eo_info->smb_chunk_len=length; |
1925 | | /* XXX is this right? */ |
1926 | 0 | if (length<si->saved->bytes_moved) { |
1927 | 0 | si->saved->file_offset=si->saved->file_offset+length; |
1928 | 0 | si->saved->bytes_moved=si->saved->bytes_moved-length; |
1929 | 0 | } |
1930 | | |
1931 | | /* Payload */ |
1932 | 0 | eo_info->payload_len = length; |
1933 | 0 | eo_info->payload_data = tvb_get_ptr(data_tvb, 0, length); |
1934 | |
|
1935 | 0 | tap_queue_packet(smb2_eo_tap, pinfo, eo_info); |
1936 | |
|
1937 | 0 | } |
1938 | | |
1939 | | static int dissect_smb2_file_full_ea_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, smb2_info_t *si); |
1940 | | |
1941 | | |
1942 | | /* This is a helper to dissect the common string type |
1943 | | * uint16 offset |
1944 | | * uint16 length |
1945 | | * ... |
1946 | | * char *string |
1947 | | * |
1948 | | * This function is called twice, first to decode the offset/length and |
1949 | | * second time to dissect the actual string. |
1950 | | * It is done this way since there is no guarantee that we have the full packet and we don't |
1951 | | * want to abort dissection too early if the packet ends somewhere between the |
1952 | | * length/offset and the actual buffer. |
1953 | | * |
1954 | | */ |
1955 | | enum offset_length_buffer_offset_size { |
1956 | | OLB_O_UINT16_S_UINT16, |
1957 | | OLB_O_UINT16_S_UINT32, |
1958 | | OLB_O_UINT8_P_UINT8_S_UINT32, |
1959 | | OLB_O_UINT32_S_UINT32, |
1960 | | OLB_S_UINT32_O_UINT32 |
1961 | | }; |
1962 | | typedef struct _offset_length_buffer_t { |
1963 | | uint32_t off; |
1964 | | uint32_t len; |
1965 | | int off_offset; |
1966 | | int len_offset; |
1967 | | enum offset_length_buffer_offset_size offset_size; |
1968 | | int hfindex; |
1969 | | } offset_length_buffer_t; |
1970 | | static int |
1971 | | dissect_smb2_olb_length_offset(tvbuff_t *tvb, int offset, offset_length_buffer_t *olb, |
1972 | | enum offset_length_buffer_offset_size offset_size, int hfindex) |
1973 | 0 | { |
1974 | 0 | olb->hfindex = hfindex; |
1975 | 0 | olb->offset_size = offset_size; |
1976 | 0 | switch (offset_size) { |
1977 | 0 | case OLB_O_UINT16_S_UINT16: |
1978 | 0 | olb->off = tvb_get_letohs(tvb, offset); |
1979 | 0 | olb->off_offset = offset; |
1980 | 0 | offset += 2; |
1981 | 0 | olb->len = tvb_get_letohs(tvb, offset); |
1982 | 0 | olb->len_offset = offset; |
1983 | 0 | offset += 2; |
1984 | 0 | break; |
1985 | 0 | case OLB_O_UINT16_S_UINT32: |
1986 | 0 | olb->off = tvb_get_letohs(tvb, offset); |
1987 | 0 | olb->off_offset = offset; |
1988 | 0 | offset += 2; |
1989 | 0 | olb->len = tvb_get_letohl(tvb, offset); |
1990 | 0 | olb->len_offset = offset; |
1991 | 0 | offset += 4; |
1992 | 0 | break; |
1993 | 0 | case OLB_O_UINT8_P_UINT8_S_UINT32: |
1994 | 0 | olb->off = tvb_get_uint8(tvb, offset); |
1995 | 0 | olb->off_offset = offset; |
1996 | 0 | offset += 1; |
1997 | | /* 1 byte reserved */ |
1998 | 0 | offset += 1; |
1999 | 0 | olb->len = tvb_get_letohl(tvb, offset); |
2000 | 0 | olb->len_offset = offset; |
2001 | 0 | offset += 4; |
2002 | 0 | break; |
2003 | 0 | case OLB_O_UINT32_S_UINT32: |
2004 | 0 | olb->off = tvb_get_letohl(tvb, offset); |
2005 | 0 | olb->off_offset = offset; |
2006 | 0 | offset += 4; |
2007 | 0 | olb->len = tvb_get_letohl(tvb, offset); |
2008 | 0 | olb->len_offset = offset; |
2009 | 0 | offset += 4; |
2010 | 0 | break; |
2011 | 0 | case OLB_S_UINT32_O_UINT32: |
2012 | 0 | olb->len = tvb_get_letohl(tvb, offset); |
2013 | 0 | olb->len_offset = offset; |
2014 | 0 | offset += 4; |
2015 | 0 | olb->off = tvb_get_letohl(tvb, offset); |
2016 | 0 | olb->off_offset = offset; |
2017 | 0 | offset += 4; |
2018 | 0 | break; |
2019 | 0 | } |
2020 | | |
2021 | 0 | return offset; |
2022 | 0 | } |
2023 | | |
2024 | 0 | #define OLB_TYPE_UNICODE_STRING 0x01 |
2025 | 0 | #define OLB_TYPE_ASCII_STRING 0x02 |
2026 | | static const uint8_t * |
2027 | | dissect_smb2_olb_off_string(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, offset_length_buffer_t *olb, int base, int type) |
2028 | 0 | { |
2029 | 0 | int len, off; |
2030 | 0 | proto_item *item = NULL; |
2031 | 0 | proto_tree *tree = NULL; |
2032 | 0 | const uint8_t *name = NULL; |
2033 | |
|
2034 | 0 | olb->off += base; |
2035 | |
|
2036 | 0 | len = olb->len; |
2037 | 0 | off = olb->off; |
2038 | | |
2039 | | |
2040 | | /* sanity check */ |
2041 | 0 | tvb_ensure_bytes_exist(tvb, off, len); |
2042 | 0 | if (((off+len)<off) |
2043 | 0 | || ((off+len)>(off+tvb_reported_length_remaining(tvb, off)))) { |
2044 | 0 | proto_tree_add_expert_format(tree, pinfo, &ei_smb2_invalid_length, tvb, off, -1, |
2045 | 0 | "Invalid offset/length. Malformed packet"); |
2046 | |
|
2047 | 0 | col_append_str(pinfo->cinfo, COL_INFO, " [Malformed packet]"); |
2048 | |
|
2049 | 0 | return NULL; |
2050 | 0 | } |
2051 | | |
2052 | | |
2053 | 0 | switch (type) { |
2054 | 0 | case OLB_TYPE_UNICODE_STRING: |
2055 | 0 | item = proto_tree_add_item_ret_string(parent_tree, |
2056 | 0 | olb->hfindex, tvb, off, len, ENC_UTF_16|ENC_LITTLE_ENDIAN, |
2057 | 0 | pinfo->pool, &name); |
2058 | 0 | tree = proto_item_add_subtree(item, ett_smb2_olb); |
2059 | 0 | break; |
2060 | 0 | case OLB_TYPE_ASCII_STRING: |
2061 | 0 | item = proto_tree_add_item_ret_string(parent_tree, |
2062 | 0 | olb->hfindex, tvb, off, len, ENC_ASCII|ENC_NA, |
2063 | 0 | pinfo->pool, &name); |
2064 | 0 | tree = proto_item_add_subtree(item, ett_smb2_olb); |
2065 | 0 | break; |
2066 | 0 | } |
2067 | | |
2068 | 0 | switch (olb->offset_size) { |
2069 | 0 | case OLB_O_UINT16_S_UINT16: |
2070 | 0 | proto_tree_add_item(tree, hf_smb2_olb_offset, tvb, olb->off_offset, 2, ENC_LITTLE_ENDIAN); |
2071 | 0 | proto_tree_add_item(tree, hf_smb2_olb_length, tvb, olb->len_offset, 2, ENC_LITTLE_ENDIAN); |
2072 | 0 | break; |
2073 | 0 | case OLB_O_UINT16_S_UINT32: |
2074 | 0 | proto_tree_add_item(tree, hf_smb2_olb_offset, tvb, olb->off_offset, 2, ENC_LITTLE_ENDIAN); |
2075 | 0 | proto_tree_add_item(tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, ENC_LITTLE_ENDIAN); |
2076 | 0 | break; |
2077 | 0 | case OLB_O_UINT8_P_UINT8_S_UINT32: |
2078 | 0 | proto_tree_add_item(tree, hf_smb2_olb_offset, tvb, olb->off_offset, 1, ENC_LITTLE_ENDIAN); |
2079 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, olb->off_offset+1, 1, ENC_NA); |
2080 | 0 | proto_tree_add_item(tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, ENC_LITTLE_ENDIAN); |
2081 | 0 | break; |
2082 | 0 | case OLB_O_UINT32_S_UINT32: |
2083 | 0 | proto_tree_add_item(tree, hf_smb2_olb_offset, tvb, olb->off_offset, 4, ENC_LITTLE_ENDIAN); |
2084 | 0 | proto_tree_add_item(tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, ENC_LITTLE_ENDIAN); |
2085 | 0 | break; |
2086 | 0 | case OLB_S_UINT32_O_UINT32: |
2087 | 0 | proto_tree_add_item(tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, ENC_LITTLE_ENDIAN); |
2088 | 0 | proto_tree_add_item(tree, hf_smb2_olb_offset, tvb, olb->off_offset, 4, ENC_LITTLE_ENDIAN); |
2089 | 0 | break; |
2090 | 0 | } |
2091 | | |
2092 | 0 | return name; |
2093 | 0 | } |
2094 | | |
2095 | | static const uint8_t * |
2096 | | dissect_smb2_olb_string(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, offset_length_buffer_t *olb, int type) |
2097 | 0 | { |
2098 | 0 | return dissect_smb2_olb_off_string(pinfo, parent_tree, tvb, olb, 0, type); |
2099 | 0 | } |
2100 | | |
2101 | | static void |
2102 | | dissect_smb2_olb_buffer(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, |
2103 | | offset_length_buffer_t *olb, smb2_info_t *si, |
2104 | | void (*dissector)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si)) |
2105 | 0 | { |
2106 | 0 | int len, off; |
2107 | 0 | proto_item *sub_item = NULL; |
2108 | 0 | proto_tree *sub_tree = NULL; |
2109 | 0 | tvbuff_t *sub_tvb = NULL; |
2110 | 0 | int offset; |
2111 | |
|
2112 | 0 | offset = olb->off; |
2113 | 0 | len = olb->len; |
2114 | 0 | off = olb->off; |
2115 | | |
2116 | | /* sanity check */ |
2117 | 0 | tvb_ensure_bytes_exist(tvb, off, len); |
2118 | 0 | if (((off+len)<off) |
2119 | 0 | || ((off+len)>(off+tvb_reported_length_remaining(tvb, off)))) { |
2120 | 0 | proto_tree_add_expert_format(parent_tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, |
2121 | 0 | "Invalid offset/length. Malformed packet"); |
2122 | |
|
2123 | 0 | col_append_str(pinfo->cinfo, COL_INFO, " [Malformed packet]"); |
2124 | |
|
2125 | 0 | return; |
2126 | 0 | } |
2127 | | |
2128 | 0 | switch (olb->offset_size) { |
2129 | 0 | case OLB_O_UINT16_S_UINT16: |
2130 | 0 | proto_tree_add_item(parent_tree, hf_smb2_olb_offset, tvb, olb->off_offset, 2, ENC_LITTLE_ENDIAN); |
2131 | 0 | proto_tree_add_item(parent_tree, hf_smb2_olb_length, tvb, olb->len_offset, 2, ENC_LITTLE_ENDIAN); |
2132 | 0 | break; |
2133 | 0 | case OLB_O_UINT16_S_UINT32: |
2134 | 0 | proto_tree_add_item(parent_tree, hf_smb2_olb_offset, tvb, olb->off_offset, 2, ENC_LITTLE_ENDIAN); |
2135 | 0 | proto_tree_add_item(parent_tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, ENC_LITTLE_ENDIAN); |
2136 | 0 | break; |
2137 | 0 | case OLB_O_UINT8_P_UINT8_S_UINT32: |
2138 | 0 | proto_tree_add_item(parent_tree, hf_smb2_olb_offset, tvb, olb->off_offset, 1, ENC_LITTLE_ENDIAN); |
2139 | 0 | proto_tree_add_item(parent_tree, hf_smb2_reserved, tvb, olb->off_offset+1, 1, ENC_NA); |
2140 | 0 | proto_tree_add_item(parent_tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, ENC_LITTLE_ENDIAN); |
2141 | 0 | break; |
2142 | 0 | case OLB_O_UINT32_S_UINT32: |
2143 | 0 | proto_tree_add_item(parent_tree, hf_smb2_olb_offset, tvb, olb->off_offset, 4, ENC_LITTLE_ENDIAN); |
2144 | 0 | proto_tree_add_item(parent_tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, ENC_LITTLE_ENDIAN); |
2145 | 0 | break; |
2146 | 0 | case OLB_S_UINT32_O_UINT32: |
2147 | 0 | proto_tree_add_item(parent_tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, ENC_LITTLE_ENDIAN); |
2148 | 0 | proto_tree_add_item(parent_tree, hf_smb2_olb_offset, tvb, olb->off_offset, 4, ENC_LITTLE_ENDIAN); |
2149 | 0 | break; |
2150 | 0 | } |
2151 | | |
2152 | | /* if we don't want/need a subtree */ |
2153 | 0 | if (olb->hfindex == -1) { |
2154 | 0 | sub_item = parent_tree; |
2155 | 0 | sub_tree = parent_tree; |
2156 | 0 | } else { |
2157 | 0 | if (parent_tree) { |
2158 | 0 | sub_item = proto_tree_add_item(parent_tree, olb->hfindex, tvb, offset, len, ENC_NA); |
2159 | 0 | sub_tree = proto_item_add_subtree(sub_item, ett_smb2_olb); |
2160 | 0 | } |
2161 | 0 | } |
2162 | |
|
2163 | 0 | if (off == 0 || len == 0) { |
2164 | 0 | proto_item_append_text(sub_item, ": NO DATA"); |
2165 | 0 | return; |
2166 | 0 | } |
2167 | | |
2168 | 0 | if (!dissector) { |
2169 | 0 | return; |
2170 | 0 | } |
2171 | | |
2172 | 0 | sub_tvb = tvb_new_subset_length_caplen(tvb, off, MIN((int)len, tvb_captured_length_remaining(tvb, off)), len); |
2173 | |
|
2174 | 0 | dissector(sub_tvb, pinfo, sub_tree, si); |
2175 | 0 | } |
2176 | | |
2177 | | static int |
2178 | | dissect_smb2_olb_tvb_max_offset(int offset, offset_length_buffer_t *olb) |
2179 | 0 | { |
2180 | |
|
2181 | 0 | return MAX(offset, (int)(olb->off + olb->len)); |
2182 | 0 | } |
2183 | | |
2184 | | typedef struct _smb2_function { |
2185 | | int (*request) (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si); |
2186 | | int (*response)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si); |
2187 | | } smb2_function; |
2188 | | |
2189 | | static const true_false_string tfs_smb2_svhdx_has_initiator_id = { |
2190 | | "Has an initiator id", |
2191 | | "Does not have an initiator id" |
2192 | | }; |
2193 | | |
2194 | | static const true_false_string tfs_flags_response = { |
2195 | | "This is a RESPONSE", |
2196 | | "This is a REQUEST" |
2197 | | }; |
2198 | | |
2199 | | static const true_false_string tfs_flags_async_cmd = { |
2200 | | "This is an ASYNC command", |
2201 | | "This is a SYNC command" |
2202 | | }; |
2203 | | |
2204 | | static const true_false_string tfs_flags_dfs_op = { |
2205 | | "This is a DFS OPERATION", |
2206 | | "This is a normal operation" |
2207 | | }; |
2208 | | |
2209 | | static const true_false_string tfs_flags_chained = { |
2210 | | "This pdu is a CHAINED command", |
2211 | | "This pdu is NOT a chained command" |
2212 | | }; |
2213 | | |
2214 | | static const true_false_string tfs_flags_signature = { |
2215 | | "This pdu is SIGNED", |
2216 | | "This pdu is NOT signed" |
2217 | | }; |
2218 | | |
2219 | | static const true_false_string tfs_flags_replay_operation = { |
2220 | | "This is a REPLAY OPERATION", |
2221 | | "This is NOT a replay operation" |
2222 | | }; |
2223 | | |
2224 | | static const true_false_string tfs_flags_priority_mask = { |
2225 | | "This pdu contains a PRIORITY", |
2226 | | "This pdu does NOT contain a PRIORITY" |
2227 | | }; |
2228 | | |
2229 | | static const true_false_string tfs_cap_dfs = { |
2230 | | "This host supports DFS", |
2231 | | "This host does NOT support DFS" |
2232 | | }; |
2233 | | |
2234 | | static const true_false_string tfs_cap_leasing = { |
2235 | | "This host supports LEASING", |
2236 | | "This host does NOT support LEASING" |
2237 | | }; |
2238 | | |
2239 | | static const true_false_string tfs_cap_large_mtu = { |
2240 | | "This host supports LARGE_MTU", |
2241 | | "This host does NOT support LARGE_MTU" |
2242 | | }; |
2243 | | |
2244 | | static const true_false_string tfs_cap_multi_channel = { |
2245 | | "This host supports MULTI CHANNEL", |
2246 | | "This host does NOT support MULTI CHANNEL" |
2247 | | }; |
2248 | | |
2249 | | static const true_false_string tfs_cap_persistent_handles = { |
2250 | | "This host supports PERSISTENT HANDLES", |
2251 | | "This host does NOT support PERSISTENT HANDLES" |
2252 | | }; |
2253 | | |
2254 | | static const true_false_string tfs_cap_directory_leasing = { |
2255 | | "This host supports DIRECTORY LEASING", |
2256 | | "This host does NOT support DIRECTORY LEASING" |
2257 | | }; |
2258 | | |
2259 | | static const true_false_string tfs_cap_encryption = { |
2260 | | "This host supports ENCRYPTION", |
2261 | | "This host does NOT support ENCRYPTION" |
2262 | | }; |
2263 | | |
2264 | | static const true_false_string tfs_cap_notifications = { |
2265 | | "This host supports receiving NOTIFICATIONS", |
2266 | | "This host does NOT support receiving NOTIFICATIONS" |
2267 | | }; |
2268 | | |
2269 | | static const true_false_string tfs_smb2_ioctl_network_interface_capability_rss = { |
2270 | | "This interface supports RSS", |
2271 | | "This interface does not support RSS" |
2272 | | }; |
2273 | | |
2274 | | static const true_false_string tfs_smb2_ioctl_network_interface_capability_rdma = { |
2275 | | "This interface supports RDMA", |
2276 | | "This interface does not support RDMA" |
2277 | | }; |
2278 | | |
2279 | | static const value_string file_region_usage_vals[] = { |
2280 | | { 0x00000001, "FILE_REGION_USAGE_VALID_CACHED_DATA" }, |
2281 | | { 0, NULL } |
2282 | | }; |
2283 | | |
2284 | | static const value_string originator_flags_vals[] = { |
2285 | | { 1, "SVHDX_ORIGINATOR_PVHDPARSER" }, |
2286 | | { 4, "SVHDX_ORIGINATOR_VHDMP" }, |
2287 | | { 0, NULL } |
2288 | | }; |
2289 | | |
2290 | | static const value_string compression_format_vals[] = { |
2291 | | { 0, "COMPRESSION_FORMAT_NONE" }, |
2292 | | { 1, "COMPRESSION_FORMAT_DEFAULT" }, |
2293 | | { 2, "COMPRESSION_FORMAT_LZNT1" }, |
2294 | | { 0, NULL } |
2295 | | }; |
2296 | | |
2297 | | static const value_string checksum_algorithm_vals[] = { |
2298 | | { 0x0000, "CHECKSUM_TYPE_NONE" }, |
2299 | | { 0x0001, "CHECKSUM_TYPE_CRC32" }, |
2300 | | { 0x0002, "CHECKSUM_TYPE_CRC64" }, |
2301 | | { 0xFFFF, "CHECKSUM_TYPE_UNCHANGED" }, |
2302 | | { 0, NULL } |
2303 | | }; |
2304 | | |
2305 | | /* Note: All uncommented are "dissector not implemented" */ |
2306 | | static const value_string smb2_ioctl_vals[] = { |
2307 | | {0x00060194, "FSCTL_DFS_GET_REFERRALS"}, /* dissector implemented */ |
2308 | | {0x000601B0, "FSCTL_DFS_GET_REFERRALS_EX"}, |
2309 | | {0x00090000, "FSCTL_REQUEST_OPLOCK_LEVEL_1"}, |
2310 | | {0x00090004, "FSCTL_REQUEST_OPLOCK_LEVEL_2"}, |
2311 | | {0x00090008, "FSCTL_REQUEST_BATCH_OPLOCK"}, |
2312 | | {0x0009000C, "FSCTL_OPLOCK_BREAK_ACKNOWLEDGE"}, |
2313 | | {0x00090010, "FSCTL_OPBATCH_ACK_CLOSE_PENDING"}, |
2314 | | {0x00090014, "FSCTL_OPLOCK_BREAK_NOTIFY"}, |
2315 | | {0x00090018, "FSCTL_LOCK_VOLUME"}, |
2316 | | {0x0009001C, "FSCTL_UNLOCK_VOLUME"}, |
2317 | | {0x00090020, "FSCTL_DISMOUNT_VOLUME"}, |
2318 | | {0x00090028, "FSCTL_IS_VOLUME_MOUNTED"}, |
2319 | | {0x0009002C, "FSCTL_IS_PATHNAME_VALID"}, |
2320 | | {0x00090030, "FSCTL_MARK_VOLUME_DIRTY"}, |
2321 | | {0x0009003B, "FSCTL_QUERY_RETRIEVAL_POINTERS"}, |
2322 | | {0x0009003C, "FSCTL_GET_COMPRESSION"}, /* dissector implemented */ |
2323 | | {0x0009004F, "FSCTL_MARK_AS_SYSTEM_HIVE"}, |
2324 | | {0x00090050, "FSCTL_OPLOCK_BREAK_ACK_NO_2"}, |
2325 | | {0x00090054, "FSCTL_INVALIDATE_VOLUMES"}, |
2326 | | {0x00090058, "FSCTL_QUERY_FAT_BPB"}, |
2327 | | {0x0009005C, "FSCTL_REQUEST_FILTER_OPLOCK"}, |
2328 | | {0x00090060, "FSCTL_FILESYSTEM_GET_STATISTICS"}, |
2329 | | {0x00090064, "FSCTL_GET_NTFS_VOLUME_DATA"}, |
2330 | | {0x00090068, "FSCTL_GET_NTFS_FILE_RECORD"}, |
2331 | | {0x0009006F, "FSCTL_GET_VOLUME_BITMAP"}, |
2332 | | {0x00090073, "FSCTL_GET_RETRIEVAL_POINTERS"}, |
2333 | | {0x00090074, "FSCTL_MOVE_FILE"}, |
2334 | | {0x00090078, "FSCTL_IS_VOLUME_DIRTY"}, |
2335 | | {0x0009007C, "FSCTL_GET_HFS_INFORMATION"}, |
2336 | | {0x00090083, "FSCTL_ALLOW_EXTENDED_DASD_IO"}, |
2337 | | {0x00090087, "FSCTL_READ_PROPERTY_DATA"}, |
2338 | | {0x0009008B, "FSCTL_WRITE_PROPERTY_DATA"}, |
2339 | | {0x0009008F, "FSCTL_FIND_FILES_BY_SID"}, |
2340 | | {0x00090097, "FSCTL_DUMP_PROPERTY_DATA"}, |
2341 | | {0x0009009C, "FSCTL_GET_OBJECT_ID"}, /* dissector implemented */ |
2342 | | {0x000900A4, "FSCTL_SET_REPARSE_POINT"}, /* dissector implemented */ |
2343 | | {0x000900A8, "FSCTL_GET_REPARSE_POINT"}, /* dissector implemented */ |
2344 | | {0x000900C0, "FSCTL_CREATE_OR_GET_OBJECT_ID"}, /* dissector implemented */ |
2345 | | {0x000900C4, "FSCTL_SET_SPARSE"}, /* dissector implemented */ |
2346 | | {0x000900D4, "FSCTL_SET_ENCRYPTION"}, |
2347 | | {0x000900DB, "FSCTL_ENCRYPTION_FSCTL_IO"}, |
2348 | | {0x000900DF, "FSCTL_WRITE_RAW_ENCRYPTED"}, |
2349 | | {0x000900E3, "FSCTL_READ_RAW_ENCRYPTED"}, |
2350 | | {0x000900F0, "FSCTL_EXTEND_VOLUME"}, |
2351 | | {0x00090244, "FSCTL_CSV_TUNNEL_REQUEST"}, |
2352 | | {0x0009027C, "FSCTL_GET_INTEGRITY_INFORMATION"}, /* dissector implemented */ |
2353 | | {0x00090284, "FSCTL_QUERY_FILE_REGIONS"}, /* dissector implemented */ |
2354 | | {0x000902c8, "FSCTL_CSV_SYNC_TUNNEL_REQUEST"}, |
2355 | | {0x00090300, "FSCTL_QUERY_SHARED_VIRTUAL_DISK_SUPPORT"}, /* dissector implemented */ |
2356 | | {0x00090304, "FSCTL_SVHDX_SYNC_TUNNEL_REQUEST"}, /* dissector implemented */ |
2357 | | {0x00090308, "FSCTL_SVHDX_SET_INITIATOR_INFORMATION"}, |
2358 | | {0x0009030C, "FSCTL_SET_EXTERNAL_BACKING"}, |
2359 | | {0x00090310, "FSCTL_GET_EXTERNAL_BACKING"}, |
2360 | | {0x00090314, "FSCTL_DELETE_EXTERNAL_BACKING"}, |
2361 | | {0x00090318, "FSCTL_ENUM_EXTERNAL_BACKING"}, |
2362 | | {0x0009031F, "FSCTL_ENUM_OVERLAY"}, |
2363 | | {0x00090350, "FSCTL_STORAGE_QOS_CONTROL"}, /* dissector implemented */ |
2364 | | {0x00090364, "FSCTL_SVHDX_ASYNC_TUNNEL_REQUEST"}, /* dissector implemented */ |
2365 | | {0x00090380, "FSCTL_SET_INTEGRITY_INFORMATION_EX"}, /* dissector implemented */ |
2366 | | {0x00090440, "FSCTL_REFS_STREAM_SNAPSHOT_MANAGEMENT"}, /* dissector implemented */ |
2367 | | {0x000940B3, "FSCTL_ENUM_USN_DATA"}, |
2368 | | {0x000940B7, "FSCTL_SECURITY_ID_CHECK"}, |
2369 | | {0x000940BB, "FSCTL_READ_USN_JOURNAL"}, |
2370 | | {0x000940CF, "FSCTL_QUERY_ALLOCATED_RANGES"}, /* dissector implemented */ |
2371 | | {0x000940E7, "FSCTL_CREATE_USN_JOURNAL"}, |
2372 | | {0x000940EB, "FSCTL_READ_FILE_USN_DATA"}, |
2373 | | {0x000940EF, "FSCTL_WRITE_USN_CLOSE_RECORD"}, |
2374 | | {0x00094264, "FSCTL_OFFLOAD_READ"}, /* dissector implemented */ |
2375 | | {0x00098098, "FSCTL_SET_OBJECT_ID"}, /* dissector implemented */ |
2376 | | {0x000980A0, "FSCTL_DELETE_OBJECT_ID"}, /* no data in/out */ |
2377 | | {0x000980A4, "FSCTL_SET_REPARSE_POINT"}, |
2378 | | {0x000980AC, "FSCTL_DELETE_REPARSE_POINT"}, |
2379 | | {0x000980BC, "FSCTL_SET_OBJECT_ID_EXTENDED"}, /* dissector implemented */ |
2380 | | {0x000980C8, "FSCTL_SET_ZERO_DATA"}, /* dissector implemented */ |
2381 | | {0x000980D0, "FSCTL_ENABLE_UPGRADE"}, |
2382 | | {0x00098208, "FSCTL_FILE_LEVEL_TRIM"}, |
2383 | | {0x00098268, "FSCTL_OFFLOAD_WRITE"}, /* dissector implemented */ |
2384 | | {0x00098344, "FSCTL_DUPLICATE_EXTENTS_TO_FILE"}, /* dissector implemented */ |
2385 | | {0x0009C040, "FSCTL_SET_COMPRESSION"}, /* dissector implemented */ |
2386 | | {0x0009C280, "FSCTL_SET_INTEGRITY_INFORMATION"}, /* dissector implemented */ |
2387 | | {0x00110018, "FSCTL_PIPE_WAIT"}, /* dissector implemented */ |
2388 | | {0x0011400C, "FSCTL_PIPE_PEEK"}, |
2389 | | {0x0011C017, "FSCTL_PIPE_TRANSCEIVE"}, /* dissector implemented */ |
2390 | | {0x00140078, "FSCTL_SRV_REQUEST_RESUME_KEY"}, |
2391 | | {0x001401D4, "FSCTL_LMR_REQUEST_RESILIENCY"}, /* dissector implemented */ |
2392 | | {0x001401FC, "FSCTL_QUERY_NETWORK_INTERFACE_INFO"}, /* dissector implemented */ |
2393 | | {0x00140200, "FSCTL_VALIDATE_NEGOTIATE_INFO_224"}, /* dissector implemented */ |
2394 | | {0x00140204, "FSCTL_VALIDATE_NEGOTIATE_INFO"}, /* dissector implemented */ |
2395 | | {0x00144064, "FSCTL_SRV_ENUMERATE_SNAPSHOTS"}, /* dissector implemented */ |
2396 | | {0x001440F2, "FSCTL_SRV_COPYCHUNK"}, |
2397 | | {0x001441bb, "FSCTL_SRV_READ_HASH"}, |
2398 | | {0x001480F2, "FSCTL_SRV_COPYCHUNK_WRITE"}, |
2399 | | { 0, NULL } |
2400 | | }; |
2401 | | static value_string_ext smb2_ioctl_vals_ext = VALUE_STRING_EXT_INIT(smb2_ioctl_vals); |
2402 | | |
2403 | | static const value_string smb2_ioctl_device_vals[] = { |
2404 | | { 0x0001, "BEEP" }, |
2405 | | { 0x0002, "CD_ROM" }, |
2406 | | { 0x0003, "CD_ROM_FILE_SYSTEM" }, |
2407 | | { 0x0004, "CONTROLLER" }, |
2408 | | { 0x0005, "DATALINK" }, |
2409 | | { 0x0006, "DFS" }, |
2410 | | { 0x0007, "DISK" }, |
2411 | | { 0x0008, "DISK_FILE_SYSTEM" }, |
2412 | | { 0x0009, "FILE_SYSTEM" }, |
2413 | | { 0x000a, "INPORT_PORT" }, |
2414 | | { 0x000b, "KEYBOARD" }, |
2415 | | { 0x000c, "MAILSLOT" }, |
2416 | | { 0x000d, "MIDI_IN" }, |
2417 | | { 0x000e, "MIDI_OUT" }, |
2418 | | { 0x000f, "MOUSE" }, |
2419 | | { 0x0010, "MULTI_UNC_PROVIDER" }, |
2420 | | { 0x0011, "NAMED_PIPE" }, |
2421 | | { 0x0012, "NETWORK" }, |
2422 | | { 0x0013, "NETWORK_BROWSER" }, |
2423 | | { 0x0014, "NETWORK_FILE_SYSTEM" }, |
2424 | | { 0x0015, "NULL" }, |
2425 | | { 0x0016, "PARALLEL_PORT" }, |
2426 | | { 0x0017, "PHYSICAL_NETCARD" }, |
2427 | | { 0x0018, "PRINTER" }, |
2428 | | { 0x0019, "SCANNER" }, |
2429 | | { 0x001a, "SERIAL_MOUSE_PORT" }, |
2430 | | { 0x001b, "SERIAL_PORT" }, |
2431 | | { 0x001c, "SCREEN" }, |
2432 | | { 0x001d, "SOUND" }, |
2433 | | { 0x001e, "STREAMS" }, |
2434 | | { 0x001f, "TAPE" }, |
2435 | | { 0x0020, "TAPE_FILE_SYSTEM" }, |
2436 | | { 0x0021, "TRANSPORT" }, |
2437 | | { 0x0022, "UNKNOWN" }, |
2438 | | { 0x0023, "VIDEO" }, |
2439 | | { 0x0024, "VIRTUAL_DISK" }, |
2440 | | { 0x0025, "WAVE_IN" }, |
2441 | | { 0x0026, "WAVE_OUT" }, |
2442 | | { 0x0027, "8042_PORT" }, |
2443 | | { 0x0028, "NETWORK_REDIRECTOR" }, |
2444 | | { 0x0029, "BATTERY" }, |
2445 | | { 0x002a, "BUS_EXTENDER" }, |
2446 | | { 0x002b, "MODEM" }, |
2447 | | { 0x002c, "VDM" }, |
2448 | | { 0x002d, "MASS_STORAGE" }, |
2449 | | { 0x002e, "SMB" }, |
2450 | | { 0x002f, "KS" }, |
2451 | | { 0x0030, "CHANGER" }, |
2452 | | { 0x0031, "SMARTCARD" }, |
2453 | | { 0x0032, "ACPI" }, |
2454 | | { 0x0033, "DVD" }, |
2455 | | { 0x0034, "FULLSCREEN_VIDEO" }, |
2456 | | { 0x0035, "DFS_FILE_SYSTEM" }, |
2457 | | { 0x0036, "DFS_VOLUME" }, |
2458 | | { 0x0037, "SERENUM" }, |
2459 | | { 0x0038, "TERMSRV" }, |
2460 | | { 0x0039, "KSEC" }, |
2461 | | { 0, NULL } |
2462 | | }; |
2463 | | static value_string_ext smb2_ioctl_device_vals_ext = VALUE_STRING_EXT_INIT(smb2_ioctl_device_vals); |
2464 | | |
2465 | | static const value_string smb2_ioctl_access_vals[] = { |
2466 | | { 0x00, "FILE_ANY_ACCESS" }, |
2467 | | { 0x01, "FILE_READ_ACCESS" }, |
2468 | | { 0x02, "FILE_WRITE_ACCESS" }, |
2469 | | { 0x03, "FILE_READ_WRITE_ACCESS" }, |
2470 | | { 0, NULL } |
2471 | | }; |
2472 | | |
2473 | | static const value_string smb2_ioctl_method_vals[] = { |
2474 | | { 0x00, "METHOD_BUFFERED" }, |
2475 | | { 0x01, "METHOD_IN_DIRECT" }, |
2476 | | { 0x02, "METHOD_OUT_DIRECT" }, |
2477 | | { 0x03, "METHOD_NEITHER" }, |
2478 | | { 0, NULL } |
2479 | | }; |
2480 | | |
2481 | | static const value_string smb2_ioctl_shared_virtual_disk_vals[] = { |
2482 | | { 0x01, "SharedVirtualDisksSupported" }, |
2483 | | { 0x07, "SharedVirtualDiskCDPSnapshotsSupported" }, |
2484 | | { 0, NULL } |
2485 | | }; |
2486 | | |
2487 | | static const value_string smb2_ioctl_shared_virtual_disk_hstate_vals[] = { |
2488 | | { 0x00, "HandleStateNone" }, |
2489 | | { 0x01, "HandleStateFileShared" }, |
2490 | | { 0x03, "HandleStateShared" }, |
2491 | | { 0, NULL } |
2492 | | }; |
2493 | | |
2494 | | /* this is called from both smb and smb2. */ |
2495 | | int |
2496 | | dissect_smb2_ioctl_function(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, uint32_t *ioctlfunc) |
2497 | 0 | { |
2498 | 0 | proto_item *item = NULL; |
2499 | 0 | proto_tree *tree = NULL; |
2500 | 0 | uint32_t ioctl_function; |
2501 | |
|
2502 | 0 | if (parent_tree) { |
2503 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_ioctl_function, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
2504 | 0 | tree = proto_item_add_subtree(item, ett_smb2_ioctl_function); |
2505 | 0 | } |
2506 | |
|
2507 | 0 | ioctl_function = tvb_get_letohl(tvb, offset); |
2508 | 0 | if (ioctlfunc) |
2509 | 0 | *ioctlfunc = ioctl_function; |
2510 | 0 | if (ioctl_function) { |
2511 | 0 | const char *unknown = "unknown"; |
2512 | 0 | const char *ioctl_name = val_to_str_ext_const(ioctl_function, |
2513 | 0 | &smb2_ioctl_vals_ext, |
2514 | 0 | unknown); |
2515 | | |
2516 | | /* |
2517 | | * val_to_str_const() doesn't work with a unknown == NULL |
2518 | | */ |
2519 | 0 | if (ioctl_name == unknown) { |
2520 | 0 | ioctl_name = NULL; |
2521 | 0 | } |
2522 | |
|
2523 | 0 | if (ioctl_name != NULL) { |
2524 | 0 | col_append_fstr( |
2525 | 0 | pinfo->cinfo, COL_INFO, " %s", ioctl_name); |
2526 | 0 | } |
2527 | | |
2528 | | /* device */ |
2529 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_function_device, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
2530 | 0 | if (ioctl_name == NULL) { |
2531 | 0 | col_append_fstr( |
2532 | 0 | pinfo->cinfo, COL_INFO, " %s", |
2533 | 0 | val_to_str_ext((ioctl_function>>16)&0xffff, &smb2_ioctl_device_vals_ext, |
2534 | 0 | "Unknown (0x%08X)")); |
2535 | 0 | } |
2536 | | |
2537 | | /* access */ |
2538 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_function_access, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
2539 | | |
2540 | | /* function */ |
2541 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_function_function, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
2542 | 0 | if (ioctl_name == NULL) { |
2543 | 0 | col_append_fstr( |
2544 | 0 | pinfo->cinfo, COL_INFO, " Function:0x%04x", |
2545 | 0 | (ioctl_function>>2)&0x0fff); |
2546 | 0 | } |
2547 | | |
2548 | | /* method */ |
2549 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_function_method, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
2550 | 0 | } |
2551 | |
|
2552 | 0 | offset += 4; |
2553 | |
|
2554 | 0 | return offset; |
2555 | 0 | } |
2556 | | |
2557 | | /* fake the dce/rpc support structures so we can piggy back on |
2558 | | * dissect_nt_policy_hnd() since this will allow us |
2559 | | * a cheap way to track where FIDs are opened, closed |
2560 | | * and fid->filename mappings |
2561 | | * if we want to do those things in the future. |
2562 | | */ |
2563 | 0 | #define FID_MODE_OPEN 0 |
2564 | 0 | #define FID_MODE_CLOSE 1 |
2565 | 0 | #define FID_MODE_USE 2 |
2566 | 0 | #define FID_MODE_DHNQ 3 |
2567 | 0 | #define FID_MODE_DHNC 4 |
2568 | | static int |
2569 | | dissect_smb2_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si, int mode) |
2570 | 0 | { |
2571 | 0 | uint8_t drep[4] = { 0x10, 0x00, 0x00, 0x00}; /* fake DREP struct */ |
2572 | 0 | static dcerpc_info di; /* fake dcerpc_info struct */ |
2573 | 0 | static dcerpc_call_value call_data; |
2574 | 0 | e_ctx_hnd policy_hnd = {0, DCERPC_UUID_NULL}; |
2575 | 0 | e_ctx_hnd *policy_hnd_hashtablekey; |
2576 | 0 | proto_item *hnd_item = NULL; |
2577 | 0 | char *fid_name; |
2578 | 0 | uint32_t open_frame = 0, close_frame = 0; |
2579 | 0 | smb2_eo_file_info_t *eo_file_info; |
2580 | 0 | smb2_fid_info_t sfi_key; |
2581 | 0 | smb2_fid_info_t *sfi = NULL; |
2582 | 0 | uint8_t buf[8]; |
2583 | 0 | uint64_t pol_uuid; |
2584 | |
|
2585 | 0 | memset(&sfi_key, 0, sizeof(sfi_key)); |
2586 | 0 | sfi_key.fid_persistent = tvb_get_letoh64(tvb, offset); |
2587 | 0 | sfi_key.fid_volatile = tvb_get_letoh64(tvb, offset+8); |
2588 | 0 | sfi_key.sesid = si->sesid; |
2589 | 0 | sfi_key.tid = si->tid; |
2590 | 0 | sfi_key.frame_key = pinfo->num; |
2591 | 0 | sfi_key.name = NULL; |
2592 | |
|
2593 | 0 | di.conformant_run = 0; |
2594 | | /* we need di->call_data->flags.NDR64 == 0 */ |
2595 | 0 | di.call_data = &call_data; |
2596 | |
|
2597 | 0 | switch (mode) { |
2598 | 0 | case FID_MODE_OPEN: |
2599 | | /* This mode is only for create requests */ |
2600 | 0 | if (si->saved) { |
2601 | 0 | offset = dissect_nt_guid_hnd(tvb, offset, pinfo, tree, &di, drep, hf_smb2_fid, |
2602 | 0 | &policy_hnd, &hnd_item, PIDL_POLHND_OPEN); |
2603 | 0 | si->saved->hnd_item = hnd_item; |
2604 | 0 | } |
2605 | 0 | if (!pinfo->fd->visited) { |
2606 | 0 | sfi = wmem_new(wmem_file_scope(), smb2_fid_info_t); |
2607 | 0 | *sfi = sfi_key; |
2608 | 0 | sfi->frame_key = 0; |
2609 | 0 | sfi->frame_beg = pinfo->fd->num; |
2610 | 0 | sfi->frame_end = UINT32_MAX; |
2611 | |
|
2612 | 0 | if (si->saved && si->saved->extra_info_type == SMB2_EI_FILENAME) { |
2613 | 0 | sfi->name = wmem_strdup(wmem_file_scope(), (char *)si->saved->extra_info); |
2614 | 0 | } else { |
2615 | 0 | sfi->name = wmem_strdup_printf(wmem_file_scope(), "[unknown]"); |
2616 | 0 | } |
2617 | |
|
2618 | 0 | if (si->saved && si->saved->extra_info_type == SMB2_EI_FILENAME) { |
2619 | 0 | fid_name = wmem_strdup_printf(wmem_file_scope(), "File: %s", |
2620 | 0 | (char *)si->saved->extra_info); |
2621 | 0 | } else { |
2622 | 0 | fid_name = wmem_strdup_printf(wmem_file_scope(), "File: "); |
2623 | 0 | } |
2624 | 0 | dcerpc_store_polhnd_name(&policy_hnd, pinfo, fid_name); |
2625 | |
|
2626 | 0 | wmem_map_insert(si->session->fids, sfi, sfi); |
2627 | 0 | si->file = sfi; |
2628 | | |
2629 | | /* If needed, create the file entry and save the policy hnd */ |
2630 | 0 | if (si->saved) { |
2631 | 0 | si->saved->file = sfi; |
2632 | 0 | si->saved->policy_hnd = policy_hnd; |
2633 | 0 | } |
2634 | |
|
2635 | 0 | if (si->conv) { |
2636 | 0 | eo_file_info = (smb2_eo_file_info_t *)wmem_map_lookup(si->session->files,&policy_hnd); |
2637 | 0 | if (!eo_file_info) { |
2638 | 0 | eo_file_info = wmem_new(wmem_file_scope(), smb2_eo_file_info_t); |
2639 | 0 | policy_hnd_hashtablekey = wmem_new(wmem_file_scope(), e_ctx_hnd); |
2640 | 0 | memcpy(policy_hnd_hashtablekey, &policy_hnd, sizeof(e_ctx_hnd)); |
2641 | 0 | eo_file_info->end_of_file=0; |
2642 | 0 | wmem_map_insert(si->session->files,policy_hnd_hashtablekey,eo_file_info); |
2643 | 0 | } |
2644 | 0 | si->eo_file_info=eo_file_info; |
2645 | 0 | } |
2646 | 0 | } |
2647 | |
|
2648 | 0 | break; |
2649 | 0 | case FID_MODE_CLOSE: |
2650 | | /* This mode is only for close requests */ |
2651 | |
|
2652 | 0 | if (!pinfo->fd->visited) { |
2653 | 0 | smb2_fid_info_t *fid = (smb2_fid_info_t *)wmem_map_lookup(si->session->fids, &sfi_key); |
2654 | |
|
2655 | 0 | if (fid) |
2656 | 0 | fid->frame_end = pinfo->fd->num; |
2657 | 0 | if (si->saved) |
2658 | 0 | si->saved->frame_end = pinfo->fd->num; |
2659 | 0 | } |
2660 | |
|
2661 | 0 | offset = dissect_nt_guid_hnd(tvb, offset, pinfo, tree, &di, drep, hf_smb2_fid, &policy_hnd, |
2662 | 0 | &hnd_item, PIDL_POLHND_CLOSE); |
2663 | |
|
2664 | 0 | if (si->saved) |
2665 | 0 | si->saved->hnd_item = hnd_item; |
2666 | 0 | break; |
2667 | 0 | case FID_MODE_USE: |
2668 | 0 | case FID_MODE_DHNQ: |
2669 | 0 | case FID_MODE_DHNC: |
2670 | 0 | offset = dissect_nt_guid_hnd(tvb, offset, pinfo, tree, &di, drep, hf_smb2_fid, |
2671 | 0 | &policy_hnd, &hnd_item, PIDL_POLHND_USE); |
2672 | 0 | if (si->saved) |
2673 | 0 | si->saved->hnd_item = hnd_item; |
2674 | 0 | break; |
2675 | 0 | } |
2676 | | |
2677 | 0 | si->file = (smb2_fid_info_t *)wmem_map_lookup(si->session->fids, &sfi_key); |
2678 | 0 | if (si->file) { |
2679 | 0 | if (si->saved) { |
2680 | 0 | si->saved->file = si->file; |
2681 | 0 | } |
2682 | 0 | if (si->file->name) { |
2683 | 0 | if (hnd_item) { |
2684 | 0 | proto_item_append_text(hnd_item, ", File: %s", si->file->name); |
2685 | 0 | } |
2686 | 0 | } |
2687 | 0 | } |
2688 | |
|
2689 | 0 | if (dcerpc_fetch_polhnd_data(&policy_hnd, &fid_name, NULL, &open_frame, &close_frame, pinfo->num)) { |
2690 | | /* look for the eo_file_info */ |
2691 | 0 | if (!si->eo_file_info) { |
2692 | 0 | if (si->saved) { si->saved->policy_hnd = policy_hnd; } |
2693 | 0 | if (si->conv) { |
2694 | 0 | eo_file_info = (smb2_eo_file_info_t *)wmem_map_lookup(si->session->files,&policy_hnd); |
2695 | 0 | if (eo_file_info) { |
2696 | 0 | si->eo_file_info=eo_file_info; |
2697 | 0 | } else { /* XXX This should never happen */ |
2698 | 0 | eo_file_info = wmem_new(wmem_file_scope(), smb2_eo_file_info_t); |
2699 | 0 | policy_hnd_hashtablekey = wmem_new(wmem_file_scope(), e_ctx_hnd); |
2700 | 0 | memcpy(policy_hnd_hashtablekey, &policy_hnd, sizeof(e_ctx_hnd)); |
2701 | 0 | eo_file_info->end_of_file=0; |
2702 | 0 | wmem_map_insert(si->session->files,policy_hnd_hashtablekey,eo_file_info); |
2703 | 0 | } |
2704 | 0 | } |
2705 | 0 | } |
2706 | 0 | } |
2707 | | /* Calculate GUID (FID) hash |
2708 | | * This provides hash that can be filtered on to provide all of the SMB2 requests and responses |
2709 | | * associated with a given FID. Note that filtering instead on the FID, only returns the CREATE |
2710 | | * response, and SMB2 requests but not their responses. |
2711 | | */ |
2712 | 0 | if (si->saved |
2713 | 0 | && policy_hnd.uuid.data1 > 0 |
2714 | 0 | && policy_hnd.uuid.data1 < 0xffffffff) { |
2715 | 0 | pol_uuid = policy_hnd.uuid.data1 + policy_hnd.uuid.data2 + policy_hnd.uuid.data3; |
2716 | 0 | for(int i = 0; i < 8; i++) { |
2717 | 0 | buf[i] = (pol_uuid >> (56 - i * 8)) & 0xFF; |
2718 | 0 | } |
2719 | 0 | si->saved->fid_hash = crc32_ccitt(buf, 8); |
2720 | 0 | } |
2721 | 0 | return offset; |
2722 | 0 | } |
2723 | | |
2724 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_READ_ONLY 0x00000001 |
2725 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_HIDDEN 0x00000002 |
2726 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_SYSTEM 0x00000004 |
2727 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_DIRECTORY 0x00000010 |
2728 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_ARCHIVE 0x00000020 |
2729 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_NORMAL 0x00000080 |
2730 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_TEMPORARY 0x00000100 |
2731 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 |
2732 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 |
2733 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_COMPRESSED 0x00000800 |
2734 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_OFFLINE 0x00001000 |
2735 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 |
2736 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_ENCRYPTED 0x00004000 |
2737 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000 |
2738 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_NO_SCRUB_DATA 0x00020000 |
2739 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_RECALL_ON_OPEN 0x00040000 |
2740 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_PINNED 0x00080000 |
2741 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_UNPINNED 0x00100000 |
2742 | 14 | #define SMB2_FSCC_FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS 0x00400000 |
2743 | | |
2744 | | |
2745 | | static const true_false_string tfs_fscc_file_attribute_reparse = { |
2746 | | "Has an associated REPARSE POINT", |
2747 | | "Does NOT have an associated reparse point" |
2748 | | }; |
2749 | | static const true_false_string tfs_fscc_file_attribute_compressed = { |
2750 | | "COMPRESSED", |
2751 | | "Uncompressed" |
2752 | | }; |
2753 | | static const true_false_string tfs_fscc_file_attribute_offline = { |
2754 | | "OFFLINE", |
2755 | | "Online" |
2756 | | }; |
2757 | | static const true_false_string tfs_fscc_file_attribute_not_content_indexed = { |
2758 | | "Is not indexed by the content indexing service", |
2759 | | "Is indexed by the content indexing service" |
2760 | | }; |
2761 | | static const true_false_string tfs_fscc_file_attribute_integrity_stream = { |
2762 | | "Has Integrity Support", |
2763 | | "Does NOT have Integrity Support" |
2764 | | }; |
2765 | | static const true_false_string tfs_fscc_file_attribute_no_scrub_data = { |
2766 | | "Is excluded from the data integrity scan", |
2767 | | "Is not excluded from the data integrity scan" |
2768 | | }; |
2769 | | static const true_false_string tfs_fscc_file_attribute_recall_on_open = { |
2770 | | "When OPENED, remote file should be fetched from remote storage", |
2771 | | "When OPENED, remote file should NOT be fetched from remote storage" |
2772 | | }; |
2773 | | static const true_false_string tfs_fscc_file_attribute_pinned = { |
2774 | | "File/dir should be kept locally even when unused", |
2775 | | "File/dir should NOT be kept locally when unused" |
2776 | | }; |
2777 | | static const true_false_string tfs_fscc_file_attribute_unpinned = { |
2778 | | "File/dir should NOT be fully kept locally except when accessed", |
2779 | | "File/dir should be fully kept locally when accessed" |
2780 | | }; |
2781 | | static const true_false_string tfs_fscc_file_attribute_recall_on_data_access = { |
2782 | | "When accessed remote content of file/dir should be fetched", |
2783 | | "When accessed remote content of file/dir should NOT be fetched" |
2784 | | }; |
2785 | | |
2786 | | /* |
2787 | | * File Attributes, section 2.6 in the [MS-FSCC] spec |
2788 | | */ |
2789 | | static int |
2790 | | dissect_fscc_file_attr(tvbuff_t* tvb, proto_tree* parent_tree, int offset, uint32_t* attr) |
2791 | 0 | { |
2792 | 0 | uint32_t mask = tvb_get_letohl(tvb, offset); |
2793 | 0 | static int* const mask_fields[] = { |
2794 | 0 | &hf_smb2_fscc_file_attr_read_only, |
2795 | 0 | &hf_smb2_fscc_file_attr_hidden, |
2796 | 0 | &hf_smb2_fscc_file_attr_system, |
2797 | 0 | &hf_smb2_fscc_file_attr_directory, |
2798 | 0 | &hf_smb2_fscc_file_attr_archive, |
2799 | 0 | &hf_smb2_fscc_file_attr_normal, |
2800 | 0 | &hf_smb2_fscc_file_attr_temporary, |
2801 | 0 | &hf_smb2_fscc_file_attr_sparse_file, |
2802 | 0 | &hf_smb2_fscc_file_attr_reparse_point, |
2803 | 0 | &hf_smb2_fscc_file_attr_compressed, |
2804 | 0 | &hf_smb2_fscc_file_attr_offline, |
2805 | 0 | &hf_smb2_fscc_file_attr_not_content_indexed, |
2806 | 0 | &hf_smb2_fscc_file_attr_encrypted, |
2807 | 0 | &hf_smb2_fscc_file_attr_integrity_stream, |
2808 | 0 | &hf_smb2_fscc_file_attr_no_scrub_data, |
2809 | 0 | &hf_smb2_fscc_file_attr_recall_on_open, |
2810 | 0 | &hf_smb2_fscc_file_attr_pinned, |
2811 | 0 | &hf_smb2_fscc_file_attr_unpinned, |
2812 | 0 | &hf_smb2_fscc_file_attr_recall_on_data_access, |
2813 | 0 | NULL |
2814 | 0 | }; |
2815 | |
|
2816 | 0 | proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_smb2_fscc_file_attr, ett_smb2_fscc_file_attributes, mask_fields, mask, BMT_NO_APPEND); |
2817 | |
|
2818 | 0 | offset += 4; |
2819 | |
|
2820 | 0 | if (attr) |
2821 | 0 | *attr = mask; |
2822 | |
|
2823 | 0 | return offset; |
2824 | 0 | } |
2825 | | |
2826 | | /* this info level is unique to SMB2 and differst from the corresponding |
2827 | | * SMB_FILE_ALL_INFO in SMB |
2828 | | */ |
2829 | | static int |
2830 | | dissect_smb2_file_all_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
2831 | 0 | { |
2832 | 0 | proto_item *item = NULL; |
2833 | 0 | proto_tree *tree = NULL; |
2834 | 0 | int length; |
2835 | 0 | static int * const mode_fields[] = { |
2836 | 0 | &hf_smb2_mode_file_write_through, |
2837 | 0 | &hf_smb2_mode_file_sequential_only, |
2838 | 0 | &hf_smb2_mode_file_no_intermediate_buffering, |
2839 | 0 | &hf_smb2_mode_file_synchronous_io_alert, |
2840 | 0 | &hf_smb2_mode_file_synchronous_io_nonalert, |
2841 | 0 | &hf_smb2_mode_file_delete_on_close, |
2842 | 0 | NULL, |
2843 | 0 | }; |
2844 | |
|
2845 | 0 | if (parent_tree) { |
2846 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_all_info, tvb, offset, -1, ENC_NA); |
2847 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_all_info); |
2848 | 0 | } |
2849 | | |
2850 | | /* create time */ |
2851 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_create_timestamp, ENC_LITTLE_ENDIAN); |
2852 | 0 | offset += 8; |
2853 | | |
2854 | | /* last access */ |
2855 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_access_timestamp, ENC_LITTLE_ENDIAN); |
2856 | 0 | offset += 8; |
2857 | | |
2858 | | /* last write */ |
2859 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_write_timestamp, ENC_LITTLE_ENDIAN); |
2860 | 0 | offset += 8; |
2861 | | |
2862 | | /* last change */ |
2863 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_change_timestamp, ENC_LITTLE_ENDIAN); |
2864 | 0 | offset += 8; |
2865 | | |
2866 | | /* File Attributes */ |
2867 | 0 | offset = dissect_fscc_file_attr(tvb, tree, offset, NULL); |
2868 | | |
2869 | | /* some unknown bytes */ |
2870 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 4, ENC_NA); |
2871 | 0 | offset += 4; |
2872 | | |
2873 | | /* allocation size */ |
2874 | 0 | proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
2875 | 0 | offset += 8; |
2876 | | |
2877 | | /* end of file */ |
2878 | 0 | proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
2879 | 0 | offset += 8; |
2880 | | |
2881 | | /* number of links */ |
2882 | 0 | proto_tree_add_item(tree, hf_smb2_nlinks, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
2883 | 0 | offset += 4; |
2884 | | |
2885 | | /* delete pending */ |
2886 | 0 | proto_tree_add_item(tree, hf_smb2_delete_pending, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
2887 | 0 | offset += 1; |
2888 | | |
2889 | | /* is directory */ |
2890 | 0 | proto_tree_add_item(tree, hf_smb2_is_directory, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
2891 | 0 | offset += 1; |
2892 | | |
2893 | | /* padding */ |
2894 | 0 | offset += 2; |
2895 | | |
2896 | | /* file id */ |
2897 | 0 | proto_tree_add_item(tree, hf_smb2_file_id, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
2898 | 0 | offset += 8; |
2899 | | |
2900 | | /* ea size */ |
2901 | 0 | proto_tree_add_item(tree, hf_smb2_ea_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
2902 | 0 | offset += 4; |
2903 | | |
2904 | | /* access mask */ |
2905 | 0 | offset = dissect_smb_access_mask(tvb, tree, offset); |
2906 | | |
2907 | | /* Position Information */ |
2908 | 0 | proto_tree_add_item(tree, hf_smb2_position_information, tvb, offset, 8, ENC_BIG_ENDIAN); |
2909 | 0 | offset += 8; |
2910 | | |
2911 | | /* Mode Information */ |
2912 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_mode_information, ett_smb2_file_mode_info, mode_fields, ENC_LITTLE_ENDIAN); |
2913 | 0 | offset += 4; |
2914 | | |
2915 | | /* Alignment Information */ |
2916 | 0 | proto_tree_add_item(tree, hf_smb2_alignment_information, tvb, offset, 4, ENC_BIG_ENDIAN); |
2917 | 0 | offset +=4; |
2918 | | |
2919 | | /* file name length */ |
2920 | 0 | length = tvb_get_letohs(tvb, offset); |
2921 | 0 | proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
2922 | 0 | offset += 4; |
2923 | | |
2924 | | /* file name */ |
2925 | 0 | if (length) { |
2926 | 0 | proto_tree_add_item(tree, hf_smb2_filename, |
2927 | 0 | tvb, offset, length, ENC_UTF_16|ENC_LITTLE_ENDIAN); |
2928 | 0 | offset += length; |
2929 | 0 | } |
2930 | |
|
2931 | 0 | return offset; |
2932 | 0 | } |
2933 | | |
2934 | | |
2935 | | static int |
2936 | | dissect_smb2_file_allocation_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
2937 | 0 | { |
2938 | 0 | proto_item *item = NULL; |
2939 | 0 | proto_tree *tree = NULL; |
2940 | 0 | uint16_t bc; |
2941 | 0 | bool trunc; |
2942 | |
|
2943 | 0 | if (parent_tree) { |
2944 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_allocation_info, tvb, offset, -1, ENC_NA); |
2945 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_allocation_info); |
2946 | 0 | } |
2947 | |
|
2948 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
2949 | 0 | offset = dissect_qsfi_SMB_FILE_ALLOCATION_INFO(tvb, pinfo, tree, offset, &bc, &trunc); |
2950 | |
|
2951 | 0 | return offset; |
2952 | 0 | } |
2953 | | |
2954 | | static int |
2955 | | dissect_smb2_file_endoffile_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
2956 | 0 | { |
2957 | 0 | proto_item *item = NULL; |
2958 | 0 | proto_tree *tree = NULL; |
2959 | 0 | uint16_t bc; |
2960 | 0 | bool trunc; |
2961 | |
|
2962 | 0 | if (parent_tree) { |
2963 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_endoffile_info, tvb, offset, -1, ENC_NA); |
2964 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_endoffile_info); |
2965 | 0 | } |
2966 | |
|
2967 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
2968 | 0 | offset = dissect_qsfi_SMB_FILE_ENDOFFILE_INFO(tvb, pinfo, tree, offset, &bc, &trunc); |
2969 | |
|
2970 | 0 | return offset; |
2971 | 0 | } |
2972 | | |
2973 | | static int |
2974 | | dissect_smb2_file_alternate_name_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
2975 | 0 | { |
2976 | 0 | proto_item *item = NULL; |
2977 | 0 | proto_tree *tree = NULL; |
2978 | 0 | uint16_t bc; |
2979 | 0 | bool trunc; |
2980 | |
|
2981 | 0 | if (parent_tree) { |
2982 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_alternate_name_info, tvb, offset, -1, ENC_NA); |
2983 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_alternate_name_info); |
2984 | 0 | } |
2985 | |
|
2986 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
2987 | 0 | offset = dissect_qfi_SMB_FILE_NAME_INFO(tvb, pinfo, tree, offset, &bc, &trunc, /* XXX assumption hack */ true); |
2988 | |
|
2989 | 0 | return offset; |
2990 | 0 | } |
2991 | | |
2992 | | static int |
2993 | | dissect_smb2_file_normalized_name_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
2994 | 0 | { |
2995 | 0 | proto_item *item = NULL; |
2996 | 0 | proto_tree *tree = NULL; |
2997 | 0 | uint16_t bc; |
2998 | 0 | bool trunc; |
2999 | |
|
3000 | 0 | if (parent_tree) { |
3001 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_normalized_name_info, tvb, offset, -1, ENC_NA); |
3002 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_normalized_name_info); |
3003 | 0 | } |
3004 | |
|
3005 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3006 | 0 | offset = dissect_qfi_SMB_FILE_NAME_INFO(tvb, pinfo, tree, offset, &bc, &trunc, /* XXX assumption hack */ true); |
3007 | |
|
3008 | 0 | return offset; |
3009 | 0 | } |
3010 | | |
3011 | | static int |
3012 | | dissect_smb2_file_basic_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3013 | 0 | { |
3014 | 0 | proto_item *item = NULL; |
3015 | 0 | proto_tree *tree = NULL; |
3016 | |
|
3017 | 0 | if (parent_tree) { |
3018 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_basic_info, tvb, offset, -1, ENC_NA); |
3019 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_basic_info); |
3020 | 0 | } |
3021 | | |
3022 | | /* create time */ |
3023 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_create_timestamp, ENC_LITTLE_ENDIAN); |
3024 | 0 | offset += 8; |
3025 | | |
3026 | | /* last access */ |
3027 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_access_timestamp, ENC_LITTLE_ENDIAN); |
3028 | 0 | offset += 8; |
3029 | | |
3030 | | /* last write */ |
3031 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_write_timestamp, ENC_LITTLE_ENDIAN); |
3032 | 0 | offset += 8; |
3033 | | |
3034 | | /* last change */ |
3035 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_change_timestamp, ENC_LITTLE_ENDIAN); |
3036 | 0 | offset += 8; |
3037 | | |
3038 | | /* File Attributes */ |
3039 | 0 | offset = dissect_fscc_file_attr(tvb, tree, offset, NULL); |
3040 | | |
3041 | | /* some unknown bytes */ |
3042 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 4, ENC_NA); |
3043 | 0 | offset += 4; |
3044 | |
|
3045 | 0 | return offset; |
3046 | 0 | } |
3047 | | |
3048 | | static int |
3049 | | dissect_smb2_file_standard_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3050 | 0 | { |
3051 | 0 | proto_item *item = NULL; |
3052 | 0 | proto_tree *tree = NULL; |
3053 | 0 | uint16_t bc; |
3054 | 0 | bool trunc; |
3055 | |
|
3056 | 0 | if (parent_tree) { |
3057 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_standard_info, tvb, offset, -1, ENC_NA); |
3058 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_standard_info); |
3059 | 0 | } |
3060 | |
|
3061 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3062 | 0 | offset = dissect_qfi_SMB_FILE_STANDARD_INFO(tvb, pinfo, tree, offset, &bc, &trunc); |
3063 | |
|
3064 | 0 | return offset; |
3065 | 0 | } |
3066 | | static int |
3067 | | dissect_smb2_file_internal_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3068 | 0 | { |
3069 | 0 | proto_item *item = NULL; |
3070 | 0 | proto_tree *tree = NULL; |
3071 | 0 | uint16_t bc; |
3072 | 0 | bool trunc; |
3073 | |
|
3074 | 0 | if (parent_tree) { |
3075 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_internal_info, tvb, offset, -1, ENC_NA); |
3076 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_internal_info); |
3077 | 0 | } |
3078 | |
|
3079 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3080 | 0 | offset = dissect_qfi_SMB_FILE_INTERNAL_INFO(tvb, pinfo, tree, offset, &bc, &trunc); |
3081 | |
|
3082 | 0 | return offset; |
3083 | 0 | } |
3084 | | static int |
3085 | | dissect_smb2_file_mode_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3086 | 0 | { |
3087 | 0 | proto_item *item = NULL; |
3088 | 0 | proto_tree *tree = NULL; |
3089 | 0 | uint16_t bc; |
3090 | 0 | bool trunc; |
3091 | |
|
3092 | 0 | if (parent_tree) { |
3093 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_mode_info, tvb, offset, -1, ENC_NA); |
3094 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_mode_info); |
3095 | 0 | } |
3096 | |
|
3097 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3098 | 0 | offset = dissect_qsfi_SMB_FILE_MODE_INFO(tvb, pinfo, tree, offset, &bc, &trunc); |
3099 | |
|
3100 | 0 | return offset; |
3101 | 0 | } |
3102 | | static int |
3103 | | dissect_smb2_file_alignment_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3104 | 0 | { |
3105 | 0 | proto_item *item = NULL; |
3106 | 0 | proto_tree *tree = NULL; |
3107 | 0 | uint16_t bc; |
3108 | 0 | bool trunc; |
3109 | |
|
3110 | 0 | if (parent_tree) { |
3111 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_alignment_info, tvb, offset, -1, ENC_NA); |
3112 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_alignment_info); |
3113 | 0 | } |
3114 | |
|
3115 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3116 | 0 | offset = dissect_qfi_SMB_FILE_ALIGNMENT_INFO(tvb, pinfo, tree, offset, &bc, &trunc); |
3117 | |
|
3118 | 0 | return offset; |
3119 | 0 | } |
3120 | | static int |
3121 | | dissect_smb2_file_position_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3122 | 0 | { |
3123 | 0 | proto_item *item = NULL; |
3124 | 0 | proto_tree *tree = NULL; |
3125 | 0 | uint16_t bc; |
3126 | 0 | bool trunc; |
3127 | |
|
3128 | 0 | if (parent_tree) { |
3129 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_position_info, tvb, offset, -1, ENC_NA); |
3130 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_position_info); |
3131 | 0 | } |
3132 | |
|
3133 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3134 | 0 | offset = dissect_qsfi_SMB_FILE_POSITION_INFO(tvb, pinfo, tree, offset, &bc, &trunc); |
3135 | |
|
3136 | 0 | return offset; |
3137 | 0 | } |
3138 | | |
3139 | | static int |
3140 | | dissect_smb2_file_access_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3141 | 0 | { |
3142 | 0 | proto_item *item = NULL; |
3143 | 0 | proto_tree *tree = NULL; |
3144 | |
|
3145 | 0 | if (parent_tree) { |
3146 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_access_info, tvb, offset, -1, ENC_NA); |
3147 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_access_info); |
3148 | 0 | } |
3149 | | |
3150 | | /* access mask */ |
3151 | 0 | offset = dissect_smb_access_mask(tvb, tree, offset); |
3152 | |
|
3153 | 0 | return offset; |
3154 | 0 | } |
3155 | | |
3156 | | static int |
3157 | | dissect_smb2_file_ea_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3158 | 0 | { |
3159 | 0 | proto_item *item = NULL; |
3160 | 0 | proto_tree *tree = NULL; |
3161 | 0 | uint16_t bc; |
3162 | 0 | bool trunc; |
3163 | |
|
3164 | 0 | if (parent_tree) { |
3165 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_ea_info, tvb, offset, -1, ENC_NA); |
3166 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_ea_info); |
3167 | 0 | } |
3168 | |
|
3169 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3170 | 0 | offset = dissect_qfi_SMB_FILE_EA_INFO(tvb, pinfo, tree, offset, &bc, &trunc); |
3171 | |
|
3172 | 0 | return offset; |
3173 | 0 | } |
3174 | | |
3175 | | static int |
3176 | | dissect_smb2_file_stream_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3177 | 0 | { |
3178 | 0 | proto_item *item = NULL; |
3179 | 0 | proto_tree *tree = NULL; |
3180 | 0 | uint16_t bc; |
3181 | 0 | bool trunc; |
3182 | |
|
3183 | 0 | if (parent_tree) { |
3184 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_stream_info, tvb, offset, -1, ENC_NA); |
3185 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_stream_info); |
3186 | 0 | } |
3187 | |
|
3188 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3189 | 0 | offset = dissect_qfi_SMB_FILE_STREAM_INFO(tvb, pinfo, tree, offset, &bc, &trunc, true); |
3190 | |
|
3191 | 0 | return offset; |
3192 | 0 | } |
3193 | | |
3194 | | static int |
3195 | | dissect_smb2_file_pipe_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3196 | 0 | { |
3197 | 0 | proto_item *item = NULL; |
3198 | 0 | proto_tree *tree = NULL; |
3199 | 0 | uint16_t bc; |
3200 | 0 | bool trunc; |
3201 | |
|
3202 | 0 | if (parent_tree) { |
3203 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_pipe_info, tvb, offset, -1, ENC_NA); |
3204 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_pipe_info); |
3205 | 0 | } |
3206 | |
|
3207 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3208 | 0 | offset = dissect_sfi_SMB_FILE_PIPE_INFO(tvb, pinfo, tree, offset, &bc, &trunc); |
3209 | |
|
3210 | 0 | return offset; |
3211 | 0 | } |
3212 | | |
3213 | | static int |
3214 | | dissect_smb2_file_pipe_local_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3215 | 0 | { |
3216 | 0 | proto_item *item = NULL; |
3217 | 0 | proto_tree *tree = NULL; |
3218 | 0 | uint16_t bc; |
3219 | 0 | bool trunc; |
3220 | |
|
3221 | 0 | if (parent_tree) { |
3222 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_pipe_local_info, tvb, offset, -1, ENC_NA); |
3223 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_pipe_local_info); |
3224 | 0 | } |
3225 | |
|
3226 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3227 | 0 | offset = dissect_qfi_SMB_FILE_PIPE_LOCAL_INFO(tvb, pinfo, tree, offset, &bc, &trunc); |
3228 | |
|
3229 | 0 | return offset; |
3230 | 0 | } |
3231 | | |
3232 | | static int |
3233 | | dissect_smb2_file_pipe_remote_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3234 | 0 | { |
3235 | 0 | proto_item *item = NULL; |
3236 | 0 | proto_tree *tree = NULL; |
3237 | 0 | uint16_t bc; |
3238 | 0 | bool trunc; |
3239 | |
|
3240 | 0 | if (parent_tree) { |
3241 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_pipe_remote_info, tvb, offset, -1, ENC_NA); |
3242 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_pipe_remote_info); |
3243 | 0 | } |
3244 | |
|
3245 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3246 | 0 | offset = dissect_qfi_SMB_FILE_PIPE_REMOTE_INFO(tvb, pinfo, tree, offset, &bc, &trunc); |
3247 | |
|
3248 | 0 | return offset; |
3249 | 0 | } |
3250 | | |
3251 | | |
3252 | | static int |
3253 | | dissect_smb2_file_compression_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3254 | 0 | { |
3255 | 0 | proto_item *item = NULL; |
3256 | 0 | proto_tree *tree = NULL; |
3257 | 0 | uint16_t bc; |
3258 | 0 | bool trunc; |
3259 | |
|
3260 | 0 | if (parent_tree) { |
3261 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_compression_info, tvb, offset, -1, ENC_NA); |
3262 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_compression_info); |
3263 | 0 | } |
3264 | |
|
3265 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3266 | 0 | offset = dissect_qfi_SMB_FILE_COMPRESSION_INFO(tvb, pinfo, tree, offset, &bc, &trunc); |
3267 | |
|
3268 | 0 | return offset; |
3269 | 0 | } |
3270 | | |
3271 | | static int |
3272 | | dissect_smb2_file_network_open_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3273 | 0 | { |
3274 | 0 | proto_item *item = NULL; |
3275 | 0 | proto_tree *tree = NULL; |
3276 | 0 | uint16_t bc; |
3277 | 0 | bool trunc; |
3278 | |
|
3279 | 0 | if (parent_tree) { |
3280 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_network_open_info, tvb, offset, -1, ENC_NA); |
3281 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_network_open_info); |
3282 | 0 | } |
3283 | | |
3284 | |
|
3285 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3286 | 0 | offset = dissect_qfi_SMB_FILE_NETWORK_OPEN_INFO(tvb, pinfo, tree, offset, &bc, &trunc); |
3287 | |
|
3288 | 0 | return offset; |
3289 | 0 | } |
3290 | | |
3291 | | static int |
3292 | | dissect_smb2_file_attribute_tag_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3293 | 0 | { |
3294 | 0 | proto_item *item = NULL; |
3295 | 0 | proto_tree *tree = NULL; |
3296 | 0 | uint16_t bc; |
3297 | 0 | bool trunc; |
3298 | |
|
3299 | 0 | if (parent_tree) { |
3300 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_attribute_tag_info, tvb, offset, -1, ENC_NA); |
3301 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_attribute_tag_info); |
3302 | 0 | } |
3303 | | |
3304 | |
|
3305 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3306 | 0 | offset = dissect_qfi_SMB_FILE_ATTRIBUTE_TAG_INFO(tvb, pinfo, tree, offset, &bc, &trunc); |
3307 | |
|
3308 | 0 | return offset; |
3309 | 0 | } |
3310 | | |
3311 | | static const true_false_string tfs_disposition_delete_on_close = { |
3312 | | "DELETE this file when closed", |
3313 | | "Normal access, do not delete on close" |
3314 | | }; |
3315 | | |
3316 | | static int |
3317 | | dissect_smb2_file_disposition_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3318 | 0 | { |
3319 | 0 | proto_item *item = NULL; |
3320 | 0 | proto_tree *tree = NULL; |
3321 | |
|
3322 | 0 | if (parent_tree) { |
3323 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_disposition_info, tvb, offset, -1, ENC_NA); |
3324 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_disposition_info); |
3325 | 0 | } |
3326 | | |
3327 | | /* file disposition */ |
3328 | 0 | proto_tree_add_item(tree, hf_smb2_disposition_delete_on_close, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
3329 | |
|
3330 | 0 | return offset; |
3331 | 0 | } |
3332 | | |
3333 | | static int |
3334 | | dissect_smb2_file_full_ea_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3335 | 0 | { |
3336 | 0 | proto_item *item = NULL; |
3337 | 0 | proto_tree *tree = NULL; |
3338 | 0 | uint32_t next_offset; |
3339 | 0 | uint8_t ea_name_len; |
3340 | 0 | uint16_t ea_data_len; |
3341 | |
|
3342 | 0 | if (parent_tree) { |
3343 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_full_ea_info, tvb, offset, -1, ENC_NA); |
3344 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_full_ea_info); |
3345 | 0 | } |
3346 | |
|
3347 | 0 | while (1) { |
3348 | 0 | char *name = NULL; |
3349 | 0 | char *data = NULL; |
3350 | 0 | int start_offset = offset; |
3351 | 0 | proto_item *ea_item; |
3352 | 0 | proto_tree *ea_tree; |
3353 | |
|
3354 | 0 | ea_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_smb2_ea, &ea_item, "EA:"); |
3355 | | |
3356 | | /* next offset */ |
3357 | 0 | next_offset = tvb_get_letohl(tvb, offset); |
3358 | 0 | proto_tree_add_item(ea_tree, hf_smb2_next_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
3359 | 0 | offset += 4; |
3360 | | |
3361 | | /* EA flags */ |
3362 | 0 | proto_tree_add_item(ea_tree, hf_smb2_ea_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
3363 | 0 | offset += 1; |
3364 | | |
3365 | | /* EA Name Length */ |
3366 | 0 | ea_name_len = tvb_get_uint8(tvb, offset); |
3367 | 0 | proto_tree_add_item(ea_tree, hf_smb2_ea_name_len, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
3368 | 0 | offset += 1; |
3369 | | |
3370 | | /* EA Data Length */ |
3371 | 0 | ea_data_len = tvb_get_letohs(tvb, offset); |
3372 | 0 | proto_tree_add_item(ea_tree, hf_smb2_ea_data_len, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
3373 | 0 | offset += 2; |
3374 | | |
3375 | | /* ea name */ |
3376 | 0 | if (ea_name_len) { |
3377 | 0 | proto_tree_add_item_ret_display_string(ea_tree, hf_smb2_ea_name, |
3378 | 0 | tvb, offset, ea_name_len, ENC_ASCII|ENC_NA, |
3379 | 0 | pinfo->pool, &name); |
3380 | 0 | } |
3381 | | |
3382 | | /* The name is terminated with a NULL */ |
3383 | 0 | offset += ea_name_len + 1; |
3384 | | |
3385 | | /* ea data */ |
3386 | 0 | if (ea_data_len) { |
3387 | 0 | proto_tree_add_item_ret_display_string(ea_tree, hf_smb2_ea_data, |
3388 | 0 | tvb, offset, ea_data_len, ENC_NA, |
3389 | 0 | pinfo->pool, &data); |
3390 | 0 | } |
3391 | 0 | offset += ea_data_len; |
3392 | | |
3393 | |
|
3394 | 0 | if (ea_item) { |
3395 | 0 | proto_item_append_text(ea_item, " %s := %s", |
3396 | 0 | name ? name : "", |
3397 | 0 | data ? data : ""); |
3398 | 0 | } |
3399 | 0 | proto_item_set_len(ea_item, offset-start_offset); |
3400 | | |
3401 | |
|
3402 | 0 | if (!next_offset) { |
3403 | 0 | break; |
3404 | 0 | } |
3405 | | |
3406 | 0 | offset = start_offset+next_offset; |
3407 | 0 | } |
3408 | |
|
3409 | 0 | return offset; |
3410 | 0 | } |
3411 | | |
3412 | | static const true_false_string tfs_replace_if_exists = { |
3413 | | "Replace the target if it exists", |
3414 | | "Fail if the target exists" |
3415 | | }; |
3416 | | |
3417 | | static int |
3418 | | dissect_smb2_file_rename_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3419 | 0 | { |
3420 | 0 | proto_item *item = NULL; |
3421 | 0 | proto_tree *tree = NULL; |
3422 | 0 | int length; |
3423 | | |
3424 | |
|
3425 | 0 | if (parent_tree) { |
3426 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_rename_info, tvb, offset, -1, ENC_NA); |
3427 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_rename_info); |
3428 | 0 | } |
3429 | | |
3430 | | /* ReplaceIfExists */ |
3431 | 0 | proto_tree_add_item(tree, hf_smb2_replace_if, tvb, offset, 1, ENC_NA); |
3432 | 0 | offset += 1; |
3433 | | |
3434 | | /* reserved */ |
3435 | 0 | proto_tree_add_item(tree, hf_smb2_reserved_random, tvb, offset, 7, ENC_NA); |
3436 | 0 | offset += 7; |
3437 | | |
3438 | | /* Root Directory Handle, MBZ */ |
3439 | 0 | proto_tree_add_item(tree, hf_smb2_root_directory_mbz, tvb, offset, 8, ENC_NA); |
3440 | 0 | offset += 8; |
3441 | | |
3442 | | /* file name length */ |
3443 | 0 | length = tvb_get_letohs(tvb, offset); |
3444 | 0 | proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
3445 | 0 | offset += 4; |
3446 | | |
3447 | | /* file name */ |
3448 | 0 | if (length) { |
3449 | 0 | char *display_string; |
3450 | |
|
3451 | 0 | proto_tree_add_item_ret_display_string(tree, hf_smb2_filename, |
3452 | 0 | tvb, offset, length, ENC_UTF_16|ENC_LITTLE_ENDIAN, |
3453 | 0 | pinfo->pool, &display_string); |
3454 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " NewName:%s", |
3455 | 0 | display_string); |
3456 | 0 | offset += length; |
3457 | 0 | } |
3458 | |
|
3459 | 0 | return offset; |
3460 | 0 | } |
3461 | | |
3462 | | static int |
3463 | | dissect_smb2_file_link_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3464 | 0 | { |
3465 | 0 | proto_item *item = NULL; |
3466 | 0 | proto_tree *tree = NULL; |
3467 | 0 | int length; |
3468 | 0 | char *display_string = NULL; |
3469 | | |
3470 | |
|
3471 | 0 | if (parent_tree) { |
3472 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_link_info, tvb, offset, -1, ENC_NA); |
3473 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_link_info); |
3474 | 0 | } |
3475 | | |
3476 | | /* ReplaceIfExists */ |
3477 | 0 | proto_tree_add_item(tree, hf_smb2_replace_if, tvb, offset, 1, ENC_NA); |
3478 | 0 | offset += 1; |
3479 | | |
3480 | | /* reserved */ |
3481 | 0 | proto_tree_add_item(tree, hf_smb2_reserved_random, tvb, offset, 7, ENC_NA); |
3482 | 0 | offset += 7; |
3483 | | |
3484 | | /* Root Directory Handle, MBZ */ |
3485 | 0 | proto_tree_add_item(tree, hf_smb2_root_directory_mbz, tvb, offset, 8, ENC_NA); |
3486 | 0 | offset += 8; |
3487 | | |
3488 | | /* file name length */ |
3489 | 0 | length = tvb_get_letohs(tvb, offset); |
3490 | 0 | proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
3491 | 0 | offset += 4; |
3492 | | |
3493 | | /* file name */ |
3494 | 0 | if (length < 1) { |
3495 | 0 | return offset; |
3496 | 0 | } |
3497 | | |
3498 | 0 | proto_tree_add_item_ret_display_string(tree, hf_smb2_filename, |
3499 | 0 | tvb, offset, length, ENC_UTF_16|ENC_LITTLE_ENDIAN, |
3500 | 0 | pinfo->pool, &display_string); |
3501 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " NewLink:%s", |
3502 | 0 | display_string); |
3503 | 0 | offset += length; |
3504 | |
|
3505 | 0 | return offset; |
3506 | 0 | } |
3507 | | |
3508 | | static int |
3509 | | dissect_smb2_sec_info_00(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3510 | 0 | { |
3511 | 0 | proto_item *item = NULL; |
3512 | 0 | proto_tree *tree = NULL; |
3513 | |
|
3514 | 0 | if (parent_tree) { |
3515 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_sec_info_00, tvb, offset, -1, ENC_NA); |
3516 | 0 | tree = proto_item_add_subtree(item, ett_smb2_sec_info_00); |
3517 | 0 | } |
3518 | | |
3519 | | /* security descriptor */ |
3520 | 0 | offset = dissect_nt_sec_desc(tvb, offset, pinfo, tree, NULL, true, tvb_captured_length_remaining(tvb, offset), NULL); |
3521 | |
|
3522 | 0 | return offset; |
3523 | 0 | } |
3524 | | |
3525 | | static int |
3526 | | dissect_smb2_quota_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3527 | 0 | { |
3528 | 0 | proto_item *item = NULL; |
3529 | 0 | proto_tree *tree = NULL; |
3530 | 0 | uint16_t bcp; |
3531 | |
|
3532 | 0 | if (parent_tree) { |
3533 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_quota_info, tvb, offset, -1, ENC_NA); |
3534 | 0 | tree = proto_item_add_subtree(item, ett_smb2_quota_info); |
3535 | 0 | } |
3536 | |
|
3537 | 0 | bcp = tvb_captured_length_remaining(tvb, offset); |
3538 | 0 | offset = dissect_nt_user_quota(tvb, pinfo, tree, offset, &bcp); |
3539 | |
|
3540 | 0 | return offset; |
3541 | 0 | } |
3542 | | |
3543 | | static int |
3544 | | dissect_smb2_fs_info_05(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3545 | 0 | { |
3546 | 0 | proto_item *item = NULL; |
3547 | 0 | proto_tree *tree = NULL; |
3548 | 0 | uint16_t bc; |
3549 | |
|
3550 | 0 | if (parent_tree) { |
3551 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_fs_info_05, tvb, offset, -1, ENC_NA); |
3552 | 0 | tree = proto_item_add_subtree(item, ett_smb2_fs_info_05); |
3553 | 0 | } |
3554 | |
|
3555 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3556 | 0 | offset = dissect_qfsi_FS_ATTRIBUTE_INFO(tvb, pinfo, tree, offset, &bc); |
3557 | |
|
3558 | 0 | return offset; |
3559 | 0 | } |
3560 | | |
3561 | | static int |
3562 | | dissect_smb2_fs_info_06(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3563 | 0 | { |
3564 | 0 | proto_item *item = NULL; |
3565 | 0 | proto_tree *tree = NULL; |
3566 | 0 | uint16_t bc; |
3567 | |
|
3568 | 0 | if (parent_tree) { |
3569 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_fs_info_06, tvb, offset, -1, ENC_NA); |
3570 | 0 | tree = proto_item_add_subtree(item, ett_smb2_fs_info_06); |
3571 | 0 | } |
3572 | |
|
3573 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3574 | 0 | offset = dissect_nt_quota(tvb, tree, offset, &bc); |
3575 | |
|
3576 | 0 | return offset; |
3577 | 0 | } |
3578 | | |
3579 | | static int |
3580 | | dissect_smb2_FS_OBJECTID_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3581 | 0 | { |
3582 | 0 | proto_item *item = NULL; |
3583 | 0 | proto_tree *tree = NULL; |
3584 | |
|
3585 | 0 | if (parent_tree) { |
3586 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_fs_objectid_info, tvb, offset, -1, ENC_NA); |
3587 | 0 | tree = proto_item_add_subtree(item, ett_smb2_fs_objectid_info); |
3588 | 0 | } |
3589 | | |
3590 | | /* FILE_OBJECTID_BUFFER */ |
3591 | 0 | offset = dissect_smb2_FILE_OBJECTID_BUFFER(tvb, pinfo, tree, offset); |
3592 | |
|
3593 | 0 | return offset; |
3594 | 0 | } |
3595 | | |
3596 | | static int |
3597 | | dissect_smb2_fs_info_07(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3598 | 0 | { |
3599 | 0 | proto_item *item = NULL; |
3600 | 0 | proto_tree *tree = NULL; |
3601 | 0 | uint16_t bc; |
3602 | |
|
3603 | 0 | if (parent_tree) { |
3604 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_fs_info_07, tvb, offset, -1, ENC_NA); |
3605 | 0 | tree = proto_item_add_subtree(item, ett_smb2_fs_info_07); |
3606 | 0 | } |
3607 | |
|
3608 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3609 | 0 | offset = dissect_qfsi_FS_FULL_SIZE_INFO(tvb, pinfo, tree, offset, &bc); |
3610 | |
|
3611 | 0 | return offset; |
3612 | 0 | } |
3613 | | |
3614 | | static int |
3615 | | dissect_smb2_fs_info_01(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3616 | 0 | { |
3617 | 0 | proto_item *item = NULL; |
3618 | 0 | proto_tree *tree = NULL; |
3619 | 0 | uint16_t bc; |
3620 | |
|
3621 | 0 | if (parent_tree) { |
3622 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_fs_info_01, tvb, offset, -1, ENC_NA); |
3623 | 0 | tree = proto_item_add_subtree(item, ett_smb2_fs_info_01); |
3624 | 0 | } |
3625 | | |
3626 | |
|
3627 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3628 | 0 | offset = dissect_qfsi_FS_VOLUME_INFO(tvb, pinfo, tree, offset, &bc, true); |
3629 | |
|
3630 | 0 | return offset; |
3631 | 0 | } |
3632 | | |
3633 | | static int |
3634 | | dissect_smb2_fs_info_03(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3635 | 0 | { |
3636 | 0 | proto_item *item = NULL; |
3637 | 0 | proto_tree *tree = NULL; |
3638 | 0 | uint16_t bc; |
3639 | |
|
3640 | 0 | if (parent_tree) { |
3641 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_fs_info_03, tvb, offset, -1, ENC_NA); |
3642 | 0 | tree = proto_item_add_subtree(item, ett_smb2_fs_info_03); |
3643 | 0 | } |
3644 | | |
3645 | |
|
3646 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3647 | 0 | offset = dissect_qfsi_FS_SIZE_INFO(tvb, pinfo, tree, offset, &bc); |
3648 | |
|
3649 | 0 | return offset; |
3650 | 0 | } |
3651 | | |
3652 | | static int |
3653 | | dissect_smb2_fs_info_04(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3654 | 0 | { |
3655 | 0 | proto_item *item = NULL; |
3656 | 0 | proto_tree *tree = NULL; |
3657 | 0 | uint16_t bc; |
3658 | |
|
3659 | 0 | if (parent_tree) { |
3660 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_fs_info_04, tvb, offset, -1, ENC_NA); |
3661 | 0 | tree = proto_item_add_subtree(item, ett_smb2_fs_info_04); |
3662 | 0 | } |
3663 | | |
3664 | |
|
3665 | 0 | bc = tvb_captured_length_remaining(tvb, offset); |
3666 | 0 | offset = dissect_qfsi_FS_DEVICE_INFO(tvb, pinfo, tree, offset, &bc); |
3667 | |
|
3668 | 0 | return offset; |
3669 | 0 | } |
3670 | | |
3671 | | static int |
3672 | | dissect_smb2_fs_posix_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
3673 | 0 | { |
3674 | 0 | proto_item *item = NULL; |
3675 | 0 | proto_tree *tree = NULL; |
3676 | |
|
3677 | 0 | if (parent_tree) { |
3678 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_fs_posix_info, tvb, offset, -1, ENC_NA); |
3679 | 0 | tree = proto_item_add_subtree(item, ett_smb2_fs_posix_info); |
3680 | 0 | } |
3681 | |
|
3682 | 0 | proto_tree_add_item(tree, hf_smb2_fs_posix_optimal_transfer_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
3683 | 0 | offset += 4; |
3684 | |
|
3685 | 0 | proto_tree_add_item(tree, hf_smb2_fs_posix_block_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
3686 | 0 | offset += 4; |
3687 | |
|
3688 | 0 | proto_tree_add_item(tree, hf_smb2_fs_posix_total_blocks, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
3689 | 0 | offset += 8; |
3690 | |
|
3691 | 0 | proto_tree_add_item(tree, hf_smb2_fs_posix_blocks_available, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
3692 | 0 | offset += 8; |
3693 | |
|
3694 | 0 | proto_tree_add_item(tree, hf_smb2_fs_posix_user_blocks_available, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
3695 | 0 | offset += 8; |
3696 | |
|
3697 | 0 | proto_tree_add_item(tree, hf_smb2_fs_posix_total_file_nodes, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
3698 | 0 | offset += 8; |
3699 | |
|
3700 | 0 | proto_tree_add_item(tree, hf_smb2_fs_posix_free_file_nodes, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
3701 | 0 | offset += 8; |
3702 | |
|
3703 | 0 | proto_tree_add_item(tree, hf_smb2_fs_posix_fs_identifier, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
3704 | 0 | offset += 8; |
3705 | |
|
3706 | 0 | return offset; |
3707 | 0 | } |
3708 | | |
3709 | | static const value_string oplock_vals[] = { |
3710 | | { 0x00, "No oplock" }, |
3711 | | { 0x01, "Level2 oplock" }, |
3712 | | { 0x08, "Exclusive oplock" }, |
3713 | | { 0x09, "Batch oplock" }, |
3714 | | { 0xff, "Lease" }, |
3715 | | { 0, NULL } |
3716 | | }; |
3717 | | |
3718 | | static int |
3719 | | dissect_smb2_oplock(proto_tree *parent_tree, tvbuff_t *tvb, int offset) |
3720 | 0 | { |
3721 | 0 | proto_tree_add_item(parent_tree, hf_smb2_oplock, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
3722 | |
|
3723 | 0 | offset += 1; |
3724 | 0 | return offset; |
3725 | 0 | } |
3726 | | |
3727 | | static int |
3728 | | dissect_smb2_buffercode(proto_tree *parent_tree, tvbuff_t *tvb, int offset, uint16_t *length) |
3729 | 0 | { |
3730 | 0 | proto_tree *tree; |
3731 | 0 | proto_item *item = NULL; |
3732 | 0 | uint16_t buffer_code; |
3733 | | |
3734 | | /* dissect the first 2 bytes of the command PDU */ |
3735 | 0 | buffer_code = tvb_get_letohs(tvb, offset); |
3736 | 0 | item = proto_tree_add_uint(parent_tree, hf_smb2_buffer_code, tvb, offset, 2, buffer_code); |
3737 | 0 | tree = proto_item_add_subtree(item, ett_smb2_buffercode); |
3738 | 0 | proto_tree_add_item(tree, hf_smb2_buffer_code_len, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
3739 | 0 | proto_tree_add_item(tree, hf_smb2_buffer_code_flags_dyn, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
3740 | 0 | offset += 2; |
3741 | |
|
3742 | 0 | if (length) { |
3743 | 0 | *length = buffer_code; /*&0xfffe don't mask it here, mask it on caller side */ |
3744 | 0 | } |
3745 | |
|
3746 | 0 | return offset; |
3747 | 0 | } |
3748 | | |
3749 | 14 | #define NEGPROT_CAP_DFS 0x00000001 |
3750 | 14 | #define NEGPROT_CAP_LEASING 0x00000002 |
3751 | 14 | #define NEGPROT_CAP_LARGE_MTU 0x00000004 |
3752 | 14 | #define NEGPROT_CAP_MULTI_CHANNEL 0x00000008 |
3753 | 14 | #define NEGPROT_CAP_PERSISTENT_HANDLES 0x00000010 |
3754 | 14 | #define NEGPROT_CAP_DIRECTORY_LEASING 0x00000020 |
3755 | 14 | #define NEGPROT_CAP_ENCRYPTION 0x00000040 |
3756 | 14 | #define NEGPROT_CAP_NOTIFICATIONS 0x00000080 |
3757 | | static int |
3758 | | dissect_smb2_capabilities(proto_tree *parent_tree, tvbuff_t *tvb, int offset) |
3759 | 0 | { |
3760 | 0 | static int * const flags[] = { |
3761 | 0 | &hf_smb2_cap_dfs, |
3762 | 0 | &hf_smb2_cap_leasing, |
3763 | 0 | &hf_smb2_cap_large_mtu, |
3764 | 0 | &hf_smb2_cap_multi_channel, |
3765 | 0 | &hf_smb2_cap_persistent_handles, |
3766 | 0 | &hf_smb2_cap_directory_leasing, |
3767 | 0 | &hf_smb2_cap_encryption, |
3768 | 0 | &hf_smb2_cap_notifications, |
3769 | 0 | NULL |
3770 | 0 | }; |
3771 | |
|
3772 | 0 | proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb2_capabilities, ett_smb2_capabilities, flags, ENC_LITTLE_ENDIAN); |
3773 | 0 | offset += 4; |
3774 | |
|
3775 | 0 | return offset; |
3776 | 0 | } |
3777 | | |
3778 | | |
3779 | | |
3780 | 14 | #define NEGPROT_SIGN_REQ 0x02 |
3781 | 14 | #define NEGPROT_SIGN_ENABLED 0x01 |
3782 | | |
3783 | | static int |
3784 | | dissect_smb2_secmode(proto_tree *parent_tree, tvbuff_t *tvb, int offset) |
3785 | 0 | { |
3786 | 0 | static int * const flags[] = { |
3787 | 0 | &hf_smb2_secmode_flags_sign_enabled, |
3788 | 0 | &hf_smb2_secmode_flags_sign_required, |
3789 | 0 | NULL |
3790 | 0 | }; |
3791 | |
|
3792 | 0 | proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb2_security_mode, ett_smb2_sec_mode, flags, ENC_LITTLE_ENDIAN); |
3793 | 0 | offset += 1; |
3794 | |
|
3795 | 0 | return offset; |
3796 | 0 | } |
3797 | | |
3798 | 14 | #define SES_REQ_FLAGS_SESSION_BINDING 0x01 |
3799 | | |
3800 | | static int |
3801 | | dissect_smb2_ses_req_flags(proto_tree *parent_tree, tvbuff_t *tvb, int offset) |
3802 | 0 | { |
3803 | 0 | static int * const flags[] = { |
3804 | 0 | &hf_smb2_ses_req_flags_session_binding, |
3805 | 0 | NULL |
3806 | 0 | }; |
3807 | |
|
3808 | 0 | proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb2_ses_req_flags, ett_smb2_ses_req_flags, flags, ENC_LITTLE_ENDIAN); |
3809 | 0 | offset += 1; |
3810 | |
|
3811 | 0 | return offset; |
3812 | 0 | } |
3813 | | |
3814 | 14 | #define SES_FLAGS_GUEST 0x0001 |
3815 | 14 | #define SES_FLAGS_NULL 0x0002 |
3816 | 14 | #define SES_FLAGS_ENCRYPT 0x0004 |
3817 | | |
3818 | | static int |
3819 | | dissect_smb2_ses_flags(proto_tree *parent_tree, tvbuff_t *tvb, int offset) |
3820 | 0 | { |
3821 | 0 | static int * const flags[] = { |
3822 | 0 | &hf_smb2_ses_flags_guest, |
3823 | 0 | &hf_smb2_ses_flags_null, |
3824 | 0 | &hf_smb2_ses_flags_encrypt, |
3825 | 0 | NULL |
3826 | 0 | }; |
3827 | |
|
3828 | 0 | proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb2_session_flags, ett_smb2_ses_flags, flags, ENC_LITTLE_ENDIAN); |
3829 | 0 | offset += 2; |
3830 | |
|
3831 | 0 | return offset; |
3832 | 0 | } |
3833 | | |
3834 | | #define SHARE_FLAGS_manual_caching 0x00000000 |
3835 | | #define SHARE_FLAGS_auto_caching 0x00000010 |
3836 | | #define SHARE_FLAGS_vdo_caching 0x00000020 |
3837 | | #define SHARE_FLAGS_no_caching 0x00000030 |
3838 | | |
3839 | | static const value_string share_cache_vals[] = { |
3840 | | { SHARE_FLAGS_manual_caching, "Manual caching" }, |
3841 | | { SHARE_FLAGS_auto_caching, "Auto caching" }, |
3842 | | { SHARE_FLAGS_vdo_caching, "VDO caching" }, |
3843 | | { SHARE_FLAGS_no_caching, "No caching" }, |
3844 | | { 0, NULL } |
3845 | | }; |
3846 | | |
3847 | 14 | #define SHARE_FLAGS_dfs 0x00000001 |
3848 | 14 | #define SHARE_FLAGS_dfs_root 0x00000002 |
3849 | 14 | #define SHARE_FLAGS_restrict_exclusive_opens 0x00000100 |
3850 | 14 | #define SHARE_FLAGS_force_shared_delete 0x00000200 |
3851 | 14 | #define SHARE_FLAGS_allow_namespace_caching 0x00000400 |
3852 | 14 | #define SHARE_FLAGS_access_based_dir_enum 0x00000800 |
3853 | 14 | #define SHARE_FLAGS_force_levelii_oplock 0x00001000 |
3854 | 14 | #define SHARE_FLAGS_enable_hash_v1 0x00002000 |
3855 | 14 | #define SHARE_FLAGS_enable_hash_v2 0x00004000 |
3856 | 14 | #define SHARE_FLAGS_encryption_required 0x00008000 |
3857 | 14 | #define SHARE_FLAGS_identity_remoting 0x00040000 |
3858 | 14 | #define SHARE_FLAGS_compress_data 0x00100000 |
3859 | 14 | #define SHARE_FLAGS_isolated_transport 0x00200000 |
3860 | | |
3861 | | static int |
3862 | | dissect_smb2_share_flags(proto_tree *tree, tvbuff_t *tvb, int offset) |
3863 | 0 | { |
3864 | 0 | static int * const sf_fields[] = { |
3865 | 0 | &hf_smb2_share_flags_dfs, |
3866 | 0 | &hf_smb2_share_flags_dfs_root, |
3867 | 0 | &hf_smb2_share_flags_restrict_exclusive_opens, |
3868 | 0 | &hf_smb2_share_flags_force_shared_delete, |
3869 | 0 | &hf_smb2_share_flags_allow_namespace_caching, |
3870 | 0 | &hf_smb2_share_flags_access_based_dir_enum, |
3871 | 0 | &hf_smb2_share_flags_force_levelii_oplock, |
3872 | 0 | &hf_smb2_share_flags_enable_hash_v1, |
3873 | 0 | &hf_smb2_share_flags_enable_hash_v2, |
3874 | 0 | &hf_smb2_share_flags_encrypt_data, |
3875 | 0 | &hf_smb2_share_flags_identity_remoting, |
3876 | 0 | &hf_smb2_share_flags_compress_data, |
3877 | 0 | &hf_smb2_share_flags_isolated_transport, |
3878 | 0 | NULL |
3879 | 0 | }; |
3880 | 0 | proto_item *item = NULL; |
3881 | 0 | uint32_t cp; |
3882 | |
|
3883 | 0 | item = proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_share_flags, ett_smb2_share_flags, sf_fields, ENC_LITTLE_ENDIAN); |
3884 | |
|
3885 | 0 | cp = tvb_get_letohl(tvb, offset); |
3886 | 0 | cp &= 0x00000030; |
3887 | 0 | proto_tree_add_uint_format(item, hf_smb2_share_caching, tvb, offset, 4, cp, "Caching policy: %s (%08x)", val_to_str(cp, share_cache_vals, "Unknown:%u"), cp); |
3888 | | |
3889 | |
|
3890 | 0 | offset += 4; |
3891 | |
|
3892 | 0 | return offset; |
3893 | 0 | } |
3894 | | |
3895 | 14 | #define SHARE_CAPS_DFS 0x00000008 |
3896 | 14 | #define SHARE_CAPS_CONTINUOUS_AVAILABILITY 0x00000010 |
3897 | 14 | #define SHARE_CAPS_SCALEOUT 0x00000020 |
3898 | 14 | #define SHARE_CAPS_CLUSTER 0x00000040 |
3899 | 14 | #define SHARE_CAPS_ASYMMETRIC 0x00000080 |
3900 | 14 | #define SHARE_CAPS_REDIRECT_TO_OWNER 0x00000100 |
3901 | | |
3902 | | static int |
3903 | | dissect_smb2_share_caps(proto_tree *tree, tvbuff_t *tvb, int offset) |
3904 | 0 | { |
3905 | 0 | static int * const sc_fields[] = { |
3906 | 0 | &hf_smb2_share_caps_dfs, |
3907 | 0 | &hf_smb2_share_caps_continuous_availability, |
3908 | 0 | &hf_smb2_share_caps_scaleout, |
3909 | 0 | &hf_smb2_share_caps_cluster, |
3910 | 0 | &hf_smb2_share_caps_asymmetric, |
3911 | 0 | &hf_smb2_share_caps_redirect_to_owner, |
3912 | 0 | NULL |
3913 | 0 | }; |
3914 | |
|
3915 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_share_caps, ett_smb2_share_caps, sc_fields, ENC_LITTLE_ENDIAN); |
3916 | |
|
3917 | 0 | offset += 4; |
3918 | |
|
3919 | 0 | return offset; |
3920 | 0 | } |
3921 | | |
3922 | | static void |
3923 | | dissect_smb2_secblob(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si _U_) |
3924 | 0 | { |
3925 | 0 | if ((tvb_captured_length(tvb)>=7) |
3926 | 0 | && (!tvb_memeql(tvb, 0, (const uint8_t*)"NTLMSSP", 7))) { |
3927 | 0 | call_dissector(ntlmssp_handle, tvb, pinfo, tree); |
3928 | 0 | } else { |
3929 | 0 | call_dissector(gssapi_handle, tvb, pinfo, tree); |
3930 | 0 | } |
3931 | 0 | } |
3932 | | |
3933 | | /* |
3934 | | * Derive client and server decryption keys from the secret session key |
3935 | | * and set them in the session object. |
3936 | | */ |
3937 | | static void smb2_generate_decryption_keys(smb2_conv_info_t *conv, smb2_sesid_info_t *ses) |
3938 | 0 | { |
3939 | 0 | bool has_seskey = memcmp(ses->session_key, zeros, NTLMSSP_KEY_LEN) != 0; |
3940 | 0 | bool has_signkey = memcmp(ses->signing_key, zeros, NTLMSSP_KEY_LEN) != 0; |
3941 | 0 | bool has_client_key = memcmp(ses->client_decryption_key16, zeros, AES_KEY_SIZE) != 0; |
3942 | 0 | bool has_server_key = memcmp(ses->server_decryption_key16, zeros, AES_KEY_SIZE) != 0; |
3943 | | |
3944 | | /* if all decryption keys are provided, nothing to do */ |
3945 | 0 | if (has_client_key && has_server_key && has_signkey) |
3946 | 0 | return; |
3947 | | |
3948 | | /* otherwise, generate them from session key, if it's there */ |
3949 | 0 | if (!has_seskey || ses->session_key_len == 0) |
3950 | 0 | return; |
3951 | | |
3952 | | /* generate decryption keys */ |
3953 | 0 | if (conv->dialect <= SMB2_DIALECT_210) { |
3954 | 0 | if (!has_signkey) |
3955 | 0 | memcpy(ses->signing_key, ses->session_key, |
3956 | 0 | NTLMSSP_KEY_LEN); |
3957 | 0 | } else if (conv->dialect < SMB2_DIALECT_311) { |
3958 | 0 | if (!has_server_key) |
3959 | 0 | smb2_key_derivation(ses->session_key, |
3960 | 0 | NTLMSSP_KEY_LEN, |
3961 | 0 | "SMB2AESCCM", 11, |
3962 | 0 | "ServerIn ", 10, |
3963 | 0 | ses->server_decryption_key16, 16); |
3964 | 0 | if (!has_client_key) |
3965 | 0 | smb2_key_derivation(ses->session_key, |
3966 | 0 | NTLMSSP_KEY_LEN, |
3967 | 0 | "SMB2AESCCM", 11, |
3968 | 0 | "ServerOut", 10, |
3969 | 0 | ses->client_decryption_key16, 16); |
3970 | 0 | if (!has_signkey) |
3971 | 0 | smb2_key_derivation(ses->session_key, |
3972 | 0 | NTLMSSP_KEY_LEN, |
3973 | 0 | "SMB2AESCMAC", 12, |
3974 | 0 | "SmbSign", 8, |
3975 | 0 | ses->signing_key, 16); |
3976 | 0 | } else if (conv->dialect >= SMB2_DIALECT_311) { |
3977 | 0 | if (!has_server_key) { |
3978 | 0 | smb2_key_derivation(ses->session_key, |
3979 | 0 | NTLMSSP_KEY_LEN, |
3980 | 0 | "SMBC2SCipherKey", 16, |
3981 | 0 | ses->preauth_hash, SMB2_PREAUTH_HASH_SIZE, |
3982 | 0 | ses->server_decryption_key16, 16); |
3983 | 0 | smb2_key_derivation(ses->session_key, |
3984 | 0 | ses->session_key_len, |
3985 | 0 | "SMBC2SCipherKey", 16, |
3986 | 0 | ses->preauth_hash, SMB2_PREAUTH_HASH_SIZE, |
3987 | 0 | ses->server_decryption_key32, 32); |
3988 | 0 | } |
3989 | 0 | if (!has_client_key) { |
3990 | 0 | smb2_key_derivation(ses->session_key, |
3991 | 0 | NTLMSSP_KEY_LEN, |
3992 | 0 | "SMBS2CCipherKey", 16, |
3993 | 0 | ses->preauth_hash, SMB2_PREAUTH_HASH_SIZE, |
3994 | 0 | ses->client_decryption_key16, 16); |
3995 | 0 | smb2_key_derivation(ses->session_key, |
3996 | 0 | ses->session_key_len, |
3997 | 0 | "SMBS2CCipherKey", 16, |
3998 | 0 | ses->preauth_hash, SMB2_PREAUTH_HASH_SIZE, |
3999 | 0 | ses->client_decryption_key32, 32); |
4000 | 0 | } |
4001 | 0 | if (!has_signkey) |
4002 | 0 | smb2_key_derivation(ses->session_key, |
4003 | 0 | NTLMSSP_KEY_LEN, |
4004 | 0 | "SMBSigningKey", 14, |
4005 | 0 | ses->preauth_hash, SMB2_PREAUTH_HASH_SIZE, |
4006 | 0 | ses->signing_key, 16); |
4007 | 0 | } |
4008 | |
|
4009 | 0 | ws_log_buffer(ses->signing_key, NTLMSSP_KEY_LEN, "Generated Sign key"); |
4010 | 0 | ws_log_buffer(ses->client_decryption_key16, AES_KEY_SIZE, "Generated S2C key16"); |
4011 | 0 | ws_log_buffer(ses->client_decryption_key32, AES_KEY_SIZE*2, "Generated S2C key32"); |
4012 | 0 | ws_log_buffer(ses->server_decryption_key16, AES_KEY_SIZE, "Generated C2S key16"); |
4013 | 0 | ws_log_buffer(ses->server_decryption_key32, AES_KEY_SIZE*2, "Generated C2S key32"); |
4014 | 0 | } |
4015 | | |
4016 | | static int |
4017 | | dissect_smb2_session_setup_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
4018 | 0 | { |
4019 | 0 | offset_length_buffer_t s_olb; |
4020 | 0 | const ntlmssp_header_t *ntlmssph; |
4021 | 0 | static int ntlmssp_tap_id = 0; |
4022 | 0 | smb2_saved_info_t *ssi = si->saved; |
4023 | 0 | proto_item *hash_item; |
4024 | 0 | int idx; |
4025 | |
|
4026 | 0 | if (!ntlmssp_tap_id) { |
4027 | 0 | GString *error_string; |
4028 | | /* We don't specify any callbacks at all. |
4029 | | * Instead we manually fetch the tapped data after the |
4030 | | * security blob has been fully dissected and before |
4031 | | * we exit from this dissector. |
4032 | | */ |
4033 | 0 | error_string = register_tap_listener("ntlmssp", NULL, NULL, |
4034 | 0 | TL_IS_DISSECTOR_HELPER, NULL, NULL, NULL, NULL); |
4035 | 0 | if (!error_string) { |
4036 | 0 | ntlmssp_tap_id = find_tap_id("ntlmssp"); |
4037 | 0 | } else { |
4038 | 0 | g_string_free(error_string, true); |
4039 | 0 | } |
4040 | 0 | } |
4041 | |
|
4042 | 0 | if (!pinfo->fd->visited && ssi) { |
4043 | | /* compute preauth hash on first pass */ |
4044 | | |
4045 | | /* start from last preauth hash of the connection if 1st request */ |
4046 | 0 | if (si->sesid == 0) |
4047 | 0 | memcpy(si->conv->preauth_hash_ses, si->conv->preauth_hash_con, SMB2_PREAUTH_HASH_SIZE); |
4048 | |
|
4049 | 0 | ssi->preauth_hash_req = (uint8_t*)wmem_alloc0(wmem_file_scope(), SMB2_PREAUTH_HASH_SIZE); |
4050 | 0 | update_preauth_hash(si->conv->preauth_hash_current, pinfo, tvb); |
4051 | 0 | memcpy(ssi->preauth_hash_req, si->conv->preauth_hash_current, SMB2_PREAUTH_HASH_SIZE); |
4052 | 0 | } |
4053 | |
|
4054 | 0 | if (ssi && ssi->preauth_hash_req) { |
4055 | 0 | hash_item = proto_tree_add_bytes_with_length(tree, hf_smb2_preauth_hash, tvb, |
4056 | 0 | 0, tvb_captured_length(tvb), |
4057 | 0 | ssi->preauth_hash_req, SMB2_PREAUTH_HASH_SIZE); |
4058 | 0 | proto_item_set_generated(hash_item); |
4059 | 0 | } |
4060 | | |
4061 | | /* buffer code */ |
4062 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
4063 | | /* some unknown bytes */ |
4064 | | |
4065 | | /* flags */ |
4066 | 0 | offset = dissect_smb2_ses_req_flags(tree, tvb, offset); |
4067 | | |
4068 | | /* security mode */ |
4069 | 0 | offset = dissect_smb2_secmode(tree, tvb, offset); |
4070 | | |
4071 | | /* capabilities */ |
4072 | 0 | offset = dissect_smb2_capabilities(tree, tvb, offset); |
4073 | | |
4074 | | /* channel */ |
4075 | 0 | proto_tree_add_item(tree, hf_smb2_channel, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
4076 | 0 | offset += 4; |
4077 | | |
4078 | | /* security blob offset/length */ |
4079 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &s_olb, OLB_O_UINT16_S_UINT16, hf_smb2_security_blob); |
4080 | | |
4081 | | /* previous session id */ |
4082 | 0 | proto_tree_add_item(tree, hf_smb2_previous_sesid, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
4083 | 0 | offset += 8; |
4084 | | |
4085 | | |
4086 | | /* the security blob itself */ |
4087 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &s_olb, si, dissect_smb2_secblob); |
4088 | |
|
4089 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &s_olb); |
4090 | | |
4091 | | /* If we have found a uid->acct_name mapping, store it */ |
4092 | 0 | if (!pinfo->fd->visited) { |
4093 | 0 | idx = 0; |
4094 | 0 | while ((ntlmssph = (const ntlmssp_header_t *)fetch_tapped_data(ntlmssp_tap_id, idx++)) != NULL) { |
4095 | 0 | if (ntlmssph->type == NTLMSSP_AUTH) { |
4096 | 0 | si->session = smb2_get_session(si->conv, si->sesid, pinfo, si); |
4097 | 0 | si->session->acct_name = wmem_strdup(wmem_file_scope(), ntlmssph->acct_name); |
4098 | 0 | si->session->domain_name = wmem_strdup(wmem_file_scope(), ntlmssph->domain_name); |
4099 | 0 | si->session->host_name = wmem_strdup(wmem_file_scope(), ntlmssph->host_name); |
4100 | | /* don't overwrite session key from preferences */ |
4101 | 0 | if (memcmp(si->session->session_key, zeros, NTLMSSP_KEY_LEN) == 0) { |
4102 | 0 | memcpy(si->session->session_key, ntlmssph->session_key, NTLMSSP_KEY_LEN); |
4103 | 0 | si->session->session_key_len = NTLMSSP_KEY_LEN; |
4104 | 0 | si->session->session_key_frame = pinfo->num; |
4105 | 0 | } |
4106 | 0 | si->session->auth_frame = pinfo->num; |
4107 | 0 | } |
4108 | 0 | } |
4109 | 0 | } |
4110 | |
|
4111 | 0 | return offset; |
4112 | 0 | } |
4113 | | |
4114 | | static void |
4115 | | dissect_smb2_share_redirect_error(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
4116 | 0 | { |
4117 | 0 | proto_tree *tree; |
4118 | 0 | proto_item *item = NULL; |
4119 | 0 | proto_tree *ips_tree; |
4120 | 0 | proto_item *ips_item; |
4121 | |
|
4122 | 0 | offset_length_buffer_t res_olb; |
4123 | 0 | uint32_t i, ip_count; |
4124 | |
|
4125 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_error_redir_context, tvb, offset, 0, ENC_NA); |
4126 | 0 | tree = proto_item_add_subtree(item, ett_smb2_error_redir_context); |
4127 | | |
4128 | | /* structure size */ |
4129 | 0 | proto_tree_add_item(tree, hf_smb2_error_redir_struct_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
4130 | 0 | offset += 4; |
4131 | | |
4132 | | /* notification type */ |
4133 | 0 | proto_tree_add_item(tree, hf_smb2_error_redir_notif_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
4134 | 0 | offset += 4; |
4135 | | |
4136 | | /* resource name offset/length */ |
4137 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &res_olb, OLB_O_UINT32_S_UINT32, hf_smb2_error_redir_res_name); |
4138 | | |
4139 | | /* flags */ |
4140 | 0 | proto_tree_add_item(tree, hf_smb2_error_redir_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
4141 | 0 | offset += 2; |
4142 | | |
4143 | | /* target type */ |
4144 | 0 | proto_tree_add_item(tree, hf_smb2_error_redir_target_type, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
4145 | 0 | offset += 2; |
4146 | | |
4147 | | /* ip addr count */ |
4148 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_error_redir_ip_count, tvb, offset, 4, ENC_LITTLE_ENDIAN, &ip_count); |
4149 | 0 | offset += 4; |
4150 | | |
4151 | | /* ip addr list */ |
4152 | 0 | ips_item = proto_tree_add_item(tree, hf_smb2_error_redir_ip_list, tvb, offset, 0, ENC_NA); |
4153 | 0 | ips_tree = proto_item_add_subtree(ips_item, ett_smb2_error_redir_ip_list); |
4154 | 0 | for (i = 0; i < ip_count; i++) |
4155 | 0 | offset += dissect_windows_sockaddr_storage(tvb, pinfo, ips_tree, offset, -1); |
4156 | | |
4157 | | /* resource name */ |
4158 | 0 | dissect_smb2_olb_off_string(pinfo, tree, tvb, &res_olb, offset, OLB_TYPE_UNICODE_STRING); |
4159 | 0 | } |
4160 | | |
4161 | | static void |
4162 | | dissect_smb2_STATUS_STOPPED_ON_SYMLINK(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
4163 | 0 | { |
4164 | 0 | proto_tree *tree; |
4165 | 0 | proto_item *item = NULL; |
4166 | |
|
4167 | 0 | offset_length_buffer_t s_olb, p_olb; |
4168 | |
|
4169 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_symlink_error_response, tvb, offset, -1, ENC_NA); |
4170 | 0 | tree = proto_item_add_subtree(item, ett_smb2_symlink_error_response); |
4171 | | |
4172 | | /* symlink length */ |
4173 | 0 | proto_tree_add_item(tree, hf_smb2_symlink_length, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
4174 | 0 | offset += 4; |
4175 | | |
4176 | | /* symlink error tag */ |
4177 | 0 | proto_tree_add_item(tree, hf_smb2_symlink_error_tag, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
4178 | 0 | offset += 4; |
4179 | | |
4180 | | /* reparse tag */ |
4181 | 0 | proto_tree_add_item(tree, hf_smb2_reparse_tag, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
4182 | 0 | offset += 4; |
4183 | |
|
4184 | 0 | proto_tree_add_item(tree, hf_smb2_reparse_data_length, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
4185 | 0 | offset += 2; |
4186 | |
|
4187 | 0 | proto_tree_add_item(tree, hf_smb2_unparsed_path_length, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
4188 | 0 | offset += 2; |
4189 | | |
4190 | | /* substitute name offset/length */ |
4191 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &s_olb, OLB_O_UINT16_S_UINT16, hf_smb2_symlink_substitute_name); |
4192 | | |
4193 | | /* print name offset/length */ |
4194 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &p_olb, OLB_O_UINT16_S_UINT16, hf_smb2_symlink_print_name); |
4195 | | |
4196 | | /* flags */ |
4197 | 0 | proto_tree_add_item(tree, hf_smb2_symlink_flags, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
4198 | 0 | offset += 4; |
4199 | | |
4200 | | /* substitute name string */ |
4201 | 0 | dissect_smb2_olb_off_string(pinfo, tree, tvb, &s_olb, offset, OLB_TYPE_UNICODE_STRING); |
4202 | | |
4203 | | /* print name string */ |
4204 | 0 | dissect_smb2_olb_off_string(pinfo, tree, tvb, &p_olb, offset, OLB_TYPE_UNICODE_STRING); |
4205 | 0 | } |
4206 | | |
4207 | | static int |
4208 | | // NOLINTNEXTLINE(misc-no-recursion) |
4209 | | dissect_smb2_error_context(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
4210 | 0 | { |
4211 | 0 | proto_tree *tree; |
4212 | 0 | proto_item *item = NULL; |
4213 | 0 | tvbuff_t *sub_tvb; |
4214 | 0 | uint32_t length; |
4215 | 0 | uint32_t id; |
4216 | |
|
4217 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_error_context, tvb, offset, -1, ENC_NA); |
4218 | 0 | tree = proto_item_add_subtree(item, ett_smb2_error_context); |
4219 | |
|
4220 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_error_context_length, tvb, offset, 4, ENC_LITTLE_ENDIAN, &length); |
4221 | 0 | offset += 4; |
4222 | |
|
4223 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_error_context_id, tvb, offset, 4, ENC_LITTLE_ENDIAN, &id); |
4224 | 0 | offset += 4; |
4225 | |
|
4226 | 0 | sub_tvb = tvb_new_subset_length(tvb, offset, length); |
4227 | 0 | dissect_smb2_error_data(sub_tvb, pinfo, tree, 0, id, si); |
4228 | 0 | offset += length; |
4229 | |
|
4230 | 0 | return offset; |
4231 | 0 | } |
4232 | | |
4233 | | /* |
4234 | | * Assumes it is being called with a sub-tvb (dissects at offsets 0) |
4235 | | */ |
4236 | | static void |
4237 | | // NOLINTNEXTLINE(misc-no-recursion) |
4238 | | dissect_smb2_error_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, |
4239 | | int error_context_count, int error_id, |
4240 | | smb2_info_t *si _U_) |
4241 | 0 | { |
4242 | 0 | proto_tree *tree; |
4243 | 0 | proto_item *item = NULL; |
4244 | |
|
4245 | 0 | int offset = 0; |
4246 | 0 | int i; |
4247 | |
|
4248 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_error_data, tvb, offset, -1, ENC_NA); |
4249 | 0 | tree = proto_item_add_subtree(item, ett_smb2_error_data); |
4250 | |
|
4251 | 0 | if (error_context_count == 0) { |
4252 | 0 | if (tvb_captured_length_remaining(tvb, offset) <= 1) |
4253 | 0 | return; |
4254 | 0 | switch (si->status) { |
4255 | 0 | case NT_STATUS_STOPPED_ON_SYMLINK: |
4256 | 0 | dissect_smb2_STATUS_STOPPED_ON_SYMLINK(tvb, pinfo, tree, offset, si); |
4257 | 0 | break; |
4258 | 0 | case NT_STATUS_BUFFER_TOO_SMALL: |
4259 | 0 | proto_tree_add_item(tree, hf_smb2_error_min_buf_length, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
4260 | 0 | break; |
4261 | 0 | case NT_STATUS_BAD_NETWORK_NAME: |
4262 | 0 | if (error_id == SMB2_ERROR_ID_SHARE_REDIRECT) |
4263 | 0 | dissect_smb2_share_redirect_error(tvb, pinfo, tree, offset, si); |
4264 | 0 | default: |
4265 | 0 | break; |
4266 | 0 | } |
4267 | 0 | } else { |
4268 | 0 | increment_dissection_depth(pinfo); |
4269 | 0 | for (i = 0; i < error_context_count; i++) { |
4270 | 0 | offset += dissect_smb2_error_context(tvb, pinfo, tree, offset, si); |
4271 | 0 | } |
4272 | 0 | decrement_dissection_depth(pinfo); |
4273 | 0 | } |
4274 | 0 | } |
4275 | | |
4276 | | /* |
4277 | | * SMB2 Error responses are a bit convoluted. Error data can be a list |
4278 | | * of error contexts which themselves can hold an error data field. |
4279 | | * See [MS-SMB2] 2.2.2.1. |
4280 | | * |
4281 | | * ERROR_RESP := ERROR_DATA |
4282 | | * |
4283 | | * ERROR_DATA := ( ERROR_CONTEXT + ) |
4284 | | * | ERROR_STATUS_STOPPED_ON_SYMLINK |
4285 | | * | ERROR_ID_SHARE_REDIRECT |
4286 | | * | ERROR_BUFFER_TOO_SMALL |
4287 | | * |
4288 | | * ERROR_CONTEXT := ... + ERROR_DATA |
4289 | | * | ERROR_ID_SHARE_REDIRECT |
4290 | | * |
4291 | | * This needs more fixes for cases when the original header had also the constant value of 9. |
4292 | | * This should be fixed on caller side where it decides if it has to call this or not. |
4293 | | * |
4294 | | */ |
4295 | | static int |
4296 | | dissect_smb2_error_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si, |
4297 | | bool* continue_dissection) |
4298 | 0 | { |
4299 | 0 | int byte_count; |
4300 | 0 | uint8_t error_context_count; |
4301 | 0 | uint16_t length; |
4302 | 0 | tvbuff_t *sub_tvb; |
4303 | | |
4304 | | /* buffer code */ |
4305 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, &length); |
4306 | | |
4307 | | /* FIX: error response uses this constant, if not then it is not an error response */ |
4308 | 0 | if(length != 9) |
4309 | 0 | { |
4310 | 0 | if(continue_dissection) |
4311 | 0 | *continue_dissection = true; |
4312 | 0 | } else { |
4313 | 0 | if(continue_dissection) |
4314 | 0 | *continue_dissection = false; |
4315 | | |
4316 | | /* ErrorContextCount (1 bytes) */ |
4317 | 0 | error_context_count = tvb_get_uint8(tvb, offset); |
4318 | 0 | proto_tree_add_item(tree, hf_smb2_error_context_count, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
4319 | 0 | offset += 1; |
4320 | | |
4321 | | /* Reserved (1 bytes) */ |
4322 | 0 | proto_tree_add_item(tree, hf_smb2_error_reserved, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
4323 | 0 | offset += 1; |
4324 | | |
4325 | | /* ByteCount (4 bytes): The number of bytes of data contained in ErrorData[]. */ |
4326 | 0 | byte_count = tvb_get_letohl(tvb, offset); |
4327 | 0 | proto_tree_add_item(tree, hf_smb2_error_byte_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
4328 | 0 | offset += 4; |
4329 | | |
4330 | | /* If the ByteCount field is zero then the server MUST supply an ErrorData field |
4331 | | that is one byte in length */ |
4332 | 0 | if (byte_count == 0) byte_count = 1; |
4333 | | |
4334 | | /* ErrorData (variable): A variable-length data field that contains extended |
4335 | | error information.*/ |
4336 | 0 | sub_tvb = tvb_new_subset_length(tvb, offset, byte_count); |
4337 | 0 | offset += byte_count; |
4338 | |
|
4339 | 0 | dissect_smb2_error_data(sub_tvb, pinfo, tree, error_context_count, 0, si); |
4340 | 0 | } |
4341 | |
|
4342 | 0 | return offset; |
4343 | 0 | } |
4344 | | |
4345 | | static int |
4346 | | dissect_smb2_session_setup_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
4347 | 0 | { |
4348 | 0 | offset_length_buffer_t s_olb; |
4349 | 0 | proto_item *hash_item; |
4350 | 0 | smb2_saved_info_t *ssi = si->saved; |
4351 | |
|
4352 | 0 | si->session = smb2_get_session(si->conv, si->sesid, pinfo, si); |
4353 | 0 | if (si->status == 0) { |
4354 | 0 | si->session->auth_frame = pinfo->num; |
4355 | 0 | } |
4356 | | |
4357 | | /* compute preauth hash on first pass */ |
4358 | 0 | if (!pinfo->fd->visited && ssi) { |
4359 | 0 | ssi->preauth_hash_res = (uint8_t*)wmem_alloc0(wmem_file_scope(), SMB2_PREAUTH_HASH_SIZE); |
4360 | | /* |
4361 | | * Preauth hash can only be used if the session is |
4362 | | * established i.e. last session setup response has a |
4363 | | * success status. As per the specification, the last |
4364 | | * response is NOT hashed. |
4365 | | */ |
4366 | 0 | if (si->status != 0) { |
4367 | | /* |
4368 | | * Not successful means either more req/rsp |
4369 | | * processing is required or we reached an |
4370 | | * error, so update hash. |
4371 | | */ |
4372 | 0 | update_preauth_hash(si->conv->preauth_hash_current, pinfo, tvb); |
4373 | 0 | } else { |
4374 | | /* |
4375 | | * Session is established, remember the last preauth hash |
4376 | | */ |
4377 | 0 | memcpy(si->session->preauth_hash, si->conv->preauth_hash_current, SMB2_PREAUTH_HASH_SIZE); |
4378 | 0 | } |
4379 | | |
4380 | | /* In all cases, stash the preauth hash */ |
4381 | 0 | memcpy(ssi->preauth_hash_res, si->conv->preauth_hash_current, SMB2_PREAUTH_HASH_SIZE); |
4382 | 0 | } |
4383 | |
|
4384 | 0 | if (ssi && ssi->preauth_hash_res) { |
4385 | 0 | hash_item = proto_tree_add_bytes_with_length(tree, hf_smb2_preauth_hash, tvb, |
4386 | 0 | 0, tvb_captured_length(tvb), |
4387 | 0 | ssi->preauth_hash_res, SMB2_PREAUTH_HASH_SIZE); |
4388 | 0 | proto_item_set_generated(hash_item); |
4389 | 0 | } |
4390 | | |
4391 | | /* session_setup is special and we don't use dissect_smb2_error_response() here! */ |
4392 | | |
4393 | | /* buffer code */ |
4394 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
4395 | | |
4396 | | /* session flags */ |
4397 | 0 | offset = dissect_smb2_ses_flags(tree, tvb, offset); |
4398 | | |
4399 | | /* security blob offset/length */ |
4400 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &s_olb, OLB_O_UINT16_S_UINT16, hf_smb2_security_blob); |
4401 | | |
4402 | | /* the security blob itself */ |
4403 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &s_olb, si, dissect_smb2_secblob); |
4404 | |
|
4405 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &s_olb); |
4406 | | |
4407 | | /* If we have found a uid->acct_name mapping, store it */ |
4408 | | #ifdef HAVE_KERBEROS |
4409 | | if (!pinfo->fd->visited && |
4410 | | ((si->session->session_key_frame == UINT32_MAX) || |
4411 | | (si->session->session_key_frame < pinfo->num))) |
4412 | | { |
4413 | | enc_key_t *ek; |
4414 | | |
4415 | | if (krb_decrypt) { |
4416 | | read_keytab_file_from_preferences(); |
4417 | | } |
4418 | | |
4419 | | for (ek=enc_key_list;ek;ek=ek->next) { |
4420 | | if (!ek->is_ap_rep_key) { |
4421 | | continue; |
4422 | | } |
4423 | | if (ek->fd_num == (int)pinfo->num) { |
4424 | | break; |
4425 | | } |
4426 | | } |
4427 | | |
4428 | | if (ek != NULL) { |
4429 | | /* |
4430 | | * If we remembered information from the PAC content |
4431 | | * from GSSAPI AP exchange we use it, otherwise we |
4432 | | * can only give a hint about the used session key. |
4433 | | */ |
4434 | | if (ek->pac_names.account_name) { |
4435 | | si->session->acct_name = wmem_strdup(wmem_file_scope(), |
4436 | | ek->pac_names.account_name); |
4437 | | si->session->domain_name = wmem_strdup(wmem_file_scope(), |
4438 | | ek->pac_names.account_domain); |
4439 | | if (ek->pac_names.device_sid) { |
4440 | | si->session->host_name = wmem_strdup_printf(wmem_file_scope(), |
4441 | | "DEVICE[%s]", |
4442 | | ek->pac_names.device_sid); |
4443 | | } else { |
4444 | | si->session->host_name = NULL; |
4445 | | } |
4446 | | } else { |
4447 | | si->session->acct_name = wmem_strdup_printf(wmem_file_scope(), |
4448 | | "KERBEROS[%s]", |
4449 | | ek->key_origin); |
4450 | | si->session->domain_name = wmem_strdup_printf(wmem_file_scope(), |
4451 | | "KERBEROS[%s]", |
4452 | | ek->id_str); |
4453 | | si->session->host_name = NULL; |
4454 | | } |
4455 | | /* don't overwrite session key from preferences */ |
4456 | | if (memcmp(si->session->session_key, zeros, NTLMSSP_KEY_LEN) == 0) { |
4457 | | si->session->session_key_len = MIN(NTLMSSP_KEY_LEN*2, ek->keylength); |
4458 | | memcpy(si->session->session_key, |
4459 | | ek->keyvalue, |
4460 | | si->session->session_key_len); |
4461 | | si->session->session_key_frame = pinfo->num; |
4462 | | } |
4463 | | } |
4464 | | } |
4465 | | #endif |
4466 | |
|
4467 | 0 | if (si->status == 0) { |
4468 | | /* |
4469 | | * Session is established, we can generate the keys |
4470 | | */ |
4471 | 0 | smb2_generate_decryption_keys(si->conv, si->session); |
4472 | 0 | } |
4473 | |
|
4474 | 0 | return offset; |
4475 | 0 | } |
4476 | | |
4477 | | static int |
4478 | | dissect_smb2_tree_connect_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si _U_) |
4479 | 0 | { |
4480 | 0 | offset_length_buffer_t olb; |
4481 | 0 | const uint8_t *buf; |
4482 | 0 | uint16_t flags; |
4483 | 0 | proto_item *item = NULL; |
4484 | 0 | static int * const connect_flags[] = { |
4485 | 0 | &hf_smb2_tc_cluster_reconnect, |
4486 | 0 | &hf_smb2_tc_redirect_to_owner, |
4487 | 0 | &hf_smb2_tc_extension_present, |
4488 | 0 | &hf_smb2_tc_reserved, |
4489 | 0 | NULL |
4490 | 0 | }; |
4491 | | |
4492 | | /* buffer code */ |
4493 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
4494 | | |
4495 | | /* flags */ |
4496 | 0 | item = proto_tree_get_parent(tree); |
4497 | 0 | flags = tvb_get_letohs(tvb, offset); |
4498 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_tree_connect_flags, ett_smb2_tree_connect_flags, connect_flags, ENC_LITTLE_ENDIAN); |
4499 | |
|
4500 | 0 | if (flags != 0) { |
4501 | 0 | proto_item_append_text(item, "%s%s%s", |
4502 | 0 | (flags & 0x0001)?", CLUSTER_RECONNECT":"", |
4503 | 0 | (flags & 0x0002)?", REDIRECT_TO_OWNER":"", |
4504 | 0 | (flags & 0x0004)?", EXTENSION_PRESENT":""); |
4505 | 0 | } |
4506 | 0 | offset += 2; |
4507 | | |
4508 | | /* tree offset/length */ |
4509 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &olb, OLB_O_UINT16_S_UINT16, hf_smb2_tree); |
4510 | | |
4511 | | /* tree string */ |
4512 | 0 | buf = dissect_smb2_olb_string(pinfo, tree, tvb, &olb, OLB_TYPE_UNICODE_STRING); |
4513 | |
|
4514 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &olb); |
4515 | |
|
4516 | 0 | if (!pinfo->fd->visited && si->saved && buf && olb.len) { |
4517 | 0 | si->saved->extra_info_type = SMB2_EI_TREENAME; |
4518 | 0 | si->saved->extra_info = wmem_strdup(wmem_file_scope(), buf); |
4519 | 0 | } |
4520 | |
|
4521 | 0 | if (buf) { |
4522 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", Tree: '%s'", |
4523 | 0 | format_text(pinfo->pool, buf, strlen(buf))); |
4524 | 0 | } |
4525 | |
|
4526 | 0 | return offset; |
4527 | 0 | } |
4528 | | static int |
4529 | | dissect_smb2_tree_connect_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si _U_) |
4530 | 0 | { |
4531 | 0 | uint8_t share_type; |
4532 | 0 | bool continue_dissection; |
4533 | |
|
4534 | 0 | switch (si->status) { |
4535 | | /* buffer code */ |
4536 | 0 | case 0x00000000: offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); break; |
4537 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
4538 | 0 | if (!continue_dissection) return offset; |
4539 | 0 | } |
4540 | | |
4541 | | /* share type */ |
4542 | 0 | share_type = tvb_get_uint8(tvb, offset); |
4543 | 0 | proto_tree_add_item(tree, hf_smb2_share_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
4544 | 0 | offset += 1; |
4545 | | |
4546 | | /* byte is reserved and must be set to zero */ |
4547 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 1, ENC_NA); |
4548 | 0 | offset += 1; |
4549 | |
|
4550 | 0 | if (!pinfo->fd->visited && si->saved && si->saved->extra_info_type == SMB2_EI_TREENAME && si->session) { |
4551 | 0 | smb2_tid_info_t *tid, tid_key; |
4552 | |
|
4553 | 0 | tid_key.tid = si->tid; |
4554 | 0 | tid = (smb2_tid_info_t *)wmem_map_lookup(si->session->tids, &tid_key); |
4555 | 0 | if (tid) { |
4556 | 0 | wmem_map_remove(si->session->tids, &tid_key); |
4557 | 0 | } |
4558 | 0 | tid = wmem_new(wmem_file_scope(), smb2_tid_info_t); |
4559 | 0 | tid->tid = si->tid; |
4560 | 0 | tid->name = (char *)si->saved->extra_info; |
4561 | 0 | tid->connect_frame = pinfo->num; |
4562 | 0 | tid->disconnect_frame = 0; |
4563 | 0 | tid->share_type = share_type; |
4564 | |
|
4565 | 0 | wmem_map_insert(si->session->tids, tid, tid); |
4566 | |
|
4567 | 0 | si->saved->extra_info_type = SMB2_EI_NONE; |
4568 | 0 | si->saved->extra_info = NULL; |
4569 | 0 | } |
4570 | |
|
4571 | 0 | if (si->tree) |
4572 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", Tree: '%s'", si->tree->name); |
4573 | | |
4574 | | /* share flags */ |
4575 | 0 | offset = dissect_smb2_share_flags(tree, tvb, offset); |
4576 | | |
4577 | | /* share capabilities */ |
4578 | 0 | offset = dissect_smb2_share_caps(tree, tvb, offset); |
4579 | | |
4580 | | /* this is some sort of access mask */ |
4581 | 0 | offset = dissect_smb_access_mask(tvb, tree, offset); |
4582 | |
|
4583 | 0 | return offset; |
4584 | 0 | } |
4585 | | |
4586 | | static int |
4587 | | dissect_smb2_tree_disconnect_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_) |
4588 | 0 | { |
4589 | | /* buffer code */ |
4590 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
4591 | |
|
4592 | 0 | if (si->tree) |
4593 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", Tree: '%s'", si->tree->name); |
4594 | | |
4595 | | /* reserved */ |
4596 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
4597 | 0 | offset += 2; |
4598 | |
|
4599 | 0 | return offset; |
4600 | 0 | } |
4601 | | |
4602 | | static int |
4603 | | dissect_smb2_tree_disconnect_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_) |
4604 | 0 | { |
4605 | 0 | bool continue_dissection; |
4606 | |
|
4607 | 0 | switch (si->status) { |
4608 | | /* buffer code */ |
4609 | 0 | case 0x00000000: |
4610 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
4611 | 0 | break; |
4612 | | |
4613 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
4614 | 0 | if (!continue_dissection) return offset; |
4615 | 0 | } |
4616 | | |
4617 | 0 | if (si->tree) { |
4618 | 0 | si->tree->disconnect_frame = pinfo->fd->num; |
4619 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", Tree: '%s'", si->tree->name); |
4620 | 0 | } |
4621 | | |
4622 | | /* reserved */ |
4623 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
4624 | 0 | offset += 2; |
4625 | |
|
4626 | 0 | return offset; |
4627 | 0 | } |
4628 | | |
4629 | | static int |
4630 | | dissect_smb2_sessionlogoff_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_) |
4631 | 0 | { |
4632 | | /* buffer code */ |
4633 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
4634 | | |
4635 | | /* reserved bytes */ |
4636 | 0 | offset += 2; |
4637 | |
|
4638 | 0 | return offset; |
4639 | 0 | } |
4640 | | |
4641 | | static int |
4642 | | dissect_smb2_sessionlogoff_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_) |
4643 | 0 | { |
4644 | 0 | bool continue_dissection; |
4645 | |
|
4646 | 0 | switch (si->status) { |
4647 | | /* buffer code */ |
4648 | 0 | case 0x00000000: offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); break; |
4649 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
4650 | 0 | if (!continue_dissection) return offset; |
4651 | 0 | } |
4652 | | |
4653 | | /* reserved bytes */ |
4654 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
4655 | 0 | offset += 2; |
4656 | |
|
4657 | 0 | return offset; |
4658 | 0 | } |
4659 | | |
4660 | | static int |
4661 | | dissect_smb2_keepalive_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_) |
4662 | 0 | { |
4663 | | /* buffer code */ |
4664 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
4665 | | |
4666 | | /* some unknown bytes */ |
4667 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 2, ENC_NA); |
4668 | 0 | offset += 2; |
4669 | |
|
4670 | 0 | return offset; |
4671 | 0 | } |
4672 | | |
4673 | | static int |
4674 | | dissect_smb2_keepalive_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_) |
4675 | 0 | { |
4676 | 0 | bool continue_dissection; |
4677 | |
|
4678 | 0 | switch (si->status) { |
4679 | | /* buffer code */ |
4680 | 0 | case 0x00000000: offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); break; |
4681 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
4682 | 0 | if (!continue_dissection) return offset; |
4683 | 0 | } |
4684 | | |
4685 | | /* some unknown bytes */ |
4686 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 2, ENC_NA); |
4687 | 0 | offset += 2; |
4688 | |
|
4689 | 0 | return offset; |
4690 | 0 | } |
4691 | | |
4692 | | static int |
4693 | | dissect_smb2_notify_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
4694 | 0 | { |
4695 | 0 | e_guid_t tag_guid; |
4696 | 0 | proto_tree *flags_tree = NULL; |
4697 | 0 | proto_item *flags_item = NULL; |
4698 | 0 | proto_item *item = NULL; |
4699 | 0 | proto_tree *fid_tree; |
4700 | 0 | proto_tree *which_tree; |
4701 | | |
4702 | | /* buffer code */ |
4703 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
4704 | | |
4705 | | /* notify flags */ |
4706 | 0 | if (tree) { |
4707 | 0 | flags_item = proto_tree_add_item(tree, hf_smb2_notify_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
4708 | 0 | flags_tree = proto_item_add_subtree(flags_item, ett_smb2_notify_flags); |
4709 | 0 | } |
4710 | 0 | proto_tree_add_item(flags_tree, hf_smb2_notify_watch_tree, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
4711 | 0 | offset += 2; |
4712 | | |
4713 | | /* output buffer length */ |
4714 | 0 | proto_tree_add_item(tree, hf_smb2_output_buffer_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
4715 | 0 | offset += 4; |
4716 | | |
4717 | | /* Save the FID for use in the reply */ |
4718 | 0 | tvb_get_letohguid(tvb, offset, &tag_guid); |
4719 | 0 | if (si->saved) |
4720 | 0 | si->saved->uuid_fid = tag_guid; |
4721 | | |
4722 | | /* fid */ |
4723 | 0 | offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); |
4724 | |
|
4725 | 0 | if (si->saved && si->saved->hnd_item) { |
4726 | 0 | fid_tree = proto_item_add_subtree(si->saved->hnd_item, ett_smb2_fid_str); |
4727 | 0 | which_tree = fid_tree; |
4728 | 0 | } else { |
4729 | 0 | which_tree = tree; |
4730 | 0 | } |
4731 | | |
4732 | | /* Filename */ |
4733 | 0 | if (si->file && si->file->name) { |
4734 | 0 | if (strcmp(si->file->name, "") == 0) |
4735 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
4736 | 0 | item = proto_tree_add_string(which_tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
4737 | 0 | proto_item_set_generated(item); |
4738 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
4739 | 0 | } |
4740 | | |
4741 | | /* fid hash */ |
4742 | 0 | if (si->saved && si->saved->fid_hash) { |
4743 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
4744 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
4745 | 0 | proto_item_set_generated(item); |
4746 | 0 | } |
4747 | | |
4748 | | /* completion filter */ |
4749 | 0 | offset = dissect_nt_notify_completion_filter(tvb, tree, offset); |
4750 | | |
4751 | | /* reserved */ |
4752 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
4753 | 0 | offset += 4; |
4754 | |
|
4755 | 0 | return offset; |
4756 | 0 | } |
4757 | | |
4758 | | static const value_string notify_action_vals[] = { |
4759 | | {0x01, "FILE_ACTION_ADDED"}, |
4760 | | {0x02, "FILE_ACTION_REMOVED"}, |
4761 | | {0x03, "FILE_ACTION_MODIFIED"}, |
4762 | | {0x04, "FILE_ACTION_RENAMED_OLD_NAME"}, |
4763 | | {0x05, "FILE_ACTION_RENAMED_NEW_NAME"}, |
4764 | | {0x06, "FILE_ACTION_ADDED_STREAM"}, |
4765 | | {0x07, "FILE_ACTION_REMOVED_STREAM"}, |
4766 | | {0x08, "FILE_ACTION_MODIFIED_STREAM"}, |
4767 | | {0x09, "FILE_ACTION_REMOVED_BY_DELETE"}, |
4768 | | {0, NULL} |
4769 | | }; |
4770 | | |
4771 | | static void |
4772 | | dissect_smb2_notify_data_out(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, smb2_info_t *si _U_) |
4773 | 0 | { |
4774 | 0 | proto_tree *tree = NULL; |
4775 | 0 | proto_item *item = NULL; |
4776 | 0 | int offset = 0; |
4777 | |
|
4778 | 0 | while (tvb_reported_length_remaining(tvb, offset) > 4) { |
4779 | 0 | uint32_t start_offset = offset; |
4780 | 0 | uint32_t next_offset; |
4781 | 0 | uint32_t length; |
4782 | |
|
4783 | 0 | if (parent_tree) { |
4784 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_notify_info, tvb, offset, -1, ENC_NA); |
4785 | 0 | tree = proto_item_add_subtree(item, ett_smb2_notify_info); |
4786 | 0 | } |
4787 | | |
4788 | | /* next offset */ |
4789 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_notify_next_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN, &next_offset); |
4790 | 0 | offset += 4; |
4791 | |
|
4792 | 0 | proto_tree_add_item(tree, hf_smb2_notify_action, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
4793 | 0 | offset += 4; |
4794 | | |
4795 | | /* file name length */ |
4796 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_filename_len, tvb, offset, 4, ENC_LITTLE_ENDIAN, &length); |
4797 | 0 | offset += 4; |
4798 | | |
4799 | | /* file name */ |
4800 | 0 | if (length) { |
4801 | 0 | proto_tree_add_item(tree, hf_smb2_filename, |
4802 | 0 | tvb, offset, length, ENC_UTF_16|ENC_LITTLE_ENDIAN); |
4803 | 0 | } |
4804 | |
|
4805 | 0 | if (!next_offset) { |
4806 | 0 | break; |
4807 | 0 | } |
4808 | | |
4809 | 0 | offset = start_offset+next_offset; |
4810 | 0 | } |
4811 | 0 | } |
4812 | | |
4813 | | static int |
4814 | | dissect_smb2_notify_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si) |
4815 | 0 | { |
4816 | 0 | offset_length_buffer_t olb; |
4817 | 0 | bool continue_dissection; |
4818 | 0 | proto_item *item = NULL; |
4819 | 0 | proto_tree *tag_tree = NULL; |
4820 | 0 | proto_item *tag_item = NULL; |
4821 | 0 | proto_tree *which_tree = NULL; |
4822 | |
|
4823 | 0 | switch (si->status) { |
4824 | | /* MS-SMB2 3.3.4.4 says STATUS_NOTIFY_ENUM_DIR is not treated as an error */ |
4825 | 0 | case 0x0000010c: /* STATUS_NOTIFY_ENUM_DIR */ |
4826 | 0 | case 0x00000000: /* buffer code */ |
4827 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); break; |
4828 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
4829 | 0 | if (!continue_dissection) return offset; |
4830 | 0 | } |
4831 | | |
4832 | 0 | if (pinfo->fd->visited) { |
4833 | 0 | if (si->file && si->file->name) { |
4834 | 0 | if (strcmp(si->file->name, "") == 0) |
4835 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
4836 | 0 | tag_item = proto_tree_add_string(tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
4837 | 0 | tag_tree = proto_item_add_subtree(tag_item, ett_smb2_fid_str); |
4838 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
4839 | 0 | which_tree = tag_tree; |
4840 | 0 | } else { |
4841 | 0 | which_tree = tree; |
4842 | 0 | } |
4843 | 0 | if (si->saved) { |
4844 | 0 | item = proto_tree_add_guid(which_tree, hf_smb2_fid, tvb, 0, 0, (e_guid_t *)&si->saved->uuid_fid); |
4845 | 0 | proto_item_set_generated(item); |
4846 | 0 | } |
4847 | 0 | if (si->saved && si->saved->fid_hash) { |
4848 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
4849 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
4850 | 0 | proto_item_set_generated(item); |
4851 | 0 | } |
4852 | 0 | if (si->file && si->file->frame_beg > 0 && si->file->frame_beg < UINT32_MAX) { |
4853 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
4854 | 0 | si->file->frame_beg); |
4855 | 0 | proto_item_set_generated(item); |
4856 | 0 | } else { |
4857 | 0 | if (si->saved && si->saved->frame_beg > 0 && si->saved->frame_beg < UINT32_MAX) { |
4858 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
4859 | 0 | si->saved->frame_beg); |
4860 | 0 | proto_item_set_generated(item); |
4861 | 0 | } |
4862 | 0 | } |
4863 | 0 | if (si->file && si->file->frame_end > 0 && si->file->frame_end < UINT32_MAX) { |
4864 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
4865 | 0 | si->file->frame_end); |
4866 | 0 | proto_item_set_generated(item); |
4867 | 0 | } else { |
4868 | 0 | if (si->saved && si->saved->frame_end > 0 && si->saved->frame_end < UINT32_MAX) { |
4869 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
4870 | 0 | si->saved->frame_end); |
4871 | 0 | proto_item_set_generated(item); |
4872 | 0 | } |
4873 | 0 | } |
4874 | 0 | } |
4875 | | |
4876 | | |
4877 | | /* out buffer offset/length */ |
4878 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &olb, OLB_O_UINT16_S_UINT32, hf_smb2_notify_out_data); |
4879 | | |
4880 | | /* out buffer */ |
4881 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &olb, si, dissect_smb2_notify_data_out); |
4882 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &olb); |
4883 | |
|
4884 | 0 | return offset; |
4885 | 0 | } |
4886 | | |
4887 | 14 | #define SMB2_FIND_FLAG_RESTART_SCANS 0x01 |
4888 | 14 | #define SMB2_FIND_FLAG_SINGLE_ENTRY 0x02 |
4889 | 14 | #define SMB2_FIND_FLAG_INDEX_SPECIFIED 0x04 |
4890 | 14 | #define SMB2_FIND_FLAG_REOPEN 0x10 |
4891 | | |
4892 | | static int |
4893 | | dissect_smb2_find_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
4894 | 0 | { |
4895 | 0 | offset_length_buffer_t olb; |
4896 | 0 | const uint8_t *buf; |
4897 | 0 | uint8_t il; |
4898 | 0 | static int * const f_fields[] = { |
4899 | 0 | &hf_smb2_find_flags_restart_scans, |
4900 | 0 | &hf_smb2_find_flags_single_entry, |
4901 | 0 | &hf_smb2_find_flags_index_specified, |
4902 | 0 | &hf_smb2_find_flags_reopen, |
4903 | 0 | NULL |
4904 | 0 | }; |
4905 | 0 | e_guid_t tag_guid; |
4906 | 0 | proto_tree *fid_tree; |
4907 | 0 | proto_item *item = NULL; |
4908 | 0 | proto_tree *which_tree = tree; |
4909 | | |
4910 | | /* buffer code */ |
4911 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
4912 | |
|
4913 | 0 | il = tvb_get_uint8(tvb, offset); |
4914 | 0 | if (si->saved) { |
4915 | 0 | si->saved->infolevel = il; |
4916 | 0 | } |
4917 | | |
4918 | | /* infolevel */ |
4919 | 0 | proto_tree_add_uint(tree, hf_smb2_find_info_level, tvb, offset, 1, il); |
4920 | 0 | offset += 1; |
4921 | | |
4922 | | /* find flags */ |
4923 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_find_flags, ett_smb2_find_flags, f_fields, ENC_LITTLE_ENDIAN); |
4924 | 0 | offset += 1; |
4925 | | |
4926 | | /* file index */ |
4927 | 0 | proto_tree_add_item(tree, hf_smb2_file_index, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
4928 | 0 | offset += 4; |
4929 | | |
4930 | | /* Save the FID for use in responses and the create request */ |
4931 | 0 | tvb_get_letohguid(tvb, offset, &tag_guid); |
4932 | 0 | if (si->saved) { |
4933 | 0 | si->saved->uuid_fid = tag_guid; |
4934 | 0 | } |
4935 | | |
4936 | | /* fid */ |
4937 | 0 | offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); |
4938 | |
|
4939 | 0 | if (si->saved && si->saved->hnd_item) { |
4940 | 0 | fid_tree = proto_item_add_subtree(si->saved->hnd_item, ett_smb2_fid_str); |
4941 | 0 | which_tree = fid_tree; |
4942 | 0 | } |
4943 | |
|
4944 | 0 | if (si->file && si->file->name) { |
4945 | 0 | if (strcmp(si->file->name, "") == 0) |
4946 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
4947 | 0 | item = proto_tree_add_string(which_tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
4948 | 0 | proto_item_set_generated(item); |
4949 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
4950 | 0 | } |
4951 | |
|
4952 | 0 | if (si->saved && si->saved->fid_hash) { |
4953 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
4954 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
4955 | 0 | proto_item_set_generated(item); |
4956 | 0 | } |
4957 | | |
4958 | | /* search pattern offset/length */ |
4959 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &olb, OLB_O_UINT16_S_UINT16, hf_smb2_find_pattern); |
4960 | | |
4961 | | /* output buffer length */ |
4962 | 0 | proto_tree_add_item(tree, hf_smb2_output_buffer_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
4963 | 0 | offset += 4; |
4964 | | |
4965 | | /* search pattern */ |
4966 | 0 | buf = dissect_smb2_olb_string(pinfo, tree, tvb, &olb, OLB_TYPE_UNICODE_STRING); |
4967 | |
|
4968 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &olb); |
4969 | |
|
4970 | 0 | if (!pinfo->fd->visited && si->saved && olb.len) { |
4971 | 0 | si->saved->extra_info_type = SMB2_EI_FINDPATTERN; |
4972 | 0 | si->saved->extra_info = wmem_strdup(wmem_file_scope(), buf); |
4973 | 0 | } |
4974 | |
|
4975 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", %s, Pattern: %s", |
4976 | 0 | val_to_str(il, smb2_find_info_levels, "(Level:0x%02x)"), |
4977 | 0 | buf); |
4978 | |
|
4979 | 0 | return offset; |
4980 | 0 | } |
4981 | | |
4982 | | static void dissect_smb2_file_directory_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, smb2_info_t *si _U_) |
4983 | 0 | { |
4984 | 0 | int offset = 0; |
4985 | 0 | proto_item *item = NULL; |
4986 | 0 | proto_tree *tree = NULL; |
4987 | |
|
4988 | 0 | while (tvb_reported_length_remaining(tvb, offset) > 4) { |
4989 | 0 | int old_offset = offset; |
4990 | 0 | int next_offset; |
4991 | 0 | int file_name_len; |
4992 | |
|
4993 | 0 | if (parent_tree) { |
4994 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_file_directory_info, tvb, offset, -1, ENC_NA); |
4995 | 0 | tree = proto_item_add_subtree(item, ett_smb2_file_directory_info); |
4996 | 0 | } |
4997 | | |
4998 | | /* next offset */ |
4999 | 0 | next_offset = tvb_get_letohl(tvb, offset); |
5000 | 0 | proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5001 | 0 | offset += 4; |
5002 | | |
5003 | | /* file index */ |
5004 | 0 | proto_tree_add_item(tree, hf_smb2_file_index, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5005 | 0 | offset += 4; |
5006 | | |
5007 | | /* create time */ |
5008 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_create_timestamp, ENC_LITTLE_ENDIAN); |
5009 | 0 | offset += 8; |
5010 | | |
5011 | | /* last access */ |
5012 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_access_timestamp, ENC_LITTLE_ENDIAN); |
5013 | 0 | offset += 8; |
5014 | | |
5015 | | /* last write */ |
5016 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_write_timestamp, ENC_LITTLE_ENDIAN); |
5017 | 0 | offset += 8; |
5018 | | |
5019 | | /* last change */ |
5020 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_change_timestamp, ENC_LITTLE_ENDIAN); |
5021 | 0 | offset += 8; |
5022 | | |
5023 | | /* end of file */ |
5024 | 0 | proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5025 | 0 | offset += 8; |
5026 | | |
5027 | | /* allocation size */ |
5028 | 0 | proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5029 | 0 | offset += 8; |
5030 | | |
5031 | | /* File Attributes */ |
5032 | 0 | offset = dissect_fscc_file_attr(tvb, tree, offset, NULL); |
5033 | | |
5034 | | /* file name length */ |
5035 | 0 | file_name_len = tvb_get_letohl(tvb, offset); |
5036 | 0 | proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5037 | 0 | offset += 4; |
5038 | | |
5039 | | /* file name */ |
5040 | 0 | if (file_name_len) { |
5041 | 0 | char *display_string; |
5042 | |
|
5043 | 0 | proto_tree_add_item_ret_display_string(tree, hf_smb2_filename, |
5044 | 0 | tvb, offset, file_name_len, ENC_UTF_16|ENC_LITTLE_ENDIAN, |
5045 | 0 | pinfo->pool, &display_string); |
5046 | 0 | proto_item_append_text(item, ": %s", display_string); |
5047 | 0 | offset += file_name_len; |
5048 | 0 | } |
5049 | |
|
5050 | 0 | proto_item_set_len(item, offset-old_offset); |
5051 | |
|
5052 | 0 | if (si->saved) |
5053 | 0 | si->saved->num_matched++; |
5054 | |
|
5055 | 0 | if (next_offset == 0) { |
5056 | 0 | return; |
5057 | 0 | } |
5058 | | |
5059 | 0 | offset = old_offset+next_offset; |
5060 | 0 | if (offset < old_offset) { |
5061 | 0 | proto_tree_add_expert_format(tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, |
5062 | 0 | "Invalid offset/length. Malformed packet"); |
5063 | 0 | return; |
5064 | 0 | } |
5065 | 0 | } |
5066 | 0 | } |
5067 | | |
5068 | | static void dissect_smb2_full_directory_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, smb2_info_t *si _U_) |
5069 | 0 | { |
5070 | 0 | int offset = 0; |
5071 | 0 | proto_item *item = NULL; |
5072 | 0 | proto_tree *tree = NULL; |
5073 | |
|
5074 | 0 | while (tvb_reported_length_remaining(tvb, offset) > 4) { |
5075 | 0 | int old_offset = offset; |
5076 | 0 | int next_offset; |
5077 | 0 | int file_name_len; |
5078 | 0 | uint32_t attr; |
5079 | |
|
5080 | 0 | if (parent_tree) { |
5081 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_full_directory_info, tvb, offset, -1, ENC_NA); |
5082 | 0 | tree = proto_item_add_subtree(item, ett_smb2_full_directory_info); |
5083 | 0 | } |
5084 | | |
5085 | | /* next offset */ |
5086 | 0 | next_offset = tvb_get_letohl(tvb, offset); |
5087 | 0 | proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5088 | 0 | offset += 4; |
5089 | | |
5090 | | /* file index */ |
5091 | 0 | proto_tree_add_item(tree, hf_smb2_file_index, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5092 | 0 | offset += 4; |
5093 | | |
5094 | | /* create time */ |
5095 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_create_timestamp, ENC_LITTLE_ENDIAN); |
5096 | 0 | offset += 8; |
5097 | | |
5098 | | /* last access */ |
5099 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_access_timestamp, ENC_LITTLE_ENDIAN); |
5100 | 0 | offset += 8; |
5101 | | |
5102 | | /* last write */ |
5103 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_write_timestamp, ENC_LITTLE_ENDIAN); |
5104 | 0 | offset += 8; |
5105 | | |
5106 | | /* last change */ |
5107 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_change_timestamp, ENC_LITTLE_ENDIAN); |
5108 | 0 | offset += 8; |
5109 | | |
5110 | | /* end of file */ |
5111 | 0 | proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5112 | 0 | offset += 8; |
5113 | | |
5114 | | /* allocation size */ |
5115 | 0 | proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5116 | 0 | offset += 8; |
5117 | | |
5118 | | /* File Attributes */ |
5119 | 0 | offset = dissect_fscc_file_attr(tvb, tree, offset, &attr); |
5120 | | |
5121 | | /* file name length */ |
5122 | 0 | file_name_len = tvb_get_letohl(tvb, offset); |
5123 | 0 | proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5124 | 0 | offset += 4; |
5125 | | |
5126 | | /* ea size or reparse tag */ |
5127 | 0 | if (attr & SMB2_FSCC_FILE_ATTRIBUTE_REPARSE_POINT) |
5128 | 0 | proto_tree_add_item(tree, hf_smb2_reparse_tag, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5129 | 0 | else |
5130 | 0 | proto_tree_add_item(tree, hf_smb2_ea_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5131 | 0 | offset += 4; |
5132 | | |
5133 | | /* file name */ |
5134 | 0 | if (file_name_len) { |
5135 | 0 | char *display_string; |
5136 | |
|
5137 | 0 | proto_tree_add_item_ret_display_string(tree, hf_smb2_filename, |
5138 | 0 | tvb, offset, file_name_len, ENC_UTF_16|ENC_LITTLE_ENDIAN, |
5139 | 0 | pinfo->pool, &display_string); |
5140 | 0 | proto_item_append_text(item, ": %s", display_string); |
5141 | 0 | offset += file_name_len; |
5142 | 0 | } |
5143 | |
|
5144 | 0 | proto_item_set_len(item, offset-old_offset); |
5145 | |
|
5146 | 0 | if (si->saved) |
5147 | 0 | si->saved->num_matched++; |
5148 | |
|
5149 | 0 | if (next_offset == 0) { |
5150 | 0 | return; |
5151 | 0 | } |
5152 | | |
5153 | 0 | offset = old_offset+next_offset; |
5154 | 0 | if (offset < old_offset) { |
5155 | 0 | proto_tree_add_expert_format(tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, |
5156 | 0 | "Invalid offset/length. Malformed packet"); |
5157 | 0 | return; |
5158 | 0 | } |
5159 | 0 | } |
5160 | 0 | } |
5161 | | |
5162 | | static void dissect_smb2_both_directory_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, smb2_info_t *si _U_) |
5163 | 0 | { |
5164 | 0 | int offset = 0; |
5165 | 0 | proto_item *item = NULL; |
5166 | 0 | proto_tree *tree = NULL; |
5167 | |
|
5168 | 0 | while (tvb_reported_length_remaining(tvb, offset) > 4) { |
5169 | 0 | int old_offset = offset; |
5170 | 0 | int next_offset; |
5171 | 0 | int file_name_len; |
5172 | 0 | int short_name_len; |
5173 | 0 | uint32_t attr; |
5174 | |
|
5175 | 0 | if (parent_tree) { |
5176 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_both_directory_info, tvb, offset, -1, ENC_NA); |
5177 | 0 | tree = proto_item_add_subtree(item, ett_smb2_both_directory_info); |
5178 | 0 | } |
5179 | | |
5180 | | /* next offset */ |
5181 | 0 | next_offset = tvb_get_letohl(tvb, offset); |
5182 | 0 | proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5183 | 0 | offset += 4; |
5184 | | |
5185 | | /* file index */ |
5186 | 0 | proto_tree_add_item(tree, hf_smb2_file_index, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5187 | 0 | offset += 4; |
5188 | | |
5189 | | /* create time */ |
5190 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_create_timestamp, ENC_LITTLE_ENDIAN); |
5191 | 0 | offset += 8; |
5192 | | |
5193 | | /* last access */ |
5194 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_access_timestamp, ENC_LITTLE_ENDIAN); |
5195 | 0 | offset += 8; |
5196 | | |
5197 | | /* last write */ |
5198 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_write_timestamp, ENC_LITTLE_ENDIAN); |
5199 | 0 | offset += 8; |
5200 | | |
5201 | | /* last change */ |
5202 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_change_timestamp, ENC_LITTLE_ENDIAN); |
5203 | 0 | offset += 8; |
5204 | | |
5205 | | /* end of file */ |
5206 | 0 | proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5207 | 0 | offset += 8; |
5208 | | |
5209 | | /* allocation size */ |
5210 | 0 | proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5211 | 0 | offset += 8; |
5212 | | |
5213 | | /* File Attributes */ |
5214 | 0 | offset = dissect_fscc_file_attr(tvb, tree, offset, &attr); |
5215 | | |
5216 | | /* file name length */ |
5217 | 0 | file_name_len = tvb_get_letohl(tvb, offset); |
5218 | 0 | proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5219 | 0 | offset += 4; |
5220 | | |
5221 | | /* ea size or reparse tag */ |
5222 | 0 | if (attr & SMB2_FSCC_FILE_ATTRIBUTE_REPARSE_POINT) |
5223 | 0 | proto_tree_add_item(tree, hf_smb2_reparse_tag, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5224 | 0 | else |
5225 | 0 | proto_tree_add_item(tree, hf_smb2_ea_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5226 | 0 | offset += 4; |
5227 | | |
5228 | | /* short name length */ |
5229 | 0 | short_name_len = tvb_get_uint8(tvb, offset); |
5230 | 0 | proto_tree_add_item(tree, hf_smb2_short_name_len, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
5231 | 0 | offset += 1; |
5232 | | |
5233 | | /* reserved */ |
5234 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 1, ENC_NA); |
5235 | 0 | offset += 1; |
5236 | | |
5237 | | /* short name */ |
5238 | 0 | if (short_name_len) { |
5239 | 0 | proto_tree_add_item(tree, hf_smb2_short_name, |
5240 | 0 | tvb, offset, short_name_len, ENC_UTF_16|ENC_LITTLE_ENDIAN); |
5241 | 0 | } |
5242 | 0 | offset += 24; |
5243 | | |
5244 | | /* file name */ |
5245 | 0 | if (file_name_len) { |
5246 | 0 | char *display_string; |
5247 | |
|
5248 | 0 | proto_tree_add_item_ret_display_string(tree, hf_smb2_filename, |
5249 | 0 | tvb, offset, file_name_len, ENC_UTF_16|ENC_LITTLE_ENDIAN, |
5250 | 0 | pinfo->pool, &display_string); |
5251 | 0 | proto_item_append_text(item, ": %s", display_string); |
5252 | 0 | offset += file_name_len; |
5253 | 0 | } |
5254 | |
|
5255 | 0 | proto_item_set_len(item, offset-old_offset); |
5256 | |
|
5257 | 0 | if (si->saved) |
5258 | 0 | si->saved->num_matched++; |
5259 | |
|
5260 | 0 | if (next_offset == 0) { |
5261 | 0 | return; |
5262 | 0 | } |
5263 | | |
5264 | 0 | offset = old_offset+next_offset; |
5265 | 0 | if (offset < old_offset) { |
5266 | 0 | proto_tree_add_expert_format(tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, |
5267 | 0 | "Invalid offset/length. Malformed packet"); |
5268 | 0 | return; |
5269 | 0 | } |
5270 | 0 | } |
5271 | 0 | } |
5272 | | |
5273 | | static void dissect_smb2_file_name_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, smb2_info_t *si _U_) |
5274 | 0 | { |
5275 | 0 | int offset = 0; |
5276 | 0 | proto_item *item = NULL; |
5277 | 0 | proto_tree *tree = NULL; |
5278 | |
|
5279 | 0 | while (tvb_reported_length_remaining(tvb, offset) > 4) { |
5280 | 0 | int old_offset = offset; |
5281 | 0 | int next_offset; |
5282 | 0 | int file_name_len; |
5283 | |
|
5284 | 0 | if (parent_tree) { |
5285 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_both_directory_info, tvb, offset, -1, ENC_NA); |
5286 | 0 | tree = proto_item_add_subtree(item, ett_smb2_both_directory_info); |
5287 | 0 | } |
5288 | | |
5289 | | /* next offset */ |
5290 | 0 | next_offset = tvb_get_letohl(tvb, offset); |
5291 | 0 | proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5292 | 0 | offset += 4; |
5293 | | |
5294 | | /* file index */ |
5295 | 0 | proto_tree_add_item(tree, hf_smb2_file_index, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5296 | 0 | offset += 4; |
5297 | | |
5298 | | /* file name length */ |
5299 | 0 | file_name_len = tvb_get_letohl(tvb, offset); |
5300 | 0 | proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5301 | 0 | offset += 4; |
5302 | | |
5303 | | /* file name */ |
5304 | 0 | if (file_name_len) { |
5305 | 0 | char *display_string; |
5306 | |
|
5307 | 0 | proto_tree_add_item_ret_display_string(tree, hf_smb2_filename, |
5308 | 0 | tvb, offset, file_name_len, ENC_UTF_16|ENC_LITTLE_ENDIAN, |
5309 | 0 | pinfo->pool, &display_string); |
5310 | 0 | proto_item_append_text(item, ": %s", display_string); |
5311 | 0 | offset += file_name_len; |
5312 | 0 | } |
5313 | |
|
5314 | 0 | if (si->saved) |
5315 | 0 | si->saved->num_matched++; |
5316 | |
|
5317 | 0 | proto_item_set_len(item, offset-old_offset); |
5318 | |
|
5319 | 0 | if (next_offset == 0) { |
5320 | 0 | return; |
5321 | 0 | } |
5322 | | |
5323 | 0 | offset = old_offset+next_offset; |
5324 | 0 | if (offset < old_offset) { |
5325 | 0 | proto_tree_add_expert_format(tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, |
5326 | 0 | "Invalid offset/length. Malformed packet"); |
5327 | 0 | return; |
5328 | 0 | } |
5329 | 0 | } |
5330 | 0 | } |
5331 | | |
5332 | | static void dissect_smb2_id_both_directory_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, smb2_info_t *si _U_) |
5333 | 0 | { |
5334 | 0 | int offset = 0; |
5335 | 0 | proto_item *item = NULL; |
5336 | 0 | proto_tree *tree = NULL; |
5337 | |
|
5338 | 0 | while (tvb_reported_length_remaining(tvb, offset) > 4) { |
5339 | 0 | int old_offset = offset; |
5340 | 0 | int next_offset; |
5341 | 0 | int file_name_len; |
5342 | 0 | int short_name_len; |
5343 | 0 | uint32_t attr; |
5344 | |
|
5345 | 0 | if (parent_tree) { |
5346 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_id_both_directory_info, tvb, offset, -1, ENC_NA); |
5347 | 0 | tree = proto_item_add_subtree(item, ett_smb2_id_both_directory_info); |
5348 | 0 | } |
5349 | | |
5350 | | /* next offset */ |
5351 | 0 | next_offset = tvb_get_letohl(tvb, offset); |
5352 | 0 | proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5353 | 0 | offset += 4; |
5354 | | |
5355 | | /* file index */ |
5356 | 0 | proto_tree_add_item(tree, hf_smb2_file_index, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5357 | 0 | offset += 4; |
5358 | | |
5359 | | /* create time */ |
5360 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_create_timestamp, ENC_LITTLE_ENDIAN); |
5361 | 0 | offset += 8; |
5362 | | |
5363 | | /* last access */ |
5364 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_access_timestamp, ENC_LITTLE_ENDIAN); |
5365 | 0 | offset += 8; |
5366 | | |
5367 | | /* last write */ |
5368 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_write_timestamp, ENC_LITTLE_ENDIAN); |
5369 | 0 | offset += 8; |
5370 | | |
5371 | | /* last change */ |
5372 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_change_timestamp, ENC_LITTLE_ENDIAN); |
5373 | 0 | offset += 8; |
5374 | | |
5375 | | /* end of file */ |
5376 | 0 | proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5377 | 0 | offset += 8; |
5378 | | |
5379 | | /* allocation size */ |
5380 | 0 | proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5381 | 0 | offset += 8; |
5382 | | |
5383 | | /* File Attributes */ |
5384 | 0 | offset = dissect_fscc_file_attr(tvb, tree, offset, &attr); |
5385 | | |
5386 | | /* file name length */ |
5387 | 0 | file_name_len = tvb_get_letohl(tvb, offset); |
5388 | 0 | proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5389 | 0 | offset += 4; |
5390 | | |
5391 | | /* ea size or reparse tag */ |
5392 | 0 | if (attr & SMB2_FSCC_FILE_ATTRIBUTE_REPARSE_POINT) |
5393 | 0 | proto_tree_add_item(tree, hf_smb2_reparse_tag, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5394 | 0 | else |
5395 | 0 | proto_tree_add_item(tree, hf_smb2_ea_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5396 | 0 | offset += 4; |
5397 | | |
5398 | | /* short name length */ |
5399 | 0 | short_name_len = tvb_get_uint8(tvb, offset); |
5400 | 0 | proto_tree_add_item(tree, hf_smb2_short_name_len, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
5401 | 0 | offset += 1; |
5402 | | |
5403 | | /* reserved */ |
5404 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 1, ENC_NA); |
5405 | 0 | offset += 1; |
5406 | | |
5407 | | /* short name */ |
5408 | 0 | if (short_name_len) { |
5409 | 0 | proto_tree_add_item(tree, hf_smb2_short_name, |
5410 | 0 | tvb, offset, short_name_len, ENC_UTF_16|ENC_LITTLE_ENDIAN); |
5411 | 0 | } |
5412 | 0 | offset += 24; |
5413 | | |
5414 | | /* reserved */ |
5415 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
5416 | 0 | offset += 2; |
5417 | | |
5418 | | /* file id */ |
5419 | 0 | proto_tree_add_item(tree, hf_smb2_file_id, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5420 | 0 | offset += 8; |
5421 | | |
5422 | | /* file name */ |
5423 | 0 | if (file_name_len) { |
5424 | 0 | char *display_string; |
5425 | |
|
5426 | 0 | proto_tree_add_item_ret_display_string(tree, hf_smb2_filename, |
5427 | 0 | tvb, offset, file_name_len, ENC_UTF_16|ENC_LITTLE_ENDIAN, |
5428 | 0 | pinfo->pool, &display_string); |
5429 | 0 | proto_item_append_text(item, ": %s", display_string); |
5430 | 0 | offset += file_name_len; |
5431 | 0 | } |
5432 | |
|
5433 | 0 | proto_item_set_len(item, offset-old_offset); |
5434 | |
|
5435 | 0 | if (si->saved) |
5436 | 0 | si->saved->num_matched++; |
5437 | |
|
5438 | 0 | if (next_offset == 0) { |
5439 | 0 | return; |
5440 | 0 | } |
5441 | | |
5442 | 0 | offset = old_offset+next_offset; |
5443 | 0 | if (offset < old_offset) { |
5444 | 0 | proto_tree_add_expert_format(tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, |
5445 | 0 | "Invalid offset/length. Malformed packet"); |
5446 | 0 | return; |
5447 | 0 | } |
5448 | 0 | } |
5449 | 0 | } |
5450 | | |
5451 | | |
5452 | | static void dissect_smb2_id_full_directory_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, smb2_info_t *si _U_) |
5453 | 0 | { |
5454 | 0 | int offset = 0; |
5455 | 0 | proto_item *item = NULL; |
5456 | 0 | proto_tree *tree = NULL; |
5457 | |
|
5458 | 0 | while (tvb_reported_length_remaining(tvb, offset) > 4) { |
5459 | 0 | int old_offset = offset; |
5460 | 0 | int next_offset; |
5461 | 0 | int file_name_len; |
5462 | 0 | uint32_t attr; |
5463 | |
|
5464 | 0 | if (parent_tree) { |
5465 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_id_both_directory_info, tvb, offset, -1, ENC_NA); |
5466 | 0 | tree = proto_item_add_subtree(item, ett_smb2_id_both_directory_info); |
5467 | 0 | } |
5468 | | |
5469 | | /* next offset */ |
5470 | 0 | next_offset = tvb_get_letohl(tvb, offset); |
5471 | 0 | proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5472 | 0 | offset += 4; |
5473 | | |
5474 | | /* file index */ |
5475 | 0 | proto_tree_add_item(tree, hf_smb2_file_index, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5476 | 0 | offset += 4; |
5477 | | |
5478 | | /* create time */ |
5479 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_create_timestamp, ENC_LITTLE_ENDIAN); |
5480 | 0 | offset += 8; |
5481 | | |
5482 | | /* last access */ |
5483 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_access_timestamp, ENC_LITTLE_ENDIAN); |
5484 | 0 | offset += 8; |
5485 | | |
5486 | | /* last write */ |
5487 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_write_timestamp, ENC_LITTLE_ENDIAN); |
5488 | 0 | offset += 8; |
5489 | | |
5490 | | /* last change */ |
5491 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_change_timestamp, ENC_LITTLE_ENDIAN); |
5492 | 0 | offset += 8; |
5493 | | |
5494 | | /* end of file */ |
5495 | 0 | proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5496 | 0 | offset += 8; |
5497 | | |
5498 | | /* allocation size */ |
5499 | 0 | proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5500 | 0 | offset += 8; |
5501 | | |
5502 | | /* File Attributes */ |
5503 | 0 | offset = dissect_fscc_file_attr(tvb, tree, offset, &attr); |
5504 | | |
5505 | | /* file name length */ |
5506 | 0 | file_name_len = tvb_get_letohl(tvb, offset); |
5507 | 0 | proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5508 | 0 | offset += 4; |
5509 | | |
5510 | | /* ea size or reparse tag */ |
5511 | 0 | if (attr & SMB2_FSCC_FILE_ATTRIBUTE_REPARSE_POINT) |
5512 | 0 | proto_tree_add_item(tree, hf_smb2_reparse_tag, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5513 | 0 | else |
5514 | 0 | proto_tree_add_item(tree, hf_smb2_ea_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5515 | 0 | offset += 4; |
5516 | | |
5517 | | /* reserved */ |
5518 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
5519 | 0 | offset += 4; |
5520 | | |
5521 | | /* file id */ |
5522 | 0 | proto_tree_add_item(tree, hf_smb2_file_id, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5523 | 0 | offset += 8; |
5524 | | |
5525 | | /* file name */ |
5526 | 0 | if (file_name_len) { |
5527 | 0 | char *display_string; |
5528 | |
|
5529 | 0 | proto_tree_add_item_ret_display_string(tree, hf_smb2_filename, |
5530 | 0 | tvb, offset, file_name_len, ENC_UTF_16|ENC_LITTLE_ENDIAN, |
5531 | 0 | pinfo->pool, &display_string); |
5532 | 0 | proto_item_append_text(item, ": %s", display_string); |
5533 | 0 | offset += file_name_len; |
5534 | 0 | } |
5535 | |
|
5536 | 0 | proto_item_set_len(item, offset-old_offset); |
5537 | |
|
5538 | 0 | if (si->saved) |
5539 | 0 | si->saved->num_matched++; |
5540 | |
|
5541 | 0 | if (next_offset == 0) { |
5542 | 0 | return; |
5543 | 0 | } |
5544 | | |
5545 | 0 | offset = old_offset+next_offset; |
5546 | 0 | if (offset < old_offset) { |
5547 | 0 | proto_tree_add_expert_format(tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, |
5548 | 0 | "Invalid offset/length. Malformed packet"); |
5549 | 0 | return; |
5550 | 0 | } |
5551 | 0 | } |
5552 | 0 | } |
5553 | | |
5554 | | static int dissect_smb2_posix_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_) |
5555 | 0 | { |
5556 | | /* create time */ |
5557 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_create_timestamp, ENC_LITTLE_ENDIAN); |
5558 | 0 | offset += 8; |
5559 | | |
5560 | | /* last access */ |
5561 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_access_timestamp, ENC_LITTLE_ENDIAN); |
5562 | 0 | offset += 8; |
5563 | | |
5564 | | /* last write */ |
5565 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_write_timestamp, ENC_LITTLE_ENDIAN); |
5566 | 0 | offset += 8; |
5567 | | |
5568 | | /* last change */ |
5569 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_change_timestamp, ENC_LITTLE_ENDIAN); |
5570 | 0 | offset += 8; |
5571 | | |
5572 | | /* end of file */ |
5573 | 0 | proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5574 | 0 | offset += 8; |
5575 | | |
5576 | | /* allocation size */ |
5577 | 0 | proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5578 | 0 | offset += 8; |
5579 | | |
5580 | | /* File Attributes */ |
5581 | 0 | offset = dissect_fscc_file_attr(tvb, tree, offset, NULL); |
5582 | | |
5583 | | /* file index */ |
5584 | 0 | proto_tree_add_item(tree, hf_smb2_inode, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
5585 | 0 | offset += 8; |
5586 | | |
5587 | | /* dev id */ |
5588 | 0 | proto_tree_add_item(tree, hf_smb2_dev, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5589 | 0 | offset += 4; |
5590 | | |
5591 | | /* zero */ |
5592 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
5593 | 0 | offset += 4; |
5594 | | |
5595 | | /* Hardlinks */ |
5596 | 0 | proto_tree_add_item(tree, hf_smb2_nlinks, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5597 | 0 | offset += 4; |
5598 | | |
5599 | | /* Reparse tag */ |
5600 | 0 | proto_tree_add_item(tree, hf_smb2_reparse_tag, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5601 | 0 | offset += 4; |
5602 | | |
5603 | | /* POSIX mode bits */ |
5604 | 0 | proto_tree_add_item(tree, hf_smb2_posix_perms, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5605 | 0 | offset += 4; |
5606 | | |
5607 | | /* Owner and Group SID */ |
5608 | 0 | offset = dissect_nt_sid(tvb, pinfo, offset, tree, "Owner SID", NULL, -1); |
5609 | 0 | offset = dissect_nt_sid(tvb, pinfo, offset, tree, "Group SID", NULL, -1); |
5610 | |
|
5611 | 0 | if (si->saved) |
5612 | 0 | si->saved->num_matched++; |
5613 | |
|
5614 | 0 | return offset; |
5615 | 0 | } |
5616 | | |
5617 | | static void dissect_smb2_posix_directory_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, smb2_info_t *si _U_) |
5618 | 0 | { |
5619 | 0 | int offset = 0; |
5620 | 0 | proto_item *item = NULL; |
5621 | 0 | proto_tree *tree = NULL; |
5622 | |
|
5623 | 0 | while (tvb_reported_length_remaining(tvb, offset) > 4) { |
5624 | 0 | int old_offset = offset; |
5625 | 0 | int next_offset; |
5626 | 0 | int file_name_len; |
5627 | |
|
5628 | 0 | if (parent_tree) { |
5629 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_posix_info, tvb, offset, -1, ENC_NA); |
5630 | 0 | tree = proto_item_add_subtree(item, ett_smb2_posix_info); |
5631 | 0 | } |
5632 | | |
5633 | | /* next offset */ |
5634 | 0 | next_offset = tvb_get_letohl(tvb, offset); |
5635 | 0 | proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5636 | 0 | offset += 4; |
5637 | 0 | offset += 4; |
5638 | |
|
5639 | 0 | offset = dissect_smb2_posix_info(tvb, pinfo, tree, offset, si); |
5640 | | |
5641 | | /* file name length */ |
5642 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_filename_len, tvb, offset, 4, ENC_LITTLE_ENDIAN, &file_name_len); |
5643 | 0 | offset += 4; |
5644 | | |
5645 | | /* file name */ |
5646 | 0 | if (file_name_len) { |
5647 | 0 | proto_tree_add_item(tree, hf_smb2_filename, tvb, offset, file_name_len, ENC_UTF_16|ENC_LITTLE_ENDIAN); |
5648 | 0 | offset += file_name_len; |
5649 | 0 | } |
5650 | |
|
5651 | 0 | proto_item_set_len(item, offset-old_offset); |
5652 | |
|
5653 | 0 | if (next_offset == 0) { |
5654 | 0 | return; |
5655 | 0 | } |
5656 | | |
5657 | 0 | offset = old_offset+next_offset; |
5658 | 0 | if (offset < old_offset) { |
5659 | 0 | proto_tree_add_expert_format(tree, pinfo, &ei_smb2_invalid_length, tvb, offset, -1, |
5660 | 0 | "Invalid offset/length. Malformed packet"); |
5661 | 0 | return; |
5662 | 0 | } |
5663 | 0 | } |
5664 | 0 | } |
5665 | | |
5666 | | |
5667 | | typedef struct _smb2_find_dissector_t { |
5668 | | uint32_t level; |
5669 | | void (*dissector)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si); |
5670 | | } smb2_find_dissector_t; |
5671 | | |
5672 | | static smb2_find_dissector_t smb2_find_dissectors[] = { |
5673 | | {SMB2_FIND_DIRECTORY_INFO, dissect_smb2_file_directory_info}, |
5674 | | {SMB2_FIND_FULL_DIRECTORY_INFO, dissect_smb2_full_directory_info}, |
5675 | | {SMB2_FIND_BOTH_DIRECTORY_INFO, dissect_smb2_both_directory_info}, |
5676 | | {SMB2_FIND_NAME_INFO, dissect_smb2_file_name_info}, |
5677 | | {SMB2_FIND_ID_BOTH_DIRECTORY_INFO,dissect_smb2_id_both_directory_info}, |
5678 | | {SMB2_FIND_ID_FULL_DIRECTORY_INFO,dissect_smb2_id_full_directory_info}, |
5679 | | {SMB2_FIND_POSIX_INFO, dissect_smb2_posix_directory_info}, |
5680 | | {0, NULL} |
5681 | | }; |
5682 | | |
5683 | | static void |
5684 | | dissect_smb2_find_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si) |
5685 | 0 | { |
5686 | 0 | smb2_find_dissector_t *dis = smb2_find_dissectors; |
5687 | |
|
5688 | 0 | if (si->saved) |
5689 | 0 | si->saved->num_matched = 0; |
5690 | |
|
5691 | 0 | while (dis->dissector) { |
5692 | 0 | if (si->saved) { |
5693 | 0 | if (dis->level == si->saved->infolevel) { |
5694 | 0 | dis->dissector(tvb, pinfo, tree, si); |
5695 | 0 | return; |
5696 | 0 | } |
5697 | 0 | } |
5698 | 0 | dis++; |
5699 | 0 | } |
5700 | | |
5701 | | |
5702 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_captured_length(tvb), ENC_NA); |
5703 | 0 | } |
5704 | | |
5705 | | static int |
5706 | | dissect_smb2_find_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_) |
5707 | 0 | { |
5708 | 0 | offset_length_buffer_t olb; |
5709 | 0 | proto_item *item = NULL; |
5710 | 0 | bool continue_dissection; |
5711 | 0 | proto_tree *fid_tree = NULL; |
5712 | 0 | proto_item *tag_item = NULL; |
5713 | 0 | proto_tree *which_tree = NULL; |
5714 | |
|
5715 | 0 | if (si->saved) { |
5716 | | /* infolevel */ |
5717 | 0 | item = proto_tree_add_uint(tree, hf_smb2_find_info_level, tvb, offset, 0, si->saved->infolevel); |
5718 | 0 | proto_item_set_generated(item); |
5719 | 0 | } |
5720 | |
|
5721 | 0 | if (pinfo->fd->visited) { |
5722 | 0 | if (si->file && si->file->name) { |
5723 | 0 | if (strcmp(si->file->name, "") == 0) |
5724 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
5725 | 0 | tag_item = proto_tree_add_string(tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
5726 | 0 | fid_tree = proto_item_add_subtree(tag_item, ett_smb2_fid_str); |
5727 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
5728 | 0 | which_tree = fid_tree; |
5729 | 0 | } |
5730 | 0 | else { |
5731 | 0 | which_tree = tree; |
5732 | 0 | } |
5733 | 0 | if (si->saved) { |
5734 | 0 | item = proto_tree_add_guid(which_tree, hf_smb2_fid, tvb, 0, 0, (e_guid_t *)&si->saved->uuid_fid); proto_item_set_generated(item); |
5735 | 0 | } |
5736 | 0 | if (si->saved && si->saved->fid_hash) { |
5737 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
5738 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
5739 | 0 | proto_item_set_generated(item); |
5740 | 0 | } |
5741 | |
|
5742 | 0 | if (si->file && si->file->frame_beg > 0 && si->file->frame_beg < UINT32_MAX) { |
5743 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
5744 | 0 | si->file->frame_beg); |
5745 | 0 | proto_item_set_generated(item); |
5746 | 0 | } else { |
5747 | 0 | if (si->saved && si->saved->frame_beg > 0 && si->saved->frame_beg < UINT32_MAX) { |
5748 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
5749 | 0 | si->saved->frame_beg); |
5750 | 0 | proto_item_set_generated(item); |
5751 | 0 | } |
5752 | 0 | } |
5753 | 0 | if (si->file && si->file->frame_end > 0 && si->file->frame_end < UINT32_MAX) { |
5754 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
5755 | 0 | si->file->frame_end); |
5756 | 0 | proto_item_set_generated(item); |
5757 | 0 | } else { |
5758 | 0 | if (si->saved |
5759 | 0 | && si->saved->frame_end > 0 |
5760 | 0 | && si->saved->frame_end < UINT32_MAX |
5761 | | /* Required if the create response is missing from the capture. */ |
5762 | 0 | && si->saved->frame_end != pinfo->fd->num) { |
5763 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
5764 | 0 | si->saved->frame_end); |
5765 | 0 | proto_item_set_generated(item); |
5766 | 0 | } |
5767 | 0 | } |
5768 | 0 | } |
5769 | |
|
5770 | 0 | if (si->saved && si->saved->extra_info_type == SMB2_EI_FINDPATTERN) { |
5771 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", %s, Pattern: %s", |
5772 | 0 | val_to_str(si->saved->infolevel, smb2_find_info_levels, "(Level:0x%02x)"), |
5773 | 0 | (const char *)si->saved->extra_info); |
5774 | 0 | } |
5775 | |
|
5776 | 0 | switch (si->status) { |
5777 | | /* buffer code */ |
5778 | 0 | case 0x00000000: offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); break; |
5779 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
5780 | 0 | if (!continue_dissection) return offset; |
5781 | 0 | } |
5782 | | |
5783 | | /* findinfo offset */ |
5784 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &olb, OLB_O_UINT16_S_UINT32, hf_smb2_find_info_blob); |
5785 | | |
5786 | | /* the buffer */ |
5787 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &olb, si, dissect_smb2_find_data); |
5788 | |
|
5789 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &olb); |
5790 | |
|
5791 | 0 | if (si->saved) { |
5792 | 0 | item = proto_tree_add_uint_format(tree, hf_smb2_num_matched, tvb, 0, 0, |
5793 | 0 | si->saved->num_matched, "Matched: %u names", si->saved->num_matched); |
5794 | 0 | proto_item_set_generated(item); |
5795 | |
|
5796 | 0 | col_append_fstr( |
5797 | 0 | pinfo->cinfo, COL_INFO, ", %u matches", si->saved->num_matched); |
5798 | 0 | } |
5799 | |
|
5800 | 0 | return offset; |
5801 | 0 | } |
5802 | | |
5803 | | static int |
5804 | | dissect_smb2_negotiate_context(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
5805 | 0 | { |
5806 | 0 | uint16_t type; |
5807 | 0 | const char *type_str; |
5808 | 0 | uint32_t i, data_length, salt_length, hash_count, cipher_count, comp_count, transform_count; |
5809 | 0 | uint32_t signing_count; |
5810 | 0 | proto_item *sub_item; |
5811 | 0 | proto_tree *sub_tree; |
5812 | 0 | static int * const comp_alg_flags_fields[] = { |
5813 | 0 | &hf_smb2_comp_alg_flags_chained, |
5814 | 0 | &hf_smb2_comp_alg_flags_reserved, |
5815 | 0 | NULL |
5816 | 0 | }; |
5817 | |
|
5818 | 0 | sub_tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_smb2_negotiate_context_element, &sub_item, "Negotiate Context"); |
5819 | | |
5820 | | /* type */ |
5821 | 0 | type = tvb_get_letohl(tvb, offset); |
5822 | 0 | type_str = val_to_str(type, smb2_negotiate_context_types, "Unknown Type: (0x%0x)"); |
5823 | 0 | proto_item_append_text(sub_item, ": %s ", type_str); |
5824 | 0 | proto_tree_add_item(sub_tree, hf_smb2_negotiate_context_type, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
5825 | 0 | offset += 2; |
5826 | | |
5827 | | /* data length */ |
5828 | 0 | proto_tree_add_item_ret_uint(sub_tree, hf_smb2_negotiate_context_data_length, tvb, offset, 2, ENC_LITTLE_ENDIAN, &data_length); |
5829 | 0 | proto_item_set_len(sub_item, data_length + 8); |
5830 | 0 | offset += 2; |
5831 | | |
5832 | | /* reserved */ |
5833 | 0 | proto_tree_add_item(sub_tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
5834 | 0 | offset += 4; |
5835 | |
|
5836 | 0 | switch (type) |
5837 | 0 | { |
5838 | 0 | case SMB2_PREAUTH_INTEGRITY_CAPABILITIES: |
5839 | 0 | proto_tree_add_item_ret_uint(sub_tree, hf_smb2_hash_alg_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &hash_count); |
5840 | 0 | offset += 2; |
5841 | 0 | proto_tree_add_item_ret_uint(sub_tree, hf_smb2_salt_length, tvb, offset, 2, ENC_LITTLE_ENDIAN, &salt_length); |
5842 | 0 | offset += 2; |
5843 | |
|
5844 | 0 | for (i = 0; i < hash_count; i++) |
5845 | 0 | { |
5846 | 0 | proto_tree_add_item(sub_tree, hf_smb2_hash_algorithm, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
5847 | 0 | offset += 2; |
5848 | 0 | } |
5849 | |
|
5850 | 0 | if (salt_length) |
5851 | 0 | { |
5852 | 0 | proto_tree_add_item(sub_tree, hf_smb2_salt, tvb, offset, salt_length, ENC_NA); |
5853 | 0 | offset += salt_length; |
5854 | 0 | } |
5855 | 0 | break; |
5856 | | |
5857 | 0 | case SMB2_ENCRYPTION_CAPABILITIES: |
5858 | 0 | proto_tree_add_item_ret_uint(sub_tree, hf_smb2_cipher_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &cipher_count); |
5859 | 0 | offset += 2; |
5860 | |
|
5861 | 0 | for (i = 0; i < cipher_count; i ++) |
5862 | 0 | { |
5863 | | /* in SMB3.1.1 the first cipher returned by the server session encryption algorithm */ |
5864 | 0 | if (i == 0 && si && si->conv && (si->flags & SMB2_FLAGS_RESPONSE)) { |
5865 | 0 | uint16_t first_cipher = tvb_get_letohs(tvb, offset); |
5866 | 0 | si->conv->enc_alg = first_cipher; |
5867 | 0 | } |
5868 | 0 | proto_tree_add_item(sub_tree, hf_smb2_cipher_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
5869 | 0 | offset += 2; |
5870 | 0 | } |
5871 | 0 | break; |
5872 | | |
5873 | 0 | case SMB2_COMPRESSION_CAPABILITIES: |
5874 | 0 | proto_tree_add_item_ret_uint(sub_tree, hf_smb2_comp_alg_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &comp_count); |
5875 | 0 | offset += 2; |
5876 | | |
5877 | | /* padding */ |
5878 | 0 | offset += 2; |
5879 | | |
5880 | | /* flags */ |
5881 | 0 | proto_tree_add_bitmask(sub_tree, tvb, offset, hf_smb2_comp_alg_flags, ett_smb2_comp_alg_flags, comp_alg_flags_fields, ENC_LITTLE_ENDIAN); |
5882 | 0 | offset += 4; |
5883 | |
|
5884 | 0 | for (i = 0; i < comp_count; i ++) { |
5885 | 0 | proto_tree_add_item(sub_tree, hf_smb2_comp_alg_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
5886 | 0 | offset += 2; |
5887 | 0 | } |
5888 | 0 | break; |
5889 | | |
5890 | 0 | case SMB2_NETNAME_NEGOTIATE_CONTEXT_ID: |
5891 | 0 | proto_tree_add_item(sub_tree, hf_smb2_netname_neg_id, tvb, offset, |
5892 | 0 | data_length, ENC_UTF_16|ENC_LITTLE_ENDIAN); |
5893 | 0 | offset += data_length; |
5894 | 0 | break; |
5895 | | |
5896 | 0 | case SMB2_TRANSPORT_CAPABILITIES: |
5897 | 0 | proto_tree_add_item(sub_tree, hf_smb2_transport_ctx_flags, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5898 | 0 | offset += 4; |
5899 | 0 | break; |
5900 | | |
5901 | 0 | case SMB2_RDMA_TRANSFORM_CAPABILITIES: |
5902 | 0 | proto_tree_add_item_ret_uint(sub_tree, hf_smb2_rdma_transform_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &transform_count); |
5903 | 0 | offset += 2; |
5904 | |
|
5905 | 0 | proto_tree_add_item(sub_tree, hf_smb2_rdma_transform_reserved1, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
5906 | 0 | offset += 2; |
5907 | 0 | proto_tree_add_item(sub_tree, hf_smb2_rdma_transform_reserved2, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
5908 | 0 | offset += 4; |
5909 | |
|
5910 | 0 | for (i = 0; i < transform_count; i++) { |
5911 | 0 | proto_tree_add_item(sub_tree, hf_smb2_rdma_transform_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
5912 | 0 | offset += 2; |
5913 | 0 | } |
5914 | 0 | break; |
5915 | | |
5916 | 0 | case SMB2_SIGNING_CAPABILITIES: |
5917 | 0 | proto_tree_add_item_ret_uint(sub_tree, hf_smb2_signing_alg_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &signing_count); |
5918 | 0 | offset += 2; |
5919 | |
|
5920 | 0 | for (i = 0; i < signing_count; i++) { |
5921 | | /* in SMB3.1.1 the first cipher returned by the server session encryption algorithm */ |
5922 | 0 | if (i == 0 && si && si->conv && (si->flags & SMB2_FLAGS_RESPONSE)) { |
5923 | 0 | uint16_t first_sign_alg = tvb_get_letohs(tvb, offset); |
5924 | 0 | si->conv->sign_alg = first_sign_alg; |
5925 | 0 | } |
5926 | 0 | proto_tree_add_item(sub_tree, hf_smb2_signing_alg_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
5927 | 0 | offset += 2; |
5928 | 0 | } |
5929 | 0 | break; |
5930 | | |
5931 | 0 | case SMB2_POSIX_EXTENSIONS_CAPABILITIES: |
5932 | 0 | proto_tree_add_item(sub_tree, hf_smb2_posix_reserved, tvb, offset, data_length, ENC_NA); |
5933 | 0 | offset += data_length; |
5934 | 0 | break; |
5935 | | |
5936 | 0 | default: |
5937 | 0 | proto_tree_add_item(sub_tree, hf_smb2_unknown, tvb, offset, data_length, ENC_NA); |
5938 | 0 | offset += data_length; |
5939 | 0 | break; |
5940 | 0 | } |
5941 | | |
5942 | 0 | return offset; |
5943 | 0 | } |
5944 | | |
5945 | | static int |
5946 | | dissect_smb2_negotiate_protocol_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
5947 | 0 | { |
5948 | 0 | uint16_t dc; |
5949 | 0 | proto_item *nco_item, *ncc_item; |
5950 | 0 | bool supports_smb_3_10 = false; |
5951 | 0 | uint32_t nco; |
5952 | 0 | uint32_t ncc; |
5953 | 0 | proto_item *hash_item = NULL; |
5954 | 0 | smb2_saved_info_t *ssi = si->saved; |
5955 | | |
5956 | | /* compute preauth hash on first pass */ |
5957 | 0 | if (!pinfo->fd->visited && ssi) { |
5958 | 0 | ssi->preauth_hash_req = (uint8_t*)wmem_alloc0(wmem_file_scope(), SMB2_PREAUTH_HASH_SIZE); |
5959 | 0 | memset(si->conv->preauth_hash_ses, 0, SMB2_PREAUTH_HASH_SIZE); |
5960 | 0 | memset(si->conv->preauth_hash_con, 0, SMB2_PREAUTH_HASH_SIZE); |
5961 | 0 | si->conv->preauth_hash_current = si->conv->preauth_hash_con; |
5962 | 0 | update_preauth_hash(si->conv->preauth_hash_current, pinfo, tvb); |
5963 | 0 | memcpy(ssi->preauth_hash_req, si->conv->preauth_hash_current, SMB2_PREAUTH_HASH_SIZE); |
5964 | 0 | } |
5965 | |
|
5966 | 0 | if (ssi && ssi->preauth_hash_req) { |
5967 | 0 | hash_item = proto_tree_add_bytes_with_length(tree, |
5968 | 0 | hf_smb2_preauth_hash, tvb, |
5969 | 0 | 0, tvb_captured_length(tvb), |
5970 | 0 | ssi->preauth_hash_req, SMB2_PREAUTH_HASH_SIZE); |
5971 | 0 | proto_item_set_generated(hash_item); |
5972 | 0 | } |
5973 | | |
5974 | | /* buffer code */ |
5975 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
5976 | | |
5977 | | /* dialect count */ |
5978 | 0 | dc = tvb_get_letohs(tvb, offset); |
5979 | 0 | proto_tree_add_item(tree, hf_smb2_dialect_count, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
5980 | 0 | offset += 2; |
5981 | | |
5982 | | /* security mode, skip second byte */ |
5983 | 0 | offset = dissect_smb2_secmode(tree, tvb, offset); |
5984 | 0 | offset++; |
5985 | | |
5986 | | |
5987 | | /* reserved */ |
5988 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
5989 | 0 | offset += 2; |
5990 | | |
5991 | | /* capabilities */ |
5992 | 0 | offset = dissect_smb2_capabilities(tree, tvb, offset); |
5993 | | |
5994 | | /* client guid */ |
5995 | 0 | proto_tree_add_item(tree, hf_smb2_client_guid, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
5996 | 0 | offset += 16; |
5997 | | |
5998 | | /* negotiate context offset */ |
5999 | 0 | nco_item = proto_tree_add_item_ret_uint(tree, hf_smb2_negotiate_context_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN, &nco); |
6000 | 0 | offset += 4; |
6001 | | |
6002 | | /* negotiate context count */ |
6003 | 0 | ncc_item = proto_tree_add_item_ret_uint(tree, hf_smb2_negotiate_context_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &ncc); |
6004 | 0 | offset += 2; |
6005 | | |
6006 | | /* reserved */ |
6007 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
6008 | 0 | offset += 2; |
6009 | |
|
6010 | 0 | for (unsigned i = 0 ; i < dc; i++) { |
6011 | 0 | uint16_t d = tvb_get_letohs(tvb, offset); |
6012 | 0 | proto_tree_add_item(tree, hf_smb2_dialect, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
6013 | 0 | offset += 2; |
6014 | |
|
6015 | 0 | if (d >= SMB2_DIALECT_310) { |
6016 | 0 | supports_smb_3_10 = true; |
6017 | 0 | } |
6018 | 0 | } |
6019 | |
|
6020 | 0 | if (!supports_smb_3_10) { |
6021 | | /* |
6022 | | * XXX - if 3.10 or later isn't supported, those fields |
6023 | | * should be dissected as an 8-byte ClientStartTime field... |
6024 | | * ...which should always be set to zero by the |
6025 | | * client and ignored by the server. Doing that would |
6026 | | * require that we look ahead and scan the dialect list |
6027 | | * but what if that's either cut off by a snapshot |
6028 | | * length or missing due to the packet being malformed |
6029 | | * or not reassembled or...? |
6030 | | * |
6031 | | * [MS-SMB2] says 3.11, but 3.10 is deprecated, and |
6032 | | * it appears to work the same way in this regard |
6033 | | * as 3.11. |
6034 | | */ |
6035 | 0 | if (ncc != 0) { |
6036 | 0 | expert_add_info(pinfo, ncc_item, &ei_smb2_bad_negprot_negotiate_context_count); |
6037 | 0 | ncc = 0; |
6038 | 0 | } |
6039 | 0 | if (nco != 0) { |
6040 | 0 | expert_add_info(pinfo, nco_item, &ei_smb2_bad_negprot_negotiate_context_offset); |
6041 | 0 | nco = 0; |
6042 | 0 | } |
6043 | 0 | } |
6044 | |
|
6045 | 0 | if (nco != 0) { |
6046 | 0 | uint32_t tmp = 0x40 + 36 + dc * 2; |
6047 | |
|
6048 | 0 | if (nco >= tmp) { |
6049 | 0 | offset += nco - tmp; |
6050 | 0 | } else { |
6051 | 0 | ncc = 0; |
6052 | 0 | } |
6053 | 0 | } |
6054 | |
|
6055 | 0 | for (unsigned i = 0; i < ncc; i++) { |
6056 | 0 | offset = WS_ROUNDUP_8(offset); |
6057 | 0 | offset = dissect_smb2_negotiate_context(tvb, pinfo, tree, offset, si); |
6058 | 0 | } |
6059 | |
|
6060 | 0 | return offset; |
6061 | 0 | } |
6062 | | |
6063 | | static int |
6064 | | dissect_smb2_negotiate_protocol_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
6065 | 0 | { |
6066 | 0 | offset_length_buffer_t s_olb; |
6067 | 0 | uint32_t nco; |
6068 | 0 | uint32_t ncc; |
6069 | 0 | bool continue_dissection; |
6070 | 0 | proto_item *hash_item = NULL; |
6071 | 0 | smb2_saved_info_t *ssi = si->saved; |
6072 | | |
6073 | | /* compute preauth hash on first pass */ |
6074 | 0 | if (!pinfo->fd->visited && ssi) { |
6075 | 0 | ssi->preauth_hash_res = (uint8_t*)wmem_alloc0(wmem_file_scope(), SMB2_PREAUTH_HASH_SIZE); |
6076 | 0 | update_preauth_hash(si->conv->preauth_hash_current, pinfo, tvb); |
6077 | 0 | memcpy(ssi->preauth_hash_res, si->conv->preauth_hash_current, SMB2_PREAUTH_HASH_SIZE); |
6078 | | |
6079 | | /* |
6080 | | * All new sessions on this conversation must reuse |
6081 | | * the preauth hash value at the time of the negprot |
6082 | | * response, so we stash it and switch buffers |
6083 | | */ |
6084 | 0 | memcpy(si->conv->preauth_hash_ses, si->conv->preauth_hash_current, SMB2_PREAUTH_HASH_SIZE); |
6085 | 0 | si->conv->preauth_hash_current = si->conv->preauth_hash_ses; |
6086 | 0 | } |
6087 | |
|
6088 | 0 | if (ssi && ssi->preauth_hash_res) { |
6089 | 0 | hash_item = proto_tree_add_bytes_with_length(tree, |
6090 | 0 | hf_smb2_preauth_hash, tvb, |
6091 | 0 | 0, tvb_captured_length(tvb), |
6092 | 0 | ssi->preauth_hash_res, SMB2_PREAUTH_HASH_SIZE); |
6093 | 0 | proto_item_set_generated(hash_item); |
6094 | 0 | } |
6095 | |
|
6096 | 0 | switch (si->status) { |
6097 | | /* buffer code */ |
6098 | 0 | case 0x00000000: |
6099 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
6100 | 0 | break; |
6101 | | |
6102 | 0 | default: |
6103 | 0 | offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
6104 | 0 | if (!continue_dissection) |
6105 | 0 | return offset; |
6106 | 0 | } |
6107 | | |
6108 | | /* security mode, skip second byte */ |
6109 | 0 | offset = dissect_smb2_secmode(tree, tvb, offset); |
6110 | 0 | offset++; |
6111 | | |
6112 | | /* dialect picked */ |
6113 | 0 | si->conv->dialect = tvb_get_letohs(tvb, offset); |
6114 | 0 | proto_tree_add_item(tree, hf_smb2_dialect, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
6115 | 0 | offset += 2; |
6116 | | |
6117 | | /* negotiate context count/reserved */ |
6118 | | /* |
6119 | | * If 3.10 or later isn't the chosen dialect, this field |
6120 | | * should be dissected as a reserved field |
6121 | | * ...which should always be set to zero by the |
6122 | | * client and ignored by the server. |
6123 | | * |
6124 | | * [MS-SMB2] says 3.11, but 3.10 is deprecated, and |
6125 | | * it appears to work the same way in this regard |
6126 | | * as 3.11. |
6127 | | */ |
6128 | 0 | if (si->conv->dialect >= SMB2_DIALECT_310) { |
6129 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_negotiate_context_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &ncc); |
6130 | 0 | } else { |
6131 | 0 | proto_item *reserved_item; |
6132 | |
|
6133 | 0 | reserved_item = proto_tree_add_item_ret_uint(tree, hf_smb2_negotiate_context_reserved, tvb, offset, 2, ENC_LITTLE_ENDIAN, &ncc); |
6134 | 0 | if (ncc != 0) { |
6135 | 0 | expert_add_info(pinfo, reserved_item, &ei_smb2_bad_negprot_reserved); |
6136 | 0 | ncc = 0; |
6137 | 0 | } |
6138 | 0 | } |
6139 | 0 | offset += 2; |
6140 | | |
6141 | | /* server GUID */ |
6142 | 0 | proto_tree_add_item(tree, hf_smb2_server_guid, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
6143 | 0 | offset += 16; |
6144 | | |
6145 | | /* capabilities */ |
6146 | 0 | offset = dissect_smb2_capabilities(tree, tvb, offset); |
6147 | | |
6148 | | /* max trans size */ |
6149 | 0 | proto_tree_add_item(tree, hf_smb2_max_trans_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
6150 | 0 | offset += 4; |
6151 | | |
6152 | | /* max read size */ |
6153 | 0 | proto_tree_add_item(tree, hf_smb2_max_read_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
6154 | 0 | offset += 4; |
6155 | | |
6156 | | /* max write size */ |
6157 | 0 | proto_tree_add_item(tree, hf_smb2_max_write_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
6158 | 0 | offset += 4; |
6159 | | |
6160 | | /* current time */ |
6161 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_current_time, ENC_LITTLE_ENDIAN); |
6162 | 0 | offset += 8; |
6163 | | |
6164 | | /* boot time */ |
6165 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_boot_time, ENC_LITTLE_ENDIAN); |
6166 | 0 | offset += 8; |
6167 | | |
6168 | | /* security blob offset/length */ |
6169 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &s_olb, OLB_O_UINT16_S_UINT16, hf_smb2_security_blob); |
6170 | | |
6171 | | /* the security blob itself */ |
6172 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &s_olb, si, dissect_smb2_secblob); |
6173 | | |
6174 | | /* negotiate context offset/reserved2 */ |
6175 | | /* |
6176 | | * If 3.10 or later isn't the chosen dialect, this field |
6177 | | * should be dissected as a reserved field |
6178 | | * ...which should always be set to zero by the |
6179 | | * client and ignored by the server. |
6180 | | * |
6181 | | * [MS-SMB2] says 3.11, but 3.10 is deprecated, and |
6182 | | * it appears to work the same way in this regard |
6183 | | * as 3.11. |
6184 | | */ |
6185 | 0 | if (si->conv->dialect >= SMB2_DIALECT_310) { |
6186 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_negotiate_context_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN, &nco); |
6187 | 0 | } else { |
6188 | 0 | proto_item *reserved2_item; |
6189 | |
|
6190 | 0 | reserved2_item = proto_tree_add_item_ret_uint(tree, hf_smb2_negotiate_context_reserved2, tvb, offset, 4, ENC_LITTLE_ENDIAN, &nco); |
6191 | 0 | if (nco != 0) { |
6192 | 0 | expert_add_info(pinfo, reserved2_item, &ei_smb2_bad_negprot_reserved2); |
6193 | 0 | nco = 0; |
6194 | 0 | } |
6195 | 0 | } |
6196 | 0 | offset += 4; |
6197 | |
|
6198 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &s_olb); |
6199 | |
|
6200 | 0 | if (si->conv->dialect == SMB2_DIALECT_300 || si->conv->dialect == SMB2_DIALECT_302) { |
6201 | | /* If we know we are decrypting SMB3.0, it must be CCM */ |
6202 | 0 | si->conv->enc_alg = SMB2_CIPHER_AES_128_CCM; |
6203 | 0 | } |
6204 | |
|
6205 | 0 | if (si->conv->dialect >= SMB2_DIALECT_300) { |
6206 | | /* If we know we are decrypting SMB3.0, it's CMAC by default */ |
6207 | 0 | si->conv->sign_alg = SMB2_SIGNING_ALG_AES_CMAC; |
6208 | 0 | } else { |
6209 | 0 | si->conv->sign_alg = SMB2_SIGNING_ALG_HMAC_SHA256; |
6210 | 0 | } |
6211 | |
|
6212 | 0 | if (si->conv->dialect < SMB2_DIALECT_310) { |
6213 | 0 | ncc = 0; |
6214 | 0 | } |
6215 | |
|
6216 | 0 | if (nco != 0) { |
6217 | 0 | uint32_t tmp = 0x40 + 64 + s_olb.len; |
6218 | |
|
6219 | 0 | if (nco >= tmp) { |
6220 | 0 | offset += nco - tmp; |
6221 | 0 | } else { |
6222 | 0 | ncc = 0; |
6223 | 0 | } |
6224 | 0 | } |
6225 | |
|
6226 | 0 | for (unsigned i = 0; i < ncc; i++) { |
6227 | 0 | offset = WS_ROUNDUP_8(offset); |
6228 | 0 | offset = dissect_smb2_negotiate_context(tvb, pinfo, tree, offset, si); |
6229 | 0 | } |
6230 | |
|
6231 | 0 | return offset; |
6232 | 0 | } |
6233 | | |
6234 | | static const true_false_string tfs_additional_owner = { |
6235 | | "Requesting OWNER security information", |
6236 | | "NOT requesting owner security information", |
6237 | | }; |
6238 | | |
6239 | | static const true_false_string tfs_additional_group = { |
6240 | | "Requesting GROUP security information", |
6241 | | "NOT requesting group security information", |
6242 | | }; |
6243 | | |
6244 | | static const true_false_string tfs_additional_dacl = { |
6245 | | "Requesting DACL security information", |
6246 | | "NOT requesting DACL security information", |
6247 | | }; |
6248 | | |
6249 | | static const true_false_string tfs_additional_sacl = { |
6250 | | "Requesting SACL security information", |
6251 | | "NOT requesting SACL security information", |
6252 | | }; |
6253 | | |
6254 | | static const true_false_string tfs_additional_label = { |
6255 | | "Requesting integrity label security information", |
6256 | | "NOT requesting integrity label security information", |
6257 | | }; |
6258 | | |
6259 | | static const true_false_string tfs_additional_attribute = { |
6260 | | "Requesting resource attribute security information", |
6261 | | "NOT requesting resource attribute security information", |
6262 | | }; |
6263 | | |
6264 | | static const true_false_string tfs_additional_scope = { |
6265 | | "Requesting central access policy security information", |
6266 | | "NOT requesting central access policy security information", |
6267 | | }; |
6268 | | |
6269 | | static const true_false_string tfs_additional_backup = { |
6270 | | "Requesting backup operation security information", |
6271 | | "NOT requesting backup operation security information", |
6272 | | }; |
6273 | | |
6274 | | static int |
6275 | | dissect_additional_information_sec_mask(tvbuff_t *tvb, proto_tree *parent_tree, int offset) |
6276 | 0 | { |
6277 | | /* Note that in SMB1 protocol some security flags were not defined yet - see dissect_security_information_mask() |
6278 | | So for SMB2 we have to use own dissector */ |
6279 | 0 | static int * const flags[] = { |
6280 | 0 | &hf_smb2_getsetinfo_additional_owner, |
6281 | 0 | &hf_smb2_getsetinfo_additional_group, |
6282 | 0 | &hf_smb2_getsetinfo_additional_dacl, |
6283 | 0 | &hf_smb2_getsetinfo_additional_sacl, |
6284 | 0 | &hf_smb2_getsetinfo_additional_label, |
6285 | 0 | &hf_smb2_getsetinfo_additional_attribute, |
6286 | 0 | &hf_smb2_getsetinfo_additional_scope, |
6287 | 0 | &hf_smb2_getsetinfo_additional_backup, |
6288 | 0 | NULL |
6289 | 0 | }; |
6290 | |
|
6291 | 0 | proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb2_getsetinfo_additionals, |
6292 | 0 | ett_smb2_additional_information_sec_mask, flags, ENC_LITTLE_ENDIAN); |
6293 | 0 | offset += 4; |
6294 | |
|
6295 | 0 | return offset; |
6296 | 0 | } |
6297 | | |
6298 | | static int |
6299 | | dissect_smb2_getinfo_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si) |
6300 | 0 | { |
6301 | 0 | static int* const flag_entries[] = { |
6302 | 0 | &hf_smb2_query_info_flag_restart_scan, |
6303 | 0 | &hf_smb2_query_info_flag_return_single_entry, |
6304 | 0 | &hf_smb2_query_info_flag_index_specified, |
6305 | 0 | NULL |
6306 | 0 | }; |
6307 | |
|
6308 | 0 | DISSECTOR_ASSERT(si->saved != NULL); |
6309 | | |
6310 | | /* Additional Info */ |
6311 | 0 | switch (si->saved->smb2_class) { |
6312 | 0 | case SMB2_CLASS_SEC_INFO: |
6313 | 0 | dissect_additional_information_sec_mask(tvb, tree, offset); |
6314 | 0 | break; |
6315 | 0 | default: |
6316 | 0 | proto_tree_add_item(tree, hf_smb2_getsetinfo_additional, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
6317 | 0 | } |
6318 | 0 | offset += 4; |
6319 | | |
6320 | | /* Flags */ |
6321 | 0 | if (si->saved->infolevel == SMB2_FILE_FULL_EA_INFO) { |
6322 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_query_info_flags, ett_smb2_query_info_flags, flag_entries, ENC_LITTLE_ENDIAN); |
6323 | 0 | } else { |
6324 | 0 | proto_tree_add_item(tree, hf_smb2_getinfo_flags, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
6325 | 0 | } |
6326 | 0 | offset += 4; |
6327 | |
|
6328 | 0 | return offset; |
6329 | 0 | } |
6330 | | |
6331 | | |
6332 | | static int |
6333 | | dissect_smb2_getinfo_buffer_quota(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_) |
6334 | 0 | { |
6335 | 0 | uint32_t sidlist_len = 0; |
6336 | 0 | uint32_t startsid_len = 0; |
6337 | 0 | uint32_t startsid_offset = 0; |
6338 | |
|
6339 | 0 | proto_item *item = NULL; |
6340 | 0 | proto_tree *tree = NULL; |
6341 | |
|
6342 | 0 | if (parent_tree) { |
6343 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_query_quota_info, tvb, offset, -1, ENC_NA); |
6344 | 0 | tree = proto_item_add_subtree(item, ett_smb2_query_quota_info); |
6345 | 0 | } |
6346 | |
|
6347 | 0 | proto_tree_add_item(tree, hf_smb2_qq_single, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
6348 | 0 | offset += 1; |
6349 | |
|
6350 | 0 | proto_tree_add_item(tree, hf_smb2_qq_restart, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
6351 | 0 | offset += 1; |
6352 | | |
6353 | | /* reserved */ |
6354 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
6355 | 0 | offset += 2; |
6356 | |
|
6357 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_qq_sidlist_len, tvb, offset, 4, ENC_LITTLE_ENDIAN, &sidlist_len); |
6358 | 0 | offset += 4; |
6359 | |
|
6360 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_qq_start_sid_len, tvb, offset, 4, ENC_LITTLE_ENDIAN, &startsid_len); |
6361 | 0 | offset += 4; |
6362 | |
|
6363 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_qq_start_sid_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN, &startsid_offset); |
6364 | 0 | offset += 4; |
6365 | |
|
6366 | 0 | if (sidlist_len != 0) { |
6367 | 0 | offset = dissect_nt_get_user_quota(tvb, pinfo, tree, offset, &sidlist_len); |
6368 | 0 | } else if (startsid_len != 0) { |
6369 | 0 | offset = dissect_nt_sid(tvb, pinfo, offset + startsid_offset, tree, "Start SID", NULL, -1); |
6370 | 0 | } |
6371 | |
|
6372 | 0 | return offset; |
6373 | 0 | } |
6374 | | |
6375 | | static int |
6376 | | dissect_smb2_class_infolevel(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree, smb2_info_t *si) |
6377 | 0 | { |
6378 | 0 | uint8_t cl, il; |
6379 | 0 | proto_item *item; |
6380 | 0 | int hfindex; |
6381 | 0 | value_string_ext *vsx; |
6382 | |
|
6383 | 0 | if (si->flags & SMB2_FLAGS_RESPONSE) { |
6384 | 0 | if (!si->saved) { |
6385 | 0 | return offset; |
6386 | 0 | } |
6387 | 0 | cl = si->saved->smb2_class; |
6388 | 0 | il = si->saved->infolevel; |
6389 | 0 | } else { |
6390 | 0 | cl = tvb_get_uint8(tvb, offset); |
6391 | 0 | il = tvb_get_uint8(tvb, offset+1); |
6392 | 0 | if (si->saved) { |
6393 | 0 | si->saved->smb2_class = cl; |
6394 | 0 | si->saved->infolevel = il; |
6395 | 0 | } |
6396 | 0 | } |
6397 | | |
6398 | | |
6399 | 0 | switch (cl) { |
6400 | 0 | case SMB2_CLASS_FILE_INFO: |
6401 | 0 | hfindex = hf_smb2_infolevel_file_info; |
6402 | 0 | vsx = &smb2_file_info_levels_ext; |
6403 | 0 | break; |
6404 | 0 | case SMB2_CLASS_FS_INFO: |
6405 | 0 | hfindex = hf_smb2_infolevel_fs_info; |
6406 | 0 | vsx = &smb2_fs_info_levels_ext; |
6407 | 0 | break; |
6408 | 0 | case SMB2_CLASS_SEC_INFO: |
6409 | 0 | hfindex = hf_smb2_infolevel_sec_info; |
6410 | 0 | vsx = &smb2_sec_info_levels_ext; |
6411 | 0 | break; |
6412 | 0 | case SMB2_CLASS_QUOTA_INFO: |
6413 | | /* infolevel is not being used for quota */ |
6414 | 0 | hfindex = hf_smb2_infolevel; |
6415 | 0 | vsx = NULL; |
6416 | 0 | break; |
6417 | 0 | default: |
6418 | 0 | hfindex = hf_smb2_infolevel; |
6419 | 0 | vsx = NULL; /* allowed arg to val_to_str_ext() */ |
6420 | 0 | } |
6421 | | |
6422 | | |
6423 | | /* class */ |
6424 | 0 | item = proto_tree_add_uint(tree, hf_smb2_class, tvb, offset, 1, cl); |
6425 | 0 | if (si->flags & SMB2_FLAGS_RESPONSE) { |
6426 | 0 | proto_item_set_generated(item); |
6427 | 0 | } |
6428 | | /* infolevel */ |
6429 | 0 | item = proto_tree_add_uint(tree, hfindex, tvb, offset+1, 1, il); |
6430 | 0 | if (si->flags & SMB2_FLAGS_RESPONSE) { |
6431 | 0 | proto_item_set_generated(item); |
6432 | 0 | } |
6433 | 0 | offset += 2; |
6434 | |
|
6435 | 0 | if (!(si->flags & SMB2_FLAGS_RESPONSE)) { |
6436 | | /* Only update COL_INFO for requests. It clutters the |
6437 | | * display a bit too much if we do it for replies |
6438 | | * as well. |
6439 | | */ |
6440 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s/%s", |
6441 | 0 | val_to_str(cl, smb2_class_vals, "(Class:0x%02x)"), |
6442 | 0 | val_to_str_ext(il, vsx, "(Level:0x%02x)")); |
6443 | 0 | } |
6444 | |
|
6445 | 0 | return offset; |
6446 | 0 | } |
6447 | | |
6448 | | static int |
6449 | | dissect_smb2_getinfo_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
6450 | 0 | { |
6451 | 0 | uint32_t getinfo_size = 0; |
6452 | 0 | uint32_t getinfo_offset = 0; |
6453 | 0 | proto_item *offset_item; |
6454 | 0 | proto_item *item = NULL; |
6455 | 0 | proto_tree *fid_tree = NULL; |
6456 | 0 | proto_tree *which_tree = NULL; |
6457 | 0 | e_guid_t tag_guid; |
6458 | | |
6459 | | |
6460 | | /* buffer code */ |
6461 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
6462 | | |
6463 | | /* class and info level */ |
6464 | 0 | offset = dissect_smb2_class_infolevel(pinfo, tvb, offset, tree, si); |
6465 | | |
6466 | | /* max response size */ |
6467 | 0 | proto_tree_add_item(tree, hf_smb2_max_response_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
6468 | 0 | offset += 4; |
6469 | | |
6470 | | /* offset */ |
6471 | 0 | offset_item = proto_tree_add_item_ret_uint(tree, hf_smb2_getinfo_input_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN, &getinfo_offset); |
6472 | 0 | offset += 2; |
6473 | | |
6474 | | /* reserved */ |
6475 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
6476 | 0 | offset += 2; |
6477 | | |
6478 | | /* size */ |
6479 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_getinfo_input_size, tvb, offset, 4, ENC_LITTLE_ENDIAN, &getinfo_size); |
6480 | 0 | offset += 4; |
6481 | | |
6482 | | /* parameters */ |
6483 | 0 | if (si->saved) { |
6484 | 0 | offset = dissect_smb2_getinfo_parameters(tvb, pinfo, tree, offset, si); |
6485 | 0 | } else { |
6486 | | /* some unknown bytes */ |
6487 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 8, ENC_NA); |
6488 | 0 | offset += 8; |
6489 | 0 | } |
6490 | | |
6491 | | /* Save the GUID for use in the reply */ |
6492 | 0 | tvb_get_letohguid(tvb, offset, &tag_guid); |
6493 | 0 | if (si->saved) { |
6494 | 0 | si->saved->uuid_fid = tag_guid; |
6495 | 0 | } |
6496 | | |
6497 | | /* fid */ |
6498 | 0 | offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); |
6499 | |
|
6500 | 0 | if (si->saved && si->saved->hnd_item) { |
6501 | 0 | fid_tree = proto_item_add_subtree(si->saved->hnd_item, ett_smb2_fid_str); |
6502 | 0 | which_tree = fid_tree; |
6503 | 0 | } else { |
6504 | 0 | which_tree = tree; |
6505 | 0 | } |
6506 | | |
6507 | | /* Filename */ |
6508 | 0 | if (si->file && si->file->name) { |
6509 | 0 | if (strcmp(si->file->name, "") == 0) |
6510 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
6511 | 0 | item = proto_tree_add_string(which_tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
6512 | 0 | proto_item_set_generated(item); |
6513 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
6514 | |
|
6515 | 0 | } |
6516 | | |
6517 | | /* fid hash */ |
6518 | 0 | if (si->saved && si->saved->fid_hash) { |
6519 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
6520 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
6521 | 0 | proto_item_set_generated(item); |
6522 | 0 | } |
6523 | | |
6524 | | /* buffer */ |
6525 | 0 | if (si->saved) { |
6526 | 0 | if (getinfo_size != 0) { |
6527 | | /* |
6528 | | * 2.2.37 says "For quota requests, this MUST be |
6529 | | * the length of the contained SMB2_QUERY_QUOTA_INFO |
6530 | | * embedded in the request. For FileFullEaInformation |
6531 | | * requests, this MUST be set to the length of the |
6532 | | * user supplied EA list specified in [MS-FSCC] |
6533 | | * section 2.4.15.1. For other information queries, |
6534 | | * this field SHOULD be set to 0 and the server MUST |
6535 | | * ignore it on receipt. |
6536 | | * |
6537 | | * This seems to imply that, for requests other |
6538 | | * than those to types, we should either completely |
6539 | | * ignore a non-zero getinfo_size or should, at |
6540 | | * most, add a warning-level expert info at the |
6541 | | * protocol level saying that it should be zero, |
6542 | | * but not try and interpret it or check its |
6543 | | * validity. |
6544 | | */ |
6545 | 0 | if (si->saved->smb2_class == SMB2_CLASS_QUOTA_INFO || |
6546 | 0 | (si->saved->smb2_class == SMB2_CLASS_FILE_INFO && |
6547 | 0 | si->saved->infolevel == SMB2_FILE_FULL_EA_INFO)) { |
6548 | | /* |
6549 | | * According to 2.2.37 SMB2 QUERY_INFO |
6550 | | * Request in the current MS-SMB2 spec, |
6551 | | * these are the only info requests that |
6552 | | * have an input buffer. |
6553 | | */ |
6554 | | |
6555 | | /* |
6556 | | * Make sure that the input buffer is after |
6557 | | * the fixed-length part of the message. |
6558 | | */ |
6559 | 0 | if (getinfo_offset < (unsigned)offset) { |
6560 | 0 | expert_add_info(pinfo, offset_item, &ei_smb2_invalid_getinfo_offset); |
6561 | 0 | return offset; |
6562 | 0 | } |
6563 | | |
6564 | | /* |
6565 | | * Make sure the input buffer is within the |
6566 | | * message, i.e. that it's within the tvbuff. |
6567 | | * |
6568 | | * We check for offset+length overflowing and |
6569 | | * for offset+length being beyond the reported |
6570 | | * length of the tvbuff. |
6571 | | */ |
6572 | 0 | if (getinfo_offset + getinfo_size < getinfo_offset || |
6573 | 0 | getinfo_offset + getinfo_size > tvb_reported_length(tvb)) { |
6574 | 0 | expert_add_info(pinfo, offset_item, &ei_smb2_invalid_getinfo_size); |
6575 | 0 | return offset; |
6576 | 0 | } |
6577 | | |
6578 | 0 | if (si->saved->smb2_class == SMB2_CLASS_QUOTA_INFO) { |
6579 | 0 | dissect_smb2_getinfo_buffer_quota(tvb, pinfo, tree, getinfo_offset, si); |
6580 | 0 | } else { |
6581 | | /* |
6582 | | * XXX - handle user supplied EA info. |
6583 | | */ |
6584 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, getinfo_offset, getinfo_size, ENC_NA); |
6585 | 0 | } |
6586 | 0 | offset = getinfo_offset + getinfo_size; |
6587 | 0 | } |
6588 | 0 | } else { |
6589 | | /* |
6590 | | * The buffer size is 0, meaning it's not present. |
6591 | | * |
6592 | | * 2.2.37 says "For FileFullEaInformation requests, |
6593 | | * the input buffer MUST contain the user supplied |
6594 | | * EA list with zero or more FILE_GET_EA_INFORMATION |
6595 | | * structures, specified in [MS-FSCC] section |
6596 | | * 2.4.15.1.", so it seems that, for a "get full |
6597 | | * EA information" request, the size can be zero - |
6598 | | * there's no other obvious way for the list to |
6599 | | * have zero structures. |
6600 | | * |
6601 | | * 2.2.37 also says "For quota requests, the input |
6602 | | * buffer MUST contain an SMB2_QUERY_QUOTA_INFO, |
6603 | | * as specified in section 2.2.37.1."; that seems |
6604 | | * to imply that the input buffer must not be empty |
6605 | | * in that case. |
6606 | | */ |
6607 | 0 | if (si->saved->smb2_class == SMB2_CLASS_QUOTA_INFO) |
6608 | 0 | expert_add_info(pinfo, offset_item, &ei_smb2_empty_getinfo_buffer); |
6609 | 0 | } |
6610 | 0 | } |
6611 | | |
6612 | 0 | return offset; |
6613 | 0 | } |
6614 | | |
6615 | | static int |
6616 | | dissect_smb2_infolevel(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si, uint8_t smb2_class, uint8_t infolevel) |
6617 | 0 | { |
6618 | 0 | int old_offset = offset; |
6619 | |
|
6620 | 0 | switch (smb2_class) { |
6621 | 0 | case SMB2_CLASS_FILE_INFO: |
6622 | 0 | switch (infolevel) { |
6623 | 0 | case SMB2_FILE_BASIC_INFO: |
6624 | 0 | offset = dissect_smb2_file_basic_info(tvb, pinfo, tree, offset, si); |
6625 | 0 | break; |
6626 | 0 | case SMB2_FILE_STANDARD_INFO: |
6627 | 0 | offset = dissect_smb2_file_standard_info(tvb, pinfo, tree, offset, si); |
6628 | 0 | break; |
6629 | 0 | case SMB2_FILE_INTERNAL_INFO: |
6630 | 0 | offset = dissect_smb2_file_internal_info(tvb, pinfo, tree, offset, si); |
6631 | 0 | break; |
6632 | 0 | case SMB2_FILE_EA_INFO: |
6633 | 0 | offset = dissect_smb2_file_ea_info(tvb, pinfo, tree, offset, si); |
6634 | 0 | break; |
6635 | 0 | case SMB2_FILE_ACCESS_INFO: |
6636 | 0 | offset = dissect_smb2_file_access_info(tvb, pinfo, tree, offset, si); |
6637 | 0 | break; |
6638 | 0 | case SMB2_FILE_RENAME_INFO: |
6639 | 0 | offset = dissect_smb2_file_rename_info(tvb, pinfo, tree, offset, si); |
6640 | 0 | break; |
6641 | 0 | case SMB2_FILE_LINK_INFO: |
6642 | 0 | offset = dissect_smb2_file_link_info(tvb, pinfo, tree, offset, si); |
6643 | 0 | break; |
6644 | 0 | case SMB2_FILE_DISPOSITION_INFO: |
6645 | 0 | offset = dissect_smb2_file_disposition_info(tvb, pinfo, tree, offset, si); |
6646 | 0 | break; |
6647 | 0 | case SMB2_FILE_POSITION_INFO: |
6648 | 0 | offset = dissect_smb2_file_position_info(tvb, pinfo, tree, offset, si); |
6649 | 0 | break; |
6650 | 0 | case SMB2_FILE_FULL_EA_INFO: |
6651 | 0 | offset = dissect_smb2_file_full_ea_info(tvb, pinfo, tree, offset, si); |
6652 | 0 | break; |
6653 | 0 | case SMB2_FILE_MODE_INFO: |
6654 | 0 | offset = dissect_smb2_file_mode_info(tvb, pinfo, tree, offset, si); |
6655 | 0 | break; |
6656 | 0 | case SMB2_FILE_ALIGNMENT_INFO: |
6657 | 0 | offset = dissect_smb2_file_alignment_info(tvb, pinfo, tree, offset, si); |
6658 | 0 | break; |
6659 | 0 | case SMB2_FILE_ALL_INFO: |
6660 | 0 | offset = dissect_smb2_file_all_info(tvb, pinfo, tree, offset, si); |
6661 | 0 | break; |
6662 | 0 | case SMB2_FILE_ALLOCATION_INFO: |
6663 | 0 | offset = dissect_smb2_file_allocation_info(tvb, pinfo, tree, offset, si); |
6664 | 0 | break; |
6665 | 0 | case SMB2_FILE_ENDOFFILE_INFO: |
6666 | 0 | dissect_smb2_file_endoffile_info(tvb, pinfo, tree, offset, si); |
6667 | 0 | break; |
6668 | 0 | case SMB2_FILE_ALTERNATE_NAME_INFO: |
6669 | 0 | offset = dissect_smb2_file_alternate_name_info(tvb, pinfo, tree, offset, si); |
6670 | 0 | break; |
6671 | 0 | case SMB2_FILE_STREAM_INFO: |
6672 | 0 | offset = dissect_smb2_file_stream_info(tvb, pinfo, tree, offset, si); |
6673 | 0 | break; |
6674 | 0 | case SMB2_FILE_PIPE_INFO: |
6675 | 0 | offset = dissect_smb2_file_pipe_info(tvb, pinfo, tree, offset, si); |
6676 | 0 | break; |
6677 | 0 | case SMB2_FILE_PIPE_LOCAL_INFO: |
6678 | 0 | offset = dissect_smb2_file_pipe_local_info(tvb, pinfo, tree, offset, si); |
6679 | 0 | break; |
6680 | 0 | case SMB2_FILE_PIPE_REMOTE_INFO: |
6681 | 0 | offset = dissect_smb2_file_pipe_remote_info(tvb, pinfo, tree, offset, si); |
6682 | 0 | break; |
6683 | 0 | case SMB2_FILE_COMPRESSION_INFO: |
6684 | 0 | offset = dissect_smb2_file_compression_info(tvb, pinfo, tree, offset, si); |
6685 | 0 | break; |
6686 | 0 | case SMB2_FILE_NETWORK_OPEN_INFO: |
6687 | 0 | offset = dissect_smb2_file_network_open_info(tvb, pinfo, tree, offset, si); |
6688 | 0 | break; |
6689 | 0 | case SMB2_FILE_ATTRIBUTE_TAG_INFO: |
6690 | 0 | offset = dissect_smb2_file_attribute_tag_info(tvb, pinfo, tree, offset, si); |
6691 | 0 | break; |
6692 | 0 | case SMB2_FILE_NORMALIZED_NAME_INFO: |
6693 | 0 | offset = dissect_smb2_file_normalized_name_info(tvb, pinfo, tree, offset, si); |
6694 | 0 | break; |
6695 | 0 | case SMB2_FILE_POSIX_INFO: |
6696 | 0 | offset = dissect_smb2_posix_info(tvb, pinfo, tree, offset, si); |
6697 | 0 | break; |
6698 | 0 | default: |
6699 | | /* we don't handle this infolevel yet */ |
6700 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA); |
6701 | 0 | offset += tvb_captured_length_remaining(tvb, offset); |
6702 | 0 | } |
6703 | 0 | break; |
6704 | 0 | case SMB2_CLASS_FS_INFO: |
6705 | 0 | switch (infolevel) { |
6706 | 0 | case SMB2_FS_INFO_01: |
6707 | 0 | offset = dissect_smb2_fs_info_01(tvb, pinfo, tree, offset, si); |
6708 | 0 | break; |
6709 | 0 | case SMB2_FS_INFO_03: |
6710 | 0 | offset = dissect_smb2_fs_info_03(tvb, pinfo, tree, offset, si); |
6711 | 0 | break; |
6712 | 0 | case SMB2_FS_INFO_04: |
6713 | 0 | offset = dissect_smb2_fs_info_04(tvb, pinfo, tree, offset, si); |
6714 | 0 | break; |
6715 | 0 | case SMB2_FS_INFO_05: |
6716 | 0 | offset = dissect_smb2_fs_info_05(tvb, pinfo, tree, offset, si); |
6717 | 0 | break; |
6718 | 0 | case SMB2_FS_INFO_06: |
6719 | 0 | offset = dissect_smb2_fs_info_06(tvb, pinfo, tree, offset, si); |
6720 | 0 | break; |
6721 | 0 | case SMB2_FS_INFO_07: |
6722 | 0 | offset = dissect_smb2_fs_info_07(tvb, pinfo, tree, offset, si); |
6723 | 0 | break; |
6724 | 0 | case SMB2_FS_OBJECTID_INFO: |
6725 | 0 | offset = dissect_smb2_FS_OBJECTID_INFO(tvb, pinfo, tree, offset, si); |
6726 | 0 | break; |
6727 | 0 | case SMB2_FS_POSIX_INFO: |
6728 | 0 | offset = dissect_smb2_fs_posix_info(tvb, pinfo, tree, offset, si); |
6729 | 0 | break; |
6730 | 0 | default: |
6731 | | /* we don't handle this infolevel yet */ |
6732 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA); |
6733 | 0 | offset += tvb_captured_length_remaining(tvb, offset); |
6734 | 0 | } |
6735 | 0 | break; |
6736 | 0 | case SMB2_CLASS_SEC_INFO: |
6737 | 0 | switch (infolevel) { |
6738 | 0 | case SMB2_SEC_INFO_00: |
6739 | 0 | offset = dissect_smb2_sec_info_00(tvb, pinfo, tree, offset, si); |
6740 | 0 | break; |
6741 | 0 | default: |
6742 | | /* we don't handle this infolevel yet */ |
6743 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA); |
6744 | 0 | offset += tvb_captured_length_remaining(tvb, offset); |
6745 | 0 | } |
6746 | 0 | break; |
6747 | 0 | case SMB2_CLASS_QUOTA_INFO: |
6748 | 0 | offset = dissect_smb2_quota_info(tvb, pinfo, tree, offset, si); |
6749 | 0 | break; |
6750 | 0 | default: |
6751 | | /* we don't handle this class yet */ |
6752 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA); |
6753 | 0 | offset += tvb_captured_length_remaining(tvb, offset); |
6754 | 0 | } |
6755 | | |
6756 | | /* if we get BUFFER_OVERFLOW there will be truncated data */ |
6757 | 0 | if (si->status == 0x80000005) { |
6758 | 0 | proto_item *item = NULL; |
6759 | 0 | item = proto_tree_add_item(tree, hf_smb2_truncated, tvb, old_offset, 0, ENC_NA); |
6760 | 0 | proto_item_set_generated(item); |
6761 | 0 | } |
6762 | 0 | return offset; |
6763 | 0 | } |
6764 | | |
6765 | | static void |
6766 | | dissect_smb2_getinfo_response_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si) |
6767 | 0 | { |
6768 | | /* data */ |
6769 | 0 | if (si->saved) { |
6770 | 0 | dissect_smb2_infolevel(tvb, pinfo, tree, 0, si, si->saved->smb2_class, si->saved->infolevel); |
6771 | 0 | } else { |
6772 | | /* some unknown bytes */ |
6773 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_captured_length(tvb), ENC_NA); |
6774 | 0 | } |
6775 | |
|
6776 | 0 | } |
6777 | | |
6778 | | |
6779 | | static int |
6780 | | dissect_smb2_getinfo_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
6781 | 0 | { |
6782 | 0 | offset_length_buffer_t olb; |
6783 | 0 | bool continue_dissection; |
6784 | 0 | proto_item *item = NULL; |
6785 | 0 | proto_item *tag_item = NULL; |
6786 | 0 | proto_tree *tag_tree = NULL; |
6787 | 0 | proto_tree *which_tree = NULL; |
6788 | | |
6789 | | /* class/infolevel */ |
6790 | 0 | dissect_smb2_class_infolevel(pinfo, tvb, offset, tree, si); |
6791 | |
|
6792 | 0 | switch (si->status) { |
6793 | 0 | case 0x00000000: |
6794 | | /* if we get BUFFER_OVERFLOW there will be truncated data */ |
6795 | 0 | case 0x80000005: |
6796 | | /* if we get BUFFER_TOO_SMALL there will not be any data there, only |
6797 | | * a guin32 specifying how big the buffer needs to be |
6798 | | */ |
6799 | | /* buffer code */ |
6800 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
6801 | 0 | break; |
6802 | 0 | case 0xc0000023: |
6803 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
6804 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &olb, OLB_O_UINT16_S_UINT32, -1); |
6805 | 0 | proto_tree_add_item(tree, hf_smb2_required_buffer_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
6806 | 0 | offset += 4; |
6807 | |
|
6808 | 0 | return offset; |
6809 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
6810 | 0 | if (!continue_dissection) return offset; |
6811 | 0 | } |
6812 | | |
6813 | | /* response buffer offset and size */ |
6814 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &olb, OLB_O_UINT16_S_UINT32, -1); |
6815 | | |
6816 | | /* response data*/ |
6817 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &olb, si, dissect_smb2_getinfo_response_data); |
6818 | |
|
6819 | 0 | if (pinfo->fd->visited) { |
6820 | 0 | if (si->file && si->file->name) { |
6821 | 0 | if (strcmp(si->file->name, "") == 0) |
6822 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
6823 | 0 | tag_item = proto_tree_add_string(tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
6824 | 0 | tag_tree = proto_item_add_subtree(tag_item, ett_smb2_fid_str); |
6825 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
6826 | 0 | which_tree = tag_tree; |
6827 | 0 | } else { |
6828 | 0 | which_tree = tree; |
6829 | 0 | } |
6830 | 0 | if (si->saved) { |
6831 | 0 | item = proto_tree_add_guid(which_tree, hf_smb2_fid, tvb, 0, 0, (e_guid_t *)&si->saved->uuid_fid); |
6832 | 0 | proto_item_set_generated(item); |
6833 | 0 | } |
6834 | 0 | if (si->saved && si->saved->fid_hash) { |
6835 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
6836 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
6837 | 0 | proto_item_set_generated(item); |
6838 | 0 | } |
6839 | 0 | if (si->file && si->file->frame_beg > 0 && si->file->frame_beg < UINT32_MAX) { |
6840 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
6841 | 0 | si->file->frame_beg); |
6842 | 0 | proto_item_set_generated(item); |
6843 | 0 | } else { |
6844 | 0 | if (si->saved && si->saved->frame_beg > 0 && si->saved->frame_beg < UINT32_MAX) { |
6845 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
6846 | 0 | si->saved->frame_beg); |
6847 | 0 | proto_item_set_generated(item); |
6848 | 0 | } |
6849 | 0 | } |
6850 | 0 | if (si->file && si->file->frame_end > 0 && si->file->frame_end < UINT32_MAX) { |
6851 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
6852 | 0 | si->file->frame_end); |
6853 | 0 | proto_item_set_generated(item); |
6854 | 0 | } else { |
6855 | 0 | if (si->saved && si->saved->frame_end > 0 && si->saved->frame_end < UINT32_MAX) { |
6856 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
6857 | 0 | si->saved->frame_end); |
6858 | 0 | proto_item_set_generated(item); |
6859 | 0 | } |
6860 | 0 | } |
6861 | 0 | } |
6862 | |
|
6863 | 0 | return offset; |
6864 | 0 | } |
6865 | | |
6866 | | static int |
6867 | | dissect_smb2_close_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
6868 | 0 | { |
6869 | 0 | proto_tree *flags_tree = NULL; |
6870 | 0 | proto_item *flags_item = NULL; |
6871 | 0 | proto_item *item = NULL; |
6872 | 0 | proto_tree *fid_tree = NULL; |
6873 | 0 | proto_tree *which_tree = NULL; |
6874 | 0 | e_guid_t tag_guid; |
6875 | | |
6876 | | |
6877 | | /* buffer code */ |
6878 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
6879 | | |
6880 | | /* close flags */ |
6881 | 0 | if (tree) { |
6882 | 0 | flags_item = proto_tree_add_item(tree, hf_smb2_close_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
6883 | 0 | flags_tree = proto_item_add_subtree(flags_item, ett_smb2_close_flags); |
6884 | 0 | } |
6885 | |
|
6886 | 0 | proto_tree_add_item(flags_tree, hf_smb2_close_pq_attrib, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
6887 | 0 | offset += 2; |
6888 | | |
6889 | | /* padding */ |
6890 | 0 | offset += 4; |
6891 | | |
6892 | | /* Save the GUID for use in the reply */ |
6893 | 0 | tvb_get_letohguid(tvb, offset, &tag_guid); |
6894 | 0 | if (si->saved) { |
6895 | 0 | si->saved->uuid_fid = tag_guid; |
6896 | 0 | } |
6897 | | |
6898 | | /* fid */ |
6899 | 0 | offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_CLOSE); |
6900 | |
|
6901 | 0 | if (si->saved && si->saved->hnd_item) { |
6902 | 0 | fid_tree = proto_item_add_subtree(si->saved->hnd_item, ett_smb2_fid_str); |
6903 | 0 | which_tree = fid_tree; |
6904 | 0 | } else { |
6905 | 0 | which_tree = tree; |
6906 | 0 | } |
6907 | |
|
6908 | 0 | if (si->file && si->file->delete_on_close) { |
6909 | 0 | if (si->file->is_dir) |
6910 | 0 | col_append_str(pinfo->cinfo, COL_INFO, ", (delete dir)"); |
6911 | 0 | else |
6912 | 0 | col_append_str(pinfo->cinfo, COL_INFO, ", (delete file)"); |
6913 | 0 | } |
6914 | | |
6915 | | /* Filename */ |
6916 | 0 | if (si->file && si->file->name) { |
6917 | 0 | item = proto_tree_add_string(which_tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
6918 | 0 | proto_item_set_generated(item); |
6919 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
6920 | 0 | } |
6921 | | |
6922 | | /* fid hash */ |
6923 | 0 | if (si->saved && si->saved->fid_hash) { |
6924 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
6925 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
6926 | 0 | proto_item_set_generated(item); |
6927 | 0 | } |
6928 | | |
6929 | |
|
6930 | 0 | return offset; |
6931 | 0 | } |
6932 | | |
6933 | | static int |
6934 | | dissect_smb2_close_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si) |
6935 | 0 | { |
6936 | 0 | proto_tree *flags_tree = NULL; |
6937 | 0 | proto_item *flags_item = NULL; |
6938 | 0 | proto_tree *tag_tree = NULL; |
6939 | 0 | proto_item *tag_item = NULL; |
6940 | 0 | proto_item *item = NULL; |
6941 | 0 | proto_tree *which_tree = NULL; |
6942 | 0 | bool continue_dissection; |
6943 | |
|
6944 | 0 | switch (si->status) { |
6945 | | /* buffer code */ |
6946 | 0 | case 0x00000000: offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); break; |
6947 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
6948 | 0 | if (!continue_dissection) return offset; |
6949 | 0 | } |
6950 | | |
6951 | | /* close flags */ |
6952 | 0 | if (tree) { |
6953 | 0 | flags_item = proto_tree_add_item(tree, hf_smb2_close_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
6954 | 0 | flags_tree = proto_item_add_subtree(flags_item, ett_smb2_close_flags); |
6955 | 0 | } |
6956 | 0 | proto_tree_add_item(flags_tree, hf_smb2_close_pq_attrib, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
6957 | 0 | offset += 2; |
6958 | | |
6959 | | /* reserved */ |
6960 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
6961 | 0 | offset += 4; |
6962 | | |
6963 | | /* create time */ |
6964 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_create_timestamp, ENC_LITTLE_ENDIAN); |
6965 | 0 | offset += 8; |
6966 | | |
6967 | | /* last access */ |
6968 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_access_timestamp, ENC_LITTLE_ENDIAN); |
6969 | 0 | offset += 8; |
6970 | | |
6971 | | /* last write */ |
6972 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_write_timestamp, ENC_LITTLE_ENDIAN); |
6973 | 0 | offset += 8; |
6974 | | |
6975 | | /* last change */ |
6976 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_change_timestamp, ENC_LITTLE_ENDIAN); |
6977 | 0 | offset += 8; |
6978 | | |
6979 | | /* allocation size */ |
6980 | 0 | proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
6981 | 0 | offset += 8; |
6982 | | |
6983 | | /* end of file */ |
6984 | 0 | proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
6985 | 0 | offset += 8; |
6986 | | |
6987 | | /* File Attributes */ |
6988 | 0 | offset = dissect_fscc_file_attr(tvb, tree, offset, NULL); |
6989 | |
|
6990 | 0 | if (si->file && si->file->delete_on_close) { |
6991 | 0 | if (si->file->is_dir) |
6992 | 0 | col_append_str(pinfo->cinfo, COL_INFO, ", (dir was deleted)"); |
6993 | 0 | else |
6994 | 0 | col_append_str(pinfo->cinfo, COL_INFO, ", (file was deleted)"); |
6995 | 0 | } |
6996 | |
|
6997 | 0 | if (pinfo->fd->visited) { |
6998 | 0 | if (si->file && si->file->name) { |
6999 | 0 | if (strcmp(si->file->name, "") == 0) |
7000 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
7001 | 0 | tag_item = proto_tree_add_string(tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
7002 | 0 | tag_tree = proto_item_add_subtree(tag_item, ett_smb2_fid_str); |
7003 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
7004 | 0 | which_tree = tag_tree; |
7005 | 0 | } else { |
7006 | 0 | which_tree = tree; |
7007 | 0 | } |
7008 | 0 | if (si->saved) { |
7009 | 0 | item = proto_tree_add_guid(which_tree, hf_smb2_fid, tvb, 0, 0, (e_guid_t *)&si->saved->uuid_fid); |
7010 | 0 | proto_item_set_generated(item); |
7011 | 0 | } |
7012 | 0 | if (si->saved && si->saved->fid_hash) { |
7013 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
7014 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
7015 | 0 | proto_item_set_generated(item); |
7016 | 0 | } |
7017 | 0 | if (si->file && si->file->frame_beg > 0 && si->file->frame_beg < UINT32_MAX) { |
7018 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
7019 | 0 | si->file->frame_beg); |
7020 | 0 | proto_item_set_generated(item); |
7021 | 0 | } else { |
7022 | 0 | if (si->saved && si->saved->frame_beg > 0 && si->saved->frame_beg < UINT32_MAX) { |
7023 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
7024 | 0 | si->saved->frame_beg); |
7025 | 0 | proto_item_set_generated(item); |
7026 | 0 | } |
7027 | 0 | } |
7028 | 0 | if (si->file && si->file->frame_end > 0 && si->file->frame_end < UINT32_MAX) { |
7029 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
7030 | 0 | si->file->frame_end); |
7031 | 0 | proto_item_set_generated(item); |
7032 | 0 | } else { |
7033 | 0 | if (si->saved && si->saved->frame_end > 0 && si->saved->frame_end < UINT32_MAX) { |
7034 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
7035 | 0 | si->saved->frame_end); |
7036 | 0 | proto_item_set_generated(item); |
7037 | 0 | } |
7038 | 0 | } |
7039 | 0 | } |
7040 | |
|
7041 | 0 | return offset; |
7042 | 0 | } |
7043 | | |
7044 | | static int |
7045 | | dissect_smb2_flush_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
7046 | 0 | { |
7047 | 0 | proto_item *item = NULL; |
7048 | 0 | proto_tree *fid_tree; |
7049 | 0 | proto_tree *which_tree; |
7050 | 0 | e_guid_t tag_guid; |
7051 | | |
7052 | | /* buffer code */ |
7053 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
7054 | | |
7055 | | /* reserved1 */ |
7056 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
7057 | 0 | offset += 2; |
7058 | | |
7059 | | /* reserved2 */ |
7060 | 0 | proto_tree_add_item(tree, hf_smb2_flush_reserved2, tvb, offset, 4, ENC_NA); |
7061 | 0 | offset += 4; |
7062 | | |
7063 | | /* Save the FID for use in responses and the create request */ |
7064 | 0 | tvb_get_letohguid(tvb, offset, &tag_guid); |
7065 | 0 | if (si->saved) { |
7066 | 0 | si->saved->uuid_fid = tag_guid; |
7067 | 0 | } |
7068 | | |
7069 | | /* fid */ |
7070 | 0 | offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); |
7071 | |
|
7072 | 0 | if (si->saved && si->saved->hnd_item) { |
7073 | 0 | fid_tree = proto_item_add_subtree(si->saved->hnd_item, ett_smb2_fid_str); |
7074 | 0 | which_tree = fid_tree; |
7075 | 0 | } else { |
7076 | 0 | which_tree = tree; |
7077 | 0 | } |
7078 | | |
7079 | | /* Filename */ |
7080 | 0 | if (si->file && si->file->name) { |
7081 | 0 | if (strcmp(si->file->name, "") == 0) |
7082 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
7083 | 0 | item = proto_tree_add_string(which_tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
7084 | 0 | proto_item_set_generated(item); |
7085 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
7086 | 0 | } |
7087 | | |
7088 | | /* fid hash */ |
7089 | 0 | if (si->saved && si->saved->fid_hash) { |
7090 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
7091 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
7092 | 0 | proto_item_set_generated(item); |
7093 | 0 | } |
7094 | |
|
7095 | 0 | return offset; |
7096 | 0 | } |
7097 | | |
7098 | | static int |
7099 | | dissect_smb2_flush_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_) |
7100 | 0 | { |
7101 | 0 | bool continue_dissection; |
7102 | 0 | proto_tree *tag_tree = NULL; |
7103 | 0 | proto_item *tag_item = NULL; |
7104 | 0 | proto_item *item = NULL; |
7105 | 0 | proto_tree *which_tree = NULL; |
7106 | |
|
7107 | 0 | switch (si->status) { |
7108 | | /* buffer code */ |
7109 | 0 | case 0x00000000: offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); break; |
7110 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
7111 | 0 | if (!continue_dissection) return offset; |
7112 | 0 | } |
7113 | | |
7114 | | /* reserved bytes */ |
7115 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
7116 | 0 | offset += 2; |
7117 | |
|
7118 | 0 | if (pinfo->fd->visited) { |
7119 | 0 | if (si->file && si->file->name) { |
7120 | 0 | if (strcmp(si->file->name, "") == 0) |
7121 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
7122 | 0 | tag_item = proto_tree_add_string(tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
7123 | 0 | tag_tree = proto_item_add_subtree(tag_item, ett_smb2_fid_str); |
7124 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
7125 | 0 | which_tree = tag_tree; |
7126 | 0 | } else { |
7127 | 0 | which_tree = tree; |
7128 | 0 | } |
7129 | 0 | if (si->saved) { |
7130 | 0 | item = proto_tree_add_guid(which_tree, hf_smb2_fid, tvb, 0, 0, (e_guid_t *)&si->saved->uuid_fid); |
7131 | 0 | proto_item_set_generated(item); |
7132 | 0 | } |
7133 | 0 | if (si->saved && si->saved->fid_hash) { |
7134 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
7135 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
7136 | 0 | proto_item_set_generated(item); |
7137 | 0 | } |
7138 | 0 | if (si->file && si->file->frame_beg > 0 && si->file->frame_beg < UINT32_MAX) { |
7139 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
7140 | 0 | si->file->frame_beg); |
7141 | 0 | proto_item_set_generated(item); |
7142 | 0 | } else { |
7143 | 0 | if (si->saved && si->saved->frame_beg > 0 && si->saved->frame_beg < UINT32_MAX) { |
7144 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
7145 | 0 | si->saved->frame_beg); |
7146 | 0 | proto_item_set_generated(item); |
7147 | 0 | } |
7148 | 0 | } |
7149 | 0 | if (si->file && si->file->frame_end > 0 && si->file->frame_end < UINT32_MAX) { |
7150 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
7151 | 0 | si->file->frame_end); |
7152 | 0 | proto_item_set_generated(item); |
7153 | 0 | } else { |
7154 | 0 | if (si->saved && si->saved->frame_end > 0 && si->saved->frame_end < UINT32_MAX) { |
7155 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
7156 | 0 | si->saved->frame_end); |
7157 | 0 | proto_item_set_generated(item); |
7158 | 0 | } |
7159 | 0 | } |
7160 | 0 | } |
7161 | |
|
7162 | 0 | return offset; |
7163 | | |
7164 | | |
7165 | |
|
7166 | 0 | } |
7167 | | |
7168 | | |
7169 | | static int |
7170 | | dissect_smb2_lock_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
7171 | 0 | { |
7172 | 0 | uint16_t lock_count; |
7173 | 0 | proto_item *item = NULL; |
7174 | 0 | proto_tree *fid_tree = NULL; |
7175 | 0 | proto_tree *which_tree = NULL; |
7176 | 0 | e_guid_t tag_guid; |
7177 | | |
7178 | | /* buffer code */ |
7179 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
7180 | | |
7181 | | /* lock count */ |
7182 | 0 | lock_count = tvb_get_letohs(tvb, offset); |
7183 | 0 | proto_tree_add_item(tree, hf_smb2_lock_count, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
7184 | 0 | offset += 2; |
7185 | | |
7186 | | /* Lock Sequence Number/Index */ |
7187 | 0 | proto_tree_add_item(tree, hf_smb2_lock_sequence_number, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
7188 | 0 | proto_tree_add_item(tree, hf_smb2_lock_sequence_index, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
7189 | 0 | offset += 4; |
7190 | | |
7191 | | /* fid hash */ |
7192 | 0 | if (si->saved && si->saved->fid_hash) { |
7193 | 0 | item = proto_tree_add_uint_format(tree, hf_smb2_file_id_hash, tvb, 0, 0, |
7194 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
7195 | 0 | proto_item_set_generated(item); |
7196 | 0 | } |
7197 | | |
7198 | | /* Save the FID for use in responses and the create request */ |
7199 | 0 | tvb_get_letohguid(tvb, offset, &tag_guid); |
7200 | 0 | if (si->saved) { |
7201 | 0 | si->saved->uuid_fid = tag_guid; |
7202 | 0 | } |
7203 | | |
7204 | | /* fid */ |
7205 | 0 | offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); |
7206 | |
|
7207 | 0 | if (si->saved && si->saved->hnd_item) { |
7208 | 0 | fid_tree = proto_item_add_subtree(si->saved->hnd_item, ett_smb2_fid_str); |
7209 | 0 | which_tree = fid_tree; |
7210 | 0 | } else { |
7211 | 0 | which_tree = tree; |
7212 | 0 | } |
7213 | | |
7214 | | /* Filename */ |
7215 | 0 | if (si->file && si->file->name) { |
7216 | 0 | if (strcmp(si->file->name, "") == 0) |
7217 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
7218 | 0 | item = proto_tree_add_string(which_tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
7219 | 0 | proto_item_set_generated(item); |
7220 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
7221 | 0 | } |
7222 | | |
7223 | | /* fid hash */ |
7224 | 0 | if (si->saved && si->saved->fid_hash) { |
7225 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
7226 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
7227 | 0 | proto_item_set_generated(item); |
7228 | 0 | } |
7229 | | |
7230 | |
|
7231 | 0 | while (lock_count--) { |
7232 | 0 | proto_item *lock_item = NULL; |
7233 | 0 | proto_tree *lock_tree = NULL; |
7234 | 0 | static int * const lf_fields[] = { |
7235 | 0 | &hf_smb2_lock_flags_shared, |
7236 | 0 | &hf_smb2_lock_flags_exclusive, |
7237 | 0 | &hf_smb2_lock_flags_unlock, |
7238 | 0 | &hf_smb2_lock_flags_fail_immediately, |
7239 | 0 | NULL |
7240 | 0 | }; |
7241 | |
|
7242 | 0 | if (tree) { |
7243 | 0 | lock_item = proto_tree_add_item(tree, hf_smb2_lock_info, tvb, offset, 24, ENC_NA); |
7244 | 0 | lock_tree = proto_item_add_subtree(lock_item, ett_smb2_lock_info); |
7245 | 0 | } |
7246 | | |
7247 | | /* offset */ |
7248 | 0 | proto_tree_add_item(tree, hf_smb2_file_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
7249 | 0 | offset += 8; |
7250 | | |
7251 | | /* count */ |
7252 | 0 | proto_tree_add_item(lock_tree, hf_smb2_lock_length, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
7253 | 0 | offset += 8; |
7254 | | |
7255 | | /* flags */ |
7256 | 0 | proto_tree_add_bitmask(lock_tree, tvb, offset, hf_smb2_lock_flags, ett_smb2_lock_flags, lf_fields, ENC_LITTLE_ENDIAN); |
7257 | 0 | offset += 4; |
7258 | | |
7259 | | /* reserved */ |
7260 | 0 | proto_tree_add_item(lock_tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
7261 | 0 | offset += 4; |
7262 | 0 | } |
7263 | |
|
7264 | 0 | return offset; |
7265 | 0 | } |
7266 | | |
7267 | | static int |
7268 | | dissect_smb2_lock_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_) |
7269 | 0 | { |
7270 | 0 | bool continue_dissection; |
7271 | 0 | proto_tree *tag_tree = NULL; |
7272 | 0 | proto_item *tag_item = NULL; |
7273 | 0 | proto_tree *which_tree = NULL; |
7274 | 0 | proto_item *item = NULL; |
7275 | |
|
7276 | 0 | switch (si->status) { |
7277 | | /* buffer code */ |
7278 | 0 | case 0x00000000: offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); break; |
7279 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
7280 | 0 | if (!continue_dissection) return offset; |
7281 | 0 | } |
7282 | | |
7283 | | /* reserved */ |
7284 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
7285 | 0 | offset += 2; |
7286 | |
|
7287 | 0 | if (pinfo->fd->visited) { |
7288 | 0 | if (si->file && si->file->name) { |
7289 | 0 | if (strcmp(si->file->name, "") == 0) |
7290 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
7291 | 0 | tag_item = proto_tree_add_string(tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
7292 | 0 | tag_tree = proto_item_add_subtree(tag_item, ett_smb2_fid_str); |
7293 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
7294 | 0 | which_tree = tag_tree; |
7295 | 0 | } else { |
7296 | 0 | which_tree = tree; |
7297 | 0 | } |
7298 | 0 | if (si->saved) { |
7299 | 0 | item = proto_tree_add_guid(which_tree, hf_smb2_fid, tvb, 0, 0, (e_guid_t *)&si->saved->uuid_fid); |
7300 | 0 | proto_item_set_generated(item); |
7301 | 0 | } |
7302 | 0 | if (si->saved && si->saved->fid_hash) { |
7303 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
7304 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
7305 | 0 | proto_item_set_generated(item); |
7306 | 0 | } |
7307 | 0 | if (si->file && si->file->frame_beg > 0 && si->file->frame_beg < UINT32_MAX) { |
7308 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
7309 | 0 | si->file->frame_beg); |
7310 | 0 | proto_item_set_generated(item); |
7311 | 0 | } else { |
7312 | 0 | if (si->saved && si->saved->frame_beg > 0 && si->saved->frame_beg < UINT32_MAX) { |
7313 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
7314 | 0 | si->saved->frame_beg); |
7315 | 0 | proto_item_set_generated(item); |
7316 | 0 | } |
7317 | 0 | } |
7318 | 0 | if (si->file && si->file->frame_end > 0 && si->file->frame_end < UINT32_MAX) { |
7319 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
7320 | 0 | si->file->frame_end); |
7321 | 0 | proto_item_set_generated(item); |
7322 | 0 | } else { |
7323 | 0 | if (si->saved && si->saved->frame_end > 0 && si->saved->frame_end < UINT32_MAX) { |
7324 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
7325 | 0 | si->saved->frame_end); |
7326 | 0 | proto_item_set_generated(item); |
7327 | 0 | } |
7328 | 0 | } |
7329 | 0 | } |
7330 | | |
7331 | | |
7332 | |
|
7333 | 0 | return offset; |
7334 | 0 | } |
7335 | | static int |
7336 | | dissect_smb2_cancel_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_) |
7337 | 0 | { |
7338 | | /* buffer code */ |
7339 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
7340 | | |
7341 | | /* some unknown bytes */ |
7342 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 2, ENC_NA); |
7343 | 0 | offset += 2; |
7344 | |
|
7345 | 0 | return offset; |
7346 | 0 | } |
7347 | | |
7348 | | static const smb2_fid_info_t * |
7349 | | smb2_pipe_get_fid_info(const smb2_info_t *si) |
7350 | 0 | { |
7351 | 0 | smb2_fid_info_t *file = NULL; |
7352 | |
|
7353 | 0 | if (si == NULL) { |
7354 | 0 | return NULL; |
7355 | 0 | } |
7356 | 0 | if (si->file != NULL) { |
7357 | 0 | file = si->file; |
7358 | 0 | } else if (si->saved != NULL) { |
7359 | 0 | file = si->saved->file; |
7360 | 0 | } |
7361 | 0 | if (file == NULL) { |
7362 | 0 | return NULL; |
7363 | 0 | } |
7364 | | |
7365 | 0 | return file; |
7366 | 0 | } |
7367 | | |
7368 | | static void |
7369 | | smb2_pipe_set_file_id(packet_info *pinfo, smb2_info_t *si) |
7370 | 0 | { |
7371 | 0 | uint64_t persistent; |
7372 | 0 | const smb2_fid_info_t *file = NULL; |
7373 | |
|
7374 | 0 | file = smb2_pipe_get_fid_info(si); |
7375 | 0 | if (file == NULL) { |
7376 | 0 | return; |
7377 | 0 | } |
7378 | | |
7379 | 0 | persistent = GPOINTER_TO_UINT(file); |
7380 | |
|
7381 | 0 | dcerpc_set_transport_salt(persistent, pinfo); |
7382 | 0 | } |
7383 | | |
7384 | | static bool smb2_pipe_reassembly = true; |
7385 | | static bool smb2_verify_signatures; |
7386 | | static reassembly_table smb2_pipe_reassembly_table; |
7387 | | |
7388 | | static int |
7389 | | dissect_file_data_smb2_pipe(tvbuff_t *raw_tvb, packet_info *pinfo, proto_tree *tree _U_, int offset, uint32_t datalen, proto_tree *top_tree, void *data) |
7390 | 0 | { |
7391 | | /* |
7392 | | * Note: si is NULL for some callers from packet-smb.c |
7393 | | */ |
7394 | 0 | const smb2_info_t *si = (const smb2_info_t *)data; |
7395 | 0 | bool result=false; |
7396 | 0 | bool save_fragmented; |
7397 | 0 | int remaining; |
7398 | 0 | unsigned reported_len; |
7399 | 0 | const smb2_fid_info_t *file = NULL; |
7400 | 0 | uint32_t id; |
7401 | 0 | fragment_head *fd_head; |
7402 | 0 | fragment_item *fd_i; |
7403 | 0 | tvbuff_t *tvb; |
7404 | 0 | tvbuff_t *new_tvb; |
7405 | 0 | proto_item *frag_tree_item; |
7406 | 0 | heur_dtbl_entry_t *hdtbl_entry; |
7407 | |
|
7408 | 0 | file = smb2_pipe_get_fid_info(si); |
7409 | 0 | id = (uint32_t)(GPOINTER_TO_UINT(file) & UINT32_MAX); |
7410 | |
|
7411 | 0 | remaining = tvb_captured_length_remaining(raw_tvb, offset); |
7412 | |
|
7413 | 0 | tvb = tvb_new_subset_length_caplen(raw_tvb, offset, |
7414 | 0 | MIN((int)datalen, remaining), |
7415 | 0 | datalen); |
7416 | | |
7417 | | /* |
7418 | | * Offer desegmentation service to Named Pipe subdissectors (e.g. DCERPC) |
7419 | | * if we have all the data. Otherwise, reassembly is (probably) impossible. |
7420 | | */ |
7421 | 0 | pinfo->can_desegment = 0; |
7422 | 0 | pinfo->desegment_offset = 0; |
7423 | 0 | pinfo->desegment_len = 0; |
7424 | 0 | reported_len = tvb_reported_length(tvb); |
7425 | 0 | if (smb2_pipe_reassembly && tvb_captured_length(tvb) >= reported_len) { |
7426 | 0 | pinfo->can_desegment = 2; |
7427 | 0 | } |
7428 | |
|
7429 | 0 | save_fragmented = pinfo->fragmented; |
7430 | | |
7431 | | /* |
7432 | | * if we are not offering desegmentation, just try the heuristics |
7433 | | *and bail out |
7434 | | */ |
7435 | 0 | if (!pinfo->can_desegment) { |
7436 | 0 | result = dissector_try_heuristic(smb2_pipe_subdissector_list, |
7437 | 0 | tvb, pinfo, top_tree, |
7438 | 0 | &hdtbl_entry, data); |
7439 | 0 | goto clean_up_and_exit; |
7440 | 0 | } |
7441 | | |
7442 | | /* below this line, we know we are doing reassembly */ |
7443 | | |
7444 | | /* |
7445 | | * this is a new packet, see if we are already reassembling this |
7446 | | * pdu and if not, check if the dissector wants us |
7447 | | * to reassemble it |
7448 | | */ |
7449 | 0 | if (!pinfo->fd->visited) { |
7450 | | /* |
7451 | | * This is the first pass. |
7452 | | * |
7453 | | * Check if we are already reassembling this PDU or not; |
7454 | | * we check for an in-progress reassembly for this FID |
7455 | | * in this direction, by searching for its reassembly |
7456 | | * structure. |
7457 | | */ |
7458 | 0 | fd_head = fragment_get(&smb2_pipe_reassembly_table, |
7459 | 0 | pinfo, id, NULL); |
7460 | 0 | if (!fd_head) { |
7461 | | /* |
7462 | | * No reassembly, so this is a new pdu. check if the |
7463 | | * dissector wants us to reassemble it or if we |
7464 | | * already got the full pdu in this tvb. |
7465 | | */ |
7466 | | |
7467 | | /* |
7468 | | * Try the heuristic dissectors and see if we |
7469 | | * find someone that recognizes this payload. |
7470 | | */ |
7471 | 0 | result = dissector_try_heuristic(smb2_pipe_subdissector_list, |
7472 | 0 | tvb, pinfo, top_tree, |
7473 | 0 | &hdtbl_entry, data); |
7474 | | |
7475 | | /* no this didn't look like something we know */ |
7476 | 0 | if (!result) { |
7477 | 0 | goto clean_up_and_exit; |
7478 | 0 | } |
7479 | | |
7480 | | /* did the subdissector want us to reassemble any |
7481 | | more data ? |
7482 | | */ |
7483 | 0 | if (pinfo->desegment_len) { |
7484 | 0 | fragment_add_check(&smb2_pipe_reassembly_table, |
7485 | 0 | tvb, 0, pinfo, id, NULL, |
7486 | 0 | 0, reported_len, true); |
7487 | 0 | fragment_set_tot_len(&smb2_pipe_reassembly_table, |
7488 | 0 | pinfo, id, NULL, |
7489 | 0 | pinfo->desegment_len+reported_len); |
7490 | 0 | } |
7491 | 0 | goto clean_up_and_exit; |
7492 | 0 | } |
7493 | | |
7494 | | /* OK, we're already doing a reassembly for this FID. |
7495 | | skip to last segment in the existing reassembly structure |
7496 | | and add this fragment there |
7497 | | |
7498 | | XXX we might add code here to use any offset values |
7499 | | we might pick up from the Read/Write calls instead of |
7500 | | assuming we always get them in the correct order |
7501 | | */ |
7502 | 0 | for (fd_i = fd_head->next; fd_i->next; fd_i = fd_i->next) {} |
7503 | 0 | fd_head = fragment_add_check(&smb2_pipe_reassembly_table, |
7504 | 0 | tvb, 0, pinfo, id, NULL, |
7505 | 0 | fd_i->offset+fd_i->len, |
7506 | 0 | reported_len, true); |
7507 | | |
7508 | | /* if we completed reassembly */ |
7509 | 0 | if (fd_head) { |
7510 | 0 | new_tvb = tvb_new_chain(tvb, fd_head->tvb_data); |
7511 | 0 | add_new_data_source(pinfo, new_tvb, |
7512 | 0 | "Named Pipe over SMB2"); |
7513 | 0 | pinfo->fragmented=false; |
7514 | |
|
7515 | 0 | tvb = new_tvb; |
7516 | | |
7517 | | /* list what segments we have */ |
7518 | 0 | show_fragment_tree(fd_head, &smb2_pipe_frag_items, |
7519 | 0 | tree, pinfo, tvb, &frag_tree_item); |
7520 | | |
7521 | | /* dissect the full PDU */ |
7522 | 0 | result = dissector_try_heuristic(smb2_pipe_subdissector_list, |
7523 | 0 | tvb, pinfo, top_tree, |
7524 | 0 | &hdtbl_entry, data); |
7525 | 0 | } |
7526 | 0 | goto clean_up_and_exit; |
7527 | 0 | } |
7528 | | |
7529 | | /* |
7530 | | * This is not the first pass; see if it's in the table of |
7531 | | * reassembled packets. |
7532 | | * |
7533 | | * XXX - we know that several of the arguments aren't going to |
7534 | | * be used, so we pass bogus variables. Can we clean this |
7535 | | * up so that we don't have to distinguish between the first |
7536 | | * pass and subsequent passes? |
7537 | | */ |
7538 | 0 | fd_head = fragment_add_check(&smb2_pipe_reassembly_table, |
7539 | 0 | tvb, 0, pinfo, id, NULL, 0, 0, true); |
7540 | 0 | if (!fd_head) { |
7541 | | /* we didn't find it, try any of the heuristic dissectors |
7542 | | and bail out |
7543 | | */ |
7544 | 0 | result = dissector_try_heuristic(smb2_pipe_subdissector_list, |
7545 | 0 | tvb, pinfo, top_tree, |
7546 | 0 | &hdtbl_entry, data); |
7547 | 0 | goto clean_up_and_exit; |
7548 | 0 | } |
7549 | 0 | if (!(fd_head->flags&FD_DEFRAGMENTED)) { |
7550 | | /* we don't have a fully reassembled frame */ |
7551 | 0 | result = dissector_try_heuristic(smb2_pipe_subdissector_list, |
7552 | 0 | tvb, pinfo, top_tree, |
7553 | 0 | &hdtbl_entry, data); |
7554 | 0 | goto clean_up_and_exit; |
7555 | 0 | } |
7556 | | |
7557 | | /* it is reassembled but it was reassembled in a different frame */ |
7558 | 0 | if (pinfo->num != fd_head->reassembled_in) { |
7559 | 0 | proto_item *item = NULL; |
7560 | 0 | item = proto_tree_add_uint(top_tree, hf_smb2_pipe_reassembled_in, |
7561 | 0 | tvb, 0, 0, fd_head->reassembled_in); |
7562 | 0 | proto_item_set_generated(item); |
7563 | 0 | goto clean_up_and_exit; |
7564 | 0 | } |
7565 | | |
7566 | | /* display the reassembled pdu */ |
7567 | 0 | new_tvb = tvb_new_chain(tvb, fd_head->tvb_data); |
7568 | 0 | add_new_data_source(pinfo, new_tvb, |
7569 | 0 | "Named Pipe over SMB2"); |
7570 | 0 | pinfo->fragmented = false; |
7571 | |
|
7572 | 0 | tvb = new_tvb; |
7573 | | |
7574 | | /* list what segments we have */ |
7575 | 0 | show_fragment_tree(fd_head, &smb2_pipe_frag_items, |
7576 | 0 | top_tree, pinfo, tvb, &frag_tree_item); |
7577 | | |
7578 | | /* dissect the full PDU */ |
7579 | 0 | result = dissector_try_heuristic(smb2_pipe_subdissector_list, |
7580 | 0 | tvb, pinfo, top_tree, |
7581 | 0 | &hdtbl_entry, data); |
7582 | |
|
7583 | 0 | clean_up_and_exit: |
7584 | | /* clear out the variables */ |
7585 | 0 | pinfo->can_desegment=0; |
7586 | 0 | pinfo->desegment_offset = 0; |
7587 | 0 | pinfo->desegment_len = 0; |
7588 | |
|
7589 | 0 | if (!result) { |
7590 | 0 | call_data_dissector(tvb, pinfo, top_tree); |
7591 | 0 | } |
7592 | |
|
7593 | 0 | pinfo->fragmented = save_fragmented; |
7594 | |
|
7595 | 0 | offset += datalen; |
7596 | 0 | return offset; |
7597 | 0 | } |
7598 | | |
7599 | 0 | #define SMB2_CHANNEL_NONE 0x00000000 |
7600 | 0 | #define SMB2_CHANNEL_RDMA_V1 0x00000001 |
7601 | 0 | #define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000002 |
7602 | | #define SMB2_CHANNEL_RDMA_TRANSFORM 0x00000003 |
7603 | | |
7604 | | static const value_string smb2_channel_vals[] = { |
7605 | | { SMB2_CHANNEL_NONE, "None" }, |
7606 | | { SMB2_CHANNEL_RDMA_V1, "RDMA V1" }, |
7607 | | { SMB2_CHANNEL_RDMA_V1_INVALIDATE, "RDMA V1_INVALIDATE" }, |
7608 | | { SMB2_CHANNEL_RDMA_TRANSFORM, "RDMA TRANSFORM" }, |
7609 | | { 0, NULL } |
7610 | | }; |
7611 | | |
7612 | | static void |
7613 | | dissect_smb2_rdma_v1_blob(tvbuff_t *tvb, packet_info *pinfo _U_, |
7614 | | proto_tree *parent_tree, smb2_info_t *si _U_) |
7615 | 0 | { |
7616 | 0 | int offset = 0; |
7617 | 0 | int len; |
7618 | 0 | int i; |
7619 | 0 | int num; |
7620 | 0 | proto_tree *sub_tree; |
7621 | 0 | proto_item *parent_item; |
7622 | |
|
7623 | 0 | parent_item = proto_tree_get_parent(parent_tree); |
7624 | |
|
7625 | 0 | len = tvb_reported_length(tvb); |
7626 | |
|
7627 | 0 | num = len / 16; |
7628 | |
|
7629 | 0 | if (parent_item) { |
7630 | 0 | proto_item_append_text(parent_item, ": SMBDirect Buffer Descriptor V1: (%d elements)", num); |
7631 | 0 | } |
7632 | |
|
7633 | 0 | for (i = 0; i < num; i++) { |
7634 | 0 | sub_tree = proto_tree_add_subtree(parent_tree, tvb, offset, 8, ett_smb2_rdma_v1, NULL, "RDMA V1"); |
7635 | |
|
7636 | 0 | proto_tree_add_item(sub_tree, hf_smb2_rdma_v1_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
7637 | 0 | offset += 8; |
7638 | |
|
7639 | 0 | proto_tree_add_item(sub_tree, hf_smb2_rdma_v1_token, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
7640 | 0 | offset += 4; |
7641 | |
|
7642 | 0 | proto_tree_add_item(sub_tree, hf_smb2_rdma_v1_length, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
7643 | 0 | offset += 4; |
7644 | 0 | } |
7645 | 0 | } |
7646 | | |
7647 | 14 | #define SMB2_WRITE_FLAG_WRITE_THROUGH 0x00000001 |
7648 | 14 | #define SMB2_WRITE_FLAG_WRITE_UNBUFFERED 0x00000002 |
7649 | | |
7650 | | static const true_false_string tfs_write_through = { |
7651 | | "Client is asking for WRITE_THROUGH", |
7652 | | "Client is NOT asking for WRITE_THROUGH" |
7653 | | }; |
7654 | | |
7655 | | static const true_false_string tfs_write_unbuffered = { |
7656 | | "Client is asking for UNBUFFERED write", |
7657 | | "Client is NOT asking for UNBUFFERED write" |
7658 | | }; |
7659 | | |
7660 | | static int |
7661 | | dissect_smb2_write_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
7662 | 0 | { |
7663 | 0 | uint16_t dataoffset = 0; |
7664 | 0 | uint32_t data_tvb_len; |
7665 | 0 | offset_length_buffer_t c_olb; |
7666 | 0 | uint32_t channel; |
7667 | 0 | uint32_t length; |
7668 | 0 | uint64_t off; |
7669 | 0 | static int * const f_fields[] = { |
7670 | 0 | &hf_smb2_write_flags_write_through, |
7671 | 0 | &hf_smb2_write_flags_write_unbuffered, |
7672 | 0 | NULL |
7673 | 0 | }; |
7674 | 0 | proto_item *item = NULL; |
7675 | 0 | proto_tree *fid_tree; |
7676 | 0 | proto_tree *which_tree; |
7677 | | |
7678 | | /* buffer code */ |
7679 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
7680 | | |
7681 | | /* data offset */ |
7682 | 0 | dataoffset=tvb_get_letohs(tvb,offset); |
7683 | 0 | proto_tree_add_item(tree, hf_smb2_data_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
7684 | 0 | offset += 2; |
7685 | | |
7686 | | /* length */ |
7687 | 0 | length = tvb_get_letohl(tvb, offset); |
7688 | 0 | proto_tree_add_item(tree, hf_smb2_write_length, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
7689 | 0 | offset += 4; |
7690 | | |
7691 | | /* offset */ |
7692 | 0 | off = tvb_get_letoh64(tvb, offset); |
7693 | 0 | if (si->saved) si->saved->file_offset=off; |
7694 | 0 | proto_tree_add_item(tree, hf_smb2_file_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
7695 | 0 | offset += 8; |
7696 | |
|
7697 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " Len:%d Off:%" PRIu64, length, off); |
7698 | | |
7699 | | /* fid */ |
7700 | 0 | offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); |
7701 | |
|
7702 | 0 | if (si->saved && si->saved->hnd_item) { |
7703 | 0 | fid_tree = proto_item_add_subtree(si->saved->hnd_item, ett_smb2_fid_str); |
7704 | 0 | which_tree = fid_tree; |
7705 | 0 | } else { |
7706 | 0 | which_tree = tree; |
7707 | 0 | } |
7708 | | |
7709 | | /* Filename */ |
7710 | 0 | if (si->file && si->file->name) { |
7711 | 0 | if (strcmp(si->file->name, "") == 0) |
7712 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
7713 | 0 | item = proto_tree_add_string(which_tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
7714 | 0 | proto_item_set_generated(item); |
7715 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
7716 | 0 | } |
7717 | | |
7718 | | /* fid hash */ |
7719 | 0 | if (si->saved && si->saved->fid_hash) { |
7720 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
7721 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
7722 | 0 | proto_item_set_generated(item); |
7723 | 0 | } |
7724 | | |
7725 | | /* channel */ |
7726 | 0 | channel = tvb_get_letohl(tvb, offset); |
7727 | 0 | proto_tree_add_item(tree, hf_smb2_channel, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
7728 | 0 | offset += 4; |
7729 | | |
7730 | | /* remaining bytes */ |
7731 | 0 | proto_tree_add_item(tree, hf_smb2_remaining_bytes, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
7732 | 0 | offset += 4; |
7733 | | |
7734 | | /* write channel info blob offset/length */ |
7735 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &c_olb, OLB_O_UINT16_S_UINT16, hf_smb2_channel_info_blob); |
7736 | | |
7737 | | /* flags */ |
7738 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_write_flags, ett_smb2_write_flags, f_fields, ENC_LITTLE_ENDIAN); |
7739 | 0 | offset += 4; |
7740 | | |
7741 | | /* the write channel info blob itself */ |
7742 | 0 | switch (channel) { |
7743 | 0 | case SMB2_CHANNEL_RDMA_V1: |
7744 | 0 | case SMB2_CHANNEL_RDMA_V1_INVALIDATE: |
7745 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &c_olb, si, dissect_smb2_rdma_v1_blob); |
7746 | 0 | break; |
7747 | 0 | case SMB2_CHANNEL_NONE: |
7748 | 0 | default: |
7749 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &c_olb, si, NULL); |
7750 | 0 | break; |
7751 | 0 | } |
7752 | | |
7753 | 0 | data_tvb_len=(uint32_t)tvb_captured_length_remaining(tvb, offset); |
7754 | | |
7755 | | /* data or namedpipe ?*/ |
7756 | 0 | if (length) { |
7757 | 0 | int oldoffset = offset; |
7758 | 0 | smb2_pipe_set_file_id(pinfo, si); |
7759 | 0 | offset = dissect_file_data_smb2_pipe(tvb, pinfo, tree, offset, length, si->top_tree, si); |
7760 | 0 | if (offset != oldoffset) { |
7761 | | /* managed to dissect pipe data */ |
7762 | 0 | goto out; |
7763 | 0 | } |
7764 | 0 | } |
7765 | | |
7766 | | /* just ordinary data */ |
7767 | 0 | proto_tree_add_item(tree, hf_smb2_write_data, tvb, offset, length, ENC_NA); |
7768 | |
|
7769 | 0 | offset += MIN(length,(uint32_t)tvb_captured_length_remaining(tvb, offset)); |
7770 | |
|
7771 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &c_olb); |
7772 | |
|
7773 | 0 | out: |
7774 | 0 | if (have_tap_listener(smb2_eo_tap) && (data_tvb_len == length)) { |
7775 | 0 | if (si->saved && si->eo_file_info) { /* without this data we don't know which file this belongs to */ |
7776 | 0 | feed_eo_smb2(tvb,pinfo,si,dataoffset,length,off); |
7777 | 0 | } |
7778 | 0 | } |
7779 | |
|
7780 | 0 | return offset; |
7781 | 0 | } |
7782 | | |
7783 | | |
7784 | | static int |
7785 | | dissect_smb2_write_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_) |
7786 | 0 | { |
7787 | 0 | bool continue_dissection; |
7788 | 0 | proto_tree *tag_tree = NULL; |
7789 | 0 | proto_item *tag_item = NULL; |
7790 | 0 | proto_item *item = NULL; |
7791 | 0 | proto_tree *which_tree = NULL; |
7792 | | |
7793 | |
|
7794 | 0 | switch (si->status) { |
7795 | | /* buffer code */ |
7796 | 0 | case 0x00000000: offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); break; |
7797 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
7798 | 0 | if (!continue_dissection) return offset; |
7799 | 0 | } |
7800 | | |
7801 | | /* reserved */ |
7802 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
7803 | 0 | offset += 2; |
7804 | | |
7805 | | /* count */ |
7806 | 0 | proto_tree_add_item(tree, hf_smb2_write_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
7807 | 0 | offset += 4; |
7808 | | |
7809 | | /* remaining, must be set to 0 */ |
7810 | 0 | proto_tree_add_item(tree, hf_smb2_write_remaining, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
7811 | 0 | offset += 4; |
7812 | | |
7813 | | /* write channel info offset */ |
7814 | 0 | proto_tree_add_item(tree, hf_smb2_channel_info_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
7815 | 0 | offset += 2; |
7816 | | |
7817 | | /* write channel info length */ |
7818 | 0 | proto_tree_add_item(tree, hf_smb2_channel_info_length, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
7819 | 0 | offset += 2; |
7820 | |
|
7821 | 0 | if (pinfo->fd->visited) { |
7822 | 0 | if (si->file && si->file->name) { |
7823 | 0 | if (strcmp(si->file->name, "") == 0) |
7824 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
7825 | 0 | tag_item = proto_tree_add_string(tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
7826 | 0 | tag_tree = proto_item_add_subtree(tag_item, ett_smb2_fid_str); |
7827 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
7828 | 0 | which_tree = tag_tree; |
7829 | 0 | } else { |
7830 | 0 | which_tree = tree; |
7831 | 0 | } |
7832 | 0 | if (si->saved) { |
7833 | 0 | item = proto_tree_add_guid(which_tree, hf_smb2_fid, tvb, 0, 0, (e_guid_t *)&si->saved->uuid_fid); |
7834 | 0 | proto_item_set_generated(item); |
7835 | 0 | } |
7836 | 0 | if (si->saved && si->saved->fid_hash) { |
7837 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
7838 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
7839 | 0 | proto_item_set_generated(item); |
7840 | 0 | } |
7841 | 0 | if (si->file && si->file->frame_beg > 0 && si->file->frame_beg < UINT32_MAX) { |
7842 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
7843 | 0 | si->file->frame_beg); |
7844 | 0 | proto_item_set_generated(item); |
7845 | 0 | } else { |
7846 | 0 | if (si->saved && si->saved->frame_beg > 0 && si->saved->frame_beg < UINT32_MAX) { |
7847 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
7848 | 0 | si->saved->frame_beg); |
7849 | 0 | proto_item_set_generated(item); |
7850 | 0 | } |
7851 | 0 | } |
7852 | 0 | if (si->file && si->file->frame_end > 0 && si->file->frame_end < UINT32_MAX) { |
7853 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
7854 | 0 | si->file->frame_end); |
7855 | 0 | proto_item_set_generated(item); |
7856 | 0 | } else { |
7857 | 0 | if (si->saved && si->saved->frame_end > 0 && si->saved->frame_end < UINT32_MAX) { |
7858 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
7859 | 0 | si->saved->frame_end); |
7860 | 0 | proto_item_set_generated(item); |
7861 | 0 | } |
7862 | 0 | } |
7863 | 0 | } |
7864 | |
|
7865 | 0 | return offset; |
7866 | 0 | } |
7867 | | |
7868 | | /* The STORAGE_OFFLOAD_TOKEN is used for "Offload Data Transfer" (ODX) operations, |
7869 | | including FSCTL_OFFLOAD_READ, FSCTL_OFFLOAD_WRITE. Ref: MS-FSCC 2.3.79 |
7870 | | Note: Unlike most of SMB2, the token fields are BIG-endian! */ |
7871 | | static int |
7872 | | dissect_smb2_STORAGE_OFFLOAD_TOKEN(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
7873 | 0 | { |
7874 | 0 | proto_tree *sub_tree; |
7875 | 0 | proto_item *sub_item; |
7876 | 0 | uint32_t idlen = 0; |
7877 | 0 | uint32_t idtype = 0; |
7878 | |
|
7879 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, 512, ett_smb2_fsctl_odx_token, &sub_item, "Token"); |
7880 | |
|
7881 | 0 | proto_tree_add_item_ret_uint(sub_tree, hf_smb2_fsctl_odx_token_type, tvb, offset, 4, ENC_BIG_ENDIAN, &idtype); |
7882 | 0 | offset += 4; |
7883 | |
|
7884 | 0 | proto_item_append_text(sub_item, " (IdType 0x%x)", idtype); |
7885 | | |
7886 | | /* reserved */ |
7887 | 0 | proto_tree_add_item(sub_tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
7888 | 0 | offset += 2; |
7889 | | |
7890 | | /* TokenIdLength */ |
7891 | 0 | proto_tree_add_item_ret_uint(sub_tree, hf_smb2_fsctl_odx_token_idlen, tvb, offset, 2, ENC_BIG_ENDIAN, &idlen); |
7892 | 0 | offset += 2; |
7893 | | |
7894 | | /* idlen is what the server says is the "meaningful" part of the token. |
7895 | | However, token ID is always 504 bytes */ |
7896 | 0 | proto_tree_add_bytes_format_value(sub_tree, hf_smb2_fsctl_odx_token_idraw, tvb, |
7897 | 0 | offset, idlen, NULL, "Opaque Data"); |
7898 | 0 | offset += 504; |
7899 | |
|
7900 | 0 | return (offset); |
7901 | 0 | } |
7902 | | |
7903 | | /* MS-FSCC 2.3.77, 2.3.78 */ |
7904 | | static void |
7905 | | dissect_smb2_FSCTL_OFFLOAD_READ(tvbuff_t *tvb, |
7906 | | packet_info *pinfo _U_, |
7907 | | proto_tree *tree, |
7908 | | int offset, |
7909 | | bool in) |
7910 | 0 | { |
7911 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_odx_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
7912 | 0 | offset += 4; |
7913 | |
|
7914 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_odx_flags, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
7915 | 0 | offset += 4; |
7916 | |
|
7917 | 0 | if (in) { |
7918 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_odx_token_ttl, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
7919 | 0 | offset += 4; |
7920 | |
|
7921 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
7922 | 0 | offset += 4; |
7923 | |
|
7924 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_odx_file_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
7925 | 0 | offset += 8; |
7926 | |
|
7927 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_odx_copy_length, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
7928 | | /* offset += 8; */ |
7929 | 0 | } else { |
7930 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_odx_xfer_length, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
7931 | 0 | offset += 8; |
7932 | |
|
7933 | 0 | (void) dissect_smb2_STORAGE_OFFLOAD_TOKEN(tvb, pinfo, tree, offset); |
7934 | 0 | } |
7935 | 0 | } |
7936 | | |
7937 | | /* MS-FSCC 2.3.80, 2.3.81 */ |
7938 | | static void |
7939 | | dissect_smb2_FSCTL_OFFLOAD_WRITE(tvbuff_t *tvb, |
7940 | | packet_info *pinfo _U_, |
7941 | | proto_tree *tree, |
7942 | | int offset, |
7943 | | bool in) |
7944 | 0 | { |
7945 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_odx_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
7946 | 0 | offset += 4; |
7947 | |
|
7948 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_odx_flags, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
7949 | 0 | offset += 4; |
7950 | |
|
7951 | 0 | if (in) { |
7952 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_odx_file_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
7953 | 0 | offset += 8; |
7954 | |
|
7955 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_odx_copy_length, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
7956 | 0 | offset += 8; |
7957 | |
|
7958 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_odx_token_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
7959 | 0 | offset += 8; |
7960 | |
|
7961 | 0 | dissect_smb2_STORAGE_OFFLOAD_TOKEN(tvb, pinfo, tree, offset); |
7962 | |
|
7963 | 0 | } else { |
7964 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_odx_xfer_length, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
7965 | | /* offset += 8; */ |
7966 | 0 | } |
7967 | 0 | } |
7968 | | |
7969 | | static void |
7970 | | dissect_smb2_FSCTL_PIPE_TRANSCEIVE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *top_tree, bool data_in _U_, void *data) |
7971 | 0 | { |
7972 | 0 | dissect_file_data_smb2_pipe(tvb, pinfo, tree, offset, tvb_captured_length_remaining(tvb, offset), top_tree, data); |
7973 | 0 | } |
7974 | | |
7975 | | static void |
7976 | | dissect_smb2_FSCTL_PIPE_WAIT(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, int offset, proto_tree *top_tree, bool data_in _U_) |
7977 | 0 | { |
7978 | 0 | int timeout_offset; |
7979 | 0 | uint32_t name_len; |
7980 | 0 | uint8_t timeout_specified; |
7981 | 0 | char *display_string; |
7982 | | |
7983 | | /* Timeout */ |
7984 | 0 | timeout_offset = offset; |
7985 | 0 | offset += 8; |
7986 | | |
7987 | | /* Name length */ |
7988 | | /* XXX - put the name length into the tree */ |
7989 | 0 | name_len = tvb_get_letohl(tvb, offset); |
7990 | 0 | offset += 4; |
7991 | | |
7992 | | /* Timeout specified */ |
7993 | 0 | timeout_specified = tvb_get_uint8(tvb, offset); |
7994 | 0 | if (timeout_specified) { |
7995 | 0 | proto_tree_add_item(top_tree, hf_smb2_fsctl_pipe_wait_timeout, |
7996 | 0 | tvb, timeout_offset, 8, ENC_LITTLE_ENDIAN); |
7997 | 0 | } |
7998 | 0 | offset += 1; |
7999 | | |
8000 | | /* Padding */ |
8001 | 0 | offset += 1; |
8002 | | |
8003 | | /* Name */ |
8004 | 0 | proto_tree_add_item_ret_display_string(top_tree, hf_smb2_fsctl_pipe_wait_name, |
8005 | 0 | tvb, offset, name_len, ENC_UTF_16|ENC_LITTLE_ENDIAN, |
8006 | 0 | pinfo->pool, &display_string); |
8007 | |
|
8008 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " Pipe: %s", display_string); |
8009 | 0 | } |
8010 | | |
8011 | | static int |
8012 | | dissect_smb2_FSCTL_SET_SPARSE(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
8013 | 0 | { |
8014 | | |
8015 | | /* There is no out data */ |
8016 | 0 | if (!data_in) { |
8017 | 0 | return offset; |
8018 | 0 | } |
8019 | | |
8020 | | /* sparse flag (optional) */ |
8021 | 0 | if (tvb_reported_length_remaining(tvb, offset) >= 1) { |
8022 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_sparse_flag, tvb, offset, 1, ENC_NA); |
8023 | 0 | offset += 1; |
8024 | 0 | } |
8025 | |
|
8026 | 0 | return offset; |
8027 | 0 | } |
8028 | | |
8029 | | static int |
8030 | | dissect_smb2_FSCTL_SET_ZERO_DATA(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
8031 | 0 | { |
8032 | 0 | proto_tree *sub_tree; |
8033 | 0 | proto_item *sub_item; |
8034 | | |
8035 | | /* There is no out data */ |
8036 | 0 | if (!data_in) { |
8037 | 0 | return offset; |
8038 | 0 | } |
8039 | | |
8040 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, 16, ett_smb2_fsctl_range_data, &sub_item, "Range"); |
8041 | |
|
8042 | 0 | proto_tree_add_item(sub_tree, hf_smb2_fsctl_range_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8043 | 0 | offset += 8; |
8044 | |
|
8045 | 0 | proto_tree_add_item(sub_tree, hf_smb2_fsctl_range_length, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8046 | 0 | offset += 8; |
8047 | |
|
8048 | 0 | return offset; |
8049 | 0 | } |
8050 | | |
8051 | | static void |
8052 | | dissect_smb2_FSCTL_QUERY_ALLOCATED_RANGES(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int offset _U_, bool data_in) |
8053 | 0 | { |
8054 | 0 | proto_tree *sub_tree; |
8055 | 0 | proto_item *sub_item; |
8056 | |
|
8057 | 0 | if (data_in) { |
8058 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, 16, ett_smb2_fsctl_range_data, &sub_item, "Range"); |
8059 | |
|
8060 | 0 | proto_tree_add_item(sub_tree, hf_smb2_fsctl_range_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8061 | 0 | offset += 8; |
8062 | |
|
8063 | 0 | proto_tree_add_item(sub_tree, hf_smb2_fsctl_range_length, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8064 | 0 | offset += 8; |
8065 | 0 | } else { |
8066 | | /* Zero or more allocated ranges may be reported. */ |
8067 | 0 | while (tvb_reported_length_remaining(tvb, offset) >= 16) { |
8068 | |
|
8069 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, 16, ett_smb2_fsctl_range_data, &sub_item, "Range"); |
8070 | |
|
8071 | 0 | proto_tree_add_item(sub_tree, hf_smb2_fsctl_range_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8072 | 0 | offset += 8; |
8073 | |
|
8074 | 0 | proto_tree_add_item(sub_tree, hf_smb2_fsctl_range_length, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8075 | 0 | offset += 8; |
8076 | 0 | } |
8077 | 0 | } |
8078 | 0 | } |
8079 | | |
8080 | | |
8081 | | static void |
8082 | | dissect_smb2_FSCTL_QUERY_FILE_REGIONS(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int offset _U_, bool data_in) |
8083 | 0 | { |
8084 | |
|
8085 | 0 | if (data_in) { |
8086 | 0 | proto_tree_add_item(tree, hf_smb2_file_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8087 | 0 | offset += 8; |
8088 | |
|
8089 | 0 | proto_tree_add_item(tree, hf_smb2_qfr_length, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8090 | 0 | offset += 8; |
8091 | |
|
8092 | 0 | proto_tree_add_item(tree, hf_smb2_qfr_usage, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8093 | 0 | offset += 4; |
8094 | |
|
8095 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
8096 | 0 | offset += 4; |
8097 | 0 | } else { |
8098 | 0 | uint32_t entry_count = 0; |
8099 | |
|
8100 | 0 | proto_tree_add_item(tree, hf_smb2_qfr_flags, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8101 | 0 | offset += 4; |
8102 | |
|
8103 | 0 | proto_tree_add_item(tree, hf_smb2_qfr_total_region_entry_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8104 | 0 | offset += 4; |
8105 | |
|
8106 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_qfr_region_entry_count, tvb, offset, 4, ENC_LITTLE_ENDIAN, &entry_count); |
8107 | 0 | offset += 4; |
8108 | |
|
8109 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
8110 | 0 | offset += 4; |
8111 | |
|
8112 | 0 | while (entry_count && tvb_reported_length_remaining(tvb, offset)) { |
8113 | 0 | proto_tree *sub_tree; |
8114 | 0 | proto_item *sub_item; |
8115 | |
|
8116 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, 24, ett_qfr_entry, &sub_item, "Entry"); |
8117 | |
|
8118 | 0 | proto_tree_add_item(sub_tree, hf_smb2_file_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8119 | 0 | offset += 8; |
8120 | |
|
8121 | 0 | proto_tree_add_item(sub_tree, hf_smb2_qfr_length, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8122 | 0 | offset += 8; |
8123 | |
|
8124 | 0 | proto_tree_add_item(sub_tree, hf_smb2_qfr_usage, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8125 | 0 | offset += 4; |
8126 | |
|
8127 | 0 | proto_tree_add_item(sub_tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
8128 | 0 | offset += 4; |
8129 | |
|
8130 | 0 | entry_count--; |
8131 | 0 | } |
8132 | 0 | } |
8133 | 0 | } |
8134 | | |
8135 | | static void |
8136 | | dissect_smb2_FSCTL_LMR_REQUEST_RESILIENCY(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
8137 | 0 | { |
8138 | | /* There is no out data */ |
8139 | 0 | if (!data_in) { |
8140 | 0 | return; |
8141 | 0 | } |
8142 | | |
8143 | | /* timeout */ |
8144 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_resiliency_timeout, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8145 | 0 | offset += 4; |
8146 | | |
8147 | | /* reserved */ |
8148 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_resiliency_reserved, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8149 | 0 | } |
8150 | | |
8151 | | static void |
8152 | | dissect_smb2_FSCTL_QUERY_SHARED_VIRTUAL_DISK_SUPPORT(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
8153 | 0 | { |
8154 | | /* There is no in data */ |
8155 | 0 | if (data_in) { |
8156 | 0 | return; |
8157 | 0 | } |
8158 | | |
8159 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_shared_virtual_disk_support, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8160 | 0 | offset += 4; |
8161 | |
|
8162 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_shared_virtual_disk_handle_state, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8163 | 0 | } |
8164 | | |
8165 | 14 | #define STORAGE_QOS_CONTROL_FLAG_SET_LOGICAL_FLOW_ID 0x00000001 |
8166 | 14 | #define STORAGE_QOS_CONTROL_FLAG_SET_POLICY 0x00000002 |
8167 | 14 | #define STORAGE_QOS_CONTROL_FLAG_PROBE_POLICY 0x00000004 |
8168 | 14 | #define STORAGE_QOS_CONTROL_FLAG_GET_STATUS 0x00000008 |
8169 | 14 | #define STORAGE_QOS_CONTROL_FLAG_UPDATE_COUNTERS 0x00000010 |
8170 | | |
8171 | | static const value_string smb2_ioctl_sqos_protocol_version_vals[] = { |
8172 | | { 0x0100, "Storage QoS Protocol Version 1.0" }, |
8173 | | { 0x0101, "Storage QoS Protocol Version 1.1" }, |
8174 | | { 0, NULL } |
8175 | | }; |
8176 | | |
8177 | | static const value_string smb2_ioctl_sqos_status_vals[] = { |
8178 | | { 0x00, "StorageQoSStatusOk" }, |
8179 | | { 0x01, "StorageQoSStatusInsufficientThroughput" }, |
8180 | | { 0x02, "StorageQoSUnknownPolicyId" }, |
8181 | | { 0x04, "StorageQoSStatusConfigurationMismatch" }, |
8182 | | { 0x05, "StorageQoSStatusNotAvailable" }, |
8183 | | { 0, NULL } |
8184 | | }; |
8185 | | |
8186 | | static void |
8187 | | dissect_smb2_FSCTL_STORAGE_QOS_CONTROL(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, bool data_in) |
8188 | 0 | { |
8189 | 0 | static int * const operations[] = { |
8190 | 0 | &hf_smb2_ioctl_sqos_op_set_logical_flow_id, |
8191 | 0 | &hf_smb2_ioctl_sqos_op_set_policy, |
8192 | 0 | &hf_smb2_ioctl_sqos_op_probe_policy, |
8193 | 0 | &hf_smb2_ioctl_sqos_op_get_status, |
8194 | 0 | &hf_smb2_ioctl_sqos_op_update_counters, |
8195 | 0 | NULL |
8196 | 0 | }; |
8197 | |
|
8198 | 0 | int proto_ver; |
8199 | | |
8200 | | /* Both request and reply have the same common header */ |
8201 | |
|
8202 | 0 | proto_ver = tvb_get_letohs(tvb, offset); |
8203 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_protocol_version, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8204 | 0 | offset += 2; |
8205 | |
|
8206 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_reserved, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8207 | 0 | offset += 2; |
8208 | |
|
8209 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_ioctl_sqos_options, |
8210 | 0 | ett_smb2_ioctl_sqos_opeations, operations, ENC_LITTLE_ENDIAN); |
8211 | 0 | offset += 4; |
8212 | |
|
8213 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_logical_flow_id, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
8214 | 0 | offset += 16; |
8215 | |
|
8216 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_policy_id, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
8217 | 0 | offset += 16; |
8218 | |
|
8219 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_initiator_id, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
8220 | 0 | offset += 16; |
8221 | |
|
8222 | 0 | if (data_in) { |
8223 | 0 | offset_length_buffer_t host_olb, node_olb; |
8224 | |
|
8225 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_limit, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8226 | 0 | offset += 8; |
8227 | |
|
8228 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_reservation, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8229 | 0 | offset += 8; |
8230 | |
|
8231 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &host_olb, OLB_O_UINT16_S_UINT16, hf_smb2_ioctl_sqos_initiator_name); |
8232 | |
|
8233 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &node_olb, OLB_O_UINT16_S_UINT16, hf_smb2_ioctl_sqos_initiator_node_name); |
8234 | |
|
8235 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_io_count_increment, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8236 | 0 | offset += 8; |
8237 | |
|
8238 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_normalized_io_count_increment, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8239 | 0 | offset += 8; |
8240 | |
|
8241 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_latency_increment, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8242 | 0 | offset += 8; |
8243 | |
|
8244 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_lower_latency_increment, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8245 | 0 | offset += 8; |
8246 | |
|
8247 | 0 | if (proto_ver > 0x0100) { |
8248 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_bandwidth_limit, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8249 | 0 | offset += 8; |
8250 | |
|
8251 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_kilobyte_count_increment, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8252 | | /*offset += 8;*/ |
8253 | 0 | } |
8254 | |
|
8255 | 0 | dissect_smb2_olb_string(pinfo, tree, tvb, &host_olb, OLB_TYPE_UNICODE_STRING); |
8256 | |
|
8257 | 0 | dissect_smb2_olb_string(pinfo, tree, tvb, &node_olb, OLB_TYPE_UNICODE_STRING); |
8258 | 0 | } else { |
8259 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_time_to_live, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8260 | 0 | offset += 4; |
8261 | |
|
8262 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8263 | 0 | offset += 4; |
8264 | |
|
8265 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_maximum_io_rate, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8266 | 0 | offset += 8; |
8267 | |
|
8268 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_minimum_io_rate, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8269 | 0 | offset += 8; |
8270 | |
|
8271 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_base_io_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8272 | 0 | offset += 4; |
8273 | |
|
8274 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_reserved2, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8275 | |
|
8276 | 0 | if (proto_ver > 0x0100) { |
8277 | 0 | offset += 4; |
8278 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_sqos_maximum_bandwidth, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8279 | 0 | } |
8280 | 0 | } |
8281 | 0 | } |
8282 | | |
8283 | | static int |
8284 | | dissect_windows_sockaddr_in(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, int len) |
8285 | 0 | { |
8286 | 0 | proto_item *sub_item; |
8287 | 0 | proto_tree *sub_tree; |
8288 | 0 | proto_item *parent_item; |
8289 | |
|
8290 | 0 | if (len == -1) { |
8291 | 0 | len = 8; |
8292 | 0 | } |
8293 | |
|
8294 | 0 | sub_tree = proto_tree_add_subtree(parent_tree, tvb, offset, len, ett_windows_sockaddr, &sub_item, "Socket Address"); |
8295 | 0 | parent_item = proto_tree_get_parent(parent_tree); |
8296 | | |
8297 | | /* family */ |
8298 | 0 | proto_tree_add_item(sub_tree, hf_windows_sockaddr_family, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8299 | 0 | offset += 2; |
8300 | | |
8301 | | /* port */ |
8302 | 0 | proto_tree_add_item(sub_tree, hf_windows_sockaddr_port, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8303 | 0 | offset += 2; |
8304 | | |
8305 | | /* IPv4 address */ |
8306 | 0 | proto_tree_add_item(sub_tree, hf_windows_sockaddr_in_addr, tvb, offset, 4, ENC_BIG_ENDIAN); |
8307 | 0 | proto_item_append_text(sub_item, ", IPv4: %s", tvb_ip_to_str(pinfo->pool, tvb, offset)); |
8308 | 0 | proto_item_append_text(parent_item, ", IPv4: %s", tvb_ip_to_str(pinfo->pool, tvb, offset)); |
8309 | 0 | offset += 4; |
8310 | 0 | return offset; |
8311 | 0 | } |
8312 | | |
8313 | | static int |
8314 | | dissect_windows_sockaddr_in6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, int len) |
8315 | 0 | { |
8316 | 0 | proto_item *sub_item; |
8317 | 0 | proto_tree *sub_tree; |
8318 | 0 | proto_item *parent_item; |
8319 | |
|
8320 | 0 | if (len == -1) { |
8321 | 0 | len = 26; |
8322 | 0 | } |
8323 | |
|
8324 | 0 | sub_tree = proto_tree_add_subtree(parent_tree, tvb, offset, len, ett_windows_sockaddr, &sub_item, "Socket Address"); |
8325 | 0 | parent_item = proto_tree_get_parent(parent_tree); |
8326 | | |
8327 | | /* family */ |
8328 | 0 | proto_tree_add_item(sub_tree, hf_windows_sockaddr_family, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8329 | 0 | offset += 2; |
8330 | | |
8331 | | /* port */ |
8332 | 0 | proto_tree_add_item(sub_tree, hf_windows_sockaddr_port, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8333 | 0 | offset += 2; |
8334 | | |
8335 | | /* sin6_flowinfo */ |
8336 | 0 | proto_tree_add_item(sub_tree, hf_windows_sockaddr_in6_flowinfo, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8337 | 0 | offset += 4; |
8338 | | |
8339 | | /* IPv6 address */ |
8340 | 0 | proto_tree_add_item(sub_tree, hf_windows_sockaddr_in6_addr, tvb, offset, 16, ENC_NA); |
8341 | 0 | proto_item_append_text(sub_item, ", IPv6: %s", tvb_ip6_to_str(pinfo->pool, tvb, offset)); |
8342 | 0 | proto_item_append_text(parent_item, ", IPv6: %s", tvb_ip6_to_str(pinfo->pool, tvb, offset)); |
8343 | 0 | offset += 16; |
8344 | | |
8345 | | /* sin6_scope_id */ |
8346 | 0 | proto_tree_add_item(sub_tree, hf_windows_sockaddr_in6_scope_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8347 | 0 | offset += 2; |
8348 | |
|
8349 | 0 | return offset; |
8350 | 0 | } |
8351 | | |
8352 | | static int |
8353 | | dissect_windows_sockaddr_storage(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, int len) |
8354 | 0 | { |
8355 | 0 | proto_item *sub_item; |
8356 | 0 | proto_tree *sub_tree; |
8357 | 0 | proto_item *parent_item; |
8358 | 0 | uint16_t family; |
8359 | |
|
8360 | 0 | family = tvb_get_letohs(tvb, offset); |
8361 | 0 | switch (family) { |
8362 | 0 | case WINSOCK_AF_INET: |
8363 | 0 | return dissect_windows_sockaddr_in(tvb, pinfo, parent_tree, offset, len); |
8364 | 0 | case WINSOCK_AF_INET6: |
8365 | 0 | return dissect_windows_sockaddr_in6(tvb, pinfo, parent_tree, offset, len); |
8366 | 0 | } |
8367 | | |
8368 | 0 | sub_tree = proto_tree_add_subtree(parent_tree, tvb, offset, len, ett_windows_sockaddr, &sub_item, "Socket Address"); |
8369 | 0 | parent_item = proto_tree_get_parent(parent_tree); |
8370 | | |
8371 | | /* ss_family */ |
8372 | 0 | proto_tree_add_item(sub_tree, hf_windows_sockaddr_family, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8373 | 0 | proto_item_append_text(sub_item, ", Family: %d (0x%04x)", family, family); |
8374 | 0 | proto_item_append_text(parent_item, ", Family: %d (0x%04x)", family, family); |
8375 | 0 | return offset + len; |
8376 | 0 | } |
8377 | | |
8378 | 14 | #define NETWORK_INTERFACE_CAP_RSS 0x00000001 |
8379 | 14 | #define NETWORK_INTERFACE_CAP_RDMA 0x00000002 |
8380 | | |
8381 | | static void |
8382 | | // NOLINTNEXTLINE(misc-no-recursion) |
8383 | | dissect_smb2_NETWORK_INTERFACE_INFO(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) |
8384 | 0 | { |
8385 | 0 | uint32_t next_offset; |
8386 | 0 | int offset = 0; |
8387 | 0 | int len = -1; |
8388 | 0 | proto_item *sub_item; |
8389 | 0 | proto_tree *sub_tree; |
8390 | 0 | proto_item *item = NULL; |
8391 | 0 | uint32_t capabilities; |
8392 | 0 | uint64_t link_speed; |
8393 | 0 | float val = 0; |
8394 | 0 | const char *unit = NULL; |
8395 | 0 | static int * const capability_flags[] = { |
8396 | 0 | &hf_smb2_ioctl_network_interface_capability_rdma, |
8397 | 0 | &hf_smb2_ioctl_network_interface_capability_rss, |
8398 | 0 | NULL |
8399 | 0 | }; |
8400 | |
|
8401 | 0 | next_offset = tvb_get_letohl(tvb, offset); |
8402 | 0 | if (next_offset) { |
8403 | 0 | len = next_offset; |
8404 | 0 | } |
8405 | |
|
8406 | 0 | sub_tree = proto_tree_add_subtree(parent_tree, tvb, offset, len, ett_smb2_ioctl_network_interface, &sub_item, "Network Interface"); |
8407 | 0 | item = proto_tree_get_parent(parent_tree); |
8408 | | |
8409 | | /* next offset */ |
8410 | 0 | proto_tree_add_item(sub_tree, hf_smb2_ioctl_network_interface_next_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8411 | 0 | offset += 4; |
8412 | | |
8413 | | /* interface index */ |
8414 | 0 | proto_tree_add_item(sub_tree, hf_smb2_ioctl_network_interface_index, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8415 | 0 | offset += 4; |
8416 | | |
8417 | | /* capabilities */ |
8418 | 0 | capabilities = tvb_get_letohl(tvb, offset); |
8419 | 0 | proto_tree_add_bitmask(sub_tree, tvb, offset, hf_smb2_ioctl_network_interface_capabilities, ett_smb2_ioctl_network_interface_capabilities, capability_flags, ENC_LITTLE_ENDIAN); |
8420 | |
|
8421 | 0 | if (capabilities != 0) { |
8422 | 0 | proto_item_append_text(item, "%s%s", |
8423 | 0 | (capabilities & NETWORK_INTERFACE_CAP_RDMA)?", RDMA":"", |
8424 | 0 | (capabilities & NETWORK_INTERFACE_CAP_RSS)?", RSS":""); |
8425 | 0 | proto_item_append_text(sub_item, "%s%s", |
8426 | 0 | (capabilities & NETWORK_INTERFACE_CAP_RDMA)?", RDMA":"", |
8427 | 0 | (capabilities & NETWORK_INTERFACE_CAP_RSS)?", RSS":""); |
8428 | 0 | } |
8429 | 0 | offset += 4; |
8430 | | |
8431 | | /* reserved (was rss queue count for release 38 and 39) */ |
8432 | 0 | proto_tree_add_item(sub_tree, hf_smb2_ioctl_network_interface_reserved, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8433 | 0 | offset += 4; |
8434 | | |
8435 | | /* link speed */ |
8436 | 0 | link_speed = tvb_get_letoh64(tvb, offset); |
8437 | 0 | item = proto_tree_add_item(sub_tree, hf_smb2_ioctl_network_interface_link_speed, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8438 | 0 | if (link_speed >= (1000*1000*1000)) { |
8439 | 0 | val = (float)(link_speed / (1000*1000*1000)); |
8440 | 0 | unit = "G"; |
8441 | 0 | } else if (link_speed >= (1000*1000)) { |
8442 | 0 | val = (float)(link_speed / (1000*1000)); |
8443 | 0 | unit = "M"; |
8444 | 0 | } else if (link_speed >= (1000)) { |
8445 | 0 | val = (float)(link_speed / (1000)); |
8446 | 0 | unit = "K"; |
8447 | 0 | } else { |
8448 | 0 | val = (float)(link_speed); |
8449 | 0 | unit = ""; |
8450 | 0 | } |
8451 | 0 | proto_item_append_text(item, ", %.1f %sBits/s", val, unit); |
8452 | 0 | proto_item_append_text(sub_item, ", %.1f %sBits/s", val, unit); |
8453 | |
|
8454 | 0 | offset += 8; |
8455 | | |
8456 | | /* socket address */ |
8457 | 0 | dissect_windows_sockaddr_storage(tvb, pinfo, sub_tree, offset, -1); |
8458 | |
|
8459 | 0 | if (next_offset) { |
8460 | 0 | tvbuff_t *next_tvb; |
8461 | 0 | next_tvb = tvb_new_subset_remaining(tvb, next_offset); |
8462 | | |
8463 | | /* next extra info */ |
8464 | 0 | increment_dissection_depth(pinfo); |
8465 | 0 | dissect_smb2_NETWORK_INTERFACE_INFO(next_tvb, pinfo, parent_tree); |
8466 | 0 | decrement_dissection_depth(pinfo); |
8467 | 0 | } |
8468 | 0 | } |
8469 | | |
8470 | | static void |
8471 | | dissect_smb2_FSCTL_QUERY_NETWORK_INTERFACE_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset _U_, bool data_in) |
8472 | 0 | { |
8473 | | /* There is no in data */ |
8474 | 0 | if (data_in) { |
8475 | 0 | return; |
8476 | 0 | } |
8477 | | |
8478 | 0 | dissect_smb2_NETWORK_INTERFACE_INFO(tvb, pinfo, tree); |
8479 | 0 | } |
8480 | | |
8481 | | static void |
8482 | | dissect_smb2_FSCTL_VALIDATE_NEGOTIATE_INFO_224(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset _U_, bool data_in) |
8483 | 0 | { |
8484 | | /* |
8485 | | * This is only used by Windows 8 beta |
8486 | | */ |
8487 | 0 | if (data_in) { |
8488 | | /* capabilities */ |
8489 | 0 | offset = dissect_smb2_capabilities(tree, tvb, offset); |
8490 | | |
8491 | | /* client guid */ |
8492 | 0 | proto_tree_add_item(tree, hf_smb2_client_guid, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
8493 | 0 | offset += 16; |
8494 | | |
8495 | | /* security mode, skip second byte */ |
8496 | 0 | offset = dissect_smb2_secmode(tree, tvb, offset); |
8497 | 0 | offset++; |
8498 | | |
8499 | | /* dialect */ |
8500 | 0 | proto_tree_add_item(tree, hf_smb2_dialect, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8501 | 0 | offset += 2; |
8502 | 0 | } else { |
8503 | | /* capabilities */ |
8504 | 0 | offset = dissect_smb2_capabilities(tree, tvb, offset); |
8505 | | |
8506 | | /* server guid */ |
8507 | 0 | proto_tree_add_item(tree, hf_smb2_server_guid, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
8508 | 0 | offset += 16; |
8509 | | |
8510 | | /* security mode, skip second byte */ |
8511 | 0 | offset = dissect_smb2_secmode(tree, tvb, offset); |
8512 | 0 | offset++; |
8513 | | |
8514 | | /* dialect */ |
8515 | 0 | proto_tree_add_item(tree, hf_smb2_dialect, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8516 | 0 | offset += 2; |
8517 | 0 | } |
8518 | 0 | } |
8519 | | |
8520 | | static void |
8521 | | dissect_smb2_FSCTL_VALIDATE_NEGOTIATE_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset _U_, bool data_in) |
8522 | 0 | { |
8523 | 0 | if (data_in) { |
8524 | 0 | uint16_t dc; |
8525 | | |
8526 | | /* capabilities */ |
8527 | 0 | offset = dissect_smb2_capabilities(tree, tvb, offset); |
8528 | | |
8529 | | /* client guid */ |
8530 | 0 | proto_tree_add_item(tree, hf_smb2_client_guid, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
8531 | 0 | offset += 16; |
8532 | | |
8533 | | /* security mode, skip second byte */ |
8534 | 0 | offset = dissect_smb2_secmode(tree, tvb, offset); |
8535 | 0 | offset++; |
8536 | | |
8537 | | /* dialect count */ |
8538 | 0 | dc = tvb_get_letohs(tvb, offset); |
8539 | 0 | proto_tree_add_item(tree, hf_smb2_dialect_count, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8540 | 0 | offset += 2; |
8541 | |
|
8542 | 0 | for ( ; dc>0; dc--) { |
8543 | 0 | proto_tree_add_item(tree, hf_smb2_dialect, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8544 | 0 | offset += 2; |
8545 | 0 | } |
8546 | 0 | } else { |
8547 | | /* capabilities */ |
8548 | 0 | offset = dissect_smb2_capabilities(tree, tvb, offset); |
8549 | | |
8550 | | /* server guid */ |
8551 | 0 | proto_tree_add_item(tree, hf_smb2_server_guid, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
8552 | 0 | offset += 16; |
8553 | | |
8554 | | /* security mode, skip second byte */ |
8555 | 0 | offset = dissect_smb2_secmode(tree, tvb, offset); |
8556 | 0 | offset++; |
8557 | | |
8558 | | /* dialect */ |
8559 | 0 | proto_tree_add_item(tree, hf_smb2_dialect, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8560 | 0 | offset += 2; |
8561 | 0 | } |
8562 | 0 | } |
8563 | | |
8564 | | static void |
8565 | | dissect_smb2_FSCTL_SRV_ENUMERATE_SNAPSHOTS(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
8566 | 0 | { |
8567 | 0 | uint32_t num_snapshots; |
8568 | | |
8569 | | /* There is no in data */ |
8570 | 0 | if (data_in) { |
8571 | 0 | return; |
8572 | 0 | } |
8573 | | |
8574 | | /* NumberOfSnapShots */ |
8575 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_enumerate_snapshots_num_snapshots, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8576 | 0 | offset += 4; |
8577 | | |
8578 | | /* NumberOfSnapshotsReturned */ |
8579 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_ioctl_enumerate_snapshots_num_snapshots_returned, tvb, offset, 4, ENC_LITTLE_ENDIAN, &num_snapshots); |
8580 | 0 | offset += 4; |
8581 | | |
8582 | | /* SnapShotArraySize */ |
8583 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_enumerate_snapshots_snapshot_array_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8584 | 0 | offset += 4; |
8585 | |
|
8586 | 0 | while (num_snapshots--) { |
8587 | 0 | int len; |
8588 | 0 | int old_offset = offset; |
8589 | |
|
8590 | 0 | proto_tree_add_item_ret_length(tree, hf_smb2_ioctl_enumerate_snapshots_snapshot, |
8591 | 0 | tvb, offset, -1, ENC_UTF_16|ENC_LITTLE_ENDIAN, &len); |
8592 | |
|
8593 | 0 | offset = old_offset+len; |
8594 | 0 | } |
8595 | 0 | } |
8596 | | |
8597 | | int |
8598 | | dissect_smb2_FILE_OBJECTID_BUFFER(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset) |
8599 | 0 | { |
8600 | 0 | proto_item *item = NULL; |
8601 | 0 | proto_tree *tree = NULL; |
8602 | | |
8603 | | /* FILE_OBJECTID_BUFFER */ |
8604 | 0 | if (parent_tree) { |
8605 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_FILE_OBJECTID_BUFFER, tvb, offset, 64, ENC_NA); |
8606 | 0 | tree = proto_item_add_subtree(item, ett_smb2_FILE_OBJECTID_BUFFER); |
8607 | 0 | } |
8608 | | |
8609 | | /* Object ID */ |
8610 | 0 | proto_tree_add_item(tree, hf_smb2_object_id, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
8611 | 0 | offset += 16; |
8612 | | |
8613 | | /* Birth Volume ID */ |
8614 | 0 | proto_tree_add_item(tree, hf_smb2_birth_volume_id, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
8615 | 0 | offset += 16; |
8616 | | |
8617 | | /* Birth Object ID */ |
8618 | 0 | proto_tree_add_item(tree, hf_smb2_birth_object_id, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
8619 | 0 | offset += 16; |
8620 | | |
8621 | | /* Domain ID */ |
8622 | 0 | proto_tree_add_item(tree, hf_smb2_domain_id, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
8623 | 0 | offset += 16; |
8624 | |
|
8625 | 0 | return offset; |
8626 | 0 | } |
8627 | | |
8628 | | static int |
8629 | | dissect_smb2_FSCTL_CREATE_OR_GET_OBJECT_ID(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
8630 | 0 | { |
8631 | | |
8632 | | /* There is no in data */ |
8633 | 0 | if (data_in) { |
8634 | 0 | return offset; |
8635 | 0 | } |
8636 | | |
8637 | | /* FILE_OBJECTID_BUFFER */ |
8638 | 0 | offset = dissect_smb2_FILE_OBJECTID_BUFFER(tvb, pinfo, tree, offset); |
8639 | |
|
8640 | 0 | return offset; |
8641 | 0 | } |
8642 | | |
8643 | | static int |
8644 | | dissect_smb2_FSCTL_GET_COMPRESSION(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
8645 | 0 | { |
8646 | | |
8647 | | /* There is no in data */ |
8648 | 0 | if (data_in) { |
8649 | 0 | return offset; |
8650 | 0 | } |
8651 | | |
8652 | | /* compression format */ |
8653 | 0 | proto_tree_add_item(tree, hf_smb2_compression_format, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8654 | 0 | offset += 2; |
8655 | |
|
8656 | 0 | return offset; |
8657 | 0 | } |
8658 | | |
8659 | | static int |
8660 | | dissect_smb2_FSCTL_SET_COMPRESSION(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
8661 | 0 | { |
8662 | | |
8663 | | /* There is no out data */ |
8664 | 0 | if (!data_in) { |
8665 | 0 | return offset; |
8666 | 0 | } |
8667 | | |
8668 | | /* compression format */ |
8669 | 0 | proto_tree_add_item(tree, hf_smb2_compression_format, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8670 | 0 | offset += 2; |
8671 | |
|
8672 | 0 | return offset; |
8673 | 0 | } |
8674 | | |
8675 | | static int |
8676 | | dissect_smb2_FSCTL_GET_INTEGRITY_INFORMATION(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in _U_) |
8677 | 0 | { |
8678 | 0 | static int * const integrity_flags[] = { |
8679 | 0 | &hf_smb2_integrity_flags_enforcement_off, |
8680 | 0 | NULL |
8681 | 0 | }; |
8682 | |
|
8683 | 0 | proto_tree_add_item(tree, hf_smb2_checksum_algorithm, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8684 | 0 | offset += 2; |
8685 | |
|
8686 | 0 | proto_tree_add_item(tree, hf_smb2_integrity_reserved, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8687 | 0 | offset += 2; |
8688 | |
|
8689 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_integrity_flags, ett_smb2_integrity_flags, integrity_flags, ENC_LITTLE_ENDIAN); |
8690 | 0 | offset += 4; |
8691 | |
|
8692 | 0 | proto_tree_add_item(tree, hf_smb2_integrity_crc_chunk_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8693 | 0 | offset += 4; |
8694 | |
|
8695 | 0 | proto_tree_add_item(tree, hf_smb2_integrity_cluster_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8696 | 0 | offset += 4; |
8697 | |
|
8698 | 0 | return offset; |
8699 | 0 | } |
8700 | | |
8701 | | static int |
8702 | | dissect_smb2_FSCTL_SET_INTEGRITY_INFORMATION(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
8703 | 0 | { |
8704 | 0 | static int * const integrity_flags[] = { |
8705 | 0 | &hf_smb2_integrity_flags_enforcement_off, |
8706 | 0 | NULL |
8707 | 0 | }; |
8708 | | |
8709 | | /* There is no out data */ |
8710 | 0 | if (!data_in) { |
8711 | 0 | return offset; |
8712 | 0 | } |
8713 | | |
8714 | 0 | proto_tree_add_item(tree, hf_smb2_checksum_algorithm, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8715 | 0 | offset += 2; |
8716 | |
|
8717 | 0 | proto_tree_add_item(tree, hf_smb2_integrity_reserved, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8718 | 0 | offset += 2; |
8719 | |
|
8720 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_integrity_flags, ett_smb2_integrity_flags, integrity_flags, ENC_LITTLE_ENDIAN); |
8721 | 0 | offset += 4; |
8722 | |
|
8723 | 0 | return offset; |
8724 | 0 | } |
8725 | | |
8726 | | static int |
8727 | | dissect_smb2_FSCTL_SET_INTEGRITY_INFORMATION_EX(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
8728 | 0 | { |
8729 | 0 | static int * const integrity_flags[] = { |
8730 | 0 | &hf_smb2_integrity_flags_enforcement_off, |
8731 | 0 | NULL |
8732 | 0 | }; |
8733 | |
|
8734 | 0 | if (!data_in) { |
8735 | 0 | return offset; |
8736 | 0 | } |
8737 | | |
8738 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_infoex_enable_integrity, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
8739 | 0 | offset += 1; |
8740 | |
|
8741 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_infoex_keep_integrity_state, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
8742 | 0 | offset += 1; |
8743 | |
|
8744 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_infoex_reserved, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8745 | 0 | offset += 2; |
8746 | |
|
8747 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_fsctl_infoex_flags, ett_smb2_integrity_flags, integrity_flags, ENC_LITTLE_ENDIAN); |
8748 | 0 | offset += 4; |
8749 | |
|
8750 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_infoex_version, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
8751 | 0 | offset += 1; |
8752 | |
|
8753 | 0 | proto_tree_add_item(tree, hf_smb2_fsctl_infoex_reserved2, tvb, offset, 7, ENC_LITTLE_ENDIAN); |
8754 | 0 | offset += 7; |
8755 | |
|
8756 | 0 | return offset; |
8757 | 0 | } |
8758 | | |
8759 | | static int |
8760 | | dissect_smb2_FSCTL_REFS_STREAM_SNAPSHOT_MANAGEMENT_Query_Delta(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
8761 | 0 | { |
8762 | 0 | proto_tree *sub_tree; |
8763 | |
|
8764 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_smb2_fscc_refs_snapshot_query_delta_buffer, NULL, "Query Delta Buffer"); |
8765 | |
|
8766 | 0 | proto_tree_add_item(sub_tree, hf_smb2_fscc_refs_snapshot_query_delta_buffer_startvcn, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8767 | 0 | offset += 8; |
8768 | |
|
8769 | 0 | proto_tree_add_item(sub_tree, hf_smb2_fscc_refs_snapshot_query_delta_buffer_flags, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8770 | 0 | offset += 4; |
8771 | |
|
8772 | 0 | proto_tree_add_item(sub_tree, hf_smb2_fscc_refs_snapshot_query_delta_buffer_reserved, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8773 | 0 | offset += 4; |
8774 | |
|
8775 | 0 | return offset; |
8776 | 0 | } |
8777 | | |
8778 | | static int |
8779 | | dissect_smb2_FSCTL_REFS_STREAM_SNAPSHOT_MANAGEMENT(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, bool data_in) |
8780 | 0 | { |
8781 | 0 | uint32_t operation; |
8782 | 0 | uint32_t name_len; |
8783 | 0 | uint32_t input_buffer_len; |
8784 | | |
8785 | | /* There is no in data */ |
8786 | 0 | if (!data_in) { |
8787 | 0 | return offset; |
8788 | 0 | } |
8789 | | |
8790 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_fscc_refs_snapshot_mgmt_operation, tvb, offset, 4, ENC_LITTLE_ENDIAN, &operation); |
8791 | 0 | offset += 4; |
8792 | |
|
8793 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_fscc_refs_snapshot_mgmt_namelen, tvb, offset, 2, ENC_LITTLE_ENDIAN, &name_len); |
8794 | 0 | offset += 2; |
8795 | |
|
8796 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_fscc_refs_snapshot_mgmt_input_buffer_len, tvb, offset, 2, ENC_LITTLE_ENDIAN, &input_buffer_len); |
8797 | 0 | offset += 2; |
8798 | |
|
8799 | 0 | proto_tree_add_item(tree, hf_smb2_fscc_refs_snapshot_mgmt_reserved, tvb, offset, 16, ENC_NA); |
8800 | 0 | offset += 16; |
8801 | |
|
8802 | 0 | if (name_len) { |
8803 | 0 | proto_tree_add_item(tree, hf_smb2_fscc_refs_snapshot_mgmt_name, tvb, offset, name_len, ENC_UTF_16|ENC_LITTLE_ENDIAN); |
8804 | 0 | offset += name_len; |
8805 | 0 | } |
8806 | |
|
8807 | 0 | if (operation == REFS_STREAM_SNAPSHOT_OPERATION_QUERY_DELTAS) { |
8808 | 0 | offset += dissect_smb2_FSCTL_REFS_STREAM_SNAPSHOT_MANAGEMENT_Query_Delta(tvb, pinfo, tree, offset); |
8809 | 0 | } |
8810 | |
|
8811 | 0 | return offset; |
8812 | 0 | } |
8813 | | |
8814 | | static int |
8815 | | dissect_smb2_FSCTL_SET_OBJECT_ID(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
8816 | 0 | { |
8817 | | |
8818 | | /* There is no out data */ |
8819 | 0 | if (!data_in) { |
8820 | 0 | return offset; |
8821 | 0 | } |
8822 | | |
8823 | | /* FILE_OBJECTID_BUFFER */ |
8824 | 0 | offset = dissect_smb2_FILE_OBJECTID_BUFFER(tvb, pinfo, tree, offset); |
8825 | |
|
8826 | 0 | return offset; |
8827 | 0 | } |
8828 | | |
8829 | | static int |
8830 | | dissect_smb2_FSCTL_SET_OBJECT_ID_EXTENDED(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
8831 | 0 | { |
8832 | | |
8833 | | /* There is no out data */ |
8834 | 0 | if (!data_in) { |
8835 | 0 | return offset; |
8836 | 0 | } |
8837 | | |
8838 | | /* FILE_OBJECTID_BUFFER->ExtendedInfo */ |
8839 | | |
8840 | | /* Birth Volume ID */ |
8841 | 0 | proto_tree_add_item(tree, hf_smb2_birth_volume_id, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
8842 | 0 | offset += 16; |
8843 | | |
8844 | | /* Birth Object ID */ |
8845 | 0 | proto_tree_add_item(tree, hf_smb2_birth_object_id, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
8846 | 0 | offset += 16; |
8847 | | |
8848 | | /* Domain ID */ |
8849 | 0 | proto_tree_add_item(tree, hf_smb2_domain_id, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
8850 | 0 | offset += 16; |
8851 | |
|
8852 | 0 | return offset; |
8853 | 0 | } |
8854 | | |
8855 | | static int |
8856 | | dissect_smb2_cchunk_RESUME_KEY(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) |
8857 | 0 | { |
8858 | |
|
8859 | 0 | proto_tree_add_bytes_format_value(tree, hf_smb2_cchunk_resume_key, tvb, |
8860 | 0 | offset, 24, NULL, "Opaque Data"); |
8861 | 0 | offset += 24; |
8862 | |
|
8863 | 0 | return (offset); |
8864 | 0 | } |
8865 | | |
8866 | | static void |
8867 | | dissect_smb2_FSCTL_SRV_REQUEST_RESUME_KEY(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
8868 | 0 | { |
8869 | | |
8870 | | /* There is no in data */ |
8871 | 0 | if (data_in) { |
8872 | 0 | return; |
8873 | 0 | } |
8874 | | |
8875 | 0 | offset = dissect_smb2_cchunk_RESUME_KEY(tvb, pinfo, tree, offset); |
8876 | |
|
8877 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
8878 | 0 | } |
8879 | | |
8880 | | static void |
8881 | | dissect_smb2_FSCTL_SRV_COPYCHUNK(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
8882 | 0 | { |
8883 | 0 | proto_tree *sub_tree; |
8884 | 0 | proto_item *sub_item; |
8885 | 0 | uint32_t chunk_count = 0; |
8886 | | |
8887 | | /* Output is simpler - handle that first. */ |
8888 | 0 | if (!data_in) { |
8889 | 0 | proto_tree_add_item(tree, hf_smb2_cchunk_chunks_written, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8890 | 0 | proto_tree_add_item(tree, hf_smb2_cchunk_bytes_written, tvb, offset+4, 4, ENC_LITTLE_ENDIAN); |
8891 | 0 | proto_tree_add_item(tree, hf_smb2_cchunk_total_written, tvb, offset+8, 4, ENC_LITTLE_ENDIAN); |
8892 | 0 | return; |
8893 | 0 | } |
8894 | | |
8895 | | /* Input data, fixed part */ |
8896 | 0 | offset = dissect_smb2_cchunk_RESUME_KEY(tvb, pinfo, tree, offset); |
8897 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_cchunk_count, tvb, offset, 4, ENC_LITTLE_ENDIAN, &chunk_count); |
8898 | 0 | offset += 4; |
8899 | |
|
8900 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
8901 | 0 | offset += 4; |
8902 | | |
8903 | | /* Zero or more allocated ranges may be reported. */ |
8904 | 0 | while (chunk_count && tvb_reported_length_remaining(tvb, offset) >= 24) { |
8905 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, 24, ett_smb2_cchunk_entry, &sub_item, "Chunk"); |
8906 | |
|
8907 | 0 | proto_tree_add_item(sub_tree, hf_smb2_cchunk_src_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8908 | 0 | offset += 8; |
8909 | |
|
8910 | 0 | proto_tree_add_item(sub_tree, hf_smb2_cchunk_dst_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8911 | 0 | offset += 8; |
8912 | |
|
8913 | 0 | proto_tree_add_item(sub_tree, hf_smb2_cchunk_xfer_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8914 | 0 | offset += 4; |
8915 | |
|
8916 | 0 | proto_tree_add_item(sub_tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
8917 | 0 | offset += 4; |
8918 | |
|
8919 | 0 | chunk_count--; |
8920 | 0 | } |
8921 | 0 | } |
8922 | | |
8923 | | static void |
8924 | | dissect_smb2_reparse_nfs(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, uint32_t length) |
8925 | 0 | { |
8926 | 0 | uint64_t type; |
8927 | 0 | int symlink_length; |
8928 | |
|
8929 | 0 | type = tvb_get_letoh64(tvb, offset); |
8930 | 0 | proto_tree_add_item(tree, hf_smb2_nfs_type, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
8931 | 0 | offset += 8; |
8932 | |
|
8933 | 0 | switch (type) { |
8934 | 0 | case NFS_SPECFILE_LNK: |
8935 | | /* |
8936 | | * According to [MS-FSCC] 2.1.2.6 "length" contains |
8937 | | * the 8-byte type plus the symlink target in Unicode |
8938 | | * non-NULL terminated. |
8939 | | */ |
8940 | 0 | if (length < 8) { |
8941 | 0 | THROW(ReportedBoundsError); |
8942 | 0 | } |
8943 | 0 | symlink_length = length - 8; |
8944 | 0 | proto_tree_add_item(tree, hf_smb2_nfs_symlink_target, tvb, offset, |
8945 | 0 | symlink_length, ENC_UTF_16|ENC_LITTLE_ENDIAN); |
8946 | 0 | break; |
8947 | 0 | case NFS_SPECFILE_CHR: |
8948 | 0 | proto_tree_add_item(tree, hf_smb2_nfs_chr_major, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8949 | 0 | offset += 4; |
8950 | 0 | proto_tree_add_item(tree, hf_smb2_nfs_chr_minor, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8951 | 0 | break; |
8952 | 0 | case NFS_SPECFILE_BLK: |
8953 | 0 | proto_tree_add_item(tree, hf_smb2_nfs_blk_major, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8954 | 0 | offset += 4; |
8955 | 0 | proto_tree_add_item(tree, hf_smb2_nfs_blk_minor, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8956 | 0 | break; |
8957 | 0 | case NFS_SPECFILE_FIFO: |
8958 | 0 | case NFS_SPECFILE_SOCK: |
8959 | | /* no data */ |
8960 | 0 | break; |
8961 | 0 | } |
8962 | 0 | } |
8963 | | |
8964 | | static void |
8965 | | dissect_smb2_FSCTL_REPARSE_POINT(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset) |
8966 | 0 | { |
8967 | 0 | proto_item *item = NULL; |
8968 | 0 | proto_tree *tree = NULL; |
8969 | |
|
8970 | 0 | uint32_t tag; |
8971 | 0 | uint32_t length; |
8972 | 0 | offset_length_buffer_t s_olb, p_olb; |
8973 | | |
8974 | | /* REPARSE_DATA_BUFFER */ |
8975 | 0 | if (parent_tree) { |
8976 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_reparse_data_buffer, tvb, offset, -1, ENC_NA); |
8977 | 0 | tree = proto_item_add_subtree(item, ett_smb2_reparse_data_buffer); |
8978 | 0 | } |
8979 | | |
8980 | | /* reparse tag */ |
8981 | 0 | tag = tvb_get_letohl(tvb, offset); |
8982 | 0 | proto_tree_add_item(tree, hf_smb2_reparse_tag, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
8983 | 0 | offset += 4; |
8984 | | |
8985 | | /* reparse data length */ |
8986 | 0 | length = tvb_get_letohs(tvb, offset); |
8987 | 0 | proto_tree_add_item(tree, hf_smb2_reparse_data_length, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
8988 | 0 | offset += 2; |
8989 | | |
8990 | | /* reserved */ |
8991 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
8992 | 0 | offset += 2; |
8993 | |
|
8994 | 0 | if (!(tag & 0x80000000)) { |
8995 | | /* if high bit is not set, this buffer has a GUID field */ |
8996 | | /* reparse guid */ |
8997 | 0 | proto_tree_add_item(tree, hf_smb2_reparse_guid, tvb, offset, 16, ENC_NA); |
8998 | 0 | offset += 16; |
8999 | 0 | } |
9000 | |
|
9001 | 0 | switch (tag) { |
9002 | 0 | case REPARSE_TAG_SYMLINK: |
9003 | | /* substitute name offset/length */ |
9004 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &s_olb, OLB_O_UINT16_S_UINT16, hf_smb2_symlink_substitute_name); |
9005 | | |
9006 | | /* print name offset/length */ |
9007 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &p_olb, OLB_O_UINT16_S_UINT16, hf_smb2_symlink_print_name); |
9008 | | |
9009 | | /* flags */ |
9010 | 0 | proto_tree_add_item(tree, hf_smb2_symlink_flags, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9011 | 0 | offset += 4; |
9012 | | |
9013 | | /* substitute name string */ |
9014 | 0 | dissect_smb2_olb_off_string(pinfo, tree, tvb, &s_olb, offset, OLB_TYPE_UNICODE_STRING); |
9015 | | |
9016 | | /* print name string */ |
9017 | 0 | dissect_smb2_olb_off_string(pinfo, tree, tvb, &p_olb, offset, OLB_TYPE_UNICODE_STRING); |
9018 | 0 | break; |
9019 | 0 | case REPARSE_TAG_NFS: |
9020 | 0 | dissect_smb2_reparse_nfs(tvb, pinfo, tree, offset, length); |
9021 | 0 | break; |
9022 | 0 | default: |
9023 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, length, ENC_NA); |
9024 | 0 | } |
9025 | 0 | } |
9026 | | |
9027 | | static void |
9028 | | dissect_smb2_FSCTL_SET_REPARSE_POINT(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, bool data_in) |
9029 | 0 | { |
9030 | 0 | if (!data_in) { |
9031 | 0 | return; |
9032 | 0 | } |
9033 | | |
9034 | 0 | dissect_smb2_FSCTL_REPARSE_POINT(tvb, pinfo, parent_tree, offset); |
9035 | 0 | } |
9036 | | |
9037 | | static void |
9038 | | dissect_smb2_FSCTL_GET_REPARSE_POINT(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, bool data_in) |
9039 | 0 | { |
9040 | 0 | if (data_in) { |
9041 | 0 | return; |
9042 | 0 | } |
9043 | | |
9044 | 0 | dissect_smb2_FSCTL_REPARSE_POINT(tvb, pinfo, parent_tree, offset); |
9045 | 0 | } |
9046 | | |
9047 | | static void |
9048 | | dissect_smb2_FSCTL_GET_NTFS_VOLUME_DATA(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, bool data_in) |
9049 | 0 | { |
9050 | | /* There is no in data */ |
9051 | 0 | if (data_in) { |
9052 | 0 | return; |
9053 | 0 | } |
9054 | | |
9055 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_get_ntfs_volume_data_volume_serial, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9056 | 0 | offset += 8; |
9057 | |
|
9058 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_get_ntfs_volume_data_num_sectors, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9059 | 0 | offset += 8; |
9060 | |
|
9061 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_get_ntfs_volume_data_total_clusters, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9062 | 0 | offset += 8; |
9063 | |
|
9064 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_get_ntfs_volume_data_free_clusters, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9065 | 0 | offset += 8; |
9066 | |
|
9067 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_get_ntfs_volume_data_total_reserved, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9068 | 0 | offset += 8; |
9069 | |
|
9070 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_get_ntfs_volume_data_bytes_per_sector, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9071 | 0 | offset += 4; |
9072 | |
|
9073 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_get_ntfs_volume_data_bytes_per_cluster, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9074 | 0 | offset += 4; |
9075 | |
|
9076 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_get_ntfs_volume_data_bytes_per_file_record_segment, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9077 | 0 | offset += 4; |
9078 | |
|
9079 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_get_ntfs_volume_data_clusters_per_file_record_segment, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9080 | 0 | offset += 4; |
9081 | |
|
9082 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_get_ntfs_volume_data_mft_valid_data_length, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9083 | 0 | offset += 8; |
9084 | |
|
9085 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_get_ntfs_volume_data_mft_start_lcn, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9086 | 0 | offset += 8; |
9087 | |
|
9088 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_get_ntfs_volume_data_mft2_start_lcn, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9089 | 0 | offset += 8; |
9090 | |
|
9091 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_get_ntfs_volume_data_mft_zone_start, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9092 | 0 | offset += 8; |
9093 | |
|
9094 | 0 | proto_tree_add_item(tree, hf_smb2_ioctl_get_ntfs_volume_data_mft_zone_end, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9095 | 0 | } |
9096 | | |
9097 | | static void |
9098 | | dissect_smb2_FSCTL_DUPLICATE_EXTENTS_TO_FILE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean data_in, void *data) |
9099 | 0 | { |
9100 | | /* |
9101 | | * Note: si is NULL for some callers from packet-smb.c |
9102 | | */ |
9103 | 0 | smb2_info_t *si = (smb2_info_t *)data; |
9104 | | |
9105 | | /* Output is simpler - handle that first. */ |
9106 | 0 | if (!data_in) { |
9107 | 0 | return; |
9108 | 0 | } |
9109 | | |
9110 | | /* fid */ |
9111 | 0 | offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); |
9112 | |
|
9113 | 0 | proto_tree_add_item(tree, hf_smb2_dupext_src_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9114 | 0 | offset += 8; |
9115 | |
|
9116 | 0 | proto_tree_add_item(tree, hf_smb2_dupext_dst_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9117 | 0 | offset += 8; |
9118 | |
|
9119 | 0 | proto_tree_add_item(tree, hf_smb2_dupext_byte_count, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9120 | | /*offset += 8;*/ |
9121 | 0 | } |
9122 | | |
9123 | | /* [MS-SMB2] - v20240129 2.2.31 and [MS-DFSC] - v20180912 2.2.3 */ |
9124 | | static void |
9125 | | dissect_smb2_FSCTL_DFS_GET_REFERRALS_EX(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset _U_, gboolean data_in) |
9126 | 0 | { |
9127 | 0 | int16_t bc; |
9128 | 0 | int32_t name_len; |
9129 | 0 | int32_t data_len; |
9130 | 0 | bool is_sitename = FALSE; |
9131 | 0 | bool has_site_name = FALSE; |
9132 | 0 | const char *name; |
9133 | 0 | proto_item *item = NULL; |
9134 | 0 | proto_tree *tree = NULL; |
9135 | 0 | proto_item *fitem = NULL; |
9136 | 0 | proto_tree *ftree = NULL; |
9137 | |
|
9138 | 0 | if (!parent_tree || !data_in) |
9139 | 0 | return; |
9140 | | |
9141 | | /* Max referral level */ |
9142 | 0 | proto_tree_add_item(parent_tree, hf_smb2_dfs_max_referral_level, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
9143 | 0 | offset += 2; |
9144 | | |
9145 | | /* Request flags */ |
9146 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_dfs_request_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
9147 | 0 | if (tvb_get_letohs(tvb, offset)==0x00000001) { |
9148 | 0 | has_site_name = TRUE; |
9149 | 0 | proto_item_append_text(item, " (Site name specified)"); |
9150 | 0 | } else { |
9151 | 0 | proto_item_append_text(item, " (Site name not specified)"); |
9152 | 0 | } |
9153 | 0 | offset += 2; |
9154 | | |
9155 | | /* Length of the RequestData buffer */ |
9156 | 0 | data_len = tvb_get_letohl(tvb, offset); |
9157 | 0 | proto_tree_add_item(parent_tree, hf_smb2_dfs_request_data_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9158 | 0 | offset += 4; |
9159 | |
|
9160 | 0 | item = proto_tree_add_item(parent_tree, hf_smb2_dfs_request_data, tvb, offset, data_len, ENC_NA); |
9161 | 0 | tree = proto_item_add_subtree(item, ett_smb2_fsctl_dfs_get_referrals_ex_request_data); |
9162 | 0 | bc = data_len; |
9163 | | |
9164 | | /* RequestData buffer */ |
9165 | | /* Read the filenames and if has_sitename, the site name */ |
9166 | 0 | while (data_len > 0) { |
9167 | |
|
9168 | 0 | name_len = tvb_get_letohs(tvb, offset); |
9169 | 0 | offset += 2; |
9170 | |
|
9171 | 0 | if(has_site_name |
9172 | 0 | && data_len == name_len + 2) |
9173 | 0 | is_sitename = TRUE; |
9174 | |
|
9175 | 0 | if (name_len) { |
9176 | 0 | name = smb_get_unicode_or_ascii_string(pinfo->pool, tvb, &offset, TRUE, &name_len, TRUE, TRUE, &bc); |
9177 | 0 | if (name) { |
9178 | 0 | if (!is_sitename) { |
9179 | 0 | fitem = proto_tree_add_string(tree, hf_smb2_dfs_request_data_file, tvb, offset, name_len, name); |
9180 | 0 | ftree = proto_item_add_subtree(fitem, ett_smb2_fsctl_dfs_get_referrals_ex_filename); |
9181 | 0 | proto_tree_add_item(ftree, hf_smb2_dfs_filename_len, tvb, offset-2, 2, ENC_LITTLE_ENDIAN); |
9182 | 0 | proto_tree_add_string(ftree, hf_smb2_filename, tvb, offset, name_len, name); |
9183 | 0 | } else { |
9184 | 0 | fitem = proto_tree_add_string(tree, hf_smb2_dfs_request_data_site, tvb, offset, name_len, name); |
9185 | 0 | ftree = proto_item_add_subtree(fitem, ett_smb2_fsctl_dfs_get_referrals_ex_sitename); |
9186 | 0 | proto_tree_add_item(ftree, hf_smb2_dfs_sitename_len, tvb, offset-2, 2, ENC_LITTLE_ENDIAN); |
9187 | 0 | proto_tree_add_string(ftree, hf_smb2_dfs_sitename, tvb, offset, name_len, name); |
9188 | 0 | } |
9189 | 0 | data_len -= (name_len + 2); |
9190 | 0 | offset += name_len; |
9191 | 0 | } else { |
9192 | 0 | return; |
9193 | 0 | } |
9194 | 0 | } else { |
9195 | 0 | return; |
9196 | 0 | } |
9197 | 0 | } |
9198 | 0 | } |
9199 | | |
9200 | | void |
9201 | | dissect_smb2_ioctl_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *top_tree, uint32_t ioctl_function, bool data_in, void *private_data _U_) |
9202 | 0 | { |
9203 | 0 | uint16_t dc; |
9204 | |
|
9205 | 0 | dc = tvb_reported_length(tvb); |
9206 | |
|
9207 | 0 | switch (ioctl_function) { |
9208 | 0 | case 0x00060194: /* FSCTL_DFS_GET_REFERRALS */ |
9209 | 0 | if (data_in) { |
9210 | 0 | dissect_smb_get_dfs_request_data(tvb, pinfo, tree, 0, &dc, true); |
9211 | 0 | } else { |
9212 | 0 | dissect_smb_get_dfs_referral_data(tvb, pinfo, tree, 0, &dc, true); |
9213 | 0 | } |
9214 | 0 | break; |
9215 | 0 | case 0x000601B0: /* FSCTL_DFS_GET_REFERRALS_EX */ |
9216 | 0 | dissect_smb2_FSCTL_DFS_GET_REFERRALS_EX(tvb, pinfo, tree, 0, data_in); |
9217 | 0 | break; |
9218 | 0 | case 0x000940CF: /* FSCTL_QUERY_ALLOCATED_RANGES */ |
9219 | 0 | dissect_smb2_FSCTL_QUERY_ALLOCATED_RANGES(tvb, pinfo, tree, 0, data_in); |
9220 | 0 | break; |
9221 | 0 | case 0x00094264: /* FSCTL_OFFLOAD_READ */ |
9222 | 0 | dissect_smb2_FSCTL_OFFLOAD_READ(tvb, pinfo, tree, 0, data_in); |
9223 | 0 | break; |
9224 | 0 | case 0x00098268: /* FSCTL_OFFLOAD_WRITE */ |
9225 | 0 | dissect_smb2_FSCTL_OFFLOAD_WRITE(tvb, pinfo, tree, 0, data_in); |
9226 | 0 | break; |
9227 | 0 | case 0x0011c017: /* FSCTL_PIPE_TRANSCEIVE */ |
9228 | 0 | dissect_smb2_FSCTL_PIPE_TRANSCEIVE(tvb, pinfo, tree, 0, top_tree, data_in, private_data); |
9229 | 0 | break; |
9230 | 0 | case 0x00110018: /* FSCTL_PIPE_WAIT */ |
9231 | 0 | dissect_smb2_FSCTL_PIPE_WAIT(tvb, pinfo, tree, 0, top_tree, data_in); |
9232 | 0 | break; |
9233 | 0 | case 0x00140078: /* FSCTL_SRV_REQUEST_RESUME_KEY */ |
9234 | 0 | dissect_smb2_FSCTL_SRV_REQUEST_RESUME_KEY(tvb, pinfo, tree, 0, data_in); |
9235 | 0 | break; |
9236 | 0 | case 0x001401D4: /* FSCTL_LMR_REQUEST_RESILIENCY */ |
9237 | 0 | dissect_smb2_FSCTL_LMR_REQUEST_RESILIENCY(tvb, pinfo, tree, 0, data_in); |
9238 | 0 | break; |
9239 | 0 | case 0x001401FC: /* FSCTL_QUERY_NETWORK_INTERFACE_INFO */ |
9240 | 0 | dissect_smb2_FSCTL_QUERY_NETWORK_INTERFACE_INFO(tvb, pinfo, tree, 0, data_in); |
9241 | 0 | break; |
9242 | 0 | case 0x00140200: /* FSCTL_VALIDATE_NEGOTIATE_INFO_224 */ |
9243 | 0 | dissect_smb2_FSCTL_VALIDATE_NEGOTIATE_INFO_224(tvb, pinfo, tree, 0, data_in); |
9244 | 0 | break; |
9245 | 0 | case 0x00140204: /* FSCTL_VALIDATE_NEGOTIATE_INFO */ |
9246 | 0 | dissect_smb2_FSCTL_VALIDATE_NEGOTIATE_INFO(tvb, pinfo, tree, 0, data_in); |
9247 | 0 | break; |
9248 | 0 | case 0x00144064: /* FSCTL_SRV_ENUMERATE_SNAPSHOTS */ |
9249 | 0 | dissect_smb2_FSCTL_SRV_ENUMERATE_SNAPSHOTS(tvb, pinfo, tree, 0, data_in); |
9250 | 0 | break; |
9251 | 0 | case 0x001440F2: /* FSCTL_SRV_COPYCHUNK */ |
9252 | 0 | case 0x001480F2: /* FSCTL_SRV_COPYCHUNK_WRITE */ |
9253 | 0 | dissect_smb2_FSCTL_SRV_COPYCHUNK(tvb, pinfo, tree, 0, data_in); |
9254 | 0 | break; |
9255 | 0 | case 0x000900A4: /* FSCTL_SET_REPARSE_POINT */ |
9256 | 0 | dissect_smb2_FSCTL_SET_REPARSE_POINT(tvb, pinfo, tree, 0, data_in); |
9257 | 0 | break; |
9258 | 0 | case 0x000900A8: /* FSCTL_GET_REPARSE_POINT */ |
9259 | 0 | dissect_smb2_FSCTL_GET_REPARSE_POINT(tvb, pinfo, tree, 0, data_in); |
9260 | 0 | break; |
9261 | 0 | case 0x0009009C: /* FSCTL_GET_OBJECT_ID */ |
9262 | 0 | case 0x000900c0: /* FSCTL_CREATE_OR_GET_OBJECT_ID */ |
9263 | 0 | dissect_smb2_FSCTL_CREATE_OR_GET_OBJECT_ID(tvb, pinfo, tree, 0, data_in); |
9264 | 0 | break; |
9265 | 0 | case 0x000900c4: /* FSCTL_SET_SPARSE */ |
9266 | 0 | dissect_smb2_FSCTL_SET_SPARSE(tvb, pinfo, tree, 0, data_in); |
9267 | 0 | break; |
9268 | 0 | case 0x00098098: /* FSCTL_SET_OBJECT_ID */ |
9269 | 0 | dissect_smb2_FSCTL_SET_OBJECT_ID(tvb, pinfo, tree, 0, data_in); |
9270 | 0 | break; |
9271 | 0 | case 0x000980BC: /* FSCTL_SET_OBJECT_ID_EXTENDED */ |
9272 | 0 | dissect_smb2_FSCTL_SET_OBJECT_ID_EXTENDED(tvb, pinfo, tree, 0, data_in); |
9273 | 0 | break; |
9274 | 0 | case 0x000980C8: /* FSCTL_SET_ZERO_DATA */ |
9275 | 0 | dissect_smb2_FSCTL_SET_ZERO_DATA(tvb, pinfo, tree, 0, data_in); |
9276 | 0 | break; |
9277 | 0 | case 0x0009003C: /* FSCTL_GET_COMPRESSION */ |
9278 | 0 | dissect_smb2_FSCTL_GET_COMPRESSION(tvb, pinfo, tree, 0, data_in); |
9279 | 0 | break; |
9280 | 0 | case 0x00090300: /* FSCTL_QUERY_SHARED_VIRTUAL_DISK_SUPPORT */ |
9281 | 0 | dissect_smb2_FSCTL_QUERY_SHARED_VIRTUAL_DISK_SUPPORT(tvb, pinfo, tree, 0, data_in); |
9282 | 0 | break; |
9283 | 0 | case 0x00090304: /* FSCTL_SVHDX_SYNC_TUNNEL or response */ |
9284 | 0 | case 0x00090364: /* FSCTL_SVHDX_ASYNC_TUNNEL or response */ |
9285 | 0 | call_dissector_with_data(rsvd_handle, tvb, pinfo, top_tree, &data_in); |
9286 | 0 | break; |
9287 | 0 | case 0x00090350: /* FSCTL_STORAGE_QOS_CONTROL */ |
9288 | 0 | dissect_smb2_FSCTL_STORAGE_QOS_CONTROL(tvb, pinfo, tree, 0, data_in); |
9289 | 0 | break; |
9290 | 0 | case 0x0009C040: /* FSCTL_SET_COMPRESSION */ |
9291 | 0 | dissect_smb2_FSCTL_SET_COMPRESSION(tvb, pinfo, tree, 0, data_in); |
9292 | 0 | break; |
9293 | 0 | case 0x00090284: /* FSCTL_QUERY_FILE_REGIONS */ |
9294 | 0 | dissect_smb2_FSCTL_QUERY_FILE_REGIONS(tvb, pinfo, tree, 0, data_in); |
9295 | 0 | break; |
9296 | 0 | case 0x0009027c: /* FSCTL_GET_INTEGRITY_INFORMATION request or response */ |
9297 | 0 | dissect_smb2_FSCTL_GET_INTEGRITY_INFORMATION(tvb, pinfo, tree, 0, data_in); |
9298 | 0 | break; |
9299 | 0 | case 0x0009C280: /* FSCTL_SET_INTEGRITY_INFORMATION request or response */ |
9300 | 0 | dissect_smb2_FSCTL_SET_INTEGRITY_INFORMATION(tvb, pinfo, tree, 0, data_in); |
9301 | 0 | break; |
9302 | 0 | case 0x00090064: /* FSCTL_GET_NTFS_VOLUME_DATA */ |
9303 | 0 | dissect_smb2_FSCTL_GET_NTFS_VOLUME_DATA(tvb, pinfo, tree, 0, data_in); |
9304 | 0 | break; |
9305 | 0 | case 0x00090380: |
9306 | 0 | dissect_smb2_FSCTL_SET_INTEGRITY_INFORMATION_EX(tvb, pinfo, tree, 0, data_in); |
9307 | 0 | break; |
9308 | 0 | case 0x00090440: |
9309 | 0 | dissect_smb2_FSCTL_REFS_STREAM_SNAPSHOT_MANAGEMENT(tvb, pinfo, tree, 0, data_in); |
9310 | 0 | break; |
9311 | 0 | case 0x00098344: /* FSCTL_DUPLICATE_EXTENTS_TO_FILE */ |
9312 | 0 | dissect_smb2_FSCTL_DUPLICATE_EXTENTS_TO_FILE(tvb, pinfo, tree, 0, data_in, private_data); |
9313 | 0 | break; |
9314 | 0 | default: |
9315 | 0 | proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_captured_length(tvb), ENC_NA); |
9316 | 0 | } |
9317 | 0 | } |
9318 | | |
9319 | | static void |
9320 | | dissect_smb2_ioctl_data_in(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si) |
9321 | 0 | { |
9322 | 0 | smb2_pipe_set_file_id(pinfo, si); |
9323 | 0 | dissect_smb2_ioctl_data(tvb, pinfo, tree, si->top_tree, si->ioctl_function, true, si); |
9324 | 0 | } |
9325 | | |
9326 | | static void |
9327 | | dissect_smb2_ioctl_data_out(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si) |
9328 | 0 | { |
9329 | 0 | smb2_pipe_set_file_id(pinfo, si); |
9330 | 0 | dissect_smb2_ioctl_data(tvb, pinfo, tree, si->top_tree, si->ioctl_function, false, si); |
9331 | 0 | } |
9332 | | |
9333 | | static int |
9334 | | dissect_smb2_ioctl_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
9335 | 0 | { |
9336 | 0 | offset_length_buffer_t o_olb; |
9337 | 0 | offset_length_buffer_t i_olb; |
9338 | 0 | proto_tree *flags_tree = NULL; |
9339 | 0 | proto_item *flags_item = NULL; |
9340 | 0 | proto_item *item = NULL; |
9341 | | |
9342 | | /* buffer code */ |
9343 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
9344 | | |
9345 | | /* reserved */ |
9346 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
9347 | 0 | offset += 2; |
9348 | | |
9349 | | /* ioctl function */ |
9350 | 0 | offset = dissect_smb2_ioctl_function(tvb, pinfo, tree, offset, &si->ioctl_function); |
9351 | | |
9352 | | /* fid hash */ |
9353 | 0 | if (si->saved && si->saved->fid_hash) { |
9354 | 0 | item = proto_tree_add_uint_format(tree, hf_smb2_file_id_hash, tvb, 0, 0, |
9355 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
9356 | 0 | proto_item_set_generated(item); |
9357 | 0 | } |
9358 | | |
9359 | | /* fid */ |
9360 | 0 | offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); |
9361 | | |
9362 | | /* in buffer offset/length */ |
9363 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &i_olb, OLB_O_UINT32_S_UINT32, hf_smb2_ioctl_in_data); |
9364 | | |
9365 | | /* max ioctl in size */ |
9366 | 0 | proto_tree_add_item(tree, hf_smb2_max_ioctl_in_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9367 | 0 | offset += 4; |
9368 | | |
9369 | | /* out buffer offset/length */ |
9370 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &o_olb, OLB_O_UINT32_S_UINT32, hf_smb2_ioctl_out_data); |
9371 | | |
9372 | | /* max ioctl out size */ |
9373 | 0 | proto_tree_add_item(tree, hf_smb2_max_ioctl_out_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9374 | 0 | offset += 4; |
9375 | | |
9376 | | /* flags */ |
9377 | 0 | if (tree) { |
9378 | 0 | flags_item = proto_tree_add_item(tree, hf_smb2_ioctl_flags, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9379 | 0 | flags_tree = proto_item_add_subtree(flags_item, ett_smb2_ioctl_flags); |
9380 | 0 | } |
9381 | 0 | proto_tree_add_item(flags_tree, hf_smb2_ioctl_is_fsctl, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9382 | 0 | offset += 4; |
9383 | | |
9384 | | /* reserved */ |
9385 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
9386 | 0 | offset += 4; |
9387 | | |
9388 | | /* try to decode these blobs in the order they were encoded |
9389 | | * so that for "short" packets we will dissect as much as possible |
9390 | | * before aborting with "short packet" |
9391 | | */ |
9392 | 0 | if (i_olb.off>o_olb.off) { |
9393 | | /* out buffer */ |
9394 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &o_olb, si, dissect_smb2_ioctl_data_out); |
9395 | | /* in buffer */ |
9396 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &i_olb, si, dissect_smb2_ioctl_data_in); |
9397 | 0 | } else { |
9398 | | /* in buffer */ |
9399 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &i_olb, si, dissect_smb2_ioctl_data_in); |
9400 | | /* out buffer */ |
9401 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &o_olb, si, dissect_smb2_ioctl_data_out); |
9402 | 0 | } |
9403 | |
|
9404 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &o_olb); |
9405 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &i_olb); |
9406 | |
|
9407 | 0 | return offset; |
9408 | 0 | } |
9409 | | |
9410 | | static int |
9411 | | dissect_smb2_ioctl_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
9412 | 0 | { |
9413 | 0 | offset_length_buffer_t o_olb; |
9414 | 0 | offset_length_buffer_t i_olb; |
9415 | 0 | bool continue_dissection; |
9416 | 0 | proto_item *item = NULL; |
9417 | |
|
9418 | 0 | switch (si->status) { |
9419 | | /* buffer code */ |
9420 | | /* if we get BUFFER_OVERFLOW there will be truncated data */ |
9421 | 0 | case 0x80000005: |
9422 | 0 | case 0x00000000: offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); break; |
9423 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
9424 | 0 | if (!continue_dissection) return offset; |
9425 | 0 | } |
9426 | | |
9427 | | /* reserved */ |
9428 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
9429 | 0 | offset += 2; |
9430 | | |
9431 | | /* ioctl function */ |
9432 | 0 | offset = dissect_smb2_ioctl_function(tvb, pinfo, tree, offset, &si->ioctl_function); |
9433 | | |
9434 | | /* fid hash */ |
9435 | 0 | if (si->saved && si->saved->fid_hash) { |
9436 | 0 | item = proto_tree_add_uint_format(tree, hf_smb2_file_id_hash, tvb, 0, 0, |
9437 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
9438 | 0 | proto_item_set_generated(item); |
9439 | 0 | } |
9440 | | |
9441 | | /* fid */ |
9442 | 0 | offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); |
9443 | | |
9444 | | /* in buffer offset/length */ |
9445 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &i_olb, OLB_O_UINT32_S_UINT32, hf_smb2_ioctl_in_data); |
9446 | | |
9447 | | /* out buffer offset/length */ |
9448 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &o_olb, OLB_O_UINT32_S_UINT32, hf_smb2_ioctl_out_data); |
9449 | | |
9450 | | |
9451 | | /* flags: reserved: must be zero */ |
9452 | 0 | proto_tree_add_item(tree, hf_smb2_flags, tvb, offset, 4, ENC_BIG_ENDIAN); |
9453 | 0 | offset += 4; |
9454 | | |
9455 | | /* reserved */ |
9456 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
9457 | 0 | offset += 4; |
9458 | | |
9459 | | /* try to decode these blobs in the order they were encoded |
9460 | | * so that for "short" packets we will dissect as much as possible |
9461 | | * before aborting with "short packet" |
9462 | | */ |
9463 | 0 | if (i_olb.off>o_olb.off) { |
9464 | | /* out buffer */ |
9465 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &o_olb, si, dissect_smb2_ioctl_data_out); |
9466 | | /* in buffer */ |
9467 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &i_olb, si, dissect_smb2_ioctl_data_in); |
9468 | 0 | } else { |
9469 | | /* in buffer */ |
9470 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &i_olb, si, dissect_smb2_ioctl_data_in); |
9471 | | /* out buffer */ |
9472 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &o_olb, si, dissect_smb2_ioctl_data_out); |
9473 | 0 | } |
9474 | |
|
9475 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &i_olb); |
9476 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &o_olb); |
9477 | |
|
9478 | 0 | return offset; |
9479 | 0 | } |
9480 | | |
9481 | | |
9482 | 14 | #define SMB2_READFLAG_READ_UNBUFFERED 0x01 |
9483 | 14 | #define SMB2_READFLAG_READ_COMPRESSED 0x02 |
9484 | | |
9485 | | static const true_false_string tfs_read_unbuffered = { |
9486 | | "Client is asking for UNBUFFERED read", |
9487 | | "Client is NOT asking for UNBUFFERED read" |
9488 | | }; |
9489 | | |
9490 | | static const true_false_string tfs_read_compressed = { |
9491 | | "Client is asking for COMPRESSED data", |
9492 | | "Client is NOT asking for COMPRESSED data" |
9493 | | }; |
9494 | | |
9495 | | static int |
9496 | | dissect_smb2_read_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
9497 | 0 | { |
9498 | 0 | offset_length_buffer_t c_olb; |
9499 | 0 | uint32_t channel; |
9500 | 0 | uint32_t len; |
9501 | 0 | uint64_t off; |
9502 | 0 | static int * const flags[] = { |
9503 | 0 | &hf_smb2_read_flags_unbuffered, |
9504 | 0 | &hf_smb2_read_flags_compressed, |
9505 | 0 | NULL |
9506 | 0 | }; |
9507 | 0 | proto_item *item = NULL; |
9508 | 0 | proto_tree *fid_tree = NULL; |
9509 | 0 | proto_tree *which_tree = NULL; |
9510 | 0 | e_guid_t tag_guid; |
9511 | | |
9512 | | |
9513 | | /* buffer code */ |
9514 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
9515 | | |
9516 | | /* padding */ |
9517 | 0 | proto_tree_add_item(tree, hf_smb2_read_padding, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
9518 | 0 | offset += 1; |
9519 | | |
9520 | | /* flags */ |
9521 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_read_flags, |
9522 | 0 | ett_smb2_read_flags, flags, ENC_LITTLE_ENDIAN); |
9523 | 0 | offset += 1; |
9524 | | |
9525 | | /* length */ |
9526 | 0 | len = tvb_get_letohl(tvb, offset); |
9527 | 0 | proto_tree_add_item(tree, hf_smb2_read_length, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9528 | 0 | offset += 4; |
9529 | | |
9530 | | /* offset */ |
9531 | 0 | off = tvb_get_letoh64(tvb, offset); |
9532 | 0 | proto_tree_add_item(tree, hf_smb2_file_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9533 | 0 | offset += 8; |
9534 | |
|
9535 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " Len:%d Off:%" PRIu64, len, off); |
9536 | | |
9537 | | /* Save the FID for use in the reply */ |
9538 | 0 | tvb_get_letohguid(tvb, offset, &tag_guid); |
9539 | 0 | if (si->saved) { |
9540 | 0 | si->saved->uuid_fid = tag_guid; |
9541 | 0 | } |
9542 | | |
9543 | | /* fid */ |
9544 | 0 | offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); |
9545 | |
|
9546 | 0 | if (si->saved && si->saved->hnd_item) { |
9547 | 0 | fid_tree = proto_item_add_subtree(si->saved->hnd_item, ett_smb2_fid_str); |
9548 | 0 | which_tree = fid_tree; |
9549 | 0 | } else { |
9550 | 0 | which_tree = tree; |
9551 | 0 | } |
9552 | | |
9553 | | /* Filename */ |
9554 | 0 | if (si->file && si->file->name) { |
9555 | 0 | if (strcmp(si->file->name, "") == 0) |
9556 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
9557 | 0 | item = proto_tree_add_string(which_tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
9558 | 0 | proto_item_set_generated(item); |
9559 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
9560 | 0 | } |
9561 | | |
9562 | | /* fid hash */ |
9563 | 0 | if (si->saved && si->saved->fid_hash) { |
9564 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
9565 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
9566 | 0 | proto_item_set_generated(item); |
9567 | 0 | } |
9568 | | |
9569 | | /* minimum count */ |
9570 | 0 | proto_tree_add_item(tree, hf_smb2_min_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9571 | 0 | offset += 4; |
9572 | | |
9573 | | /* channel */ |
9574 | 0 | channel = tvb_get_letohl(tvb, offset); |
9575 | 0 | proto_tree_add_item(tree, hf_smb2_channel, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9576 | 0 | offset += 4; |
9577 | | |
9578 | | /* remaining bytes */ |
9579 | 0 | proto_tree_add_item(tree, hf_smb2_remaining_bytes, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9580 | 0 | offset += 4; |
9581 | | |
9582 | | /* read channel info blob offset/length */ |
9583 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &c_olb, OLB_O_UINT16_S_UINT16, hf_smb2_channel_info_blob); |
9584 | | |
9585 | | /* the read channel info blob itself */ |
9586 | 0 | switch (channel) { |
9587 | 0 | case SMB2_CHANNEL_RDMA_V1: |
9588 | 0 | case SMB2_CHANNEL_RDMA_V1_INVALIDATE: |
9589 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &c_olb, si, dissect_smb2_rdma_v1_blob); |
9590 | 0 | break; |
9591 | 0 | case SMB2_CHANNEL_NONE: |
9592 | 0 | default: |
9593 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &c_olb, si, NULL); |
9594 | 0 | break; |
9595 | 0 | } |
9596 | | |
9597 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &c_olb); |
9598 | | |
9599 | | /* Store len and offset */ |
9600 | 0 | if (si->saved) { |
9601 | 0 | si->saved->file_offset=off; |
9602 | 0 | si->saved->bytes_moved=len; |
9603 | 0 | } |
9604 | |
|
9605 | 0 | return offset; |
9606 | 0 | } |
9607 | | |
9608 | | static void |
9609 | | dissect_smb2_read_blob(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si) |
9610 | 0 | { |
9611 | 0 | int offset = 0; |
9612 | 0 | int length = tvb_captured_length_remaining(tvb, offset); |
9613 | |
|
9614 | 0 | smb2_pipe_set_file_id(pinfo, si); |
9615 | |
|
9616 | 0 | offset = dissect_file_data_smb2_pipe(tvb, pinfo, tree, offset, length, si->top_tree, si); |
9617 | 0 | if (offset != 0) { |
9618 | | /* managed to dissect pipe data */ |
9619 | 0 | return; |
9620 | 0 | } |
9621 | | |
9622 | | /* data */ |
9623 | 0 | proto_tree_add_item(tree, hf_smb2_read_data, tvb, offset, length, ENC_NA); |
9624 | 0 | } |
9625 | | |
9626 | | static int |
9627 | | dissect_smb2_read_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
9628 | 0 | { |
9629 | 0 | offset_length_buffer_t olb; |
9630 | 0 | uint32_t data_tvb_len; |
9631 | 0 | bool continue_dissection; |
9632 | 0 | proto_item *item = NULL; |
9633 | 0 | proto_item *tag_item = NULL; |
9634 | 0 | proto_tree *tag_tree = NULL; |
9635 | 0 | proto_tree *which_tree = NULL; |
9636 | |
|
9637 | 0 | switch (si->status) { |
9638 | | /* buffer code */ |
9639 | 0 | case 0x00000000: offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); break; |
9640 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
9641 | 0 | if (!continue_dissection) return offset; |
9642 | 0 | } |
9643 | | |
9644 | | /* data offset 8 bit, 8 bit reserved, length 32bit */ |
9645 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &olb, |
9646 | 0 | OLB_O_UINT8_P_UINT8_S_UINT32, |
9647 | 0 | hf_smb2_read_blob); |
9648 | | |
9649 | | /* remaining */ |
9650 | 0 | proto_tree_add_item(tree, hf_smb2_read_remaining, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9651 | 0 | offset += 4; |
9652 | | |
9653 | | /* Create a filename subtree and populate it. */ |
9654 | 0 | if (pinfo->fd->visited) { |
9655 | 0 | if (si->file && si->file->name) { |
9656 | 0 | if (strcmp(si->file->name, "") == 0) |
9657 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
9658 | 0 | tag_item = proto_tree_add_string(tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
9659 | 0 | tag_tree = proto_item_add_subtree(tag_item, ett_smb2_fid_str); |
9660 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
9661 | 0 | which_tree = tag_tree; |
9662 | 0 | } else { |
9663 | 0 | which_tree = tree; |
9664 | 0 | } |
9665 | 0 | if (si->saved) { |
9666 | 0 | item = proto_tree_add_guid(which_tree, hf_smb2_fid, tvb, 0, 0, (e_guid_t *)&si->saved->uuid_fid); |
9667 | 0 | proto_item_set_generated(item); |
9668 | 0 | } |
9669 | 0 | if (si->saved && si->saved->fid_hash) { |
9670 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
9671 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
9672 | 0 | proto_item_set_generated(item); |
9673 | 0 | } |
9674 | 0 | if (si->file && si->file->frame_beg > 0 && si->file->frame_beg < UINT32_MAX) { |
9675 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
9676 | 0 | si->file->frame_beg); |
9677 | 0 | proto_item_set_generated(item); |
9678 | 0 | } else { |
9679 | 0 | if (si->saved && si->saved->frame_beg > 0 && si->saved->frame_beg < UINT32_MAX) { |
9680 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
9681 | 0 | si->saved->frame_beg); |
9682 | 0 | proto_item_set_generated(item); |
9683 | 0 | } |
9684 | 0 | } |
9685 | 0 | if (si->file && si->file->frame_end > 0 && si->file->frame_end < UINT32_MAX) { |
9686 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
9687 | 0 | si->file->frame_end); |
9688 | 0 | proto_item_set_generated(item); |
9689 | 0 | } else { |
9690 | 0 | if (si->saved && si->saved->frame_end > 0 && si->saved->frame_end < UINT32_MAX) { |
9691 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
9692 | 0 | si->saved->frame_end); |
9693 | 0 | proto_item_set_generated(item); |
9694 | 0 | } |
9695 | 0 | } |
9696 | 0 | } |
9697 | | |
9698 | | /* reserved */ |
9699 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
9700 | 0 | offset += 4; |
9701 | |
|
9702 | 0 | data_tvb_len=(uint32_t)tvb_captured_length_remaining(tvb, offset); |
9703 | |
|
9704 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &olb, si, dissect_smb2_read_blob); |
9705 | |
|
9706 | 0 | offset += MIN(olb.len, data_tvb_len); |
9707 | |
|
9708 | 0 | if (have_tap_listener(smb2_eo_tap) && (data_tvb_len == olb.len)) { |
9709 | 0 | if (si->saved && si->eo_file_info) { /* without this data we don't know which file this belongs to */ |
9710 | 0 | feed_eo_smb2(tvb,pinfo,si,olb.off,olb.len,si->saved->file_offset); |
9711 | 0 | } |
9712 | 0 | } |
9713 | |
|
9714 | 0 | return offset; |
9715 | 0 | } |
9716 | | |
9717 | | static void |
9718 | | report_create_context_malformed_buffer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const char *buffer_desc) |
9719 | 0 | { |
9720 | 0 | proto_tree_add_expert_format(tree, pinfo, &ei_smb2_bad_response, tvb, 0, -1, |
9721 | 0 | "%s SHOULD NOT be generated", buffer_desc); |
9722 | 0 | } |
9723 | | static void |
9724 | | dissect_smb2_ExtA_buffer_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si) |
9725 | 0 | { |
9726 | 0 | proto_item *item = NULL; |
9727 | 0 | if (tree) { |
9728 | 0 | item = proto_tree_get_parent(tree); |
9729 | 0 | proto_item_append_text(item, ": SMB2_FILE_FULL_EA_INFO"); |
9730 | 0 | } |
9731 | 0 | dissect_smb2_file_full_ea_info(tvb, pinfo, tree, 0, si); |
9732 | 0 | } |
9733 | | |
9734 | | static void |
9735 | | dissect_smb2_ExtA_buffer_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si _U_) |
9736 | 0 | { |
9737 | 0 | report_create_context_malformed_buffer(tvb, pinfo, tree, "ExtA Response"); |
9738 | 0 | } |
9739 | | |
9740 | | static void |
9741 | | dissect_smb2_SecD_buffer_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si) |
9742 | 0 | { |
9743 | 0 | proto_item *item = NULL; |
9744 | 0 | if (tree) { |
9745 | 0 | item = proto_tree_get_parent(tree); |
9746 | 0 | proto_item_append_text(item, ": SMB2_SEC_INFO_00"); |
9747 | 0 | } |
9748 | 0 | dissect_smb2_sec_info_00(tvb, pinfo, tree, 0, si); |
9749 | 0 | } |
9750 | | |
9751 | | static void |
9752 | | dissect_smb2_SecD_buffer_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si _U_) |
9753 | 0 | { |
9754 | 0 | report_create_context_malformed_buffer(tvb, pinfo, tree, "SecD Response"); |
9755 | 0 | } |
9756 | | |
9757 | | /* |
9758 | | * Add the timestamp to the info column and to the name of the file if |
9759 | | * we have not visited this packet before. |
9760 | | */ |
9761 | | static void |
9762 | | add_timestamp_to_info_col(tvbuff_t *tvb, packet_info *pinfo, smb2_info_t *si, |
9763 | | int offset) |
9764 | 0 | { |
9765 | 0 | uint32_t filetime_high, filetime_low; |
9766 | 0 | uint64_t ft; |
9767 | 0 | nstime_t ts; |
9768 | |
|
9769 | 0 | filetime_low = tvb_get_letohl(tvb, offset); |
9770 | 0 | filetime_high = tvb_get_letohl(tvb, offset + 4); |
9771 | |
|
9772 | 0 | ft = ((uint64_t)filetime_high << 32) | filetime_low; |
9773 | 0 | if (!filetime_to_nstime(&ts, ft)) { |
9774 | 0 | return; |
9775 | 0 | } |
9776 | | |
9777 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, "@%s", |
9778 | 0 | abs_time_to_str(pinfo->pool, &ts, ABSOLUTE_TIME_UTC, |
9779 | 0 | false)); |
9780 | | |
9781 | | /* Append the timestamp */ |
9782 | 0 | if (!pinfo->fd->visited) { |
9783 | 0 | if (si->saved && si->saved->extra_info_type == SMB2_EI_FILENAME) { |
9784 | 0 | char *saved_name = (char *)si->saved->extra_info; |
9785 | |
|
9786 | 0 | si->saved->extra_info = wmem_strdup_printf(wmem_file_scope(), |
9787 | 0 | "%s@%s", (char *)saved_name, |
9788 | 0 | abs_time_to_str(pinfo->pool, &ts, |
9789 | 0 | ABSOLUTE_TIME_UTC, false)); |
9790 | 0 | wmem_free(wmem_file_scope(), saved_name); |
9791 | 0 | } |
9792 | 0 | } |
9793 | 0 | } |
9794 | | |
9795 | | static void |
9796 | | dissect_smb2_TWrp_buffer_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
9797 | 0 | { |
9798 | 0 | proto_item *item = NULL; |
9799 | 0 | if (tree) { |
9800 | 0 | item = proto_tree_get_parent(tree); |
9801 | 0 | proto_item_append_text(item, ": Timestamp"); |
9802 | 0 | } |
9803 | 0 | add_timestamp_to_info_col(tvb, pinfo, si, 0); |
9804 | 0 | dissect_nttime(tvb, tree, 0, hf_smb2_twrp_timestamp, ENC_LITTLE_ENDIAN); |
9805 | 0 | } |
9806 | | |
9807 | | static void |
9808 | | dissect_smb2_TWrp_buffer_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
9809 | 0 | { |
9810 | 0 | report_create_context_malformed_buffer(tvb, pinfo, tree, "TWrp Response"); |
9811 | 0 | } |
9812 | | |
9813 | | static void |
9814 | | dissect_smb2_QFid_buffer_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
9815 | 0 | { |
9816 | 0 | proto_item *item = NULL; |
9817 | |
|
9818 | 0 | if (tree) { |
9819 | 0 | item = proto_tree_get_parent(tree); |
9820 | 0 | } |
9821 | |
|
9822 | 0 | if (item) { |
9823 | 0 | if (tvb_reported_length(tvb) == 0) { |
9824 | 0 | proto_item_append_text(item, ": NO DATA"); |
9825 | 0 | } else { |
9826 | 0 | proto_item_append_text(item, ": QFid request should have no data, malformed packet"); |
9827 | 0 | } |
9828 | 0 | } |
9829 | 0 | } |
9830 | | |
9831 | | static void |
9832 | | dissect_smb2_QFid_buffer_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
9833 | 0 | { |
9834 | 0 | int offset = 0; |
9835 | 0 | proto_item *item = NULL; |
9836 | 0 | proto_item *sub_tree; |
9837 | |
|
9838 | 0 | item = proto_tree_get_parent(tree); |
9839 | |
|
9840 | 0 | proto_item_append_text(item, ": QFid INFO"); |
9841 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_smb2_QFid_buffer, NULL, "QFid INFO"); |
9842 | |
|
9843 | 0 | proto_tree_add_item(sub_tree, hf_smb2_qfid_fid, tvb, offset, 32, ENC_NA); |
9844 | 0 | } |
9845 | | |
9846 | | static void |
9847 | | dissect_smb2_AlSi_buffer_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
9848 | 0 | { |
9849 | 0 | proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, 0, 8, ENC_LITTLE_ENDIAN); |
9850 | 0 | } |
9851 | | |
9852 | | static void |
9853 | | dissect_smb2_AlSi_buffer_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
9854 | 0 | { |
9855 | 0 | report_create_context_malformed_buffer(tvb, pinfo, tree, "AlSi Response"); |
9856 | 0 | } |
9857 | | |
9858 | | static void |
9859 | | dissect_smb2_DHnQ_buffer_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si) |
9860 | 0 | { |
9861 | 0 | dissect_smb2_fid(tvb, pinfo, tree, 0, si, FID_MODE_DHNQ); |
9862 | 0 | } |
9863 | | |
9864 | | static void |
9865 | | dissect_smb2_DHnQ_buffer_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
9866 | 0 | { |
9867 | 0 | proto_tree_add_item(tree, hf_smb2_dhnq_buffer_reserved, tvb, 0, 8, ENC_LITTLE_ENDIAN); |
9868 | 0 | } |
9869 | | |
9870 | | static void |
9871 | | dissect_smb2_DHnC_buffer_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si) |
9872 | 0 | { |
9873 | 0 | dissect_smb2_fid(tvb, pinfo, tree, 0, si, FID_MODE_DHNC); |
9874 | 0 | } |
9875 | | |
9876 | | static void |
9877 | | dissect_smb2_DHnC_buffer_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si _U_) |
9878 | 0 | { |
9879 | 0 | report_create_context_malformed_buffer(tvb, pinfo, tree, "DHnC Response"); |
9880 | 0 | } |
9881 | | |
9882 | | /* |
9883 | | * SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 |
9884 | | * 4 - timeout |
9885 | | * 4 - flags |
9886 | | * 8 - reserved |
9887 | | * 16 - create guid |
9888 | | * |
9889 | | * SMB2_CREATE_DURABLE_HANDLE_RESPONSE_V2 |
9890 | | * 4 - timeout |
9891 | | * 4 - flags |
9892 | | * |
9893 | | * SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 |
9894 | | * 16 - file id |
9895 | | * 16 - create guid |
9896 | | * 4 - flags |
9897 | | * |
9898 | | * SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 |
9899 | | * - nothing - |
9900 | | */ |
9901 | 14 | #define SMB2_DH2X_FLAGS_PERSISTENT_HANDLE 0x00000002 |
9902 | | |
9903 | | static void |
9904 | | dissect_smb2_DH2Q_buffer_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
9905 | 0 | { |
9906 | 0 | static int * const dh2x_flags_fields[] = { |
9907 | 0 | &hf_smb2_dh2x_buffer_flags_persistent_handle, |
9908 | 0 | NULL |
9909 | 0 | }; |
9910 | 0 | int offset = 0; |
9911 | 0 | proto_item *item = NULL; |
9912 | 0 | proto_item *sub_tree; |
9913 | |
|
9914 | 0 | item = proto_tree_get_parent(tree); |
9915 | |
|
9916 | 0 | proto_item_append_text(item, ": DH2Q Request"); |
9917 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_smb2_DH2Q_buffer, NULL, "DH2Q Request"); |
9918 | | |
9919 | | /* timeout */ |
9920 | 0 | proto_tree_add_item(sub_tree, hf_smb2_dh2x_buffer_timeout, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9921 | 0 | offset += 4; |
9922 | | |
9923 | | /* flags */ |
9924 | 0 | proto_tree_add_bitmask(sub_tree, tvb, offset, hf_smb2_dh2x_buffer_flags, |
9925 | 0 | ett_smb2_dh2x_flags, dh2x_flags_fields, ENC_LITTLE_ENDIAN); |
9926 | 0 | offset += 4; |
9927 | | |
9928 | | /* reserved */ |
9929 | 0 | proto_tree_add_item(sub_tree, hf_smb2_dh2x_buffer_reserved, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
9930 | 0 | offset += 8; |
9931 | | |
9932 | | /* create guid */ |
9933 | 0 | proto_tree_add_item(sub_tree, hf_smb2_dh2x_buffer_create_guid, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
9934 | 0 | } |
9935 | | |
9936 | | static void |
9937 | | dissect_smb2_DH2Q_buffer_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
9938 | 0 | { |
9939 | 0 | int offset = 0; |
9940 | 0 | proto_item *item = NULL; |
9941 | 0 | proto_item *sub_tree; |
9942 | |
|
9943 | 0 | item = proto_tree_get_parent(tree); |
9944 | |
|
9945 | 0 | proto_item_append_text(item, ": DH2Q Response"); |
9946 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_smb2_DH2Q_buffer, NULL, "DH2Q Response"); |
9947 | | |
9948 | | /* timeout */ |
9949 | 0 | proto_tree_add_item(sub_tree, hf_smb2_dh2x_buffer_timeout, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9950 | 0 | offset += 4; |
9951 | | |
9952 | | /* flags */ |
9953 | 0 | proto_tree_add_item(sub_tree, hf_smb2_dh2x_buffer_flags, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9954 | 0 | } |
9955 | | |
9956 | | static void |
9957 | | dissect_smb2_DH2C_buffer_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si) |
9958 | 0 | { |
9959 | 0 | int offset = 0; |
9960 | 0 | proto_item *item = NULL; |
9961 | 0 | proto_item *sub_tree; |
9962 | |
|
9963 | 0 | item = proto_tree_get_parent(tree); |
9964 | |
|
9965 | 0 | proto_item_append_text(item, ": DH2C Request"); |
9966 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_smb2_DH2C_buffer, NULL, "DH2C Request"); |
9967 | | |
9968 | | /* file id */ |
9969 | 0 | dissect_smb2_fid(tvb, pinfo, sub_tree, offset, si, FID_MODE_DHNC); |
9970 | 0 | offset += 16; |
9971 | | |
9972 | | /* create guid */ |
9973 | 0 | proto_tree_add_item(sub_tree, hf_smb2_dh2x_buffer_create_guid, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
9974 | 0 | offset += 16; |
9975 | | |
9976 | | /* flags */ |
9977 | 0 | proto_tree_add_item(sub_tree, hf_smb2_dh2x_buffer_flags, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
9978 | 0 | } |
9979 | | |
9980 | | static void |
9981 | | dissect_smb2_DH2C_buffer_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si _U_) |
9982 | 0 | { |
9983 | 0 | report_create_context_malformed_buffer(tvb, pinfo, tree, "DH2C Response"); |
9984 | 0 | } |
9985 | | |
9986 | | static void |
9987 | | dissect_smb2_MxAc_buffer_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
9988 | 0 | { |
9989 | 0 | int offset = 0; |
9990 | 0 | proto_item *item = NULL; |
9991 | |
|
9992 | 0 | if (tree) { |
9993 | 0 | item = proto_tree_get_parent(tree); |
9994 | 0 | } |
9995 | |
|
9996 | 0 | if (tvb_reported_length(tvb) == 0) { |
9997 | 0 | if (item) { |
9998 | 0 | proto_item_append_text(item, ": NO DATA"); |
9999 | 0 | } |
10000 | 0 | return; |
10001 | 0 | } |
10002 | | |
10003 | 0 | if (item) { |
10004 | 0 | proto_item_append_text(item, ": Timestamp"); |
10005 | 0 | } |
10006 | |
|
10007 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_mxac_timestamp, ENC_LITTLE_ENDIAN); |
10008 | 0 | } |
10009 | | |
10010 | | static void |
10011 | | dissect_smb2_MxAc_buffer_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
10012 | 0 | { |
10013 | 0 | int offset = 0; |
10014 | 0 | proto_item *item = NULL; |
10015 | 0 | proto_tree *sub_tree; |
10016 | |
|
10017 | 0 | item = proto_tree_get_parent(tree); |
10018 | |
|
10019 | 0 | if (tvb_reported_length(tvb) == 0) { |
10020 | 0 | proto_item_append_text(item, ": NO DATA"); |
10021 | 0 | return; |
10022 | 0 | } |
10023 | | |
10024 | 0 | proto_item_append_text(item, ": MxAc INFO"); |
10025 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_smb2_MxAc_buffer, NULL, "MxAc INFO"); |
10026 | |
|
10027 | 0 | proto_tree_add_item(sub_tree, hf_smb2_mxac_status, tvb, offset, 4, ENC_BIG_ENDIAN); |
10028 | 0 | offset += 4; |
10029 | |
|
10030 | 0 | dissect_smb_access_mask(tvb, sub_tree, offset); |
10031 | 0 | } |
10032 | | |
10033 | | /* |
10034 | | * SMB2_CREATE_REQUEST_LEASE 32 |
10035 | | * 16 - lease key |
10036 | | * 4 - lease state |
10037 | | * 4 - lease flags |
10038 | | * 8 - lease duration |
10039 | | * |
10040 | | * SMB2_CREATE_REQUEST_LEASE_V2 52 |
10041 | | * 16 - lease key |
10042 | | * 4 - lease state |
10043 | | * 4 - lease flags |
10044 | | * 8 - lease duration |
10045 | | * 16 - parent lease key |
10046 | | * 2 - epoch |
10047 | | * 2 - reserved |
10048 | | */ |
10049 | 14 | #define SMB2_LEASE_STATE_READ_CACHING 0x00000001 |
10050 | 14 | #define SMB2_LEASE_STATE_HANDLE_CACHING 0x00000002 |
10051 | 14 | #define SMB2_LEASE_STATE_WRITE_CACHING 0x00000004 |
10052 | | |
10053 | 14 | #define SMB2_LEASE_FLAGS_BREAK_ACK_REQUIRED 0x00000001 |
10054 | 14 | #define SMB2_LEASE_FLAGS_BREAK_IN_PROGRESS 0x00000002 |
10055 | 14 | #define SMB2_LEASE_FLAGS_PARENT_LEASE_KEY_SET 0x00000004 |
10056 | | |
10057 | | static int * const lease_state_fields[] = { |
10058 | | &hf_smb2_lease_state_read_caching, |
10059 | | &hf_smb2_lease_state_handle_caching, |
10060 | | &hf_smb2_lease_state_write_caching, |
10061 | | NULL |
10062 | | }; |
10063 | | static int * const lease_flags_fields[] = { |
10064 | | &hf_smb2_lease_flags_break_ack_required, |
10065 | | &hf_smb2_lease_flags_break_in_progress, |
10066 | | &hf_smb2_lease_flags_parent_lease_key_set, |
10067 | | NULL |
10068 | | }; |
10069 | | |
10070 | | static void |
10071 | | dissect_SMB2_CREATE_LEASE_VX(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, smb2_info_t *si _U_) |
10072 | 0 | { |
10073 | 0 | int offset = 0; |
10074 | 0 | int len; |
10075 | 0 | proto_tree *sub_tree = NULL; |
10076 | 0 | proto_item *parent_item; |
10077 | |
|
10078 | 0 | parent_item = proto_tree_get_parent(parent_tree); |
10079 | |
|
10080 | 0 | len = tvb_reported_length(tvb); |
10081 | |
|
10082 | 0 | switch (len) { |
10083 | 0 | case 32: /* SMB2_CREATE_REQUEST/RESPONSE_LEASE */ |
10084 | 0 | proto_item_append_text(parent_item, ": LEASE_V1"); |
10085 | 0 | sub_tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_smb2_RqLs_buffer, NULL, "LEASE_V1"); |
10086 | 0 | break; |
10087 | 0 | case 52: /* SMB2_CREATE_REQUEST/RESPONSE_LEASE_V2 */ |
10088 | 0 | proto_item_append_text(parent_item, ": LEASE_V2"); |
10089 | 0 | sub_tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_smb2_RqLs_buffer, NULL, "LEASE_V2"); |
10090 | 0 | break; |
10091 | 0 | default: |
10092 | 0 | report_create_context_malformed_buffer(tvb, pinfo, parent_tree, "RqLs"); |
10093 | 0 | break; |
10094 | 0 | } |
10095 | | |
10096 | 0 | proto_tree_add_item(sub_tree, hf_smb2_lease_key, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
10097 | 0 | offset += 16; |
10098 | |
|
10099 | 0 | proto_tree_add_bitmask(sub_tree, tvb, offset, hf_smb2_lease_state, |
10100 | 0 | ett_smb2_lease_state, lease_state_fields, ENC_LITTLE_ENDIAN); |
10101 | 0 | offset += 4; |
10102 | |
|
10103 | 0 | proto_tree_add_bitmask(sub_tree, tvb, offset, hf_smb2_lease_flags, |
10104 | 0 | ett_smb2_lease_flags, lease_flags_fields, ENC_LITTLE_ENDIAN); |
10105 | 0 | offset += 4; |
10106 | |
|
10107 | 0 | proto_tree_add_item(sub_tree, hf_smb2_lease_duration, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
10108 | 0 | offset += 8; |
10109 | |
|
10110 | 0 | if (len < 52) { |
10111 | 0 | return; |
10112 | 0 | } |
10113 | | |
10114 | 0 | proto_tree_add_item(sub_tree, hf_smb2_parent_lease_key, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
10115 | 0 | offset += 16; |
10116 | |
|
10117 | 0 | proto_tree_add_item(sub_tree, hf_smb2_lease_epoch, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
10118 | 0 | offset += 2; |
10119 | |
|
10120 | 0 | proto_tree_add_item(sub_tree, hf_smb2_lease_reserved, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
10121 | 0 | } |
10122 | | |
10123 | | static void |
10124 | | dissect_smb2_RqLs_buffer_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
10125 | 0 | { |
10126 | 0 | dissect_SMB2_CREATE_LEASE_VX(tvb, pinfo, tree, si); |
10127 | 0 | } |
10128 | | |
10129 | | static void |
10130 | | dissect_smb2_RqLs_buffer_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
10131 | 0 | { |
10132 | 0 | dissect_SMB2_CREATE_LEASE_VX(tvb, pinfo, tree, si); |
10133 | 0 | } |
10134 | | |
10135 | | /* |
10136 | | * SMB2_CREATE_APP_INSTANCE_ID |
10137 | | * 2 - structure size - 20 |
10138 | | * 2 - reserved |
10139 | | * 16 - application guid |
10140 | | */ |
10141 | | |
10142 | | static void |
10143 | | dissect_smb2_APP_INSTANCE_buffer_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
10144 | 0 | { |
10145 | 0 | int offset = 0; |
10146 | 0 | proto_item *item = NULL; |
10147 | 0 | proto_item *sub_tree; |
10148 | |
|
10149 | 0 | item = proto_tree_get_parent(tree); |
10150 | |
|
10151 | 0 | proto_item_append_text(item, ": CREATE APP INSTANCE ID"); |
10152 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_smb2_APP_INSTANCE_buffer, NULL, "APP INSTANCE ID"); |
10153 | | |
10154 | | /* struct size */ |
10155 | 0 | proto_tree_add_item(sub_tree, hf_smb2_APP_INSTANCE_buffer_struct_size, |
10156 | 0 | tvb, offset, 2, ENC_LITTLE_ENDIAN); |
10157 | 0 | offset += 2; |
10158 | | |
10159 | | /* reserved */ |
10160 | 0 | proto_tree_add_item(sub_tree, hf_smb2_APP_INSTANCE_buffer_reserved, |
10161 | 0 | tvb, offset, 2, ENC_LITTLE_ENDIAN); |
10162 | 0 | offset += 2; |
10163 | | |
10164 | | /* create guid */ |
10165 | 0 | proto_tree_add_item(sub_tree, hf_smb2_APP_INSTANCE_buffer_app_guid, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
10166 | 0 | } |
10167 | | |
10168 | | static void |
10169 | | dissect_smb2_APP_INSTANCE_buffer_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
10170 | 0 | { |
10171 | 0 | report_create_context_malformed_buffer(tvb, pinfo, tree, "APP INSTANCE Response"); |
10172 | 0 | } |
10173 | | |
10174 | | /* |
10175 | | * Dissect the MS-RSVD stuff that turns up when HyperV uses SMB3.x |
10176 | | */ |
10177 | | static void |
10178 | | dissect_smb2_svhdx_open_device_context(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
10179 | 0 | { |
10180 | 0 | int offset = 0; |
10181 | 0 | uint32_t version; |
10182 | 0 | proto_item *item = NULL; |
10183 | 0 | proto_item *sub_tree; |
10184 | |
|
10185 | 0 | item = proto_tree_get_parent(tree); |
10186 | |
|
10187 | 0 | proto_item_append_text(item, ": SVHDX OPEN DEVICE CONTEXT"); |
10188 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_smb2_svhdx_open_device_context, NULL, "SVHDX OPEN DEVICE CONTEXT"); |
10189 | | |
10190 | | /* Version */ |
10191 | 0 | proto_tree_add_item_ret_uint(sub_tree, hf_smb2_svhdx_open_device_context_version, |
10192 | 0 | tvb, offset, 4, ENC_LITTLE_ENDIAN, &version); |
10193 | 0 | offset += 4; |
10194 | | |
10195 | | /* HasInitiatorId */ |
10196 | 0 | proto_tree_add_item(sub_tree, hf_smb2_svhdx_open_device_context_has_initiator_id, |
10197 | 0 | tvb, offset, 1, ENC_LITTLE_ENDIAN); |
10198 | 0 | offset += 1; |
10199 | | |
10200 | | /* Reserved */ |
10201 | 0 | proto_tree_add_item(sub_tree, hf_smb2_svhdx_open_device_context_reserved, |
10202 | 0 | tvb, offset, 3, ENC_NA); |
10203 | 0 | offset += 3; |
10204 | | |
10205 | | /* InitiatorId */ |
10206 | 0 | proto_tree_add_item(sub_tree, hf_smb2_svhdx_open_device_context_initiator_id, |
10207 | 0 | tvb, offset, 16, ENC_LITTLE_ENDIAN); |
10208 | 0 | offset += 16; |
10209 | | |
10210 | | /* Flags TODO: Dissect these*/ |
10211 | 0 | proto_tree_add_item(sub_tree, hf_smb2_svhdx_open_device_context_flags, |
10212 | 0 | tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10213 | 0 | offset += 4; |
10214 | | |
10215 | | /* OriginatorFlags */ |
10216 | 0 | proto_tree_add_item(sub_tree, hf_smb2_svhdx_open_device_context_originator_flags, |
10217 | 0 | tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10218 | 0 | offset += 4; |
10219 | | |
10220 | | /* OpenRequestId */ |
10221 | 0 | proto_tree_add_item(sub_tree, hf_smb2_svhdx_open_device_context_open_request_id, |
10222 | 0 | tvb, offset, 8, ENC_LITTLE_ENDIAN); |
10223 | 0 | offset += 8; |
10224 | | |
10225 | | /* InitiatorHostNameLength */ |
10226 | 0 | proto_tree_add_item(sub_tree, hf_smb2_svhdx_open_device_context_initiator_host_name_len, |
10227 | 0 | tvb, offset, 2, ENC_LITTLE_ENDIAN); |
10228 | 0 | offset += 2; |
10229 | | |
10230 | | /* InitiatorHostName */ |
10231 | 0 | proto_tree_add_item(sub_tree, hf_smb2_svhdx_open_device_context_initiator_host_name, |
10232 | 0 | tvb, offset, 126, ENC_ASCII); |
10233 | 0 | offset += 126; |
10234 | |
|
10235 | 0 | if (version == 2) { |
10236 | | /* VirtualDiskPropertiesInitialized */ |
10237 | 0 | proto_tree_add_item(sub_tree, hf_smb2_svhdx_open_device_context_virtual_disk_properties_initialized, |
10238 | 0 | tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10239 | 0 | offset += 4; |
10240 | | |
10241 | | /* ServerServiceVersion */ |
10242 | 0 | proto_tree_add_item(sub_tree, hf_smb2_svhdx_open_device_context_server_service_version, |
10243 | 0 | tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10244 | 0 | offset += 4; |
10245 | | |
10246 | | /* VirtualSectorSize */ |
10247 | 0 | proto_tree_add_item(sub_tree, hf_smb2_svhdx_open_device_context_virtual_sector_size, |
10248 | 0 | tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10249 | 0 | offset += 4; |
10250 | | |
10251 | | /* PhysicalSectorSize */ |
10252 | 0 | proto_tree_add_item(sub_tree, hf_smb2_svhdx_open_device_context_physical_sector_size, |
10253 | 0 | tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10254 | 0 | offset += 4; |
10255 | | |
10256 | | /* VirtualSize */ |
10257 | 0 | proto_tree_add_item(sub_tree, hf_smb2_svhdx_open_device_context_virtual_size, |
10258 | 0 | tvb, offset, 8, ENC_LITTLE_ENDIAN); |
10259 | 0 | } |
10260 | 0 | } |
10261 | | |
10262 | | /* |
10263 | | * SMB2_CREATE_APP_INSTANCE_VERSION |
10264 | | * 2 - structure size - 24 |
10265 | | * 2 - reserved |
10266 | | * 4 - padding |
10267 | | * 8 - AppInstanceVersionHigh |
10268 | | * 8 - AppInstanceVersionHigh |
10269 | | */ |
10270 | | |
10271 | | static void |
10272 | | dissect_smb2_app_instance_version_buffer_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
10273 | 0 | { |
10274 | 0 | int offset = 0; |
10275 | 0 | proto_item *item = NULL; |
10276 | 0 | proto_item *sub_tree; |
10277 | 0 | proto_item *version_sub_tree; |
10278 | 0 | uint64_t version_high; |
10279 | 0 | uint64_t version_low; |
10280 | |
|
10281 | 0 | item = proto_tree_get_parent(tree); |
10282 | |
|
10283 | 0 | proto_item_append_text(item, ": CREATE APP INSTANCE VERSION"); |
10284 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_smb2_app_instance_version_buffer, NULL, "APP INSTANCE VERSION"); |
10285 | | |
10286 | | /* struct size */ |
10287 | 0 | proto_tree_add_item(sub_tree, hf_smb2_app_instance_version_struct_size, |
10288 | 0 | tvb, offset, 2, ENC_LITTLE_ENDIAN); |
10289 | 0 | offset += 2; |
10290 | | |
10291 | | /* reserved */ |
10292 | 0 | proto_tree_add_item(sub_tree, hf_smb2_app_instance_version_reserved, |
10293 | 0 | tvb, offset, 2, ENC_LITTLE_ENDIAN); |
10294 | 0 | offset += 2; |
10295 | | |
10296 | | /* padding */ |
10297 | 0 | proto_tree_add_item(sub_tree, hf_smb2_app_instance_version_padding, |
10298 | 0 | tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10299 | 0 | offset += 4; |
10300 | |
|
10301 | 0 | version_sub_tree = proto_tree_add_subtree(sub_tree, tvb, offset, -1, ett_smb2_app_instance_version_buffer_version, NULL, "version"); |
10302 | | |
10303 | | /* version high */ |
10304 | 0 | proto_tree_add_item_ret_uint64(version_sub_tree, hf_smb2_app_instance_version_high, |
10305 | 0 | tvb, offset, 8, ENC_LITTLE_ENDIAN, &version_high); |
10306 | 0 | offset += 8; |
10307 | | |
10308 | | /* version low */ |
10309 | 0 | proto_tree_add_item_ret_uint64(version_sub_tree, hf_smb2_app_instance_version_low, |
10310 | 0 | tvb, offset, 8, ENC_LITTLE_ENDIAN, &version_low); |
10311 | |
|
10312 | 0 | proto_item_append_text(version_sub_tree, " : %" PRIu64 ".%" PRIu64, version_high, version_low); |
10313 | 0 | proto_item_append_text(sub_tree, ", version: %" PRIu64 ".%" PRIu64, version_high, version_low); |
10314 | 0 | } |
10315 | | |
10316 | | static void |
10317 | | dissect_smb2_app_instance_version_buffer_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) |
10318 | 0 | { |
10319 | 0 | report_create_context_malformed_buffer(tvb, pinfo, tree, "APP INSTANCE Version Response"); |
10320 | 0 | } |
10321 | | |
10322 | | static void |
10323 | | dissect_smb2_posix_buffer_request(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, smb2_info_t *si _U_) |
10324 | 0 | { |
10325 | 0 | int offset = 0; |
10326 | 0 | proto_item *item = NULL; |
10327 | |
|
10328 | 0 | item = proto_tree_get_parent(tree); |
10329 | 0 | proto_item_append_text(item, ": POSIX Create Context request"); |
10330 | | |
10331 | | /* POSIX mode bits */ |
10332 | 0 | proto_tree_add_item(tree, hf_smb2_posix_perms, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10333 | 0 | } |
10334 | | |
10335 | | static void |
10336 | | dissect_smb2_posix_buffer_response(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, smb2_info_t *si _U_) |
10337 | 0 | { |
10338 | 0 | int offset = 0; |
10339 | 0 | proto_item *item = NULL; |
10340 | |
|
10341 | 0 | item = proto_tree_get_parent(tree); |
10342 | 0 | proto_item_append_text(item, ": POSIX Create Context response"); |
10343 | | |
10344 | | /* Hardlinks */ |
10345 | 0 | proto_tree_add_item(tree, hf_smb2_nlinks, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10346 | 0 | offset += 4; |
10347 | | |
10348 | | /* Reparse tag */ |
10349 | 0 | proto_tree_add_item(tree, hf_smb2_reparse_tag, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10350 | 0 | offset += 4; |
10351 | | |
10352 | | /* POSIX mode bits */ |
10353 | 0 | proto_tree_add_item(tree, hf_smb2_posix_perms, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10354 | 0 | offset += 4; |
10355 | | |
10356 | | /* Owner and Group SID */ |
10357 | 0 | offset = dissect_nt_sid(tvb, pinfo, offset, tree, "Owner SID", NULL, -1); |
10358 | 0 | dissect_nt_sid(tvb, pinfo, offset, tree, "Group SID", NULL, -1); |
10359 | 0 | } |
10360 | | |
10361 | 0 | #define SMB2_AAPL_SERVER_QUERY 1 |
10362 | 0 | #define SMB2_AAPL_RESOLVE_ID 2 |
10363 | | |
10364 | | static const value_string aapl_command_code_vals[] = { |
10365 | | { SMB2_AAPL_SERVER_QUERY, "Server query"}, |
10366 | | { SMB2_AAPL_RESOLVE_ID, "Resolve ID"}, |
10367 | | { 0, NULL } |
10368 | | }; |
10369 | | |
10370 | 14 | #define SMB2_AAPL_SERVER_CAPS 0x00000001 |
10371 | 14 | #define SMB2_AAPL_VOLUME_CAPS 0x00000002 |
10372 | 14 | #define SMB2_AAPL_MODEL_INFO 0x00000004 |
10373 | | |
10374 | | static int * const aapl_server_query_bitmap_fields[] = { |
10375 | | &hf_smb2_aapl_server_query_bitmask_server_caps, |
10376 | | &hf_smb2_aapl_server_query_bitmask_volume_caps, |
10377 | | &hf_smb2_aapl_server_query_bitmask_model_info, |
10378 | | NULL |
10379 | | }; |
10380 | | |
10381 | 14 | #define SMB2_AAPL_SUPPORTS_READ_DIR_ATTR 0x00000001 |
10382 | 14 | #define SMB2_AAPL_SUPPORTS_OSX_COPYFILE 0x00000002 |
10383 | 14 | #define SMB2_AAPL_UNIX_BASED 0x00000004 |
10384 | 14 | #define SMB2_AAPL_SUPPORTS_NFS_ACE 0x00000008 |
10385 | | |
10386 | | static int * const aapl_server_query_caps_fields[] = { |
10387 | | &hf_smb2_aapl_server_query_caps_supports_read_dir_attr, |
10388 | | &hf_smb2_aapl_server_query_caps_supports_osx_copyfile, |
10389 | | &hf_smb2_aapl_server_query_caps_unix_based, |
10390 | | &hf_smb2_aapl_server_query_caps_supports_nfs_ace, |
10391 | | NULL |
10392 | | }; |
10393 | | |
10394 | | static void |
10395 | | dissect_smb2_AAPL_buffer_request(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, smb2_info_t *si _U_) |
10396 | 0 | { |
10397 | 0 | int offset = 0; |
10398 | 0 | proto_item *item = NULL; |
10399 | 0 | proto_item *sub_tree; |
10400 | 0 | uint32_t command_code; |
10401 | |
|
10402 | 0 | item = proto_tree_get_parent(tree); |
10403 | |
|
10404 | 0 | proto_item_append_text(item, ": AAPL Create Context request"); |
10405 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_smb2_aapl_create_context_request, NULL, "AAPL Create Context request"); |
10406 | | |
10407 | | /* Command code */ |
10408 | 0 | proto_tree_add_item_ret_uint(sub_tree, hf_smb2_aapl_command_code, |
10409 | 0 | tvb, offset, 4, ENC_LITTLE_ENDIAN, &command_code); |
10410 | 0 | offset += 4; |
10411 | | |
10412 | | /* Reserved */ |
10413 | 0 | proto_tree_add_item(sub_tree, hf_smb2_aapl_reserved, |
10414 | 0 | tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10415 | 0 | offset += 4; |
10416 | |
|
10417 | 0 | switch (command_code) { |
10418 | | |
10419 | 0 | case SMB2_AAPL_SERVER_QUERY: |
10420 | | /* Request bitmap */ |
10421 | 0 | proto_tree_add_bitmask(sub_tree, tvb, offset, |
10422 | 0 | hf_smb2_aapl_server_query_bitmask, |
10423 | 0 | ett_smb2_aapl_server_query_bitmask, |
10424 | 0 | aapl_server_query_bitmap_fields, |
10425 | 0 | ENC_LITTLE_ENDIAN); |
10426 | 0 | offset += 8; |
10427 | | |
10428 | | /* Client capabilities */ |
10429 | 0 | proto_tree_add_bitmask(sub_tree, tvb, offset, |
10430 | 0 | hf_smb2_aapl_server_query_caps, |
10431 | 0 | ett_smb2_aapl_server_query_caps, |
10432 | 0 | aapl_server_query_caps_fields, |
10433 | 0 | ENC_LITTLE_ENDIAN); |
10434 | 0 | break; |
10435 | | |
10436 | 0 | case SMB2_AAPL_RESOLVE_ID: |
10437 | | /* file ID */ |
10438 | 0 | proto_tree_add_item(sub_tree, hf_smb2_file_id, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
10439 | 0 | break; |
10440 | | |
10441 | 0 | default: |
10442 | 0 | break; |
10443 | 0 | } |
10444 | 0 | } |
10445 | | |
10446 | 14 | #define SMB2_AAPL_SUPPORTS_RESOLVE_ID 0x00000001 |
10447 | 14 | #define SMB2_AAPL_CASE_SENSITIVE 0x00000002 |
10448 | 14 | #define SMB2_AAPL_SUPPORTS_FULL_SYNC 0x00000004 |
10449 | | |
10450 | | static int * const aapl_server_query_volume_caps_fields[] = { |
10451 | | &hf_smb2_aapl_server_query_volume_caps_support_resolve_id, |
10452 | | &hf_smb2_aapl_server_query_volume_caps_case_sensitive, |
10453 | | &hf_smb2_aapl_server_query_volume_caps_supports_full_sync, |
10454 | | NULL |
10455 | | }; |
10456 | | |
10457 | | static void |
10458 | | dissect_smb2_AAPL_buffer_response(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, smb2_info_t *si _U_) |
10459 | 0 | { |
10460 | 0 | int offset = 0; |
10461 | 0 | proto_item *item = NULL; |
10462 | 0 | proto_item *sub_tree; |
10463 | 0 | uint32_t command_code; |
10464 | 0 | uint64_t server_query_bitmask; |
10465 | |
|
10466 | 0 | item = proto_tree_get_parent(tree); |
10467 | |
|
10468 | 0 | proto_item_append_text(item, ": AAPL Create Context response"); |
10469 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_smb2_aapl_create_context_response, NULL, "AAPL Create Context response"); |
10470 | | |
10471 | | /* Command code */ |
10472 | 0 | proto_tree_add_item_ret_uint(sub_tree, hf_smb2_aapl_command_code, |
10473 | 0 | tvb, offset, 4, ENC_LITTLE_ENDIAN, &command_code); |
10474 | 0 | offset += 4; |
10475 | | |
10476 | | /* Reserved */ |
10477 | 0 | proto_tree_add_item(sub_tree, hf_smb2_aapl_reserved, |
10478 | 0 | tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10479 | 0 | offset += 4; |
10480 | |
|
10481 | 0 | switch (command_code) { |
10482 | | |
10483 | 0 | case SMB2_AAPL_SERVER_QUERY: |
10484 | | /* Reply bitmap */ |
10485 | 0 | proto_tree_add_bitmask_ret_uint64(sub_tree, tvb, offset, |
10486 | 0 | hf_smb2_aapl_server_query_bitmask, |
10487 | 0 | ett_smb2_aapl_server_query_bitmask, |
10488 | 0 | aapl_server_query_bitmap_fields, |
10489 | 0 | ENC_LITTLE_ENDIAN, |
10490 | 0 | &server_query_bitmask); |
10491 | 0 | offset += 8; |
10492 | |
|
10493 | 0 | if (server_query_bitmask & SMB2_AAPL_SERVER_CAPS) { |
10494 | | /* Server capabilities */ |
10495 | 0 | proto_tree_add_bitmask(sub_tree, tvb, offset, |
10496 | 0 | hf_smb2_aapl_server_query_caps, |
10497 | 0 | ett_smb2_aapl_server_query_caps, |
10498 | 0 | aapl_server_query_caps_fields, |
10499 | 0 | ENC_LITTLE_ENDIAN); |
10500 | 0 | offset += 8; |
10501 | 0 | } |
10502 | 0 | if (server_query_bitmask & SMB2_AAPL_VOLUME_CAPS) { |
10503 | | /* Volume capabilities */ |
10504 | 0 | proto_tree_add_bitmask(sub_tree, tvb, offset, |
10505 | 0 | hf_smb2_aapl_server_query_volume_caps, |
10506 | 0 | ett_smb2_aapl_server_query_volume_caps, |
10507 | 0 | aapl_server_query_volume_caps_fields, |
10508 | 0 | ENC_LITTLE_ENDIAN); |
10509 | 0 | offset += 8; |
10510 | 0 | } |
10511 | 0 | if (server_query_bitmask & SMB2_AAPL_MODEL_INFO) { |
10512 | | /* Padding */ |
10513 | 0 | offset += 4; |
10514 | | |
10515 | | /* Model string */ |
10516 | 0 | proto_tree_add_item(sub_tree, hf_smb2_aapl_server_query_model_string, |
10517 | 0 | tvb, offset, 4, |
10518 | 0 | ENC_UTF_16|ENC_LITTLE_ENDIAN); |
10519 | 0 | } |
10520 | 0 | break; |
10521 | | |
10522 | 0 | case SMB2_AAPL_RESOLVE_ID: |
10523 | | /* NT status */ |
10524 | 0 | proto_tree_add_item(sub_tree, hf_smb2_nt_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10525 | 0 | offset += 4; |
10526 | | |
10527 | | /* Server path */ |
10528 | 0 | proto_tree_add_item(sub_tree, hf_smb2_aapl_server_query_server_path, |
10529 | 0 | tvb, offset, 4, |
10530 | 0 | ENC_UTF_16|ENC_LITTLE_ENDIAN); |
10531 | 0 | break; |
10532 | | |
10533 | 0 | default: |
10534 | 0 | break; |
10535 | 0 | } |
10536 | 0 | } |
10537 | | |
10538 | | typedef void (*create_context_data_dissector_t)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si); |
10539 | | |
10540 | | typedef struct create_context_data_dissectors { |
10541 | | create_context_data_dissector_t request; |
10542 | | create_context_data_dissector_t response; |
10543 | | } create_context_data_dissectors_t; |
10544 | | |
10545 | | struct create_context_data_tag_dissectors { |
10546 | | const char *tag; |
10547 | | const char *val; |
10548 | | create_context_data_dissectors_t dissectors; |
10549 | | }; |
10550 | | |
10551 | | static struct create_context_data_tag_dissectors create_context_dissectors_array[] = { |
10552 | | { "ExtA", "SMB2_CREATE_EA_BUFFER", |
10553 | | { dissect_smb2_ExtA_buffer_request, dissect_smb2_ExtA_buffer_response } }, |
10554 | | { "SecD", "SMB2_CREATE_SD_BUFFER", |
10555 | | { dissect_smb2_SecD_buffer_request, dissect_smb2_SecD_buffer_response } }, |
10556 | | { "AlSi", "SMB2_CREATE_ALLOCATION_SIZE", |
10557 | | { dissect_smb2_AlSi_buffer_request, dissect_smb2_AlSi_buffer_response } }, |
10558 | | { "MxAc", "SMB2_CREATE_QUERY_MAXIMAL_ACCESS_REQUEST", |
10559 | | { dissect_smb2_MxAc_buffer_request, dissect_smb2_MxAc_buffer_response } }, |
10560 | | { "DHnQ", "SMB2_CREATE_DURABLE_HANDLE_REQUEST", |
10561 | | { dissect_smb2_DHnQ_buffer_request, dissect_smb2_DHnQ_buffer_response } }, |
10562 | | { "DHnC", "SMB2_CREATE_DURABLE_HANDLE_RECONNECT", |
10563 | | { dissect_smb2_DHnC_buffer_request, dissect_smb2_DHnC_buffer_response } }, |
10564 | | { "DH2Q", "SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2", |
10565 | | { dissect_smb2_DH2Q_buffer_request, dissect_smb2_DH2Q_buffer_response } }, |
10566 | | { "DH2C", "SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2", |
10567 | | { dissect_smb2_DH2C_buffer_request, dissect_smb2_DH2C_buffer_response } }, |
10568 | | { "TWrp", "SMB2_CREATE_TIMEWARP_TOKEN", |
10569 | | { dissect_smb2_TWrp_buffer_request, dissect_smb2_TWrp_buffer_response } }, |
10570 | | { "QFid", "SMB2_CREATE_QUERY_ON_DISK_ID", |
10571 | | { dissect_smb2_QFid_buffer_request, dissect_smb2_QFid_buffer_response } }, |
10572 | | { "RqLs", "SMB2_CREATE_REQUEST_LEASE", |
10573 | | { dissect_smb2_RqLs_buffer_request, dissect_smb2_RqLs_buffer_response } }, |
10574 | | { "744D142E-46FA-0890-4AF7-A7EF6AA6BC45", "SMB2_CREATE_APP_INSTANCE_ID", |
10575 | | { dissect_smb2_APP_INSTANCE_buffer_request, dissect_smb2_APP_INSTANCE_buffer_response } }, |
10576 | | { "6aa6bc45-a7ef-4af7-9008-fa462e144d74", "SMB2_CREATE_APP_INSTANCE_ID", |
10577 | | { dissect_smb2_APP_INSTANCE_buffer_request, dissect_smb2_APP_INSTANCE_buffer_response } }, |
10578 | | { "9ecfcb9c-c104-43e6-980e-158da1f6ec83", "SVHDX_OPEN_DEVICE_CONTEXT", |
10579 | | { dissect_smb2_svhdx_open_device_context, dissect_smb2_svhdx_open_device_context} }, |
10580 | | { "b7d082b9-563b-4f07-a07b-524a8116a010", "SMB2_CREATE_APP_INSTANCE_VERSION", |
10581 | | { dissect_smb2_app_instance_version_buffer_request, dissect_smb2_app_instance_version_buffer_response } }, |
10582 | | { "5025ad93-b49c-e711-b423-83de968bcd7c", "SMB2_POSIX_CREATE_CONTEXT", |
10583 | | { dissect_smb2_posix_buffer_request, dissect_smb2_posix_buffer_response } }, |
10584 | | { "AAPL", "SMB2_AAPL_CREATE_CONTEXT", |
10585 | | { dissect_smb2_AAPL_buffer_request, dissect_smb2_AAPL_buffer_response } }, |
10586 | | }; |
10587 | | |
10588 | | static struct create_context_data_tag_dissectors* |
10589 | | get_create_context_data_tag_dissectors(const char *tag) |
10590 | 0 | { |
10591 | 0 | static struct create_context_data_tag_dissectors INVALID = { |
10592 | 0 | NULL, "<invalid>", { NULL, NULL } |
10593 | 0 | }; |
10594 | |
|
10595 | 0 | size_t i; |
10596 | |
|
10597 | 0 | for (i = 0; i<array_length(create_context_dissectors_array); i++) { |
10598 | 0 | if (!strcmp(tag, create_context_dissectors_array[i].tag)) |
10599 | 0 | return &create_context_dissectors_array[i]; |
10600 | 0 | } |
10601 | 0 | return &INVALID; |
10602 | 0 | } |
10603 | | |
10604 | | static void |
10605 | | // NOLINTNEXTLINE(misc-no-recursion) |
10606 | | dissect_smb2_create_extra_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, smb2_info_t *si) |
10607 | 0 | { |
10608 | 0 | offset_length_buffer_t tag_olb; |
10609 | 0 | offset_length_buffer_t data_olb; |
10610 | 0 | const uint8_t *tag; |
10611 | 0 | uint16_t chain_offset; |
10612 | 0 | int offset = 0; |
10613 | 0 | int len = -1; |
10614 | 0 | proto_item *sub_item; |
10615 | 0 | proto_tree *sub_tree; |
10616 | 0 | proto_item *parent_item = NULL; |
10617 | 0 | create_context_data_dissectors_t *dissectors = NULL; |
10618 | 0 | create_context_data_dissector_t dissector = NULL; |
10619 | 0 | struct create_context_data_tag_dissectors *tag_dissectors; |
10620 | |
|
10621 | 0 | chain_offset = tvb_get_letohl(tvb, offset); |
10622 | 0 | if (chain_offset) { |
10623 | 0 | len = chain_offset; |
10624 | 0 | } |
10625 | |
|
10626 | 0 | sub_tree = proto_tree_add_subtree(parent_tree, tvb, offset, len, ett_smb2_create_chain_element, &sub_item, "Chain Element"); |
10627 | 0 | parent_item = proto_tree_get_parent(parent_tree); |
10628 | | |
10629 | | /* chain offset */ |
10630 | 0 | proto_tree_add_item(sub_tree, hf_smb2_create_chain_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10631 | 0 | offset += 4; |
10632 | | |
10633 | | /* tag offset/length */ |
10634 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &tag_olb, OLB_O_UINT16_S_UINT32, hf_smb2_tag); |
10635 | | |
10636 | | /* data offset/length */ |
10637 | 0 | dissect_smb2_olb_length_offset(tvb, offset, &data_olb, OLB_O_UINT16_S_UINT32, hf_smb2_create_chain_data); |
10638 | | |
10639 | | /* |
10640 | | * These things are all either 4-char strings, like DH2C, or GUIDs, |
10641 | | * however, at least one of them appears to be a GUID as a string and |
10642 | | * one appears to be a binary guid. So, check if the length is |
10643 | | * 16, and if so, pull the GUID and convert it to a string. Otherwise |
10644 | | * call dissect_smb2_olb_string. |
10645 | | */ |
10646 | 0 | if (tag_olb.len == 16) { |
10647 | 0 | e_guid_t tag_guid; |
10648 | 0 | proto_item *tag_item; |
10649 | 0 | proto_tree *tag_tree; |
10650 | |
|
10651 | 0 | tvb_get_letohguid(tvb, tag_olb.off, &tag_guid); |
10652 | 0 | tag = guid_to_str(pinfo->pool, &tag_guid); |
10653 | |
|
10654 | 0 | tag_item = proto_tree_add_string(sub_tree, tag_olb.hfindex, tvb, tag_olb.off, tag_olb.len, tag); |
10655 | 0 | tag_tree = proto_item_add_subtree(tag_item, ett_smb2_olb); |
10656 | 0 | proto_tree_add_item(tag_tree, hf_smb2_olb_offset, tvb, tag_olb.off_offset, 2, ENC_LITTLE_ENDIAN); |
10657 | 0 | proto_tree_add_item(tag_tree, hf_smb2_olb_length, tvb, tag_olb.len_offset, 2, ENC_LITTLE_ENDIAN); |
10658 | |
|
10659 | 0 | } else { |
10660 | | /* tag string */ |
10661 | 0 | tag = dissect_smb2_olb_string(pinfo, sub_tree, tvb, &tag_olb, OLB_TYPE_ASCII_STRING); |
10662 | 0 | } |
10663 | |
|
10664 | 0 | tag_dissectors = get_create_context_data_tag_dissectors(tag); |
10665 | |
|
10666 | 0 | proto_item_append_text(parent_item, " %s", tag_dissectors->val); |
10667 | 0 | proto_item_append_text(sub_item, ": %s \"%s\"", tag_dissectors->val, tag); |
10668 | | |
10669 | | /* data */ |
10670 | 0 | dissectors = &tag_dissectors->dissectors; |
10671 | 0 | if (dissectors) |
10672 | 0 | dissector = (si->flags & SMB2_FLAGS_RESPONSE) ? dissectors->response : dissectors->request; |
10673 | |
|
10674 | 0 | dissect_smb2_olb_buffer(pinfo, sub_tree, tvb, &data_olb, si, dissector); |
10675 | |
|
10676 | 0 | if (chain_offset) { |
10677 | 0 | tvbuff_t *chain_tvb; |
10678 | 0 | chain_tvb = tvb_new_subset_remaining(tvb, chain_offset); |
10679 | | |
10680 | | /* next extra info */ |
10681 | 0 | increment_dissection_depth(pinfo); |
10682 | 0 | dissect_smb2_create_extra_info(chain_tvb, pinfo, parent_tree, si); |
10683 | 0 | decrement_dissection_depth(pinfo); |
10684 | 0 | } |
10685 | 0 | } |
10686 | | |
10687 | | static int |
10688 | | dissect_smb2_create_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
10689 | 0 | { |
10690 | 0 | offset_length_buffer_t f_olb, e_olb; |
10691 | 0 | const uint8_t *fname; |
10692 | 0 | proto_item *item; |
10693 | 0 | proto_tree *tag_tree = NULL; |
10694 | 0 | proto_item *tag_item = NULL; |
10695 | | |
10696 | | /* buffer code */ |
10697 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
10698 | | |
10699 | | /* security flags */ |
10700 | 0 | offset++; |
10701 | | |
10702 | | /* oplock */ |
10703 | 0 | offset = dissect_smb2_oplock(tree, tvb, offset); |
10704 | | |
10705 | | /* impersonation level */ |
10706 | 0 | proto_tree_add_item(tree, hf_smb2_impersonation_level, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10707 | 0 | offset += 4; |
10708 | | |
10709 | | /* create flags */ |
10710 | 0 | proto_tree_add_item(tree, hf_smb2_create_flags, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
10711 | 0 | offset += 8; |
10712 | | |
10713 | | /* reserved */ |
10714 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 8, ENC_NA); |
10715 | 0 | offset += 8; |
10716 | | |
10717 | | /* access mask */ |
10718 | 0 | offset = dissect_smb_access_mask(tvb, tree, offset); |
10719 | | |
10720 | | /* File Attributes */ |
10721 | 0 | if (si->file) { |
10722 | 0 | if (tvb_get_letohl(tvb, offset) & 0x10) |
10723 | 0 | si->file->is_dir = TRUE; |
10724 | 0 | else |
10725 | 0 | si->file->is_dir = FALSE; |
10726 | 0 | } |
10727 | 0 | offset = dissect_fscc_file_attr(tvb, tree, offset, NULL); |
10728 | | |
10729 | | /* share access */ |
10730 | 0 | offset = dissect_nt_share_access(tvb, tree, offset); |
10731 | | |
10732 | | /* create disposition */ |
10733 | 0 | proto_tree_add_item(tree, hf_smb2_create_disposition, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10734 | 0 | offset += 4; |
10735 | | |
10736 | | /* create options */ |
10737 | 0 | offset = dissect_nt_create_options(tvb, tree, offset); |
10738 | |
|
10739 | 0 | if (tvb_get_letohl(tvb, offset-4) & 0x1000) { |
10740 | 0 | col_append_str(pinfo->cinfo, COL_INFO, ", (delete on close)"); |
10741 | 0 | if (si->file) |
10742 | 0 | si->file->delete_on_close = TRUE; |
10743 | 0 | } |
10744 | |
|
10745 | 0 | if (si->file) |
10746 | 0 | si->file->frame_beg = pinfo->fd->num; |
10747 | 0 | if (si->saved) |
10748 | 0 | si->saved->frame_beg = pinfo->fd->num; |
10749 | |
|
10750 | 0 | if (pinfo->fd->visited) { |
10751 | 0 | if (si->saved && si->saved->uuid_fid.data1 > 0) { |
10752 | 0 | tag_item = proto_tree_add_guid(tree, hf_smb2_fid, tvb, 0, 0, |
10753 | 0 | (e_guid_t *)&si->saved->uuid_fid); |
10754 | 0 | proto_item_set_generated(tag_item); |
10755 | 0 | tag_tree = proto_item_add_subtree(tag_item, ett_smb2_fid_str); |
10756 | 0 | } else { |
10757 | 0 | tag_tree = tree; |
10758 | 0 | } |
10759 | 0 | if (si->saved && si->saved->fid_hash) { |
10760 | 0 | item = proto_tree_add_uint_format(tag_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
10761 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
10762 | 0 | proto_item_set_generated(item); |
10763 | 0 | } |
10764 | 0 | item = proto_tree_add_uint(tag_tree, hf_frame_handle_opened, tvb, 0, 0, pinfo->fd->num); |
10765 | 0 | proto_item_set_generated(item); |
10766 | |
|
10767 | 0 | if (si->file && si->file->frame_end > 0 && si->file->frame_end < UINT32_MAX) { |
10768 | 0 | item = proto_tree_add_uint(tag_tree, hf_frame_handle_closed, tvb, 0, 0, |
10769 | 0 | si->file->frame_end); |
10770 | 0 | proto_item_set_generated(item); |
10771 | 0 | } else if (si->saved && si->saved->frame_end > 0 && si->saved->frame_end < UINT32_MAX) { |
10772 | 0 | item = proto_tree_add_uint(tag_tree, hf_frame_handle_closed, tvb, 0, 0, |
10773 | 0 | si->saved->frame_end); |
10774 | 0 | proto_item_set_generated(item); |
10775 | 0 | } |
10776 | 0 | } |
10777 | | |
10778 | | /* Blobs offset/length */ |
10779 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &f_olb, OLB_O_UINT16_S_UINT16, hf_smb2_filename); |
10780 | | |
10781 | | /* extrainfo offset */ |
10782 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &e_olb, OLB_O_UINT32_S_UINT32, hf_smb2_extrainfo); |
10783 | | |
10784 | | /* filename string */ |
10785 | 0 | fname = dissect_smb2_olb_string(pinfo, tag_tree, tvb, &f_olb, OLB_TYPE_UNICODE_STRING); |
10786 | 0 | if (strcmp(fname, "") == 0) |
10787 | 0 | fname = wmem_strdup(wmem_file_scope(),"<share>"); |
10788 | |
|
10789 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", |
10790 | 0 | format_text(pinfo->pool, fname, strlen(fname))); |
10791 | | |
10792 | | /* save the name if it looks sane */ |
10793 | 0 | if (!pinfo->fd->visited) { |
10794 | 0 | if (si->saved && si->saved->extra_info_type == SMB2_EI_FILENAME) { |
10795 | 0 | wmem_free(wmem_file_scope(), si->saved->extra_info); |
10796 | 0 | si->saved->extra_info = NULL; |
10797 | 0 | si->saved->extra_info_type = SMB2_EI_NONE; |
10798 | 0 | } |
10799 | 0 | if (si->saved && f_olb.len < 1024) { |
10800 | 0 | si->saved->extra_info_type = SMB2_EI_FILENAME; |
10801 | 0 | si->saved->extra_info = wmem_strdup(wmem_file_scope(), fname); |
10802 | 0 | } |
10803 | 0 | } |
10804 | | |
10805 | | /* If extrainfo_offset is non-null then this points to another |
10806 | | * buffer. The offset is relative to the start of the smb packet |
10807 | | */ |
10808 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &e_olb, si, dissect_smb2_create_extra_info); |
10809 | |
|
10810 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &f_olb); |
10811 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &e_olb); |
10812 | |
|
10813 | 0 | return offset; |
10814 | 0 | } |
10815 | | |
10816 | 14 | #define SMB2_CREATE_REP_FLAGS_REPARSE_POINT 0x01 |
10817 | | |
10818 | | static int |
10819 | | dissect_smb2_create_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
10820 | 0 | { |
10821 | 0 | uint64_t end_of_file; |
10822 | 0 | uint32_t attr_mask; |
10823 | 0 | offset_length_buffer_t e_olb; |
10824 | 0 | e_guid_t tag_guid; |
10825 | 0 | static int * const create_rep_flags_fields[] = { |
10826 | 0 | &hf_smb2_create_rep_flags_reparse_point, |
10827 | 0 | NULL |
10828 | 0 | }; |
10829 | 0 | bool continue_dissection; |
10830 | 0 | proto_item *item = NULL; |
10831 | 0 | proto_tree *tag_tree = NULL; |
10832 | 0 | proto_tree *which_tree = tree; |
10833 | | |
10834 | |
|
10835 | 0 | switch (si->status) { |
10836 | | /* buffer code */ |
10837 | 0 | case 0x00000000: offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); break; |
10838 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
10839 | 0 | if (!continue_dissection) return offset; |
10840 | 0 | } |
10841 | | |
10842 | | /* oplock */ |
10843 | 0 | offset = dissect_smb2_oplock(tree, tvb, offset); |
10844 | | |
10845 | | /* reserved */ |
10846 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_create_rep_flags, |
10847 | 0 | ett_smb2_create_rep_flags, create_rep_flags_fields, ENC_LITTLE_ENDIAN); |
10848 | 0 | offset += 1; |
10849 | | |
10850 | | /* create action */ |
10851 | 0 | proto_tree_add_item(tree, hf_smb2_create_action, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10852 | 0 | offset += 4; |
10853 | | |
10854 | | /* create time */ |
10855 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_create_timestamp, ENC_LITTLE_ENDIAN); |
10856 | 0 | offset += 8; |
10857 | | |
10858 | | /* last access */ |
10859 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_access_timestamp, ENC_LITTLE_ENDIAN); |
10860 | 0 | offset += 8; |
10861 | | |
10862 | | /* last write */ |
10863 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_write_timestamp, ENC_LITTLE_ENDIAN); |
10864 | 0 | offset += 8; |
10865 | | |
10866 | | /* last change */ |
10867 | 0 | dissect_nttime(tvb, tree, offset, hf_smb2_last_change_timestamp, ENC_LITTLE_ENDIAN); |
10868 | 0 | offset += 8; |
10869 | | |
10870 | | /* allocation size */ |
10871 | 0 | proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
10872 | 0 | offset += 8; |
10873 | | |
10874 | | /* end of file */ |
10875 | 0 | end_of_file = tvb_get_letoh64(tvb, offset); |
10876 | 0 | if (si->eo_file_info) { |
10877 | 0 | si->eo_file_info->end_of_file = tvb_get_letoh64(tvb, offset); |
10878 | 0 | } |
10879 | 0 | proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
10880 | 0 | offset += 8; |
10881 | | |
10882 | | /* File Attributes */ |
10883 | 0 | offset = dissect_fscc_file_attr(tvb, tree, offset, &attr_mask); |
10884 | | |
10885 | | /* reserved */ |
10886 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
10887 | 0 | offset += 4; |
10888 | | |
10889 | | /* Save the GUID for use in the *request* */ |
10890 | 0 | tvb_get_letohguid(tvb, offset, &tag_guid); |
10891 | 0 | if (si->saved) |
10892 | 0 | si->saved->uuid_fid = tag_guid; |
10893 | |
|
10894 | 0 | if (si->file && si->file->delete_on_close) |
10895 | 0 | col_append_str(pinfo->cinfo, COL_INFO, ", (delete on close)"); |
10896 | | |
10897 | | /* Display the GUID subtree */ |
10898 | 0 | offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_OPEN); |
10899 | |
|
10900 | 0 | if (si->saved && si->saved->hnd_item && si->file && si->file->name) { |
10901 | 0 | tag_tree = proto_item_add_subtree(si->saved->hnd_item, ett_smb2_fid_str); |
10902 | 0 | if (strcmp(si->file->name, "") == 0) |
10903 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
10904 | 0 | item = proto_tree_add_string(tag_tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
10905 | 0 | proto_item_set_generated(item); |
10906 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
10907 | 0 | which_tree = tag_tree; |
10908 | |
|
10909 | 0 | } else if (si->file && si->file->name) { |
10910 | 0 | if (strcmp(si->file->name, "") == 0) |
10911 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
10912 | 0 | item = proto_tree_add_string(tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
10913 | 0 | proto_item_set_generated(item); |
10914 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
10915 | 0 | } |
10916 | |
|
10917 | 0 | if (si->saved) { |
10918 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
10919 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
10920 | 0 | proto_item_set_generated(item); |
10921 | 0 | } |
10922 | |
|
10923 | 0 | if (si->saved) { |
10924 | 0 | si->saved->frame_beg = pinfo->fd->num; |
10925 | 0 | } |
10926 | 0 | if (si->file) |
10927 | 0 | si->file->frame_beg = pinfo->fd->num; |
10928 | | |
10929 | | /* We save this after dissect_smb2_fid just because it would be |
10930 | | possible to have this response without having the matching request. |
10931 | | In that case the entry in the file info hash table has been created |
10932 | | in dissect_smb2_fid */ |
10933 | 0 | if (si->eo_file_info) { |
10934 | 0 | si->eo_file_info->end_of_file = end_of_file; |
10935 | 0 | si->eo_file_info->attr_mask = attr_mask; |
10936 | 0 | } |
10937 | | |
10938 | | /* extrainfo offset */ |
10939 | 0 | offset = dissect_smb2_olb_length_offset(tvb, offset, &e_olb, OLB_O_UINT32_S_UINT32, hf_smb2_extrainfo); |
10940 | | |
10941 | | /* If extrainfo_offset is non-null then this points to another |
10942 | | * buffer. The offset is relative to the start of the smb packet |
10943 | | */ |
10944 | 0 | if (e_olb.off < 0xffff && e_olb.len < 0xfffff) { /* Sanity check: if the create_request is missing, |
10945 | | the offset and length are enormous (bogus). */ |
10946 | 0 | dissect_smb2_olb_buffer(pinfo, tree, tvb, &e_olb, si, dissect_smb2_create_extra_info); |
10947 | |
|
10948 | 0 | offset = dissect_smb2_olb_tvb_max_offset(offset, &e_olb); |
10949 | 0 | } |
10950 | | /* free si->saved->extra_info we don't need it any more */ |
10951 | 0 | if (si->saved && si->saved->extra_info_type == SMB2_EI_FILENAME) { |
10952 | 0 | wmem_free(wmem_file_scope(), si->saved->extra_info); |
10953 | 0 | si->saved->extra_info = NULL; |
10954 | 0 | si->saved->extra_info_type = SMB2_EI_NONE; |
10955 | 0 | } |
10956 | |
|
10957 | 0 | return offset; |
10958 | 0 | } |
10959 | | |
10960 | | |
10961 | | static int |
10962 | | dissect_smb2_setinfo_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
10963 | 0 | { |
10964 | 0 | uint32_t setinfo_size; |
10965 | 0 | uint16_t setinfo_offset; |
10966 | 0 | proto_item *item = NULL; |
10967 | 0 | proto_tree *fid_tree; |
10968 | 0 | proto_tree *which_tree; |
10969 | 0 | e_guid_t tag_guid; |
10970 | | |
10971 | | /* buffer code */ |
10972 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
10973 | | |
10974 | | /* class and info level */ |
10975 | 0 | offset = dissect_smb2_class_infolevel(pinfo, tvb, offset, tree, si); |
10976 | | |
10977 | | /* size */ |
10978 | 0 | setinfo_size = tvb_get_letohl(tvb, offset); |
10979 | 0 | proto_tree_add_item(tree, hf_smb2_setinfo_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10980 | 0 | offset += 4; |
10981 | | |
10982 | | /* offset */ |
10983 | 0 | setinfo_offset = tvb_get_letohs(tvb, offset); |
10984 | 0 | proto_tree_add_item(tree, hf_smb2_setinfo_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
10985 | 0 | offset += 2; |
10986 | | |
10987 | | /* reserved */ |
10988 | 0 | proto_tree_add_item(tree, hf_smb2_setinfo_reserved, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
10989 | 0 | offset += 2; |
10990 | |
|
10991 | 0 | if (si->saved && si->saved->smb2_class == SMB2_CLASS_SEC_INFO) { |
10992 | | /* AdditionalInformation (4 bytes): Provides additional information to the server. |
10993 | | If security information is being set, this value MUST contain a 4-byte bit field |
10994 | | of flags indicating what security attributes MUST be applied. */ |
10995 | 0 | offset = dissect_additional_information_sec_mask(tvb, tree, offset); |
10996 | 0 | } else { |
10997 | | /* For all other set requests, this field MUST be 0. */ |
10998 | 0 | proto_tree_add_item(tree, hf_smb2_getsetinfo_additional, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
10999 | 0 | offset += 4; |
11000 | 0 | } |
11001 | | |
11002 | | /* Save the FID for use in responses and the create request */ |
11003 | 0 | tvb_get_letohguid(tvb, offset, &tag_guid); |
11004 | 0 | if (si->saved) { |
11005 | 0 | si->saved->uuid_fid = tag_guid; |
11006 | 0 | } |
11007 | | |
11008 | | /* fid */ |
11009 | 0 | dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); |
11010 | |
|
11011 | 0 | if (si->saved && si->saved->hnd_item) { |
11012 | 0 | fid_tree = proto_item_add_subtree(si->saved->hnd_item, ett_smb2_fid_str); |
11013 | 0 | which_tree = fid_tree; |
11014 | 0 | } else { |
11015 | 0 | which_tree = tree; |
11016 | 0 | } |
11017 | | |
11018 | | /* Filename */ |
11019 | 0 | if (si->file && si->file->name) { |
11020 | 0 | if (strcmp(si->file->name, "") == 0) |
11021 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
11022 | 0 | item = proto_tree_add_string(which_tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
11023 | 0 | proto_item_set_generated(item); |
11024 | 0 | } |
11025 | | |
11026 | | /* fid hash */ |
11027 | 0 | if (si->saved && si->saved->fid_hash) { |
11028 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
11029 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
11030 | 0 | proto_item_set_generated(item); |
11031 | 0 | } |
11032 | | |
11033 | | /* data */ |
11034 | 0 | if (si->saved) |
11035 | 0 | dissect_smb2_infolevel(tvb, pinfo, tree, setinfo_offset, si, si->saved->smb2_class, si->saved->infolevel); |
11036 | 0 | offset = setinfo_offset + setinfo_size; |
11037 | |
|
11038 | 0 | return offset; |
11039 | 0 | } |
11040 | | |
11041 | | static int |
11042 | | dissect_smb2_setinfo_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
11043 | 0 | { |
11044 | 0 | bool continue_dissection; |
11045 | 0 | proto_item *item = NULL; |
11046 | 0 | proto_tree *tag_tree = NULL; |
11047 | 0 | proto_item *tag_item = NULL; |
11048 | 0 | proto_tree *which_tree = NULL; |
11049 | | |
11050 | | /* class/infolevel */ |
11051 | 0 | dissect_smb2_class_infolevel(pinfo, tvb, offset, tree, si); |
11052 | |
|
11053 | 0 | if (pinfo->fd->visited) { |
11054 | 0 | if (si->file && si->file->name) { |
11055 | 0 | if (strcmp(si->file->name, "") == 0) |
11056 | 0 | si->file->name = wmem_strdup(wmem_file_scope(),"<share>"); |
11057 | 0 | tag_item = proto_tree_add_string(tree, hf_smb2_filename, tvb, 0, 0, si->file->name); |
11058 | 0 | tag_tree = proto_item_add_subtree(tag_item, ett_smb2_fid_str); |
11059 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", si->file->name); |
11060 | 0 | which_tree = tag_tree; |
11061 | 0 | } else { |
11062 | 0 | which_tree = tree; |
11063 | 0 | } |
11064 | 0 | if (si->saved) { |
11065 | 0 | item = proto_tree_add_guid(which_tree, hf_smb2_fid, tvb, 0, 0, (e_guid_t *)&si->saved->uuid_fid); |
11066 | 0 | proto_item_set_generated(item); |
11067 | 0 | } |
11068 | 0 | if (si->saved && si->saved->fid_hash) { |
11069 | 0 | item = proto_tree_add_uint_format(which_tree, hf_smb2_file_id_hash, tvb, 0, 0, |
11070 | 0 | si->saved->fid_hash, "File Id Hash: 0x%04x", si->saved->fid_hash); |
11071 | 0 | proto_item_set_generated(item); |
11072 | 0 | } |
11073 | 0 | if (si->file && si->file->frame_beg > 0 && si->file->frame_beg < UINT32_MAX) { |
11074 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
11075 | 0 | si->file->frame_beg); |
11076 | 0 | proto_item_set_generated(item); |
11077 | 0 | } else { |
11078 | 0 | if (si->saved && si->saved->frame_beg > 0 && si->saved->frame_beg < UINT32_MAX) { |
11079 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_opened, tvb, 0, 0, |
11080 | 0 | si->saved->frame_beg); |
11081 | 0 | proto_item_set_generated(item); |
11082 | 0 | } |
11083 | 0 | } |
11084 | 0 | if (si->file && si->file->frame_end > 0 && si->file->frame_end < UINT32_MAX) { |
11085 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
11086 | 0 | si->file->frame_end); |
11087 | 0 | proto_item_set_generated(item); |
11088 | 0 | } else { |
11089 | 0 | if (si->saved && si->saved->frame_end > 0 && si->saved->frame_end < UINT32_MAX) { |
11090 | 0 | item = proto_tree_add_uint(which_tree, hf_frame_handle_closed, tvb, 0, 0, |
11091 | 0 | si->saved->frame_end); |
11092 | 0 | proto_item_set_generated(item); |
11093 | |
|
11094 | 0 | } |
11095 | 0 | } |
11096 | 0 | } |
11097 | | |
11098 | | |
11099 | | /* buffer code */ |
11100 | 0 | switch (si->status) { |
11101 | 0 | case 0x00000000: offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); break; |
11102 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
11103 | 0 | if (!continue_dissection) return offset; |
11104 | 0 | } |
11105 | | |
11106 | 0 | return offset; |
11107 | 0 | } |
11108 | | |
11109 | | static int |
11110 | | dissect_smb2_break_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
11111 | 0 | { |
11112 | 0 | uint16_t buffer_code; |
11113 | | |
11114 | | /* buffer code */ |
11115 | 0 | buffer_code = tvb_get_letohs(tvb, offset); |
11116 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
11117 | |
|
11118 | 0 | if (buffer_code == OPLOCK_BREAK_OPLOCK_STRUCTURE_SIZE) { |
11119 | | /* OPLOCK Break */ |
11120 | | |
11121 | | /* oplock */ |
11122 | 0 | offset = dissect_smb2_oplock(tree, tvb, offset); |
11123 | | |
11124 | | /* reserved */ |
11125 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 1, ENC_NA); |
11126 | 0 | offset += 1; |
11127 | | |
11128 | | /* reserved */ |
11129 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
11130 | 0 | offset += 4; |
11131 | | |
11132 | | /* fid */ |
11133 | 0 | offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); |
11134 | |
|
11135 | 0 | return offset; |
11136 | 0 | } |
11137 | | |
11138 | 0 | if (buffer_code == OPLOCK_BREAK_LEASE_ACKNOWLEDGMENT_STRUCTURE_SIZE) { |
11139 | | /* Lease Break Acknowledgment */ |
11140 | | |
11141 | | /* reserved */ |
11142 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
11143 | 0 | offset +=2; |
11144 | | |
11145 | | /* lease flags */ |
11146 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_lease_flags, |
11147 | 0 | ett_smb2_lease_flags, lease_flags_fields, ENC_LITTLE_ENDIAN); |
11148 | 0 | offset += 4; |
11149 | | |
11150 | | /* lease key */ |
11151 | 0 | proto_tree_add_item(tree, hf_smb2_lease_key, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
11152 | 0 | offset += 16; |
11153 | | |
11154 | | /* lease state */ |
11155 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_lease_state, |
11156 | 0 | ett_smb2_lease_state, lease_state_fields, ENC_LITTLE_ENDIAN); |
11157 | 0 | offset += 4; |
11158 | |
|
11159 | 0 | proto_tree_add_item(tree, hf_smb2_lease_duration, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
11160 | 0 | offset += 8; |
11161 | |
|
11162 | 0 | return offset; |
11163 | 0 | } |
11164 | | |
11165 | 0 | return offset; |
11166 | 0 | } |
11167 | | |
11168 | | static int |
11169 | | dissect_smb2_break_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
11170 | 0 | { |
11171 | 0 | uint16_t buffer_code; |
11172 | 0 | bool continue_dissection; |
11173 | | |
11174 | | /* buffer code */ |
11175 | 0 | buffer_code = tvb_get_letohs(tvb, offset); |
11176 | 0 | switch (si->status) { |
11177 | 0 | case 0x00000000: offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); break; |
11178 | 0 | default: offset = dissect_smb2_error_response(tvb, pinfo, tree, offset, si, &continue_dissection); |
11179 | 0 | if (!continue_dissection) return offset; |
11180 | 0 | } |
11181 | | |
11182 | 0 | if (buffer_code == OPLOCK_BREAK_OPLOCK_STRUCTURE_SIZE) { |
11183 | | /* OPLOCK Break Notification */ |
11184 | | |
11185 | | /* oplock */ |
11186 | 0 | offset = dissect_smb2_oplock(tree, tvb, offset); |
11187 | | |
11188 | | /* reserved */ |
11189 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 1, ENC_NA); |
11190 | 0 | offset += 1; |
11191 | | |
11192 | | /* reserved */ |
11193 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
11194 | 0 | offset += 4; |
11195 | | |
11196 | | /* fid */ |
11197 | 0 | offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); |
11198 | | |
11199 | | /* in break requests from server to client here're 24 byte zero bytes |
11200 | | * which are likely a bug in windows (they may use 2* 24 bytes instead of just |
11201 | | * 1 *24 bytes |
11202 | | */ |
11203 | 0 | return offset; |
11204 | 0 | } |
11205 | | |
11206 | 0 | if (buffer_code == OPLOCK_BREAK_LEASE_NOTIFICATION_STRUCTURE_SIZE) { |
11207 | 0 | proto_item *item = NULL; |
11208 | | |
11209 | | /* Lease Break Notification */ |
11210 | | |
11211 | | /* new lease epoch */ |
11212 | 0 | proto_tree_add_item(tree, hf_smb2_lease_epoch, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
11213 | 0 | offset += 2; |
11214 | | |
11215 | | /* lease flags */ |
11216 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_lease_flags, |
11217 | 0 | ett_smb2_lease_flags, lease_flags_fields, ENC_LITTLE_ENDIAN); |
11218 | 0 | offset += 4; |
11219 | | |
11220 | | /* lease key */ |
11221 | 0 | proto_tree_add_item(tree, hf_smb2_lease_key, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
11222 | 0 | offset += 16; |
11223 | | |
11224 | | /* current lease state */ |
11225 | 0 | item = proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_lease_state, |
11226 | 0 | ett_smb2_lease_state, lease_state_fields, ENC_LITTLE_ENDIAN); |
11227 | 0 | if (item) { |
11228 | 0 | proto_item_prepend_text(item, "Current "); |
11229 | 0 | } |
11230 | 0 | offset += 4; |
11231 | | |
11232 | | /* new lease state */ |
11233 | 0 | item = proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_lease_state, |
11234 | 0 | ett_smb2_lease_state, lease_state_fields, ENC_LITTLE_ENDIAN); |
11235 | 0 | if (item) { |
11236 | 0 | proto_item_prepend_text(item, "New "); |
11237 | 0 | } |
11238 | 0 | offset += 4; |
11239 | | |
11240 | | /* break reason - reserved */ |
11241 | 0 | proto_tree_add_item(tree, hf_smb2_lease_break_reason, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
11242 | 0 | offset += 4; |
11243 | | |
11244 | | /* access mask hint - reserved */ |
11245 | 0 | proto_tree_add_item(tree, hf_smb2_lease_access_mask_hint, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
11246 | 0 | offset += 4; |
11247 | | |
11248 | | /* share mask hint - reserved */ |
11249 | 0 | proto_tree_add_item(tree, hf_smb2_lease_share_mask_hint, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
11250 | 0 | offset += 4; |
11251 | |
|
11252 | 0 | return offset; |
11253 | 0 | } |
11254 | | |
11255 | 0 | if (buffer_code == OPLOCK_BREAK_LEASE_RESPONSE_STRUCTURE_SIZE) { |
11256 | | /* Lease Break Response */ |
11257 | | |
11258 | | /* reserved */ |
11259 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
11260 | 0 | offset +=2; |
11261 | | |
11262 | | /* lease flags */ |
11263 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_lease_flags, |
11264 | 0 | ett_smb2_lease_flags, lease_flags_fields, ENC_LITTLE_ENDIAN); |
11265 | 0 | offset += 4; |
11266 | | |
11267 | | /* lease key */ |
11268 | 0 | proto_tree_add_item(tree, hf_smb2_lease_key, tvb, offset, 16, ENC_LITTLE_ENDIAN); |
11269 | 0 | offset += 16; |
11270 | | |
11271 | | /* lease state */ |
11272 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_lease_state, |
11273 | 0 | ett_smb2_lease_state, lease_state_fields, ENC_LITTLE_ENDIAN); |
11274 | 0 | offset += 4; |
11275 | |
|
11276 | 0 | proto_tree_add_item(tree, hf_smb2_lease_duration, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
11277 | 0 | offset += 8; |
11278 | |
|
11279 | 0 | return offset; |
11280 | 0 | } |
11281 | | |
11282 | 0 | return offset; |
11283 | 0 | } |
11284 | | |
11285 | | static int |
11286 | | dissect_smb2_notify_session_closed(tvbuff_t *tvb, proto_tree *parent_tree, packet_info *pinfo _U_, int offset, smb2_info_t *si _U_) |
11287 | 0 | { |
11288 | 0 | proto_tree *sub_tree; |
11289 | |
|
11290 | 0 | sub_tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_smb2_server_notification, NULL, "Notification"); |
11291 | | |
11292 | | /* reserved */ |
11293 | 0 | proto_tree_add_item(sub_tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA); |
11294 | 0 | offset += 4; |
11295 | |
|
11296 | 0 | return offset; |
11297 | 0 | } |
11298 | | |
11299 | | static int |
11300 | | dissect_smb2_server_to_client_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si) |
11301 | 0 | { |
11302 | 0 | uint32_t notification_type; |
11303 | |
|
11304 | 0 | offset = dissect_smb2_buffercode(tree, tvb, offset, NULL); |
11305 | | |
11306 | | /* reserved */ |
11307 | 0 | proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
11308 | 0 | offset += 2; |
11309 | | |
11310 | | /* notification type */ |
11311 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_notification_type, tvb, offset, 4, ENC_BIG_ENDIAN, ¬ification_type); |
11312 | 0 | offset += 4; |
11313 | |
|
11314 | 0 | switch(notification_type) { |
11315 | 0 | case NOTIFY_SESSION_CLOSED: |
11316 | 0 | default: |
11317 | 0 | offset = dissect_smb2_notify_session_closed(tvb, tree, pinfo, offset, si); |
11318 | 0 | break; |
11319 | 0 | } |
11320 | | |
11321 | 0 | return offset; |
11322 | 0 | } |
11323 | | |
11324 | | /* names here are just until we find better names for these functions */ |
11325 | | /* decode_smb2_name can be used to access this safely */ |
11326 | | static const value_string smb2_cmd_vals[] = { |
11327 | | { 0x00, "Negotiate Protocol" }, |
11328 | | { 0x01, "Session Setup" }, |
11329 | | { 0x02, "Session Logoff" }, |
11330 | | { 0x03, "Tree Connect" }, |
11331 | | { 0x04, "Tree Disconnect" }, |
11332 | | { 0x05, "Create" }, |
11333 | | { 0x06, "Close" }, |
11334 | | { 0x07, "Flush" }, |
11335 | | { 0x08, "Read" }, |
11336 | | { 0x09, "Write" }, |
11337 | | { 0x0A, "Lock" }, |
11338 | | { 0x0B, "Ioctl" }, |
11339 | | { 0x0C, "Cancel" }, |
11340 | | { 0x0D, "KeepAlive" }, |
11341 | | { 0x0E, "Find" }, |
11342 | | { 0x0F, "Notify" }, |
11343 | | { 0x10, "GetInfo" }, |
11344 | | { 0x11, "SetInfo" }, |
11345 | | { 0x12, "Break" }, |
11346 | | { 0x13, "Server notification" }, |
11347 | | { 0x14, "unknown-0x14" }, |
11348 | | { 0x15, "unknown-0x15" }, |
11349 | | { 0x16, "unknown-0x16" }, |
11350 | | { 0x17, "unknown-0x17" }, |
11351 | | { 0x18, "unknown-0x18" }, |
11352 | | { 0x19, "unknown-0x19" }, |
11353 | | { 0x1A, "unknown-0x1A" }, |
11354 | | { 0x1B, "unknown-0x1B" }, |
11355 | | { 0x1C, "unknown-0x1C" }, |
11356 | | { 0x1D, "unknown-0x1D" }, |
11357 | | { 0x1E, "unknown-0x1E" }, |
11358 | | { 0x1F, "unknown-0x1F" }, |
11359 | | { 0x20, "unknown-0x20" }, |
11360 | | { 0x21, "unknown-0x21" }, |
11361 | | { 0x22, "unknown-0x22" }, |
11362 | | { 0x23, "unknown-0x23" }, |
11363 | | { 0x24, "unknown-0x24" }, |
11364 | | { 0x25, "unknown-0x25" }, |
11365 | | { 0x26, "unknown-0x26" }, |
11366 | | { 0x27, "unknown-0x27" }, |
11367 | | { 0x28, "unknown-0x28" }, |
11368 | | { 0x29, "unknown-0x29" }, |
11369 | | { 0x2A, "unknown-0x2A" }, |
11370 | | { 0x2B, "unknown-0x2B" }, |
11371 | | { 0x2C, "unknown-0x2C" }, |
11372 | | { 0x2D, "unknown-0x2D" }, |
11373 | | { 0x2E, "unknown-0x2E" }, |
11374 | | { 0x2F, "unknown-0x2F" }, |
11375 | | { 0x30, "unknown-0x30" }, |
11376 | | { 0x31, "unknown-0x31" }, |
11377 | | { 0x32, "unknown-0x32" }, |
11378 | | { 0x33, "unknown-0x33" }, |
11379 | | { 0x34, "unknown-0x34" }, |
11380 | | { 0x35, "unknown-0x35" }, |
11381 | | { 0x36, "unknown-0x36" }, |
11382 | | { 0x37, "unknown-0x37" }, |
11383 | | { 0x38, "unknown-0x38" }, |
11384 | | { 0x39, "unknown-0x39" }, |
11385 | | { 0x3A, "unknown-0x3A" }, |
11386 | | { 0x3B, "unknown-0x3B" }, |
11387 | | { 0x3C, "unknown-0x3C" }, |
11388 | | { 0x3D, "unknown-0x3D" }, |
11389 | | { 0x3E, "unknown-0x3E" }, |
11390 | | { 0x3F, "unknown-0x3F" }, |
11391 | | { 0x40, "unknown-0x40" }, |
11392 | | { 0x41, "unknown-0x41" }, |
11393 | | { 0x42, "unknown-0x42" }, |
11394 | | { 0x43, "unknown-0x43" }, |
11395 | | { 0x44, "unknown-0x44" }, |
11396 | | { 0x45, "unknown-0x45" }, |
11397 | | { 0x46, "unknown-0x46" }, |
11398 | | { 0x47, "unknown-0x47" }, |
11399 | | { 0x48, "unknown-0x48" }, |
11400 | | { 0x49, "unknown-0x49" }, |
11401 | | { 0x4A, "unknown-0x4A" }, |
11402 | | { 0x4B, "unknown-0x4B" }, |
11403 | | { 0x4C, "unknown-0x4C" }, |
11404 | | { 0x4D, "unknown-0x4D" }, |
11405 | | { 0x4E, "unknown-0x4E" }, |
11406 | | { 0x4F, "unknown-0x4F" }, |
11407 | | { 0x50, "unknown-0x50" }, |
11408 | | { 0x51, "unknown-0x51" }, |
11409 | | { 0x52, "unknown-0x52" }, |
11410 | | { 0x53, "unknown-0x53" }, |
11411 | | { 0x54, "unknown-0x54" }, |
11412 | | { 0x55, "unknown-0x55" }, |
11413 | | { 0x56, "unknown-0x56" }, |
11414 | | { 0x57, "unknown-0x57" }, |
11415 | | { 0x58, "unknown-0x58" }, |
11416 | | { 0x59, "unknown-0x59" }, |
11417 | | { 0x5A, "unknown-0x5A" }, |
11418 | | { 0x5B, "unknown-0x5B" }, |
11419 | | { 0x5C, "unknown-0x5C" }, |
11420 | | { 0x5D, "unknown-0x5D" }, |
11421 | | { 0x5E, "unknown-0x5E" }, |
11422 | | { 0x5F, "unknown-0x5F" }, |
11423 | | { 0x60, "unknown-0x60" }, |
11424 | | { 0x61, "unknown-0x61" }, |
11425 | | { 0x62, "unknown-0x62" }, |
11426 | | { 0x63, "unknown-0x63" }, |
11427 | | { 0x64, "unknown-0x64" }, |
11428 | | { 0x65, "unknown-0x65" }, |
11429 | | { 0x66, "unknown-0x66" }, |
11430 | | { 0x67, "unknown-0x67" }, |
11431 | | { 0x68, "unknown-0x68" }, |
11432 | | { 0x69, "unknown-0x69" }, |
11433 | | { 0x6A, "unknown-0x6A" }, |
11434 | | { 0x6B, "unknown-0x6B" }, |
11435 | | { 0x6C, "unknown-0x6C" }, |
11436 | | { 0x6D, "unknown-0x6D" }, |
11437 | | { 0x6E, "unknown-0x6E" }, |
11438 | | { 0x6F, "unknown-0x6F" }, |
11439 | | { 0x70, "unknown-0x70" }, |
11440 | | { 0x71, "unknown-0x71" }, |
11441 | | { 0x72, "unknown-0x72" }, |
11442 | | { 0x73, "unknown-0x73" }, |
11443 | | { 0x74, "unknown-0x74" }, |
11444 | | { 0x75, "unknown-0x75" }, |
11445 | | { 0x76, "unknown-0x76" }, |
11446 | | { 0x77, "unknown-0x77" }, |
11447 | | { 0x78, "unknown-0x78" }, |
11448 | | { 0x79, "unknown-0x79" }, |
11449 | | { 0x7A, "unknown-0x7A" }, |
11450 | | { 0x7B, "unknown-0x7B" }, |
11451 | | { 0x7C, "unknown-0x7C" }, |
11452 | | { 0x7D, "unknown-0x7D" }, |
11453 | | { 0x7E, "unknown-0x7E" }, |
11454 | | { 0x7F, "unknown-0x7F" }, |
11455 | | { 0x80, "unknown-0x80" }, |
11456 | | { 0x81, "unknown-0x81" }, |
11457 | | { 0x82, "unknown-0x82" }, |
11458 | | { 0x83, "unknown-0x83" }, |
11459 | | { 0x84, "unknown-0x84" }, |
11460 | | { 0x85, "unknown-0x85" }, |
11461 | | { 0x86, "unknown-0x86" }, |
11462 | | { 0x87, "unknown-0x87" }, |
11463 | | { 0x88, "unknown-0x88" }, |
11464 | | { 0x89, "unknown-0x89" }, |
11465 | | { 0x8A, "unknown-0x8A" }, |
11466 | | { 0x8B, "unknown-0x8B" }, |
11467 | | { 0x8C, "unknown-0x8C" }, |
11468 | | { 0x8D, "unknown-0x8D" }, |
11469 | | { 0x8E, "unknown-0x8E" }, |
11470 | | { 0x8F, "unknown-0x8F" }, |
11471 | | { 0x90, "unknown-0x90" }, |
11472 | | { 0x91, "unknown-0x91" }, |
11473 | | { 0x92, "unknown-0x92" }, |
11474 | | { 0x93, "unknown-0x93" }, |
11475 | | { 0x94, "unknown-0x94" }, |
11476 | | { 0x95, "unknown-0x95" }, |
11477 | | { 0x96, "unknown-0x96" }, |
11478 | | { 0x97, "unknown-0x97" }, |
11479 | | { 0x98, "unknown-0x98" }, |
11480 | | { 0x99, "unknown-0x99" }, |
11481 | | { 0x9A, "unknown-0x9A" }, |
11482 | | { 0x9B, "unknown-0x9B" }, |
11483 | | { 0x9C, "unknown-0x9C" }, |
11484 | | { 0x9D, "unknown-0x9D" }, |
11485 | | { 0x9E, "unknown-0x9E" }, |
11486 | | { 0x9F, "unknown-0x9F" }, |
11487 | | { 0xA0, "unknown-0xA0" }, |
11488 | | { 0xA1, "unknown-0xA1" }, |
11489 | | { 0xA2, "unknown-0xA2" }, |
11490 | | { 0xA3, "unknown-0xA3" }, |
11491 | | { 0xA4, "unknown-0xA4" }, |
11492 | | { 0xA5, "unknown-0xA5" }, |
11493 | | { 0xA6, "unknown-0xA6" }, |
11494 | | { 0xA7, "unknown-0xA7" }, |
11495 | | { 0xA8, "unknown-0xA8" }, |
11496 | | { 0xA9, "unknown-0xA9" }, |
11497 | | { 0xAA, "unknown-0xAA" }, |
11498 | | { 0xAB, "unknown-0xAB" }, |
11499 | | { 0xAC, "unknown-0xAC" }, |
11500 | | { 0xAD, "unknown-0xAD" }, |
11501 | | { 0xAE, "unknown-0xAE" }, |
11502 | | { 0xAF, "unknown-0xAF" }, |
11503 | | { 0xB0, "unknown-0xB0" }, |
11504 | | { 0xB1, "unknown-0xB1" }, |
11505 | | { 0xB2, "unknown-0xB2" }, |
11506 | | { 0xB3, "unknown-0xB3" }, |
11507 | | { 0xB4, "unknown-0xB4" }, |
11508 | | { 0xB5, "unknown-0xB5" }, |
11509 | | { 0xB6, "unknown-0xB6" }, |
11510 | | { 0xB7, "unknown-0xB7" }, |
11511 | | { 0xB8, "unknown-0xB8" }, |
11512 | | { 0xB9, "unknown-0xB9" }, |
11513 | | { 0xBA, "unknown-0xBA" }, |
11514 | | { 0xBB, "unknown-0xBB" }, |
11515 | | { 0xBC, "unknown-0xBC" }, |
11516 | | { 0xBD, "unknown-0xBD" }, |
11517 | | { 0xBE, "unknown-0xBE" }, |
11518 | | { 0xBF, "unknown-0xBF" }, |
11519 | | { 0xC0, "unknown-0xC0" }, |
11520 | | { 0xC1, "unknown-0xC1" }, |
11521 | | { 0xC2, "unknown-0xC2" }, |
11522 | | { 0xC3, "unknown-0xC3" }, |
11523 | | { 0xC4, "unknown-0xC4" }, |
11524 | | { 0xC5, "unknown-0xC5" }, |
11525 | | { 0xC6, "unknown-0xC6" }, |
11526 | | { 0xC7, "unknown-0xC7" }, |
11527 | | { 0xC8, "unknown-0xC8" }, |
11528 | | { 0xC9, "unknown-0xC9" }, |
11529 | | { 0xCA, "unknown-0xCA" }, |
11530 | | { 0xCB, "unknown-0xCB" }, |
11531 | | { 0xCC, "unknown-0xCC" }, |
11532 | | { 0xCD, "unknown-0xCD" }, |
11533 | | { 0xCE, "unknown-0xCE" }, |
11534 | | { 0xCF, "unknown-0xCF" }, |
11535 | | { 0xD0, "unknown-0xD0" }, |
11536 | | { 0xD1, "unknown-0xD1" }, |
11537 | | { 0xD2, "unknown-0xD2" }, |
11538 | | { 0xD3, "unknown-0xD3" }, |
11539 | | { 0xD4, "unknown-0xD4" }, |
11540 | | { 0xD5, "unknown-0xD5" }, |
11541 | | { 0xD6, "unknown-0xD6" }, |
11542 | | { 0xD7, "unknown-0xD7" }, |
11543 | | { 0xD8, "unknown-0xD8" }, |
11544 | | { 0xD9, "unknown-0xD9" }, |
11545 | | { 0xDA, "unknown-0xDA" }, |
11546 | | { 0xDB, "unknown-0xDB" }, |
11547 | | { 0xDC, "unknown-0xDC" }, |
11548 | | { 0xDD, "unknown-0xDD" }, |
11549 | | { 0xDE, "unknown-0xDE" }, |
11550 | | { 0xDF, "unknown-0xDF" }, |
11551 | | { 0xE0, "unknown-0xE0" }, |
11552 | | { 0xE1, "unknown-0xE1" }, |
11553 | | { 0xE2, "unknown-0xE2" }, |
11554 | | { 0xE3, "unknown-0xE3" }, |
11555 | | { 0xE4, "unknown-0xE4" }, |
11556 | | { 0xE5, "unknown-0xE5" }, |
11557 | | { 0xE6, "unknown-0xE6" }, |
11558 | | { 0xE7, "unknown-0xE7" }, |
11559 | | { 0xE8, "unknown-0xE8" }, |
11560 | | { 0xE9, "unknown-0xE9" }, |
11561 | | { 0xEA, "unknown-0xEA" }, |
11562 | | { 0xEB, "unknown-0xEB" }, |
11563 | | { 0xEC, "unknown-0xEC" }, |
11564 | | { 0xED, "unknown-0xED" }, |
11565 | | { 0xEE, "unknown-0xEE" }, |
11566 | | { 0xEF, "unknown-0xEF" }, |
11567 | | { 0xF0, "unknown-0xF0" }, |
11568 | | { 0xF1, "unknown-0xF1" }, |
11569 | | { 0xF2, "unknown-0xF2" }, |
11570 | | { 0xF3, "unknown-0xF3" }, |
11571 | | { 0xF4, "unknown-0xF4" }, |
11572 | | { 0xF5, "unknown-0xF5" }, |
11573 | | { 0xF6, "unknown-0xF6" }, |
11574 | | { 0xF7, "unknown-0xF7" }, |
11575 | | { 0xF8, "unknown-0xF8" }, |
11576 | | { 0xF9, "unknown-0xF9" }, |
11577 | | { 0xFA, "unknown-0xFA" }, |
11578 | | { 0xFB, "unknown-0xFB" }, |
11579 | | { 0xFC, "unknown-0xFC" }, |
11580 | | { 0xFD, "unknown-0xFD" }, |
11581 | | { 0xFE, "unknown-0xFE" }, |
11582 | | { 0xFF, "unknown-0xFF" }, |
11583 | | { 0x00, NULL }, |
11584 | | }; |
11585 | | value_string_ext smb2_cmd_vals_ext = VALUE_STRING_EXT_INIT(smb2_cmd_vals); |
11586 | | |
11587 | | static const char *decode_smb2_name(uint16_t cmd) |
11588 | 0 | { |
11589 | 0 | if (cmd > 0xFF) return "unknown"; |
11590 | 0 | return smb2_cmd_vals[cmd & 0xFF].strptr; |
11591 | 0 | } |
11592 | | |
11593 | | static const smb2_function smb2_dissector[256] = { |
11594 | | /* 0x00 NegotiateProtocol*/ |
11595 | | {dissect_smb2_negotiate_protocol_request, |
11596 | | dissect_smb2_negotiate_protocol_response}, |
11597 | | /* 0x01 SessionSetup*/ |
11598 | | {dissect_smb2_session_setup_request, |
11599 | | dissect_smb2_session_setup_response}, |
11600 | | /* 0x02 SessionLogoff*/ |
11601 | | {dissect_smb2_sessionlogoff_request, |
11602 | | dissect_smb2_sessionlogoff_response}, |
11603 | | /* 0x03 TreeConnect*/ |
11604 | | {dissect_smb2_tree_connect_request, |
11605 | | dissect_smb2_tree_connect_response}, |
11606 | | /* 0x04 TreeDisconnect*/ |
11607 | | {dissect_smb2_tree_disconnect_request, |
11608 | | dissect_smb2_tree_disconnect_response}, |
11609 | | /* 0x05 Create*/ |
11610 | | {dissect_smb2_create_request, |
11611 | | dissect_smb2_create_response}, |
11612 | | /* 0x06 Close*/ |
11613 | | {dissect_smb2_close_request, |
11614 | | dissect_smb2_close_response}, |
11615 | | /* 0x07 Flush*/ |
11616 | | {dissect_smb2_flush_request, |
11617 | | dissect_smb2_flush_response}, |
11618 | | /* 0x08 Read*/ |
11619 | | {dissect_smb2_read_request, |
11620 | | dissect_smb2_read_response}, |
11621 | | /* 0x09 Write*/ |
11622 | | {dissect_smb2_write_request, |
11623 | | dissect_smb2_write_response}, |
11624 | | /* 0x0a Lock */ |
11625 | | {dissect_smb2_lock_request, |
11626 | | dissect_smb2_lock_response}, |
11627 | | /* 0x0b Ioctl*/ |
11628 | | {dissect_smb2_ioctl_request, |
11629 | | dissect_smb2_ioctl_response}, |
11630 | | /* 0x0c Cancel*/ |
11631 | | {dissect_smb2_cancel_request, |
11632 | | NULL}, |
11633 | | /* 0x0d KeepAlive*/ |
11634 | | {dissect_smb2_keepalive_request, |
11635 | | dissect_smb2_keepalive_response}, |
11636 | | /* 0x0e Find*/ |
11637 | | {dissect_smb2_find_request, |
11638 | | dissect_smb2_find_response}, |
11639 | | /* 0x0f Notify*/ |
11640 | | {dissect_smb2_notify_request, |
11641 | | dissect_smb2_notify_response}, |
11642 | | /* 0x10 GetInfo*/ |
11643 | | {dissect_smb2_getinfo_request, |
11644 | | dissect_smb2_getinfo_response}, |
11645 | | /* 0x11 SetInfo*/ |
11646 | | {dissect_smb2_setinfo_request, |
11647 | | dissect_smb2_setinfo_response}, |
11648 | | /* 0x12 Break */ |
11649 | | {dissect_smb2_break_request, |
11650 | | dissect_smb2_break_response}, |
11651 | | /* 0x13 Server to client notification */ |
11652 | | {NULL, |
11653 | | dissect_smb2_server_to_client_notification}, |
11654 | | /* 0x14 */ {NULL, NULL}, |
11655 | | /* 0x15 */ {NULL, NULL}, |
11656 | | /* 0x16 */ {NULL, NULL}, |
11657 | | /* 0x17 */ {NULL, NULL}, |
11658 | | /* 0x18 */ {NULL, NULL}, |
11659 | | /* 0x19 */ {NULL, NULL}, |
11660 | | /* 0x1a */ {NULL, NULL}, |
11661 | | /* 0x1b */ {NULL, NULL}, |
11662 | | /* 0x1c */ {NULL, NULL}, |
11663 | | /* 0x1d */ {NULL, NULL}, |
11664 | | /* 0x1e */ {NULL, NULL}, |
11665 | | /* 0x1f */ {NULL, NULL}, |
11666 | | /* 0x20 */ {NULL, NULL}, |
11667 | | /* 0x21 */ {NULL, NULL}, |
11668 | | /* 0x22 */ {NULL, NULL}, |
11669 | | /* 0x23 */ {NULL, NULL}, |
11670 | | /* 0x24 */ {NULL, NULL}, |
11671 | | /* 0x25 */ {NULL, NULL}, |
11672 | | /* 0x26 */ {NULL, NULL}, |
11673 | | /* 0x27 */ {NULL, NULL}, |
11674 | | /* 0x28 */ {NULL, NULL}, |
11675 | | /* 0x29 */ {NULL, NULL}, |
11676 | | /* 0x2a */ {NULL, NULL}, |
11677 | | /* 0x2b */ {NULL, NULL}, |
11678 | | /* 0x2c */ {NULL, NULL}, |
11679 | | /* 0x2d */ {NULL, NULL}, |
11680 | | /* 0x2e */ {NULL, NULL}, |
11681 | | /* 0x2f */ {NULL, NULL}, |
11682 | | /* 0x30 */ {NULL, NULL}, |
11683 | | /* 0x31 */ {NULL, NULL}, |
11684 | | /* 0x32 */ {NULL, NULL}, |
11685 | | /* 0x33 */ {NULL, NULL}, |
11686 | | /* 0x34 */ {NULL, NULL}, |
11687 | | /* 0x35 */ {NULL, NULL}, |
11688 | | /* 0x36 */ {NULL, NULL}, |
11689 | | /* 0x37 */ {NULL, NULL}, |
11690 | | /* 0x38 */ {NULL, NULL}, |
11691 | | /* 0x39 */ {NULL, NULL}, |
11692 | | /* 0x3a */ {NULL, NULL}, |
11693 | | /* 0x3b */ {NULL, NULL}, |
11694 | | /* 0x3c */ {NULL, NULL}, |
11695 | | /* 0x3d */ {NULL, NULL}, |
11696 | | /* 0x3e */ {NULL, NULL}, |
11697 | | /* 0x3f */ {NULL, NULL}, |
11698 | | /* 0x40 */ {NULL, NULL}, |
11699 | | /* 0x41 */ {NULL, NULL}, |
11700 | | /* 0x42 */ {NULL, NULL}, |
11701 | | /* 0x43 */ {NULL, NULL}, |
11702 | | /* 0x44 */ {NULL, NULL}, |
11703 | | /* 0x45 */ {NULL, NULL}, |
11704 | | /* 0x46 */ {NULL, NULL}, |
11705 | | /* 0x47 */ {NULL, NULL}, |
11706 | | /* 0x48 */ {NULL, NULL}, |
11707 | | /* 0x49 */ {NULL, NULL}, |
11708 | | /* 0x4a */ {NULL, NULL}, |
11709 | | /* 0x4b */ {NULL, NULL}, |
11710 | | /* 0x4c */ {NULL, NULL}, |
11711 | | /* 0x4d */ {NULL, NULL}, |
11712 | | /* 0x4e */ {NULL, NULL}, |
11713 | | /* 0x4f */ {NULL, NULL}, |
11714 | | /* 0x50 */ {NULL, NULL}, |
11715 | | /* 0x51 */ {NULL, NULL}, |
11716 | | /* 0x52 */ {NULL, NULL}, |
11717 | | /* 0x53 */ {NULL, NULL}, |
11718 | | /* 0x54 */ {NULL, NULL}, |
11719 | | /* 0x55 */ {NULL, NULL}, |
11720 | | /* 0x56 */ {NULL, NULL}, |
11721 | | /* 0x57 */ {NULL, NULL}, |
11722 | | /* 0x58 */ {NULL, NULL}, |
11723 | | /* 0x59 */ {NULL, NULL}, |
11724 | | /* 0x5a */ {NULL, NULL}, |
11725 | | /* 0x5b */ {NULL, NULL}, |
11726 | | /* 0x5c */ {NULL, NULL}, |
11727 | | /* 0x5d */ {NULL, NULL}, |
11728 | | /* 0x5e */ {NULL, NULL}, |
11729 | | /* 0x5f */ {NULL, NULL}, |
11730 | | /* 0x60 */ {NULL, NULL}, |
11731 | | /* 0x61 */ {NULL, NULL}, |
11732 | | /* 0x62 */ {NULL, NULL}, |
11733 | | /* 0x63 */ {NULL, NULL}, |
11734 | | /* 0x64 */ {NULL, NULL}, |
11735 | | /* 0x65 */ {NULL, NULL}, |
11736 | | /* 0x66 */ {NULL, NULL}, |
11737 | | /* 0x67 */ {NULL, NULL}, |
11738 | | /* 0x68 */ {NULL, NULL}, |
11739 | | /* 0x69 */ {NULL, NULL}, |
11740 | | /* 0x6a */ {NULL, NULL}, |
11741 | | /* 0x6b */ {NULL, NULL}, |
11742 | | /* 0x6c */ {NULL, NULL}, |
11743 | | /* 0x6d */ {NULL, NULL}, |
11744 | | /* 0x6e */ {NULL, NULL}, |
11745 | | /* 0x6f */ {NULL, NULL}, |
11746 | | /* 0x70 */ {NULL, NULL}, |
11747 | | /* 0x71 */ {NULL, NULL}, |
11748 | | /* 0x72 */ {NULL, NULL}, |
11749 | | /* 0x73 */ {NULL, NULL}, |
11750 | | /* 0x74 */ {NULL, NULL}, |
11751 | | /* 0x75 */ {NULL, NULL}, |
11752 | | /* 0x76 */ {NULL, NULL}, |
11753 | | /* 0x77 */ {NULL, NULL}, |
11754 | | /* 0x78 */ {NULL, NULL}, |
11755 | | /* 0x79 */ {NULL, NULL}, |
11756 | | /* 0x7a */ {NULL, NULL}, |
11757 | | /* 0x7b */ {NULL, NULL}, |
11758 | | /* 0x7c */ {NULL, NULL}, |
11759 | | /* 0x7d */ {NULL, NULL}, |
11760 | | /* 0x7e */ {NULL, NULL}, |
11761 | | /* 0x7f */ {NULL, NULL}, |
11762 | | /* 0x80 */ {NULL, NULL}, |
11763 | | /* 0x81 */ {NULL, NULL}, |
11764 | | /* 0x82 */ {NULL, NULL}, |
11765 | | /* 0x83 */ {NULL, NULL}, |
11766 | | /* 0x84 */ {NULL, NULL}, |
11767 | | /* 0x85 */ {NULL, NULL}, |
11768 | | /* 0x86 */ {NULL, NULL}, |
11769 | | /* 0x87 */ {NULL, NULL}, |
11770 | | /* 0x88 */ {NULL, NULL}, |
11771 | | /* 0x89 */ {NULL, NULL}, |
11772 | | /* 0x8a */ {NULL, NULL}, |
11773 | | /* 0x8b */ {NULL, NULL}, |
11774 | | /* 0x8c */ {NULL, NULL}, |
11775 | | /* 0x8d */ {NULL, NULL}, |
11776 | | /* 0x8e */ {NULL, NULL}, |
11777 | | /* 0x8f */ {NULL, NULL}, |
11778 | | /* 0x90 */ {NULL, NULL}, |
11779 | | /* 0x91 */ {NULL, NULL}, |
11780 | | /* 0x92 */ {NULL, NULL}, |
11781 | | /* 0x93 */ {NULL, NULL}, |
11782 | | /* 0x94 */ {NULL, NULL}, |
11783 | | /* 0x95 */ {NULL, NULL}, |
11784 | | /* 0x96 */ {NULL, NULL}, |
11785 | | /* 0x97 */ {NULL, NULL}, |
11786 | | /* 0x98 */ {NULL, NULL}, |
11787 | | /* 0x99 */ {NULL, NULL}, |
11788 | | /* 0x9a */ {NULL, NULL}, |
11789 | | /* 0x9b */ {NULL, NULL}, |
11790 | | /* 0x9c */ {NULL, NULL}, |
11791 | | /* 0x9d */ {NULL, NULL}, |
11792 | | /* 0x9e */ {NULL, NULL}, |
11793 | | /* 0x9f */ {NULL, NULL}, |
11794 | | /* 0xa0 */ {NULL, NULL}, |
11795 | | /* 0xa1 */ {NULL, NULL}, |
11796 | | /* 0xa2 */ {NULL, NULL}, |
11797 | | /* 0xa3 */ {NULL, NULL}, |
11798 | | /* 0xa4 */ {NULL, NULL}, |
11799 | | /* 0xa5 */ {NULL, NULL}, |
11800 | | /* 0xa6 */ {NULL, NULL}, |
11801 | | /* 0xa7 */ {NULL, NULL}, |
11802 | | /* 0xa8 */ {NULL, NULL}, |
11803 | | /* 0xa9 */ {NULL, NULL}, |
11804 | | /* 0xaa */ {NULL, NULL}, |
11805 | | /* 0xab */ {NULL, NULL}, |
11806 | | /* 0xac */ {NULL, NULL}, |
11807 | | /* 0xad */ {NULL, NULL}, |
11808 | | /* 0xae */ {NULL, NULL}, |
11809 | | /* 0xaf */ {NULL, NULL}, |
11810 | | /* 0xb0 */ {NULL, NULL}, |
11811 | | /* 0xb1 */ {NULL, NULL}, |
11812 | | /* 0xb2 */ {NULL, NULL}, |
11813 | | /* 0xb3 */ {NULL, NULL}, |
11814 | | /* 0xb4 */ {NULL, NULL}, |
11815 | | /* 0xb5 */ {NULL, NULL}, |
11816 | | /* 0xb6 */ {NULL, NULL}, |
11817 | | /* 0xb7 */ {NULL, NULL}, |
11818 | | /* 0xb8 */ {NULL, NULL}, |
11819 | | /* 0xb9 */ {NULL, NULL}, |
11820 | | /* 0xba */ {NULL, NULL}, |
11821 | | /* 0xbb */ {NULL, NULL}, |
11822 | | /* 0xbc */ {NULL, NULL}, |
11823 | | /* 0xbd */ {NULL, NULL}, |
11824 | | /* 0xbe */ {NULL, NULL}, |
11825 | | /* 0xbf */ {NULL, NULL}, |
11826 | | /* 0xc0 */ {NULL, NULL}, |
11827 | | /* 0xc1 */ {NULL, NULL}, |
11828 | | /* 0xc2 */ {NULL, NULL}, |
11829 | | /* 0xc3 */ {NULL, NULL}, |
11830 | | /* 0xc4 */ {NULL, NULL}, |
11831 | | /* 0xc5 */ {NULL, NULL}, |
11832 | | /* 0xc6 */ {NULL, NULL}, |
11833 | | /* 0xc7 */ {NULL, NULL}, |
11834 | | /* 0xc8 */ {NULL, NULL}, |
11835 | | /* 0xc9 */ {NULL, NULL}, |
11836 | | /* 0xca */ {NULL, NULL}, |
11837 | | /* 0xcb */ {NULL, NULL}, |
11838 | | /* 0xcc */ {NULL, NULL}, |
11839 | | /* 0xcd */ {NULL, NULL}, |
11840 | | /* 0xce */ {NULL, NULL}, |
11841 | | /* 0xcf */ {NULL, NULL}, |
11842 | | /* 0xd0 */ {NULL, NULL}, |
11843 | | /* 0xd1 */ {NULL, NULL}, |
11844 | | /* 0xd2 */ {NULL, NULL}, |
11845 | | /* 0xd3 */ {NULL, NULL}, |
11846 | | /* 0xd4 */ {NULL, NULL}, |
11847 | | /* 0xd5 */ {NULL, NULL}, |
11848 | | /* 0xd6 */ {NULL, NULL}, |
11849 | | /* 0xd7 */ {NULL, NULL}, |
11850 | | /* 0xd8 */ {NULL, NULL}, |
11851 | | /* 0xd9 */ {NULL, NULL}, |
11852 | | /* 0xda */ {NULL, NULL}, |
11853 | | /* 0xdb */ {NULL, NULL}, |
11854 | | /* 0xdc */ {NULL, NULL}, |
11855 | | /* 0xdd */ {NULL, NULL}, |
11856 | | /* 0xde */ {NULL, NULL}, |
11857 | | /* 0xdf */ {NULL, NULL}, |
11858 | | /* 0xe0 */ {NULL, NULL}, |
11859 | | /* 0xe1 */ {NULL, NULL}, |
11860 | | /* 0xe2 */ {NULL, NULL}, |
11861 | | /* 0xe3 */ {NULL, NULL}, |
11862 | | /* 0xe4 */ {NULL, NULL}, |
11863 | | /* 0xe5 */ {NULL, NULL}, |
11864 | | /* 0xe6 */ {NULL, NULL}, |
11865 | | /* 0xe7 */ {NULL, NULL}, |
11866 | | /* 0xe8 */ {NULL, NULL}, |
11867 | | /* 0xe9 */ {NULL, NULL}, |
11868 | | /* 0xea */ {NULL, NULL}, |
11869 | | /* 0xeb */ {NULL, NULL}, |
11870 | | /* 0xec */ {NULL, NULL}, |
11871 | | /* 0xed */ {NULL, NULL}, |
11872 | | /* 0xee */ {NULL, NULL}, |
11873 | | /* 0xef */ {NULL, NULL}, |
11874 | | /* 0xf0 */ {NULL, NULL}, |
11875 | | /* 0xf1 */ {NULL, NULL}, |
11876 | | /* 0xf2 */ {NULL, NULL}, |
11877 | | /* 0xf3 */ {NULL, NULL}, |
11878 | | /* 0xf4 */ {NULL, NULL}, |
11879 | | /* 0xf5 */ {NULL, NULL}, |
11880 | | /* 0xf6 */ {NULL, NULL}, |
11881 | | /* 0xf7 */ {NULL, NULL}, |
11882 | | /* 0xf8 */ {NULL, NULL}, |
11883 | | /* 0xf9 */ {NULL, NULL}, |
11884 | | /* 0xfa */ {NULL, NULL}, |
11885 | | /* 0xfb */ {NULL, NULL}, |
11886 | | /* 0xfc */ {NULL, NULL}, |
11887 | | /* 0xfd */ {NULL, NULL}, |
11888 | | /* 0xfe */ {NULL, NULL}, |
11889 | | /* 0xff */ {NULL, NULL}, |
11890 | | }; |
11891 | | |
11892 | | |
11893 | 0 | #define SMB3_AES128CCM_NONCE 11 |
11894 | 0 | #define SMB3_AES128GCM_NONCE 12 |
11895 | | |
11896 | | static bool is_decrypted_header_ok(const uint8_t *p, size_t size) |
11897 | 0 | { |
11898 | 0 | if (size < 4) |
11899 | 0 | return false; |
11900 | | |
11901 | 0 | if ((p[0] == SMB2_COMP_HEADER || p[0] == SMB2_NORM_HEADER) |
11902 | 0 | && (p[1] == 'S' || p[2] == 'M' || p[3] == 'B')) { |
11903 | 0 | return true; |
11904 | 0 | } |
11905 | | |
11906 | 0 | ws_debug("decrypt: bad SMB header"); |
11907 | 0 | return false; |
11908 | 0 | } |
11909 | | |
11910 | | static bool |
11911 | | do_decrypt(uint8_t *data, |
11912 | | size_t data_size, |
11913 | | const uint8_t *key, |
11914 | | const uint8_t *aad, |
11915 | | int aad_size, |
11916 | | const uint8_t *nonce, |
11917 | | int alg) |
11918 | 0 | { |
11919 | 0 | gcry_error_t err; |
11920 | 0 | gcry_cipher_hd_t cipher_hd = NULL; |
11921 | 0 | int algo; |
11922 | 0 | size_t keylen; |
11923 | 0 | int mode; |
11924 | 0 | int iv_size; |
11925 | 0 | uint64_t lengths[3]; |
11926 | |
|
11927 | 0 | switch (alg) { |
11928 | 0 | case SMB2_CIPHER_AES_128_CCM: |
11929 | 0 | algo = GCRY_CIPHER_AES128; |
11930 | 0 | keylen = AES_KEY_SIZE; |
11931 | 0 | mode = GCRY_CIPHER_MODE_CCM; |
11932 | 0 | iv_size = SMB3_AES128CCM_NONCE; |
11933 | 0 | break; |
11934 | 0 | case SMB2_CIPHER_AES_128_GCM: |
11935 | 0 | algo = GCRY_CIPHER_AES128; |
11936 | 0 | keylen = AES_KEY_SIZE; |
11937 | 0 | mode = GCRY_CIPHER_MODE_GCM; |
11938 | 0 | iv_size = SMB3_AES128GCM_NONCE; |
11939 | 0 | break; |
11940 | 0 | case SMB2_CIPHER_AES_256_CCM: |
11941 | 0 | algo = GCRY_CIPHER_AES256; |
11942 | 0 | keylen = AES_KEY_SIZE*2; |
11943 | 0 | mode = GCRY_CIPHER_MODE_CCM; |
11944 | 0 | iv_size = SMB3_AES128CCM_NONCE; |
11945 | 0 | break; |
11946 | 0 | case SMB2_CIPHER_AES_256_GCM: |
11947 | 0 | algo = GCRY_CIPHER_AES256; |
11948 | 0 | keylen = AES_KEY_SIZE*2; |
11949 | 0 | mode = GCRY_CIPHER_MODE_GCM; |
11950 | 0 | iv_size = SMB3_AES128GCM_NONCE; |
11951 | 0 | break; |
11952 | 0 | default: |
11953 | 0 | return false; |
11954 | 0 | } |
11955 | | |
11956 | | /* Open the cipher */ |
11957 | 0 | err = gcry_cipher_open(&cipher_hd, algo, mode, 0); |
11958 | 0 | if (err != GPG_ERR_NO_ERROR) { |
11959 | 0 | ws_debug("GCRY: open %s/%s", gcry_strsource(err), gcry_strerror(err)); |
11960 | 0 | return false; |
11961 | 0 | } |
11962 | | |
11963 | | /* Set the key */ |
11964 | 0 | err = gcry_cipher_setkey(cipher_hd, key, keylen); |
11965 | 0 | if (err != GPG_ERR_NO_ERROR) { |
11966 | 0 | ws_debug("GCRY: setkey %s/%s", gcry_strsource(err), gcry_strerror(err)); |
11967 | 0 | gcry_cipher_close(cipher_hd); |
11968 | 0 | return false; |
11969 | 0 | } |
11970 | | |
11971 | | /* Set the initial value */ |
11972 | 0 | err = gcry_cipher_setiv(cipher_hd, nonce, iv_size); |
11973 | 0 | if (err != GPG_ERR_NO_ERROR) { |
11974 | 0 | ws_debug("GCRY: setiv %s/%s", gcry_strsource(err), gcry_strerror(err)); |
11975 | 0 | gcry_cipher_close(cipher_hd); |
11976 | 0 | return false; |
11977 | 0 | } |
11978 | | |
11979 | 0 | lengths[0] = data_size; /* encrypted length */ |
11980 | 0 | lengths[1] = aad_size; /* AAD length */ |
11981 | 0 | lengths[2] = 16; /* tag length (signature size) */ |
11982 | |
|
11983 | 0 | if (mode == GCRY_CIPHER_MODE_CCM) { |
11984 | 0 | err = gcry_cipher_ctl(cipher_hd, GCRYCTL_SET_CCM_LENGTHS, lengths, sizeof(lengths)); |
11985 | 0 | if (err != GPG_ERR_NO_ERROR) { |
11986 | 0 | ws_debug("GCRY: ctl %s/%s", gcry_strsource(err), gcry_strerror(err)); |
11987 | 0 | gcry_cipher_close(cipher_hd); |
11988 | 0 | return false; |
11989 | 0 | } |
11990 | 0 | } |
11991 | | |
11992 | 0 | err = gcry_cipher_authenticate(cipher_hd, aad, aad_size); |
11993 | 0 | if (err != GPG_ERR_NO_ERROR) { |
11994 | 0 | ws_debug("GCRY: auth %s/%s", gcry_strsource(err), gcry_strerror(err)); |
11995 | 0 | gcry_cipher_close(cipher_hd); |
11996 | 0 | return false; |
11997 | 0 | } |
11998 | | |
11999 | 0 | err = gcry_cipher_decrypt(cipher_hd, data, data_size, NULL, 0); |
12000 | 0 | if (err != GPG_ERR_NO_ERROR) { |
12001 | 0 | ws_debug("GCRY: decrypt %s/%s", gcry_strsource(err), gcry_strerror(err)); |
12002 | 0 | gcry_cipher_close(cipher_hd); |
12003 | 0 | return false; |
12004 | 0 | } |
12005 | | |
12006 | | /* Done with the cipher */ |
12007 | 0 | gcry_cipher_close(cipher_hd); |
12008 | 0 | return is_decrypted_header_ok(data, data_size); |
12009 | 0 | } |
12010 | | |
12011 | | static uint8_t* |
12012 | | decrypt_smb_payload(packet_info *pinfo, |
12013 | | tvbuff_t *tvb, int offset, |
12014 | | int offset_aad, |
12015 | | smb2_transform_info_t *sti) |
12016 | 0 | { |
12017 | 0 | const uint8_t *aad = NULL; |
12018 | 0 | uint8_t *data = NULL; |
12019 | 0 | uint8_t *key16 = NULL; |
12020 | 0 | uint8_t *keys16[2]; |
12021 | 0 | uint8_t *key32 = NULL; |
12022 | 0 | uint8_t *keys32[2]; |
12023 | 0 | bool ok; |
12024 | 0 | int aad_size; |
12025 | 0 | int alg; |
12026 | | |
12027 | | /* AAD is the rest of transform header after the ProtocolID and Signature */ |
12028 | 0 | aad_size = 32; |
12029 | |
|
12030 | 0 | if ((unsigned)tvb_captured_length_remaining(tvb, offset) < sti->size) |
12031 | 0 | return NULL; |
12032 | | |
12033 | 0 | if (tvb_captured_length_remaining(tvb, offset_aad) < aad_size) |
12034 | 0 | return NULL; |
12035 | | |
12036 | 0 | if (pinfo->destport == sti->session->server_port) { |
12037 | 0 | keys16[0] = sti->session->server_decryption_key16; |
12038 | 0 | keys16[1] = sti->session->client_decryption_key16; |
12039 | 0 | keys32[0] = sti->session->server_decryption_key32; |
12040 | 0 | keys32[1] = sti->session->client_decryption_key32; |
12041 | 0 | } else { |
12042 | 0 | keys16[1] = sti->session->server_decryption_key16; |
12043 | 0 | keys16[0] = sti->session->client_decryption_key16; |
12044 | 0 | keys32[1] = sti->session->server_decryption_key32; |
12045 | 0 | keys32[0] = sti->session->client_decryption_key32; |
12046 | 0 | } |
12047 | |
|
12048 | 0 | aad = tvb_get_ptr(tvb, offset_aad, aad_size); |
12049 | 0 | data = (uint8_t *)tvb_memdup(pinfo->pool, tvb, offset, sti->size); |
12050 | | |
12051 | | /* |
12052 | | * In SMB3.0 the transform header had a Algorithm field to |
12053 | | * know which type of encryption was used but only CCM was |
12054 | | * supported. |
12055 | | * |
12056 | | * SMB3.1.1 turned that field into a generic "Encrypted" flag |
12057 | | * which cannot be used to determine the encryption |
12058 | | * type. Instead the type is decided in the NegProt response, |
12059 | | * within the Encryption Capability context which should only |
12060 | | * have one element. That element is si->saved in the conversation |
12061 | | * struct (si->conv) and checked here. |
12062 | | * |
12063 | | * If the trace didn't contain NegProt packets, we have to |
12064 | | * guess the encryption type by trying them all. |
12065 | | * |
12066 | | * Similarly, if we don't have unencrypted packets telling us |
12067 | | * which host is the server and which host is the client, we |
12068 | | * have to guess by trying both keys. |
12069 | | */ |
12070 | |
|
12071 | 0 | ws_debug("dialect 0x%x alg 0x%x conv alg 0x%x", sti->conv->dialect, sti->flags, sti->conv->enc_alg); |
12072 | |
|
12073 | 0 | for (unsigned i = 0; i < G_N_ELEMENTS(keys16); i++) { |
12074 | 0 | bool try_ccm16, try_gcm16; |
12075 | 0 | bool try_ccm32, try_gcm32; |
12076 | 0 | try_ccm16 = try_gcm16 = false; |
12077 | 0 | try_ccm32 = try_gcm32 = false; |
12078 | 0 | ok = false; |
12079 | |
|
12080 | 0 | key16 = keys16[i]; |
12081 | 0 | key32 = keys32[i]; |
12082 | |
|
12083 | 0 | switch (sti->conv->enc_alg) { |
12084 | 0 | case SMB2_CIPHER_AES_128_CCM: |
12085 | 0 | try_ccm16 = true; |
12086 | 0 | break; |
12087 | 0 | case SMB2_CIPHER_AES_128_GCM: |
12088 | 0 | try_gcm16 = true; |
12089 | 0 | break; |
12090 | 0 | case SMB2_CIPHER_AES_256_CCM: |
12091 | 0 | try_ccm32 = true; |
12092 | 0 | break; |
12093 | 0 | case SMB2_CIPHER_AES_256_GCM: |
12094 | 0 | try_gcm32 = true; |
12095 | 0 | break; |
12096 | 0 | default: |
12097 | | /* we don't know, try all */ |
12098 | 0 | try_gcm16 = true; |
12099 | 0 | try_ccm16 = true; |
12100 | 0 | try_gcm32 = true; |
12101 | 0 | try_ccm32 = true; |
12102 | 0 | } |
12103 | | |
12104 | 0 | if (try_gcm16) { |
12105 | 0 | uint8_t *key = key16; |
12106 | 0 | ws_debug("trying AES-128-GCM decryption"); |
12107 | 0 | alg = SMB2_CIPHER_AES_128_GCM; |
12108 | 0 | tvb_memcpy(tvb, data, offset, sti->size); |
12109 | 0 | ok = do_decrypt(data, sti->size, key, aad, aad_size, sti->nonce, alg); |
12110 | 0 | if (ok) |
12111 | 0 | break; |
12112 | 0 | ws_debug("bad decrypted buffer with AES-128-GCM"); |
12113 | 0 | } |
12114 | 0 | if (try_ccm16) { |
12115 | 0 | uint8_t *key = key16; |
12116 | 0 | ws_debug("trying AES-128-CCM decryption"); |
12117 | 0 | alg = SMB2_CIPHER_AES_128_CCM; |
12118 | 0 | ok = do_decrypt(data, sti->size, key, aad, aad_size, sti->nonce, alg); |
12119 | 0 | if (ok) |
12120 | 0 | break; |
12121 | 0 | ws_debug("bad decrypted buffer with AES-128-CCM"); |
12122 | 0 | } |
12123 | 0 | if (try_gcm32) { |
12124 | 0 | uint8_t *key = key32; |
12125 | 0 | ws_debug("trying AES-256-GCM decryption"); |
12126 | 0 | alg = SMB2_CIPHER_AES_256_GCM; |
12127 | 0 | tvb_memcpy(tvb, data, offset, sti->size); |
12128 | 0 | ok = do_decrypt(data, sti->size, key, aad, aad_size, sti->nonce, alg); |
12129 | 0 | if (ok) |
12130 | 0 | break; |
12131 | 0 | ws_debug("bad decrypted buffer with AES-256-GCM"); |
12132 | 0 | } |
12133 | 0 | if (try_ccm32) { |
12134 | 0 | uint8_t *key = key32; |
12135 | 0 | ws_debug("trying AES-256-CCM decryption"); |
12136 | 0 | alg = SMB2_CIPHER_AES_256_CCM; |
12137 | 0 | ok = do_decrypt(data, sti->size, key, aad, aad_size, sti->nonce, alg); |
12138 | 0 | if (ok) |
12139 | 0 | break; |
12140 | 0 | ws_debug("bad decrypted buffer with AES-256-CCM"); |
12141 | 0 | } |
12142 | 0 | ws_debug("trying to decrypt with swapped client/server keys"); |
12143 | 0 | tvb_memcpy(tvb, data, offset, sti->size); |
12144 | 0 | } |
12145 | | |
12146 | 0 | if (!ok) |
12147 | 0 | return NULL; |
12148 | | |
12149 | | /* Remember what worked */ |
12150 | 0 | sti->conv->enc_alg = alg; |
12151 | 0 | if (key16 == sti->session->server_decryption_key16) |
12152 | 0 | sti->session->server_port = pinfo->destport; |
12153 | 0 | else |
12154 | 0 | sti->session->server_port = pinfo->srcport; |
12155 | 0 | return data; |
12156 | 0 | } |
12157 | | |
12158 | | /* |
12159 | | Append tvb[offset:offset+length] to out |
12160 | | */ |
12161 | | static void |
12162 | | append_uncompress_data(wmem_array_t *out, tvbuff_t *tvb, int offset, unsigned length) |
12163 | 0 | { |
12164 | 0 | const uint8_t *ptr = tvb_get_ptr(tvb, offset, length); |
12165 | 0 | if (ptr) |
12166 | 0 | wmem_array_append(out, tvb_get_ptr(tvb, offset, length), length); |
12167 | 0 | } |
12168 | | |
12169 | | static int |
12170 | | dissect_smb2_compression_pattern_v1(proto_tree *tree, |
12171 | | tvbuff_t *tvb, int offset, int length, |
12172 | | wmem_array_t *out) |
12173 | 0 | { |
12174 | 0 | proto_item *pat_item; |
12175 | 0 | proto_tree *pat_tree; |
12176 | 0 | unsigned pattern, times; |
12177 | |
|
12178 | 0 | pat_tree = proto_tree_add_subtree_format(tree, tvb, offset, length, |
12179 | 0 | ett_smb2_comp_pattern_v1, &pat_item, |
12180 | 0 | "Pattern"); |
12181 | |
|
12182 | 0 | proto_tree_add_item_ret_uint(pat_tree, hf_smb2_comp_pattern_v1_pattern, tvb, offset, 1, ENC_LITTLE_ENDIAN, &pattern); |
12183 | 0 | offset += 1; |
12184 | |
|
12185 | 0 | proto_tree_add_item(pat_tree, hf_smb2_comp_pattern_v1_reserved1, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
12186 | 0 | offset += 1; |
12187 | |
|
12188 | 0 | proto_tree_add_item(pat_tree, hf_smb2_comp_pattern_v1_reserved2, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
12189 | 0 | offset += 2; |
12190 | |
|
12191 | 0 | proto_tree_add_item_ret_uint(pat_tree, hf_smb2_comp_pattern_v1_repetitions, tvb, offset, 4, ENC_LITTLE_ENDIAN, ×); |
12192 | 0 | offset += 4; |
12193 | |
|
12194 | 0 | proto_item_append_text(pat_item, " 0x%02x repeated %u times", pattern, times); |
12195 | |
|
12196 | 0 | if (out && times < MAX_UNCOMPRESSED_SIZE) { |
12197 | 0 | uint8_t v = (uint8_t)pattern; |
12198 | |
|
12199 | 0 | for (unsigned i = 0; i < times; i++) |
12200 | 0 | wmem_array_append(out, &v, 1); |
12201 | 0 | } |
12202 | |
|
12203 | 0 | return offset; |
12204 | 0 | } |
12205 | | |
12206 | | static int |
12207 | | dissect_smb2_chained_comp_payload(packet_info *pinfo, proto_tree *tree, |
12208 | | tvbuff_t *tvb, int offset, |
12209 | | wmem_array_t *out, |
12210 | | bool *ok) |
12211 | 0 | { |
12212 | 0 | proto_tree *subtree; |
12213 | 0 | proto_item *subitem; |
12214 | 0 | unsigned alg, length, flags, orig_size = 0; |
12215 | 0 | tvbuff_t *uncomp_tvb = NULL; |
12216 | 0 | bool lz_based = false; |
12217 | |
|
12218 | 0 | *ok = true; |
12219 | |
|
12220 | 0 | subtree = proto_tree_add_subtree_format(tree, tvb, offset, 0, ett_smb2_comp_payload, &subitem, "COMPRESSION_PAYLOAD_HEADER"); |
12221 | 0 | proto_tree_add_item_ret_uint(subtree, hf_smb2_comp_transform_comp_alg, tvb, offset, 2, ENC_LITTLE_ENDIAN, &alg); |
12222 | 0 | offset += 2; |
12223 | |
|
12224 | 0 | proto_tree_add_item_ret_uint(subtree, hf_smb2_comp_transform_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN, &flags); |
12225 | 0 | offset += 2; |
12226 | |
|
12227 | 0 | proto_tree_add_item_ret_uint(subtree, hf_smb2_comp_transform_length, tvb, offset, 4, ENC_LITTLE_ENDIAN, &length); |
12228 | 0 | offset += 4; |
12229 | |
|
12230 | 0 | proto_item_set_len(subitem, length); |
12231 | |
|
12232 | 0 | lz_based = (SMB2_COMP_ALG_LZNT1 <= alg && alg <= SMB2_COMP_ALG_LZ77HUFF); |
12233 | 0 | if (lz_based) { |
12234 | 0 | proto_tree_add_item_ret_uint(subtree, hf_smb2_comp_transform_orig_payload_size, |
12235 | 0 | tvb, offset, 4, ENC_LITTLE_ENDIAN, &orig_size); |
12236 | 0 | offset += 4; |
12237 | 0 | length -= 4; |
12238 | 0 | } |
12239 | |
|
12240 | 0 | if (length > MAX_UNCOMPRESSED_SIZE) { |
12241 | | /* decompression error */ |
12242 | 0 | col_append_str(pinfo->cinfo, COL_INFO, "Comp. SMB3 (invalid)"); |
12243 | 0 | *ok = false; |
12244 | 0 | goto out; |
12245 | 0 | } |
12246 | | |
12247 | 0 | switch (alg) { |
12248 | 0 | case SMB2_COMP_ALG_NONE: |
12249 | 0 | append_uncompress_data(out, tvb, offset, length); |
12250 | 0 | break; |
12251 | 0 | case SMB2_COMP_ALG_LZ77: |
12252 | 0 | uncomp_tvb = tvb_uncompress_lz77(tvb, offset, length); |
12253 | 0 | break; |
12254 | 0 | case SMB2_COMP_ALG_LZ77HUFF: |
12255 | 0 | uncomp_tvb = tvb_uncompress_lz77huff(tvb, offset, length); |
12256 | 0 | break; |
12257 | 0 | case SMB2_COMP_ALG_LZNT1: |
12258 | 0 | uncomp_tvb = tvb_uncompress_lznt1(tvb, offset, length); |
12259 | 0 | break; |
12260 | 0 | case SMB2_COMP_ALG_PATTERN_V1: |
12261 | 0 | dissect_smb2_compression_pattern_v1(subtree, tvb, offset, length, out); |
12262 | 0 | break; |
12263 | 0 | default: |
12264 | 0 | col_append_str(pinfo->cinfo, COL_INFO, "Comp. SMB3 (unknown)"); |
12265 | 0 | uncomp_tvb = NULL; |
12266 | 0 | break; |
12267 | 0 | } |
12268 | | |
12269 | 0 | if (lz_based) { |
12270 | 0 | if (!uncomp_tvb || tvb_reported_length(uncomp_tvb) != orig_size) { |
12271 | | /* decompression error */ |
12272 | 0 | col_append_str(pinfo->cinfo, COL_INFO, "Comp. SMB3 (invalid)"); |
12273 | 0 | *ok = false; |
12274 | 0 | goto out; |
12275 | 0 | } |
12276 | 0 | append_uncompress_data(out, uncomp_tvb, 0, tvb_reported_length(uncomp_tvb)); |
12277 | 0 | } |
12278 | | |
12279 | 0 | out: |
12280 | 0 | if (uncomp_tvb) |
12281 | 0 | tvb_free(uncomp_tvb); |
12282 | 0 | proto_tree_add_item(subtree, hf_smb2_comp_transform_data, tvb, offset, length, ENC_NA); |
12283 | 0 | offset += length; |
12284 | |
|
12285 | 0 | return offset; |
12286 | 0 | } |
12287 | | |
12288 | | static int |
12289 | | dissect_smb2_comp_transform_header(packet_info *pinfo, proto_tree *tree, |
12290 | | tvbuff_t *tvb, int offset, |
12291 | | smb2_comp_transform_info_t *scti, |
12292 | | tvbuff_t **comp_tvb, |
12293 | | tvbuff_t **plain_tvb) |
12294 | 0 | { |
12295 | 0 | int in_size; |
12296 | 0 | tvbuff_t *uncomp_tvb = NULL; |
12297 | 0 | unsigned flags; |
12298 | 0 | wmem_array_t *uncomp_data; |
12299 | |
|
12300 | 0 | *comp_tvb = NULL; |
12301 | 0 | *plain_tvb = NULL; |
12302 | | |
12303 | | /* |
12304 | | "old" compressed method: |
12305 | | |
12306 | | [COMPRESS_TRANSFORM_HEADER with Flags=0] |
12307 | | [OPTIONAL UNCOMPRESSED DATA] |
12308 | | [COMPRESSED DATA] |
12309 | | |
12310 | | new "chained" compressed method: |
12311 | | |
12312 | | [fist 8 bytes of COMPRESS_TRANSFORM_HEADER with Flags=CHAINED] |
12313 | | [ sequence of |
12314 | | [ COMPRESSION_PAYLOAD_HEADER ] |
12315 | | [ COMPRESSED PAYLOAD ] |
12316 | | ] |
12317 | | */ |
12318 | | |
12319 | | /* SMB2_COMPRESSION_TRANSFORM marker */ |
12320 | 0 | proto_tree_add_item(tree, hf_smb2_protocol_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
12321 | 0 | offset += 4; |
12322 | |
|
12323 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_comp_transform_orig_size, tvb, offset, 4, ENC_LITTLE_ENDIAN, &scti->orig_size); |
12324 | 0 | offset += 4; |
12325 | |
|
12326 | 0 | uncomp_data = wmem_array_sized_new(pinfo->pool, 1, 1024); |
12327 | |
|
12328 | 0 | flags = tvb_get_letohs(tvb, offset+2); |
12329 | 0 | if (flags & SMB2_COMP_FLAG_CHAINED) { |
12330 | 0 | bool all_ok = true; |
12331 | |
|
12332 | 0 | *comp_tvb = tvb_new_subset_length(tvb, offset, tvb_reported_length_remaining(tvb, offset)); |
12333 | 0 | do { |
12334 | 0 | bool ok = false; |
12335 | |
|
12336 | 0 | offset = dissect_smb2_chained_comp_payload(pinfo, tree, tvb, offset, uncomp_data, &ok); |
12337 | 0 | if (!ok) |
12338 | 0 | all_ok = false; |
12339 | 0 | } while (tvb_reported_length_remaining(tvb, offset) > 8); |
12340 | 0 | if (all_ok) |
12341 | 0 | goto decompression_ok; |
12342 | 0 | else |
12343 | 0 | goto out; |
12344 | |
|
12345 | 0 | } |
12346 | | |
12347 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_comp_transform_comp_alg, tvb, offset, 2, ENC_LITTLE_ENDIAN, &scti->alg); |
12348 | 0 | offset += 2; |
12349 | |
|
12350 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_comp_transform_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN, &flags); |
12351 | 0 | offset += 2; |
12352 | |
|
12353 | 0 | proto_tree_add_item_ret_uint(tree, hf_smb2_comp_transform_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN, &scti->comp_offset); |
12354 | 0 | offset += 4; |
12355 | |
|
12356 | 0 | *comp_tvb = tvb_new_subset_length(tvb, offset, tvb_reported_length_remaining(tvb, offset)); |
12357 | |
|
12358 | 0 | if (scti->orig_size > MAX_UNCOMPRESSED_SIZE || scti->comp_offset > MAX_UNCOMPRESSED_SIZE) { |
12359 | 0 | col_append_str(pinfo->cinfo, COL_INFO, "Comp. SMB3 (too big)"); |
12360 | 0 | goto out; |
12361 | 0 | } |
12362 | | |
12363 | | /* |
12364 | | * final uncompressed size is the partial normal packet + uncompressed segment |
12365 | | * final_size = scti->orig_size + scti->comp_offset |
12366 | | */ |
12367 | | |
12368 | 0 | append_uncompress_data(uncomp_data, tvb, offset, scti->comp_offset); |
12369 | 0 | in_size = tvb_reported_length_remaining(tvb, offset + scti->comp_offset); |
12370 | | |
12371 | | /* decompress compressed segment */ |
12372 | 0 | switch (scti->alg) { |
12373 | 0 | case SMB2_COMP_ALG_LZ77: |
12374 | 0 | uncomp_tvb = tvb_uncompress_lz77(tvb, offset + scti->comp_offset, in_size); |
12375 | 0 | break; |
12376 | 0 | case SMB2_COMP_ALG_LZ77HUFF: |
12377 | 0 | uncomp_tvb = tvb_uncompress_lz77huff(tvb, offset + scti->comp_offset, in_size); |
12378 | 0 | break; |
12379 | 0 | case SMB2_COMP_ALG_LZNT1: |
12380 | 0 | uncomp_tvb = tvb_uncompress_lznt1(tvb, offset + scti->comp_offset, in_size); |
12381 | 0 | break; |
12382 | 0 | default: |
12383 | 0 | col_append_str(pinfo->cinfo, COL_INFO, "Comp. SMB3 (unknown)"); |
12384 | 0 | uncomp_tvb = NULL; |
12385 | 0 | goto out; |
12386 | 0 | } |
12387 | | |
12388 | 0 | if (!uncomp_tvb || tvb_reported_length(uncomp_tvb) != scti->orig_size) { |
12389 | | /* decompression error */ |
12390 | 0 | col_append_str(pinfo->cinfo, COL_INFO, "Comp. SMB3 (invalid)"); |
12391 | 0 | goto out; |
12392 | 0 | } |
12393 | | |
12394 | | /* write decompressed segment at the end of partial packet */ |
12395 | 0 | append_uncompress_data(uncomp_data, uncomp_tvb, 0, scti->orig_size); |
12396 | |
|
12397 | 0 | decompression_ok: |
12398 | 0 | col_append_str(pinfo->cinfo, COL_INFO, "Decomp. SMB3"); |
12399 | 0 | *plain_tvb = tvb_new_child_real_data(tvb, |
12400 | 0 | (uint8_t *)wmem_array_get_raw(uncomp_data), |
12401 | 0 | wmem_array_get_count(uncomp_data), |
12402 | 0 | wmem_array_get_count(uncomp_data)); |
12403 | 0 | add_new_data_source(pinfo, *plain_tvb, "Decomp. SMB3"); |
12404 | |
|
12405 | 0 | out: |
12406 | 0 | if (uncomp_tvb) |
12407 | 0 | tvb_free(uncomp_tvb); |
12408 | 0 | return offset; |
12409 | 0 | } |
12410 | | |
12411 | | static int |
12412 | | dissect_smb2_transform_header(packet_info *pinfo, proto_tree *tree, |
12413 | | tvbuff_t *tvb, int offset, |
12414 | | smb2_transform_info_t *sti, |
12415 | | tvbuff_t **enc_tvb, tvbuff_t **plain_tvb) |
12416 | 0 | { |
12417 | 0 | proto_item *sesid_item = NULL; |
12418 | 0 | proto_tree *sesid_tree = NULL; |
12419 | 0 | int sesid_offset; |
12420 | 0 | uint8_t *plain_data = NULL; |
12421 | 0 | int offset_aad; |
12422 | |
|
12423 | 0 | *enc_tvb = NULL; |
12424 | 0 | *plain_tvb = NULL; |
12425 | | |
12426 | | /* signature */ |
12427 | 0 | proto_tree_add_item(tree, hf_smb2_transform_signature, tvb, offset, 16, ENC_NA); |
12428 | 0 | offset += 16; |
12429 | |
|
12430 | 0 | offset_aad = offset; |
12431 | | |
12432 | | /* nonce */ |
12433 | 0 | proto_tree_add_item(tree, hf_smb2_transform_nonce, tvb, offset, 16, ENC_NA); |
12434 | 0 | tvb_memcpy(tvb, sti->nonce, offset, 16); |
12435 | 0 | offset += 16; |
12436 | | |
12437 | | /* size */ |
12438 | 0 | proto_tree_add_item(tree, hf_smb2_transform_msg_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
12439 | 0 | sti->size = tvb_get_letohl(tvb, offset); |
12440 | 0 | offset += 4; |
12441 | | |
12442 | | /* reserved */ |
12443 | 0 | proto_tree_add_item(tree, hf_smb2_transform_reserved, tvb, offset, 2, ENC_NA); |
12444 | 0 | offset += 2; |
12445 | | |
12446 | | /* flags */ |
12447 | 0 | proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_transform_flags, |
12448 | 0 | ett_smb2_transform_flags, |
12449 | 0 | smb2_transform_flags, ENC_LITTLE_ENDIAN); |
12450 | 0 | sti->flags = tvb_get_letohs(tvb, offset); |
12451 | 0 | offset += 2; |
12452 | | |
12453 | | /* session ID */ |
12454 | 0 | sesid_offset = offset; |
12455 | 0 | sti->sesid = tvb_get_letoh64(tvb, offset); |
12456 | 0 | sesid_item = proto_tree_add_item(tree, hf_smb2_sesid, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
12457 | 0 | sesid_tree = proto_item_add_subtree(sesid_item, ett_smb2_sesid_tree); |
12458 | 0 | offset += 8; |
12459 | | |
12460 | | /* now we need to first lookup the uid session */ |
12461 | 0 | sti->session = smb2_get_session(sti->conv, sti->sesid, NULL, NULL); |
12462 | 0 | smb2_add_session_info(sesid_tree, sesid_item, tvb, sesid_offset, sti->session); |
12463 | |
|
12464 | 0 | if (sti->flags & SMB2_TRANSFORM_FLAGS_ENCRYPTED) { |
12465 | 0 | plain_data = decrypt_smb_payload(pinfo, tvb, offset, offset_aad, sti); |
12466 | 0 | } |
12467 | 0 | *enc_tvb = tvb_new_subset_length(tvb, offset, sti->size); |
12468 | |
|
12469 | 0 | if (plain_data != NULL) { |
12470 | 0 | *plain_tvb = tvb_new_child_real_data(*enc_tvb, plain_data, sti->size, sti->size); |
12471 | 0 | add_new_data_source(pinfo, *plain_tvb, "Decrypted SMB3"); |
12472 | 0 | } |
12473 | |
|
12474 | 0 | offset += sti->size; |
12475 | 0 | return offset; |
12476 | 0 | } |
12477 | | |
12478 | | static const char * |
12479 | | get_special_packet_title(uint16_t cmd, uint32_t flags, uint64_t msg_id, tvbuff_t *tvb, int offset) |
12480 | 0 | { |
12481 | | /* for some types of packets we don't have request/response packets but something else |
12482 | | * to show more correct names while displaying them we use this logic to override standard naming convention |
12483 | | */ |
12484 | |
|
12485 | 0 | uint16_t buffer_code; |
12486 | | /* detect oplock/lease break packets */ |
12487 | 0 | if (cmd != SMB2_COM_BREAK) { |
12488 | 0 | return NULL; |
12489 | 0 | } |
12490 | | |
12491 | 0 | buffer_code = tvb_get_letohs(tvb, offset); |
12492 | 0 | if (flags & SMB2_FLAGS_RESPONSE) { |
12493 | 0 | switch (buffer_code) { |
12494 | 0 | case OPLOCK_BREAK_OPLOCK_STRUCTURE_SIZE: |
12495 | | /* note - Notification and Response packets for Oplock Break are equivalent, |
12496 | | * we can distinguish them only via msg_id value */ |
12497 | 0 | if (msg_id == 0xFFFFFFFFFFFFFFFF) /* see [MS-SMB2] 3.3.4.6 Object Store Indicates an Oplock Break */ |
12498 | 0 | return "Oplock Break Notification"; |
12499 | 0 | else |
12500 | 0 | return "Oplock Break Response"; |
12501 | 0 | case OPLOCK_BREAK_LEASE_NOTIFICATION_STRUCTURE_SIZE: |
12502 | 0 | return "Lease Break Notification"; |
12503 | 0 | case OPLOCK_BREAK_LEASE_RESPONSE_STRUCTURE_SIZE: |
12504 | 0 | return "Lease Break Response"; |
12505 | 0 | } |
12506 | 0 | } else { |
12507 | 0 | switch (buffer_code) { |
12508 | 0 | case OPLOCK_BREAK_OPLOCK_STRUCTURE_SIZE: |
12509 | 0 | return "Oplock Break Acknowledgment"; |
12510 | 0 | case OPLOCK_BREAK_LEASE_ACKNOWLEDGMENT_STRUCTURE_SIZE: |
12511 | 0 | return "Lease Break Acknowledgment"; |
12512 | 0 | } |
12513 | 0 | } |
12514 | | /* return back to standard notation if we can't detect packet type of break packet */ |
12515 | 0 | return NULL; |
12516 | 0 | } |
12517 | | |
12518 | | static int |
12519 | | dissect_smb2_command(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, smb2_info_t *si) |
12520 | 0 | { |
12521 | 0 | int (*cmd_dissector)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si); |
12522 | 0 | proto_item *cmd_item; |
12523 | 0 | proto_tree *cmd_tree; |
12524 | 0 | int old_offset = offset; |
12525 | 0 | const char *packet_title = get_special_packet_title(si->opcode, si->flags, si->msg_id, tvb, offset); |
12526 | |
|
12527 | 0 | if (packet_title) { |
12528 | 0 | cmd_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1, |
12529 | 0 | ett_smb2_command, &cmd_item, "%s (0x%02x)", |
12530 | 0 | packet_title, |
12531 | 0 | si->opcode); |
12532 | 0 | } else { |
12533 | 0 | cmd_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1, |
12534 | 0 | ett_smb2_command, &cmd_item, "%s %s (0x%02x)", |
12535 | 0 | decode_smb2_name(si->opcode), |
12536 | 0 | (si->flags & SMB2_FLAGS_RESPONSE)?"Response":"Request", |
12537 | 0 | si->opcode); |
12538 | 0 | } |
12539 | |
|
12540 | 0 | cmd_dissector = (si->flags & SMB2_FLAGS_RESPONSE)? |
12541 | 0 | smb2_dissector[si->opcode&0xff].response: |
12542 | 0 | smb2_dissector[si->opcode&0xff].request; |
12543 | 0 | if (cmd_dissector) { |
12544 | 0 | offset = (*cmd_dissector)(tvb, pinfo, cmd_tree, offset, si); |
12545 | 0 | } else { |
12546 | 0 | proto_tree_add_item(cmd_tree, hf_smb2_unknown, tvb, offset, -1, ENC_NA); |
12547 | 0 | offset = tvb_captured_length(tvb); |
12548 | 0 | } |
12549 | |
|
12550 | 0 | proto_item_set_len(cmd_item, offset-old_offset); |
12551 | |
|
12552 | 0 | return offset; |
12553 | 0 | } |
12554 | | |
12555 | | static int |
12556 | | dissect_smb2_tid_sesid(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, smb2_info_t *si) |
12557 | 0 | { |
12558 | 0 | proto_item *tid_item = NULL; |
12559 | 0 | proto_tree *tid_tree = NULL; |
12560 | 0 | smb2_tid_info_t tid_key; |
12561 | 0 | int tid_offset = 0; |
12562 | 0 | proto_item *sesid_item = NULL; |
12563 | 0 | proto_tree *sesid_tree = NULL; |
12564 | 0 | smb2_sesid_info_t sesid_key; |
12565 | 0 | int sesid_offset; |
12566 | 0 | proto_item *item; |
12567 | | |
12568 | |
|
12569 | 0 | if (si->flags&SMB2_FLAGS_ASYNC_CMD) { |
12570 | 0 | proto_tree_add_item(tree, hf_smb2_aid, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
12571 | 0 | offset += 8; |
12572 | 0 | } else { |
12573 | | /* Reserved */ |
12574 | 0 | proto_tree_add_item(tree, hf_smb2_header_reserved, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
12575 | 0 | offset += 4; |
12576 | | |
12577 | | /* Tree ID */ |
12578 | 0 | tid_offset = offset; |
12579 | 0 | si->tid = tvb_get_letohl(tvb, offset); |
12580 | 0 | tid_item = proto_tree_add_item(tree, hf_smb2_tid, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
12581 | 0 | tid_tree = proto_item_add_subtree(tid_item, ett_smb2_tid_tree); |
12582 | 0 | offset += 4; |
12583 | 0 | } |
12584 | | |
12585 | | /* Session ID */ |
12586 | 0 | sesid_offset = offset; |
12587 | 0 | si->sesid = tvb_get_letoh64(tvb, offset); |
12588 | 0 | sesid_item = proto_tree_add_item(tree, hf_smb2_sesid, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
12589 | 0 | sesid_tree = proto_item_add_subtree(sesid_item, ett_smb2_sesid_tree); |
12590 | 0 | offset += 8; |
12591 | | |
12592 | | /* now we need to first lookup the uid session */ |
12593 | 0 | sesid_key.sesid = si->sesid; |
12594 | 0 | si->session = (smb2_sesid_info_t *)wmem_map_lookup(smb2_sessions, &sesid_key); |
12595 | 0 | if (!si->session) { |
12596 | 0 | si->session = smb2_get_session(si->conv, si->sesid, pinfo, si); |
12597 | 0 | return offset; |
12598 | 0 | } |
12599 | | |
12600 | 0 | smb2_add_session_info(sesid_tree, sesid_item, tvb, sesid_offset, si->session); |
12601 | |
|
12602 | 0 | if (!(si->flags&SMB2_FLAGS_ASYNC_CMD)) { |
12603 | | /* see if we can find the name for this tid */ |
12604 | 0 | tid_key.tid = si->tid; |
12605 | 0 | si->tree = (smb2_tid_info_t *)wmem_map_lookup(si->session->tids, &tid_key); |
12606 | 0 | if (!si->tree) return offset; |
12607 | | |
12608 | 0 | item = proto_tree_add_string(tid_tree, hf_smb2_tree, tvb, tid_offset, 4, si->tree->name); |
12609 | 0 | proto_item_set_generated(item); |
12610 | 0 | proto_item_append_text(tid_item, " %s", si->tree->name); |
12611 | |
|
12612 | 0 | item = proto_tree_add_uint(tid_tree, hf_smb2_share_type, tvb, tid_offset, 0, si->tree->share_type); |
12613 | 0 | proto_item_set_generated(item); |
12614 | |
|
12615 | 0 | item = proto_tree_add_uint(tid_tree, hf_smb2_tcon_frame, tvb, tid_offset, 0, si->tree->connect_frame); |
12616 | 0 | proto_item_set_generated(item); |
12617 | |
|
12618 | 0 | item = proto_tree_add_uint(tid_tree, hf_smb2_tdcon_frame, tvb, tid_offset, 0, si->tree->disconnect_frame); |
12619 | 0 | proto_item_set_generated(item); |
12620 | |
|
12621 | 0 | } |
12622 | | |
12623 | 0 | return offset; |
12624 | 0 | } |
12625 | | |
12626 | | static void |
12627 | | dissect_smb2_signature(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree, smb2_info_t *si) |
12628 | 0 | { |
12629 | 0 | proto_item *item = NULL; |
12630 | 0 | proto_tree *stree = NULL; |
12631 | 0 | gcry_error_t err; |
12632 | 0 | gcry_mac_hd_t md; |
12633 | 0 | uint8_t mac[NTLMSSP_KEY_LEN] = { 0, }; |
12634 | 0 | size_t len = NTLMSSP_KEY_LEN; |
12635 | 0 | int i, remaining; |
12636 | 0 | bool use_mac = false; |
12637 | |
|
12638 | 0 | item = proto_tree_add_item(tree, hf_smb2_signature, tvb, offset, 16, ENC_NA); |
12639 | |
|
12640 | 0 | if (!si || !si->session ||!si->conv) |
12641 | 0 | return; |
12642 | | |
12643 | 0 | if (!smb2_verify_signatures || !(si->flags & SMB2_FLAGS_SIGNATURE)) |
12644 | 0 | return; |
12645 | | |
12646 | 0 | if (memcmp(si->session->signing_key, zeros, NTLMSSP_KEY_LEN) == 0) { |
12647 | 0 | return; |
12648 | 0 | } |
12649 | | |
12650 | 0 | if (tvb_reported_length(tvb) > tvb_captured_length(tvb)) |
12651 | 0 | return; |
12652 | | |
12653 | 0 | remaining = tvb_reported_length_remaining(tvb, offset + NTLMSSP_KEY_LEN); |
12654 | |
|
12655 | 0 | if (si->conv->sign_alg == SMB2_SIGNING_ALG_HMAC_SHA256) { |
12656 | 0 | err = gcry_mac_open(&md, GCRY_MAC_HMAC_SHA256, 0, NULL); |
12657 | 0 | if (err) |
12658 | 0 | return; |
12659 | 0 | use_mac = true; |
12660 | 0 | } else if (si->conv->sign_alg == SMB2_SIGNING_ALG_AES_CMAC) { |
12661 | 0 | err = gcry_mac_open(&md, GCRY_MAC_CMAC_AES, 0, NULL); |
12662 | 0 | if (err) |
12663 | 0 | return; |
12664 | 0 | use_mac = true; |
12665 | 0 | } |
12666 | | |
12667 | 0 | if (use_mac) { |
12668 | 0 | gcry_mac_setkey(md, si->session->signing_key, len); |
12669 | 0 | gcry_mac_write(md, tvb_get_ptr(tvb, 0, 48), 48); |
12670 | 0 | gcry_mac_write(md, zeros, NTLMSSP_KEY_LEN); |
12671 | 0 | gcry_mac_write(md, tvb_get_ptr(tvb, offset + NTLMSSP_KEY_LEN, remaining), remaining); |
12672 | 0 | gcry_mac_read(md, &mac[0], &len); |
12673 | 0 | gcry_mac_close(md); |
12674 | 0 | } |
12675 | |
|
12676 | 0 | stree = proto_item_add_subtree(item, ett_smb2_signature); |
12677 | |
|
12678 | 0 | if (memcmp(&mac[0], tvb_get_ptr(tvb, offset, NTLMSSP_KEY_LEN), NTLMSSP_KEY_LEN) == 0) { |
12679 | 0 | proto_tree_add_item(stree, hf_smb2_good_signature, tvb, offset, 16, ENC_NA); |
12680 | 0 | return; /* signature matched */ |
12681 | 0 | } |
12682 | | |
12683 | 0 | item = proto_tree_add_item(stree, hf_smb2_bad_signature, tvb, offset, 16, ENC_NA); |
12684 | 0 | proto_item_append_text(item, " "); |
12685 | 0 | for (i = 0; i < NTLMSSP_KEY_LEN; i++) |
12686 | 0 | proto_item_append_text(item, "%02x", mac[i]); |
12687 | 0 | proto_item_set_generated(item); |
12688 | 0 | expert_add_info(pinfo, item, &ei_smb2_invalid_signature); |
12689 | |
|
12690 | 0 | return; |
12691 | 0 | } |
12692 | | |
12693 | | static int |
12694 | | // NOLINTNEXTLINE(misc-no-recursion) |
12695 | | dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, bool first_in_chain) |
12696 | 0 | { |
12697 | 0 | int msg_type; |
12698 | 0 | proto_item *item = NULL; |
12699 | 0 | proto_tree *tree = NULL; |
12700 | 0 | proto_item *header_item = NULL; |
12701 | 0 | proto_tree *header_tree = NULL; |
12702 | 0 | int offset = 0; |
12703 | 0 | int chain_offset = 0; |
12704 | 0 | const char *label = smb_header_label; |
12705 | 0 | conversation_t *conversation; |
12706 | 0 | smb2_saved_info_t *ssi = NULL, ssi_key; |
12707 | 0 | smb2_info_t *si; |
12708 | 0 | smb2_transform_info_t *sti; |
12709 | 0 | smb2_comp_transform_info_t *scti; |
12710 | 0 | char *fid_name; |
12711 | 0 | uint32_t open_frame,close_frame; |
12712 | 0 | smb2_eo_file_info_t *eo_file_info; |
12713 | 0 | e_ctx_hnd *policy_hnd_hashtablekey; |
12714 | 0 | const char *packet_title; |
12715 | |
|
12716 | 0 | sti = wmem_new(pinfo->pool, smb2_transform_info_t); |
12717 | 0 | scti = wmem_new(pinfo->pool, smb2_comp_transform_info_t); |
12718 | 0 | si = wmem_new0(pinfo->pool, smb2_info_t); |
12719 | | // XXX Should we create a dummy si->saved here? Or even make |
12720 | | // smb2_info_t.saved an smb2_saved_info_t instead of an |
12721 | | // smb2_saved_info_t* ? It would remove the need for a bunch of |
12722 | | // NULL checks later on. |
12723 | 0 | si->top_tree = parent_tree; |
12724 | |
|
12725 | 0 | msg_type = tvb_get_uint8(tvb, 0); |
12726 | |
|
12727 | 0 | switch (msg_type) { |
12728 | 0 | case SMB2_COMP_HEADER: |
12729 | 0 | label = smb_comp_transform_header_label; |
12730 | 0 | break; |
12731 | 0 | case SMB2_ENCR_HEADER: |
12732 | 0 | label = smb_transform_header_label; |
12733 | 0 | break; |
12734 | 0 | case SMB2_NORM_HEADER: |
12735 | 0 | label = smb_header_label; |
12736 | 0 | break; |
12737 | 0 | default: |
12738 | 0 | label = smb_bad_header_label; |
12739 | 0 | break; |
12740 | 0 | } |
12741 | | |
12742 | 0 | increment_dissection_depth(pinfo); |
12743 | | |
12744 | | /* find which conversation we are part of and get the data for that |
12745 | | * conversation |
12746 | | */ |
12747 | 0 | conversation = find_or_create_conversation(pinfo); |
12748 | 0 | si->conv = (smb2_conv_info_t *)conversation_get_proto_data(conversation, proto_smb2); |
12749 | 0 | if (!si->conv) { |
12750 | | /* no smb2_into_t structure for this conversation yet, |
12751 | | * create it. |
12752 | | */ |
12753 | 0 | si->conv = wmem_new0(wmem_file_scope(), smb2_conv_info_t); |
12754 | | /* qqq this leaks memory for now since we never free |
12755 | | the hashtables */ |
12756 | 0 | si->conv->matched = g_hash_table_new(smb2_saved_info_hash_matched, |
12757 | 0 | smb2_saved_info_equal_matched); |
12758 | 0 | si->conv->unmatched = g_hash_table_new(smb2_saved_info_hash_unmatched, |
12759 | 0 | smb2_saved_info_equal_unmatched); |
12760 | 0 | si->conv->preauth_hash_current = si->conv->preauth_hash_con; |
12761 | | |
12762 | | /* Bit of a hack to avoid leaking the hash tables - register a |
12763 | | * callback to free them. Ideally wmem would implement a simple |
12764 | | * hash table so we wouldn't have to do this. */ |
12765 | 0 | wmem_register_callback(wmem_file_scope(), smb2_conv_destroy, |
12766 | 0 | si->conv); |
12767 | |
|
12768 | 0 | conversation_add_proto_data(conversation, proto_smb2, si->conv); |
12769 | 0 | } |
12770 | |
|
12771 | 0 | sti->conv = si->conv; |
12772 | 0 | scti->conv = si->conv; |
12773 | |
|
12774 | 0 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMB2"); |
12775 | 0 | if (first_in_chain) { |
12776 | | /* first packet */ |
12777 | 0 | col_clear(pinfo->cinfo, COL_INFO); |
12778 | 0 | } else { |
12779 | 0 | col_append_str(pinfo->cinfo, COL_INFO, "; "); |
12780 | 0 | } |
12781 | |
|
12782 | 0 | item = proto_tree_add_item(parent_tree, proto_smb2, tvb, offset, -1, ENC_NA); |
12783 | 0 | tree = proto_item_add_subtree(item, ett_smb2); |
12784 | |
|
12785 | 0 | header_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_smb2_header, &header_item, label); |
12786 | | |
12787 | | /* Decode the header */ |
12788 | |
|
12789 | 0 | if (msg_type == SMB2_NORM_HEADER) { |
12790 | | /* SMB2 marker */ |
12791 | 0 | proto_tree_add_item(header_tree, hf_smb2_protocol_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
12792 | 0 | offset += 4; |
12793 | | |
12794 | | /* we need the flags before we know how to parse the credits field */ |
12795 | 0 | si->flags = tvb_get_letohl(tvb, offset+12); |
12796 | | |
12797 | | /* header length */ |
12798 | 0 | proto_tree_add_item(header_tree, hf_smb2_header_len, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
12799 | 0 | offset += 2; |
12800 | | |
12801 | | /* credit charge (previously "epoch" (unused) which has been deprecated as of "SMB 2.1") */ |
12802 | 0 | proto_tree_add_item(header_tree, hf_smb2_credit_charge, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
12803 | 0 | offset += 2; |
12804 | | |
12805 | | /* Status Code */ |
12806 | 0 | if (si->flags & SMB2_FLAGS_RESPONSE) { |
12807 | 0 | si->status = tvb_get_letohl(tvb, offset); |
12808 | 0 | proto_tree_add_item(header_tree, hf_smb2_nt_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
12809 | 0 | if (si->status) { |
12810 | 0 | proto_item_append_text(item, ", %s", |
12811 | 0 | val_to_str_ext(si->status, &NT_errors_ext, "Unknown (0x%08X)")); |
12812 | 0 | } |
12813 | 0 | offset += 4; |
12814 | 0 | } else { |
12815 | 0 | si->status = 0; |
12816 | 0 | proto_tree_add_item(header_tree, hf_smb2_channel_sequence, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
12817 | 0 | offset += 2; |
12818 | 0 | proto_tree_add_item(header_tree, hf_smb2_reserved, tvb, offset, 2, ENC_NA); |
12819 | 0 | offset += 2; |
12820 | 0 | } |
12821 | | |
12822 | | /* opcode */ |
12823 | 0 | si->opcode = tvb_get_letohs(tvb, offset); |
12824 | 0 | proto_tree_add_item(header_tree, hf_smb2_cmd, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
12825 | 0 | proto_item_append_text(item, ", %s %s", |
12826 | 0 | decode_smb2_name(si->opcode), |
12827 | 0 | si->flags & SMB2_FLAGS_RESPONSE ? "Response" : "Request"); |
12828 | 0 | offset += 2; |
12829 | | |
12830 | | /* credits */ |
12831 | 0 | if (si->flags & SMB2_FLAGS_RESPONSE) { |
12832 | 0 | proto_tree_add_item(header_tree, hf_smb2_credits_granted, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
12833 | 0 | } else { |
12834 | 0 | proto_tree_add_item(header_tree, hf_smb2_credits_requested, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
12835 | 0 | } |
12836 | 0 | offset += 2; |
12837 | | |
12838 | | /* flags */ |
12839 | 0 | if (header_tree) { |
12840 | 0 | static int * const flags[] = { |
12841 | 0 | &hf_smb2_flags_response, |
12842 | 0 | &hf_smb2_flags_async_cmd, |
12843 | 0 | &hf_smb2_flags_chained, |
12844 | 0 | &hf_smb2_flags_signature, |
12845 | 0 | &hf_smb2_flags_priority_mask, |
12846 | 0 | &hf_smb2_flags_dfs_op, |
12847 | 0 | &hf_smb2_flags_replay_operation, |
12848 | 0 | NULL |
12849 | 0 | }; |
12850 | |
|
12851 | 0 | proto_tree_add_bitmask(header_tree, tvb, offset, hf_smb2_flags, |
12852 | 0 | ett_smb2_flags, flags, ENC_LITTLE_ENDIAN); |
12853 | 0 | } |
12854 | |
|
12855 | 0 | offset += 4; |
12856 | | |
12857 | | /* Next Command */ |
12858 | 0 | chain_offset = tvb_get_letohl(tvb, offset); |
12859 | 0 | proto_tree_add_item(header_tree, hf_smb2_chain_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
12860 | 0 | offset += 4; |
12861 | | |
12862 | | /* Message ID */ |
12863 | 0 | si->msg_id = tvb_get_letoh64(tvb, offset); |
12864 | 0 | ssi_key.msg_id = si->msg_id; |
12865 | 0 | proto_tree_add_item(header_tree, hf_smb2_msg_id, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
12866 | 0 | proto_item_append_text(item, ", MessageId %" PRIu64, (uint64_t)si->msg_id); |
12867 | 0 | offset += 8; |
12868 | | |
12869 | | /* Tree ID and Session ID */ |
12870 | 0 | offset = dissect_smb2_tid_sesid(pinfo, header_tree, tvb, offset, si); |
12871 | | |
12872 | | /* Signature */ |
12873 | 0 | dissect_smb2_signature(pinfo, tvb, offset, header_tree, si); |
12874 | 0 | offset += 16; |
12875 | 0 | proto_item_set_len(header_item, offset); |
12876 | | |
12877 | | /* Check if this is a special packet type and it has non-regular title */ |
12878 | 0 | packet_title = get_special_packet_title(si->opcode, si->flags, si->msg_id, tvb, offset); |
12879 | 0 | if (packet_title) { |
12880 | 0 | col_append_str(pinfo->cinfo, COL_INFO, packet_title); |
12881 | 0 | } else { |
12882 | | /* Regular packets have standard title */ |
12883 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s %s", |
12884 | 0 | decode_smb2_name(si->opcode), |
12885 | 0 | (si->flags & SMB2_FLAGS_RESPONSE)?"Response":"Request"); |
12886 | 0 | } |
12887 | 0 | if (si->status) { |
12888 | 0 | col_append_fstr( |
12889 | 0 | pinfo->cinfo, COL_INFO, ", Error: %s", |
12890 | 0 | val_to_str_ext(si->status, &NT_errors_ext, |
12891 | 0 | "Unknown (0x%08X)")); |
12892 | 0 | } |
12893 | | |
12894 | |
|
12895 | 0 | if (!pinfo->fd->visited) { |
12896 | | /* see if we can find this msg_id in the unmatched table */ |
12897 | 0 | ssi = (smb2_saved_info_t *)g_hash_table_lookup(si->conv->unmatched, &ssi_key); |
12898 | |
|
12899 | 0 | if (!(si->flags & SMB2_FLAGS_RESPONSE)) { |
12900 | | /* This is a request */ |
12901 | 0 | if (ssi) { |
12902 | | /* this is a request and we already found |
12903 | | * an older ssi so just delete the previous |
12904 | | * one |
12905 | | */ |
12906 | 0 | g_hash_table_remove(si->conv->unmatched, ssi); |
12907 | 0 | ssi = NULL; |
12908 | 0 | } |
12909 | |
|
12910 | 0 | if (!ssi) { |
12911 | | /* no we couldn't find it, so just add it then |
12912 | | * if was a request we are decoding |
12913 | | */ |
12914 | 0 | ssi = wmem_new0(wmem_file_scope(), smb2_saved_info_t); |
12915 | 0 | ssi->msg_id = ssi_key.msg_id; |
12916 | 0 | ssi->frame_req = pinfo->num; |
12917 | 0 | ssi->frame_res = UINT32_MAX; |
12918 | 0 | ssi->req_time = pinfo->abs_ts; |
12919 | 0 | ssi->extra_info_type = SMB2_EI_NONE; |
12920 | 0 | g_hash_table_insert(si->conv->unmatched, ssi, ssi); |
12921 | 0 | } |
12922 | 0 | } else { |
12923 | | /* This is a response */ |
12924 | 0 | if (!((si->flags & SMB2_FLAGS_ASYNC_CMD) |
12925 | 0 | && si->status == NT_STATUS_PENDING) |
12926 | 0 | && ssi) { |
12927 | | /* just set the response frame and move it to the matched table */ |
12928 | 0 | ssi->frame_res = pinfo->num; |
12929 | 0 | ssi->resp_time = pinfo->abs_ts; |
12930 | 0 | g_hash_table_remove(si->conv->unmatched, ssi); |
12931 | 0 | g_hash_table_insert(si->conv->matched, ssi, ssi); |
12932 | 0 | } |
12933 | 0 | } |
12934 | 0 | } else { |
12935 | | /* see if we can find this msg_id in the matched table */ |
12936 | 0 | ssi = (smb2_saved_info_t *)g_hash_table_lookup(si->conv->matched, &ssi_key); |
12937 | | /* if we couldn't find it in the matched table, it might still |
12938 | | * be in the unmatched table |
12939 | | */ |
12940 | 0 | if (!ssi) { |
12941 | 0 | ssi = (smb2_saved_info_t *)g_hash_table_lookup(si->conv->unmatched, &ssi_key); |
12942 | 0 | } |
12943 | 0 | } |
12944 | |
|
12945 | 0 | if (ssi) { |
12946 | 0 | if (dcerpc_fetch_polhnd_data(&ssi->policy_hnd, &fid_name, NULL, &open_frame, &close_frame, pinfo->num)) { |
12947 | | /* If needed, create the file entry and save the policy hnd */ |
12948 | 0 | if (!si->eo_file_info) { |
12949 | 0 | if (si->conv) { |
12950 | 0 | eo_file_info = (smb2_eo_file_info_t *)wmem_map_lookup(si->session->files,&ssi->policy_hnd); |
12951 | 0 | if (!eo_file_info) { /* XXX This should never happen */ |
12952 | | /* assert(1==0); */ |
12953 | 0 | eo_file_info = wmem_new(wmem_file_scope(), smb2_eo_file_info_t); |
12954 | 0 | policy_hnd_hashtablekey = wmem_new(wmem_file_scope(), e_ctx_hnd); |
12955 | 0 | memcpy(policy_hnd_hashtablekey, &ssi->policy_hnd, sizeof(e_ctx_hnd)); |
12956 | 0 | eo_file_info->end_of_file=0; |
12957 | 0 | wmem_map_insert(si->session->files,policy_hnd_hashtablekey,eo_file_info); |
12958 | 0 | } |
12959 | 0 | si->eo_file_info=eo_file_info; |
12960 | 0 | } |
12961 | 0 | } |
12962 | |
|
12963 | 0 | } |
12964 | |
|
12965 | 0 | if (!(si->flags & SMB2_FLAGS_RESPONSE)) { |
12966 | 0 | if (ssi->frame_res != UINT32_MAX) { |
12967 | 0 | proto_item *tmp_item; |
12968 | 0 | nstime_t deltat; |
12969 | |
|
12970 | 0 | tmp_item = proto_tree_add_uint(header_tree, hf_smb2_response_in, tvb, 0, 0, |
12971 | 0 | ssi->frame_res); |
12972 | 0 | proto_item_set_generated(tmp_item); |
12973 | |
|
12974 | 0 | nstime_delta(&deltat, &ssi->resp_time, &pinfo->abs_ts); |
12975 | 0 | tmp_item = proto_tree_add_time(header_tree, hf_smb2_time_req, tvb, |
12976 | 0 | 0, 0, &deltat); |
12977 | 0 | proto_item_set_generated(tmp_item); |
12978 | 0 | } |
12979 | 0 | } else { |
12980 | 0 | if (ssi->frame_req != UINT32_MAX) { |
12981 | 0 | proto_item *tmp_item; |
12982 | 0 | nstime_t t, deltat; |
12983 | |
|
12984 | 0 | tmp_item = proto_tree_add_uint(header_tree, hf_smb2_response_to, tvb, 0, 0, |
12985 | 0 | ssi->frame_req); |
12986 | 0 | proto_item_set_generated(tmp_item); |
12987 | 0 | t = pinfo->abs_ts; |
12988 | 0 | nstime_delta(&deltat, &t, &ssi->req_time); |
12989 | 0 | tmp_item = proto_tree_add_time(header_tree, hf_smb2_time_resp, tvb, |
12990 | 0 | 0, 0, &deltat); |
12991 | 0 | proto_item_set_generated(tmp_item); |
12992 | 0 | } |
12993 | 0 | } |
12994 | 0 | if (si->file != NULL) { |
12995 | 0 | ssi->file = si->file; |
12996 | 0 | } else { |
12997 | 0 | si->file = ssi->file; |
12998 | 0 | } |
12999 | 0 | } |
13000 | | /* if we don't have ssi yet we must fake it */ |
13001 | | /*qqq*/ |
13002 | 0 | si->saved = ssi; |
13003 | |
|
13004 | 0 | tap_queue_packet(smb2_tap, pinfo, si); |
13005 | | |
13006 | | /* Decode the payload */ |
13007 | 0 | offset = dissect_smb2_command(pinfo, tree, tvb, offset, si); |
13008 | 0 | } else if (msg_type == SMB2_ENCR_HEADER) { |
13009 | 0 | proto_tree *enc_tree; |
13010 | 0 | tvbuff_t *enc_tvb = NULL; |
13011 | 0 | tvbuff_t *plain_tvb = NULL; |
13012 | | |
13013 | | /* SMB2_TRANSFORM marker */ |
13014 | 0 | proto_tree_add_item(header_tree, hf_smb2_protocol_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
13015 | 0 | offset += 4; |
13016 | |
|
13017 | 0 | offset = dissect_smb2_transform_header(pinfo, header_tree, tvb, offset, sti, |
13018 | 0 | &enc_tvb, &plain_tvb); |
13019 | |
|
13020 | 0 | enc_tree = proto_tree_add_subtree(tree, enc_tvb, 0, sti->size, ett_smb2_encrypted, NULL, "Encrypted SMB3 data"); |
13021 | 0 | if (plain_tvb != NULL) { |
13022 | 0 | col_append_str(pinfo->cinfo, COL_INFO, "Decrypted SMB3"); |
13023 | 0 | dissect_smb2(plain_tvb, pinfo, enc_tree, false); |
13024 | 0 | } else { |
13025 | 0 | col_append_str(pinfo->cinfo, COL_INFO, "Encrypted SMB3"); |
13026 | 0 | proto_tree_add_item(enc_tree, hf_smb2_transform_encrypted_data, |
13027 | 0 | enc_tvb, 0, sti->size, ENC_NA); |
13028 | 0 | } |
13029 | |
|
13030 | 0 | if (tvb_reported_length_remaining(tvb, offset) > 0) { |
13031 | 0 | chain_offset = offset; |
13032 | 0 | } |
13033 | 0 | } else if (msg_type == SMB2_COMP_HEADER) { |
13034 | 0 | proto_tree *comp_tree; |
13035 | 0 | proto_item *decomp_item; |
13036 | 0 | tvbuff_t *plain_tvb = NULL; |
13037 | 0 | tvbuff_t *comp_tvb = NULL; |
13038 | |
|
13039 | 0 | offset = dissect_smb2_comp_transform_header(pinfo, header_tree, tvb, offset, |
13040 | 0 | scti, &comp_tvb, &plain_tvb); |
13041 | |
|
13042 | 0 | comp_tree = proto_tree_add_subtree(header_tree, tvb, offset, |
13043 | 0 | tvb_reported_length_remaining(tvb, offset), |
13044 | 0 | ett_smb2_compressed, NULL, |
13045 | 0 | "Compressed SMB3 data"); |
13046 | 0 | proto_tree_add_item(comp_tree, hf_smb2_comp_transform_data, |
13047 | 0 | tvb, offset, |
13048 | 0 | tvb_reported_length_remaining(tvb, offset), |
13049 | 0 | ENC_NA); |
13050 | |
|
13051 | 0 | if (plain_tvb) { |
13052 | 0 | proto_tree *decomp_tree; |
13053 | |
|
13054 | 0 | decomp_tree = proto_tree_add_subtree(header_tree, plain_tvb, 0, |
13055 | 0 | tvb_reported_length_remaining(plain_tvb, 0), |
13056 | 0 | ett_smb2_decompressed, &decomp_item, |
13057 | 0 | "Decompressed SMB3 data"); |
13058 | 0 | proto_item_set_generated(decomp_item); |
13059 | 0 | dissect_smb2(plain_tvb, pinfo, decomp_tree, false); |
13060 | 0 | } |
13061 | |
|
13062 | 0 | offset += tvb_reported_length_remaining(tvb, offset); |
13063 | 0 | } else { |
13064 | 0 | col_append_str(pinfo->cinfo, COL_INFO, "Invalid header"); |
13065 | | |
13066 | | /* bad packet after decompressing/decrypting */ |
13067 | 0 | offset += tvb_reported_length_remaining(tvb, offset); |
13068 | 0 | } |
13069 | |
|
13070 | 0 | if (chain_offset > 0) { |
13071 | 0 | tvbuff_t *next_tvb; |
13072 | |
|
13073 | 0 | proto_item_set_len(item, chain_offset); |
13074 | |
|
13075 | 0 | next_tvb = tvb_new_subset_remaining(tvb, chain_offset); |
13076 | 0 | offset = dissect_smb2(next_tvb, pinfo, parent_tree, false); |
13077 | 0 | } |
13078 | |
|
13079 | 0 | decrement_dissection_depth(pinfo); |
13080 | 0 | return offset; |
13081 | 0 | } |
13082 | | |
13083 | | static bool |
13084 | | dissect_smb2_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_) |
13085 | 271 | { |
13086 | 271 | uint8_t b; |
13087 | | |
13088 | | /* must check that this really is a smb2 packet */ |
13089 | 271 | if (tvb_captured_length(tvb) < 4) |
13090 | 222 | return false; |
13091 | | |
13092 | 49 | b = tvb_get_uint8(tvb, 0); |
13093 | 49 | if (((b != SMB2_COMP_HEADER) && (b != SMB2_ENCR_HEADER) && (b != SMB2_NORM_HEADER)) |
13094 | 49 | || (tvb_get_uint8(tvb, 1) != 'S') |
13095 | 49 | || (tvb_get_uint8(tvb, 2) != 'M') |
13096 | 49 | || (tvb_get_uint8(tvb, 3) != 'B') ) { |
13097 | 49 | return false; |
13098 | 49 | } |
13099 | | |
13100 | 0 | dissect_smb2(tvb, pinfo, parent_tree, true); |
13101 | |
|
13102 | 0 | return true; |
13103 | 49 | } |
13104 | | |
13105 | | void |
13106 | | proto_register_smb2(void) |
13107 | 14 | { |
13108 | 14 | module_t *smb2_module; |
13109 | 14 | static hf_register_info hf[] = { |
13110 | 14 | { &hf_smb2_cmd, |
13111 | 14 | { "Command", "smb2.cmd", FT_UINT16, BASE_DEC | BASE_EXT_STRING, |
13112 | 14 | &smb2_cmd_vals_ext, 0, "SMB2 Command Opcode", HFILL } |
13113 | 14 | }, |
13114 | | |
13115 | 14 | { &hf_smb2_response_to, |
13116 | 14 | { "Response to", "smb2.response_to", FT_FRAMENUM, BASE_NONE, |
13117 | 14 | FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0, "This packet is a response to the packet in this frame", HFILL } |
13118 | 14 | }, |
13119 | | |
13120 | 14 | { &hf_smb2_response_in, |
13121 | 14 | { "Response in", "smb2.response_in", FT_FRAMENUM, BASE_NONE, |
13122 | 14 | FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0, "The response to this packet is in this packet", HFILL } |
13123 | 14 | }, |
13124 | | |
13125 | 14 | { &hf_smb2_time_req, |
13126 | 14 | { "Time to response", "smb2.time", FT_RELATIVE_TIME, BASE_NONE, |
13127 | 14 | NULL, 0, "Time between Request and Response for SMB2 cmds", HFILL } |
13128 | 14 | }, |
13129 | | |
13130 | 14 | { &hf_smb2_time_resp, |
13131 | 14 | { "Time from request", "smb2.time", FT_RELATIVE_TIME, BASE_NONE, |
13132 | 14 | NULL, 0, "Time between Request and Response for SMB2 cmds", HFILL } |
13133 | 14 | }, |
13134 | | |
13135 | 14 | { &hf_smb2_preauth_hash, |
13136 | 14 | { "Preauth Hash", "smb2.preauth_hash", FT_BYTES, BASE_NONE, |
13137 | 14 | NULL, 0, "SMB3.1.1 pre-authentication SHA512 hash after hashing the packet", HFILL } |
13138 | 14 | }, |
13139 | | |
13140 | 14 | { &hf_smb2_header_len, |
13141 | 14 | { "Header Length", "smb2.header_len", FT_UINT16, BASE_DEC, |
13142 | 14 | NULL, 0, "SMB2 Size of Header", HFILL } |
13143 | 14 | }, |
13144 | | |
13145 | 14 | { &hf_smb2_nt_status, |
13146 | 14 | { "NT Status", "smb2.nt_status", FT_UINT32, BASE_HEX | BASE_EXT_STRING, |
13147 | 14 | &NT_errors_ext, 0, "NT Status code", HFILL } |
13148 | 14 | }, |
13149 | | |
13150 | 14 | { &hf_smb2_msg_id, |
13151 | 14 | { "Message ID", "smb2.msg_id", FT_UINT64, BASE_DEC|BASE_VAL64_STRING|BASE_SPECIAL_VALS, |
13152 | 14 | VALS64(unique_unsolicited_response), 0, NULL, HFILL } |
13153 | 14 | }, |
13154 | | |
13155 | 14 | { &hf_smb2_tid, |
13156 | 14 | { "Tree Id", "smb2.tid", FT_UINT32, BASE_HEX, |
13157 | 14 | NULL, 0, NULL, HFILL } |
13158 | 14 | }, |
13159 | | |
13160 | 14 | { &hf_smb2_aid, |
13161 | 14 | { "Async Id", "smb2.aid", FT_UINT64, BASE_HEX, |
13162 | 14 | NULL, 0, NULL, HFILL } |
13163 | 14 | }, |
13164 | | |
13165 | 14 | { &hf_smb2_sesid, |
13166 | 14 | { "Session Id", "smb2.sesid", FT_UINT64, BASE_HEX, |
13167 | 14 | NULL, 0, NULL, HFILL } |
13168 | 14 | }, |
13169 | | |
13170 | 14 | { &hf_smb2_previous_sesid, |
13171 | 14 | { "Previous Session Id", "smb2.previous_sesid", FT_UINT64, BASE_HEX, |
13172 | 14 | NULL, 0, NULL, HFILL } |
13173 | 14 | }, |
13174 | | |
13175 | 14 | { &hf_smb2_chain_offset, |
13176 | 14 | { "Chain Offset", "smb2.chain_offset", FT_UINT32, BASE_HEX, |
13177 | 14 | NULL, 0, NULL, HFILL } |
13178 | 14 | }, |
13179 | | |
13180 | 14 | { &hf_smb2_end_of_file, |
13181 | 14 | { "End Of File", "smb2.eof", FT_UINT64, BASE_DEC, |
13182 | 14 | NULL, 0, "SMB2 End Of File/File size", HFILL } |
13183 | 14 | }, |
13184 | | |
13185 | 14 | { &hf_smb2_nlinks, |
13186 | 14 | { "Number of Links", "smb2.nlinks", FT_UINT32, BASE_DEC, |
13187 | 14 | NULL, 0, "Number of links to this object", HFILL } |
13188 | 14 | }, |
13189 | | |
13190 | 14 | { &hf_smb2_file_id, |
13191 | 14 | { "File Id", "smb2.file_id", FT_UINT64, BASE_HEX, |
13192 | 14 | NULL, 0, NULL, HFILL } |
13193 | 14 | }, |
13194 | | |
13195 | 14 | { &hf_smb2_allocation_size, |
13196 | 14 | { "Allocation Size", "smb2.allocation_size", FT_UINT64, BASE_DEC, |
13197 | 14 | NULL, 0, NULL, HFILL } |
13198 | 14 | }, |
13199 | | |
13200 | 14 | { &hf_smb2_max_response_size, |
13201 | 14 | { "Max Response Size", "smb2.max_response_size", FT_UINT32, BASE_DEC, |
13202 | 14 | NULL, 0, NULL, HFILL } |
13203 | 14 | }, |
13204 | | |
13205 | 14 | { &hf_smb2_getinfo_input_size, |
13206 | 14 | { "Getinfo Input Size", "smb2.getinfo_input_size", FT_UINT32, BASE_DEC, |
13207 | 14 | NULL, 0, NULL, HFILL } |
13208 | 14 | }, |
13209 | | |
13210 | 14 | { &hf_smb2_getinfo_input_offset, |
13211 | 14 | { "Getinfo Input Offset", "smb2.getinfo_input_offset", FT_UINT16, BASE_HEX, |
13212 | 14 | NULL, 0, NULL, HFILL } |
13213 | 14 | }, |
13214 | | |
13215 | 14 | { &hf_smb2_getsetinfo_additional, |
13216 | 14 | { "Additional Info", "smb2.getsetinfo_additional", FT_UINT32, BASE_HEX, |
13217 | 14 | NULL, 0, NULL, HFILL } |
13218 | 14 | }, |
13219 | | |
13220 | 14 | { &hf_smb2_getsetinfo_additionals, |
13221 | 14 | { "Additional Info", "smb2.getsetinfo_additionals", FT_UINT32, BASE_HEX, |
13222 | 14 | NULL, 0, NULL, HFILL } |
13223 | 14 | }, |
13224 | | |
13225 | 14 | { &hf_smb2_getsetinfo_additional_owner, |
13226 | 14 | { "Owner", "smb2.getsetinfo_additional_secinfo.owner", FT_BOOLEAN, 32, |
13227 | 14 | TFS(&tfs_additional_owner), OWNER_SECURITY_INFORMATION, "Is owner security information being queried?", HFILL }}, |
13228 | | |
13229 | 14 | { &hf_smb2_getsetinfo_additional_group, |
13230 | 14 | { "Group", "smb2.getsetinfo_additional_secinfo.group", FT_BOOLEAN, 32, |
13231 | 14 | TFS(&tfs_additional_group), GROUP_SECURITY_INFORMATION, "Is group security information being queried?", HFILL }}, |
13232 | | |
13233 | 14 | { &hf_smb2_getsetinfo_additional_dacl, |
13234 | 14 | { "DACL", "smb2.getsetinfo_additional_secinfo.dacl", FT_BOOLEAN, 32, |
13235 | 14 | TFS(&tfs_additional_dacl), DACL_SECURITY_INFORMATION, "Is DACL security information being queried?", HFILL }}, |
13236 | | |
13237 | 14 | { &hf_smb2_getsetinfo_additional_sacl, |
13238 | 14 | { "SACL", "smb2.getsetinfo_additional_secinfo.sacl", FT_BOOLEAN, 32, |
13239 | 14 | TFS(&tfs_additional_sacl), SACL_SECURITY_INFORMATION, "Is SACL security information being queried?", HFILL }}, |
13240 | | |
13241 | 14 | { &hf_smb2_getsetinfo_additional_label, |
13242 | 14 | { "Integrity label", "smb2.getsetinfo_additional_secinfo.label", FT_BOOLEAN, 32, |
13243 | 14 | TFS(&tfs_additional_label), LABEL_SECURITY_INFORMATION, "Is integrity label security information being queried?", HFILL }}, |
13244 | | |
13245 | 14 | { &hf_smb2_getsetinfo_additional_attribute, |
13246 | 14 | { "Resource attribute", "smb2.getsetinfo_additional_secinfo.attribute", FT_BOOLEAN, 32, |
13247 | 14 | TFS(&tfs_additional_attribute), ATTRIBUTE_SECURITY_INFORMATION, "Is resource attribute security information being queried?", HFILL }}, |
13248 | | |
13249 | 14 | { &hf_smb2_getsetinfo_additional_scope, |
13250 | 14 | { "Central access policy", "smb2.getsetinfo_additional_secinfo.scope", FT_BOOLEAN, 32, |
13251 | 14 | TFS(&tfs_additional_scope), SCOPE_SECURITY_INFORMATION, "Is central access policy security information being queried?", HFILL }}, |
13252 | | |
13253 | 14 | { &hf_smb2_getsetinfo_additional_backup, |
13254 | 14 | { "Backup operation", "smb2.getsetinfo_additional_secinfo.backup", FT_BOOLEAN, 32, |
13255 | 14 | TFS(&tfs_additional_backup), BACKUP_SECURITY_INFORMATION, "Is backup operation security information being queried?", HFILL }}, |
13256 | | |
13257 | 14 | { &hf_smb2_getinfo_flags, |
13258 | 14 | { "Flags", "smb2.getinfo_flags", FT_UINT32, BASE_HEX, |
13259 | 14 | NULL, 0, NULL, HFILL } |
13260 | 14 | }, |
13261 | | |
13262 | 14 | { &hf_smb2_setinfo_size, |
13263 | 14 | { "Setinfo Size", "smb2.setinfo_size", FT_UINT32, BASE_DEC, |
13264 | 14 | NULL, 0, NULL, HFILL } |
13265 | 14 | }, |
13266 | | |
13267 | 14 | { &hf_smb2_setinfo_offset, |
13268 | 14 | { "Setinfo Offset", "smb2.setinfo_offset", FT_UINT16, BASE_HEX, |
13269 | 14 | NULL, 0, NULL, HFILL } |
13270 | 14 | }, |
13271 | | |
13272 | 14 | { &hf_smb2_setinfo_reserved, |
13273 | 14 | { "Reserved", "smb2.setinfo_reserved", FT_UINT16, BASE_DEC, |
13274 | 14 | NULL, 0, NULL, HFILL } |
13275 | 14 | }, |
13276 | | |
13277 | 14 | { &hf_smb2_max_ioctl_out_size, |
13278 | 14 | { "Max Ioctl Out Size", "smb2.max_ioctl_out_size", FT_UINT32, BASE_DEC, |
13279 | 14 | NULL, 0, NULL, HFILL } |
13280 | 14 | }, |
13281 | | |
13282 | 14 | { &hf_smb2_max_ioctl_in_size, |
13283 | 14 | { "Max Ioctl In Size", "smb2.max_ioctl_in_size", FT_UINT32, BASE_DEC, |
13284 | 14 | NULL, 0, NULL, HFILL } |
13285 | 14 | }, |
13286 | | |
13287 | 14 | { &hf_smb2_required_buffer_size, |
13288 | 14 | { "Required Buffer Size", "smb2.required_size", FT_UINT32, BASE_DEC, |
13289 | 14 | NULL, 0, NULL, HFILL } |
13290 | 14 | }, |
13291 | | |
13292 | 14 | { &hf_smb2_header_reserved, |
13293 | 14 | { "Reserved", "smb2.header_reserved", FT_UINT32, BASE_HEX, |
13294 | 14 | NULL, 0, NULL, HFILL } |
13295 | 14 | }, |
13296 | | |
13297 | | |
13298 | | /* SMB2 header flags */ |
13299 | 14 | { &hf_smb2_flags, |
13300 | 14 | { "Flags", "smb2.flags", FT_UINT32, BASE_HEX, |
13301 | 14 | NULL, 0, "SMB2 flags", HFILL } |
13302 | 14 | }, |
13303 | | |
13304 | 14 | { &hf_smb2_flags_response, |
13305 | 14 | { "Response", "smb2.flags.response", FT_BOOLEAN, 32, |
13306 | 14 | TFS(&tfs_flags_response), SMB2_FLAGS_RESPONSE, "Whether this is an SMB2 Request or Response", HFILL } |
13307 | 14 | }, |
13308 | | |
13309 | 14 | { &hf_smb2_flags_async_cmd, |
13310 | 14 | { "Async command", "smb2.flags.async", FT_BOOLEAN, 32, |
13311 | 14 | TFS(&tfs_flags_async_cmd), SMB2_FLAGS_ASYNC_CMD, NULL, HFILL } |
13312 | 14 | }, |
13313 | | |
13314 | 14 | { &hf_smb2_flags_dfs_op, |
13315 | 14 | { "DFS operation", "smb2.flags.dfs", FT_BOOLEAN, 32, |
13316 | 14 | TFS(&tfs_flags_dfs_op), SMB2_FLAGS_DFS_OP, NULL, HFILL } |
13317 | 14 | }, |
13318 | | |
13319 | 14 | { &hf_smb2_flags_chained, |
13320 | 14 | { "Chained", "smb2.flags.chained", FT_BOOLEAN, 32, |
13321 | 14 | TFS(&tfs_flags_chained), SMB2_FLAGS_CHAINED, "Whether the pdu continues a chain or not", HFILL } |
13322 | 14 | }, |
13323 | 14 | { &hf_smb2_flags_signature, |
13324 | 14 | { "Signing", "smb2.flags.signature", FT_BOOLEAN, 32, |
13325 | 14 | TFS(&tfs_flags_signature), SMB2_FLAGS_SIGNATURE, "Whether the pdu is signed or not", HFILL } |
13326 | 14 | }, |
13327 | | |
13328 | 14 | { &hf_smb2_flags_replay_operation, |
13329 | 14 | { "Replay operation", "smb2.flags.replay", FT_BOOLEAN, 32, |
13330 | 14 | TFS(&tfs_flags_replay_operation), SMB2_FLAGS_REPLAY_OPERATION, "Whether this is a replay operation", HFILL } |
13331 | 14 | }, |
13332 | | |
13333 | 14 | { &hf_smb2_flags_priority_mask, |
13334 | 14 | { "Priority", "smb2.flags.priority_mask", FT_BOOLEAN, 32, |
13335 | 14 | TFS(&tfs_flags_priority_mask), SMB2_FLAGS_PRIORITY_MASK, "Priority Mask", HFILL } |
13336 | 14 | }, |
13337 | | |
13338 | 14 | { &hf_smb2_tree, |
13339 | 14 | { "Tree", "smb2.tree", FT_STRING, BASE_NONE, |
13340 | 14 | NULL, 0, "Name of the Tree/Share", HFILL } |
13341 | 14 | }, |
13342 | | |
13343 | 14 | { &hf_smb2_blobs, |
13344 | 14 | { "Blobs", "smb2.blobs", FT_STRING, BASE_NONE, |
13345 | 14 | NULL, 0, NULL, HFILL } |
13346 | 14 | }, |
13347 | | |
13348 | 14 | { &hf_smb2_filename, |
13349 | 14 | { "Filename", "smb2.filename", FT_STRING, BASE_NONE, |
13350 | 14 | NULL, 0, NULL, HFILL } |
13351 | 14 | }, |
13352 | | |
13353 | 14 | { &hf_smb2_filename_len, |
13354 | 14 | { "Filename Length", "smb2.filename.len", FT_UINT32, BASE_DEC, |
13355 | 14 | NULL, 0, NULL, HFILL } |
13356 | 14 | }, |
13357 | | |
13358 | 14 | { &hf_frame_handle_opened, |
13359 | 14 | { "Frame handle opened", "smb2.frame_handle_opened", FT_FRAMENUM, BASE_NONE, |
13360 | 14 | FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0, "File opened in", HFILL } |
13361 | 14 | }, |
13362 | | |
13363 | 14 | { &hf_frame_handle_closed, |
13364 | 14 | { "Frame handle closed", "smb2.frame_handle_closed", FT_FRAMENUM, BASE_NONE, |
13365 | 14 | FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0, "File closed in", HFILL } |
13366 | 14 | }, |
13367 | | |
13368 | 14 | { &hf_smb2_file_id_hash, |
13369 | 14 | { "FileId Hash", "smb2.fid_hash", FT_UINT32, BASE_HEX, |
13370 | 14 | NULL, 0, "Used to find all instances of a File ID", HFILL } |
13371 | 14 | }, |
13372 | | |
13373 | 14 | { &hf_smb2_num_matched, |
13374 | 14 | { "Matched pattern", "smb2.num_matched", FT_UINT16, BASE_DEC, |
13375 | 14 | NULL, 0, "Number of files matching the find pattern", HFILL } |
13376 | 14 | }, |
13377 | | |
13378 | 14 | { &hf_smb2_replace_if, |
13379 | 14 | { "Replace If", "smb2.rename.replace_if", FT_BOOLEAN, 8, |
13380 | 14 | TFS(&tfs_replace_if_exists), 0xFF, "Whether to replace if the target exists", HFILL } |
13381 | 14 | }, |
13382 | | |
13383 | 14 | { &hf_smb2_data_offset, |
13384 | 14 | { "Data Offset", "smb2.data_offset", FT_UINT16, BASE_HEX, |
13385 | 14 | NULL, 0, "Offset to data", HFILL } |
13386 | 14 | }, |
13387 | | |
13388 | 14 | { &hf_smb2_find_info_level, |
13389 | 14 | { "Info Level", "smb2.find.infolevel", FT_UINT32, BASE_DEC, |
13390 | 14 | VALS(smb2_find_info_levels), 0, "Find_Info Infolevel", HFILL } |
13391 | 14 | }, |
13392 | | |
13393 | 14 | { &hf_smb2_find_flags, |
13394 | 14 | { "Find Flags", "smb2.find.flags", FT_UINT8, BASE_HEX, |
13395 | 14 | NULL, 0, NULL, HFILL } |
13396 | 14 | }, |
13397 | | |
13398 | 14 | { &hf_smb2_find_pattern, |
13399 | 14 | { "Search Pattern", "smb2.find.pattern", FT_STRING, BASE_NONE, |
13400 | 14 | NULL, 0, "Find pattern", HFILL } |
13401 | 14 | }, |
13402 | | |
13403 | 14 | { &hf_smb2_find_info_blob, |
13404 | 14 | { "Info", "smb2.find.info_blob", FT_BYTES, BASE_NONE, |
13405 | 14 | NULL, 0, "Find Info", HFILL } |
13406 | 14 | }, |
13407 | | |
13408 | 14 | { &hf_smb2_ea_size, |
13409 | 14 | { "EA Size", "smb2.ea_size", FT_UINT32, BASE_DEC, |
13410 | 14 | NULL, 0, "Size of EA data", HFILL } |
13411 | 14 | }, |
13412 | | |
13413 | 14 | { &hf_smb2_position_information, |
13414 | 14 | { "Position Information", "smb2.position_info", FT_UINT64, BASE_DEC, |
13415 | 14 | NULL, 0, "Current file position", HFILL } |
13416 | 14 | }, |
13417 | | |
13418 | 14 | { &hf_smb2_mode_information, |
13419 | 14 | { "Mode Information", "smb2.mode_info", FT_UINT32, BASE_HEX, |
13420 | 14 | NULL, 0, "File mode information", HFILL } |
13421 | 14 | }, |
13422 | | |
13423 | 14 | { &hf_smb2_mode_file_write_through, |
13424 | 14 | { "FILE_WRITE_THROUGH", "smb2.mode.file_write_through", FT_UINT32, BASE_HEX, |
13425 | 14 | NULL, 0x02, NULL, HFILL } |
13426 | 14 | }, |
13427 | | |
13428 | 14 | { &hf_smb2_mode_file_sequential_only, |
13429 | 14 | { "FILE_SEQUENTIAL_ONLY", "smb2.mode.file_sequential_only", FT_UINT32, BASE_HEX, |
13430 | 14 | NULL, 0x04, NULL, HFILL } |
13431 | 14 | }, |
13432 | | |
13433 | 14 | { &hf_smb2_mode_file_no_intermediate_buffering, |
13434 | 14 | { "FILE_NO_INTERMEDIATE_BUFFERING", "smb2.mode.file_no_intermediate_buffering", FT_UINT32, BASE_HEX, |
13435 | 14 | NULL, 0x08, NULL, HFILL } |
13436 | 14 | }, |
13437 | | |
13438 | 14 | { &hf_smb2_mode_file_synchronous_io_alert, |
13439 | 14 | { "FILE_SYNCHRONOUS_IO_ALERT", "smb2.mode.file_synchronous_io_alert", FT_UINT32, BASE_HEX, |
13440 | 14 | NULL, 0x10, NULL, HFILL } |
13441 | 14 | }, |
13442 | | |
13443 | 14 | { &hf_smb2_mode_file_synchronous_io_nonalert, |
13444 | 14 | { "FILE_SYNCHRONOUS_IO_NONALERT", "smb2.mode.file_synchronous_io_nonalert", FT_UINT32, BASE_HEX, |
13445 | 14 | NULL, 0x20, NULL, HFILL } |
13446 | 14 | }, |
13447 | | |
13448 | 14 | { &hf_smb2_mode_file_delete_on_close, |
13449 | 14 | { "FILE_DELETE_ON_CLOSE", "smb2.mode.file_delete_on_close", FT_UINT32, BASE_HEX, |
13450 | 14 | NULL, 0x1000, NULL, HFILL } |
13451 | 14 | }, |
13452 | | |
13453 | 14 | { &hf_smb2_alignment_information, |
13454 | 14 | { "Alignment Information", "smb2.alignment_info", FT_UINT32, BASE_HEX, |
13455 | 14 | VALS(smb2_alignment_vals), 0, "File alignment", HFILL} |
13456 | 14 | }, |
13457 | | |
13458 | 14 | { &hf_smb2_class, |
13459 | 14 | { "Class", "smb2.class", FT_UINT8, BASE_HEX, |
13460 | 14 | VALS(smb2_class_vals), 0, "Info class", HFILL } |
13461 | 14 | }, |
13462 | | |
13463 | 14 | { &hf_smb2_infolevel, |
13464 | 14 | { "InfoLevel", "smb2.infolevel", FT_UINT8, BASE_HEX, |
13465 | 14 | NULL, 0, NULL, HFILL } |
13466 | 14 | }, |
13467 | | |
13468 | 14 | { &hf_smb2_infolevel_file_info, |
13469 | 14 | { "InfoLevel", "smb2.file_info.infolevel", FT_UINT8, BASE_HEX | BASE_EXT_STRING, |
13470 | 14 | &smb2_file_info_levels_ext, 0, "File_Info Infolevel", HFILL } |
13471 | 14 | }, |
13472 | | |
13473 | 14 | { &hf_smb2_infolevel_fs_info, |
13474 | 14 | { "InfoLevel", "smb2.fs_info.infolevel", FT_UINT8, BASE_HEX | BASE_EXT_STRING, |
13475 | 14 | &smb2_fs_info_levels_ext, 0, "Fs_Info Infolevel", HFILL } |
13476 | 14 | }, |
13477 | | |
13478 | 14 | { &hf_smb2_infolevel_sec_info, |
13479 | 14 | { "InfoLevel", "smb2.sec_info.infolevel", FT_UINT8, BASE_HEX | BASE_EXT_STRING, |
13480 | 14 | &smb2_sec_info_levels_ext, 0, "Sec_Info Infolevel", HFILL } |
13481 | 14 | }, |
13482 | | |
13483 | 14 | { &hf_smb2_write_length, |
13484 | 14 | { "Write Length", "smb2.write_length", FT_UINT32, BASE_DEC, |
13485 | 14 | NULL, 0, "Amount of data to write", HFILL } |
13486 | 14 | }, |
13487 | | |
13488 | 14 | { &hf_smb2_read_blob, |
13489 | 14 | { "Info", "smb2.read.blob", FT_BYTES, BASE_NONE, |
13490 | 14 | NULL, 0, "Read Blob", HFILL } |
13491 | 14 | }, |
13492 | | |
13493 | 14 | { &hf_smb2_read_length, |
13494 | 14 | { "Read Length", "smb2.read_length", FT_UINT32, BASE_DEC, |
13495 | 14 | NULL, 0, "Amount of data to read", HFILL } |
13496 | 14 | }, |
13497 | | |
13498 | 14 | { &hf_smb2_read_remaining, |
13499 | 14 | { "Read Remaining", "smb2.read_remaining", FT_UINT32, BASE_DEC, |
13500 | 14 | NULL, 0, NULL, HFILL } |
13501 | 14 | }, |
13502 | | |
13503 | 14 | { &hf_smb2_read_padding, |
13504 | 14 | { "Padding", "smb2.read_padding", FT_UINT8, BASE_HEX, |
13505 | 14 | NULL, 0, NULL, HFILL } |
13506 | 14 | }, |
13507 | | |
13508 | 14 | { &hf_smb2_read_flags, |
13509 | 14 | { "Flags", "smb2.read_flags", FT_UINT8, BASE_HEX, |
13510 | 14 | NULL, 0, NULL, HFILL } |
13511 | 14 | }, |
13512 | | |
13513 | 14 | { &hf_smb2_read_flags_unbuffered, |
13514 | 14 | { "Unbuffered", "smb2.read_flags.unbuffered", FT_BOOLEAN, 8, |
13515 | 14 | TFS(&tfs_read_unbuffered), SMB2_READFLAG_READ_UNBUFFERED, "If client requests unbuffered read", HFILL } |
13516 | 14 | }, |
13517 | | |
13518 | 14 | { &hf_smb2_read_flags_compressed, |
13519 | 14 | { "Compressed", "smb2.read_flags.compressed", FT_BOOLEAN, 8, |
13520 | 14 | TFS(&tfs_read_compressed), SMB2_READFLAG_READ_COMPRESSED, "If client requests compressed response", HFILL } |
13521 | 14 | }, |
13522 | | |
13523 | 14 | { &hf_smb2_create_flags, |
13524 | 14 | { "Create Flags", "smb2.create_flags", FT_UINT64, BASE_HEX, |
13525 | 14 | NULL, 0, NULL, HFILL } |
13526 | 14 | }, |
13527 | | |
13528 | 14 | { &hf_smb2_file_offset, |
13529 | 14 | { "File Offset", "smb2.file_offset", FT_UINT64, BASE_DEC, |
13530 | 14 | NULL, 0, NULL, HFILL } |
13531 | 14 | }, |
13532 | | |
13533 | 14 | { &hf_smb2_fsctl_range_offset, |
13534 | 14 | { "File Offset", "smb2.fsctl.range_offset", FT_UINT64, BASE_DEC, |
13535 | 14 | NULL, 0, NULL, HFILL } |
13536 | 14 | }, |
13537 | | |
13538 | 14 | { &hf_smb2_fsctl_range_length, |
13539 | 14 | { "Length", "smb2.fsctl.range_length", FT_UINT64, BASE_DEC, |
13540 | 14 | NULL, 0, NULL, HFILL } |
13541 | 14 | }, |
13542 | | |
13543 | 14 | { &hf_smb2_qfr_length, |
13544 | 14 | { "Length", "smb2.qfr_length", FT_UINT64, BASE_DEC, |
13545 | 14 | NULL, 0, NULL, HFILL } |
13546 | 14 | }, |
13547 | | |
13548 | 14 | { &hf_smb2_qfr_usage, |
13549 | 14 | { "Desired Usage", "smb2.qfr_usage", FT_UINT32, BASE_HEX, |
13550 | 14 | VALS(file_region_usage_vals), 0, NULL, HFILL } |
13551 | 14 | }, |
13552 | | |
13553 | 14 | { &hf_smb2_qfr_flags, |
13554 | 14 | { "Flags", "smb2.qfr_flags", FT_UINT32, BASE_HEX, |
13555 | 14 | NULL, 0, NULL, HFILL } |
13556 | 14 | }, |
13557 | | |
13558 | 14 | { &hf_smb2_qfr_total_region_entry_count, |
13559 | 14 | { "Total Region Entry Count", "smb2.qfr_tot_region_entry_count", FT_UINT32, BASE_HEX, |
13560 | 14 | NULL, 0, NULL, HFILL } |
13561 | 14 | }, |
13562 | | |
13563 | 14 | { &hf_smb2_qfr_region_entry_count, |
13564 | 14 | { "Region Entry Count", "smb2.qfr_region_entry_count", FT_UINT32, BASE_HEX, |
13565 | 14 | NULL, 0, NULL, HFILL } |
13566 | 14 | }, |
13567 | | |
13568 | 14 | { &hf_smb2_security_blob, |
13569 | 14 | { "Security Blob", "smb2.security_blob", FT_BYTES, BASE_NONE, |
13570 | 14 | NULL, 0, NULL, HFILL } |
13571 | 14 | }, |
13572 | | |
13573 | 14 | { &hf_smb2_ioctl_out_data, |
13574 | 14 | { "Out Data", "smb2.ioctl.out", FT_NONE, BASE_NONE, |
13575 | 14 | NULL, 0, "Ioctl Out", HFILL } |
13576 | 14 | }, |
13577 | | |
13578 | 14 | { &hf_smb2_ioctl_in_data, |
13579 | 14 | { "In Data", "smb2.ioctl.in", FT_NONE, BASE_NONE, |
13580 | 14 | NULL, 0, "Ioctl In", HFILL } |
13581 | 14 | }, |
13582 | | |
13583 | 14 | { &hf_smb2_server_guid, |
13584 | 14 | { "Server Guid", "smb2.server_guid", FT_GUID, BASE_NONE, |
13585 | 14 | NULL, 0, NULL, HFILL } |
13586 | 14 | }, |
13587 | | |
13588 | 14 | { &hf_smb2_client_guid, |
13589 | 14 | { "Client Guid", "smb2.client_guid", FT_GUID, BASE_NONE, |
13590 | 14 | NULL, 0, NULL, HFILL } |
13591 | 14 | }, |
13592 | | |
13593 | 14 | { &hf_smb2_object_id, |
13594 | 14 | { "ObjectId", "smb2.object_id", FT_GUID, BASE_NONE, |
13595 | 14 | NULL, 0, "ObjectID for this FID", HFILL } |
13596 | 14 | }, |
13597 | | |
13598 | 14 | { &hf_smb2_birth_volume_id, |
13599 | 14 | { "BirthVolumeId", "smb2.birth_volume_id", FT_GUID, BASE_NONE, |
13600 | 14 | NULL, 0, "ObjectID for the volume where this FID was originally created", HFILL } |
13601 | 14 | }, |
13602 | | |
13603 | 14 | { &hf_smb2_birth_object_id, |
13604 | 14 | { "BirthObjectId", "smb2.birth_object_id", FT_GUID, BASE_NONE, |
13605 | 14 | NULL, 0, "ObjectID for this FID when it was originally created", HFILL } |
13606 | 14 | }, |
13607 | | |
13608 | 14 | { &hf_smb2_domain_id, |
13609 | 14 | { "DomainId", "smb2.domain_id", FT_GUID, BASE_NONE, |
13610 | 14 | NULL, 0, NULL, HFILL } |
13611 | 14 | }, |
13612 | | |
13613 | 14 | { &hf_smb2_create_timestamp, |
13614 | 14 | { "Create", "smb2.create.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, |
13615 | 14 | NULL, 0, "Time when this object was created", HFILL } |
13616 | 14 | }, |
13617 | | |
13618 | 14 | { &hf_smb2_fid, |
13619 | 14 | { "File Id", "smb2.fid", FT_GUID, BASE_NONE, |
13620 | 14 | NULL, 0, "SMB2 File Id", HFILL } |
13621 | 14 | }, |
13622 | | |
13623 | 14 | { &hf_smb2_write_data, |
13624 | 14 | { "Write Data", "smb2.write_data", FT_BYTES, BASE_NONE, |
13625 | 14 | NULL, 0, "SMB2 Data to be written", HFILL } |
13626 | 14 | }, |
13627 | | |
13628 | 14 | { &hf_smb2_write_flags, |
13629 | 14 | { "Write Flags", "smb2.write.flags", FT_UINT32, BASE_HEX, |
13630 | 14 | NULL, 0, NULL, HFILL } |
13631 | 14 | }, |
13632 | | |
13633 | 14 | { &hf_smb2_write_flags_write_through, |
13634 | 14 | { "Write through", "smb2.write.flags.write_through", FT_BOOLEAN, 32, |
13635 | 14 | TFS(&tfs_write_through), SMB2_WRITE_FLAG_WRITE_THROUGH, "If the client requests WRITE_THROUGH", HFILL } |
13636 | 14 | }, |
13637 | | |
13638 | 14 | { &hf_smb2_write_flags_write_unbuffered, |
13639 | 14 | { "Unbuffered", "smb2.write.flags.unbuffered", FT_BOOLEAN, 32, |
13640 | 14 | TFS(&tfs_write_unbuffered), SMB2_WRITE_FLAG_WRITE_UNBUFFERED, "If client requests UNBUFFERED read", HFILL } |
13641 | 14 | }, |
13642 | | |
13643 | 14 | { &hf_smb2_write_count, |
13644 | 14 | { "Write Count", "smb2.write.count", FT_UINT32, BASE_DEC, |
13645 | 14 | NULL, 0, NULL, HFILL } |
13646 | 14 | }, |
13647 | | |
13648 | 14 | { &hf_smb2_write_remaining, |
13649 | 14 | { "Write Remaining", "smb2.write.remaining", FT_UINT32, BASE_DEC, |
13650 | 14 | NULL, 0, NULL, HFILL } |
13651 | 14 | }, |
13652 | | |
13653 | 14 | { &hf_smb2_read_data, |
13654 | 14 | { "Read Data", "smb2.read_data", FT_BYTES, BASE_NONE, |
13655 | 14 | NULL, 0, "SMB2 Data that is read", HFILL } |
13656 | 14 | }, |
13657 | | |
13658 | 14 | { &hf_smb2_last_access_timestamp, |
13659 | 14 | { "Last Access", "smb2.last_access.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, |
13660 | 14 | NULL, 0, "Time when this object was last accessed", HFILL } |
13661 | 14 | }, |
13662 | | |
13663 | 14 | { &hf_smb2_last_write_timestamp, |
13664 | 14 | { "Last Write", "smb2.last_write.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, |
13665 | 14 | NULL, 0, "Time when this object was last written to", HFILL } |
13666 | 14 | }, |
13667 | | |
13668 | 14 | { &hf_smb2_last_change_timestamp, |
13669 | 14 | { "Last Change", "smb2.last_change.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, |
13670 | 14 | NULL, 0, "Time when this object was last changed", HFILL } |
13671 | 14 | }, |
13672 | | |
13673 | 14 | { &hf_smb2_file_all_info, |
13674 | 14 | { "SMB2_FILE_ALL_INFO", "smb2.file_all_info", FT_NONE, BASE_NONE, |
13675 | 14 | NULL, 0, NULL, HFILL } |
13676 | 14 | }, |
13677 | | |
13678 | 14 | { &hf_smb2_file_allocation_info, |
13679 | 14 | { "SMB2_FILE_ALLOCATION_INFO", "smb2.file_allocation_info", FT_NONE, BASE_NONE, |
13680 | 14 | NULL, 0, NULL, HFILL } |
13681 | 14 | }, |
13682 | | |
13683 | 14 | { &hf_smb2_file_endoffile_info, |
13684 | 14 | { "SMB2_FILE_ENDOFFILE_INFO", "smb2.file_endoffile_info", FT_NONE, BASE_NONE, |
13685 | 14 | NULL, 0, NULL, HFILL } |
13686 | 14 | }, |
13687 | | |
13688 | 14 | { &hf_smb2_good_signature, |
13689 | 14 | { "Good signature", "smb2.good_signature", FT_NONE, BASE_NONE, |
13690 | 14 | NULL, 0, NULL, HFILL } |
13691 | 14 | }, |
13692 | | |
13693 | 14 | { &hf_smb2_bad_signature, |
13694 | 14 | { "Bad signature. Should be", "smb2.bad_signature", FT_NONE, BASE_NONE, |
13695 | 14 | NULL, 0, NULL, HFILL } |
13696 | 14 | }, |
13697 | | |
13698 | 14 | { &hf_smb2_file_alternate_name_info, |
13699 | 14 | { "SMB2_FILE_ALTERNATE_NAME_INFO", "smb2.file_alternate_name_info", FT_NONE, BASE_NONE, |
13700 | 14 | NULL, 0, NULL, HFILL } |
13701 | 14 | }, |
13702 | | |
13703 | 14 | { &hf_smb2_file_normalized_name_info, |
13704 | 14 | { "SMB2_FILE_NORMALIZED_NAME_INFO", "smb2.file_normalized_name_info", FT_NONE, BASE_NONE, |
13705 | 14 | NULL, 0, NULL, HFILL } |
13706 | 14 | }, |
13707 | | |
13708 | 14 | { &hf_smb2_file_stream_info, |
13709 | 14 | { "SMB2_FILE_STREAM_INFO", "smb2.file_stream_info", FT_NONE, BASE_NONE, |
13710 | 14 | NULL, 0, NULL, HFILL } |
13711 | 14 | }, |
13712 | | |
13713 | 14 | { &hf_smb2_file_pipe_info, |
13714 | 14 | { "SMB2_FILE_PIPE_INFO", "smb2.file_pipe_info", FT_NONE, BASE_NONE, |
13715 | 14 | NULL, 0, NULL, HFILL } |
13716 | 14 | }, |
13717 | | |
13718 | 14 | { &hf_smb2_file_pipe_local_info, |
13719 | 14 | { "SMB2_FILE_LOCAL_PIPE_INFO", "smb2.file_local_pipe_info", FT_NONE, BASE_NONE, |
13720 | 14 | NULL, 0, NULL, HFILL } |
13721 | 14 | }, |
13722 | 14 | { &hf_smb2_file_pipe_remote_info, |
13723 | 14 | { "SMB2_FILE_REMOTE_PIPE_INFO", "smb2.file_remote_pipe_info", FT_NONE, BASE_NONE, |
13724 | 14 | NULL, 0, NULL, HFILL } |
13725 | 14 | }, |
13726 | 14 | { &hf_smb2_file_compression_info, |
13727 | 14 | { "SMB2_FILE_COMPRESSION_INFO", "smb2.file_compression_info", FT_NONE, BASE_NONE, |
13728 | 14 | NULL, 0, NULL, HFILL } |
13729 | 14 | }, |
13730 | | |
13731 | 14 | { &hf_smb2_file_basic_info, |
13732 | 14 | { "SMB2_FILE_BASIC_INFO", "smb2.file_basic_info", FT_NONE, BASE_NONE, |
13733 | 14 | NULL, 0, NULL, HFILL } |
13734 | 14 | }, |
13735 | | |
13736 | 14 | { &hf_smb2_file_standard_info, |
13737 | 14 | { "SMB2_FILE_STANDARD_INFO", "smb2.file_standard_info", FT_NONE, BASE_NONE, |
13738 | 14 | NULL, 0, NULL, HFILL } |
13739 | 14 | }, |
13740 | | |
13741 | 14 | { &hf_smb2_file_internal_info, |
13742 | 14 | { "SMB2_FILE_INTERNAL_INFO", "smb2.file_internal_info", FT_NONE, BASE_NONE, |
13743 | 14 | NULL, 0, NULL, HFILL } |
13744 | 14 | }, |
13745 | | |
13746 | 14 | { &hf_smb2_file_mode_info, |
13747 | 14 | { "SMB2_FILE_MODE_INFO", "smb2.file_mode_info", FT_NONE, BASE_NONE, |
13748 | 14 | NULL, 0, NULL, HFILL } |
13749 | 14 | }, |
13750 | | |
13751 | 14 | { &hf_smb2_file_alignment_info, |
13752 | 14 | { "SMB2_FILE_ALIGNMENT_INFO", "smb2.file_alignment_info", FT_NONE, BASE_NONE, |
13753 | 14 | NULL, 0, NULL, HFILL } |
13754 | 14 | }, |
13755 | | |
13756 | 14 | { &hf_smb2_file_position_info, |
13757 | 14 | { "SMB2_FILE_POSITION_INFO", "smb2.file_position_info", FT_NONE, BASE_NONE, |
13758 | 14 | NULL, 0, NULL, HFILL } |
13759 | 14 | }, |
13760 | | |
13761 | 14 | { &hf_smb2_file_access_info, |
13762 | 14 | { "SMB2_FILE_ACCESS_INFO", "smb2.file_access_info", FT_NONE, BASE_NONE, |
13763 | 14 | NULL, 0, NULL, HFILL } |
13764 | 14 | }, |
13765 | | |
13766 | 14 | { &hf_smb2_file_ea_info, |
13767 | 14 | { "SMB2_FILE_EA_INFO", "smb2.file_ea_info", FT_NONE, BASE_NONE, |
13768 | 14 | NULL, 0, NULL, HFILL } |
13769 | 14 | }, |
13770 | | |
13771 | 14 | { &hf_smb2_file_network_open_info, |
13772 | 14 | { "SMB2_FILE_NETWORK_OPEN_INFO", "smb2.file_network_open_info", FT_NONE, BASE_NONE, |
13773 | 14 | NULL, 0, NULL, HFILL } |
13774 | 14 | }, |
13775 | | |
13776 | 14 | { &hf_smb2_file_attribute_tag_info, |
13777 | 14 | { "SMB2_FILE_ATTRIBUTE_TAG_INFO", "smb2.file_attribute_tag_info", FT_NONE, BASE_NONE, |
13778 | 14 | NULL, 0, NULL, HFILL } |
13779 | 14 | }, |
13780 | | |
13781 | 14 | { &hf_smb2_file_disposition_info, |
13782 | 14 | { "SMB2_FILE_DISPOSITION_INFO", "smb2.file_disposition_info", FT_NONE, BASE_NONE, |
13783 | 14 | NULL, 0, NULL, HFILL } |
13784 | 14 | }, |
13785 | | |
13786 | 14 | { &hf_smb2_file_full_ea_info, |
13787 | 14 | { "SMB2_FILE_FULL_EA_INFO", "smb2.file_full_ea_info", FT_NONE, BASE_NONE, |
13788 | 14 | NULL, 0, NULL, HFILL } |
13789 | 14 | }, |
13790 | | |
13791 | 14 | { &hf_smb2_file_rename_info, |
13792 | 14 | { "SMB2_FILE_RENAME_INFO", "smb2.file_rename_info", FT_NONE, BASE_NONE, |
13793 | 14 | NULL, 0, NULL, HFILL } |
13794 | 14 | }, |
13795 | | |
13796 | 14 | { &hf_smb2_file_link_info, |
13797 | 14 | { "SMB2_FILE_LINK_INFO", "smb2.file_link_info", FT_NONE, BASE_NONE, |
13798 | 14 | NULL, 0, NULL, HFILL } |
13799 | 14 | }, |
13800 | | |
13801 | 14 | { &hf_smb2_fs_info_01, |
13802 | 14 | { "FileFsVolumeInformation", "smb2.fs_volume_info", FT_NONE, BASE_NONE, |
13803 | 14 | NULL, 0, NULL, HFILL } |
13804 | 14 | }, |
13805 | | |
13806 | 14 | { &hf_smb2_fs_info_03, |
13807 | 14 | { "FileFsSizeInformation", "smb2.fs_size_info", FT_NONE, BASE_NONE, |
13808 | 14 | NULL, 0, NULL, HFILL } |
13809 | 14 | }, |
13810 | | |
13811 | 14 | { &hf_smb2_fs_info_04, |
13812 | 14 | { "FileFsDeviceInformation", "smb2.fs_device_info", FT_NONE, BASE_NONE, |
13813 | 14 | NULL, 0, NULL, HFILL } |
13814 | 14 | }, |
13815 | | |
13816 | 14 | { &hf_smb2_fs_info_05, |
13817 | 14 | { "FileFsAttributeInformation", "smb2.fs_attribute_info", FT_NONE, BASE_NONE, |
13818 | 14 | NULL, 0, NULL, HFILL } |
13819 | 14 | }, |
13820 | | |
13821 | 14 | { &hf_smb2_fs_info_06, |
13822 | 14 | { "FileFsControlInformation", "smb2.fs_control_info", FT_NONE, BASE_NONE, |
13823 | 14 | NULL, 0, NULL, HFILL } |
13824 | 14 | }, |
13825 | | |
13826 | 14 | { &hf_smb2_fs_info_07, |
13827 | 14 | { "FileFsFullSizeInformation", "smb2.fs_full_size_info", FT_NONE, BASE_NONE, |
13828 | 14 | NULL, 0, NULL, HFILL } |
13829 | 14 | }, |
13830 | | |
13831 | 14 | { &hf_smb2_fs_objectid_info, |
13832 | 14 | { "FileFsObjectIdInformation", "smb2.fs_objectid_info", FT_NONE, BASE_NONE, |
13833 | 14 | NULL, 0, NULL, HFILL } |
13834 | 14 | }, |
13835 | | |
13836 | 14 | { &hf_smb2_fs_posix_info, |
13837 | 14 | { "FileFsPOSIXInformation", "smb2.fs_posix_info", FT_NONE, BASE_NONE, |
13838 | 14 | NULL, 0, NULL, HFILL } |
13839 | 14 | }, |
13840 | | |
13841 | 14 | { &hf_smb2_fs_posix_optimal_transfer_size, |
13842 | 14 | { "Optimal Transfer Size", "smb2.fs_posix_optimal_transfer_size", FT_UINT32, BASE_DEC, |
13843 | 14 | NULL, 0, NULL, HFILL } |
13844 | 14 | }, |
13845 | | |
13846 | 14 | { &hf_smb2_fs_posix_block_size, |
13847 | 14 | { "Block Size", "smb2.fs_posix_block_size", FT_UINT32, BASE_DEC, |
13848 | 14 | NULL, 0, NULL, HFILL } |
13849 | 14 | }, |
13850 | | |
13851 | 14 | { &hf_smb2_fs_posix_total_blocks, |
13852 | 14 | { "Total Blocks", "smb2.fs_posix_total_blocks", FT_UINT64, BASE_DEC, |
13853 | 14 | NULL, 0, NULL, HFILL } |
13854 | 14 | }, |
13855 | | |
13856 | 14 | { &hf_smb2_fs_posix_blocks_available, |
13857 | 14 | { "Blocks Available", "smb2.fs_posix_blocks_available", FT_UINT64, BASE_DEC, |
13858 | 14 | NULL, 0, NULL, HFILL } |
13859 | 14 | }, |
13860 | | |
13861 | 14 | { &hf_smb2_fs_posix_user_blocks_available, |
13862 | 14 | { "User Blocks Available", "smb2.fs_posix_user_blocks_available", FT_UINT64, BASE_DEC, |
13863 | 14 | NULL, 0, NULL, HFILL } |
13864 | 14 | }, |
13865 | | |
13866 | 14 | { &hf_smb2_fs_posix_total_file_nodes, |
13867 | 14 | { "Total File Nodes", "smb2.fs_posix_total_file_nodes", FT_UINT64, BASE_DEC, |
13868 | 14 | NULL, 0, NULL, HFILL } |
13869 | 14 | }, |
13870 | | |
13871 | 14 | { &hf_smb2_fs_posix_free_file_nodes, |
13872 | 14 | { "Free File Nodes", "smb2.fs_posix_free_file_nodes", FT_UINT64, BASE_DEC, |
13873 | 14 | NULL, 0, NULL, HFILL } |
13874 | 14 | }, |
13875 | | |
13876 | 14 | { &hf_smb2_fs_posix_fs_identifier, |
13877 | 14 | { "Fs-Identifier", "smb2.fs_posix_fs_identifier", FT_UINT64, BASE_HEX, |
13878 | 14 | NULL, 0, NULL, HFILL } |
13879 | 14 | }, |
13880 | | |
13881 | 14 | { &hf_smb2_sec_info_00, |
13882 | 14 | { "SMB2_SEC_INFO_00", "smb2.sec_info_00", FT_NONE, BASE_NONE, |
13883 | 14 | NULL, 0, NULL, HFILL } |
13884 | 14 | }, |
13885 | | |
13886 | 14 | { &hf_smb2_quota_info, |
13887 | 14 | { "SMB2_QUOTA_INFO", "smb2.quota_info", FT_NONE, BASE_NONE, |
13888 | 14 | NULL, 0, NULL, HFILL } |
13889 | 14 | }, |
13890 | | |
13891 | 14 | { &hf_smb2_query_quota_info, |
13892 | 14 | { "SMB2_QUERY_QUOTA_INFO", "smb2.query_quota_info", FT_NONE, BASE_NONE, |
13893 | 14 | NULL, 0, NULL, HFILL } |
13894 | 14 | }, |
13895 | | |
13896 | 14 | { &hf_smb2_qq_single, |
13897 | 14 | { "ReturnSingle", "smb2.query_quota_info.single", FT_BOOLEAN, 8, |
13898 | 14 | NULL, 0xff, NULL, HFILL } |
13899 | 14 | }, |
13900 | | |
13901 | 14 | { &hf_smb2_qq_restart, |
13902 | 14 | { "RestartScan", "smb2.query_quota_info.restart", FT_BOOLEAN, 8, |
13903 | 14 | NULL, 0xff, NULL, HFILL } |
13904 | 14 | }, |
13905 | | |
13906 | 14 | { &hf_smb2_qq_sidlist_len, |
13907 | 14 | { "SidListLength", "smb2.query_quota_info.sidlistlen", FT_UINT32, BASE_DEC, |
13908 | 14 | NULL, 0, NULL, HFILL } |
13909 | 14 | }, |
13910 | | |
13911 | 14 | { &hf_smb2_qq_start_sid_len, |
13912 | 14 | { "StartSidLength", "smb2.query_quota_info.startsidlen", FT_UINT32, BASE_DEC, |
13913 | 14 | NULL, 0, NULL, HFILL } |
13914 | 14 | }, |
13915 | | |
13916 | 14 | { &hf_smb2_qq_start_sid_offset, |
13917 | 14 | { "StartSidOffset", "smb2.query_quota_info.startsidoffset", FT_UINT32, BASE_DEC, |
13918 | 14 | NULL, 0, NULL, HFILL } |
13919 | 14 | }, |
13920 | | |
13921 | 14 | { &hf_smb2_disposition_delete_on_close, |
13922 | 14 | { "Delete on close", "smb2.disposition.delete_on_close", FT_BOOLEAN, 8, |
13923 | 14 | TFS(&tfs_disposition_delete_on_close), 0x01, NULL, HFILL } |
13924 | 14 | }, |
13925 | | |
13926 | | |
13927 | 14 | { &hf_smb2_create_disposition, |
13928 | 14 | { "Disposition", "smb2.create.disposition", FT_UINT32, BASE_DEC, |
13929 | 14 | VALS(create_disposition_vals), 0, "Create disposition, what to do if the file does/does not exist", HFILL } |
13930 | 14 | }, |
13931 | | |
13932 | 14 | { &hf_smb2_create_action, |
13933 | 14 | { "Create Action", "smb2.create.action", FT_UINT32, BASE_DEC, |
13934 | 14 | VALS(oa_open_vals), 0, NULL, HFILL } |
13935 | 14 | }, |
13936 | | |
13937 | 14 | { &hf_smb2_create_rep_flags, |
13938 | 14 | { "Response Flags", "smb2.create.rep_flags", FT_UINT8, BASE_HEX, |
13939 | 14 | NULL, 0, NULL, HFILL } |
13940 | 14 | }, |
13941 | | |
13942 | 14 | { &hf_smb2_create_rep_flags_reparse_point, |
13943 | 14 | { "ReparsePoint", "smb2.create.rep_flags.reparse_point", FT_BOOLEAN, 8, |
13944 | 14 | NULL, SMB2_CREATE_REP_FLAGS_REPARSE_POINT, NULL, HFILL } |
13945 | 14 | }, |
13946 | | |
13947 | 14 | { &hf_smb2_extrainfo, |
13948 | 14 | { "ExtraInfo", "smb2.create.extrainfo", FT_NONE, BASE_NONE, |
13949 | 14 | NULL, 0, "Create ExtraInfo", HFILL } |
13950 | 14 | }, |
13951 | | |
13952 | 14 | { &hf_smb2_create_chain_offset, |
13953 | 14 | { "Chain Offset", "smb2.create.chain_offset", FT_UINT32, BASE_HEX, |
13954 | 14 | NULL, 0, "Offset to next entry in chain or 0", HFILL } |
13955 | 14 | }, |
13956 | | |
13957 | 14 | { &hf_smb2_create_chain_data, |
13958 | 14 | { "Data", "smb2.create.chain_data", FT_NONE, BASE_NONE, |
13959 | 14 | NULL, 0, "Chain Data", HFILL } |
13960 | 14 | }, |
13961 | | |
13962 | 14 | { &hf_smb2_FILE_OBJECTID_BUFFER, |
13963 | 14 | { "FILE_OBJECTID_BUFFER", "smb2.FILE_OBJECTID_BUFFER", FT_NONE, BASE_NONE, |
13964 | 14 | NULL, 0, NULL, HFILL } |
13965 | 14 | }, |
13966 | | |
13967 | 14 | { &hf_smb2_lease_key, |
13968 | 14 | { "Lease Key", "smb2.lease.lease_key", FT_GUID, BASE_NONE, |
13969 | 14 | NULL, 0, NULL, HFILL } |
13970 | 14 | }, |
13971 | | |
13972 | 14 | { &hf_smb2_lease_state, |
13973 | 14 | { "Lease State", "smb2.lease.lease_state", FT_UINT32, BASE_HEX, |
13974 | 14 | NULL, 0, NULL, HFILL } |
13975 | 14 | }, |
13976 | | |
13977 | 14 | { &hf_smb2_lease_state_read_caching, |
13978 | 14 | { "Read Caching", "smb2.lease.lease_state.read_caching", FT_BOOLEAN, 32, |
13979 | 14 | NULL, SMB2_LEASE_STATE_READ_CACHING, NULL, HFILL } |
13980 | 14 | }, |
13981 | | |
13982 | 14 | { &hf_smb2_lease_state_handle_caching, |
13983 | 14 | { "Handle Caching", "smb2.lease.lease_state.handle_caching", FT_BOOLEAN, 32, |
13984 | 14 | NULL, SMB2_LEASE_STATE_HANDLE_CACHING, NULL, HFILL } |
13985 | 14 | }, |
13986 | | |
13987 | 14 | { &hf_smb2_lease_state_write_caching, |
13988 | 14 | { "Write Caching", "smb2.lease.lease_state.write_caching", FT_BOOLEAN, 32, |
13989 | 14 | NULL, SMB2_LEASE_STATE_WRITE_CACHING, NULL, HFILL } |
13990 | 14 | }, |
13991 | | |
13992 | 14 | { &hf_smb2_lease_flags, |
13993 | 14 | { "Lease Flags", "smb2.lease.lease_flags", FT_UINT32, BASE_HEX, |
13994 | 14 | NULL, 0, NULL, HFILL } |
13995 | 14 | }, |
13996 | | |
13997 | 14 | { &hf_smb2_lease_flags_break_ack_required, |
13998 | 14 | { "Break Ack Required", "smb2.lease.lease_state.break_ack_required", FT_BOOLEAN, 32, |
13999 | 14 | NULL, SMB2_LEASE_FLAGS_BREAK_ACK_REQUIRED, NULL, HFILL } |
14000 | 14 | }, |
14001 | | |
14002 | 14 | { &hf_smb2_lease_flags_break_in_progress, |
14003 | 14 | { "Break In Progress", "smb2.lease.lease_state.break_in_progress", FT_BOOLEAN, 32, |
14004 | 14 | NULL, SMB2_LEASE_FLAGS_BREAK_IN_PROGRESS, NULL, HFILL } |
14005 | 14 | }, |
14006 | | |
14007 | 14 | { &hf_smb2_lease_flags_parent_lease_key_set, |
14008 | 14 | { "Parent Lease Key Set", "smb2.lease.lease_state.parent_lease_key_set", FT_BOOLEAN, 32, |
14009 | 14 | NULL, SMB2_LEASE_FLAGS_PARENT_LEASE_KEY_SET, NULL, HFILL } |
14010 | 14 | }, |
14011 | | |
14012 | 14 | { &hf_smb2_lease_duration, |
14013 | 14 | { "Lease Duration", "smb2.lease.lease_duration", FT_UINT64, BASE_HEX, |
14014 | 14 | NULL, 0, NULL, HFILL } |
14015 | 14 | }, |
14016 | | |
14017 | 14 | { &hf_smb2_parent_lease_key, |
14018 | 14 | { "Parent Lease Key", "smb2.lease.parent_lease_key", FT_GUID, BASE_NONE, |
14019 | 14 | NULL, 0, NULL, HFILL } |
14020 | 14 | }, |
14021 | | |
14022 | 14 | { &hf_smb2_lease_epoch, |
14023 | 14 | { "Lease Epoch", "smb2.lease.lease_oplock", FT_UINT16, BASE_HEX, |
14024 | 14 | NULL, 0, NULL, HFILL } |
14025 | 14 | }, |
14026 | | |
14027 | 14 | { &hf_smb2_lease_reserved, |
14028 | 14 | { "Lease Reserved", "smb2.lease.lease_reserved", FT_UINT16, BASE_HEX, |
14029 | 14 | NULL, 0, NULL, HFILL } |
14030 | 14 | }, |
14031 | | |
14032 | 14 | { &hf_smb2_lease_break_reason, |
14033 | 14 | { "Lease Break Reason", "smb2.lease.lease_break_reason", FT_UINT32, BASE_HEX, |
14034 | 14 | NULL, 0, NULL, HFILL } |
14035 | 14 | }, |
14036 | | |
14037 | 14 | { &hf_smb2_lease_access_mask_hint, |
14038 | 14 | { "Access Mask Hint", "smb2.lease.access_mask_hint", FT_UINT32, BASE_HEX, |
14039 | 14 | NULL, 0, NULL, HFILL } |
14040 | 14 | }, |
14041 | | |
14042 | 14 | { &hf_smb2_lease_share_mask_hint, |
14043 | 14 | { "Share Mask Hint", "smb2.lease.share_mask_hint", FT_UINT32, BASE_HEX, |
14044 | 14 | NULL, 0, NULL, HFILL } |
14045 | 14 | }, |
14046 | | |
14047 | 14 | { &hf_smb2_next_offset, |
14048 | 14 | { "Next Offset", "smb2.next_offset", FT_UINT32, BASE_DEC, |
14049 | 14 | NULL, 0, "Offset to next buffer or 0", HFILL } |
14050 | 14 | }, |
14051 | | |
14052 | 14 | { &hf_smb2_negotiate_context_type, |
14053 | 14 | { "Type", "smb2.negotiate_context.type", FT_UINT16, BASE_HEX, |
14054 | 14 | VALS(smb2_negotiate_context_types), 0, NULL, HFILL } |
14055 | 14 | }, |
14056 | | |
14057 | 14 | { &hf_smb2_negotiate_context_data_length, |
14058 | 14 | { "DataLength", "smb2.negotiate_context.data_length", FT_UINT16, BASE_DEC, |
14059 | 14 | NULL, 0, NULL, HFILL } |
14060 | 14 | }, |
14061 | | |
14062 | 14 | { &hf_smb2_negotiate_context_offset, |
14063 | 14 | { "NegotiateContextOffset", "smb2.negotiate_context.offset", FT_UINT32, BASE_HEX, |
14064 | 14 | NULL, 0, NULL, HFILL } |
14065 | 14 | }, |
14066 | | |
14067 | 14 | { &hf_smb2_negotiate_context_reserved2, |
14068 | 14 | { "Reserved2", "smb2.negotiate_context.reserved2", FT_UINT32, BASE_HEX, |
14069 | 14 | NULL, 0, NULL, HFILL } |
14070 | 14 | }, |
14071 | | |
14072 | 14 | { &hf_smb2_negotiate_context_count, |
14073 | 14 | { "NegotiateContextCount", "smb2.negotiate_context.count", FT_UINT16, BASE_DEC, |
14074 | 14 | NULL, 0, NULL, HFILL } |
14075 | 14 | }, |
14076 | | |
14077 | 14 | { &hf_smb2_negotiate_context_reserved, |
14078 | 14 | { "Reserved", "smb2.negotiate_context.reserved", FT_UINT16, BASE_DEC, |
14079 | 14 | NULL, 0, NULL, HFILL } |
14080 | 14 | }, |
14081 | | |
14082 | 14 | { &hf_smb2_hash_alg_count, |
14083 | 14 | { "HashAlgorithmCount", "smb2.negotiate_context.hash_alg_count", FT_UINT16, BASE_DEC, |
14084 | 14 | NULL, 0, NULL, HFILL }}, |
14085 | | |
14086 | 14 | { &hf_smb2_hash_algorithm, |
14087 | 14 | { "HashAlgorithm", "smb2.negotiate_context.hash_algorithm", FT_UINT16, BASE_HEX, |
14088 | 14 | VALS(smb2_hash_algorithm_types), 0, NULL, HFILL }}, |
14089 | | |
14090 | 14 | { &hf_smb2_salt_length, |
14091 | 14 | { "SaltLength", "smb2.negotiate_context.salt_length", FT_UINT16, BASE_DEC, |
14092 | 14 | NULL, 0, NULL, HFILL }}, |
14093 | | |
14094 | 14 | { &hf_smb2_salt, |
14095 | 14 | { "Salt", "smb2.negotiate_context.salt", FT_BYTES, BASE_NONE, |
14096 | 14 | NULL, 0, NULL, HFILL }}, |
14097 | | |
14098 | 14 | { &hf_smb2_signing_alg_count, |
14099 | 14 | { "SigningAlgorithmCount", "smb2.negotiate_context.signing_alg_count", FT_UINT16, BASE_DEC, |
14100 | 14 | NULL, 0, NULL, HFILL }}, |
14101 | | |
14102 | 14 | { &hf_smb2_signing_alg_id, |
14103 | 14 | { "SigningAlgorithmId", "smb2.negotiate_context.signing_id", FT_UINT16, BASE_HEX, |
14104 | 14 | VALS(smb2_signing_alg_types), 0, NULL, HFILL }}, |
14105 | | |
14106 | 14 | { &hf_smb2_cipher_count, |
14107 | 14 | { "CipherCount", "smb2.negotiate_context.cipher_count", FT_UINT16, BASE_DEC, |
14108 | 14 | NULL, 0, NULL, HFILL }}, |
14109 | | |
14110 | 14 | { &hf_smb2_cipher_id, |
14111 | 14 | { "CipherId", "smb2.negotiate_context.cipher_id", FT_UINT16, BASE_HEX, |
14112 | 14 | VALS(smb2_cipher_types), 0, NULL, HFILL }}, |
14113 | | |
14114 | 14 | { &hf_smb2_posix_reserved, |
14115 | 14 | { "POSIX Reserved", "smb2.negotiate_context.posix_reserved", FT_BYTES, BASE_NONE, |
14116 | 14 | NULL, 0, NULL, HFILL } |
14117 | 14 | }, |
14118 | | |
14119 | 14 | { &hf_smb2_dev, |
14120 | 14 | { "Device", "smb2.dev", FT_UINT32, BASE_HEX, |
14121 | 14 | NULL, 0, NULL, HFILL } |
14122 | 14 | }, |
14123 | | |
14124 | 14 | { &hf_smb2_inode, |
14125 | 14 | { "Inode", "smb2.inode", FT_UINT64, BASE_HEX, |
14126 | 14 | NULL, 0, NULL, HFILL } |
14127 | 14 | }, |
14128 | | |
14129 | 14 | { &hf_smb2_comp_alg_count, |
14130 | 14 | { "CompressionAlgorithmCount", "smb2.negotiate_context.comp_alg_count", FT_UINT16, BASE_DEC, |
14131 | 14 | NULL, 0, NULL, HFILL }}, |
14132 | | |
14133 | 14 | { &hf_smb2_comp_alg_id, |
14134 | 14 | { "CompressionAlgorithmId", "smb2.negotiate_context.comp_alg_id", FT_UINT16, BASE_HEX, |
14135 | 14 | VALS(smb2_comp_alg_types), 0, NULL, HFILL }}, |
14136 | | |
14137 | 14 | { &hf_smb2_comp_alg_flags, |
14138 | 14 | { "Flags", "smb2.negotiate_context.comp_alg_flags", FT_UINT32, BASE_HEX, |
14139 | 14 | NULL, 0, NULL, HFILL } |
14140 | 14 | }, |
14141 | | |
14142 | 14 | { &hf_smb2_comp_alg_flags_chained, |
14143 | 14 | { "Chained", "smb2.negotiate_context.comp_alg_flags.chained", FT_BOOLEAN, 32, |
14144 | 14 | NULL, SMB2_COMP_ALG_FLAGS_CHAINED, "Chained compression is supported on this connection", HFILL } |
14145 | 14 | }, |
14146 | | |
14147 | 14 | { &hf_smb2_comp_alg_flags_reserved, |
14148 | 14 | { "Reserved", "smb2.negotiate_context.comp_alg_flags.reserved", FT_UINT32, BASE_HEX, |
14149 | 14 | NULL, 0xFFFFFFFE, "Must be zero", HFILL } |
14150 | 14 | }, |
14151 | | |
14152 | 14 | { &hf_smb2_netname_neg_id, |
14153 | 14 | { "Netname", "smb2.negotiate_context.netname", FT_STRING, |
14154 | 14 | BASE_NONE, NULL, 0x0, NULL, HFILL } |
14155 | 14 | }, |
14156 | | |
14157 | 14 | { &hf_smb2_transport_ctx_flags, |
14158 | 14 | { "Flags", "smb2.negotiate_context.transport_flags", FT_UINT32, BASE_HEX, |
14159 | 14 | VALS(smb2_transport_ctx_flags_vals), 0, NULL, HFILL } |
14160 | 14 | }, |
14161 | | |
14162 | 14 | { &hf_smb2_rdma_transform_count, |
14163 | 14 | { "TransformCount", "smb2.negotiate_context.rdma_transform_count", FT_UINT16, BASE_DEC, |
14164 | 14 | NULL, 0, NULL, HFILL } |
14165 | 14 | }, |
14166 | | |
14167 | 14 | { &hf_smb2_rdma_transform_reserved1, |
14168 | 14 | { "Reserved1", "smb2.negotiate_context.rdma_transform_reserved1", FT_UINT16, BASE_HEX, |
14169 | 14 | NULL, 0, NULL, HFILL } |
14170 | 14 | }, |
14171 | | |
14172 | 14 | { &hf_smb2_rdma_transform_reserved2, |
14173 | 14 | { "Reserved2", "smb2.negotiate_context.rdma_transform_reserved2", FT_UINT32, BASE_HEX, |
14174 | 14 | NULL, 0, NULL, HFILL } |
14175 | 14 | }, |
14176 | | |
14177 | 14 | { &hf_smb2_rdma_transform_id, |
14178 | 14 | { "RDMATransformId", "smb2.negotiate_context.rdma_transform_id", FT_UINT16, BASE_HEX, |
14179 | 14 | VALS(smb2_rdma_transform_types), 0, NULL, HFILL } |
14180 | 14 | }, |
14181 | | |
14182 | 14 | { &hf_smb2_current_time, |
14183 | 14 | { "Current Time", "smb2.current_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, |
14184 | 14 | NULL, 0, "Current Time at server", HFILL } |
14185 | 14 | }, |
14186 | | |
14187 | 14 | { &hf_smb2_boot_time, |
14188 | 14 | { "Boot Time", "smb2.boot_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, |
14189 | 14 | NULL, 0, "Boot Time at server", HFILL } |
14190 | 14 | }, |
14191 | | |
14192 | 14 | { &hf_smb2_ea_flags, |
14193 | 14 | { "EA Flags", "smb2.ea.flags", FT_UINT8, BASE_HEX, |
14194 | 14 | VALS(file_full_ea_information_flags), 0, NULL, HFILL } |
14195 | 14 | }, |
14196 | | |
14197 | 14 | { &hf_smb2_ea_name_len, |
14198 | 14 | { "EA Name Length", "smb2.ea.name_len", FT_UINT8, BASE_DEC, |
14199 | 14 | NULL, 0, NULL, HFILL } |
14200 | 14 | }, |
14201 | | |
14202 | 14 | { &hf_smb2_ea_data_len, |
14203 | 14 | { "EA Data Length", "smb2.ea.data_len", FT_UINT16, BASE_DEC, |
14204 | 14 | NULL, 0, NULL, HFILL } |
14205 | 14 | }, |
14206 | | |
14207 | 14 | { &hf_smb2_delete_pending, |
14208 | 14 | { "Delete Pending", "smb2.delete_pending", FT_UINT8, BASE_DEC, |
14209 | 14 | NULL, 0, NULL, HFILL } |
14210 | 14 | }, |
14211 | | |
14212 | 14 | { &hf_smb2_is_directory, |
14213 | 14 | { "Is Directory", "smb2.is_directory", FT_UINT8, BASE_DEC, |
14214 | 14 | NULL, 0, "Is this a directory?", HFILL } |
14215 | 14 | }, |
14216 | | |
14217 | 14 | { &hf_smb2_oplock, |
14218 | 14 | { "Oplock", "smb2.create.oplock", FT_UINT8, BASE_HEX, |
14219 | 14 | VALS(oplock_vals), 0, "Oplock type", HFILL } |
14220 | 14 | }, |
14221 | | |
14222 | 14 | { &hf_smb2_close_flags, |
14223 | 14 | { "Close Flags", "smb2.close.flags", FT_UINT16, BASE_HEX, |
14224 | 14 | NULL, 0, NULL, HFILL } |
14225 | 14 | }, |
14226 | | |
14227 | 14 | { &hf_smb2_notify_flags, |
14228 | 14 | { "Notify Flags", "smb2.notify.flags", FT_UINT16, BASE_HEX, |
14229 | 14 | NULL, 0, NULL, HFILL } |
14230 | 14 | }, |
14231 | | |
14232 | 14 | { &hf_smb2_buffer_code, |
14233 | 14 | { "StructureSize", "smb2.buffer_code", FT_UINT16, BASE_HEX, |
14234 | 14 | NULL, 0, NULL, HFILL } |
14235 | 14 | }, |
14236 | | |
14237 | 14 | { &hf_smb2_buffer_code_len, |
14238 | 14 | { "Fixed Part Length", "smb2.buffer_code.length", FT_UINT16, BASE_DEC, |
14239 | 14 | NULL, 0xFFFE, "Length of fixed portion of PDU", HFILL } |
14240 | 14 | }, |
14241 | | |
14242 | 14 | { &hf_smb2_olb_length, |
14243 | 14 | { "Blob Length", "smb2.olb.length", FT_UINT32, BASE_DEC, |
14244 | 14 | NULL, 0, "Length of the buffer", HFILL } |
14245 | 14 | }, |
14246 | | |
14247 | 14 | { &hf_smb2_olb_offset, |
14248 | 14 | { "Blob Offset", "smb2.olb.offset", FT_UINT32, BASE_HEX, |
14249 | 14 | NULL, 0, "Offset to the buffer", HFILL } |
14250 | 14 | }, |
14251 | | |
14252 | 14 | { &hf_smb2_buffer_code_flags_dyn, |
14253 | 14 | { "Dynamic Part", "smb2.buffer_code.dynamic", FT_BOOLEAN, 16, |
14254 | 14 | NULL, 0x0001, "Whether a dynamic length blob follows", HFILL } |
14255 | 14 | }, |
14256 | | |
14257 | 14 | { &hf_smb2_ea_data, |
14258 | 14 | { "EA Data", "smb2.ea.data", FT_BYTES, BASE_NONE|BASE_SHOW_ASCII_PRINTABLE, |
14259 | 14 | NULL, 0, NULL, HFILL } |
14260 | 14 | }, |
14261 | | |
14262 | 14 | { &hf_smb2_ea_name, |
14263 | 14 | { "EA Name", "smb2.ea.name", FT_STRING, BASE_NONE, |
14264 | 14 | NULL, 0, NULL, HFILL } |
14265 | 14 | }, |
14266 | | |
14267 | 14 | { &hf_smb2_impersonation_level, |
14268 | 14 | { "Impersonation level", "smb2.impersonation.level", FT_UINT32, BASE_DEC, |
14269 | 14 | VALS(impersonation_level_vals), 0, NULL, HFILL } |
14270 | 14 | }, |
14271 | | |
14272 | 14 | { &hf_smb2_ioctl_function, |
14273 | 14 | { "Function", "smb2.ioctl.function", FT_UINT32, BASE_HEX | BASE_EXT_STRING, |
14274 | 14 | &smb2_ioctl_vals_ext, 0, "Ioctl function", HFILL } |
14275 | 14 | }, |
14276 | | |
14277 | 14 | { &hf_smb2_ioctl_function_device, |
14278 | 14 | { "Device", "smb2.ioctl.function.device", FT_UINT32, BASE_HEX | BASE_EXT_STRING, |
14279 | 14 | &smb2_ioctl_device_vals_ext, 0xffff0000, "Device for Ioctl", HFILL } |
14280 | 14 | }, |
14281 | | |
14282 | 14 | { &hf_smb2_ioctl_function_access, |
14283 | 14 | { "Access", "smb2.ioctl.function.access", FT_UINT32, BASE_HEX, |
14284 | 14 | VALS(smb2_ioctl_access_vals), 0x0000c000, "Access for Ioctl", HFILL } |
14285 | 14 | }, |
14286 | | |
14287 | 14 | { &hf_smb2_ioctl_function_function, |
14288 | 14 | { "Function", "smb2.ioctl.function.function", FT_UINT32, BASE_HEX, |
14289 | 14 | NULL, 0x00003ffc, "Function for Ioctl", HFILL } |
14290 | 14 | }, |
14291 | | |
14292 | 14 | { &hf_smb2_ioctl_function_method, |
14293 | 14 | { "Method", "smb2.ioctl.function.method", FT_UINT32, BASE_HEX, |
14294 | 14 | VALS(smb2_ioctl_method_vals), 0x00000003, "Method for Ioctl", HFILL } |
14295 | 14 | }, |
14296 | | |
14297 | 14 | { &hf_smb2_fsctl_pipe_wait_timeout, |
14298 | 14 | { "Timeout", "smb2.fsctl.wait.timeout", FT_INT64, BASE_DEC, |
14299 | 14 | NULL, 0, "Wait timeout", HFILL } |
14300 | 14 | }, |
14301 | | |
14302 | 14 | { &hf_smb2_fsctl_pipe_wait_name, |
14303 | 14 | { "Name", "smb2.fsctl.wait.name", FT_STRING, BASE_NONE, |
14304 | 14 | NULL, 0, "Pipe name", HFILL } |
14305 | 14 | }, |
14306 | | |
14307 | 14 | { &hf_smb2_fsctl_odx_token_type, |
14308 | 14 | { "TokenType", "smb2.fsctl.odx.token.type", FT_UINT32, BASE_HEX, |
14309 | 14 | NULL, 0, NULL, HFILL } |
14310 | 14 | }, |
14311 | | |
14312 | 14 | { &hf_smb2_fsctl_odx_token_idlen, |
14313 | 14 | { "TokenIdLength", "smb2.fsctl.odx.token.idlen", FT_UINT16, BASE_DEC, |
14314 | 14 | NULL, 0, NULL, HFILL } |
14315 | 14 | }, |
14316 | | |
14317 | 14 | { &hf_smb2_fsctl_odx_token_idraw, |
14318 | 14 | { "TokenId", "smb2.fsctl.odx.token.id", FT_BYTES, BASE_NONE, |
14319 | 14 | NULL, 0, "Token ID (opaque)", HFILL } |
14320 | 14 | }, |
14321 | | |
14322 | 14 | { &hf_smb2_fsctl_odx_token_ttl, |
14323 | 14 | { "TokenTimeToLive", "smb2.fsctl.odx.token_ttl", FT_UINT32, BASE_DEC, |
14324 | 14 | NULL, 0, "TTL requested for the token (in milliseconds)", HFILL } |
14325 | 14 | }, |
14326 | | |
14327 | 14 | { &hf_smb2_fsctl_odx_size, |
14328 | 14 | { "Size", "smb2.fsctl.odx.size", FT_UINT32, BASE_DEC, |
14329 | 14 | NULL, 0, "Size of this data element", HFILL } |
14330 | 14 | }, |
14331 | | |
14332 | 14 | { &hf_smb2_fsctl_odx_flags, |
14333 | 14 | { "Flags", "smb2.fsctl.odx.flags", FT_UINT32, BASE_HEX, |
14334 | 14 | NULL, 0, "Flags for this operation", HFILL } |
14335 | 14 | }, |
14336 | | |
14337 | 14 | { &hf_smb2_fsctl_odx_file_offset, |
14338 | 14 | { "FileOffset", "smb2.fsctl.odx.file_offset", FT_UINT64, BASE_DEC, |
14339 | 14 | NULL, 0, NULL, HFILL } |
14340 | 14 | }, |
14341 | | |
14342 | 14 | { &hf_smb2_fsctl_odx_copy_length, |
14343 | 14 | { "CopyLength", "smb2.fsctl.odx.copy_length", FT_UINT64, BASE_DEC, |
14344 | 14 | NULL, 0, NULL, HFILL } |
14345 | 14 | }, |
14346 | | |
14347 | 14 | { &hf_smb2_fsctl_odx_xfer_length, |
14348 | 14 | { "TransferLength", "smb2.fsctl.odx.xfer_length", FT_UINT64, BASE_DEC, |
14349 | 14 | NULL, 0, NULL, HFILL } |
14350 | 14 | }, |
14351 | | |
14352 | 14 | { &hf_smb2_fsctl_odx_token_offset, |
14353 | 14 | { "TokenOffset", "smb2.fsctl.odx.token_offset", FT_UINT64, BASE_DEC, |
14354 | 14 | NULL, 0, "Token Offset (relative to start of token)", HFILL } |
14355 | 14 | }, |
14356 | | |
14357 | 14 | { &hf_smb2_fsctl_sparse_flag, |
14358 | 14 | { "SetSparse", "smb2.fsctl.set_sparse", FT_BOOLEAN, 8, |
14359 | 14 | NULL, 0xFF, NULL, HFILL } |
14360 | 14 | }, |
14361 | | |
14362 | 14 | { &hf_smb2_ioctl_resiliency_timeout, |
14363 | 14 | { "Timeout", "smb2.ioctl.resiliency.timeout", FT_UINT32, BASE_DEC, |
14364 | 14 | NULL, 0, "Resiliency timeout", HFILL } |
14365 | 14 | }, |
14366 | | |
14367 | 14 | { &hf_smb2_ioctl_resiliency_reserved, |
14368 | 14 | { "Reserved", "smb2.ioctl.resiliency.reserved", FT_UINT32, BASE_DEC, |
14369 | 14 | NULL, 0, "Resiliency reserved", HFILL } |
14370 | 14 | }, |
14371 | | |
14372 | 14 | { &hf_smb2_ioctl_shared_virtual_disk_support, |
14373 | 14 | { "SharedVirtualDiskSupport", "smb2.ioctl.shared_virtual_disk.support", FT_UINT32, BASE_HEX, |
14374 | 14 | VALS(smb2_ioctl_shared_virtual_disk_vals), 0, "Supported shared capabilities", HFILL } |
14375 | 14 | }, |
14376 | | |
14377 | 14 | { &hf_smb2_ioctl_shared_virtual_disk_handle_state, |
14378 | 14 | { "SharedVirtualDiskHandleState", "smb2.ioctl.shared_virtual_disk.handle_state", FT_UINT32, BASE_HEX, |
14379 | 14 | VALS(smb2_ioctl_shared_virtual_disk_hstate_vals), 0, NULL, HFILL } |
14380 | 14 | }, |
14381 | | |
14382 | 14 | { &hf_smb2_ioctl_sqos_protocol_version, |
14383 | 14 | { "ProtocolVersion", "smb2.ioctl.sqos.protocol_version", FT_UINT16, BASE_HEX, |
14384 | 14 | VALS(smb2_ioctl_sqos_protocol_version_vals), 0, NULL, HFILL } |
14385 | 14 | }, |
14386 | | |
14387 | 14 | { &hf_smb2_ioctl_sqos_reserved, |
14388 | 14 | { "Reserved", "smb2.ioctl.sqos.reserved", FT_UINT16, BASE_DEC, |
14389 | 14 | NULL, 0, NULL, HFILL } |
14390 | 14 | }, |
14391 | | |
14392 | 14 | { &hf_smb2_ioctl_sqos_options, |
14393 | 14 | { "Operations", "smb2.ioctl.sqos.operations", FT_UINT32, BASE_HEX, |
14394 | 14 | NULL, 0, "SQOS operations", HFILL } |
14395 | 14 | }, |
14396 | | |
14397 | 14 | { &hf_smb2_ioctl_sqos_op_set_logical_flow_id, |
14398 | 14 | { "Set Logical Flow ID", "smb2.ioctl.sqos.operations.set_logical_flow_id", FT_BOOLEAN, 32, |
14399 | 14 | NULL, STORAGE_QOS_CONTROL_FLAG_SET_LOGICAL_FLOW_ID, "Whether Set Logical Flow ID operation is performed", HFILL } |
14400 | 14 | }, |
14401 | | |
14402 | 14 | { &hf_smb2_ioctl_sqos_op_set_policy, |
14403 | 14 | { "Set Policy", "smb2.ioctl.sqos.operations.set_policy", FT_BOOLEAN, 32, |
14404 | 14 | NULL, STORAGE_QOS_CONTROL_FLAG_SET_POLICY, "Whether Set Policy operation is performed", HFILL } |
14405 | 14 | }, |
14406 | | |
14407 | 14 | { &hf_smb2_ioctl_sqos_op_probe_policy, |
14408 | 14 | { "Probe Policy", "smb2.ioctl.sqos.operations.probe_policy", FT_BOOLEAN, 32, |
14409 | 14 | NULL, STORAGE_QOS_CONTROL_FLAG_PROBE_POLICY, "Whether Probe Policy operation is performed", HFILL } |
14410 | 14 | }, |
14411 | | |
14412 | 14 | { &hf_smb2_ioctl_sqos_op_get_status, |
14413 | 14 | { "Get Status", "smb2.ioctl.sqos.operations.get_status", FT_BOOLEAN, 32, |
14414 | 14 | NULL, STORAGE_QOS_CONTROL_FLAG_GET_STATUS, "Whether Get Status operation is performed", HFILL } |
14415 | 14 | }, |
14416 | | |
14417 | 14 | { &hf_smb2_ioctl_sqos_op_update_counters, |
14418 | 14 | { "Update Counters", "smb2.ioctl.sqos.operations.update_counters", FT_BOOLEAN, 32, |
14419 | 14 | NULL, STORAGE_QOS_CONTROL_FLAG_UPDATE_COUNTERS, "Whether Update Counters operation is performed", HFILL } |
14420 | 14 | }, |
14421 | | |
14422 | 14 | { &hf_smb2_ioctl_sqos_logical_flow_id, |
14423 | 14 | { "LogicalFlowID", "smb2.ioctl.sqos.logical_flow_id", FT_GUID, BASE_NONE, |
14424 | 14 | NULL, 0, NULL, HFILL } |
14425 | 14 | }, |
14426 | | |
14427 | 14 | { &hf_smb2_ioctl_sqos_policy_id, |
14428 | 14 | { "PolicyID", "smb2.ioctl.sqos.policy_id", FT_GUID, BASE_NONE, |
14429 | 14 | NULL, 0, NULL, HFILL } |
14430 | 14 | }, |
14431 | | |
14432 | 14 | { &hf_smb2_ioctl_sqos_initiator_id, |
14433 | 14 | { "InitiatorID", "smb2.ioctl.sqos.initiator_id", FT_GUID, BASE_NONE, |
14434 | 14 | NULL, 0, NULL, HFILL } |
14435 | 14 | }, |
14436 | | |
14437 | 14 | { &hf_smb2_ioctl_sqos_limit, |
14438 | 14 | { "Limit", "smb2.ioctl.sqos.limit", FT_UINT64, BASE_DEC, |
14439 | 14 | NULL, 0, "Desired maximum throughput for the logical flow, in normalized IOPS", HFILL } |
14440 | 14 | }, |
14441 | | |
14442 | 14 | { &hf_smb2_ioctl_sqos_reservation, |
14443 | 14 | { "Reservation", "smb2.ioctl.sqos.reservation", FT_UINT64, BASE_DEC, |
14444 | 14 | NULL, 0, "Desired minimum throughput for the logical flow, in normalized 8KB IOPS", HFILL } |
14445 | 14 | }, |
14446 | | |
14447 | 14 | { &hf_smb2_ioctl_sqos_initiator_name, |
14448 | 14 | { "InitiatorName", "smb2.ioctl.sqos.initiator_name", FT_STRING, BASE_NONE, |
14449 | 14 | NULL, 0x0, NULL, HFILL } |
14450 | 14 | }, |
14451 | | |
14452 | 14 | { &hf_smb2_ioctl_sqos_initiator_node_name, |
14453 | 14 | { "InitiatorNodeName", "smb2.ioctl.sqos.initiator_node_name", FT_STRING, BASE_NONE, |
14454 | 14 | NULL, 0x0, NULL, HFILL } |
14455 | 14 | }, |
14456 | | |
14457 | 14 | { &hf_smb2_ioctl_sqos_io_count_increment, |
14458 | 14 | { "IoCountIncrement", "smb2.ioctl.sqos.io_count_increment", FT_UINT64, BASE_DEC, |
14459 | 14 | NULL, 0, "The total number of I/O requests issued by the initiator on the logical flow", HFILL } |
14460 | 14 | }, |
14461 | | |
14462 | 14 | { &hf_smb2_ioctl_sqos_normalized_io_count_increment, |
14463 | 14 | { "NormalizedIoCountIncrement", "smb2.ioctl.sqos.normalized_io_count_increment", FT_UINT64, BASE_DEC, |
14464 | 14 | NULL, 0, "The total number of normalized 8-KB I/O requests issued by the initiator on the logical flow", HFILL } |
14465 | 14 | }, |
14466 | | |
14467 | 14 | { &hf_smb2_ioctl_sqos_latency_increment, |
14468 | 14 | { "LatencyIncrement", "smb2.ioctl.sqos.latency_increment", FT_UINT64, BASE_DEC, |
14469 | 14 | NULL, 0, "The total latency (including initiator's queues delays) measured by the initiator", HFILL } |
14470 | 14 | }, |
14471 | | |
14472 | 14 | { &hf_smb2_ioctl_sqos_lower_latency_increment, |
14473 | 14 | { "LowerLatencyIncrement", "smb2.ioctl.sqos.lower_latency_increment", FT_UINT64, BASE_DEC, |
14474 | 14 | NULL, 0, "The total latency (excluding initiator's queues delays) measured by the initiator", HFILL } |
14475 | 14 | }, |
14476 | | |
14477 | 14 | { &hf_smb2_ioctl_sqos_bandwidth_limit, |
14478 | 14 | { "BandwidthLimit", "smb2.ioctl.sqos.bandwidth_limit", FT_UINT64, BASE_DEC, |
14479 | 14 | NULL, 0, "Desired maximum bandwidth for the logical flow, in kilobytes per second", HFILL } |
14480 | 14 | }, |
14481 | | |
14482 | 14 | { &hf_smb2_ioctl_sqos_kilobyte_count_increment, |
14483 | 14 | { "KilobyteCountIncrement", "smb2.ioctl.sqos.kilobyte_count_increment", FT_UINT64, BASE_DEC, |
14484 | 14 | NULL, 0, "The total data transfer length of all I/O requests, in kilobyte units, issued by the initiator on the logical flow", HFILL } |
14485 | 14 | }, |
14486 | | |
14487 | 14 | { &hf_smb2_ioctl_sqos_time_to_live, |
14488 | 14 | { "TimeToLive", "smb2.ioctl.sqos.time_to_live", FT_UINT32, BASE_DEC, |
14489 | 14 | NULL, 0, "The expected period of validity of the Status, MaximumIoRate and MinimumIoRate fields, expressed in milliseconds", HFILL } |
14490 | 14 | }, |
14491 | | |
14492 | 14 | { &hf_smb2_ioctl_sqos_status, |
14493 | 14 | { "Status", "smb2.ioctl.sqos.status", FT_UINT32, BASE_HEX, |
14494 | 14 | VALS(smb2_ioctl_sqos_status_vals), 0, "The current status of the logical flow", HFILL } |
14495 | 14 | }, |
14496 | | |
14497 | 14 | { &hf_smb2_ioctl_sqos_maximum_io_rate, |
14498 | 14 | { "MaximumIoRate", "smb2.ioctl.sqos.maximum_io_rate", FT_UINT64, BASE_DEC, |
14499 | 14 | NULL, 0, "The maximum I/O initiation rate currently assigned to the logical flow, expressed in normalized input/output operations per second (normalized IOPS)", HFILL } |
14500 | 14 | }, |
14501 | | |
14502 | 14 | { &hf_smb2_ioctl_sqos_minimum_io_rate, |
14503 | 14 | { "MinimumIoRate", "smb2.ioctl.sqos.minimum_io_rate", FT_UINT64, BASE_DEC, |
14504 | 14 | NULL, 0, "The minimum I/O completion rate currently assigned to the logical flow, expressed in normalized IOPS", HFILL } |
14505 | 14 | }, |
14506 | | |
14507 | 14 | { &hf_smb2_ioctl_sqos_base_io_size, |
14508 | 14 | { "BaseIoSize", "smb2.ioctl.sqos.base_io_size", FT_UINT32, BASE_DEC, |
14509 | 14 | NULL, 0, "The base I/O size used to compute the normalized size of an I/O request for the logical flow", HFILL } |
14510 | 14 | }, |
14511 | | |
14512 | 14 | { &hf_smb2_ioctl_sqos_reserved2, |
14513 | 14 | { "Reserved", "smb2.ioctl.sqos.reserved2", FT_UINT32, BASE_DEC, |
14514 | 14 | NULL, 0, NULL, HFILL } |
14515 | 14 | }, |
14516 | | |
14517 | 14 | { &hf_smb2_ioctl_sqos_maximum_bandwidth, |
14518 | 14 | { "MaximumBandwidth", "smb2.ioctl.sqos.maximum_bandwidth", FT_UINT64, BASE_DEC, |
14519 | 14 | NULL, 0, "The maximum bandwidth currently assigned to the logical flow, expressed in kilobytes per second", HFILL } |
14520 | 14 | }, |
14521 | | |
14522 | | |
14523 | 14 | { &hf_windows_sockaddr_family, |
14524 | 14 | { "Socket Family", "smb2.windows.sockaddr.family", FT_UINT16, BASE_DEC, |
14525 | 14 | NULL, 0, "The socket address family (on windows)", HFILL } |
14526 | 14 | }, |
14527 | | |
14528 | 14 | { &hf_windows_sockaddr_port, |
14529 | 14 | { "Socket Port", "smb2.windows.sockaddr.port", FT_UINT16, BASE_DEC, |
14530 | 14 | NULL, 0, "The socket address port", HFILL } |
14531 | 14 | }, |
14532 | | |
14533 | 14 | { &hf_windows_sockaddr_in_addr, |
14534 | 14 | { "Socket IPv4", "smb2.windows.sockaddr.in.addr", FT_IPv4, BASE_NONE, |
14535 | 14 | NULL, 0, "The IPv4 address", HFILL } |
14536 | 14 | }, |
14537 | | |
14538 | 14 | { &hf_windows_sockaddr_in6_flowinfo, |
14539 | 14 | { "IPv6 Flow Info", "smb2.windows.sockaddr.in6.flow_info", FT_UINT32, BASE_HEX, |
14540 | 14 | NULL, 0, "The socket IPv6 flow info", HFILL } |
14541 | 14 | }, |
14542 | | |
14543 | 14 | { &hf_windows_sockaddr_in6_addr, |
14544 | 14 | { "Socket IPv6", "smb2.windows.sockaddr.in6.addr", FT_IPv6, BASE_NONE, |
14545 | 14 | NULL, 0, "The IPv6 address", HFILL } |
14546 | 14 | }, |
14547 | | |
14548 | 14 | { &hf_windows_sockaddr_in6_scope_id, |
14549 | 14 | { "IPv6 Scope ID", "smb2.windows.sockaddr.in6.scope_id", FT_UINT32, BASE_DEC, |
14550 | 14 | NULL, 0, "The socket IPv6 scope id", HFILL } |
14551 | 14 | }, |
14552 | | |
14553 | 14 | { &hf_smb2_ioctl_network_interface_next_offset, |
14554 | 14 | { "Next Offset", "smb2.ioctl.network_interfaces.next_offset", FT_UINT32, BASE_HEX, |
14555 | 14 | NULL, 0, "Offset to next entry in chain or 0", HFILL } |
14556 | 14 | }, |
14557 | | |
14558 | 14 | { &hf_smb2_ioctl_network_interface_index, |
14559 | 14 | { "Interface Index", "smb2.ioctl.network_interfaces.index", FT_UINT32, BASE_DEC, |
14560 | 14 | NULL, 0, "The index of the interface", HFILL } |
14561 | 14 | }, |
14562 | | |
14563 | 14 | { &hf_smb2_ioctl_network_interface_reserved, |
14564 | 14 | { "Reserved", "smb2.ioctl.network_interfaces.reserved", FT_UINT32, BASE_DEC, |
14565 | 14 | NULL, 0, "Was RSS Queue Count", HFILL } |
14566 | 14 | }, |
14567 | | |
14568 | 14 | { &hf_smb2_ioctl_network_interface_capabilities, |
14569 | 14 | { "Interface Cababilities", "smb2.ioctl.network_interfaces.capabilities", FT_UINT32, BASE_HEX, |
14570 | 14 | NULL, 0, "The capabilities of the network interface", HFILL } |
14571 | 14 | }, |
14572 | | |
14573 | 14 | { &hf_smb2_ioctl_network_interface_capability_rss, |
14574 | 14 | { "RSS", "smb2.ioctl.network_interfaces.capabilities.rss", FT_BOOLEAN, 32, |
14575 | 14 | TFS(&tfs_smb2_ioctl_network_interface_capability_rss), NETWORK_INTERFACE_CAP_RSS, "If the host supports RSS", HFILL } |
14576 | 14 | }, |
14577 | | |
14578 | 14 | { &hf_smb2_ioctl_network_interface_capability_rdma, |
14579 | 14 | { "RDMA", "smb2.ioctl.network_interfaces.capabilities.rdma", FT_BOOLEAN, 32, |
14580 | 14 | TFS(&tfs_smb2_ioctl_network_interface_capability_rdma), NETWORK_INTERFACE_CAP_RDMA, "If the host supports RDMA", HFILL } |
14581 | 14 | }, |
14582 | | |
14583 | 14 | { &hf_smb2_ioctl_network_interface_link_speed, |
14584 | 14 | { "Link Speed", "smb2.ioctl.network_interfaces.link_speed", FT_UINT64, BASE_DEC, |
14585 | 14 | NULL, 0, "The link speed of the interface", HFILL } |
14586 | 14 | }, |
14587 | | |
14588 | 14 | { &hf_smb2_ioctl_enumerate_snapshots_num_snapshots, |
14589 | 14 | { "Number of snapshots", "smb2.ioctl.enumerate_snapshots.num_snapshots", FT_UINT32, BASE_DEC, |
14590 | 14 | NULL, 0, "Number of previous versions associated with the volume", HFILL } |
14591 | 14 | }, |
14592 | | |
14593 | 14 | { &hf_smb2_ioctl_enumerate_snapshots_num_snapshots_returned, |
14594 | 14 | { "Number of snapshots returned", "smb2.ioctl.enumerate_snapshots.num_snapshots_returned", FT_UINT32, BASE_DEC, |
14595 | 14 | NULL, 0, "Number of previous version time stamps returned", HFILL } |
14596 | 14 | }, |
14597 | | |
14598 | 14 | { &hf_smb2_ioctl_enumerate_snapshots_snapshot_array_size, |
14599 | 14 | { "Array size", "smb2.ioctl.enumerate_snapshots.array_size", FT_UINT32, BASE_DEC, |
14600 | 14 | NULL, 0, "Number of bytes for snapshot time stamp strings", HFILL } |
14601 | 14 | }, |
14602 | | |
14603 | 14 | { &hf_smb2_ioctl_enumerate_snapshots_snapshot, |
14604 | 14 | { "Snapshot", "smb2.ioctl.enumerate_snapshots.snapshot", FT_STRINGZ, BASE_NONE, |
14605 | 14 | NULL, 0, "Time stamp of previous version", HFILL } |
14606 | 14 | }, |
14607 | | |
14608 | 14 | { &hf_smb2_ioctl_get_ntfs_volume_data_volume_serial, { |
14609 | 14 | "VolumeSerialNumber", |
14610 | 14 | "smb2.ioctl.get_ntfs_volume_data.volume_serial_number", |
14611 | 14 | FT_UINT64, BASE_DEC, |
14612 | 14 | NULL, 0, "Volume Serial Number", HFILL }, |
14613 | 14 | }, |
14614 | | |
14615 | 14 | { &hf_smb2_ioctl_get_ntfs_volume_data_num_sectors, { |
14616 | 14 | "NumberSectors", |
14617 | 14 | "smb2.ioctl.get_ntfs_volume_data.num_sectors", |
14618 | 14 | FT_UINT64, BASE_DEC, |
14619 | 14 | NULL, 0, "Number Sectors", HFILL }, |
14620 | 14 | }, |
14621 | | |
14622 | 14 | { &hf_smb2_ioctl_get_ntfs_volume_data_total_clusters, { |
14623 | 14 | "TotalClusters", |
14624 | 14 | "smb2.ioctl.get_ntfs_volume_data.total_clusters", |
14625 | 14 | FT_UINT64, BASE_DEC, |
14626 | 14 | NULL, 0, "Total Clusters", HFILL }, |
14627 | 14 | }, |
14628 | | |
14629 | 14 | { &hf_smb2_ioctl_get_ntfs_volume_data_free_clusters, { |
14630 | 14 | "FreeClusters", |
14631 | 14 | "smb2.ioctl.get_ntfs_volume_data.free_clusters", |
14632 | 14 | FT_UINT64, BASE_DEC, |
14633 | 14 | NULL, 0, "Free Clusters", HFILL }, |
14634 | 14 | }, |
14635 | | |
14636 | 14 | { &hf_smb2_ioctl_get_ntfs_volume_data_total_reserved, { |
14637 | 14 | "TotalReserved", |
14638 | 14 | "smb2.ioctl.get_ntfs_volume_data.total_reserved", |
14639 | 14 | FT_UINT64, BASE_DEC, |
14640 | 14 | NULL, 0, "Total Reserved", HFILL }, |
14641 | 14 | }, |
14642 | | |
14643 | 14 | { &hf_smb2_ioctl_get_ntfs_volume_data_bytes_per_sector, { |
14644 | 14 | "BytesPerSector", |
14645 | 14 | "smb2.ioctl.get_ntfs_volume_data.bytes_per_sector", |
14646 | 14 | FT_UINT32, BASE_DEC, |
14647 | 14 | NULL, 0, "Bytes Per Sector", HFILL }, |
14648 | 14 | }, |
14649 | | |
14650 | 14 | { &hf_smb2_ioctl_get_ntfs_volume_data_bytes_per_cluster, { |
14651 | 14 | "BytesPerCluster", |
14652 | 14 | "smb2.ioctl.get_ntfs_volume_data.bytes_per_cluster", |
14653 | 14 | FT_UINT32, BASE_DEC, |
14654 | 14 | NULL, 0, "Bytes Per Cluster", HFILL }, |
14655 | 14 | }, |
14656 | | |
14657 | 14 | { &hf_smb2_ioctl_get_ntfs_volume_data_bytes_per_file_record_segment, { |
14658 | 14 | "BytesPerFileRecordSegment", |
14659 | 14 | "smb2.ioctl.get_ntfs_volume_data.bytes_per_file_record_segment", |
14660 | 14 | FT_UINT32, BASE_DEC, |
14661 | 14 | NULL, 0, "Bytes Per File Record Segment", HFILL }, |
14662 | 14 | }, |
14663 | | |
14664 | 14 | { &hf_smb2_ioctl_get_ntfs_volume_data_clusters_per_file_record_segment, { |
14665 | 14 | "ClustersPerFileRecordSegment", |
14666 | 14 | "smb2.ioctl.get_ntfs_volume_data.clusters_per_file_record_segment", |
14667 | 14 | FT_UINT32, BASE_DEC, |
14668 | 14 | NULL, 0, "Clusters Per File Record Segment", HFILL }, |
14669 | 14 | }, |
14670 | | |
14671 | 14 | { &hf_smb2_ioctl_get_ntfs_volume_data_mft_valid_data_length, { |
14672 | 14 | "MftValidDataLength", |
14673 | 14 | "smb2.ioctl.get_ntfs_volume_data.mft_valid_data_length", |
14674 | 14 | FT_UINT64, BASE_DEC, |
14675 | 14 | NULL, 0, "Mft Valid Data Length", HFILL }, |
14676 | 14 | }, |
14677 | | |
14678 | 14 | { &hf_smb2_ioctl_get_ntfs_volume_data_mft_start_lcn, { |
14679 | 14 | "MftStartLcn", |
14680 | 14 | "smb2.ioctl.get_ntfs_volume_data.mft_start_lcn", |
14681 | 14 | FT_UINT64, BASE_DEC, |
14682 | 14 | NULL, 0, "Mft Start Lcn", HFILL }, |
14683 | 14 | }, |
14684 | | |
14685 | 14 | { &hf_smb2_ioctl_get_ntfs_volume_data_mft2_start_lcn, { |
14686 | 14 | "Mft2StartLcn", |
14687 | 14 | "smb2.ioctl.get_ntfs_volume_data.mft2_start_lcn", |
14688 | 14 | FT_UINT64, BASE_DEC, |
14689 | 14 | NULL, 0, "Mft2 Start Lcn", HFILL }, |
14690 | 14 | }, |
14691 | | |
14692 | 14 | { &hf_smb2_ioctl_get_ntfs_volume_data_mft_zone_start, { |
14693 | 14 | "MftZoneStart", |
14694 | 14 | "smb2.ioctl.get_ntfs_volume_data.mft_zone_start", |
14695 | 14 | FT_UINT64, BASE_DEC, |
14696 | 14 | NULL, 0, "Mft Zone Start", HFILL }, |
14697 | 14 | }, |
14698 | | |
14699 | 14 | { &hf_smb2_ioctl_get_ntfs_volume_data_mft_zone_end, { |
14700 | 14 | "MftZoneEnd", |
14701 | 14 | "smb2.ioctl.get_ntfs_volume_data.mft_zone_end", |
14702 | 14 | FT_UINT64, BASE_DEC, |
14703 | 14 | NULL, 0, "Mft Zone End", HFILL }, |
14704 | 14 | }, |
14705 | | |
14706 | 14 | { &hf_smb2_tree_connect_flags, |
14707 | 14 | { "Flags", "smb2.tc.flags", FT_UINT16, BASE_HEX, |
14708 | 14 | NULL, 0, "Tree Connect flags", HFILL } |
14709 | 14 | }, |
14710 | | |
14711 | 14 | { &hf_smb2_tc_cluster_reconnect, |
14712 | 14 | { "Cluster Reconnect", "smb2.tc.cluster_reconnect", FT_BOOLEAN, 16, |
14713 | 14 | TFS(&tfs_set_notset), 0x0001, "If this is a Cluster Reconnect", HFILL } |
14714 | 14 | }, |
14715 | | |
14716 | 14 | { &hf_smb2_tc_redirect_to_owner, |
14717 | 14 | { "Redirect To Owner", "smb2.tc.redirect_to_owner", FT_BOOLEAN, 16, |
14718 | 14 | TFS(&tfs_set_notset), 0x0002, "Set if the client can handle Share Redirects", HFILL } |
14719 | 14 | }, |
14720 | | |
14721 | 14 | { &hf_smb2_tc_extension_present, |
14722 | 14 | { "Extension Present", "smb2.tc.extension_present", FT_BOOLEAN, 16, |
14723 | 14 | TFS(&tfs_set_notset), 0x0004, "Set if an extension structure is present", HFILL } |
14724 | 14 | }, |
14725 | | |
14726 | 14 | { &hf_smb2_tc_reserved, |
14727 | 14 | { "Reserved", "smb2.tc.reserved", FT_UINT16, BASE_HEX, |
14728 | 14 | NULL, 0xFFF8, "Must be zero", HFILL } |
14729 | 14 | }, |
14730 | | |
14731 | 14 | { &hf_smb2_compression_format, |
14732 | 14 | { "Compression Format", "smb2.compression_format", FT_UINT16, BASE_DEC, |
14733 | 14 | VALS(compression_format_vals), 0, NULL, HFILL } |
14734 | 14 | }, |
14735 | | |
14736 | 14 | { &hf_smb2_checksum_algorithm, |
14737 | 14 | { "Checksum Algorithm", "smb2.checksum_algorithm", FT_UINT16, BASE_HEX, |
14738 | 14 | VALS(checksum_algorithm_vals), 0, NULL, HFILL } |
14739 | 14 | }, |
14740 | | |
14741 | 14 | { &hf_smb2_integrity_reserved, |
14742 | 14 | { "Reserved", "smb2.integrity_reserved", FT_UINT16, BASE_DEC, |
14743 | 14 | NULL, 0, NULL, HFILL } |
14744 | 14 | }, |
14745 | | |
14746 | 14 | { &hf_smb2_integrity_flags, |
14747 | 14 | { "Flags", "smb2.integrity_flags", FT_UINT32, BASE_HEX, |
14748 | 14 | NULL, 0, NULL, HFILL } |
14749 | 14 | }, |
14750 | | |
14751 | 14 | { &hf_smb2_integrity_flags_enforcement_off, |
14752 | 14 | { "FSCTL_INTEGRITY_FLAG_CHECKSUM_ENFORCEMENT_OFF", "smb2.integrity_flags_enforcement", FT_BOOLEAN, 32, |
14753 | 14 | NULL, 0x1, "If checksum error enforcement is off", HFILL } |
14754 | 14 | }, |
14755 | | |
14756 | 14 | { &hf_smb2_integrity_crc_chunk_size, |
14757 | 14 | { "Checksum Chunk Size", "smb2.integrity_crc_chunk_size", FT_UINT32, BASE_DEC, |
14758 | 14 | NULL, 0, NULL, HFILL } |
14759 | 14 | }, |
14760 | | |
14761 | 14 | { &hf_smb2_integrity_cluster_size, |
14762 | 14 | { "Cluster Size", "smb2.cluster_size", FT_UINT32, BASE_DEC, |
14763 | 14 | NULL, 0, NULL, HFILL } |
14764 | 14 | }, |
14765 | | |
14766 | 14 | { &hf_smb2_share_type, |
14767 | 14 | { "Share Type", "smb2.share_type", FT_UINT8, BASE_HEX, |
14768 | 14 | VALS(smb2_share_type_vals), 0, "Type of share", HFILL } |
14769 | 14 | }, |
14770 | | |
14771 | 14 | { &hf_smb2_credit_charge, |
14772 | 14 | { "Credit Charge", "smb2.credit.charge", FT_UINT16, BASE_DEC, |
14773 | 14 | NULL, 0, NULL, HFILL } |
14774 | 14 | }, |
14775 | | |
14776 | 14 | { &hf_smb2_credits_requested, |
14777 | 14 | { "Credits requested", "smb2.credits.requested", FT_UINT16, BASE_DEC, |
14778 | 14 | NULL, 0, NULL, HFILL } |
14779 | 14 | }, |
14780 | | |
14781 | 14 | { &hf_smb2_credits_granted, |
14782 | 14 | { "Credits granted", "smb2.credits.granted", FT_UINT16, BASE_DEC, |
14783 | 14 | NULL, 0, NULL, HFILL } |
14784 | 14 | }, |
14785 | | |
14786 | 14 | { &hf_smb2_channel_sequence, |
14787 | 14 | { "Channel Sequence", "smb2.channel_sequence", FT_UINT16, BASE_DEC, |
14788 | 14 | NULL, 0, NULL, HFILL } |
14789 | 14 | }, |
14790 | | |
14791 | 14 | { &hf_smb2_dialect_count, |
14792 | 14 | { "Dialect count", "smb2.dialect_count", FT_UINT16, BASE_DEC, |
14793 | 14 | NULL, 0, NULL, HFILL } |
14794 | 14 | }, |
14795 | | |
14796 | 14 | { &hf_smb2_dialect, |
14797 | 14 | { "Dialect", "smb2.dialect", FT_UINT16, BASE_HEX, |
14798 | 14 | VALS(smb2_dialect_vals), 0, NULL, HFILL } |
14799 | 14 | }, |
14800 | | |
14801 | 14 | { &hf_smb2_security_mode, |
14802 | 14 | { "Security mode", "smb2.sec_mode", FT_UINT8, BASE_HEX, |
14803 | 14 | NULL, 0, NULL, HFILL } |
14804 | 14 | }, |
14805 | | |
14806 | 14 | { &hf_smb2_session_flags, |
14807 | 14 | { "Session Flags", "smb2.session_flags", FT_UINT16, BASE_HEX, |
14808 | 14 | NULL, 0, NULL, HFILL } |
14809 | 14 | }, |
14810 | | |
14811 | 14 | { &hf_smb2_lock_count, |
14812 | 14 | { "Lock Count", "smb2.lock_count", FT_UINT16, BASE_DEC, |
14813 | 14 | NULL, 0, NULL, HFILL } |
14814 | 14 | }, |
14815 | | |
14816 | 14 | { &hf_smb2_lock_sequence_number, |
14817 | 14 | { "Lock Sequence Number", "smb2.lock_sequence_number", FT_UINT32, BASE_DEC, |
14818 | 14 | NULL, 0x0000000F, NULL, HFILL } |
14819 | 14 | }, |
14820 | | |
14821 | 14 | { &hf_smb2_lock_sequence_index, |
14822 | 14 | { "Lock Sequence Index", "smb2.lock_sequence_index", FT_UINT32, BASE_DEC, |
14823 | 14 | NULL, 0xFFFFFFF0, NULL, HFILL } |
14824 | 14 | }, |
14825 | | |
14826 | 14 | { &hf_smb2_capabilities, |
14827 | 14 | { "Capabilities", "smb2.capabilities", FT_UINT32, BASE_HEX, |
14828 | 14 | NULL, 0, NULL, HFILL } |
14829 | 14 | }, |
14830 | | |
14831 | 14 | { &hf_smb2_auth_frame, |
14832 | 14 | { "Authenticated in Frame", "smb2.auth_frame", FT_FRAMENUM, BASE_NONE, |
14833 | 14 | NULL, 0, "Which frame this user was authenticated in", HFILL } |
14834 | 14 | }, |
14835 | | |
14836 | 14 | { &hf_smb2_tcon_frame, |
14837 | 14 | { "Connected in Frame", "smb2.tcon_frame", FT_FRAMENUM, BASE_NONE, |
14838 | 14 | NULL, 0, "Which frame this share was connected in", HFILL } |
14839 | 14 | }, |
14840 | | |
14841 | 14 | { &hf_smb2_tdcon_frame, |
14842 | 14 | { "Disconnected in Frame", "smb2.tdcon_frame", FT_FRAMENUM, BASE_NONE, |
14843 | 14 | NULL, 0, "Which frame this share was disconnected in", HFILL } |
14844 | 14 | }, |
14845 | | |
14846 | 14 | { &hf_smb2_tag, |
14847 | 14 | { "Tag", "smb2.tag", FT_STRING, BASE_NONE, |
14848 | 14 | NULL, 0, "Tag of chain entry", HFILL } |
14849 | 14 | }, |
14850 | | |
14851 | 14 | { &hf_smb2_acct_name, |
14852 | 14 | { "Account", "smb2.acct", FT_STRING, BASE_NONE, |
14853 | 14 | NULL, 0, "Account Name", HFILL } |
14854 | 14 | }, |
14855 | | |
14856 | 14 | { &hf_smb2_domain_name, |
14857 | 14 | { "Domain", "smb2.domain", FT_STRING, BASE_NONE, |
14858 | 14 | NULL, 0, "Domain Name", HFILL } |
14859 | 14 | }, |
14860 | | |
14861 | 14 | { &hf_smb2_host_name, |
14862 | 14 | { "Host", "smb2.host", FT_STRING, BASE_NONE, |
14863 | 14 | NULL, 0, "Host Name", HFILL } |
14864 | 14 | }, |
14865 | | |
14866 | 14 | { &hf_smb2_signature, |
14867 | 14 | { "Signature", "smb2.signature", FT_BYTES, BASE_NONE, |
14868 | 14 | NULL, 0, NULL, HFILL } |
14869 | 14 | }, |
14870 | | |
14871 | 14 | { &hf_smb2_unknown, |
14872 | 14 | { "Unknown", "smb2.unknown", FT_BYTES, BASE_NONE, |
14873 | 14 | NULL, 0, NULL, HFILL } |
14874 | 14 | }, |
14875 | | |
14876 | 14 | { &hf_smb2_twrp_timestamp, |
14877 | 14 | { "Timestamp", "smb2.twrp_timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, |
14878 | 14 | NULL, 0, "TWrp timestamp", HFILL } |
14879 | 14 | }, |
14880 | | |
14881 | 14 | { &hf_smb2_mxac_timestamp, |
14882 | 14 | { "Timestamp", "smb2.mxac_timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, |
14883 | 14 | NULL, 0, "MxAc timestamp", HFILL } |
14884 | 14 | }, |
14885 | | |
14886 | 14 | { &hf_smb2_mxac_status, |
14887 | 14 | { "Query Status", "smb2.mxac_status", FT_UINT32, BASE_HEX | BASE_EXT_STRING, |
14888 | 14 | &NT_errors_ext, 0, "NT Status code", HFILL } |
14889 | 14 | }, |
14890 | | |
14891 | 14 | { &hf_smb2_qfid_fid, |
14892 | 14 | { "Opaque File ID", "smb2.qfid_fid", FT_BYTES, BASE_NONE, |
14893 | 14 | NULL, 0, NULL, HFILL } |
14894 | 14 | }, |
14895 | | |
14896 | 14 | { &hf_smb2_ses_flags_guest, |
14897 | 14 | { "Guest", "smb2.ses_flags.guest", FT_BOOLEAN, 16, |
14898 | 14 | NULL, SES_FLAGS_GUEST, NULL, HFILL } |
14899 | 14 | }, |
14900 | | |
14901 | 14 | { &hf_smb2_ses_flags_null, |
14902 | 14 | { "Null", "smb2.ses_flags.null", FT_BOOLEAN, 16, |
14903 | 14 | NULL, SES_FLAGS_NULL, NULL, HFILL } |
14904 | 14 | }, |
14905 | | |
14906 | 14 | { &hf_smb2_ses_flags_encrypt, |
14907 | 14 | { "Encrypt", "smb2.ses_flags.encrypt", FT_BOOLEAN, 16, |
14908 | 14 | NULL, SES_FLAGS_ENCRYPT, NULL, HFILL }}, |
14909 | | |
14910 | 14 | { &hf_smb2_secmode_flags_sign_required, |
14911 | 14 | { "Signing required", "smb2.sec_mode.sign_required", FT_BOOLEAN, 8, |
14912 | 14 | NULL, NEGPROT_SIGN_REQ, "Is signing required", HFILL } |
14913 | 14 | }, |
14914 | | |
14915 | 14 | { &hf_smb2_secmode_flags_sign_enabled, |
14916 | 14 | { "Signing enabled", "smb2.sec_mode.sign_enabled", FT_BOOLEAN, 8, |
14917 | 14 | NULL, NEGPROT_SIGN_ENABLED, "Is signing enabled", HFILL } |
14918 | 14 | }, |
14919 | | |
14920 | 14 | { &hf_smb2_ses_req_flags, |
14921 | 14 | { "Flags", "smb2.ses_req_flags", FT_UINT8, BASE_DEC, |
14922 | 14 | NULL, 0, NULL, HFILL } |
14923 | 14 | }, |
14924 | | |
14925 | 14 | { &hf_smb2_ses_req_flags_session_binding, |
14926 | 14 | { "Session Binding Request", "smb2.ses_req_flags.session_binding", FT_BOOLEAN, 8, |
14927 | 14 | NULL, SES_REQ_FLAGS_SESSION_BINDING, "The client wants to bind to an existing session", HFILL } |
14928 | 14 | }, |
14929 | | |
14930 | 14 | { &hf_smb2_cap_dfs, |
14931 | 14 | { "DFS", "smb2.capabilities.dfs", FT_BOOLEAN, 32, |
14932 | 14 | TFS(&tfs_cap_dfs), NEGPROT_CAP_DFS, "If the host supports dfs", HFILL } |
14933 | 14 | }, |
14934 | | |
14935 | 14 | { &hf_smb2_cap_leasing, |
14936 | 14 | { "LEASING", "smb2.capabilities.leasing", FT_BOOLEAN, 32, |
14937 | 14 | TFS(&tfs_cap_leasing), NEGPROT_CAP_LEASING, "If the host supports leasing", HFILL } |
14938 | 14 | }, |
14939 | | |
14940 | 14 | { &hf_smb2_cap_large_mtu, |
14941 | 14 | { "LARGE MTU", "smb2.capabilities.large_mtu", FT_BOOLEAN, 32, |
14942 | 14 | TFS(&tfs_cap_large_mtu), NEGPROT_CAP_LARGE_MTU, "If the host supports LARGE MTU", HFILL } |
14943 | 14 | }, |
14944 | | |
14945 | 14 | { &hf_smb2_cap_multi_channel, |
14946 | 14 | { "MULTI CHANNEL", "smb2.capabilities.multi_channel", FT_BOOLEAN, 32, |
14947 | 14 | TFS(&tfs_cap_multi_channel), NEGPROT_CAP_MULTI_CHANNEL, "If the host supports MULTI CHANNEL", HFILL } |
14948 | 14 | }, |
14949 | | |
14950 | 14 | { &hf_smb2_cap_persistent_handles, |
14951 | 14 | { "PERSISTENT HANDLES", "smb2.capabilities.persistent_handles", FT_BOOLEAN, 32, |
14952 | 14 | TFS(&tfs_cap_persistent_handles), NEGPROT_CAP_PERSISTENT_HANDLES, "If the host supports PERSISTENT HANDLES", HFILL } |
14953 | 14 | }, |
14954 | | |
14955 | 14 | { &hf_smb2_cap_directory_leasing, |
14956 | 14 | { "DIRECTORY LEASING", "smb2.capabilities.directory_leasing", FT_BOOLEAN, 32, |
14957 | 14 | TFS(&tfs_cap_directory_leasing), NEGPROT_CAP_DIRECTORY_LEASING, "If the host supports DIRECTORY LEASING", HFILL } |
14958 | 14 | }, |
14959 | | |
14960 | 14 | { &hf_smb2_cap_encryption, |
14961 | 14 | { "ENCRYPTION", "smb2.capabilities.encryption", FT_BOOLEAN, 32, |
14962 | 14 | TFS(&tfs_cap_encryption), NEGPROT_CAP_ENCRYPTION, "If the host supports ENCRYPTION", HFILL } |
14963 | 14 | }, |
14964 | | |
14965 | 14 | { &hf_smb2_cap_notifications, |
14966 | 14 | { "NOTIFICATIONS", "smb2.capabilities.notifications", FT_BOOLEAN, 32, |
14967 | 14 | TFS(&tfs_cap_notifications), NEGPROT_CAP_NOTIFICATIONS, "If the host supports receiving notifications from server", HFILL } |
14968 | 14 | }, |
14969 | | |
14970 | 14 | { &hf_smb2_max_trans_size, |
14971 | 14 | { "Max Transaction Size", "smb2.max_trans_size", FT_UINT32, BASE_DEC, |
14972 | 14 | NULL, 0, NULL, HFILL } |
14973 | 14 | }, |
14974 | | |
14975 | 14 | { &hf_smb2_max_read_size, |
14976 | 14 | { "Max Read Size", "smb2.max_read_size", FT_UINT32, BASE_DEC, |
14977 | 14 | NULL, 0, NULL, HFILL } |
14978 | 14 | }, |
14979 | | |
14980 | 14 | { &hf_smb2_max_write_size, |
14981 | 14 | { "Max Write Size", "smb2.max_write_size", FT_UINT32, BASE_DEC, |
14982 | 14 | NULL, 0, NULL, HFILL } |
14983 | 14 | }, |
14984 | | |
14985 | 14 | { &hf_smb2_channel, |
14986 | 14 | { "Channel", "smb2.channel", FT_UINT32, BASE_HEX, |
14987 | 14 | VALS(smb2_channel_vals), 0, NULL, HFILL } |
14988 | 14 | }, |
14989 | | |
14990 | 14 | { &hf_smb2_rdma_v1_offset, |
14991 | 14 | { "Offset", "smb2.buffer_descriptor.offset", FT_UINT64, BASE_DEC, |
14992 | 14 | NULL, 0, NULL, HFILL } |
14993 | 14 | }, |
14994 | | |
14995 | 14 | { &hf_smb2_rdma_v1_token, |
14996 | 14 | { "Token", "smb2.buffer_descriptor.token", FT_UINT32, BASE_HEX, |
14997 | 14 | NULL, 0, NULL, HFILL } |
14998 | 14 | }, |
14999 | | |
15000 | 14 | { &hf_smb2_rdma_v1_length, |
15001 | 14 | { "Length", "smb2.buffer_descriptor.length", FT_UINT32, BASE_DEC, |
15002 | 14 | NULL, 0, NULL, HFILL } |
15003 | 14 | }, |
15004 | | |
15005 | 14 | { &hf_smb2_share_flags, |
15006 | 14 | { "Share flags", "smb2.share_flags", FT_UINT32, BASE_HEX, |
15007 | 14 | NULL, 0, NULL, HFILL } |
15008 | 14 | }, |
15009 | | |
15010 | 14 | { &hf_smb2_share_flags_dfs, |
15011 | 14 | { "DFS", "smb2.share_flags.dfs", FT_BOOLEAN, 32, |
15012 | 14 | NULL, SHARE_FLAGS_dfs, "The specified share is present in a Distributed File System (DFS) tree structure", HFILL } |
15013 | 14 | }, |
15014 | | |
15015 | 14 | { &hf_smb2_share_flags_dfs_root, |
15016 | 14 | { "DFS root", "smb2.share_flags.dfs_root", FT_BOOLEAN, 32, |
15017 | 14 | NULL, SHARE_FLAGS_dfs_root, "The specified share is present in a Distributed File System (DFS) tree structure", HFILL } |
15018 | 14 | }, |
15019 | | |
15020 | 14 | { &hf_smb2_share_flags_restrict_exclusive_opens, |
15021 | 14 | { "Restrict exclusive opens", "smb2.share_flags.restrict_exclusive_opens", FT_BOOLEAN, 32, |
15022 | 14 | NULL, SHARE_FLAGS_restrict_exclusive_opens, "The specified share disallows exclusive file opens that deny reads to an open file", HFILL } |
15023 | 14 | }, |
15024 | | |
15025 | 14 | { &hf_smb2_share_flags_force_shared_delete, |
15026 | 14 | { "Force shared delete", "smb2.share_flags.force_shared_delete", FT_BOOLEAN, 32, |
15027 | 14 | NULL, SHARE_FLAGS_force_shared_delete, "Shared files in the specified share can be forcibly deleted", HFILL } |
15028 | 14 | }, |
15029 | | |
15030 | 14 | { &hf_smb2_share_flags_allow_namespace_caching, |
15031 | 14 | { "Allow namespace caching", "smb2.share_flags.allow_namespace_caching", FT_BOOLEAN, 32, |
15032 | 14 | NULL, SHARE_FLAGS_allow_namespace_caching, "Clients are allowed to cache the namespace of the specified share", HFILL } |
15033 | 14 | }, |
15034 | | |
15035 | 14 | { &hf_smb2_share_flags_access_based_dir_enum, |
15036 | 14 | { "Access based directory enum", "smb2.share_flags.access_based_dir_enum", FT_BOOLEAN, 32, |
15037 | 14 | NULL, SHARE_FLAGS_access_based_dir_enum, "The server will filter directory entries based on the access permissions of the client", HFILL } |
15038 | 14 | }, |
15039 | | |
15040 | 14 | { &hf_smb2_share_flags_force_levelii_oplock, |
15041 | 14 | { "Force level II oplock", "smb2.share_flags.force_levelii_oplock", FT_BOOLEAN, 32, |
15042 | 14 | NULL, SHARE_FLAGS_force_levelii_oplock, "The server will not issue exclusive caching rights on this share", HFILL } |
15043 | 14 | }, |
15044 | | |
15045 | 14 | { &hf_smb2_share_flags_enable_hash_v1, |
15046 | 14 | { "Enable hash V1", "smb2.share_flags.enable_hash_v1", FT_BOOLEAN, 32, |
15047 | 14 | NULL, SHARE_FLAGS_enable_hash_v1, "The share supports hash generation V1 for branch cache retrieval of data (see also section 2.2.31.2 of MS-SMB2)", HFILL } |
15048 | 14 | }, |
15049 | | |
15050 | 14 | { &hf_smb2_share_flags_enable_hash_v2, |
15051 | 14 | { "Enable hash V2", "smb2.share_flags.enable_hash_v2", FT_BOOLEAN, 32, |
15052 | 14 | NULL, SHARE_FLAGS_enable_hash_v2, "The share supports hash generation V2 for branch cache retrieval of data (see also section 2.2.31.2 of MS-SMB2)", HFILL } |
15053 | 14 | }, |
15054 | | |
15055 | 14 | { &hf_smb2_share_flags_encrypt_data, |
15056 | 14 | { "Encrypted data required", "smb2.share_flags.encrypt_data", FT_BOOLEAN, 32, |
15057 | 14 | NULL, SHARE_FLAGS_encryption_required, "The share require data encryption", HFILL } |
15058 | 14 | }, |
15059 | | |
15060 | 14 | { &hf_smb2_share_flags_identity_remoting, |
15061 | 14 | { "Identity Remoting", "smb2.share_flags.identity_remoting", FT_BOOLEAN, 32, |
15062 | 14 | NULL, SHARE_FLAGS_identity_remoting, "The specified share supports Identity Remoting", HFILL } |
15063 | 14 | }, |
15064 | | |
15065 | 14 | { &hf_smb2_share_flags_compress_data, |
15066 | 14 | { "Compressed IO", "smb2.share_flags.compress_data", FT_BOOLEAN, 32, |
15067 | 14 | NULL, SHARE_FLAGS_compress_data, "The share supports compression of read/write messages", HFILL } |
15068 | 14 | }, |
15069 | | |
15070 | 14 | { &hf_smb2_share_flags_isolated_transport, |
15071 | 14 | { "Isolated Transport", "smb2.share_flags.isolated_transport", FT_BOOLEAN, 32, |
15072 | 14 | NULL, SHARE_FLAGS_isolated_transport, "The server indicates that administrator set share property telling client that it is preferable to isolate communication to that share on a separate set of connections.", HFILL } |
15073 | 14 | }, |
15074 | | |
15075 | 14 | { &hf_smb2_share_caching, |
15076 | 14 | { "Caching policy", "smb2.share.caching", FT_UINT32, BASE_HEX, |
15077 | 14 | VALS(share_cache_vals), 0, NULL, HFILL } |
15078 | 14 | }, |
15079 | | |
15080 | 14 | { &hf_smb2_share_caps, |
15081 | 14 | { "Share Capabilities", "smb2.share_caps", FT_UINT32, BASE_HEX, |
15082 | 14 | NULL, 0, NULL, HFILL } |
15083 | 14 | }, |
15084 | | |
15085 | 14 | { &hf_smb2_share_caps_dfs, |
15086 | 14 | { "DFS", "smb2.share_caps.dfs", FT_BOOLEAN, 32, |
15087 | 14 | NULL, SHARE_CAPS_DFS, "The specified share is present in a DFS tree structure", HFILL } |
15088 | 14 | }, |
15089 | | |
15090 | 14 | { &hf_smb2_share_caps_continuous_availability, |
15091 | 14 | { "CONTINUOUS AVAILABILITY", "smb2.share_caps.continuous_availability", FT_BOOLEAN, 32, |
15092 | 14 | NULL, SHARE_CAPS_CONTINUOUS_AVAILABILITY, "The specified share is continuously available", HFILL } |
15093 | 14 | }, |
15094 | | |
15095 | 14 | { &hf_smb2_share_caps_scaleout, |
15096 | 14 | { "SCALEOUT", "smb2.share_caps.scaleout", FT_BOOLEAN, 32, |
15097 | 14 | NULL, SHARE_CAPS_SCALEOUT, "The specified share is a scaleout share", HFILL } |
15098 | 14 | }, |
15099 | | |
15100 | 14 | { &hf_smb2_share_caps_cluster, |
15101 | 14 | { "CLUSTER", "smb2.share_caps.cluster", FT_BOOLEAN, 32, |
15102 | 14 | NULL, SHARE_CAPS_CLUSTER, "The specified share is a cluster share", HFILL } |
15103 | 14 | }, |
15104 | | |
15105 | 14 | { &hf_smb2_share_caps_asymmetric, |
15106 | 14 | { "ASYMMETRIC", "smb2.share_caps.asymmetric", FT_BOOLEAN, 32, |
15107 | 14 | NULL, SHARE_CAPS_ASYMMETRIC, "The specified share allows dynamic changes in ownership of the share", HFILL } |
15108 | 14 | }, |
15109 | | |
15110 | 14 | { &hf_smb2_share_caps_redirect_to_owner, |
15111 | 14 | { "REDIRECT_TO_OWNER", "smb2.share_caps.redirect_to_owner", FT_BOOLEAN, 32, |
15112 | 14 | NULL, SHARE_CAPS_REDIRECT_TO_OWNER, "The specified share supports synchronous share level redirection", HFILL } |
15113 | 14 | }, |
15114 | | |
15115 | 14 | { &hf_smb2_ioctl_flags, |
15116 | 14 | { "Flags", "smb2.ioctl.flags", FT_UINT32, BASE_HEX, |
15117 | 14 | NULL, 0, NULL, HFILL } |
15118 | 14 | }, |
15119 | | |
15120 | 14 | { &hf_smb2_min_count, |
15121 | 14 | { "Min Count", "smb2.min_count", FT_UINT32, BASE_DEC, |
15122 | 14 | NULL, 0, NULL, HFILL } |
15123 | 14 | }, |
15124 | | |
15125 | 14 | { &hf_smb2_remaining_bytes, |
15126 | 14 | { "Remaining Bytes", "smb2.remaining_bytes", FT_UINT32, BASE_DEC, |
15127 | 14 | NULL, 0, NULL, HFILL } |
15128 | 14 | }, |
15129 | | |
15130 | 14 | { &hf_smb2_channel_info_offset, |
15131 | 14 | { "Channel Info Offset", "smb2.channel_info_offset", FT_UINT16, BASE_DEC, |
15132 | 14 | NULL, 0, NULL, HFILL } |
15133 | 14 | }, |
15134 | | |
15135 | 14 | { &hf_smb2_channel_info_length, |
15136 | 14 | { "Channel Info Length", "smb2.channel_info_length", FT_UINT16, BASE_DEC, |
15137 | 14 | NULL, 0, NULL, HFILL } |
15138 | 14 | }, |
15139 | | |
15140 | 14 | { &hf_smb2_channel_info_blob, |
15141 | 14 | { "Channel Info Blob", "smb2.channel_info_blob", FT_NONE, BASE_NONE, |
15142 | 14 | NULL, 0, NULL, HFILL } |
15143 | 14 | }, |
15144 | | |
15145 | 14 | { &hf_smb2_ioctl_is_fsctl, |
15146 | 14 | { "Is FSCTL", "smb2.ioctl.is_fsctl", FT_BOOLEAN, 32, |
15147 | 14 | NULL, 0x00000001, NULL, HFILL } |
15148 | 14 | }, |
15149 | | |
15150 | 14 | { &hf_smb2_output_buffer_len, |
15151 | 14 | { "Output Buffer Length", "smb2.output_buffer_len", FT_UINT32, BASE_DEC, |
15152 | 14 | NULL, 0, NULL, HFILL } |
15153 | 14 | }, |
15154 | | |
15155 | 14 | { &hf_smb2_close_pq_attrib, |
15156 | 14 | { "PostQuery Attrib", "smb2.close.pq_attrib", FT_BOOLEAN, 16, |
15157 | 14 | NULL, 0x0001, NULL, HFILL } |
15158 | 14 | }, |
15159 | | |
15160 | 14 | { &hf_smb2_notify_watch_tree, |
15161 | 14 | { "Watch Tree", "smb2.notify.watch_tree", FT_BOOLEAN, 16, |
15162 | 14 | NULL, 0x0001, NULL, HFILL } |
15163 | 14 | }, |
15164 | | |
15165 | 14 | { &hf_smb2_notify_out_data, |
15166 | 14 | { "Out Data", "smb2.notify.out", FT_NONE, BASE_NONE, |
15167 | 14 | NULL, 0, NULL, HFILL } |
15168 | 14 | }, |
15169 | | |
15170 | 14 | { &hf_smb2_notify_info, |
15171 | 14 | { "Notify Info", "smb2.notify.info", FT_NONE, BASE_NONE, |
15172 | 14 | NULL, 0, NULL, HFILL } |
15173 | 14 | }, |
15174 | | |
15175 | 14 | { &hf_smb2_notify_next_offset, |
15176 | 14 | { "Next Offset", "smb2.notify.next_offset", FT_UINT32, BASE_HEX, |
15177 | 14 | NULL, 0, "Offset to next entry in chain or 0", HFILL } |
15178 | 14 | }, |
15179 | | |
15180 | 14 | { &hf_smb2_notify_action, |
15181 | 14 | { "Action", "smb2.notify.action", FT_UINT32, BASE_HEX, |
15182 | 14 | VALS(notify_action_vals), 0, "Notify Action", HFILL } |
15183 | 14 | }, |
15184 | | |
15185 | | |
15186 | 14 | { &hf_smb2_find_flags_restart_scans, |
15187 | 14 | { "Restart Scans", "smb2.find.restart_scans", FT_BOOLEAN, 8, |
15188 | 14 | NULL, SMB2_FIND_FLAG_RESTART_SCANS, NULL, HFILL } |
15189 | 14 | }, |
15190 | | |
15191 | 14 | { &hf_smb2_find_flags_single_entry, |
15192 | 14 | { "Single Entry", "smb2.find.single_entry", FT_BOOLEAN, 8, |
15193 | 14 | NULL, SMB2_FIND_FLAG_SINGLE_ENTRY, NULL, HFILL } |
15194 | 14 | }, |
15195 | | |
15196 | 14 | { &hf_smb2_find_flags_index_specified, |
15197 | 14 | { "Index Specified", "smb2.find.index_specified", FT_BOOLEAN, 8, |
15198 | 14 | NULL, SMB2_FIND_FLAG_INDEX_SPECIFIED, NULL, HFILL } |
15199 | 14 | }, |
15200 | | |
15201 | 14 | { &hf_smb2_find_flags_reopen, |
15202 | 14 | { "Reopen", "smb2.find.reopen", FT_BOOLEAN, 8, |
15203 | 14 | NULL, SMB2_FIND_FLAG_REOPEN, NULL, HFILL } |
15204 | 14 | }, |
15205 | | |
15206 | 14 | { &hf_smb2_file_index, |
15207 | 14 | { "File Index", "smb2.file_index", FT_UINT32, BASE_HEX, |
15208 | 14 | NULL, 0, NULL, HFILL } |
15209 | 14 | }, |
15210 | | |
15211 | 14 | { &hf_smb2_file_directory_info, |
15212 | 14 | { "FileDirectoryInfo", "smb2.find.file_directory_info", FT_NONE, BASE_NONE, |
15213 | 14 | NULL, 0, NULL, HFILL } |
15214 | 14 | }, |
15215 | | |
15216 | 14 | { &hf_smb2_full_directory_info, |
15217 | 14 | { "FullDirectoryInfo", "smb2.find.full_directory_info", FT_NONE, BASE_NONE, |
15218 | 14 | NULL, 0, NULL, HFILL } |
15219 | 14 | }, |
15220 | | |
15221 | 14 | { &hf_smb2_both_directory_info, |
15222 | 14 | { "FileBothDirectoryInfo", "smb2.find.both_directory_info", FT_NONE, BASE_NONE, |
15223 | 14 | NULL, 0, NULL, HFILL } |
15224 | 14 | }, |
15225 | | |
15226 | 14 | { &hf_smb2_id_both_directory_info, |
15227 | 14 | { "FileIdBothDirectoryInfo", "smb2.find.id_both_directory_info", FT_NONE, BASE_NONE, |
15228 | 14 | NULL, 0, NULL, HFILL } |
15229 | 14 | }, |
15230 | | |
15231 | 14 | { &hf_smb2_posix_info, |
15232 | 14 | { "FilePosixInfo", "smb2.find.posix_info", FT_NONE, BASE_NONE, |
15233 | 14 | NULL, 0, NULL, HFILL } |
15234 | 14 | }, |
15235 | | |
15236 | 14 | { &hf_smb2_short_name_len, |
15237 | 14 | { "Short Name Length", "smb2.short_name_len", FT_UINT8, BASE_DEC, |
15238 | 14 | NULL, 0, NULL, HFILL } |
15239 | 14 | }, |
15240 | | |
15241 | 14 | { &hf_smb2_short_name, |
15242 | 14 | { "Short Name", "smb2.shortname", FT_STRING, BASE_NONE, |
15243 | 14 | NULL, 0, NULL, HFILL } |
15244 | 14 | }, |
15245 | | |
15246 | 14 | { &hf_smb2_lock_info, |
15247 | 14 | { "Lock Info", "smb2.lock_info", FT_NONE, BASE_NONE, |
15248 | 14 | NULL, 0, NULL, HFILL } |
15249 | 14 | }, |
15250 | | |
15251 | 14 | { &hf_smb2_lock_length, |
15252 | 14 | { "Length", "smb2.lock_length", FT_UINT64, BASE_DEC, |
15253 | 14 | NULL, 0, NULL, HFILL } |
15254 | 14 | }, |
15255 | | |
15256 | 14 | { &hf_smb2_lock_flags, |
15257 | 14 | { "Flags", "smb2.lock_flags", FT_UINT32, BASE_HEX, |
15258 | 14 | NULL, 0, NULL, HFILL } |
15259 | 14 | }, |
15260 | | |
15261 | 14 | { &hf_smb2_lock_flags_shared, |
15262 | 14 | { "Shared", "smb2.lock_flags.shared", FT_BOOLEAN, 32, |
15263 | 14 | NULL, 0x00000001, NULL, HFILL } |
15264 | 14 | }, |
15265 | | |
15266 | 14 | { &hf_smb2_lock_flags_exclusive, |
15267 | 14 | { "Exclusive", "smb2.lock_flags.exclusive", FT_BOOLEAN, 32, |
15268 | 14 | NULL, 0x00000002, NULL, HFILL } |
15269 | 14 | }, |
15270 | | |
15271 | 14 | { &hf_smb2_lock_flags_unlock, |
15272 | 14 | { "Unlock", "smb2.lock_flags.unlock", FT_BOOLEAN, 32, |
15273 | 14 | NULL, 0x00000004, NULL, HFILL } |
15274 | 14 | }, |
15275 | | |
15276 | 14 | { &hf_smb2_lock_flags_fail_immediately, |
15277 | 14 | { "Fail Immediately", "smb2.lock_flags.fail_immediately", FT_BOOLEAN, 32, |
15278 | 14 | NULL, 0x00000010, NULL, HFILL } |
15279 | 14 | }, |
15280 | | |
15281 | 14 | { &hf_smb2_error_context_count, |
15282 | 14 | { "Error Context Count", "smb2.error.context_count", FT_UINT8, BASE_DEC, |
15283 | 14 | NULL, 0, NULL, HFILL } |
15284 | 14 | }, |
15285 | | |
15286 | 14 | { &hf_smb2_error_reserved, |
15287 | 14 | { "Reserved", "smb2.error.reserved", FT_UINT8, BASE_HEX, |
15288 | 14 | NULL, 0, NULL, HFILL } |
15289 | 14 | }, |
15290 | | |
15291 | 14 | { &hf_smb2_error_byte_count, |
15292 | 14 | { "Byte Count", "smb2.error.byte_count", FT_UINT32, BASE_DEC, |
15293 | 14 | NULL, 0, NULL, HFILL } |
15294 | 14 | }, |
15295 | | |
15296 | 14 | { &hf_smb2_error_data, |
15297 | 14 | { "Error Data", "smb2.error.data", FT_BYTES, BASE_NONE, |
15298 | 14 | NULL, 0, NULL, HFILL } |
15299 | 14 | }, |
15300 | | |
15301 | 14 | { &hf_smb2_error_context, |
15302 | 14 | { "Error Context", "smb2.error.context", FT_BYTES, BASE_NONE, |
15303 | 14 | NULL, 0, NULL, HFILL } |
15304 | 14 | }, |
15305 | | |
15306 | 14 | { &hf_smb2_error_context_id, |
15307 | 14 | { "Type", "smb2.error.context.id", FT_UINT32, BASE_HEX, |
15308 | 14 | VALS(smb2_error_id_vals), 0, NULL, HFILL } |
15309 | 14 | }, |
15310 | | |
15311 | 14 | { &hf_smb2_error_context_length, |
15312 | 14 | { "Type", "smb2.error.context.length", FT_UINT32, BASE_DEC, |
15313 | 14 | NULL, 0, NULL, HFILL } |
15314 | 14 | }, |
15315 | | |
15316 | 14 | { &hf_smb2_error_min_buf_length, |
15317 | 14 | { "Minimum required buffer length", "smb2.error.min_buf_length", FT_UINT32, BASE_DEC, |
15318 | 14 | NULL, 0, NULL, HFILL } |
15319 | 14 | }, |
15320 | | |
15321 | 14 | { &hf_smb2_error_redir_context, |
15322 | 14 | { "Share Redirect", "smb2.error.share_redirect", FT_NONE, BASE_NONE, |
15323 | 14 | NULL, 0, NULL, HFILL } |
15324 | 14 | }, |
15325 | | |
15326 | 14 | { &hf_smb2_error_redir_struct_size, |
15327 | 14 | { "Struct Size", "smb2.error.share_redirect.struct_size", FT_UINT32, BASE_DEC, |
15328 | 14 | NULL, 0, NULL, HFILL } |
15329 | 14 | }, |
15330 | | |
15331 | 14 | { &hf_smb2_error_redir_notif_type, |
15332 | 14 | { "Notification Type", "smb2.error.share_redirect.notif_type", FT_UINT32, BASE_DEC, |
15333 | 14 | NULL, 0, NULL, HFILL } |
15334 | 14 | }, |
15335 | | |
15336 | 14 | { &hf_smb2_error_redir_flags, |
15337 | 14 | { "Flags", "smb2.error.share_redirect.flags", FT_UINT16, BASE_HEX, |
15338 | 14 | NULL, 0, NULL, HFILL } |
15339 | 14 | }, |
15340 | | |
15341 | 14 | { &hf_smb2_error_redir_target_type, |
15342 | 14 | { "Target Type", "smb2.error.share_redirect.target_type", FT_UINT16, BASE_HEX, |
15343 | 14 | NULL, 0, NULL, HFILL } |
15344 | 14 | }, |
15345 | | |
15346 | 14 | { &hf_smb2_error_redir_ip_count, |
15347 | 14 | { "IP Addr Count", "smb2.error.share_redirect.ip_count", FT_UINT32, BASE_DEC, |
15348 | 14 | NULL, 0, NULL, HFILL } |
15349 | 14 | }, |
15350 | | |
15351 | 14 | { &hf_smb2_error_redir_ip_list, |
15352 | 14 | { "IP Addr List", "smb2.error.share_redirect.ip_list", FT_NONE, BASE_NONE, |
15353 | 14 | NULL, 0, NULL, HFILL } |
15354 | 14 | }, |
15355 | | |
15356 | 14 | { &hf_smb2_error_redir_res_name, |
15357 | 14 | { "Resource Name", "smb2.error.share_redirect.res_name", FT_STRING, BASE_NONE, |
15358 | 14 | NULL, 0, NULL, HFILL } |
15359 | 14 | }, |
15360 | | |
15361 | 14 | { &hf_smb2_reserved, |
15362 | 14 | { "Reserved", "smb2.reserved", FT_BYTES, BASE_NONE, |
15363 | 14 | NULL, 0, NULL, HFILL } |
15364 | 14 | }, |
15365 | | |
15366 | 14 | { &hf_smb2_reserved_random, |
15367 | 14 | { "Reserved (Random)", "smb2.reserved.random", FT_BYTES, BASE_NONE, |
15368 | 14 | NULL, 0, "Reserved bytes, random data", HFILL } |
15369 | 14 | }, |
15370 | | |
15371 | 14 | { &hf_smb2_root_directory_mbz, |
15372 | 14 | { "Root Dir Handle (MBZ)", "smb2.root_directory", FT_BYTES, BASE_NONE, |
15373 | 14 | NULL, 0, NULL, HFILL } |
15374 | 14 | }, |
15375 | | |
15376 | 14 | { &hf_smb2_dhnq_buffer_reserved, |
15377 | 14 | { "Reserved", "smb2.dhnq_buffer_reserved", FT_UINT64, BASE_HEX, |
15378 | 14 | NULL, 0, NULL, HFILL } |
15379 | 14 | }, |
15380 | | |
15381 | 14 | { &hf_smb2_dh2x_buffer_timeout, |
15382 | 14 | { "Timeout", "smb2.dh2x.timeout", FT_UINT32, BASE_DEC, |
15383 | 14 | NULL, 0, NULL, HFILL } |
15384 | 14 | }, |
15385 | | |
15386 | 14 | { &hf_smb2_dh2x_buffer_flags, |
15387 | 14 | { "Flags", "smb2.dh2x.flags", FT_UINT32, BASE_HEX, |
15388 | 14 | NULL, 0, NULL, HFILL } |
15389 | 14 | }, |
15390 | | |
15391 | 14 | { &hf_smb2_dh2x_buffer_flags_persistent_handle, |
15392 | 14 | { "Persistent Handle", "smb2.dh2x.flags.persistent_handle", FT_BOOLEAN, 32, |
15393 | 14 | NULL, SMB2_DH2X_FLAGS_PERSISTENT_HANDLE, NULL, HFILL } |
15394 | 14 | }, |
15395 | | |
15396 | 14 | { &hf_smb2_dh2x_buffer_reserved, |
15397 | 14 | { "Reserved", "smb2.dh2x.reserved", FT_UINT64, BASE_HEX, |
15398 | 14 | NULL, 0, NULL, HFILL } |
15399 | 14 | }, |
15400 | | |
15401 | 14 | { &hf_smb2_dh2x_buffer_create_guid, |
15402 | 14 | { "Create Guid", "smb2.dh2x.create_guid", FT_GUID, BASE_NONE, |
15403 | 14 | NULL, 0, NULL, HFILL } |
15404 | 14 | }, |
15405 | | |
15406 | 14 | { &hf_smb2_APP_INSTANCE_buffer_struct_size, |
15407 | 14 | { "Struct Size", "smb2.app_instance.struct_size", FT_UINT16, BASE_DEC, |
15408 | 14 | NULL, 0, NULL, HFILL } |
15409 | 14 | }, |
15410 | | |
15411 | 14 | { &hf_smb2_APP_INSTANCE_buffer_reserved, |
15412 | 14 | { "Reserved", "smb2.app_instance.reserved", FT_UINT16, BASE_HEX, |
15413 | 14 | NULL, 0, NULL, HFILL } |
15414 | 14 | }, |
15415 | | |
15416 | 14 | { &hf_smb2_APP_INSTANCE_buffer_app_guid, |
15417 | 14 | { "Application Guid", "smb2.app_instance.app_guid", FT_GUID, BASE_NONE, |
15418 | 14 | NULL, 0, NULL, HFILL } |
15419 | 14 | }, |
15420 | | |
15421 | 14 | { &hf_smb2_svhdx_open_device_context_version, |
15422 | 14 | { "Version", "smb2.svhdx_open_device_context.version", FT_UINT32, BASE_DEC, |
15423 | 14 | NULL, 0, NULL, HFILL } |
15424 | 14 | }, |
15425 | | |
15426 | 14 | { &hf_smb2_svhdx_open_device_context_has_initiator_id, |
15427 | 14 | { "HasInitiatorId", "smb2.svhdx_open_device_context.initiator_has_id", FT_BOOLEAN, BASE_NONE, |
15428 | 14 | TFS(&tfs_smb2_svhdx_has_initiator_id), 0, "Whether the host has an initiator", HFILL } |
15429 | 14 | }, |
15430 | | |
15431 | 14 | { &hf_smb2_svhdx_open_device_context_reserved, |
15432 | 14 | { "Reserved", "smb2.svhdx_open_device_context.reserved", FT_BYTES, BASE_NONE, |
15433 | 14 | NULL, 0, NULL, HFILL } |
15434 | 14 | }, |
15435 | | |
15436 | 14 | { &hf_smb2_svhdx_open_device_context_initiator_id, |
15437 | 14 | { "InitiatorId", "smb2.svhdx_open_device_context.initiator_id", FT_GUID, BASE_NONE, |
15438 | 14 | NULL, 0, NULL, HFILL } |
15439 | 14 | }, |
15440 | | |
15441 | 14 | { &hf_smb2_svhdx_open_device_context_flags, |
15442 | 14 | { "Flags", "smb2.svhdx_open_device_context.flags", FT_UINT32, BASE_HEX, |
15443 | 14 | NULL, 0, NULL, HFILL } |
15444 | 14 | }, |
15445 | | |
15446 | 14 | { &hf_smb2_svhdx_open_device_context_originator_flags, |
15447 | 14 | { "OriginatorFlags", "smb2.svhdx_open_device_context.originator_flags", FT_UINT32, BASE_HEX, |
15448 | 14 | VALS(originator_flags_vals), 0, NULL, HFILL } |
15449 | 14 | }, |
15450 | | |
15451 | 14 | { &hf_smb2_svhdx_open_device_context_open_request_id, |
15452 | 14 | { "OpenRequestId","smb2.svhxd_open_device_context.open_request_id", FT_UINT64, BASE_HEX, |
15453 | 14 | NULL, 0, NULL, HFILL } |
15454 | 14 | }, |
15455 | | |
15456 | 14 | { &hf_smb2_svhdx_open_device_context_initiator_host_name_len, |
15457 | 14 | { "HostNameLength", "smb2.svhxd_open_device_context.initiator_host_name_len", FT_UINT16, BASE_DEC, |
15458 | 14 | NULL, 0, NULL, HFILL } |
15459 | 14 | }, |
15460 | | |
15461 | 14 | { &hf_smb2_svhdx_open_device_context_initiator_host_name, |
15462 | 14 | { "HostName", "smb2.svhdx_open_device_context.host_name", FT_STRING, BASE_NONE, |
15463 | 14 | NULL, 0, NULL, HFILL } |
15464 | 14 | }, |
15465 | | |
15466 | 14 | { &hf_smb2_svhdx_open_device_context_virtual_disk_properties_initialized, |
15467 | 14 | { "VirtualDiskPropertiesInitialized", "smb2.svhdx_open_device_context.virtual_disk_properties_initialized", FT_BOOLEAN, BASE_NONE, |
15468 | 14 | NULL, 0, "Whether VirtualSectorSize, PhysicalSectorSize, and VirtualSize fields are filled", HFILL } |
15469 | 14 | }, |
15470 | | |
15471 | 14 | { &hf_smb2_svhdx_open_device_context_server_service_version, |
15472 | 14 | { "ServerServiceVersion", "smb2.svhdx_open_device_context.server_service_version", FT_UINT32, BASE_DEC, |
15473 | 14 | NULL, 0, "The current version of the protocol running on the server", HFILL } |
15474 | 14 | }, |
15475 | | |
15476 | 14 | { &hf_smb2_svhdx_open_device_context_virtual_sector_size, |
15477 | 14 | { "VirtualSectorSize", "smb2.svhdx_open_device_context.virtual_sector_size", FT_UINT32, BASE_DEC, |
15478 | 14 | NULL, 0, "The virtual sector size of the virtual disk", HFILL } |
15479 | 14 | }, |
15480 | | |
15481 | 14 | { &hf_smb2_svhdx_open_device_context_physical_sector_size, |
15482 | 14 | { "PhysicalSectorSize", "smb2.svhdx_open_device_context.physical_sector_size", FT_UINT32, BASE_DEC, |
15483 | 14 | NULL, 0, "The physical sector size of the virtual disk", HFILL } |
15484 | 14 | }, |
15485 | | |
15486 | 14 | { &hf_smb2_svhdx_open_device_context_virtual_size, |
15487 | 14 | { "VirtualSize", "smb2.svhdx_open_device_context.virtual_size", FT_UINT64, BASE_DEC, |
15488 | 14 | NULL, 0, "The current length of the virtual disk, in bytes", HFILL } |
15489 | 14 | }, |
15490 | | |
15491 | 14 | { &hf_smb2_app_instance_version_struct_size, |
15492 | 14 | { "Struct Size", "smb2.app_instance_version.struct_size", FT_UINT16, BASE_DEC, |
15493 | 14 | NULL, 0, NULL, HFILL } |
15494 | 14 | }, |
15495 | | |
15496 | 14 | { &hf_smb2_app_instance_version_reserved, |
15497 | 14 | { "Reserved", "smb2.app_instance_version.reserved", FT_UINT16, BASE_DEC, |
15498 | 14 | NULL, 0, NULL, HFILL } |
15499 | 14 | }, |
15500 | | |
15501 | 14 | { &hf_smb2_app_instance_version_padding, |
15502 | 14 | { "Padding", "smb2.app_instance_version.padding", FT_UINT32, BASE_HEX, |
15503 | 14 | NULL, 0, NULL, HFILL } |
15504 | 14 | }, |
15505 | | |
15506 | 14 | { &hf_smb2_app_instance_version_high, |
15507 | 14 | { "AppInstanceVersionHigh", "smb2.app_instance_version.version.high", FT_UINT64, BASE_DEC, |
15508 | 14 | NULL, 0, NULL, HFILL } |
15509 | 14 | }, |
15510 | | |
15511 | 14 | { &hf_smb2_app_instance_version_low, |
15512 | 14 | { "AppInstanceVersionLow", "smb2.app_instance_version.version.low", FT_UINT64, BASE_DEC, |
15513 | 14 | NULL, 0, NULL, HFILL } |
15514 | 14 | }, |
15515 | | |
15516 | 14 | { &hf_smb2_posix_perms, |
15517 | 14 | { "POSIX perms", "smb2.posix_perms", FT_UINT32, BASE_OCT, |
15518 | 14 | NULL, 0, NULL, HFILL } |
15519 | 14 | }, |
15520 | | |
15521 | 14 | { &hf_smb2_aapl_command_code, |
15522 | 14 | { "Command code", "smb2.aapl.command_code", FT_UINT32, BASE_DEC, |
15523 | 14 | VALS(aapl_command_code_vals), 0, NULL, HFILL } |
15524 | 14 | }, |
15525 | | |
15526 | 14 | { &hf_smb2_aapl_reserved, |
15527 | 14 | { "Reserved", "smb2.aapl.reserved", FT_UINT32, BASE_HEX, |
15528 | 14 | NULL, 0, NULL, HFILL } |
15529 | 14 | }, |
15530 | | |
15531 | 14 | { &hf_smb2_aapl_server_query_bitmask, |
15532 | 14 | { "Query bitmask", "smb2.aapl.query_bitmask", FT_UINT64, BASE_HEX, |
15533 | 14 | NULL, 0, NULL, HFILL } |
15534 | 14 | }, |
15535 | | |
15536 | 14 | { &hf_smb2_aapl_server_query_bitmask_server_caps, |
15537 | 14 | { "Server capabilities", "smb2.aapl.bitmask.server_caps", FT_BOOLEAN, 64, |
15538 | 14 | NULL, SMB2_AAPL_SERVER_CAPS, NULL, HFILL } |
15539 | 14 | }, |
15540 | | |
15541 | 14 | { &hf_smb2_aapl_server_query_bitmask_volume_caps, |
15542 | 14 | { "Volume capabilities", "smb2.aapl.bitmask.volume_caps", FT_BOOLEAN, 64, |
15543 | 14 | NULL, SMB2_AAPL_VOLUME_CAPS, NULL, HFILL } |
15544 | 14 | }, |
15545 | | |
15546 | 14 | { &hf_smb2_aapl_server_query_bitmask_model_info, |
15547 | 14 | { "Model information", "smb2.aapl.bitmask.model_info", FT_BOOLEAN, 64, |
15548 | 14 | NULL, SMB2_AAPL_MODEL_INFO, NULL, HFILL } |
15549 | 14 | }, |
15550 | | |
15551 | 14 | { &hf_smb2_aapl_server_query_caps, |
15552 | 14 | { "Client/Server capabilities", "smb2.aapl.caps", FT_UINT64, BASE_HEX, |
15553 | 14 | NULL, 0, NULL, HFILL } |
15554 | 14 | }, |
15555 | | |
15556 | 14 | { &hf_smb2_aapl_server_query_caps_supports_read_dir_attr, |
15557 | 14 | { "Supports READDIRATTR", "smb2.aapl.caps.supports_read_dir_addr", FT_BOOLEAN, 64, |
15558 | 14 | NULL, SMB2_AAPL_SUPPORTS_READ_DIR_ATTR, NULL, HFILL } |
15559 | 14 | }, |
15560 | | |
15561 | 14 | { &hf_smb2_aapl_server_query_caps_supports_osx_copyfile, |
15562 | 14 | { "Supports macOS copyfile", "smb2.aapl.caps.supports_osx_copyfile", FT_BOOLEAN, 64, |
15563 | 14 | NULL, SMB2_AAPL_SUPPORTS_OSX_COPYFILE, NULL, HFILL } |
15564 | 14 | }, |
15565 | | |
15566 | 14 | { &hf_smb2_aapl_server_query_caps_unix_based, |
15567 | 14 | { "UNIX-based", "smb2.aapl.caps.unix_based", FT_BOOLEAN, 64, |
15568 | 14 | NULL, SMB2_AAPL_UNIX_BASED, NULL, HFILL } |
15569 | 14 | }, |
15570 | | |
15571 | 14 | { &hf_smb2_aapl_server_query_caps_supports_nfs_ace, |
15572 | 14 | { "Supports NFS ACE", "smb2.aapl.supports_nfs_ace", FT_BOOLEAN, 64, |
15573 | 14 | NULL, SMB2_AAPL_SUPPORTS_NFS_ACE, NULL, HFILL } |
15574 | 14 | }, |
15575 | | |
15576 | 14 | { &hf_smb2_aapl_server_query_volume_caps, |
15577 | 14 | { "Volume capabilities", "smb2.aapl.volume_caps", FT_UINT64, BASE_HEX, |
15578 | 14 | NULL, 0, NULL, HFILL } |
15579 | 14 | }, |
15580 | | |
15581 | 14 | { &hf_smb2_aapl_server_query_volume_caps_support_resolve_id, |
15582 | 14 | { "Supports Resolve ID", "smb2.aapl.volume_caps.supports_resolve_id", FT_BOOLEAN, 64, |
15583 | 14 | NULL, SMB2_AAPL_SUPPORTS_RESOLVE_ID, NULL, HFILL } |
15584 | 14 | }, |
15585 | | |
15586 | 14 | { &hf_smb2_aapl_server_query_volume_caps_case_sensitive, |
15587 | 14 | { "Case sensitive", "smb2.aapl.volume_caps.case_sensitive", FT_BOOLEAN, 64, |
15588 | 14 | NULL, SMB2_AAPL_CASE_SENSITIVE, NULL, HFILL } |
15589 | 14 | }, |
15590 | | |
15591 | 14 | { &hf_smb2_aapl_server_query_volume_caps_supports_full_sync, |
15592 | 14 | { "Supports full sync", "smb2.aapl.volume_caps.supports_full_sync", FT_BOOLEAN, 64, |
15593 | 14 | NULL, SMB2_AAPL_SUPPORTS_FULL_SYNC, NULL, HFILL } |
15594 | 14 | }, |
15595 | | |
15596 | 14 | { &hf_smb2_aapl_server_query_model_string, |
15597 | 14 | { "Model string", "smb2.aapl.model_string", FT_UINT_STRING, BASE_NONE, |
15598 | 14 | NULL, 0, NULL, HFILL } |
15599 | 14 | }, |
15600 | | |
15601 | 14 | { &hf_smb2_aapl_server_query_server_path, |
15602 | 14 | { "Server path", "smb2.aapl.server_path", FT_UINT_STRING, BASE_NONE, |
15603 | 14 | NULL, 0, NULL, HFILL } |
15604 | 14 | }, |
15605 | | |
15606 | 14 | { &hf_smb2_transform_signature, |
15607 | 14 | { "Signature", "smb2.header.transform.signature", FT_BYTES, BASE_NONE, |
15608 | 14 | NULL, 0, NULL, HFILL } |
15609 | 14 | }, |
15610 | | |
15611 | 14 | { &hf_smb2_transform_nonce, |
15612 | 14 | { "Nonce", "smb2.header.transform.nonce", FT_BYTES, BASE_NONE, |
15613 | 14 | NULL, 0, NULL, HFILL } |
15614 | 14 | }, |
15615 | | |
15616 | 14 | { &hf_smb2_transform_msg_size, |
15617 | 14 | { "Message size", "smb2.header.transform.msg_size", FT_UINT32, BASE_DEC, |
15618 | 14 | NULL, 0, NULL, HFILL } |
15619 | 14 | }, |
15620 | | |
15621 | 14 | { &hf_smb2_transform_reserved, |
15622 | 14 | { "Reserved", "smb2.header.transform.reserved", FT_BYTES, BASE_NONE, |
15623 | 14 | NULL, 0, NULL, HFILL } |
15624 | 14 | }, |
15625 | | |
15626 | | /* SMB2 header flags */ |
15627 | 14 | { &hf_smb2_transform_flags, |
15628 | 14 | { "Flags", "smb2.header.transform.flags", FT_UINT16, BASE_HEX, |
15629 | 14 | NULL, 0, "SMB2 transform flags", HFILL } |
15630 | 14 | }, |
15631 | | |
15632 | 14 | { &hf_smb2_transform_flags_encrypted, |
15633 | 14 | { "Encrypted", "smb2.header.transform.flags.encrypted", FT_BOOLEAN, 16, |
15634 | 14 | NULL, SMB2_TRANSFORM_FLAGS_ENCRYPTED, |
15635 | 14 | "Whether the payload is encrypted", HFILL } |
15636 | 14 | }, |
15637 | | |
15638 | 14 | { &hf_smb2_transform_encrypted_data, |
15639 | 14 | { "Data", "smb2.header.transform.enc_data", FT_BYTES, BASE_NONE, |
15640 | 14 | NULL, 0, NULL, HFILL } |
15641 | 14 | }, |
15642 | | |
15643 | 14 | { &hf_smb2_comp_transform_orig_size, |
15644 | 14 | { "OriginalSize", "smb2.header.comp_transform.original_size", FT_UINT32, BASE_DEC, |
15645 | 14 | NULL, 0, NULL, HFILL } |
15646 | 14 | }, |
15647 | | |
15648 | 14 | { &hf_smb2_comp_transform_comp_alg, |
15649 | 14 | { "CompressionAlgorithm", "smb2.header.comp_transform.comp_alg", FT_UINT16, BASE_HEX, |
15650 | 14 | VALS(smb2_comp_alg_types), 0, NULL, HFILL } |
15651 | 14 | }, |
15652 | | |
15653 | 14 | { &hf_smb2_comp_transform_flags, |
15654 | 14 | { "Flags", "smb2.header.comp_transform.flags", FT_UINT16, BASE_HEX, |
15655 | 14 | VALS(smb2_comp_transform_flags_vals), 0, NULL, HFILL } |
15656 | 14 | }, |
15657 | | |
15658 | 14 | { &hf_smb2_comp_transform_offset, |
15659 | 14 | { "Offset", "smb2.header.comp_transform.offset", FT_UINT32, BASE_HEX, |
15660 | 14 | NULL, 0, NULL, HFILL } |
15661 | 14 | }, |
15662 | | |
15663 | 14 | { &hf_smb2_comp_transform_length, |
15664 | 14 | { "Length", "smb2.header.comp_transform.length", FT_UINT32, BASE_HEX, |
15665 | 14 | NULL, 0, NULL, HFILL } |
15666 | 14 | }, |
15667 | | |
15668 | 14 | { &hf_smb2_comp_transform_data, |
15669 | 14 | { "CompressedData", "smb2.header.comp_transform.data", FT_BYTES, BASE_NONE, |
15670 | 14 | NULL, 0, NULL, HFILL } |
15671 | 14 | }, |
15672 | | |
15673 | 14 | { &hf_smb2_comp_transform_orig_payload_size, |
15674 | 14 | { "OriginalPayloadSize", "smb2.header.comp_transform.orig_payload_size", FT_UINT32, BASE_DEC, |
15675 | 14 | NULL, 0, NULL, HFILL } |
15676 | 14 | }, |
15677 | | |
15678 | 14 | { &hf_smb2_comp_pattern_v1_pattern, |
15679 | 14 | { "Pattern", "smb2.pattern_v1.pattern", FT_UINT8, BASE_HEX, |
15680 | 14 | NULL, 0, NULL, HFILL } |
15681 | 14 | }, |
15682 | | |
15683 | 14 | { &hf_smb2_comp_pattern_v1_reserved1, |
15684 | 14 | { "Reserved1", "smb2.pattern_v1.reserved1", FT_UINT8, BASE_HEX, |
15685 | 14 | NULL, 0, NULL, HFILL } |
15686 | 14 | }, |
15687 | | |
15688 | 14 | { &hf_smb2_comp_pattern_v1_reserved2, |
15689 | 14 | { "Reserved2", "smb2.pattern_v1.reserved2", FT_UINT16, BASE_HEX, |
15690 | 14 | NULL, 0, NULL, HFILL } |
15691 | 14 | }, |
15692 | | |
15693 | 14 | { &hf_smb2_comp_pattern_v1_repetitions, |
15694 | 14 | { "Repetitions", "smb2.pattern_v1.repetitions", FT_UINT32, BASE_DEC, |
15695 | 14 | NULL, 0, NULL, HFILL } |
15696 | 14 | }, |
15697 | | |
15698 | 14 | { &hf_smb2_protocol_id, |
15699 | 14 | { "ProtocolId", "smb2.protocol_id", FT_UINT32, BASE_HEX, |
15700 | 14 | NULL, 0, NULL, HFILL } |
15701 | 14 | }, |
15702 | | |
15703 | 14 | { &hf_smb2_truncated, |
15704 | 14 | { "Truncated...", "smb2.truncated", FT_NONE, BASE_NONE, |
15705 | 14 | NULL, 0, NULL, HFILL } |
15706 | 14 | }, |
15707 | | |
15708 | 14 | { &hf_smb2_pipe_fragment_overlap, |
15709 | 14 | { "Fragment overlap", "smb2.pipe.fragment.overlap", FT_BOOLEAN, BASE_NONE, |
15710 | 14 | NULL, 0x0, "Fragment overlaps with other fragments", HFILL } |
15711 | 14 | }, |
15712 | | |
15713 | 14 | { &hf_smb2_pipe_fragment_overlap_conflict, |
15714 | 14 | { "Conflicting data in fragment overlap", "smb2.pipe.fragment.overlap.conflict", FT_BOOLEAN, BASE_NONE, |
15715 | 14 | NULL, 0x0, NULL, HFILL } |
15716 | 14 | }, |
15717 | | |
15718 | 14 | { &hf_smb2_pipe_fragment_multiple_tails, |
15719 | 14 | { "Multiple tail fragments found", "smb2.pipe.fragment.multipletails", FT_BOOLEAN, BASE_NONE, |
15720 | 14 | NULL, 0x0, "Several tails were found when defragmenting the packet", HFILL } |
15721 | 14 | }, |
15722 | | |
15723 | 14 | { &hf_smb2_pipe_fragment_too_long_fragment, |
15724 | 14 | { "Fragment too long", "smb2.pipe.fragment.toolongfragment", FT_BOOLEAN, BASE_NONE, |
15725 | 14 | NULL, 0x0, "Fragment contained data past end of packet", HFILL } |
15726 | 14 | }, |
15727 | | |
15728 | 14 | { &hf_smb2_pipe_fragment_error, |
15729 | 14 | { "Defragmentation error", "smb2.pipe.fragment.error", FT_FRAMENUM, BASE_NONE, |
15730 | 14 | NULL, 0x0, "Defragmentation error due to illegal fragments", HFILL } |
15731 | 14 | }, |
15732 | | |
15733 | 14 | { &hf_smb2_pipe_fragment_count, |
15734 | 14 | { "Fragment count", "smb2.pipe.fragment.count", FT_UINT32, BASE_DEC, |
15735 | 14 | NULL, 0x0, NULL, HFILL } |
15736 | 14 | }, |
15737 | | |
15738 | 14 | { &hf_smb2_pipe_fragment, |
15739 | 14 | { "Fragment SMB2 Named Pipe", "smb2.pipe.fragment", FT_FRAMENUM, BASE_NONE, |
15740 | 14 | NULL, 0x0, NULL, HFILL } |
15741 | 14 | }, |
15742 | | |
15743 | 14 | { &hf_smb2_pipe_fragments, |
15744 | 14 | { "Reassembled SMB2 Named Pipe fragments", "smb2.pipe.fragments", FT_NONE, BASE_NONE, |
15745 | 14 | NULL, 0x0, NULL, HFILL } |
15746 | 14 | }, |
15747 | | |
15748 | 14 | { &hf_smb2_pipe_reassembled_in, |
15749 | 14 | { "This SMB2 Named Pipe payload is reassembled in frame", "smb2.pipe.reassembled_in", FT_FRAMENUM, BASE_NONE, |
15750 | 14 | NULL, 0x0, "The Named Pipe PDU is completely reassembled in this frame", HFILL } |
15751 | 14 | }, |
15752 | | |
15753 | 14 | { &hf_smb2_pipe_reassembled_length, |
15754 | 14 | { "Reassembled SMB2 Named Pipe length", "smb2.pipe.reassembled.length", FT_UINT32, BASE_DEC, |
15755 | 14 | NULL, 0x0, "The total length of the reassembled payload", HFILL } |
15756 | 14 | }, |
15757 | | |
15758 | 14 | { &hf_smb2_pipe_reassembled_data, |
15759 | 14 | { "Reassembled SMB2 Named Pipe Data", "smb2.pipe.reassembled.data", FT_BYTES, BASE_NONE, |
15760 | 14 | NULL, 0x0, "The reassembled payload", HFILL } |
15761 | 14 | }, |
15762 | | |
15763 | 14 | { &hf_smb2_cchunk_resume_key, |
15764 | 14 | { "ResumeKey", "smb2.fsctl.cchunk.resume_key", FT_BYTES, BASE_NONE, |
15765 | 14 | NULL, 0x0, "Opaque data representing source of copy", HFILL } |
15766 | 14 | }, |
15767 | | |
15768 | 14 | { &hf_smb2_cchunk_count, |
15769 | 14 | { "Chunk Count", "smb2.fsctl.cchunk.count", FT_UINT32, BASE_DEC, |
15770 | 14 | NULL, 0x0, NULL, HFILL } |
15771 | 14 | }, |
15772 | | |
15773 | 14 | { &hf_smb2_cchunk_src_offset, |
15774 | 14 | { "Source Offset", "smb2.fsctl.cchunk.src_offset", FT_UINT64, BASE_DEC, |
15775 | 14 | NULL, 0x0, NULL, HFILL } |
15776 | 14 | }, |
15777 | | |
15778 | 14 | { &hf_smb2_cchunk_dst_offset, |
15779 | 14 | { "Target Offset", "smb2.fsctl.cchunk.dst_offset", FT_UINT64, BASE_DEC, |
15780 | 14 | NULL, 0x0, NULL, HFILL } |
15781 | 14 | }, |
15782 | | |
15783 | 14 | { &hf_smb2_cchunk_xfer_len, |
15784 | 14 | { "Transfer Length", "smb2.fsctl.cchunk.xfer_len", FT_UINT32, BASE_DEC, |
15785 | 14 | NULL, 0x0, NULL, HFILL } |
15786 | 14 | }, |
15787 | | |
15788 | 14 | { &hf_smb2_cchunk_chunks_written, |
15789 | 14 | { "Chunks Written", "smb2.fsctl.cchunk.chunks_written", FT_UINT32, BASE_DEC, |
15790 | 14 | NULL, 0x0, NULL, HFILL } |
15791 | 14 | }, |
15792 | | |
15793 | 14 | { &hf_smb2_cchunk_bytes_written, |
15794 | 14 | { "Chunk Bytes Written", "smb2.fsctl.cchunk.bytes_written", FT_UINT32, BASE_DEC, |
15795 | 14 | NULL, 0x0, NULL, HFILL } |
15796 | 14 | }, |
15797 | | |
15798 | 14 | { &hf_smb2_cchunk_total_written, |
15799 | 14 | { "Total Bytes Written", "smb2.fsctl.cchunk.total_written", FT_UINT32, BASE_DEC, |
15800 | 14 | NULL, 0x0, NULL, HFILL } |
15801 | 14 | }, |
15802 | | |
15803 | 14 | { &hf_smb2_dupext_src_offset, |
15804 | 14 | { "Source File Offset", "smb2.fsctl.dupext.src_offset", FT_UINT64, BASE_DEC, |
15805 | 14 | NULL, 0x0, NULL, HFILL } |
15806 | 14 | }, |
15807 | 14 | { &hf_smb2_dupext_dst_offset, |
15808 | 14 | { "Target File Offset", "smb2.fsctl.dupext.dst_offset", FT_UINT64, BASE_DEC, |
15809 | 14 | NULL, 0x0, NULL, HFILL } |
15810 | 14 | }, |
15811 | 14 | { &hf_smb2_dupext_byte_count, |
15812 | 14 | { "Byte Count", "smb2.fsctl.dupext.byte_count", FT_UINT64, BASE_DEC, |
15813 | 14 | NULL, 0x0, NULL, HFILL } |
15814 | 14 | }, |
15815 | | |
15816 | 14 | { &hf_smb2_reparse_tag, |
15817 | 14 | { "Reparse Tag", "smb2.reparse_tag", FT_UINT32, BASE_HEX, |
15818 | 14 | VALS(reparse_tag_vals), 0x0, NULL, HFILL } |
15819 | 14 | }, |
15820 | 14 | { &hf_smb2_reparse_guid, |
15821 | 14 | { "Reparse GUID", "smb2.reparse_guid", FT_NONE, BASE_NONE, |
15822 | 14 | NULL, 0, NULL, HFILL } |
15823 | 14 | }, |
15824 | 14 | { &hf_smb2_reparse_data_length, |
15825 | 14 | { "Reparse Data Length", "smb2.reparse_data_length", FT_UINT16, BASE_DEC, |
15826 | 14 | NULL, 0x0, NULL, HFILL } |
15827 | 14 | }, |
15828 | 14 | { &hf_smb2_reparse_data_buffer, |
15829 | 14 | { "Reparse Data Buffer", "smb2.reparse_data_buffer", FT_NONE, BASE_NONE, |
15830 | 14 | NULL, 0, NULL, HFILL } |
15831 | 14 | }, |
15832 | 14 | { &hf_smb2_nfs_type, |
15833 | 14 | { "NFS file type", "smb2.nfs.type", FT_UINT64, BASE_HEX|BASE_VAL64_STRING, |
15834 | 14 | VALS64(nfs_type_vals), 0x0, NULL, HFILL } |
15835 | 14 | }, |
15836 | 14 | { &hf_smb2_nfs_symlink_target, |
15837 | 14 | { "Symlink Target", "smb2.nfs.symlink.target", FT_STRING, |
15838 | 14 | BASE_NONE, NULL, 0x0, NULL, HFILL } |
15839 | 14 | }, |
15840 | 14 | { &hf_smb2_nfs_chr_major, |
15841 | 14 | { "Major", "smb2.nfs.char.major", FT_UINT32, |
15842 | 14 | BASE_HEX, NULL, 0x0, NULL, HFILL } |
15843 | 14 | }, |
15844 | 14 | { &hf_smb2_nfs_chr_minor, |
15845 | 14 | { "Minor", "smb2.nfs.char.minor", FT_UINT32, |
15846 | 14 | BASE_HEX, NULL, 0x0, NULL, HFILL } |
15847 | 14 | }, |
15848 | 14 | { &hf_smb2_nfs_blk_major, |
15849 | 14 | { "Major", "smb2.nfs.block.major", FT_UINT32, |
15850 | 14 | BASE_HEX, NULL, 0x0, NULL, HFILL } |
15851 | 14 | }, |
15852 | 14 | { &hf_smb2_nfs_blk_minor, |
15853 | 14 | { "Minor", "smb2.nfs.block.minor", FT_UINT32, |
15854 | 14 | BASE_HEX, NULL, 0x0, NULL, HFILL } |
15855 | 14 | }, |
15856 | 14 | { &hf_smb2_symlink_error_response, |
15857 | 14 | { "Symbolic Link Error Response", "smb2.symlink_error_response", FT_NONE, BASE_NONE, |
15858 | 14 | NULL, 0, NULL, HFILL } |
15859 | 14 | }, |
15860 | 14 | { &hf_smb2_symlink_length, |
15861 | 14 | { "SymLink Length", "smb2.symlink.length", FT_UINT32, |
15862 | 14 | BASE_DEC, NULL, 0x0, NULL, HFILL } |
15863 | 14 | }, |
15864 | 14 | { &hf_smb2_symlink_error_tag, |
15865 | 14 | { "SymLink Error Tag", "smb2.symlink.error_tag", FT_UINT32, |
15866 | 14 | BASE_HEX, NULL, 0x0, NULL, HFILL } |
15867 | 14 | }, |
15868 | 14 | { &hf_smb2_unparsed_path_length, |
15869 | 14 | { "Unparsed Path Length", "smb2.symlink.unparsed_path_length", FT_UINT16, BASE_DEC, |
15870 | 14 | NULL, 0x0, NULL, HFILL } |
15871 | 14 | }, |
15872 | 14 | { &hf_smb2_symlink_substitute_name, |
15873 | 14 | { "Substitute Name", "smb2.symlink.substitute_name", FT_STRING, BASE_NONE, |
15874 | 14 | NULL, 0x0, NULL, HFILL } |
15875 | 14 | }, |
15876 | 14 | { &hf_smb2_symlink_print_name, |
15877 | 14 | { "Print Name", "smb2.symlink.print_name", FT_STRING, BASE_NONE, |
15878 | 14 | NULL, 0x0, NULL, HFILL } |
15879 | 14 | }, |
15880 | 14 | { &hf_smb2_symlink_flags, |
15881 | 14 | { "Flags", "smb2.symlink.flags", FT_UINT32, BASE_DEC, |
15882 | 14 | NULL, 0x0, NULL, HFILL } |
15883 | 14 | }, |
15884 | 14 | { &hf_smb2_fscc_file_attr, |
15885 | 14 | { "File Attributes", "smb2.file_attribute", FT_UINT32, BASE_HEX, |
15886 | 14 | NULL, 0x0, NULL, HFILL } |
15887 | 14 | }, |
15888 | 14 | { &hf_smb2_fscc_file_attr_read_only, |
15889 | 14 | { "Read Only", "smb2.file_attribute.read_only", FT_BOOLEAN, 32, |
15890 | 14 | TFS(&tfs_yes_no), SMB2_FSCC_FILE_ATTRIBUTE_READ_ONLY, "READ ONLY file attribute", HFILL } }, |
15891 | | |
15892 | 14 | { &hf_smb2_fscc_file_attr_hidden, |
15893 | 14 | { "Hidden", "smb2.file_attribute.hidden", FT_BOOLEAN, 32, |
15894 | 14 | TFS(&tfs_yes_no), SMB2_FSCC_FILE_ATTRIBUTE_HIDDEN, "HIDDEN file attribute", HFILL } }, |
15895 | | |
15896 | 14 | { &hf_smb2_fscc_file_attr_system, |
15897 | 14 | { "System", "smb2.file_attribute.system", FT_BOOLEAN, 32, |
15898 | 14 | TFS(&tfs_yes_no), SMB2_FSCC_FILE_ATTRIBUTE_SYSTEM, "SYSTEM file attribute", HFILL } }, |
15899 | | |
15900 | 14 | { &hf_smb2_fscc_file_attr_directory, |
15901 | 14 | { "Directory", "smb2.file_attribute.directory", FT_BOOLEAN, 32, |
15902 | 14 | TFS(&tfs_yes_no), SMB2_FSCC_FILE_ATTRIBUTE_DIRECTORY, "DIRECTORY file attribute", HFILL } }, |
15903 | | |
15904 | 14 | { &hf_smb2_fscc_file_attr_archive, |
15905 | 14 | { "Requires archived", "smb2.file_attribute.archive", FT_BOOLEAN, 32, |
15906 | 14 | TFS(&tfs_yes_no), SMB2_FSCC_FILE_ATTRIBUTE_ARCHIVE, "ARCHIVE file attribute", HFILL } }, |
15907 | | |
15908 | 14 | { &hf_smb2_fscc_file_attr_normal, |
15909 | 14 | { "Normal", "smb2.file_attribute.normal", FT_BOOLEAN, 32, |
15910 | 14 | TFS(&tfs_yes_no), SMB2_FSCC_FILE_ATTRIBUTE_NORMAL, "Is this a normal file?", HFILL } }, |
15911 | | |
15912 | 14 | { &hf_smb2_fscc_file_attr_temporary, |
15913 | 14 | { "Temporary", "smb2.file_attribute.temporary", FT_BOOLEAN, 32, |
15914 | 14 | TFS(&tfs_yes_no), SMB2_FSCC_FILE_ATTRIBUTE_TEMPORARY, "Is this a temporary file?", HFILL } }, |
15915 | | |
15916 | 14 | { &hf_smb2_fscc_file_attr_sparse_file, |
15917 | 14 | { "Sparse", "smb2.file_attribute.sparse", FT_BOOLEAN, 32, |
15918 | 14 | TFS(&tfs_yes_no), SMB2_FSCC_FILE_ATTRIBUTE_SPARSE_FILE, "Is this a sparse file?", HFILL } }, |
15919 | | |
15920 | 14 | { &hf_smb2_fscc_file_attr_reparse_point, |
15921 | 14 | { "Reparse Point", "smb2.file_attribute.reparse", FT_BOOLEAN, 32, |
15922 | 14 | TFS(&tfs_fscc_file_attribute_reparse), SMB2_FSCC_FILE_ATTRIBUTE_REPARSE_POINT, "Does this file have an associated reparse point?", HFILL } }, |
15923 | | |
15924 | 14 | { &hf_smb2_fscc_file_attr_compressed, |
15925 | 14 | { "Compressed", "smb2.file_attribute.compressed", FT_BOOLEAN, 32, |
15926 | 14 | TFS(&tfs_fscc_file_attribute_compressed), SMB2_FSCC_FILE_ATTRIBUTE_COMPRESSED, "Is this file compressed?", HFILL } }, |
15927 | | |
15928 | 14 | { &hf_smb2_fscc_file_attr_offline, |
15929 | 14 | { "Offline", "smb2.file_attribute.offline", FT_BOOLEAN, 32, |
15930 | 14 | TFS(&tfs_fscc_file_attribute_offline), SMB2_FSCC_FILE_ATTRIBUTE_OFFLINE, "Is this file offline?", HFILL } }, |
15931 | | |
15932 | 14 | { &hf_smb2_fscc_file_attr_not_content_indexed, |
15933 | 14 | { "Not Content Indexed", "smb2.file_attribute.not_content_indexed", FT_BOOLEAN, 32, |
15934 | 14 | TFS(&tfs_fscc_file_attribute_not_content_indexed), SMB2_FSCC_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED, "May this file be indexed by the content indexing service", HFILL } }, |
15935 | | |
15936 | 14 | { &hf_smb2_fscc_file_attr_encrypted, |
15937 | 14 | { "Encrypted", "smb2.file_attribute.encrypted", FT_BOOLEAN, 32, |
15938 | 14 | TFS(&tfs_yes_no), SMB2_FSCC_FILE_ATTRIBUTE_ENCRYPTED, "Is this file encrypted?", HFILL } }, |
15939 | | |
15940 | 14 | { &hf_smb2_fscc_file_attr_integrity_stream, |
15941 | 14 | { "Integrity Stream", "smb2.file_attribute.integrity_stream", FT_BOOLEAN, 32, |
15942 | 14 | TFS(&tfs_fscc_file_attribute_integrity_stream), SMB2_FSCC_FILE_ATTRIBUTE_INTEGRITY_STREAM, "Is this file configured with integrity support?", HFILL } }, |
15943 | | |
15944 | 14 | { &hf_smb2_fscc_file_attr_no_scrub_data, |
15945 | 14 | { "No Scrub Data", "smb2.file_attribute.no_scrub_data", FT_BOOLEAN, 32, |
15946 | 14 | TFS(&tfs_fscc_file_attribute_no_scrub_data), SMB2_FSCC_FILE_ATTRIBUTE_NO_SCRUB_DATA, "Is this file configured to be excluded from the data integrity scan?", HFILL } }, |
15947 | | |
15948 | 14 | { &hf_smb2_fscc_file_attr_recall_on_open, |
15949 | 14 | { "Recall on open", "smb2.file_attribute.recall_on_open", FT_BOOLEAN, 32, |
15950 | 14 | TFS(&tfs_fscc_file_attribute_recall_on_open), SMB2_FSCC_FILE_ATTRIBUTE_RECALL_ON_OPEN, "When OPENED does some/all of the file/dir need to be fetched from remote storage?", HFILL } }, |
15951 | | |
15952 | 14 | { &hf_smb2_fscc_file_attr_pinned, |
15953 | 14 | { "Pinned", "smb2.file_attribute.pinned", FT_BOOLEAN, 32, |
15954 | 14 | TFS(&tfs_fscc_file_attribute_pinned), SMB2_FSCC_FILE_ATTRIBUTE_PINNED, "Should the file/dir be kept fully present locally even when not being used?", HFILL } }, |
15955 | | |
15956 | 14 | { &hf_smb2_fscc_file_attr_unpinned, |
15957 | 14 | { "Unpinned", "smb2.file_attribute.unpinned", FT_BOOLEAN, 32, |
15958 | 14 | TFS(&tfs_fscc_file_attribute_unpinned), SMB2_FSCC_FILE_ATTRIBUTE_UNPINNED, "Should file/dir NOT be fully kept locally except when ACCESSED?", HFILL } }, |
15959 | | |
15960 | 14 | { &hf_smb2_fscc_file_attr_recall_on_data_access, |
15961 | 14 | { "Recall on data access", "smb2.file_attribute.recall_on_data_access", FT_BOOLEAN, 32, |
15962 | 14 | TFS(&tfs_fscc_file_attribute_recall_on_data_access), SMB2_FSCC_FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS, "Should the remote content be fetched when ACCESSED?", HFILL } }, |
15963 | | |
15964 | 14 | { &hf_smb2_fsctl_infoex_enable_integrity, |
15965 | 14 | {"Enable Integrity", "smb2.fsctl.infoex.enable_integrity", FT_UINT8, BASE_HEX, |
15966 | 14 | VALS(smb2_fsctl_infoex_integrity_modes), 0, NULL, HFILL } }, |
15967 | | |
15968 | 14 | { &hf_smb2_fsctl_infoex_keep_integrity_state, |
15969 | 14 | {"Integrity State", "smb2.fsctl.infoex.keep_integrity_state", FT_UINT8, BASE_HEX, |
15970 | 14 | VALS(smb2_fsctl_infoex_integrity_state), 0, NULL, HFILL } }, |
15971 | | |
15972 | 14 | { &hf_smb2_fsctl_infoex_reserved, |
15973 | 14 | {"Reserved", "smb2.fsctl.infoex.reserved", FT_UINT16, BASE_HEX, |
15974 | 14 | NULL, 0, NULL, HFILL } }, |
15975 | | |
15976 | 14 | { &hf_smb2_fsctl_infoex_flags, |
15977 | 14 | { "Flags", "smb2.fsctl.infoex.flags", FT_UINT32, BASE_HEX, |
15978 | 14 | NULL, 0, NULL, HFILL } }, |
15979 | | |
15980 | 14 | { &hf_smb2_fsctl_infoex_version, |
15981 | 14 | { "Version", "smb2.fsctl.infoex.version", FT_UINT8, BASE_DEC, |
15982 | 14 | NULL, 0, NULL, HFILL } }, |
15983 | | |
15984 | 14 | { &hf_smb2_fsctl_infoex_reserved2, |
15985 | 14 | { "Reserved", "smb2.fsctl.infoex.reserved2", FT_UINT56, BASE_HEX, |
15986 | 14 | NULL, 0, NULL, HFILL } }, |
15987 | | |
15988 | 14 | { &hf_smb2_query_info_flags, |
15989 | 14 | {"Flags", "smb2.query_info.flags", FT_UINT32, BASE_HEX, |
15990 | 14 | NULL, 0, NULL, HFILL }}, |
15991 | | |
15992 | 14 | { &hf_smb2_query_info_flag_restart_scan, |
15993 | 14 | {"SL Restart Scan", "smb2.query_info.flags.restart_scan", FT_BOOLEAN, 32, |
15994 | 14 | NULL, SMB2_SL_RESTART_SCAN, "Restart the scan for EAs from the beginning", HFILL } }, |
15995 | | |
15996 | 14 | { &hf_smb2_query_info_flag_return_single_entry, |
15997 | 14 | {"SL Return Single Entry", "smb2.query_info.flags.return_single_entry", FT_BOOLEAN, 32, |
15998 | 14 | NULL, SMB2_SL_RETURN_SINGLE_ENTRY, "Return a single EA entry in the response buffer.", HFILL } }, |
15999 | | |
16000 | 14 | { &hf_smb2_query_info_flag_index_specified, |
16001 | 14 | {"SL Index Specified", "smb2.query_info.flags.index_specified", FT_BOOLEAN, 32, |
16002 | 14 | NULL, SL_INDEX_SPECIFIED, "The caller has specified an EA index.", HFILL } }, |
16003 | | |
16004 | 14 | { &hf_smb2_notification_type, |
16005 | 14 | { "Notification Type", "smb2.notification.type", FT_UINT32, BASE_HEX, |
16006 | 14 | VALS(server_notification_types), 0, NULL, HFILL } }, |
16007 | | |
16008 | 14 | { |
16009 | 14 | &hf_smb2_fscc_refs_snapshot_mgmt_operation, |
16010 | 14 | { "Operation", "smb2.refs.snapshot.mgmt.op", FT_UINT32, BASE_HEX, |
16011 | 14 | VALS(refs_stream_snapshot_operation_types), 0, NULL, HFILL }}, |
16012 | | |
16013 | 14 | { |
16014 | 14 | &hf_smb2_fscc_refs_snapshot_mgmt_namelen, |
16015 | 14 | { "Name Length", "smb2.refs.snapshot.mgmt.namelen", FT_UINT16, BASE_DEC, |
16016 | 14 | NULL, 0, NULL, HFILL }}, |
16017 | | |
16018 | 14 | { |
16019 | 14 | &hf_smb2_fscc_refs_snapshot_mgmt_input_buffer_len, |
16020 | 14 | { "Input Buffer Length", "smb2.refs.snapshot.mgmt.input_buffer_len", FT_UINT16, BASE_DEC, |
16021 | 14 | NULL, 0, NULL, HFILL }}, |
16022 | | |
16023 | 14 | { |
16024 | 14 | &hf_smb2_fscc_refs_snapshot_mgmt_reserved, |
16025 | 14 | { "Reserved", "smb2.refs.snapshot.mgmt.reserved", FT_BYTES, BASE_NONE, |
16026 | 14 | NULL, 0, NULL, HFILL }}, |
16027 | | |
16028 | 14 | { |
16029 | 14 | &hf_smb2_fscc_refs_snapshot_mgmt_name, |
16030 | 14 | { "Name", "smb2.refs.snapshot.mgmt.name", FT_STRING, BASE_NONE, |
16031 | 14 | NULL, 0x0, NULL, HFILL }}, |
16032 | | |
16033 | 14 | { |
16034 | 14 | &hf_smb2_fscc_refs_snapshot_query_delta_buffer_startvcn, |
16035 | 14 | { "Starting VCN", "smb2.refs.snapshot.query.delta_buffer.startvcn", FT_UINT64, BASE_DEC, |
16036 | 14 | NULL, 0, NULL, HFILL }}, |
16037 | | |
16038 | 14 | { |
16039 | 14 | &hf_smb2_fscc_refs_snapshot_query_delta_buffer_flags, |
16040 | 14 | { "Flags", "smb2.refs.snapshot.query.delta_buffer.flags", FT_UINT32, BASE_DEC, |
16041 | 14 | NULL, 0, NULL, HFILL }}, |
16042 | | |
16043 | 14 | { |
16044 | 14 | &hf_smb2_fscc_refs_snapshot_query_delta_buffer_reserved, |
16045 | 14 | { "Reserved", "smb2.refs.snapshot.query.delta_buffer.reserved", FT_UINT32, BASE_DEC, |
16046 | 14 | NULL, 0, NULL, HFILL }}, |
16047 | | |
16048 | 14 | { &hf_smb2_flush_reserved2, |
16049 | 14 | { "Reserved2", "smb2.flush.reserved2", FT_BYTES, BASE_NONE, |
16050 | 14 | NULL, 0, NULL, HFILL }}, |
16051 | | |
16052 | | /* FSCTL_DFS_GET_REFERRALS_EX fields */ |
16053 | 14 | { &hf_smb2_dfs_max_referral_level, |
16054 | 14 | { "Max referral level", "smb2.fsctl.max_referral_level", FT_UINT16, BASE_DEC, |
16055 | 14 | NULL, 0, NULL, HFILL }}, |
16056 | 14 | { &hf_smb2_dfs_request_flags, |
16057 | 14 | { "Request flags", "smb2.fsctl.request_flags", FT_UINT16, BASE_DEC, |
16058 | 14 | NULL, 0, NULL, HFILL }}, |
16059 | 14 | { &hf_smb2_dfs_request_data_len, |
16060 | 14 | { "Request data length", "smb2.fsctl.request_data_len", FT_UINT32, BASE_DEC, |
16061 | 14 | NULL, 0, NULL, HFILL }}, |
16062 | 14 | { &hf_smb2_dfs_request_data, |
16063 | 14 | { "Request Data", "smb2.fsctl.request_data", FT_NONE, BASE_NONE, |
16064 | 14 | NULL, 0, NULL, HFILL }}, |
16065 | 14 | { &hf_smb2_dfs_request_data_file, |
16066 | 14 | { "File", "smb2.fsctl.request_data_file", FT_STRING, BASE_NONE, |
16067 | 14 | NULL, 0, NULL, HFILL }}, |
16068 | 14 | { &hf_smb2_dfs_filename_len, |
16069 | 14 | { "Length", "smb2.fsctl.filename_len", FT_UINT16, BASE_DEC, |
16070 | 14 | NULL, 0, NULL, HFILL }}, |
16071 | 14 | { &hf_smb2_dfs_request_data_site, |
16072 | 14 | { "Site", "smb2.fsctl.request_data_site", FT_STRING, BASE_NONE, |
16073 | 14 | NULL, 0, NULL, HFILL }}, |
16074 | 14 | { &hf_smb2_dfs_sitename_len, |
16075 | 14 | { "Length", "smb2.fsctl.sitename_len", FT_UINT16, BASE_DEC, |
16076 | 14 | NULL, 0, NULL, HFILL }}, |
16077 | 14 | { &hf_smb2_dfs_sitename, |
16078 | 14 | { "Sitename", "smb2.sitename", FT_STRING, BASE_NONE, |
16079 | 14 | NULL, 0, NULL, HFILL }}, |
16080 | 14 | }; |
16081 | | |
16082 | 14 | static int *ett[] = { |
16083 | 14 | &ett_smb2, |
16084 | 14 | &ett_smb2_ea, |
16085 | 14 | &ett_smb2_olb, |
16086 | 14 | &ett_smb2_header, |
16087 | 14 | &ett_smb2_encrypted, |
16088 | 14 | &ett_smb2_compressed, |
16089 | 14 | &ett_smb2_decompressed, |
16090 | 14 | &ett_smb2_command, |
16091 | 14 | &ett_smb2_secblob, |
16092 | 14 | &ett_smb2_negotiate_context_element, |
16093 | 14 | &ett_smb2_file_basic_info, |
16094 | 14 | &ett_smb2_file_standard_info, |
16095 | 14 | &ett_smb2_file_internal_info, |
16096 | 14 | &ett_smb2_file_ea_info, |
16097 | 14 | &ett_smb2_file_access_info, |
16098 | 14 | &ett_smb2_file_rename_info, |
16099 | 14 | &ett_smb2_file_link_info, |
16100 | 14 | &ett_smb2_file_disposition_info, |
16101 | 14 | &ett_smb2_file_position_info, |
16102 | 14 | &ett_smb2_file_full_ea_info, |
16103 | 14 | &ett_smb2_file_mode_info, |
16104 | 14 | &ett_smb2_file_alignment_info, |
16105 | 14 | &ett_smb2_file_all_info, |
16106 | 14 | &ett_smb2_file_allocation_info, |
16107 | 14 | &ett_smb2_file_endoffile_info, |
16108 | 14 | &ett_smb2_file_alternate_name_info, |
16109 | 14 | &ett_smb2_file_stream_info, |
16110 | 14 | &ett_smb2_file_pipe_info, |
16111 | 14 | &ett_smb2_file_pipe_local_info, |
16112 | 14 | &ett_smb2_file_pipe_remote_info, |
16113 | 14 | &ett_smb2_file_compression_info, |
16114 | 14 | &ett_smb2_file_network_open_info, |
16115 | 14 | &ett_smb2_file_attribute_tag_info, |
16116 | 14 | &ett_smb2_file_normalized_name_info, |
16117 | 14 | &ett_smb2_fs_info_01, |
16118 | 14 | &ett_smb2_fs_info_03, |
16119 | 14 | &ett_smb2_fs_info_04, |
16120 | 14 | &ett_smb2_fs_info_05, |
16121 | 14 | &ett_smb2_fs_info_06, |
16122 | 14 | &ett_smb2_fs_info_07, |
16123 | 14 | &ett_smb2_fs_objectid_info, |
16124 | 14 | &ett_smb2_fs_posix_info, |
16125 | 14 | &ett_smb2_sec_info_00, |
16126 | 14 | &ett_smb2_additional_information_sec_mask, |
16127 | 14 | &ett_smb2_quota_info, |
16128 | 14 | &ett_smb2_query_quota_info, |
16129 | 14 | &ett_smb2_tid_tree, |
16130 | 14 | &ett_smb2_sesid_tree, |
16131 | 14 | &ett_smb2_create_chain_element, |
16132 | 14 | &ett_smb2_MxAc_buffer, |
16133 | 14 | &ett_smb2_QFid_buffer, |
16134 | 14 | &ett_smb2_RqLs_buffer, |
16135 | 14 | &ett_smb2_ioctl_function, |
16136 | 14 | &ett_smb2_FILE_OBJECTID_BUFFER, |
16137 | 14 | &ett_smb2_flags, |
16138 | 14 | &ett_smb2_sec_mode, |
16139 | 14 | &ett_smb2_capabilities, |
16140 | 14 | &ett_smb2_ses_req_flags, |
16141 | 14 | &ett_smb2_ses_flags, |
16142 | 14 | &ett_smb2_create_rep_flags, |
16143 | 14 | &ett_smb2_lease_state, |
16144 | 14 | &ett_smb2_lease_flags, |
16145 | 14 | &ett_smb2_share_flags, |
16146 | 14 | &ett_smb2_share_caps, |
16147 | 14 | &ett_smb2_comp_alg_flags, |
16148 | 14 | &ett_smb2_ioctl_flags, |
16149 | 14 | &ett_smb2_ioctl_network_interface, |
16150 | 14 | &ett_smb2_ioctl_sqos_opeations, |
16151 | 14 | &ett_smb2_fsctl_range_data, |
16152 | 14 | &ett_windows_sockaddr, |
16153 | 14 | &ett_smb2_close_flags, |
16154 | 14 | &ett_smb2_notify_info, |
16155 | 14 | &ett_smb2_notify_flags, |
16156 | 14 | &ett_smb2_rdma_v1, |
16157 | 14 | &ett_smb2_write_flags, |
16158 | 14 | &ett_smb2_find_flags, |
16159 | 14 | &ett_smb2_file_directory_info, |
16160 | 14 | &ett_smb2_both_directory_info, |
16161 | 14 | &ett_smb2_id_both_directory_info, |
16162 | 14 | &ett_smb2_full_directory_info, |
16163 | 14 | &ett_smb2_posix_info, |
16164 | 14 | &ett_smb2_file_name_info, |
16165 | 14 | &ett_smb2_lock_info, |
16166 | 14 | &ett_smb2_lock_flags, |
16167 | 14 | &ett_smb2_DH2Q_buffer, |
16168 | 14 | &ett_smb2_DH2C_buffer, |
16169 | 14 | &ett_smb2_dh2x_flags, |
16170 | 14 | &ett_smb2_APP_INSTANCE_buffer, |
16171 | 14 | &ett_smb2_svhdx_open_device_context, |
16172 | 14 | &ett_smb2_app_instance_version_buffer, |
16173 | 14 | &ett_smb2_app_instance_version_buffer_version, |
16174 | 14 | &ett_smb2_aapl_create_context_request, |
16175 | 14 | &ett_smb2_aapl_server_query_bitmask, |
16176 | 14 | &ett_smb2_aapl_server_query_caps, |
16177 | 14 | &ett_smb2_aapl_create_context_response, |
16178 | 14 | &ett_smb2_aapl_server_query_volume_caps, |
16179 | 14 | &ett_smb2_integrity_flags, |
16180 | 14 | &ett_smb2_buffercode, |
16181 | 14 | &ett_smb2_ioctl_network_interface_capabilities, |
16182 | 14 | &ett_smb2_tree_connect_flags, |
16183 | 14 | &ett_qfr_entry, |
16184 | 14 | &ett_smb2_pipe_fragment, |
16185 | 14 | &ett_smb2_pipe_fragments, |
16186 | 14 | &ett_smb2_cchunk_entry, |
16187 | 14 | &ett_smb2_fsctl_odx_token, |
16188 | 14 | &ett_smb2_symlink_error_response, |
16189 | 14 | &ett_smb2_reparse_data_buffer, |
16190 | 14 | &ett_smb2_error_data, |
16191 | 14 | &ett_smb2_error_context, |
16192 | 14 | &ett_smb2_error_redir_context, |
16193 | 14 | &ett_smb2_error_redir_ip_list, |
16194 | 14 | &ett_smb2_read_flags, |
16195 | 14 | &ett_smb2_signature, |
16196 | 14 | &ett_smb2_transform_flags, |
16197 | 14 | &ett_smb2_fscc_file_attributes, |
16198 | 14 | &ett_smb2_comp_pattern_v1, |
16199 | 14 | &ett_smb2_comp_payload, |
16200 | 14 | &ett_smb2_query_info_flags, |
16201 | 14 | &ett_smb2_server_notification, |
16202 | 14 | &ett_smb2_fscc_refs_snapshot_query_delta_buffer, |
16203 | 14 | &ett_smb2_fid_str, |
16204 | 14 | &ett_smb2_fsctl_dfs_get_referrals_ex_request_data, |
16205 | 14 | &ett_smb2_fsctl_dfs_get_referrals_ex_filename, |
16206 | 14 | &ett_smb2_fsctl_dfs_get_referrals_ex_sitename, |
16207 | 14 | }; |
16208 | | |
16209 | 14 | static ei_register_info ei[] = { |
16210 | 14 | { &ei_smb2_invalid_length, { "smb2.invalid_length", PI_MALFORMED, PI_ERROR, "Invalid length", EXPFILL }}, |
16211 | 14 | { &ei_smb2_bad_response, { "smb2.bad_response", PI_MALFORMED, PI_ERROR, "Bad response", EXPFILL }}, |
16212 | 14 | { &ei_smb2_bad_negprot_negotiate_context_count, { "smb2.bad_negprot_negotiate_context_count", PI_MALFORMED, PI_ERROR, "Negotiate Protocol request NegotiateContextCount is nonzero without SMB 3.11 support", EXPFILL }}, |
16213 | 14 | { &ei_smb2_bad_negprot_negotiate_context_offset, { "smb2.bad_negprot_negotiate_context_offset", PI_MALFORMED, PI_ERROR, "Negotiate Protocol request NegotiateContextOffset is nonzero without SMB 3.11 support", EXPFILL }}, |
16214 | 14 | { &ei_smb2_bad_negprot_reserved, { "smb2.bad_negprot_reserved", PI_MALFORMED, PI_ERROR, "Negotiate Protocol response Reserved is nonzero", EXPFILL }}, |
16215 | 14 | { &ei_smb2_bad_negprot_reserved2, { "smb2.bad_negprot_reserved2", PI_MALFORMED, PI_ERROR, "Negotiate Protocol response Reserved2 is nonzero", EXPFILL }}, |
16216 | 14 | { &ei_smb2_invalid_getinfo_offset, { "smb2.invalid_getinfo_offset", PI_MALFORMED, PI_ERROR, "Input buffer offset isn't past the fixed data in the message", EXPFILL }}, |
16217 | 14 | { &ei_smb2_invalid_getinfo_size, { "smb2.invalid_getinfo_size", PI_MALFORMED, PI_ERROR, "Input buffer length goes past the end of the message", EXPFILL }}, |
16218 | 14 | { &ei_smb2_empty_getinfo_buffer, { "smb2.empty_getinfo_buffer", PI_PROTOCOL, PI_WARN, "Input buffer length is empty for a quota request", EXPFILL }}, |
16219 | 14 | { &ei_smb2_invalid_signature, { "smb2.invalid_signature", PI_MALFORMED, PI_ERROR, "Invalid Signature", EXPFILL }}, |
16220 | 14 | }; |
16221 | | |
16222 | 14 | expert_module_t* expert_smb2; |
16223 | | |
16224 | | /* SessionID <=> SessionKey mappings for decryption */ |
16225 | 14 | uat_t *seskey_uat; |
16226 | | |
16227 | 14 | static uat_field_t seskey_uat_fields[] = { |
16228 | 14 | UAT_FLD_BUFFER(seskey_list, id, "Session ID", "The session ID buffer, coded as hex string, as it appears on the wire (LE)."), |
16229 | 14 | UAT_FLD_BUFFER(seskey_list, seskey, "Session Key", "The secret session key buffer, coded as 16-byte hex string."), |
16230 | 14 | UAT_FLD_BUFFER(seskey_list, s2ckey, "Server-to-Client", "The AES-128 key used by the client to decrypt server messages, coded as 16-byte hex string."), |
16231 | 14 | UAT_FLD_BUFFER(seskey_list, c2skey, "Client-to-Server", "The AES-128 key used by the server to decrypt client messages, coded as 16-byte hex string."), |
16232 | 14 | UAT_END_FIELDS |
16233 | 14 | }; |
16234 | | |
16235 | 14 | proto_smb2 = proto_register_protocol("SMB2 (Server Message Block Protocol version 2)", |
16236 | 14 | "SMB2", "smb2"); |
16237 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
16238 | 14 | proto_register_field_array(proto_smb2, hf, array_length(hf)); |
16239 | 14 | expert_smb2 = expert_register_protocol(proto_smb2); |
16240 | 14 | expert_register_field_array(expert_smb2, ei, array_length(ei)); |
16241 | | |
16242 | 14 | smb2_module = prefs_register_protocol(proto_smb2, NULL); |
16243 | 14 | prefs_register_bool_preference(smb2_module, "eosmb2_take_name_as_fid", |
16244 | 14 | "Use the full file name as File ID when exporting an SMB2 object", |
16245 | 14 | "Whether the export object functionality will take the full path file name as file identifier", |
16246 | 14 | &eosmb2_take_name_as_fid); |
16247 | | |
16248 | 14 | prefs_register_bool_preference(smb2_module, "pipe_reassembly", |
16249 | 14 | "Reassemble Named Pipes over SMB2", |
16250 | 14 | "Whether the dissector should reassemble Named Pipes over SMB2 commands", |
16251 | 14 | &smb2_pipe_reassembly); |
16252 | | |
16253 | 14 | prefs_register_bool_preference(smb2_module, "verify_signatures", |
16254 | 14 | "Verify SMB2 Signatures", |
16255 | 14 | "Whether the dissector should try to verify SMB2 signatures", |
16256 | 14 | &smb2_verify_signatures); |
16257 | | |
16258 | 14 | seskey_uat = uat_new("Secret session key to use for decryption", |
16259 | 14 | sizeof(smb2_seskey_field_t), |
16260 | 14 | "smb2_seskey_list", |
16261 | 14 | true, |
16262 | 14 | &seskey_list, |
16263 | 14 | &num_seskey_list, |
16264 | 14 | (UAT_AFFECTS_DISSECTION | UAT_AFFECTS_FIELDS), |
16265 | 14 | NULL, |
16266 | 14 | seskey_list_copy_cb, |
16267 | 14 | seskey_list_update_cb, |
16268 | 14 | seskey_list_free_cb, |
16269 | 14 | NULL, |
16270 | 14 | NULL, |
16271 | 14 | seskey_uat_fields); |
16272 | | |
16273 | 14 | prefs_register_uat_preference(smb2_module, |
16274 | 14 | "seskey_list", |
16275 | 14 | "Secret session keys for decryption", |
16276 | 14 | "A table of Session ID to Session keys mappings used to decrypt traffic.", |
16277 | 14 | seskey_uat); |
16278 | | |
16279 | 14 | smb2_pipe_subdissector_list = register_heur_dissector_list_with_description("smb2_pipe_subdissectors", "SMB2 Pipe data", proto_smb2); |
16280 | | /* |
16281 | | * XXX - addresses_ports_reassembly_table_functions? |
16282 | | * Probably correct for SMB-over-NBT and SMB-over-TCP, |
16283 | | * as stuff from two different connections should |
16284 | | * probably not be combined, but what about other |
16285 | | * transports for SMB, e.g. NBF or Netware? |
16286 | | */ |
16287 | 14 | reassembly_table_register(&smb2_pipe_reassembly_table, |
16288 | 14 | &addresses_reassembly_table_functions); |
16289 | | |
16290 | 14 | smb2_tap = register_tap("smb2"); |
16291 | 14 | smb2_eo_tap = register_tap("smb_eo"); /* SMB Export Object tap */ |
16292 | | |
16293 | 14 | register_srt_table(proto_smb2, NULL, 1, smb2stat_packet, smb2stat_init, NULL); |
16294 | 14 | smb2_sessions = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), smb2_sesid_info_hash, smb2_sesid_info_equal); |
16295 | 14 | } |
16296 | | |
16297 | | void |
16298 | | proto_reg_handoff_smb2(void) |
16299 | 14 | { |
16300 | 14 | gssapi_handle = find_dissector_add_dependency("gssapi", proto_smb2); |
16301 | 14 | ntlmssp_handle = find_dissector_add_dependency("ntlmssp", proto_smb2); |
16302 | 14 | rsvd_handle = find_dissector_add_dependency("rsvd", proto_smb2); |
16303 | 14 | heur_dissector_add("netbios", dissect_smb2_heur, "SMB2 over Netbios", "smb2_netbios", proto_smb2, HEURISTIC_ENABLE); |
16304 | 14 | heur_dissector_add("smb_direct", dissect_smb2_heur, "SMB2 over SMB Direct", "smb2_smb_direct", proto_smb2, HEURISTIC_ENABLE); |
16305 | 14 | } |
16306 | | |
16307 | | /* |
16308 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
16309 | | * |
16310 | | * Local variables: |
16311 | | * c-basic-offset: 8 |
16312 | | * tab-width: 8 |
16313 | | * indent-tabs-mode: t |
16314 | | * End: |
16315 | | * |
16316 | | * vi: set shiftwidth=8 tabstop=8 noexpandtab: |
16317 | | * :indentSize=8:tabSize=8:noTabs=false: |
16318 | | */ |