2 * Routines for smb2 packet dissection
5 * See http://wiki.wireshark.org/SMB2 for documentation of
7 * If you edit this file, keep the wiki updated as well.
11 * Wireshark - Network traffic analyzer
12 * By Gerald Combs <gerald@wireshark.org>
13 * Copyright 1998 Gerald Combs
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 #include <epan/packet.h>
35 #include <epan/conversation.h>
37 #include <epan/emem.h>
39 #include "packet-smb2.h"
40 #include "packet-dcerpc.h"
41 #include "packet-ntlmssp.h"
42 #include "packet-windows-common.h"
43 #include "packet-smb-common.h"
44 #include "packet-smb.h"
45 #include "packet-dcerpc-nt.h"
50 static int proto_smb2 = -1;
51 static int hf_smb2_cmd = -1;
52 static int hf_smb2_nt_status = -1;
53 static int hf_smb2_response_to = -1;
54 static int hf_smb2_response_in = -1;
55 static int hf_smb2_time = -1;
56 static int hf_smb2_header_len = -1;
57 static int hf_smb2_seqnum = -1;
58 static int hf_smb2_pid = -1;
59 static int hf_smb2_tid = -1;
60 static int hf_smb2_aid = -1;
61 static int hf_smb2_sesid = -1;
62 static int hf_smb2_previous_sesid = -1;
63 static int hf_smb2_flags_response = -1;
64 static int hf_smb2_flags_async_cmd = -1;
65 static int hf_smb2_flags_dfs_op = -1;
66 static int hf_smb2_flags_chained = -1;
67 static int hf_smb2_flags_signature = -1;
68 static int hf_smb2_chain_offset = -1;
69 static int hf_smb2_response_buffer_offset = -1;
70 static int hf_smb2_security_blob_offset = -1;
71 static int hf_smb2_security_blob_len = -1;
72 static int hf_smb2_security_blob = -1;
73 static int hf_smb2_ioctl_in_data = -1;
74 static int hf_smb2_ioctl_out_data = -1;
75 static int hf_smb2_unknown = -1;
76 static int hf_smb2_unknown_timestamp = -1;
77 static int hf_smb2_create_timestamp = -1;
78 static int hf_smb2_oplock = -1;
79 static int hf_smb2_close_flags = -1;
80 static int hf_smb2_notify_flags = -1;
81 static int hf_smb2_last_access_timestamp = -1;
82 static int hf_smb2_last_write_timestamp = -1;
83 static int hf_smb2_last_change_timestamp = -1;
84 static int hf_smb2_current_time = -1;
85 static int hf_smb2_boot_time = -1;
86 static int hf_smb2_filename = -1;
87 static int hf_smb2_filename_len = -1;
88 static int hf_smb2_nlinks = -1;
89 static int hf_smb2_delete_pending = -1;
90 static int hf_smb2_is_directory = -1;
91 static int hf_smb2_file_id = -1;
92 static int hf_smb2_allocation_size = -1;
93 static int hf_smb2_end_of_file = -1;
94 static int hf_smb2_tree = -1;
95 static int hf_smb2_find_pattern = -1;
96 static int hf_smb2_find_info_level = -1;
97 static int hf_smb2_find_info_blob = -1;
98 static int hf_smb2_client_guid = -1;
99 static int hf_smb2_server_guid = -1;
100 static int hf_smb2_object_id = -1;
101 static int hf_smb2_birth_volume_id = -1;
102 static int hf_smb2_birth_object_id = -1;
103 static int hf_smb2_domain_id = -1;
104 static int hf_smb2_class = -1;
105 static int hf_smb2_infolevel = -1;
106 static int hf_smb2_infolevel_file_info = -1;
107 static int hf_smb2_infolevel_fs_info = -1;
108 static int hf_smb2_infolevel_sec_info = -1;
109 static int hf_smb2_max_response_size = -1;
110 static int hf_smb2_max_ioctl_in_size = -1;
111 static int hf_smb2_max_ioctl_out_size = -1;
112 static int hf_smb2_required_buffer_size = -1;
113 static int hf_smb2_response_size = -1;
114 static int hf_smb2_setinfo_size = -1;
115 static int hf_smb2_setinfo_offset = -1;
116 static int hf_smb2_file_basic_info = -1;
117 static int hf_smb2_file_standard_info = -1;
118 static int hf_smb2_file_internal_info = -1;
119 static int hf_smb2_file_ea_info = -1;
120 static int hf_smb2_file_access_info = -1;
121 static int hf_smb2_file_rename_info = -1;
122 static int hf_smb2_file_disposition_info = -1;
123 static int hf_smb2_file_position_info = -1;
124 static int hf_smb2_file_info_0f = -1;
125 static int hf_smb2_file_mode_info = -1;
126 static int hf_smb2_file_alignment_info = -1;
127 static int hf_smb2_file_all_info = -1;
128 static int hf_smb2_file_allocation_info = -1;
129 static int hf_smb2_file_endoffile_info = -1;
130 static int hf_smb2_file_alternate_name_info = -1;
131 static int hf_smb2_file_stream_info = -1;
132 static int hf_smb2_file_pipe_info = -1;
133 static int hf_smb2_file_compression_info = -1;
134 static int hf_smb2_file_network_open_info = -1;
135 static int hf_smb2_file_attribute_tag_info = -1;
136 static int hf_smb2_fs_info_01 = -1;
137 static int hf_smb2_fs_info_03 = -1;
138 static int hf_smb2_fs_info_04 = -1;
139 static int hf_smb2_fs_info_05 = -1;
140 static int hf_smb2_fs_info_06 = -1;
141 static int hf_smb2_fs_info_07 = -1;
142 static int hf_smb2_fs_objectid_info = -1;
143 static int hf_smb2_sec_info_00 = -1;
144 static int hf_smb2_fid = -1;
145 static int hf_smb2_write_length = -1;
146 static int hf_smb2_write_data = -1;
147 static int hf_smb2_read_length = -1;
148 static int hf_smb2_read_remaining = -1;
149 static int hf_smb2_file_offset = -1;
150 static int hf_smb2_read_data = -1;
151 static int hf_smb2_disposition_delete_on_close = -1;
152 static int hf_smb2_create_disposition = -1;
153 static int hf_smb2_create_chain_offset = -1;
154 static int hf_smb2_create_chain_data = -1;
155 static int hf_smb2_data_offset = -1;
156 static int hf_smb2_data_length = -1;
157 static int hf_smb2_extrainfo = -1;
158 static int hf_smb2_create_action = -1;
159 static int hf_smb2_next_offset = -1;
160 static int hf_smb2_ea_size = -1;
161 static int hf_smb2_ea_flags = -1;
162 static int hf_smb2_ea_name_len = -1;
163 static int hf_smb2_ea_data_len = -1;
164 static int hf_smb2_ea_name = -1;
165 static int hf_smb2_ea_data = -1;
166 static int hf_smb2_buffer_code_len = -1;
167 static int hf_smb2_buffer_code_flags_dyn = -1;
168 static int hf_smb2_olb_offset = -1;
169 static int hf_smb2_olb_length = -1;
170 static int hf_smb2_tag = -1;
171 static int hf_smb2_impersonation_level = -1;
172 static int hf_smb2_ioctl_function = -1;
173 static int hf_smb2_ioctl_function_device = -1;
174 static int hf_smb2_ioctl_function_access = -1;
175 static int hf_smb2_ioctl_function_function = -1;
176 static int hf_smb2_ioctl_function_method = -1;
177 static int hf_smb2_ioctl_shadow_copy_num_volumes = -1;
178 static int hf_smb2_ioctl_shadow_copy_num_labels = -1;
179 static int hf_smb2_ioctl_shadow_copy_count = -1;
180 static int hf_smb2_ioctl_shadow_copy_label = -1;
181 static int hf_smb2_compression_format = -1;
182 static int hf_smb2_FILE_OBJECTID_BUFFER = -1;
183 static int hf_smb2_acct_name = -1;
184 static int hf_smb2_domain_name = -1;
185 static int hf_smb2_host_name = -1;
186 static int hf_smb2_auth_frame = -1;
187 static int hf_smb2_tcon_frame = -1;
188 static int hf_smb2_share_type = -1;
189 static int hf_smb2_signature = -1;
190 static int hf_smb2_epoch = -1;
191 static int hf_smb2_credits_requested = -1;
192 static int hf_smb2_credits_granted = -1;
193 static int hf_smb2_dialect_count = -1;
194 static int hf_smb2_security_mode = -1;
195 static int hf_smb2_secmode_flags_sign_required = -1;
196 static int hf_smb2_secmode_flags_sign_enabled = -1;
197 static int hf_smb2_capabilities = -1;
198 static int hf_smb2_cap_dfs = -1;
199 static int hf_smb2_dialect = -1;
200 static int hf_smb2_max_trans_size = -1;
201 static int hf_smb2_max_read_size = -1;
202 static int hf_smb2_max_write_size = -1;
203 static int hf_smb2_vcnum = -1;
204 static int hf_smb2_channel = -1;
205 static int hf_smb2_session_flags = -1;
206 static int hf_smb2_ses_flags_guest = -1;
207 static int hf_smb2_ses_flags_null = -1;
208 static int hf_smb2_share_flags = -1;
209 static int hf_smb2_share_flags_dfs = -1;
210 static int hf_smb2_share_flags_dfs_root = -1;
211 static int hf_smb2_share_flags_restrict_exclusive_opens = -1;
212 static int hf_smb2_share_flags_force_shared_delete = -1;
213 static int hf_smb2_share_flags_allow_namespace_caching = -1;
214 static int hf_smb2_share_flags_access_based_dir_enum = -1;
215 static int hf_smb2_share_caching = -1;
216 static int hf_smb2_share_caps = -1;
217 static int hf_smb2_share_caps_dfs = -1;
218 static int hf_smb2_create_flags = -1;
219 static int hf_smb2_lock_count = -1;
220 static int hf_smb2_min_count = -1;
221 static int hf_smb2_remaining_bytes = -1;
222 static int hf_smb2_channel_info_offset = -1;
223 static int hf_smb2_channel_info_length = -1;
224 static int hf_smb2_ioctl_flags = -1;
225 static int hf_smb2_ioctl_is_fsctl = -1;
226 static int hf_smb2_close_pq_attrib = -1;
227 static int hf_smb2_notify_watch_tree = -1;
228 static int hf_smb2_output_buffer_len = -1;
229 static int hf_smb2_notify_out_data = -1;
230 static int hf_smb2_find_flags = -1;
231 static int hf_smb2_find_flags_restart_scans = -1;
232 static int hf_smb2_find_flags_single_entry = -1;
233 static int hf_smb2_find_flags_index_specified = -1;
234 static int hf_smb2_find_flags_reopen = -1;
235 static int hf_smb2_file_index = -1;
236 static int hf_smb2_file_directory_info = -1;
237 static int hf_smb2_both_directory_info = -1;
238 static int hf_smb2_short_name_len = -1;
239 static int hf_smb2_short_name = -1;
240 static int hf_smb2_id_both_directory_info = -1;
241 static int hf_smb2_full_directory_info = -1;
242 static int hf_smb2_file_name_info = -1;
243 static int hf_smb2_lock_info = -1;
244 static int hf_smb2_lock_length = -1;
245 static int hf_smb2_lock_flags = -1;
246 static int hf_smb2_lock_flags_shared = -1;
247 static int hf_smb2_lock_flags_exclusive = -1;
248 static int hf_smb2_lock_flags_unlock = -1;
249 static int hf_smb2_lock_flags_fail_immediately = -1;
250 static int hf_smb2_error_byte_count = -1;
251 static int hf_smb2_error_data = -1;
252 static int hf_smb2_error_reserved = -1;
254 static gint ett_smb2 = -1;
255 static gint ett_smb2_olb = -1;
256 static gint ett_smb2_ea = -1;
257 static gint ett_smb2_header = -1;
258 static gint ett_smb2_command = -1;
259 static gint ett_smb2_secblob = -1;
260 static gint ett_smb2_file_basic_info = -1;
261 static gint ett_smb2_file_standard_info = -1;
262 static gint ett_smb2_file_internal_info = -1;
263 static gint ett_smb2_file_ea_info = -1;
264 static gint ett_smb2_file_access_info = -1;
265 static gint ett_smb2_file_position_info = -1;
266 static gint ett_smb2_file_mode_info = -1;
267 static gint ett_smb2_file_alignment_info = -1;
268 static gint ett_smb2_file_all_info = -1;
269 static gint ett_smb2_file_allocation_info = -1;
270 static gint ett_smb2_file_endoffile_info = -1;
271 static gint ett_smb2_file_alternate_name_info = -1;
272 static gint ett_smb2_file_stream_info = -1;
273 static gint ett_smb2_file_pipe_info = -1;
274 static gint ett_smb2_file_compression_info = -1;
275 static gint ett_smb2_file_network_open_info = -1;
276 static gint ett_smb2_file_attribute_tag_info = -1;
277 static gint ett_smb2_file_rename_info = -1;
278 static gint ett_smb2_file_disposition_info = -1;
279 static gint ett_smb2_file_info_0f = -1;
280 static gint ett_smb2_fs_info_01 = -1;
281 static gint ett_smb2_fs_info_03 = -1;
282 static gint ett_smb2_fs_info_04 = -1;
283 static gint ett_smb2_fs_info_05 = -1;
284 static gint ett_smb2_fs_info_06 = -1;
285 static gint ett_smb2_fs_info_07 = -1;
286 static gint ett_smb2_fs_objectid_info = -1;
287 static gint ett_smb2_sec_info_00 = -1;
288 static gint ett_smb2_tid_tree = -1;
289 static gint ett_smb2_sesid_tree = -1;
290 static gint ett_smb2_create_chain_element = -1;
291 static gint ett_smb2_MxAc_buffer = -1;
292 static gint ett_smb2_ioctl_function = -1;
293 static gint ett_smb2_FILE_OBJECTID_BUFFER = -1;
294 static gint ett_smb2_flags = -1;
295 static gint ett_smb2_sec_mode = -1;
296 static gint ett_smb2_capabilities = -1;
297 static gint ett_smb2_ses_flags = -1;
298 static gint ett_smb2_share_flags = -1;
299 static gint ett_smb2_share_caps = -1;
300 static gint ett_smb2_ioctl_flags = -1;
301 static gint ett_smb2_close_flags = -1;
302 static gint ett_smb2_notify_flags = -1;
303 static gint ett_smb2_find_flags = -1;
304 static gint ett_smb2_file_directory_info = -1;
305 static gint ett_smb2_both_directory_info = -1;
306 static gint ett_smb2_id_both_directory_info = -1;
307 static gint ett_smb2_full_directory_info = -1;
308 static gint ett_smb2_file_name_info = -1;
309 static gint ett_smb2_lock_info = -1;
310 static gint ett_smb2_lock_flags = -1;
312 static int smb2_tap = -1;
314 static dissector_handle_t gssapi_handle = NULL;
315 static dissector_handle_t ntlmssp_handle = NULL;
317 static heur_dissector_list_t smb2_heur_subdissector_list;
319 #define SMB2_CLASS_FILE_INFO 0x01
320 #define SMB2_CLASS_FS_INFO 0x02
321 #define SMB2_CLASS_SEC_INFO 0x03
322 static const value_string smb2_class_vals[] = {
323 { SMB2_CLASS_FILE_INFO, "FILE_INFO"},
324 { SMB2_CLASS_FS_INFO, "FS_INFO"},
325 { SMB2_CLASS_SEC_INFO, "SEC_INFO"},
329 #define SMB2_SHARE_TYPE_FILE 0x0001
330 #define SMB2_SHARE_TYPE_IPC 0x0002
331 #define SMB2_SHARE_TYPE_PRINT 0x0003
332 static const value_string smb2_share_type_vals[] = {
333 { SMB2_SHARE_TYPE_FILE, "File Share" },
334 { SMB2_SHARE_TYPE_IPC, "IPC share" },
335 { SMB2_SHARE_TYPE_PRINT, "Print Share" },
340 #define SMB2_FILE_BASIC_INFO 0x04
341 #define SMB2_FILE_STANDARD_INFO 0x05
342 #define SMB2_FILE_INTERNAL_INFO 0x06
343 #define SMB2_FILE_EA_INFO 0x07
344 #define SMB2_FILE_ACCESS_INFO 0x08
345 #define SMB2_FILE_RENAME_INFO 0x0a
346 #define SMB2_FILE_DISPOSITION_INFO 0x0d
347 #define SMB2_FILE_POSITION_INFO 0x0e
348 #define SMB2_FILE_INFO_0f 0x0f
349 #define SMB2_FILE_MODE_INFO 0x10
350 #define SMB2_FILE_ALIGNMENT_INFO 0x11
351 #define SMB2_FILE_ALL_INFO 0x12
352 #define SMB2_FILE_ALLOCATION_INFO 0x13
353 #define SMB2_FILE_ENDOFFILE_INFO 0x14
354 #define SMB2_FILE_ALTERNATE_NAME_INFO 0x15
355 #define SMB2_FILE_STREAM_INFO 0x16
356 #define SMB2_FILE_PIPE_INFO 0x17
357 #define SMB2_FILE_COMPRESSION_INFO 0x1c
358 #define SMB2_FILE_NETWORK_OPEN_INFO 0x22
359 #define SMB2_FILE_ATTRIBUTE_TAG_INFO 0x23
360 static const value_string smb2_file_info_levels[] = {
361 {SMB2_FILE_BASIC_INFO, "SMB2_FILE_BASIC_INFO" },
362 {SMB2_FILE_STANDARD_INFO, "SMB2_FILE_STANDARD_INFO" },
363 {SMB2_FILE_INTERNAL_INFO, "SMB2_FILE_INTERNAL_INFO" },
364 {SMB2_FILE_EA_INFO, "SMB2_FILE_EA_INFO" },
365 {SMB2_FILE_ACCESS_INFO, "SMB2_FILE_ACCESS_INFO" },
366 {SMB2_FILE_RENAME_INFO, "SMB2_FILE_RENAME_INFO" },
367 {SMB2_FILE_DISPOSITION_INFO, "SMB2_FILE_DISPOSITION_INFO" },
368 {SMB2_FILE_POSITION_INFO, "SMB2_FILE_POSITION_INFO" },
369 {SMB2_FILE_INFO_0f, "SMB2_FILE_INFO_0f" },
370 {SMB2_FILE_MODE_INFO, "SMB2_FILE_MODE_INFO" },
371 {SMB2_FILE_ALIGNMENT_INFO, "SMB2_FILE_ALIGNMENT_INFO" },
372 {SMB2_FILE_ALL_INFO, "SMB2_FILE_ALL_INFO" },
373 {SMB2_FILE_ALLOCATION_INFO, "SMB2_FILE_ALLOCATION_INFO" },
374 {SMB2_FILE_ENDOFFILE_INFO, "SMB2_FILE_ENDOFFILE_INFO" },
375 {SMB2_FILE_ALTERNATE_NAME_INFO, "SMB2_FILE_ALTERNATE_NAME_INFO" },
376 {SMB2_FILE_STREAM_INFO, "SMB2_FILE_STREAM_INFO" },
377 {SMB2_FILE_PIPE_INFO, "SMB2_FILE_PIPE_INFO" },
378 {SMB2_FILE_COMPRESSION_INFO, "SMB2_FILE_COMPRESSION_INFO" },
379 {SMB2_FILE_NETWORK_OPEN_INFO, "SMB2_FILE_NETWORK_OPEN_INFO" },
380 {SMB2_FILE_ATTRIBUTE_TAG_INFO, "SMB2_FILE_ATTRIBUTE_TAG_INFO" },
386 #define SMB2_FS_INFO_01 0x01
387 #define SMB2_FS_INFO_03 0x03
388 #define SMB2_FS_INFO_04 0x04
389 #define SMB2_FS_INFO_05 0x05
390 #define SMB2_FS_INFO_06 0x06
391 #define SMB2_FS_INFO_07 0x07
392 #define SMB2_FS_OBJECTID_INFO 0x08
393 static const value_string smb2_fs_info_levels[] = {
394 {SMB2_FS_INFO_01, "SMB2_FS_INFO_01" },
395 {SMB2_FS_INFO_03, "SMB2_FS_INFO_03" },
396 {SMB2_FS_INFO_04, "SMB2_FS_INFO_04" },
397 {SMB2_FS_INFO_05, "SMB2_FS_INFO_05" },
398 {SMB2_FS_INFO_06, "SMB2_FS_INFO_06" },
399 {SMB2_FS_INFO_07, "SMB2_FS_INFO_07" },
400 {SMB2_FS_OBJECTID_INFO, "SMB2_FS_OBJECTID_INFO" },
404 #define SMB2_SEC_INFO_00 0x00
405 static const value_string smb2_sec_info_levels[] = {
406 {SMB2_SEC_INFO_00, "SMB2_SEC_INFO_00" },
410 #define SMB2_FIND_DIRECTORY_INFO 0x01
411 #define SMB2_FIND_FULL_DIRECTORY_INFO 0x02
412 #define SMB2_FIND_BOTH_DIRECTORY_INFO 0x03
413 #define SMB2_FIND_INDEX_SPECIFIED 0x04
414 #define SMB2_FIND_NAME_INFO 0x0C
415 #define SMB2_FIND_ID_BOTH_DIRECTORY_INFO 0x25
416 #define SMB2_FIND_ID_FULL_DIRECTORY_INFO 0x26
417 static const value_string smb2_find_info_levels[] = {
418 { SMB2_FIND_DIRECTORY_INFO, "SMB2_FIND_DIRECTORY_INFO" },
419 { SMB2_FIND_FULL_DIRECTORY_INFO, "SMB2_FIND_FULL_DIRECTORY_INFO" },
420 { SMB2_FIND_BOTH_DIRECTORY_INFO, "SMB2_FIND_BOTH_DIRECTORY_INFO" },
421 { SMB2_FIND_INDEX_SPECIFIED, "SMB2_FIND_INDEX_SPECIFIED" },
422 { SMB2_FIND_NAME_INFO, "SMB2_FIND_NAME_INFO" },
423 { SMB2_FIND_ID_BOTH_DIRECTORY_INFO, "SMB2_FIND_ID_BOTH_DIRECTORY_INFO" },
424 { SMB2_FIND_ID_FULL_DIRECTORY_INFO, "SMB2_FIND_ID_FULL_DIRECTORY_INFO" },
428 /* unmatched smb_saved_info structures.
429 For unmatched smb_saved_info structures we store the smb_saved_info
430 structure using the SEQNUM field.
433 smb2_saved_info_equal_unmatched(gconstpointer k1, gconstpointer k2)
435 smb2_saved_info_t *key1 = (smb2_saved_info_t *)k1;
436 smb2_saved_info_t *key2 = (smb2_saved_info_t *)k2;
437 return key1->seqnum==key2->seqnum;
440 smb2_saved_info_hash_unmatched(gconstpointer k)
442 smb2_saved_info_t *key = (smb2_saved_info_t *)k;
445 hash=(guint32) (key->seqnum&0xffffffff);
449 /* matched smb_saved_info structures.
450 For matched smb_saved_info structures we store the smb_saved_info
451 structure using the SEQNUM field.
454 smb2_saved_info_equal_matched(gconstpointer k1, gconstpointer k2)
456 smb2_saved_info_t *key1 = (smb2_saved_info_t *)k1;
457 smb2_saved_info_t *key2 = (smb2_saved_info_t *)k2;
458 return key1->seqnum==key2->seqnum;
461 smb2_saved_info_hash_matched(gconstpointer k)
463 smb2_saved_info_t *key = (smb2_saved_info_t *)k;
466 hash=(guint32) (key->seqnum&0xffffffff);
470 /* For Tids of a specific conversation.
471 This keeps track of tid->sharename mappings and other information about the
474 We might need to refine this if it occurs that tids are reused on a single
475 conversation. we dont worry about that yet for simplicity
478 smb2_tid_info_equal(gconstpointer k1, gconstpointer k2)
480 smb2_tid_info_t *key1 = (smb2_tid_info_t *)k1;
481 smb2_tid_info_t *key2 = (smb2_tid_info_t *)k2;
482 return key1->tid==key2->tid;
485 smb2_tid_info_hash(gconstpointer k)
487 smb2_tid_info_t *key = (smb2_tid_info_t *)k;
494 /* For Uids of a specific conversation.
495 This keeps track of uid->acct_name mappings and other information about the
498 We might need to refine this if it occurs that uids are reused on a single
499 conversation. we dont worry about that yet for simplicity
502 smb2_sesid_info_equal(gconstpointer k1, gconstpointer k2)
504 smb2_sesid_info_t *key1 = (smb2_sesid_info_t *)k1;
505 smb2_sesid_info_t *key2 = (smb2_sesid_info_t *)k2;
506 return key1->sesid==key2->sesid;
509 smb2_sesid_info_hash(gconstpointer k)
511 smb2_sesid_info_t *key = (smb2_sesid_info_t *)k;
514 hash=(guint32)( ((key->sesid>>32)&0xffffffff)+((key->sesid)&0xffffffff) );
518 static int dissect_smb2_file_info_0f(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, smb2_info_t *si);
521 /* This is a helper to dissect the common string type
527 * This function is called twice, first to decode the offset/length and
528 * second time to dissect the actual string.
529 * It is done this way since there is no guarantee that we have the full packet and we dont
530 * want to abort dissection too early if the packet ends somewhere between the
531 * length/offset and the actual buffer.
534 enum offset_length_buffer_offset_size {
535 OLB_O_UINT16_S_UINT16,
536 OLB_O_UINT16_S_UINT32,
537 OLB_O_UINT32_S_UINT32,
538 OLB_S_UINT32_O_UINT32
540 typedef struct _offset_length_buffer_t {
545 enum offset_length_buffer_offset_size offset_size;
547 } offset_length_buffer_t;
549 dissect_smb2_olb_length_offset(tvbuff_t *tvb, int offset, offset_length_buffer_t *olb,
550 enum offset_length_buffer_offset_size offset_size, int hfindex)
552 olb->hfindex=hfindex;
553 olb->offset_size=offset_size;
555 case OLB_O_UINT16_S_UINT16:
556 olb->off=tvb_get_letohs(tvb, offset);
557 olb->off_offset=offset;
559 olb->len=tvb_get_letohs(tvb, offset);
560 olb->len_offset=offset;
563 case OLB_O_UINT16_S_UINT32:
564 olb->off=tvb_get_letohs(tvb, offset);
565 olb->off_offset=offset;
567 olb->len=tvb_get_letohl(tvb, offset);
568 olb->len_offset=offset;
571 case OLB_O_UINT32_S_UINT32:
572 olb->off=tvb_get_letohl(tvb, offset);
573 olb->off_offset=offset;
575 olb->len=tvb_get_letohl(tvb, offset);
576 olb->len_offset=offset;
579 case OLB_S_UINT32_O_UINT32:
580 olb->len=tvb_get_letohl(tvb, offset);
581 olb->len_offset=offset;
583 olb->off=tvb_get_letohl(tvb, offset);
584 olb->off_offset=offset;
592 #define OLB_TYPE_UNICODE_STRING 0x01
593 #define OLB_TYPE_ASCII_STRING 0x02
595 dissect_smb2_olb_string(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, offset_length_buffer_t *olb, int type)
598 proto_item *item=NULL;
599 proto_tree *tree=NULL;
600 const char *name=NULL;
607 bc=tvb_length_remaining(tvb, offset);
611 tvb_ensure_bytes_exist(tvb, off, len);
613 || ((off+len)>(off+tvb_reported_length_remaining(tvb, off)))){
614 proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset),
615 "Invalid offset/length. Malformed packet");
617 col_append_str(pinfo->cinfo, COL_INFO, " [Malformed packet]");
624 case OLB_TYPE_UNICODE_STRING:
625 name = get_unicode_or_ascii_string(tvb, &off,
626 TRUE, &len, TRUE, TRUE, &bc);
631 item = proto_tree_add_string(parent_tree, olb->hfindex, tvb, offset, len, name);
632 tree = proto_item_add_subtree(item, ett_smb2_olb);
635 case OLB_TYPE_ASCII_STRING:
636 name = get_unicode_or_ascii_string(tvb, &off,
637 FALSE, &len, TRUE, TRUE, &bc);
642 item = proto_tree_add_string(parent_tree, olb->hfindex, tvb, offset, len, name);
643 tree = proto_item_add_subtree(item, ett_smb2_olb);
648 switch(olb->offset_size){
649 case OLB_O_UINT16_S_UINT16:
650 proto_tree_add_item(tree, hf_smb2_olb_offset, tvb, olb->off_offset, 2, TRUE);
651 proto_tree_add_item(tree, hf_smb2_olb_length, tvb, olb->len_offset, 2, TRUE);
653 case OLB_O_UINT16_S_UINT32:
654 proto_tree_add_item(tree, hf_smb2_olb_offset, tvb, olb->off_offset, 2, TRUE);
655 proto_tree_add_item(tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, TRUE);
657 case OLB_O_UINT32_S_UINT32:
658 proto_tree_add_item(tree, hf_smb2_olb_offset, tvb, olb->off_offset, 4, TRUE);
659 proto_tree_add_item(tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, TRUE);
661 case OLB_S_UINT32_O_UINT32:
662 proto_tree_add_item(tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, TRUE);
663 proto_tree_add_item(tree, hf_smb2_olb_offset, tvb, olb->off_offset, 4, TRUE);
671 dissect_smb2_olb_buffer(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb,
672 offset_length_buffer_t *olb, smb2_info_t *si,
673 void (*dissector)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si))
676 proto_item *sub_item=NULL;
677 proto_tree *sub_tree=NULL;
678 tvbuff_t *sub_tvb=NULL;
685 bc=tvb_length_remaining(tvb, offset);
688 tvb_ensure_bytes_exist(tvb, off, len);
690 || ((off+len)>(off+tvb_reported_length_remaining(tvb, off)))){
691 proto_tree_add_text(parent_tree, tvb, offset, tvb_length_remaining(tvb, offset),
692 "Invalid offset/length. Malformed packet");
694 col_append_str(pinfo->cinfo, COL_INFO, " [Malformed packet]");
699 /* if we dont want/need a subtree */
700 if(olb->hfindex==-1){
701 sub_item=parent_tree;
702 sub_tree=parent_tree;
705 sub_item = proto_tree_add_item(parent_tree, olb->hfindex, tvb, offset, len, TRUE);
706 sub_tree = proto_item_add_subtree(sub_item, ett_smb2_olb);
710 switch(olb->offset_size){
711 case OLB_O_UINT16_S_UINT16:
712 proto_tree_add_item(sub_tree, hf_smb2_olb_offset, tvb, olb->off_offset, 2, TRUE);
713 proto_tree_add_item(sub_tree, hf_smb2_olb_length, tvb, olb->len_offset, 2, TRUE);
715 case OLB_O_UINT16_S_UINT32:
716 proto_tree_add_item(sub_tree, hf_smb2_olb_offset, tvb, olb->off_offset, 2, TRUE);
717 proto_tree_add_item(sub_tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, TRUE);
719 case OLB_O_UINT32_S_UINT32:
720 proto_tree_add_item(sub_tree, hf_smb2_olb_offset, tvb, olb->off_offset, 4, TRUE);
721 proto_tree_add_item(sub_tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, TRUE);
723 case OLB_S_UINT32_O_UINT32:
724 proto_tree_add_item(sub_tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, TRUE);
725 proto_tree_add_item(sub_tree, hf_smb2_olb_offset, tvb, olb->off_offset, 4, TRUE);
729 if (off == 0 || len == 0) {
730 proto_item_append_text(sub_item, ": NO DATA");
738 sub_tvb=tvb_new_subset(tvb, off, MIN((int)len, tvb_length_remaining(tvb, off)), len);
740 dissector(sub_tvb, pinfo, sub_tree, si);
746 dissect_smb2_olb_tvb_max_offset(int offset, offset_length_buffer_t *olb)
751 return MAX(offset, (int)(olb->off + olb->len));
754 typedef struct _smb2_function {
755 int (*request)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si);
756 int (*response)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si);
759 static const true_false_string tfs_flags_response = {
760 "This is a RESPONSE",
764 static const true_false_string tfs_flags_async_cmd = {
765 "This is an ASYNC command",
766 "This is a SYNC command"
769 static const true_false_string tfs_flags_dfs_op = {
770 "This is a DFS OPERATION",
771 "This is a normal operation"
774 static const true_false_string tfs_flags_chained = {
775 "This pdu a CHAINED command",
776 "This pdu is NOT a chained command"
779 static const true_false_string tfs_flags_signature = {
780 "This pdu is SIGNED",
781 "This pdu is NOT signed"
784 static const true_false_string tfs_cap_dfs = {
785 "This host supports DFS",
786 "This host does NOT support DFS"
789 static const value_string compression_format_vals[] = {
790 { 0, "COMPRESSION_FORMAT_NONE" },
791 { 1, "COMPRESSION_FORMAT_DEFAULT" },
792 { 2, "COMPRESSION_FORMAT_LZNT1" },
797 static const value_string smb2_ioctl_vals[] = {
798 /* dissector implemented */
799 {0x0011c017, "IOCTL_DO_DCERPC"},
800 {0x00144064, "FSCTL_GET_SHADOW_COPY_DATA"},
801 {0x000900C0, "FSCTL_CREATE_OR_GET_OBJECT_ID"},
802 {0x0009009C, "FSCTL_GET_OBJECT_ID"},
803 {0x000980A0, "FSCTL_DELETE_OBJECT_ID"}, /* no data in/out */
804 {0x00098098, "FSCTL_SET_OBJECT_ID"},
805 {0x000980BC, "FSCTL_SET_OBJECT_ID_EXTENDED"},
806 {0x0009003C, "FSCTL_GET_COMPRESSION"},
807 {0x0009C040, "FSCTL_SET_COMPRESSION"},
809 /* dissector not yet implemented */
810 {0x00090000, "FSCTL_REQUEST_OPLOCK_LEVEL_1"},
811 {0x00090004, "FSCTL_REQUEST_OPLOCK_LEVEL_2"},
812 {0x00090008, "FSCTL_REQUEST_BATCH_OPLOCK"},
813 {0x0009000C, "FSCTL_OPLOCK_BREAK_ACKNOWLEDGE"},
814 {0x00090010, "FSCTL_OPBATCH_ACK_CLOSE_PENDING"},
815 {0x00090014, "FSCTL_OPLOCK_BREAK_NOTIFY"},
816 {0x00090018, "FSCTL_LOCK_VOLUME"},
817 {0x0009001C, "FSCTL_UNLOCK_VOLUME"},
818 {0x00090020, "FSCTL_DISMOUNT_VOLUME"},
819 {0x00090028, "FSCTL_IS_VOLUME_MOUNTED"},
820 {0x0009002C, "FSCTL_IS_PATHNAME_VALID"},
821 {0x00090030, "FSCTL_MARK_VOLUME_DIRTY"},
822 {0x0009003B, "FSCTL_QUERY_RETRIEVAL_POINTERS"},
823 {0x0009004F, "FSCTL_MARK_AS_SYSTEM_HIVE"},
824 {0x00090050, "FSCTL_OPLOCK_BREAK_ACK_NO_2"},
825 {0x00090054, "FSCTL_INVALIDATE_VOLUMES"},
826 {0x00090058, "FSCTL_QUERY_FAT_BPB"},
827 {0x0009005C, "FSCTL_REQUEST_FILTER_OPLOCK"},
828 {0x00090060, "FSCTL_FILESYSTEM_GET_STATISTICS"},
829 {0x00090064, "FSCTL_GET_NTFS_VOLUME_DATA"},
830 {0x00090068, "FSCTL_GET_NTFS_FILE_RECORD"},
831 {0x0009006F, "FSCTL_GET_VOLUME_BITMAP"},
832 {0x00090073, "FSCTL_GET_RETRIEVAL_POINTERS"},
833 {0x00090074, "FSCTL_MOVE_FILE"},
834 {0x00090078, "FSCTL_IS_VOLUME_DIRTY"},
835 {0x0009007C, "FSCTL_GET_HFS_INFORMATION"},
836 {0x00090083, "FSCTL_ALLOW_EXTENDED_DASD_IO"},
837 {0x00090087, "FSCTL_READ_PROPERTY_DATA"},
838 {0x0009008B, "FSCTL_WRITE_PROPERTY_DATA"},
839 {0x0009008F, "FSCTL_FIND_FILES_BY_SID"},
840 {0x00090097, "FSCTL_DUMP_PROPERTY_DATA"},
841 {0x000980A4, "FSCTL_SET_REPARSE_POINT"},
842 {0x000900A8, "FSCTL_GET_REPARSE_POINT"},
843 {0x000980AC, "FSCTL_DELETE_REPARSE_POINT"},
844 {0x000940B3, "FSCTL_ENUM_USN_DATA"},
845 {0x000940B7, "FSCTL_SECURITY_ID_CHECK"},
846 {0x000940BB, "FSCTL_READ_USN_JOURNAL"},
847 {0x000980C4, "FSCTL_SET_SPARSE"},
848 {0x000980C8, "FSCTL_SET_ZERO_DATA"},
849 {0x000940CF, "FSCTL_QUERY_ALLOCATED_RANGES"},
850 {0x000980D0, "FSCTL_ENABLE_UPGRADE"},
851 {0x000900D4, "FSCTL_SET_ENCRYPTION"},
852 {0x000900DB, "FSCTL_ENCRYPTION_FSCTL_IO"},
853 {0x000900DF, "FSCTL_WRITE_RAW_ENCRYPTED"},
854 {0x000900E3, "FSCTL_READ_RAW_ENCRYPTED"},
855 {0x000940E7, "FSCTL_CREATE_USN_JOURNAL"},
856 {0x000940EB, "FSCTL_READ_FILE_USN_DATA"},
857 {0x000940EF, "FSCTL_WRITE_USN_CLOSE_RECORD"},
858 {0x000900F0, "FSCTL_EXTEND_VOLUME"},
863 static const value_string smb2_ioctl_device_vals[] = {
865 { 0x0002, "CD_ROM" },
866 { 0x0003, "CD_ROM_FILE_SYSTEM" },
867 { 0x0004, "CONTROLLER" },
868 { 0x0005, "DATALINK" },
871 { 0x0008, "DISK_FILE_SYSTEM" },
872 { 0x0009, "FILE_SYSTEM" },
873 { 0x000a, "INPORT_PORT" },
874 { 0x000b, "KEYBOARD" },
875 { 0x000c, "MAILSLOT" },
876 { 0x000d, "MIDI_IN" },
877 { 0x000e, "MIDI_OUT" },
879 { 0x0010, "MULTI_UNC_PROVIDER" },
880 { 0x0011, "NAMED_PIPE" },
881 { 0x0012, "NETWORK" },
882 { 0x0013, "NETWORK_BROWSER" },
883 { 0x0014, "NETWORK_FILE_SYSTEM" },
885 { 0x0016, "PARALLEL_PORT" },
886 { 0x0017, "PHYSICAL_NETCARD" },
887 { 0x0018, "PRINTER" },
888 { 0x0019, "SCANNER" },
889 { 0x001a, "SERIAL_MOUSE_PORT" },
890 { 0x001b, "SERIAL_PORT" },
891 { 0x001c, "SCREEN" },
893 { 0x001e, "STREAMS" },
895 { 0x0020, "TAPE_FILE_SYSTEM" },
896 { 0x0021, "TRANSPORT" },
897 { 0x0022, "UNKNOWN" },
899 { 0x0024, "VIRTUAL_DISK" },
900 { 0x0025, "WAVE_IN" },
901 { 0x0026, "WAVE_OUT" },
902 { 0x0027, "8042_PORT" },
903 { 0x0028, "NETWORK_REDIRECTOR" },
904 { 0x0029, "BATTERY" },
905 { 0x002a, "BUS_EXTENDER" },
908 { 0x002d, "MASS_STORAGE" },
911 { 0x0030, "CHANGER" },
912 { 0x0031, "SMARTCARD" },
915 { 0x0034, "FULLSCREEN_VIDEO" },
916 { 0x0035, "DFS_FILE_SYSTEM" },
917 { 0x0036, "DFS_VOLUME" },
918 { 0x0037, "SERENUM" },
919 { 0x0038, "TERMSRV" },
924 static const value_string smb2_ioctl_access_vals[] = {
925 { 0x00, "FILE_ANY_ACCESS" },
926 { 0x01, "FILE_READ_ACCESS" },
927 { 0x02, "FILE_WRITE_ACCESS" },
928 { 0x03, "FILE_READ_WRITE_ACCESS" },
932 static const value_string smb2_ioctl_method_vals[] = {
933 { 0x00, "METHOD_BUFFERED" },
934 { 0x01, "METHOD_IN_DIRECT" },
935 { 0x02, "METHOD_OUT_DIRECT" },
936 { 0x03, "METHOD_NEITHER" },
940 /* this is called from both smb and smb2. */
942 dissect_smb2_ioctl_function(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, guint32 *ioctlfunc)
944 proto_item *item=NULL;
945 proto_tree *tree=NULL;
946 guint32 ioctl_function;
949 item = proto_tree_add_item(parent_tree, hf_smb2_ioctl_function, tvb, offset, 4, TRUE);
950 tree = proto_item_add_subtree(item, ett_smb2_ioctl_function);
953 ioctl_function=tvb_get_letohl(tvb, offset);
954 *ioctlfunc=ioctl_function;
957 proto_tree_add_item(tree, hf_smb2_ioctl_function_device, tvb, offset, 4, TRUE);
958 if (check_col(pinfo->cinfo, COL_INFO)){
960 pinfo->cinfo, COL_INFO, " %s",
961 val_to_str((ioctl_function>>16)&0xffff, smb2_ioctl_device_vals,
962 "Unknown (0x%08X)"));
966 proto_tree_add_item(tree, hf_smb2_ioctl_function_access, tvb, offset, 4, TRUE);
969 proto_tree_add_item(tree, hf_smb2_ioctl_function_function, tvb, offset, 4, TRUE);
970 if (check_col(pinfo->cinfo, COL_INFO)){
972 pinfo->cinfo, COL_INFO, " Function:0x%04x",
973 (ioctl_function>>2)&0x0fff);
977 proto_tree_add_item(tree, hf_smb2_ioctl_function_method, tvb, offset, 4, TRUE);
985 /* fake the dce/rpc support structures so we can piggy back on
986 * dissect_nt_policy_hnd() since this will allow us
987 * a cheap way to track where FIDs are opened, closed
988 * and fid->filename mappings
989 * if we want to do those things in the future.
991 #define FID_MODE_OPEN 0
992 #define FID_MODE_CLOSE 1
993 #define FID_MODE_USE 2
994 #define FID_MODE_DHNQ 3
995 #define FID_MODE_DHNC 4
997 dissect_smb2_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si, int mode)
999 guint8 drep[4] = { 0x10, 0x00, 0x00, 0x00}; /* fake DREP struct */
1000 static dcerpc_info di; /* fake dcerpc_info struct */
1001 static dcerpc_call_value call_data;
1002 void *old_private_data;
1003 e_ctx_hnd policy_hnd;
1004 proto_item *hnd_item=NULL;
1006 guint32 open_frame = 0, close_frame = 0;
1008 di.conformant_run=0;
1009 /* we need di->call_data->flags.NDR64 == 0 */
1010 di.call_data=&call_data;
1011 old_private_data=pinfo->private_data;
1012 pinfo->private_data=&di;
1016 offset = dissect_nt_guid_hnd(tvb, offset, pinfo, tree, drep, hf_smb2_fid, &policy_hnd, &hnd_item, TRUE, FALSE);
1017 if(!pinfo->fd->flags.visited){
1018 if(si->saved && si->saved->extra_info_type==SMB2_EI_FILENAME){
1019 fid_name = se_strdup_printf("File: %s", (char *)si->saved->extra_info);
1021 fid_name = se_strdup_printf("File: ");
1023 dcerpc_store_polhnd_name(&policy_hnd, pinfo,
1027 case FID_MODE_CLOSE:
1028 offset = dissect_nt_guid_hnd(tvb, offset, pinfo, tree, drep, hf_smb2_fid, &policy_hnd, &hnd_item, FALSE, TRUE);
1033 offset = dissect_nt_guid_hnd(tvb, offset, pinfo, tree, drep, hf_smb2_fid, &policy_hnd, &hnd_item, FALSE, FALSE);
1037 pinfo->private_data=old_private_data;
1040 /* put the filename in col_info */
1041 if (dcerpc_fetch_polhnd_data(&policy_hnd, &fid_name, NULL, &open_frame, &close_frame, pinfo->fd->num)) {
1044 proto_item_append_text(hnd_item, " %s", fid_name);
1046 if (check_col(pinfo->cinfo, COL_INFO)){
1047 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", fid_name);
1056 /* this info level is unique to SMB2 and differst from the corresponding
1057 * SMB_FILE_ALL_INFO in SMB
1060 dissect_smb2_file_all_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1062 proto_item *item=NULL;
1063 proto_tree *tree=NULL;
1065 const char *name="";
1069 item = proto_tree_add_item(parent_tree, hf_smb2_file_all_info, tvb, offset, -1, TRUE);
1070 tree = proto_item_add_subtree(item, ett_smb2_file_all_info);
1074 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_create_timestamp);
1077 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_access_timestamp);
1080 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_write_timestamp);
1083 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_change_timestamp);
1085 /* File Attributes */
1086 offset = dissect_file_attributes(tvb, tree, offset, 4);
1088 /* some unknown bytes */
1089 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 4, FALSE);
1092 /* allocation size */
1093 proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, TRUE);
1097 proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, TRUE);
1100 /* number of links */
1101 proto_tree_add_item(tree, hf_smb2_nlinks, tvb, offset, 4, TRUE);
1104 /* delete pending */
1105 proto_tree_add_item(tree, hf_smb2_delete_pending, tvb, offset, 1, TRUE);
1109 proto_tree_add_item(tree, hf_smb2_is_directory, tvb, offset, 1, TRUE);
1116 proto_tree_add_item(tree, hf_smb2_file_id, tvb, offset, 8, TRUE);
1120 proto_tree_add_item(tree, hf_smb2_ea_size, tvb, offset, 4, TRUE);
1124 offset = dissect_smb_access_mask(tvb, tree, offset);
1126 /* some unknown bytes */
1127 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 16, FALSE);
1130 /* file name length */
1131 length=tvb_get_letohs(tvb, offset);
1132 proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 2, TRUE);
1135 /* some unknown bytes */
1136 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 2, FALSE);
1141 bc=tvb_length_remaining(tvb, offset);
1142 name = get_unicode_or_ascii_string(tvb, &offset,
1143 TRUE, &length, TRUE, TRUE, &bc);
1145 proto_tree_add_string(tree, hf_smb2_filename, tvb,
1146 offset, length, name);
1158 dissect_smb2_file_allocation_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1160 proto_item *item=NULL;
1161 proto_tree *tree=NULL;
1166 item = proto_tree_add_item(parent_tree, hf_smb2_file_allocation_info, tvb, offset, -1, TRUE);
1167 tree = proto_item_add_subtree(item, ett_smb2_file_allocation_info);
1170 bc=tvb_length_remaining(tvb, offset);
1171 offset = dissect_qfi_SMB_FILE_ALLOCATION_INFO(tvb, pinfo, tree, offset, &bc, &trunc);
1177 dissect_smb2_file_endoffile_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1179 proto_item *item=NULL;
1180 proto_tree *tree=NULL;
1185 item = proto_tree_add_item(parent_tree, hf_smb2_file_endoffile_info, tvb, offset, -1, TRUE);
1186 tree = proto_item_add_subtree(item, ett_smb2_file_endoffile_info);
1189 bc=tvb_length_remaining(tvb, offset);
1190 offset = dissect_qfi_SMB_FILE_ENDOFFILE_INFO(tvb, pinfo, tree, offset, &bc, &trunc);
1196 dissect_smb2_file_alternate_name_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1198 proto_item *item=NULL;
1199 proto_tree *tree=NULL;
1204 item = proto_tree_add_item(parent_tree, hf_smb2_file_alternate_name_info, tvb, offset, -1, TRUE);
1205 tree = proto_item_add_subtree(item, ett_smb2_file_alternate_name_info);
1208 bc=tvb_length_remaining(tvb, offset);
1209 offset = dissect_qfi_SMB_FILE_ALTERNATE_NAME_INFO(tvb, pinfo, tree, offset, &bc, &trunc);
1216 dissect_smb2_file_basic_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1218 proto_item *item=NULL;
1219 proto_tree *tree=NULL;
1222 item = proto_tree_add_item(parent_tree, hf_smb2_file_basic_info, tvb, offset, -1, TRUE);
1223 tree = proto_item_add_subtree(item, ett_smb2_file_basic_info);
1227 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_create_timestamp);
1230 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_access_timestamp);
1233 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_write_timestamp);
1236 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_change_timestamp);
1238 /* File Attributes */
1239 offset = dissect_file_attributes(tvb, tree, offset, 4);
1241 /* some unknown bytes */
1242 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 4, FALSE);
1249 dissect_smb2_file_standard_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1251 proto_item *item=NULL;
1252 proto_tree *tree=NULL;
1257 item = proto_tree_add_item(parent_tree, hf_smb2_file_standard_info, tvb, offset, -1, TRUE);
1258 tree = proto_item_add_subtree(item, ett_smb2_file_standard_info);
1261 bc=tvb_length_remaining(tvb, offset);
1262 offset = dissect_qfi_SMB_FILE_STANDARD_INFO(tvb, pinfo, tree, offset, &bc, &trunc);
1267 dissect_smb2_file_internal_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1269 proto_item *item=NULL;
1270 proto_tree *tree=NULL;
1275 item = proto_tree_add_item(parent_tree, hf_smb2_file_internal_info, tvb, offset, -1, TRUE);
1276 tree = proto_item_add_subtree(item, ett_smb2_file_internal_info);
1279 bc=tvb_length_remaining(tvb, offset);
1280 offset = dissect_qfi_SMB_FILE_INTERNAL_INFO(tvb, pinfo, tree, offset, &bc, &trunc);
1285 dissect_smb2_file_mode_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1287 proto_item *item=NULL;
1288 proto_tree *tree=NULL;
1293 item = proto_tree_add_item(parent_tree, hf_smb2_file_mode_info, tvb, offset, -1, TRUE);
1294 tree = proto_item_add_subtree(item, ett_smb2_file_mode_info);
1297 bc=tvb_length_remaining(tvb, offset);
1298 offset = dissect_qfi_SMB_FILE_MODE_INFO(tvb, pinfo, tree, offset, &bc, &trunc);
1303 dissect_smb2_file_alignment_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1305 proto_item *item=NULL;
1306 proto_tree *tree=NULL;
1311 item = proto_tree_add_item(parent_tree, hf_smb2_file_alignment_info, tvb, offset, -1, TRUE);
1312 tree = proto_item_add_subtree(item, ett_smb2_file_alignment_info);
1315 bc=tvb_length_remaining(tvb, offset);
1316 offset = dissect_qfi_SMB_FILE_ALIGNMENT_INFO(tvb, pinfo, tree, offset, &bc, &trunc);
1321 dissect_smb2_file_position_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1323 proto_item *item=NULL;
1324 proto_tree *tree=NULL;
1329 item = proto_tree_add_item(parent_tree, hf_smb2_file_position_info, tvb, offset, -1, TRUE);
1330 tree = proto_item_add_subtree(item, ett_smb2_file_position_info);
1333 bc=tvb_length_remaining(tvb, offset);
1334 offset = dissect_qfi_SMB_FILE_POSITION_INFO(tvb, pinfo, tree, offset, &bc, &trunc);
1340 dissect_smb2_file_access_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1342 proto_item *item=NULL;
1343 proto_tree *tree=NULL;
1346 item = proto_tree_add_item(parent_tree, hf_smb2_file_access_info, tvb, offset, -1, TRUE);
1347 tree = proto_item_add_subtree(item, ett_smb2_file_access_info);
1351 offset = dissect_smb_access_mask(tvb, tree, offset);
1357 dissect_smb2_file_ea_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1359 proto_item *item=NULL;
1360 proto_tree *tree=NULL;
1365 item = proto_tree_add_item(parent_tree, hf_smb2_file_ea_info, tvb, offset, -1, TRUE);
1366 tree = proto_item_add_subtree(item, ett_smb2_file_ea_info);
1369 bc=tvb_length_remaining(tvb, offset);
1370 offset = dissect_qfi_SMB_FILE_EA_INFO(tvb, pinfo, tree, offset, &bc, &trunc);
1376 dissect_smb2_file_stream_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1378 proto_item *item=NULL;
1379 proto_tree *tree=NULL;
1384 item = proto_tree_add_item(parent_tree, hf_smb2_file_stream_info, tvb, offset, -1, TRUE);
1385 tree = proto_item_add_subtree(item, ett_smb2_file_stream_info);
1388 bc=tvb_length_remaining(tvb, offset);
1389 offset = dissect_qfi_SMB_FILE_STREAM_INFO(tvb, pinfo, tree, offset, &bc, &trunc, TRUE);
1395 dissect_smb2_file_pipe_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1397 proto_item *item=NULL;
1398 proto_tree *tree=NULL;
1403 item = proto_tree_add_item(parent_tree, hf_smb2_file_pipe_info, tvb, offset, -1, TRUE);
1404 tree = proto_item_add_subtree(item, ett_smb2_file_pipe_info);
1407 bc=tvb_length_remaining(tvb, offset);
1408 offset = dissect_sfi_SMB_FILE_PIPE_INFO(tvb, pinfo, tree, offset, &bc, &trunc);
1414 dissect_smb2_file_compression_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1416 proto_item *item=NULL;
1417 proto_tree *tree=NULL;
1422 item = proto_tree_add_item(parent_tree, hf_smb2_file_compression_info, tvb, offset, -1, TRUE);
1423 tree = proto_item_add_subtree(item, ett_smb2_file_compression_info);
1426 bc=tvb_length_remaining(tvb, offset);
1427 offset = dissect_qfi_SMB_FILE_COMPRESSION_INFO(tvb, pinfo, tree, offset, &bc, &trunc);
1433 dissect_smb2_file_network_open_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1435 proto_item *item=NULL;
1436 proto_tree *tree=NULL;
1441 item = proto_tree_add_item(parent_tree, hf_smb2_file_network_open_info, tvb, offset, -1, TRUE);
1442 tree = proto_item_add_subtree(item, ett_smb2_file_network_open_info);
1446 bc=tvb_length_remaining(tvb, offset);
1447 offset = dissect_qfi_SMB_FILE_NETWORK_OPEN_INFO(tvb, pinfo, tree, offset, &bc, &trunc);
1453 dissect_smb2_file_attribute_tag_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1455 proto_item *item=NULL;
1456 proto_tree *tree=NULL;
1461 item = proto_tree_add_item(parent_tree, hf_smb2_file_attribute_tag_info, tvb, offset, -1, TRUE);
1462 tree = proto_item_add_subtree(item, ett_smb2_file_attribute_tag_info);
1466 bc=tvb_length_remaining(tvb, offset);
1467 offset = dissect_qfi_SMB_FILE_ATTRIBUTE_TAG_INFO(tvb, pinfo, tree, offset, &bc, &trunc);
1472 static const true_false_string tfs_disposition_delete_on_close = {
1473 "DELETE this file when closed",
1474 "Normal access, do not delete on close"
1478 dissect_smb2_file_disposition_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1480 proto_item *item=NULL;
1481 proto_tree *tree=NULL;
1484 item = proto_tree_add_item(parent_tree, hf_smb2_file_disposition_info, tvb, offset, -1, TRUE);
1485 tree = proto_item_add_subtree(item, ett_smb2_file_disposition_info);
1488 /* file disposition */
1489 proto_tree_add_item(tree, hf_smb2_disposition_delete_on_close, tvb, offset, 1, TRUE);
1495 dissect_smb2_file_info_0f(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1497 proto_item *item=NULL;
1498 proto_tree *tree=NULL;
1499 guint32 next_offset;
1500 guint8 ea_name_len, ea_data_len;
1503 item = proto_tree_add_item(parent_tree, hf_smb2_file_info_0f, tvb, offset, -1, TRUE);
1504 tree = proto_item_add_subtree(item, ett_smb2_file_info_0f);
1509 const char *name="";
1510 const char *data="";
1512 int start_offset=offset;
1513 proto_item *ea_item=NULL;
1514 proto_tree *ea_tree=NULL;
1517 ea_item = proto_tree_add_text(tree, tvb, offset, -1, "EA:");
1518 ea_tree = proto_item_add_subtree(ea_item, ett_smb2_ea);
1522 next_offset=tvb_get_letohl(tvb, offset);
1523 proto_tree_add_item(ea_tree, hf_smb2_next_offset, tvb, offset, 4, TRUE);
1527 proto_tree_add_item(ea_tree, hf_smb2_ea_flags, tvb, offset, 1, TRUE);
1530 /* EA Name Length */
1531 ea_name_len=tvb_get_guint8(tvb, offset);
1532 proto_tree_add_item(ea_tree, hf_smb2_ea_name_len, tvb, offset, 1, TRUE);
1535 /* EA Data Length */
1536 ea_data_len=tvb_get_guint8(tvb, offset);
1537 proto_tree_add_item(ea_tree, hf_smb2_ea_data_len, tvb, offset, 1, TRUE);
1540 /* some unknown bytes */
1541 proto_tree_add_item(ea_tree, hf_smb2_unknown, tvb, offset, 1, TRUE);
1547 bc=tvb_length_remaining(tvb, offset);
1548 name = get_unicode_or_ascii_string(tvb, &offset,
1549 FALSE, &length, TRUE, TRUE, &bc);
1551 proto_tree_add_string(ea_tree, hf_smb2_ea_name, tvb,
1552 offset, length, name);
1555 offset += ea_name_len;
1557 /* separator byte */
1563 bc=tvb_length_remaining(tvb, offset);
1564 data = get_unicode_or_ascii_string(tvb, &offset,
1565 FALSE, &length, TRUE, TRUE, &bc);
1567 proto_tree_add_string(ea_tree, hf_smb2_ea_data, tvb,
1568 offset, length, data);
1571 offset += ea_data_len;
1575 proto_item_append_text(ea_item, " %s := %s", name, data);
1577 proto_item_set_len(ea_item, offset-start_offset);
1583 if(next_offset>256){
1587 offset = start_offset+next_offset;
1594 dissect_smb2_file_rename_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1596 proto_item *item=NULL;
1597 proto_tree *tree=NULL;
1599 const char *name="";
1604 item = proto_tree_add_item(parent_tree, hf_smb2_file_rename_info, tvb, offset, -1, TRUE);
1605 tree = proto_item_add_subtree(item, ett_smb2_file_rename_info);
1608 /* some unknown bytes */
1609 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 16, FALSE);
1612 /* file name length */
1613 length=tvb_get_letohs(tvb, offset);
1614 proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 2, TRUE);
1617 /* some unknown bytes */
1618 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 2, FALSE);
1623 bc=tvb_length_remaining(tvb, offset);
1624 name = get_unicode_or_ascii_string(tvb, &offset,
1625 TRUE, &length, TRUE, TRUE, &bc);
1627 proto_tree_add_string(tree, hf_smb2_filename, tvb,
1628 offset, length, name);
1631 if (check_col(pinfo->cinfo, COL_INFO)){
1632 col_append_fstr(pinfo->cinfo, COL_INFO, " NewName:%s",
1638 /* some unknown bytes */
1639 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 4, FALSE);
1646 dissect_smb2_sec_info_00(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1648 proto_item *item=NULL;
1649 proto_tree *tree=NULL;
1652 item = proto_tree_add_item(parent_tree, hf_smb2_sec_info_00, tvb, offset, -1, TRUE);
1653 tree = proto_item_add_subtree(item, ett_smb2_sec_info_00);
1656 /* security descriptor */
1657 offset = dissect_nt_sec_desc(tvb, offset, pinfo, tree, NULL, TRUE, tvb_length_remaining(tvb, offset), NULL);
1663 dissect_smb2_fs_info_05(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1665 proto_item *item=NULL;
1666 proto_tree *tree=NULL;
1670 item = proto_tree_add_item(parent_tree, hf_smb2_fs_info_05, tvb, offset, -1, TRUE);
1671 tree = proto_item_add_subtree(item, ett_smb2_fs_info_05);
1674 bc=tvb_length_remaining(tvb, offset);
1675 offset=dissect_qfsi_FS_ATTRIBUTE_INFO(tvb, pinfo, tree, offset, &bc, TRUE);
1681 dissect_smb2_fs_info_06(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1683 proto_item *item=NULL;
1684 proto_tree *tree=NULL;
1688 item = proto_tree_add_item(parent_tree, hf_smb2_fs_info_06, tvb, offset, -1, TRUE);
1689 tree = proto_item_add_subtree(item, ett_smb2_fs_info_06);
1692 bc=tvb_length_remaining(tvb, offset);
1693 offset=dissect_nt_quota(tvb, tree, offset, &bc);
1699 dissect_smb2_FS_OBJECTID_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1701 proto_item *item=NULL;
1702 proto_tree *tree=NULL;
1705 item = proto_tree_add_item(parent_tree, hf_smb2_fs_objectid_info, tvb, offset, -1, TRUE);
1706 tree = proto_item_add_subtree(item, ett_smb2_fs_objectid_info);
1709 /* FILE_OBJECTID_BUFFER */
1710 offset=dissect_smb2_FILE_OBJECTID_BUFFER(tvb, pinfo, tree, offset);
1716 dissect_smb2_fs_info_07(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1718 proto_item *item=NULL;
1719 proto_tree *tree=NULL;
1723 item = proto_tree_add_item(parent_tree, hf_smb2_fs_info_07, tvb, offset, -1, TRUE);
1724 tree = proto_item_add_subtree(item, ett_smb2_fs_info_07);
1727 bc=tvb_length_remaining(tvb, offset);
1728 offset=dissect_qfsi_FS_FULL_SIZE_INFO(tvb, pinfo, tree, offset, &bc);
1734 dissect_smb2_fs_info_01(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1736 proto_item *item=NULL;
1737 proto_tree *tree=NULL;
1741 item = proto_tree_add_item(parent_tree, hf_smb2_fs_info_01, tvb, offset, -1, TRUE);
1742 tree = proto_item_add_subtree(item, ett_smb2_fs_info_01);
1746 bc=tvb_length_remaining(tvb, offset);
1747 offset=dissect_qfsi_FS_VOLUME_INFO(tvb, pinfo, tree, offset, &bc, TRUE);
1753 dissect_smb2_fs_info_03(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1755 proto_item *item=NULL;
1756 proto_tree *tree=NULL;
1760 item = proto_tree_add_item(parent_tree, hf_smb2_fs_info_03, tvb, offset, -1, TRUE);
1761 tree = proto_item_add_subtree(item, ett_smb2_fs_info_03);
1765 bc=tvb_length_remaining(tvb, offset);
1766 offset=dissect_qfsi_FS_SIZE_INFO(tvb, pinfo, tree, offset, &bc);
1772 dissect_smb2_fs_info_04(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
1774 proto_item *item=NULL;
1775 proto_tree *tree=NULL;
1779 item = proto_tree_add_item(parent_tree, hf_smb2_fs_info_04, tvb, offset, -1, TRUE);
1780 tree = proto_item_add_subtree(item, ett_smb2_fs_info_04);
1784 bc=tvb_length_remaining(tvb, offset);
1785 offset=dissect_qfsi_FS_DEVICE_INFO(tvb, pinfo, tree, offset, &bc);
1790 static const value_string oplock_vals[] = {
1791 { 0x00, "No oplock" },
1792 { 0x01, "Level2 oplock" },
1793 { 0x08, "Exclusive oplock" },
1794 { 0x09, "Batch oplock" },
1799 dissect_smb2_oplock(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
1801 proto_tree_add_item(parent_tree, hf_smb2_oplock, tvb, offset, 1, TRUE);
1808 dissect_smb2_buffercode(proto_tree *tree, tvbuff_t *tvb, int offset, guint16 *length)
1810 guint16 buffer_code;
1812 /* dissect the first 2 bytes of the command PDU */
1813 buffer_code = tvb_get_letohs(tvb, offset);
1814 proto_tree_add_uint(tree, hf_smb2_buffer_code_len, tvb, offset, 2, buffer_code&0xfffe);
1815 proto_tree_add_item(tree, hf_smb2_buffer_code_flags_dyn, tvb, offset, 2, TRUE);
1819 *length=buffer_code&0xfffe;
1825 #define NEGPROT_CAP_DFS 0x00000001
1827 dissect_smb2_capabilities(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
1830 proto_item *item=NULL;
1831 proto_tree *tree=NULL;
1833 cap = tvb_get_letohl(tvb, offset);
1835 item = proto_tree_add_item(parent_tree, hf_smb2_capabilities, tvb, offset, 4, TRUE);
1836 tree = proto_item_add_subtree(item, ett_smb2_capabilities);
1839 proto_tree_add_boolean(tree, hf_smb2_cap_dfs, tvb, offset, 4, cap);
1849 #define NEGPROT_SIGN_REQ 0x0002
1850 #define NEGPROT_SIGN_ENABLED 0x0001
1853 dissect_smb2_secmode(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
1856 proto_item *item=NULL;
1857 proto_tree *tree=NULL;
1859 sm = tvb_get_guint8(tvb, offset);
1861 item = proto_tree_add_item(parent_tree, hf_smb2_security_mode, tvb, offset, 1, TRUE);
1862 tree = proto_item_add_subtree(item, ett_smb2_sec_mode);
1865 proto_tree_add_boolean(tree, hf_smb2_secmode_flags_sign_required, tvb, offset, 1, sm);
1866 proto_tree_add_boolean(tree, hf_smb2_secmode_flags_sign_enabled, tvb, offset, 1, sm);
1874 #define SES_FLAGS_GUEST 0x0001
1875 #define SES_FLAGS_NULL 0x0002
1878 dissect_smb2_ses_flags(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
1881 proto_item *item=NULL;
1882 proto_tree *tree=NULL;
1884 sf = tvb_get_letohs(tvb, offset);
1886 item = proto_tree_add_item(parent_tree, hf_smb2_session_flags, tvb, offset, 2, TRUE);
1887 tree = proto_item_add_subtree(item, ett_smb2_ses_flags);
1890 proto_tree_add_boolean(tree, hf_smb2_ses_flags_null, tvb, offset, 2, sf);
1891 proto_tree_add_boolean(tree, hf_smb2_ses_flags_guest, tvb, offset, 2, sf);
1899 #define SHARE_FLAGS_manual_caching 0x00000000
1900 #define SHARE_FLAGS_auto_caching 0x00000010
1901 #define SHARE_FLAGS_vdo_caching 0x00000020
1902 #define SHARE_FLAGS_no_caching 0x00000030
1904 static const value_string share_cache_vals[] = {
1905 { SHARE_FLAGS_manual_caching, "manual_caching" },
1906 { SHARE_FLAGS_auto_caching, "auto_caching" },
1907 { SHARE_FLAGS_vdo_caching, "vdo_caching" },
1908 { SHARE_FLAGS_no_caching, "no_caching" },
1912 #define SHARE_FLAGS_dfs 0x00000001
1913 #define SHARE_FLAGS_dfs_root 0x00000002
1914 #define SHARE_FLAGS_restrict_exclusive_opens 0x00000100
1915 #define SHARE_FLAGS_force_shared_delete 0x00000200
1916 #define SHARE_FLAGS_allow_namespace_caching 0x00000400
1917 #define SHARE_FLAGS_access_based_dir_enum 0x00000800
1920 dissect_smb2_share_flags(proto_tree *tree, tvbuff_t *tvb, int offset)
1922 static const int *sf_fields[] = {
1923 &hf_smb2_share_flags_dfs,
1924 &hf_smb2_share_flags_dfs_root,
1925 &hf_smb2_share_flags_restrict_exclusive_opens,
1926 &hf_smb2_share_flags_force_shared_delete,
1927 &hf_smb2_share_flags_allow_namespace_caching,
1928 &hf_smb2_share_flags_access_based_dir_enum,
1934 item = proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_share_flags, ett_smb2_share_flags, sf_fields, TRUE);
1936 cp = tvb_get_letohl(tvb, offset);
1938 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);
1946 #define SHARE_CAPS_DFS 0x00000008
1949 dissect_smb2_share_caps(proto_tree *tree, tvbuff_t *tvb, int offset)
1951 static const int *sc_fields[] = {
1952 &hf_smb2_share_caps_dfs,
1957 item = proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_share_caps, ett_smb2_share_caps, sc_fields, TRUE);
1966 dissect_smb2_secblob(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si _U_)
1968 if( (tvb_length(tvb)>=7)
1969 && (!tvb_memeql(tvb, 0, "NTLMSSP", 7))){
1970 call_dissector(ntlmssp_handle, tvb, pinfo, tree);
1972 call_dissector(gssapi_handle, tvb, pinfo, tree);
1978 dissect_smb2_session_setup_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
1980 offset_length_buffer_t s_olb;
1981 const ntlmssp_header_t *ntlmssph;
1982 static int ntlmssp_tap_id = 0;
1985 if(!ntlmssp_tap_id){
1986 GString *error_string;
1987 /* We dont specify any callbacks at all.
1988 * Instead we manually fetch the tapped data after the
1989 * security blob has been fully dissected and before
1990 * we exit from this dissector.
1992 error_string=register_tap_listener("ntlmssp", NULL, NULL,
1993 0, NULL, NULL, NULL);
1995 ntlmssp_tap_id=find_tap_id("ntlmssp");
2001 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2002 /* some unknown bytes */
2005 proto_tree_add_item(tree, hf_smb2_vcnum, tvb, offset, 1, TRUE);
2009 offset = dissect_smb2_secmode(tree, tvb, offset);
2012 offset = dissect_smb2_capabilities(tree, tvb, offset);
2015 proto_tree_add_item(tree, hf_smb2_channel, tvb, offset, 4, TRUE);
2018 /* security blob offset/length */
2019 offset = dissect_smb2_olb_length_offset(tvb, offset, &s_olb, OLB_O_UINT16_S_UINT16, hf_smb2_security_blob);
2021 /* previous session id */
2022 proto_tree_add_item(tree, hf_smb2_previous_sesid, tvb, offset, 8, TRUE);
2026 /* the security blob itself */
2027 dissect_smb2_olb_buffer(pinfo, tree, tvb, &s_olb, si, dissect_smb2_secblob);
2029 offset = dissect_smb2_olb_tvb_max_offset(offset, &s_olb);
2031 /* If we have found a uid->acct_name mapping, store it */
2032 if(!pinfo->fd->flags.visited){
2034 while((ntlmssph=fetch_tapped_data(ntlmssp_tap_id, idx++)) != NULL){
2035 if(ntlmssph && ntlmssph->type==3){
2036 smb2_sesid_info_t *sesid;
2037 sesid=se_alloc(sizeof(smb2_sesid_info_t));
2038 sesid->sesid=si->sesid;
2039 sesid->acct_name=se_strdup(ntlmssph->acct_name);
2040 sesid->domain_name=se_strdup(ntlmssph->domain_name);
2041 sesid->host_name=se_strdup(ntlmssph->host_name);
2042 sesid->auth_frame=pinfo->fd->num;
2043 sesid->tids= g_hash_table_new(smb2_tid_info_hash, smb2_tid_info_equal);
2044 g_hash_table_insert(si->conv->sesids, sesid, sesid);
2053 dissect_smb2_error_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_)
2058 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2061 /* Reserved (2 bytes) */
2062 proto_tree_add_item(tree, hf_smb2_error_reserved, tvb, offset, 2, TRUE);
2065 /* ByteCount (4 bytes): The number of bytes of data contained in ErrorData[]. */
2066 byte_count = tvb_get_ntohl(tvb, offset);
2067 proto_tree_add_item(tree, hf_smb2_error_byte_count, tvb, offset, 4, TRUE);
2070 /* If the ByteCount field is zero then the server MUST supply an ErrorData field
2071 that is one byte in length */
2072 if (byte_count == 0) byte_count = 1;
2074 /* ErrorData (variable): A variable-length data field that contains extended
2075 error information.*/
2076 proto_tree_add_item(tree, hf_smb2_error_data, tvb, offset, byte_count, TRUE);
2077 offset += byte_count;
2083 dissect_smb2_session_setup_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si _U_)
2085 offset_length_buffer_t s_olb;
2087 /* session_setup is special and we don't use dissect_smb2_error_response() here! */
2090 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2093 offset = dissect_smb2_ses_flags(tree, tvb, offset);
2095 /* security blob offset/length */
2096 offset = dissect_smb2_olb_length_offset(tvb, offset, &s_olb, OLB_O_UINT16_S_UINT16, hf_smb2_security_blob);
2098 /* the security blob itself */
2099 dissect_smb2_olb_buffer(pinfo, tree, tvb, &s_olb, si, dissect_smb2_secblob);
2101 offset = dissect_smb2_olb_tvb_max_offset(offset, &s_olb);
2107 dissect_smb2_tree_connect_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si _U_)
2109 offset_length_buffer_t olb;
2113 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2118 /* tree offset/length */
2119 offset = dissect_smb2_olb_length_offset(tvb, offset, &olb, OLB_O_UINT16_S_UINT16, hf_smb2_tree);
2122 buf = dissect_smb2_olb_string(pinfo, tree, tvb, &olb, OLB_TYPE_UNICODE_STRING);
2124 offset = dissect_smb2_olb_tvb_max_offset(offset, &olb);
2126 /* treelen +1 is overkill here if the string is unicode,
2127 * but who ever has more than a handful of TCON in a trace anyways
2129 if(!pinfo->fd->flags.visited && si->saved && buf && olb.len){
2130 si->saved->extra_info_type=SMB2_EI_TREENAME;
2131 si->saved->extra_info=se_alloc(olb.len+1);
2132 g_snprintf((char *)si->saved->extra_info,olb.len+1,"%s",buf);
2135 if (check_col(pinfo->cinfo, COL_INFO)){
2136 col_append_fstr(pinfo->cinfo, COL_INFO, " Tree: %s", buf);
2143 dissect_smb2_tree_connect_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si _U_)
2147 switch (si->status) {
2148 case 0x00000000: break;
2149 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
2153 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2156 share_type = tvb_get_letohs(tvb, offset);
2157 proto_tree_add_item(tree, hf_smb2_share_type, tvb, offset, 2, TRUE);
2160 if(!pinfo->fd->flags.visited && si->saved && si->saved->extra_info_type==SMB2_EI_TREENAME && si->session) {
2161 smb2_tid_info_t *tid, tid_key;
2163 tid_key.tid=si->tid;
2164 tid=g_hash_table_lookup(si->session->tids, &tid_key);
2166 g_hash_table_remove(si->session->tids, &tid_key);
2168 tid=se_alloc(sizeof(smb2_tid_info_t));
2170 tid->name=(char *)si->saved->extra_info;
2171 tid->connect_frame=pinfo->fd->num;
2172 tid->share_type=share_type;
2174 g_hash_table_insert(si->session->tids, tid, tid);
2176 si->saved->extra_info_type=SMB2_EI_NONE;
2177 si->saved->extra_info=NULL;
2181 offset = dissect_smb2_share_flags(tree, tvb, offset);
2183 /* share capabilities */
2184 offset = dissect_smb2_share_caps(tree, tvb, offset);
2186 /* this is some sort of access mask */
2187 offset = dissect_smb_access_mask(tvb, tree, offset);
2193 dissect_smb2_tree_disconnect_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_)
2196 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2205 dissect_smb2_tree_disconnect_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_)
2207 switch (si->status) {
2208 case 0x00000000: break;
2209 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
2213 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2222 dissect_smb2_sessionlogoff_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_)
2225 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2227 /* reserved bytes */
2234 dissect_smb2_sessionlogoff_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_)
2236 switch (si->status) {
2237 case 0x00000000: break;
2238 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
2242 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2244 /* reserved bytes */
2251 dissect_smb2_keepalive_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_)
2254 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2256 /* some unknown bytes */
2257 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 2, TRUE);
2264 dissect_smb2_keepalive_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_)
2266 switch (si->status) {
2267 case 0x00000000: break;
2268 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
2272 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2274 /* some unknown bytes */
2275 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 2, TRUE);
2282 dissect_smb2_notify_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
2284 proto_tree *flags_tree = NULL;
2285 proto_item *flags_item = NULL;
2288 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2292 flags_item = proto_tree_add_item(tree, hf_smb2_notify_flags, tvb, offset, 2, TRUE);
2293 flags_tree = proto_item_add_subtree(flags_item, ett_smb2_notify_flags);
2295 proto_tree_add_item(flags_tree, hf_smb2_notify_watch_tree, tvb, offset, 2, TRUE);
2298 /* output buffer length */
2299 proto_tree_add_item(tree, hf_smb2_output_buffer_len, tvb, offset, 4, TRUE);
2303 offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE);
2305 /* completion filter */
2306 offset = dissect_nt_notify_completion_filter(tvb, tree, offset);
2315 dissect_smb2_notify_data_out(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_)
2317 proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_length(tvb), TRUE);
2321 dissect_smb2_notify_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si)
2323 offset_length_buffer_t olb;
2325 switch (si->status) {
2326 case 0x00000000: break;
2327 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
2331 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2333 /* out buffer offset/length */
2334 offset = dissect_smb2_olb_length_offset(tvb, offset, &olb, OLB_O_UINT16_S_UINT32, hf_smb2_notify_out_data);
2337 dissect_smb2_olb_buffer(pinfo, tree, tvb, &olb, si, dissect_smb2_notify_data_out);
2338 offset = dissect_smb2_olb_tvb_max_offset(offset, &olb);
2343 #define SMB2_FIND_FLAG_RESTART_SCANS 0x01
2344 #define SMB2_FIND_FLAG_SINGLE_ENTRY 0x02
2345 #define SMB2_FIND_FLAG_INDEX_SPECIFIED 0x04
2346 #define SMB2_FIND_FLAG_REOPEN 0x10
2349 dissect_smb2_find_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
2351 offset_length_buffer_t olb;
2354 static const int *f_fields[] = {
2355 &hf_smb2_find_flags_restart_scans,
2356 &hf_smb2_find_flags_single_entry,
2357 &hf_smb2_find_flags_index_specified,
2358 &hf_smb2_find_flags_reopen,
2363 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2365 il=tvb_get_guint8(tvb, offset);
2367 si->saved->infolevel=il;
2371 proto_tree_add_uint(tree, hf_smb2_find_info_level, tvb, offset, 1, il);
2375 proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_find_flags, ett_smb2_find_flags, f_fields, TRUE);
2379 proto_tree_add_item(tree, hf_smb2_file_index, tvb, offset, 4, TRUE);
2383 offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE);
2385 /* search pattern offset/length */
2386 offset = dissect_smb2_olb_length_offset(tvb, offset, &olb, OLB_O_UINT16_S_UINT16, hf_smb2_find_pattern);
2388 /* output buffer length */
2389 proto_tree_add_item(tree, hf_smb2_output_buffer_len, tvb, offset, 4, TRUE);
2392 /* search pattern */
2393 buf = dissect_smb2_olb_string(pinfo, tree, tvb, &olb, OLB_TYPE_UNICODE_STRING);
2395 offset = dissect_smb2_olb_tvb_max_offset(offset, &olb);
2397 if(!pinfo->fd->flags.visited && si->saved && olb.len){
2398 si->saved->extra_info_type=SMB2_EI_FINDPATTERN;
2399 si->saved->extra_info=g_malloc(olb.len+1);
2400 g_snprintf((char *)si->saved->extra_info,olb.len+1,"%s",buf);
2403 if (check_col(pinfo->cinfo, COL_INFO)){
2404 col_append_fstr(pinfo->cinfo, COL_INFO, " %s Pattern: %s",
2405 val_to_str(il, smb2_find_info_levels, "(Level:0x%02x)"),
2412 static void dissect_smb2_file_directory_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, smb2_info_t *si _U_)
2415 proto_item *item=NULL;
2416 proto_tree *tree=NULL;
2417 const char *name=NULL;
2420 while(tvb_length_remaining(tvb, offset) > 4){
2421 int old_offset = offset;
2426 item = proto_tree_add_item(parent_tree, hf_smb2_file_directory_info, tvb, offset, -1, TRUE);
2427 tree = proto_item_add_subtree(item, ett_smb2_file_directory_info);
2431 next_offset = tvb_get_letohl(tvb, offset);
2432 proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, TRUE);
2436 proto_tree_add_item(tree, hf_smb2_file_index, tvb, offset, 4, TRUE);
2440 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_create_timestamp);
2443 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_access_timestamp);
2446 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_write_timestamp);
2449 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_change_timestamp);
2452 proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, TRUE);
2455 /* allocation size */
2456 proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, TRUE);
2459 /* File Attributes */
2460 offset = dissect_file_attributes(tvb, tree, offset, 4);
2462 /* file name length */
2463 file_name_len=tvb_get_letohl(tvb, offset);
2464 proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, TRUE);
2470 name = get_unicode_or_ascii_string(tvb, &offset,
2471 TRUE, &file_name_len, TRUE, TRUE, &bc);
2473 proto_tree_add_string(tree, hf_smb2_filename, tvb,
2474 offset, file_name_len, name);
2475 proto_item_append_text(item, ": %s", name);
2480 proto_item_set_len(item, offset-old_offset);
2482 if (next_offset == 0){
2486 offset = old_offset+next_offset;
2487 if (offset < old_offset) {
2488 proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset),
2489 "Invalid offset/length. Malformed packet");
2496 static void dissect_smb2_full_directory_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, smb2_info_t *si _U_)
2499 proto_item *item=NULL;
2500 proto_tree *tree=NULL;
2501 const char *name=NULL;
2504 while(tvb_length_remaining(tvb, offset) > 4){
2505 int old_offset = offset;
2510 item = proto_tree_add_item(parent_tree, hf_smb2_full_directory_info, tvb, offset, -1, TRUE);
2511 tree = proto_item_add_subtree(item, ett_smb2_full_directory_info);
2515 next_offset = tvb_get_letohl(tvb, offset);
2516 proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, TRUE);
2520 proto_tree_add_item(tree, hf_smb2_file_index, tvb, offset, 4, TRUE);
2524 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_create_timestamp);
2527 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_access_timestamp);
2530 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_write_timestamp);
2533 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_change_timestamp);
2536 proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, TRUE);
2539 /* allocation size */
2540 proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, TRUE);
2543 /* File Attributes */
2544 offset = dissect_file_attributes(tvb, tree, offset, 4);
2546 /* file name length */
2547 file_name_len=tvb_get_letohl(tvb, offset);
2548 proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, TRUE);
2552 proto_tree_add_item(tree, hf_smb2_ea_size, tvb, offset, 4, TRUE);
2558 name = get_unicode_or_ascii_string(tvb, &offset,
2559 TRUE, &file_name_len, TRUE, TRUE, &bc);
2561 proto_tree_add_string(tree, hf_smb2_filename, tvb,
2562 offset, file_name_len, name);
2563 proto_item_append_text(item, ": %s", name);
2568 proto_item_set_len(item, offset-old_offset);
2570 if (next_offset == 0){
2574 offset = old_offset+next_offset;
2575 if (offset < old_offset) {
2576 proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset),
2577 "Invalid offset/length. Malformed packet");
2584 static void dissect_smb2_both_directory_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, smb2_info_t *si _U_)
2587 proto_item *item=NULL;
2588 proto_tree *tree=NULL;
2589 const char *name=NULL;
2592 while(tvb_length_remaining(tvb, offset) > 4){
2593 int old_offset = offset;
2600 item = proto_tree_add_item(parent_tree, hf_smb2_both_directory_info, tvb, offset, -1, TRUE);
2601 tree = proto_item_add_subtree(item, ett_smb2_both_directory_info);
2605 next_offset = tvb_get_letohl(tvb, offset);
2606 proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, TRUE);
2610 proto_tree_add_item(tree, hf_smb2_file_index, tvb, offset, 4, TRUE);
2614 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_create_timestamp);
2617 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_access_timestamp);
2620 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_write_timestamp);
2623 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_change_timestamp);
2626 proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, TRUE);
2629 /* allocation size */
2630 proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, TRUE);
2633 /* File Attributes */
2634 offset = dissect_file_attributes(tvb, tree, offset, 4);
2636 /* file name length */
2637 file_name_len=tvb_get_letohl(tvb, offset);
2638 proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, TRUE);
2642 ea_size=tvb_get_letohl(tvb, offset);
2643 proto_tree_add_item(tree, hf_smb2_ea_size, tvb, offset, 4, TRUE);
2646 /* short name length */
2647 short_name_len=tvb_get_guint8(tvb, offset);
2648 proto_tree_add_item(tree, hf_smb2_short_name_len, tvb, offset, 1, TRUE);
2657 name = get_unicode_or_ascii_string(tvb, &offset,
2658 TRUE, &short_name_len, TRUE, TRUE, &bc);
2660 proto_tree_add_string(tree, hf_smb2_short_name, tvb,
2661 offset, short_name_len, name);
2669 name = get_unicode_or_ascii_string(tvb, &offset,
2670 TRUE, &file_name_len, TRUE, TRUE, &bc);
2672 proto_tree_add_string(tree, hf_smb2_filename, tvb,
2673 offset, file_name_len, name);
2674 proto_item_append_text(item, ": %s", name);
2679 proto_item_set_len(item, offset-old_offset);
2681 if (next_offset == 0){
2685 offset = old_offset+next_offset;
2686 if (offset < old_offset) {
2687 proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset),
2688 "Invalid offset/length. Malformed packet");
2695 static void dissect_smb2_file_name_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, smb2_info_t *si _U_)
2698 proto_item *item=NULL;
2699 proto_tree *tree=NULL;
2700 const char *name=NULL;
2703 while(tvb_length_remaining(tvb, offset) > 4){
2704 int old_offset = offset;
2709 item = proto_tree_add_item(parent_tree, hf_smb2_both_directory_info, tvb, offset, -1, TRUE);
2710 tree = proto_item_add_subtree(item, ett_smb2_both_directory_info);
2714 next_offset = tvb_get_letohl(tvb, offset);
2715 proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, TRUE);
2719 proto_tree_add_item(tree, hf_smb2_file_index, tvb, offset, 4, TRUE);
2722 /* file name length */
2723 file_name_len=tvb_get_letohl(tvb, offset);
2724 proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, TRUE);
2730 name = get_unicode_or_ascii_string(tvb, &offset,
2731 TRUE, &file_name_len, TRUE, TRUE, &bc);
2733 proto_tree_add_string(tree, hf_smb2_filename, tvb,
2734 offset, file_name_len, name);
2735 proto_item_append_text(item, ": %s", name);
2740 proto_item_set_len(item, offset-old_offset);
2742 if (next_offset == 0){
2746 offset = old_offset+next_offset;
2747 if (offset < old_offset) {
2748 proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset),
2749 "Invalid offset/length. Malformed packet");
2756 static void dissect_smb2_id_both_directory_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, smb2_info_t *si _U_)
2759 proto_item *item=NULL;
2760 proto_tree *tree=NULL;
2761 const char *name=NULL;
2764 while(tvb_length_remaining(tvb, offset) > 4){
2765 int old_offset = offset;
2772 item = proto_tree_add_item(parent_tree, hf_smb2_id_both_directory_info, tvb, offset, -1, TRUE);
2773 tree = proto_item_add_subtree(item, ett_smb2_id_both_directory_info);
2777 next_offset = tvb_get_letohl(tvb, offset);
2778 proto_tree_add_item(tree, hf_smb2_next_offset, tvb, offset, 4, TRUE);
2782 proto_tree_add_item(tree, hf_smb2_file_index, tvb, offset, 4, TRUE);
2786 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_create_timestamp);
2789 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_access_timestamp);
2792 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_write_timestamp);
2795 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_change_timestamp);
2798 proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, TRUE);
2801 /* allocation size */
2802 proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, TRUE);
2805 /* File Attributes */
2806 offset = dissect_file_attributes(tvb, tree, offset, 4);
2808 /* file name length */
2809 file_name_len=tvb_get_letohl(tvb, offset);
2810 proto_tree_add_item(tree, hf_smb2_filename_len, tvb, offset, 4, TRUE);
2814 ea_size=tvb_get_letohl(tvb, offset);
2815 proto_tree_add_item(tree, hf_smb2_ea_size, tvb, offset, 4, TRUE);
2818 /* short name length */
2819 short_name_len=tvb_get_guint8(tvb, offset);
2820 proto_tree_add_item(tree, hf_smb2_short_name_len, tvb, offset, 1, TRUE);
2829 name = get_unicode_or_ascii_string(tvb, &offset,
2830 TRUE, &short_name_len, TRUE, TRUE, &bc);
2832 proto_tree_add_string(tree, hf_smb2_short_name, tvb,
2833 offset, short_name_len, name);
2842 proto_tree_add_item(tree, hf_smb2_file_id, tvb, offset, 8, TRUE);
2848 name = get_unicode_or_ascii_string(tvb, &offset,
2849 TRUE, &file_name_len, TRUE, TRUE, &bc);
2851 proto_tree_add_string(tree, hf_smb2_filename, tvb,
2852 offset, file_name_len, name);
2853 proto_item_append_text(item, ": %s", name);
2858 proto_item_set_len(item, offset-old_offset);
2860 if (next_offset == 0){
2864 offset = old_offset+next_offset;
2865 if (offset < old_offset) {
2866 proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset),
2867 "Invalid offset/length. Malformed packet");
2875 typedef struct _smb2_find_dissector_t {
2877 void (*dissector)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si);
2878 } smb2_find_dissector_t;
2880 smb2_find_dissector_t smb2_find_dissectors[] = {
2881 {SMB2_FIND_DIRECTORY_INFO, dissect_smb2_file_directory_info},
2882 {SMB2_FIND_FULL_DIRECTORY_INFO, dissect_smb2_full_directory_info},
2883 {SMB2_FIND_BOTH_DIRECTORY_INFO, dissect_smb2_both_directory_info},
2884 {SMB2_FIND_NAME_INFO, dissect_smb2_file_name_info},
2885 {SMB2_FIND_ID_BOTH_DIRECTORY_INFO,dissect_smb2_id_both_directory_info},
2890 dissect_smb2_find_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si)
2892 smb2_find_dissector_t *dis = smb2_find_dissectors;
2894 while(dis->dissector){
2895 if(si && si->saved && si->saved){
2896 if(dis->level ==si->saved->infolevel){
2897 dis->dissector(tvb, pinfo, tree, si);
2904 proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_length(tvb), FALSE);
2909 dissect_smb2_find_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_)
2911 offset_length_buffer_t olb;
2912 proto_item *item=NULL;
2916 item=proto_tree_add_uint(tree, hf_smb2_find_info_level, tvb, offset, 0, si->saved->infolevel);
2917 PROTO_ITEM_SET_GENERATED(item);
2920 if(!pinfo->fd->flags.visited && si->saved && si->saved->extra_info_type==SMB2_EI_FINDPATTERN) {
2921 if (check_col(pinfo->cinfo, COL_INFO)){
2922 col_append_fstr(pinfo->cinfo, COL_INFO, " %s Pattern: %s",
2923 val_to_str(si->saved->infolevel, smb2_find_info_levels, "(Level:0x%02x)"),
2924 (const char *)si->saved->extra_info);
2927 g_free(si->saved->extra_info);
2928 si->saved->extra_info_type=SMB2_EI_NONE;
2929 si->saved->extra_info=NULL;
2932 switch (si->status) {
2933 case 0x00000000: break;
2934 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
2938 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2940 /* findinfo offset */
2941 offset = dissect_smb2_olb_length_offset(tvb, offset, &olb, OLB_O_UINT16_S_UINT32, hf_smb2_find_info_blob);
2944 dissect_smb2_olb_buffer(pinfo, tree, tvb, &olb, si, dissect_smb2_find_data);
2946 offset = dissect_smb2_olb_tvb_max_offset(offset, &olb);
2952 dissect_smb2_negotiate_protocol_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_)
2957 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
2960 dc = tvb_get_letohs(tvb, offset);
2961 proto_tree_add_item(tree, hf_smb2_dialect_count, tvb, offset, 2, TRUE);
2964 /* security mode, skip second byte */
2965 offset = dissect_smb2_secmode(tree, tvb, offset);
2973 offset = dissect_smb2_capabilities(tree, tvb, offset);
2976 proto_tree_add_item(tree, hf_smb2_client_guid, tvb, offset, 16, TRUE);
2979 /* client boot time */
2980 dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_boot_time);
2984 proto_tree_add_item(tree, hf_smb2_dialect, tvb, offset, 2, TRUE);
2992 dissect_smb2_negotiate_protocol_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si _U_)
2994 offset_length_buffer_t s_olb;
2996 switch (si->status) {
2997 case 0x00000000: break;
2998 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
3002 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3004 /* security mode, skip second byte */
3005 offset = dissect_smb2_secmode(tree, tvb, offset);
3008 /* dialect picked */
3009 proto_tree_add_item(tree, hf_smb2_dialect, tvb, offset, 2, TRUE);
3016 proto_tree_add_item(tree, hf_smb2_server_guid, tvb, offset, 16, TRUE);
3020 offset = dissect_smb2_capabilities(tree, tvb, offset);
3022 /* max trans size */
3023 proto_tree_add_item(tree, hf_smb2_max_trans_size, tvb, offset, 4, TRUE);
3027 proto_tree_add_item(tree, hf_smb2_max_read_size, tvb, offset, 4, TRUE);
3030 /* max write size */
3031 proto_tree_add_item(tree, hf_smb2_max_write_size, tvb, offset, 4, TRUE);
3035 dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_current_time);
3039 dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_boot_time);
3042 /* security blob offset/length */
3043 offset = dissect_smb2_olb_length_offset(tvb, offset, &s_olb, OLB_O_UINT16_S_UINT16, hf_smb2_security_blob);
3045 /* the security blob itself */
3046 dissect_smb2_olb_buffer(pinfo, tree, tvb, &s_olb, si, dissect_smb2_secblob);
3051 offset = dissect_smb2_olb_tvb_max_offset(offset, &s_olb);
3057 dissect_smb2_getinfo_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si)
3059 switch(si->saved->class){
3060 case SMB2_CLASS_FILE_INFO:
3061 switch(si->saved->infolevel){
3063 /* we dont handle this infolevel yet */
3064 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 16, TRUE);
3065 offset += tvb_length_remaining(tvb, offset);
3068 case SMB2_CLASS_FS_INFO:
3069 switch(si->saved->infolevel){
3071 /* we dont handle this infolevel yet */
3072 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 16, TRUE);
3073 offset += tvb_length_remaining(tvb, offset);
3076 case SMB2_CLASS_SEC_INFO:
3077 switch(si->saved->infolevel){
3078 case SMB2_SEC_INFO_00:
3079 dissect_security_information_mask(tvb, tree, offset+8);
3082 /* we dont handle this infolevel yet */
3083 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 16, TRUE);
3084 offset += tvb_length_remaining(tvb, offset);
3088 /* we dont handle this class yet */
3089 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 16, TRUE);
3095 dissect_smb2_class_infolevel(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree, smb2_info_t *si)
3100 static const value_string dummy_value_string[] = {
3103 const value_string *vs;
3105 if(si->flags & SMB2_FLAGS_RESPONSE){
3109 cl=si->saved->class;
3110 il=si->saved->infolevel;
3112 cl=tvb_get_guint8(tvb, offset);
3113 il=tvb_get_guint8(tvb, offset+1);
3115 si->saved->class=cl;
3116 si->saved->infolevel=il;
3122 case SMB2_CLASS_FILE_INFO:
3123 hfindex=hf_smb2_infolevel_file_info;
3124 vs=smb2_file_info_levels;
3126 case SMB2_CLASS_FS_INFO:
3127 hfindex=hf_smb2_infolevel_fs_info;
3128 vs=smb2_fs_info_levels;
3130 case SMB2_CLASS_SEC_INFO:
3131 hfindex=hf_smb2_infolevel_sec_info;
3132 vs=smb2_sec_info_levels;
3135 hfindex=hf_smb2_infolevel;
3136 vs=dummy_value_string;
3141 item=proto_tree_add_uint(tree, hf_smb2_class, tvb, offset, 1, cl);
3142 if(si->flags & SMB2_FLAGS_RESPONSE){
3143 PROTO_ITEM_SET_GENERATED(item);
3146 item=proto_tree_add_uint(tree, hfindex, tvb, offset+1, 1, il);
3147 if(si->flags & SMB2_FLAGS_RESPONSE){
3148 PROTO_ITEM_SET_GENERATED(item);
3152 if(!(si->flags & SMB2_FLAGS_RESPONSE)){
3153 /* Only update COL_INFO for requests. It clutters the
3154 * display ab bit too much if we do it for replies
3157 if (check_col(pinfo->cinfo, COL_INFO)){
3158 col_append_fstr(pinfo->cinfo, COL_INFO, " %s/%s",
3159 val_to_str(cl, smb2_class_vals, "(Class:0x%02x)"),
3160 val_to_str(il, vs, "(Level:0x%02x)"));
3168 dissect_smb2_getinfo_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
3171 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3173 /* class and info level */
3174 offset = dissect_smb2_class_infolevel(pinfo, tvb, offset, tree, si);
3176 /* max response size */
3177 proto_tree_add_item(tree, hf_smb2_max_response_size, tvb, offset, 4, TRUE);
3182 dissect_smb2_getinfo_parameters(tvb, pinfo, tree, offset, si);
3184 /* some unknown bytes */
3185 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 16, TRUE);
3190 offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE);
3196 dissect_smb2_infolevel(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si, guint8 class, guint8 infolevel)
3198 int old_offset = offset;
3201 case SMB2_CLASS_FILE_INFO:
3203 case SMB2_FILE_BASIC_INFO:
3204 dissect_smb2_file_basic_info(tvb, pinfo, tree, offset, si);
3206 case SMB2_FILE_STANDARD_INFO:
3207 dissect_smb2_file_standard_info(tvb, pinfo, tree, offset, si);
3209 case SMB2_FILE_INTERNAL_INFO:
3210 dissect_smb2_file_internal_info(tvb, pinfo, tree, offset, si);
3212 case SMB2_FILE_EA_INFO:
3213 dissect_smb2_file_ea_info(tvb, pinfo, tree, offset, si);
3215 case SMB2_FILE_ACCESS_INFO:
3216 dissect_smb2_file_access_info(tvb, pinfo, tree, offset, si);
3218 case SMB2_FILE_RENAME_INFO:
3219 dissect_smb2_file_rename_info(tvb, pinfo, tree, offset, si);
3221 case SMB2_FILE_DISPOSITION_INFO:
3222 dissect_smb2_file_disposition_info(tvb, pinfo, tree, offset, si);
3224 case SMB2_FILE_POSITION_INFO:
3225 dissect_smb2_file_position_info(tvb, pinfo, tree, offset, si);
3227 case SMB2_FILE_INFO_0f:
3228 dissect_smb2_file_info_0f(tvb, pinfo, tree, offset, si);
3230 case SMB2_FILE_MODE_INFO:
3231 dissect_smb2_file_mode_info(tvb, pinfo, tree, offset, si);
3233 case SMB2_FILE_ALIGNMENT_INFO:
3234 dissect_smb2_file_alignment_info(tvb, pinfo, tree, offset, si);
3236 case SMB2_FILE_ALL_INFO:
3237 dissect_smb2_file_all_info(tvb, pinfo, tree, offset, si);
3239 case SMB2_FILE_ALLOCATION_INFO:
3240 dissect_smb2_file_allocation_info(tvb, pinfo, tree, offset, si);
3242 case SMB2_FILE_ENDOFFILE_INFO:
3243 dissect_smb2_file_endoffile_info(tvb, pinfo, tree, offset, si);
3245 case SMB2_FILE_ALTERNATE_NAME_INFO:
3246 dissect_smb2_file_alternate_name_info(tvb, pinfo, tree, offset, si);
3248 case SMB2_FILE_STREAM_INFO:
3249 dissect_smb2_file_stream_info(tvb, pinfo, tree, offset, si);
3251 case SMB2_FILE_PIPE_INFO:
3252 dissect_smb2_file_pipe_info(tvb, pinfo, tree, offset, si);
3254 case SMB2_FILE_COMPRESSION_INFO:
3255 dissect_smb2_file_compression_info(tvb, pinfo, tree, offset, si);
3257 case SMB2_FILE_NETWORK_OPEN_INFO:
3258 dissect_smb2_file_network_open_info(tvb, pinfo, tree, offset, si);
3260 case SMB2_FILE_ATTRIBUTE_TAG_INFO:
3261 dissect_smb2_file_attribute_tag_info(tvb, pinfo, tree, offset, si);
3264 /* we dont handle this infolevel yet */
3265 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_length_remaining(tvb, offset), TRUE);
3266 offset += tvb_length_remaining(tvb, offset);
3269 case SMB2_CLASS_FS_INFO:
3271 case SMB2_FS_INFO_01:
3272 dissect_smb2_fs_info_01(tvb, pinfo, tree, offset, si);
3274 case SMB2_FS_INFO_03:
3275 dissect_smb2_fs_info_03(tvb, pinfo, tree, offset, si);
3277 case SMB2_FS_INFO_04:
3278 dissect_smb2_fs_info_04(tvb, pinfo, tree, offset, si);
3280 case SMB2_FS_INFO_05:
3281 dissect_smb2_fs_info_05(tvb, pinfo, tree, offset, si);
3283 case SMB2_FS_INFO_06:
3284 dissect_smb2_fs_info_06(tvb, pinfo, tree, offset, si);
3286 case SMB2_FS_INFO_07:
3287 dissect_smb2_fs_info_07(tvb, pinfo, tree, offset, si);
3289 case SMB2_FS_OBJECTID_INFO:
3290 dissect_smb2_FS_OBJECTID_INFO(tvb, pinfo, tree, offset, si);
3293 /* we dont handle this infolevel yet */
3294 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_length_remaining(tvb, offset), TRUE);
3295 offset += tvb_length_remaining(tvb, offset);
3298 case SMB2_CLASS_SEC_INFO:
3300 case SMB2_SEC_INFO_00:
3301 dissect_smb2_sec_info_00(tvb, pinfo, tree, offset, si);
3304 /* we dont handle this infolevel yet */
3305 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_length_remaining(tvb, offset), TRUE);
3306 offset += tvb_length_remaining(tvb, offset);
3310 /* we dont handle this class yet */
3311 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_length_remaining(tvb, offset), TRUE);
3314 /* if we get BUFFER_OVERFLOW there will be truncated data */
3315 if (si->status == 0x80000005) {
3317 item=proto_tree_add_text(tree, tvb, old_offset, 0, "Truncated...");
3318 PROTO_ITEM_SET_GENERATED(item);
3323 dissect_smb2_getinfo_response_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si)
3327 dissect_smb2_infolevel(tvb, pinfo, tree, 0, si, si->saved->class, si->saved->infolevel);
3329 /* some unknown bytes */
3330 proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_length(tvb), FALSE);
3338 dissect_smb2_getinfo_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
3340 offset_length_buffer_t olb;
3342 /* class/infolevel */
3343 dissect_smb2_class_infolevel(pinfo, tvb, offset, tree, si);
3345 switch (si->status) {
3346 case 0x00000000: break;
3347 /* if we get BUFFER_OVERFLOW there will be truncated data */
3348 case 0x80000005: break;
3349 /* if we get BUFFER_TOO_SMALL there will not be any data there, only
3350 * a guin32 specifying how big the buffer needs to be
3353 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3354 offset = dissect_smb2_olb_length_offset(tvb, offset, &olb, OLB_O_UINT16_S_UINT32, -1);
3355 proto_tree_add_item(tree, hf_smb2_required_buffer_size, tvb, offset, 4, TRUE);
3359 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
3364 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3365 /* response buffer offset and size */
3366 offset = dissect_smb2_olb_length_offset(tvb, offset, &olb, OLB_O_UINT16_S_UINT32, -1);
3369 dissect_smb2_olb_buffer(pinfo, tree, tvb, &olb, si, dissect_smb2_getinfo_response_data);
3375 dissect_smb2_close_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
3377 proto_tree *flags_tree = NULL;
3378 proto_item *flags_item = NULL;
3381 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3385 flags_item = proto_tree_add_item(tree, hf_smb2_close_flags, tvb, offset, 2, TRUE);
3386 flags_tree = proto_item_add_subtree(flags_item, ett_smb2_close_flags);
3388 proto_tree_add_item(flags_tree, hf_smb2_close_pq_attrib, tvb, offset, 2, TRUE);
3395 offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_CLOSE);
3401 dissect_smb2_close_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_)
3403 proto_tree *flags_tree = NULL;
3404 proto_item *flags_item = NULL;
3406 switch (si->status) {
3407 case 0x00000000: break;
3408 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
3412 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3416 flags_item = proto_tree_add_item(tree, hf_smb2_close_flags, tvb, offset, 2, TRUE);
3417 flags_tree = proto_item_add_subtree(flags_item, ett_smb2_close_flags);
3425 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_create_timestamp);
3428 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_access_timestamp);
3431 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_write_timestamp);
3434 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_change_timestamp);
3436 /* allocation size */
3437 proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, TRUE);
3441 proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, TRUE);
3444 /* File Attributes */
3445 offset = dissect_file_attributes(tvb, tree, offset, 4);
3451 dissect_smb2_flush_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
3454 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3456 /* some unknown bytes */
3457 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 6, TRUE);
3461 offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE);
3467 dissect_smb2_flush_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_)
3469 switch (si->status) {
3470 case 0x00000000: break;
3471 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
3475 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3477 /* some unknown bytes */
3478 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 2, TRUE);
3486 dissect_smb2_lock_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
3491 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3494 lock_count = tvb_get_letohs(tvb, offset);
3495 proto_tree_add_item(tree, hf_smb2_lock_count, tvb, offset, 2, TRUE);
3502 offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE);
3504 while (lock_count--) {
3505 proto_item *lock_item=NULL;
3506 proto_tree *lock_tree=NULL;
3507 static const int *lf_fields[] = {
3508 &hf_smb2_lock_flags_shared,
3509 &hf_smb2_lock_flags_exclusive,
3510 &hf_smb2_lock_flags_unlock,
3511 &hf_smb2_lock_flags_fail_immediately,
3516 lock_item = proto_tree_add_item(tree, hf_smb2_lock_info, tvb, offset, 24, TRUE);
3517 lock_tree = proto_item_add_subtree(lock_item, ett_smb2_lock_info);
3521 proto_tree_add_item(tree, hf_smb2_file_offset, tvb, offset, 8, TRUE);
3525 proto_tree_add_item(lock_tree, hf_smb2_lock_length, tvb, offset, 8, TRUE);
3529 proto_tree_add_bitmask(lock_tree, tvb, offset, hf_smb2_lock_flags, ett_smb2_lock_flags, lf_fields, TRUE);
3540 dissect_smb2_lock_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_)
3542 switch (si->status) {
3543 case 0x00000000: break;
3544 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
3548 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3550 /* some unknown bytes */
3551 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 2, TRUE);
3557 dissect_smb2_cancel_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_)
3560 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3562 /* some unknown bytes */
3563 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 2, TRUE);
3571 dissect_file_data_dcerpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, int offset, guint32 datalen, proto_tree *top_tree)
3576 tvbuff_t *dcerpc_tvb;
3577 tvblen = tvb_length_remaining(tvb, offset);
3578 dcerpc_tvb = tvb_new_subset(tvb, offset, MIN((int)datalen, tvb_length_remaining(tvb, offset)), datalen);
3580 /* dissect the full PDU */
3581 result = dissector_try_heuristic(smb2_heur_subdissector_list, dcerpc_tvb, pinfo, top_tree);
3591 dissect_smb2_write_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
3597 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3600 proto_tree_add_item(tree, hf_smb2_data_offset, tvb, offset, 2, TRUE);
3604 length=tvb_get_letohl(tvb, offset);
3605 proto_tree_add_item(tree, hf_smb2_write_length, tvb, offset, 4, TRUE);
3609 off=tvb_get_letoh64(tvb, offset);
3610 proto_tree_add_item(tree, hf_smb2_file_offset, tvb, offset, 8, TRUE);
3613 if (check_col(pinfo->cinfo, COL_INFO)){
3614 col_append_fstr(pinfo->cinfo, COL_INFO, " Len:%d Off:%" G_GINT64_MODIFIER "u", length, off);
3618 offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE);
3620 /* some unknown bytes */
3621 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 16, TRUE);
3625 /* data or dcerpc ?*/
3626 if(length && si->tree && si->tree->share_type == SMB2_SHARE_TYPE_IPC){
3627 offset = dissect_file_data_dcerpc(tvb, pinfo, tree, offset, length, si->top_tree);
3631 /* just ordinary data */
3632 proto_tree_add_item(tree, hf_smb2_write_data, tvb, offset, length, TRUE);
3633 offset += MIN(length,(guint32)tvb_length_remaining(tvb, offset));
3640 dissect_smb2_write_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, smb2_info_t *si _U_)
3642 switch (si->status) {
3643 case 0x00000000: break;
3644 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
3648 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3649 /* some unknown bytes */
3650 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 2, TRUE);
3654 proto_tree_add_item(tree, hf_smb2_write_length, tvb, offset, 4, TRUE);
3657 /* some unknown bytes */
3658 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 9, TRUE);
3665 dissect_smb2_IOCTL_DO_DCERPC(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *top_tree, gboolean data_in _U_)
3667 dissect_file_data_dcerpc(tvb, pinfo, tree, offset, tvb_length_remaining(tvb, offset), top_tree);
3673 dissect_smb2_FSCTL_GET_SHADOW_COPY_DATA(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean data_in)
3675 guint32 num_volumes, num_labels;
3677 /* There is no in data */
3683 num_volumes=tvb_get_letohl(tvb, offset);
3684 proto_tree_add_item(tree, hf_smb2_ioctl_shadow_copy_num_volumes, tvb, offset, 4, TRUE);
3688 num_labels=tvb_get_letohl(tvb, offset);
3689 proto_tree_add_item(tree, hf_smb2_ioctl_shadow_copy_num_labels, tvb, offset, 4, TRUE);
3693 proto_tree_add_item(tree, hf_smb2_ioctl_shadow_copy_count, tvb, offset, 4, TRUE);
3696 while(num_volumes--){
3700 int old_offset=offset;
3702 bc=tvb_length_remaining(tvb, offset);
3703 name = get_unicode_or_ascii_string(tvb, &offset,
3704 TRUE, &len, TRUE, FALSE, &bc);
3705 proto_tree_add_string(tree, hf_smb2_ioctl_shadow_copy_label, tvb, old_offset, len, name);
3707 offset = old_offset+len;
3718 dissect_smb2_FILE_OBJECTID_BUFFER(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset)
3720 proto_item *item=NULL;
3721 proto_tree *tree=NULL;
3723 /* FILE_OBJECTID_BUFFER */
3725 item = proto_tree_add_item(parent_tree, hf_smb2_FILE_OBJECTID_BUFFER, tvb, offset, 64, TRUE);
3726 tree = proto_item_add_subtree(item, ett_smb2_FILE_OBJECTID_BUFFER);
3730 proto_tree_add_item(tree, hf_smb2_object_id, tvb, offset, 16, TRUE);
3733 /* Birth Volume ID */
3734 proto_tree_add_item(tree, hf_smb2_birth_volume_id, tvb, offset, 16, TRUE);
3737 /* Birth Object ID */
3738 proto_tree_add_item(tree, hf_smb2_birth_object_id, tvb, offset, 16, TRUE);
3742 proto_tree_add_item(tree, hf_smb2_domain_id, tvb, offset, 16, TRUE);
3749 dissect_smb2_FSCTL_CREATE_OR_GET_OBJECT_ID(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean data_in)
3752 /* There is no in data */
3757 /* FILE_OBJECTID_BUFFER */
3758 offset=dissect_smb2_FILE_OBJECTID_BUFFER(tvb, pinfo, tree, offset);
3764 dissect_smb2_FSCTL_GET_COMPRESSION(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean data_in)
3767 /* There is no in data */
3772 /* compression format */
3773 proto_tree_add_item(tree, hf_smb2_compression_format, tvb, offset, 2, TRUE);
3779 dissect_smb2_FSCTL_SET_COMPRESSION(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean data_in)
3782 /* There is no out data */
3787 /* compression format */
3788 proto_tree_add_item(tree, hf_smb2_compression_format, tvb, offset, 2, TRUE);
3795 dissect_smb2_FSCTL_SET_OBJECT_ID(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean data_in)
3798 /* There is no out data */
3803 /* FILE_OBJECTID_BUFFER */
3804 offset=dissect_smb2_FILE_OBJECTID_BUFFER(tvb, pinfo, tree, offset);
3810 dissect_smb2_FSCTL_SET_OBJECT_ID_EXTENDED(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean data_in)
3813 /* There is no out data */
3818 /* FILE_OBJECTID_BUFFER->ExtendedInfo */
3820 /* Birth Volume ID */
3821 proto_tree_add_item(tree, hf_smb2_birth_volume_id, tvb, offset, 16, TRUE);
3824 /* Birth Object ID */
3825 proto_tree_add_item(tree, hf_smb2_birth_object_id, tvb, offset, 16, TRUE);
3829 proto_tree_add_item(tree, hf_smb2_domain_id, tvb, offset, 16, TRUE);
3836 dissect_smb2_ioctl_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *top_tree, guint32 ioctl_function, gboolean data_in)
3838 switch(ioctl_function){
3840 dissect_smb2_IOCTL_DO_DCERPC(tvb, pinfo, tree, 0, top_tree, data_in);
3842 case 0x00144064: /* FSCTL_GET_SHADOW_COPY_DATA */
3843 dissect_smb2_FSCTL_GET_SHADOW_COPY_DATA(tvb, pinfo, tree, 0, data_in);
3845 case 0x0009009C: /* FSCTL_GET_OBJECT_ID */
3846 case 0x000900c0: /* FSCTL_CREATE_OR_GET_OBJECT_ID */
3847 dissect_smb2_FSCTL_CREATE_OR_GET_OBJECT_ID(tvb, pinfo, tree, 0, data_in);
3849 case 0x00098098: /* FSCTL_SET_OBJECT_ID */
3850 dissect_smb2_FSCTL_SET_OBJECT_ID(tvb, pinfo, tree, 0, data_in);
3852 case 0x000980BC: /* FSCTL_SET_OBJECT_ID_EXTENDED */
3853 dissect_smb2_FSCTL_SET_OBJECT_ID_EXTENDED(tvb, pinfo, tree, 0, data_in);
3855 case 0x0009003C: /* FSCTL_GET_COMPRESSION */
3856 dissect_smb2_FSCTL_GET_COMPRESSION(tvb, pinfo, tree, 0, data_in);
3858 case 0x0009C040: /* FSCTL_SET_COMPRESSION */
3859 dissect_smb2_FSCTL_SET_COMPRESSION(tvb, pinfo, tree, 0, data_in);
3862 proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_length(tvb), TRUE);
3869 dissect_smb2_ioctl_data_in(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si)
3871 dissect_smb2_ioctl_data(tvb, pinfo, tree, si->top_tree, si->ioctl_function, TRUE);
3875 dissect_smb2_ioctl_data_out(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si)
3877 dissect_smb2_ioctl_data(tvb, pinfo, tree, si->top_tree, si->ioctl_function, FALSE);
3881 dissect_smb2_ioctl_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
3883 offset_length_buffer_t o_olb;
3884 offset_length_buffer_t i_olb;
3885 proto_tree *flags_tree = NULL;
3886 proto_item *flags_item = NULL;
3889 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3894 /* ioctl function */
3895 offset = dissect_smb2_ioctl_function(tvb, pinfo, tree, offset, &si->ioctl_function);
3898 offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE);
3900 /* in buffer offset/length */
3901 offset = dissect_smb2_olb_length_offset(tvb, offset, &i_olb, OLB_O_UINT32_S_UINT32, hf_smb2_ioctl_in_data);
3903 /* max ioctl in size */
3904 proto_tree_add_item(tree, hf_smb2_max_ioctl_in_size, tvb, offset, 4, TRUE);
3907 /* out buffer offset/length */
3908 offset = dissect_smb2_olb_length_offset(tvb, offset, &o_olb, OLB_O_UINT32_S_UINT32, hf_smb2_ioctl_out_data);
3910 /* max ioctl out size */
3911 proto_tree_add_item(tree, hf_smb2_max_ioctl_out_size, tvb, offset, 4, TRUE);
3916 flags_item = proto_tree_add_item(tree, hf_smb2_ioctl_flags, tvb, offset, 4, TRUE);
3917 flags_tree = proto_item_add_subtree(flags_item, ett_smb2_ioctl_flags);
3919 proto_tree_add_item(flags_tree, hf_smb2_ioctl_is_fsctl, tvb, offset, 4, TRUE);
3925 /* try to decode these blobs in the order they were encoded
3926 * so that for "short" packets we will dissect as much as possible
3927 * before aborting with "short packet"
3929 if(i_olb.off>o_olb.off){
3931 dissect_smb2_olb_buffer(pinfo, tree, tvb, &o_olb, si, dissect_smb2_ioctl_data_out);
3933 dissect_smb2_olb_buffer(pinfo, tree, tvb, &i_olb, si, dissect_smb2_ioctl_data_in);
3936 dissect_smb2_olb_buffer(pinfo, tree, tvb, &i_olb, si, dissect_smb2_ioctl_data_in);
3938 dissect_smb2_olb_buffer(pinfo, tree, tvb, &o_olb, si, dissect_smb2_ioctl_data_out);
3941 offset = dissect_smb2_olb_tvb_max_offset(offset, &o_olb);
3942 offset = dissect_smb2_olb_tvb_max_offset(offset, &i_olb);
3948 dissect_smb2_ioctl_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
3950 offset_length_buffer_t o_olb;
3951 offset_length_buffer_t i_olb;
3952 proto_tree *flags_tree = NULL;
3953 proto_item *flags_item = NULL;
3955 switch (si->status) {
3956 case 0x00000000: break;
3957 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
3961 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
3963 /* some unknown bytes */
3964 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 2, TRUE);
3967 /* ioctl function */
3968 offset = dissect_smb2_ioctl_function(tvb, pinfo, tree, offset, &si->ioctl_function);
3971 offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE);
3973 /* in buffer offset/length */
3974 offset = dissect_smb2_olb_length_offset(tvb, offset, &i_olb, OLB_O_UINT32_S_UINT32, hf_smb2_ioctl_in_data);
3976 /* out buffer offset/length */
3977 offset = dissect_smb2_olb_length_offset(tvb, offset, &o_olb, OLB_O_UINT32_S_UINT32, hf_smb2_ioctl_out_data);
3982 flags_item = proto_tree_add_item(tree, hf_smb2_ioctl_flags, tvb, offset, 4, TRUE);
3983 flags_tree = proto_item_add_subtree(flags_item, ett_smb2_ioctl_flags);
3990 /* try to decode these blobs in the order they were encoded
3991 * so that for "short" packets we will dissect as much as possible
3992 * before aborting with "short packet"
3994 if(i_olb.off>o_olb.off){
3996 dissect_smb2_olb_buffer(pinfo, tree, tvb, &o_olb, si, dissect_smb2_ioctl_data_out);
3998 dissect_smb2_olb_buffer(pinfo, tree, tvb, &i_olb, si, dissect_smb2_ioctl_data_in);
4001 dissect_smb2_olb_buffer(pinfo, tree, tvb, &i_olb, si, dissect_smb2_ioctl_data_in);
4003 dissect_smb2_olb_buffer(pinfo, tree, tvb, &o_olb, si, dissect_smb2_ioctl_data_out);
4006 offset = dissect_smb2_olb_tvb_max_offset(offset, &i_olb);
4007 offset = dissect_smb2_olb_tvb_max_offset(offset, &o_olb);
4014 dissect_smb2_read_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
4020 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
4022 /* padding and reserved */
4026 len=tvb_get_letohl(tvb, offset);
4027 proto_tree_add_item(tree, hf_smb2_read_length, tvb, offset, 4, TRUE);
4031 off=tvb_get_letoh64(tvb, offset);
4032 proto_tree_add_item(tree, hf_smb2_file_offset, tvb, offset, 8, TRUE);
4035 if (check_col(pinfo->cinfo, COL_INFO)){
4036 col_append_fstr(pinfo->cinfo, COL_INFO, " Len:%d Off:%" G_GINT64_MODIFIER "u", len, off);
4040 offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE);
4043 proto_tree_add_item(tree, hf_smb2_min_count, tvb, offset, 4, TRUE);
4046 proto_tree_add_item(tree, hf_smb2_channel, tvb, offset, 4, TRUE);
4049 /* remaining bytes */
4050 proto_tree_add_item(tree, hf_smb2_remaining_bytes, tvb, offset, 4, TRUE);
4053 /* channel info offset */
4054 proto_tree_add_item(tree, hf_smb2_channel_info_offset, tvb, offset, 2, TRUE);
4057 /* channel info length */
4058 proto_tree_add_item(tree, hf_smb2_channel_info_length, tvb, offset, 2, TRUE);
4061 /* there is a buffer here but it is never used (yet) */
4068 dissect_smb2_read_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si _U_)
4072 switch (si->status) {
4073 case 0x00000000: break;
4074 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
4078 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
4081 proto_tree_add_item(tree, hf_smb2_data_offset, tvb, offset, 2, TRUE);
4084 /* length might even be 64bits if they are ambitious*/
4085 length=tvb_get_letohl(tvb, offset);
4086 proto_tree_add_item(tree, hf_smb2_read_length, tvb, offset, 4, TRUE);
4090 proto_tree_add_item(tree, hf_smb2_read_remaining, tvb, offset, 4, TRUE);
4097 * If the pidvalid flag is set we assume it is a deferred
4098 * STATUS_PENDING read and thus a named pipe (==dcerpc)
4100 if(length && ( (si->tree && si->tree->share_type == SMB2_SHARE_TYPE_IPC)||(si->flags & SMB2_FLAGS_ASYNC_CMD))){
4101 offset = dissect_file_data_dcerpc(tvb, pinfo, tree, offset, length, si->top_tree);
4106 proto_tree_add_item(tree, hf_smb2_read_data, tvb, offset, length, TRUE);
4107 offset += MIN(length,(guint32)tvb_length_remaining(tvb, offset));
4113 dissect_smb2_ExtA_buffer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si)
4115 proto_item *item=NULL;
4117 item = proto_tree_get_parent(tree);
4118 proto_item_append_text(item, ": SMB2_FILE_INFO_0f");
4120 dissect_smb2_file_info_0f(tvb, pinfo, tree, 0, si);
4125 dissect_smb2_TWrp_buffer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_)
4127 proto_item *item=NULL;
4129 item = proto_tree_get_parent(tree);
4130 proto_item_append_text(item, ": Timestamp");
4132 dissect_nt_64bit_time(tvb, tree, 0, hf_smb2_unknown_timestamp);
4139 dissect_smb2_AlSi_buffer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_)
4141 proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, 0, 8, TRUE);
4145 dissect_smb2_DHnQ_buffer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si)
4147 dissect_smb2_fid(tvb, pinfo, tree, 0, si, FID_MODE_DHNQ);
4151 dissect_smb2_DHnC_buffer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si)
4153 dissect_smb2_fid(tvb, pinfo, tree, 0, si, FID_MODE_DHNC);
4157 dissect_smb2_MxAc_buffer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_)
4160 proto_item *item=NULL;
4161 proto_item *sub_item=NULL;
4162 proto_tree *sub_tree=NULL;
4165 item = proto_tree_get_parent(tree);
4168 if (tvb_length(tvb) == 0) {
4170 proto_item_append_text(item, ": NO DATA");
4176 proto_item_append_text(item, ": MxAc INFO");
4177 sub_item = proto_tree_add_text(tree, tvb, offset, -1, "MxAc INFO");
4178 sub_tree = proto_item_add_subtree(sub_item, ett_smb2_MxAc_buffer);
4181 proto_tree_add_item(sub_tree, hf_smb2_unknown, tvb, offset, 4, FALSE);
4184 offset = dissect_smb_access_mask(tvb, sub_tree, offset);
4190 dissect_smb2_create_extra_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, smb2_info_t *si)
4192 offset_length_buffer_t tag_olb;
4193 offset_length_buffer_t data_olb;
4195 guint16 chain_offset;
4198 void (*dissector)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si);
4199 proto_item *sub_item=NULL;
4200 proto_tree *sub_tree=NULL;
4201 proto_item *parent_item=NULL;
4203 chain_offset=tvb_get_letohl(tvb, offset);
4209 sub_item = proto_tree_add_text(parent_tree, tvb, offset, len, "Chain Element");
4210 sub_tree = proto_item_add_subtree(sub_item, ett_smb2_create_chain_element);
4211 parent_item = proto_tree_get_parent(parent_tree);
4215 proto_tree_add_item(sub_tree, hf_smb2_create_chain_offset, tvb, offset, 4, TRUE);
4218 /* tag offset/length */
4219 offset = dissect_smb2_olb_length_offset(tvb, offset, &tag_olb, OLB_O_UINT16_S_UINT32, hf_smb2_tag);
4221 /* data offset/length */
4222 offset = dissect_smb2_olb_length_offset(tvb, offset, &data_olb, OLB_O_UINT16_S_UINT32, hf_smb2_create_chain_data);
4225 tag = dissect_smb2_olb_string(pinfo, sub_tree, tvb, &tag_olb, OLB_TYPE_ASCII_STRING);
4227 proto_item_append_text(parent_item, " %s", tag);
4228 proto_item_append_text(sub_item, ": %s", tag);
4232 if(!strcmp(tag, "ExtA")){
4233 dissector = dissect_smb2_ExtA_buffer;
4234 } else if(!strcmp(tag, "AlSi")){
4235 dissector = dissect_smb2_AlSi_buffer;
4236 } else if(!strcmp(tag, "MxAc")){
4237 dissector = dissect_smb2_MxAc_buffer;
4238 } else if(!strcmp(tag, "DHnQ")){
4239 dissector = dissect_smb2_DHnQ_buffer;
4240 } else if(!strcmp(tag, "DHnC")){
4241 dissector = dissect_smb2_DHnC_buffer;
4242 } else if(!strcmp(tag, "TWrp")){
4243 dissector = dissect_smb2_TWrp_buffer;
4246 dissect_smb2_olb_buffer(pinfo, sub_tree, tvb, &data_olb, si, dissector);
4249 tvbuff_t *chain_tvb;
4250 chain_tvb=tvb_new_subset(tvb, chain_offset, tvb_length_remaining(tvb, chain_offset), tvb_reported_length_remaining(tvb, chain_offset));
4252 /* next extra info */
4253 dissect_smb2_create_extra_info(chain_tvb, pinfo, parent_tree, si);
4259 dissect_smb2_create_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
4261 offset_length_buffer_t f_olb, e_olb;
4265 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
4267 /* security flags */
4271 offset = dissect_smb2_oplock(tree, tvb, offset);
4273 /* impersonation level */
4274 proto_tree_add_item(tree, hf_smb2_impersonation_level, tvb, offset, 4, TRUE);
4278 proto_tree_add_item(tree, hf_smb2_create_flags, tvb, offset, 8, TRUE);
4285 offset = dissect_smb_access_mask(tvb, tree, offset);
4287 /* File Attributes */
4288 offset = dissect_file_attributes(tvb, tree, offset, 4);
4291 offset = dissect_nt_share_access(tvb, tree, offset);
4293 /* create disposition */
4294 proto_tree_add_item(tree, hf_smb2_create_disposition, tvb, offset, 4, TRUE);
4297 /* create options */
4298 offset = dissect_nt_create_options(tvb, tree, offset);
4300 /* filename offset/length */
4301 offset = dissect_smb2_olb_length_offset(tvb, offset, &f_olb, OLB_O_UINT16_S_UINT16, hf_smb2_filename);
4303 /* extrainfo offset */
4304 offset = dissect_smb2_olb_length_offset(tvb, offset, &e_olb, OLB_O_UINT32_S_UINT32, hf_smb2_extrainfo);
4306 /* filename string */
4307 fname = dissect_smb2_olb_string(pinfo, tree, tvb, &f_olb, OLB_TYPE_UNICODE_STRING);
4308 if (check_col(pinfo->cinfo, COL_INFO)){
4309 col_append_fstr(pinfo->cinfo, COL_INFO, " File: %s", fname);
4312 /* save the name if it looks sane */
4313 if(!pinfo->fd->flags.visited){
4314 if(si->saved && si->saved->extra_info_type==SMB2_EI_FILENAME){
4315 g_free(si->saved->extra_info);
4316 si->saved->extra_info=NULL;
4317 si->saved->extra_info_type=SMB2_EI_NONE;
4319 if(si->saved && f_olb.len && f_olb.len<256){
4320 si->saved->extra_info_type=SMB2_EI_FILENAME;
4321 si->saved->extra_info=g_malloc(f_olb.len+1);
4322 g_snprintf(si->saved->extra_info, f_olb.len+1, "%s", fname);
4326 /* If extrainfo_offset is non-null then this points to another
4327 * buffer. The offset is relative to the start of the smb packet
4329 dissect_smb2_olb_buffer(pinfo, tree, tvb, &e_olb, si, dissect_smb2_create_extra_info);
4331 offset = dissect_smb2_olb_tvb_max_offset(offset, &f_olb);
4332 offset = dissect_smb2_olb_tvb_max_offset(offset, &e_olb);
4338 dissect_smb2_create_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
4340 offset_length_buffer_t e_olb;
4342 switch (si->status) {
4343 case 0x00000000: break;
4344 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
4348 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
4351 offset = dissect_smb2_oplock(tree, tvb, offset);
4357 proto_tree_add_item(tree, hf_smb2_create_action, tvb, offset, 4, TRUE);
4361 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_create_timestamp);
4364 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_access_timestamp);
4367 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_write_timestamp);
4370 offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb2_last_change_timestamp);
4372 /* allocation size */
4373 proto_tree_add_item(tree, hf_smb2_allocation_size, tvb, offset, 8, TRUE);
4377 proto_tree_add_item(tree, hf_smb2_end_of_file, tvb, offset, 8, TRUE);
4380 /* File Attributes */
4381 offset = dissect_file_attributes(tvb, tree, offset, 4);
4387 offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_OPEN);
4389 /* extrainfo offset */
4390 offset = dissect_smb2_olb_length_offset(tvb, offset, &e_olb, OLB_O_UINT32_S_UINT32, hf_smb2_extrainfo);
4392 /* If extrainfo_offset is non-null then this points to another
4393 * buffer. The offset is relative to the start of the smb packet
4395 dissect_smb2_olb_buffer(pinfo, tree, tvb, &e_olb, si, dissect_smb2_create_extra_info);
4397 offset = dissect_smb2_olb_tvb_max_offset(offset, &e_olb);
4399 /* free si->saved->extra_info we dont need it any more */
4400 if(si->saved && si->saved->extra_info_type==SMB2_EI_FILENAME){
4401 g_free(si->saved->extra_info);
4402 si->saved->extra_info=NULL;
4403 si->saved->extra_info_type=SMB2_EI_NONE;
4411 dissect_smb2_setinfo_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
4413 guint32 setinfo_size;
4414 guint16 setinfo_offset;
4417 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
4419 /* class and info level */
4420 offset = dissect_smb2_class_infolevel(pinfo, tvb, offset, tree, si);
4423 setinfo_size=tvb_get_letohl(tvb, offset);
4424 proto_tree_add_item(tree, hf_smb2_setinfo_size, tvb, offset, 4, TRUE);
4428 setinfo_offset=tvb_get_letohs(tvb, offset);
4429 proto_tree_add_item(tree, hf_smb2_setinfo_offset, tvb, offset, 2, TRUE);
4432 /* some unknown bytes */
4433 proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 6, TRUE);
4437 offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE);
4441 dissect_smb2_infolevel(tvb, pinfo, tree, setinfo_offset, si, si->saved->class, si->saved->infolevel);
4442 offset = setinfo_offset + setinfo_size;
4448 dissect_smb2_setinfo_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
4450 /* class/infolevel */
4451 dissect_smb2_class_infolevel(pinfo, tvb, offset, tree, si);
4453 switch (si->status) {
4454 case 0x00000000: break;
4455 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
4459 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
4465 dissect_smb2_break_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
4468 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
4471 offset = dissect_smb2_oplock(tree, tvb, offset);
4480 offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE);
4486 dissect_smb2_break_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
4488 switch (si->status) {
4489 case 0x00000000: break;
4490 default: return dissect_smb2_error_response(tvb, pinfo, tree, offset, si);
4494 offset = dissect_smb2_buffercode(tree, tvb, offset, NULL);
4497 offset = dissect_smb2_oplock(tree, tvb, offset);
4506 offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE);
4508 /* in break requests from server to client here're 24 byte zero bytes
4509 * which are likely a bug in windows (they may use 2* 24 bytes instead of just
4516 /* names here are just until we find better names for these functions */
4517 const value_string smb2_cmd_vals[] = {
4518 { 0x00, "NegotiateProtocol" },
4519 { 0x01, "SessionSetup" },
4520 { 0x02, "SessionLogoff" },
4521 { 0x03, "TreeConnect" },
4522 { 0x04, "TreeDisconnect" },
4531 { 0x0D, "KeepAlive" },
4534 { 0x10, "GetInfo" },
4535 { 0x11, "SetInfo" },
4537 { 0x13, "unknown-0x13" },
4538 { 0x14, "unknown-0x14" },
4539 { 0x15, "unknown-0x15" },
4540 { 0x16, "unknown-0x16" },
4541 { 0x17, "unknown-0x17" },
4542 { 0x18, "unknown-0x18" },
4543 { 0x19, "unknown-0x19" },
4544 { 0x1A, "unknown-0x1A" },
4545 { 0x1B, "unknown-0x1B" },
4546 { 0x1C, "unknown-0x1C" },
4547 { 0x1D, "unknown-0x1D" },
4548 { 0x1E, "unknown-0x1E" },
4549 { 0x1F, "unknown-0x1F" },
4550 { 0x20, "unknown-0x20" },
4551 { 0x21, "unknown-0x21" },
4552 { 0x22, "unknown-0x22" },
4553 { 0x23, "unknown-0x23" },
4554 { 0x24, "unknown-0x24" },
4555 { 0x25, "unknown-0x25" },
4556 { 0x26, "unknown-0x26" },
4557 { 0x27, "unknown-0x27" },
4558 { 0x28, "unknown-0x28" },
4559 { 0x29, "unknown-0x29" },
4560 { 0x2A, "unknown-0x2A" },
4561 { 0x2B, "unknown-0x2B" },
4562 { 0x2C, "unknown-0x2C" },
4563 { 0x2D, "unknown-0x2D" },
4564 { 0x2E, "unknown-0x2E" },
4565 { 0x2F, "unknown-0x2F" },
4566 { 0x30, "unknown-0x30" },
4567 { 0x31, "unknown-0x31" },
4568 { 0x32, "unknown-0x32" },
4569 { 0x33, "unknown-0x33" },
4570 { 0x34, "unknown-0x34" },
4571 { 0x35, "unknown-0x35" },
4572 { 0x36, "unknown-0x36" },
4573 { 0x37, "unknown-0x37" },
4574 { 0x38, "unknown-0x38" },
4575 { 0x39, "unknown-0x39" },
4576 { 0x3A, "unknown-0x3A" },
4577 { 0x3B, "unknown-0x3B" },
4578 { 0x3C, "unknown-0x3C" },
4579 { 0x3D, "unknown-0x3D" },
4580 { 0x3E, "unknown-0x3E" },
4581 { 0x3F, "unknown-0x3F" },
4582 { 0x40, "unknown-0x40" },
4583 { 0x41, "unknown-0x41" },
4584 { 0x42, "unknown-0x42" },
4585 { 0x43, "unknown-0x43" },
4586 { 0x44, "unknown-0x44" },
4587 { 0x45, "unknown-0x45" },
4588 { 0x46, "unknown-0x46" },
4589 { 0x47, "unknown-0x47" },
4590 { 0x48, "unknown-0x48" },
4591 { 0x49, "unknown-0x49" },
4592 { 0x4A, "unknown-0x4A" },
4593 { 0x4B, "unknown-0x4B" },
4594 { 0x4C, "unknown-0x4C" },
4595 { 0x4D, "unknown-0x4D" },
4596 { 0x4E, "unknown-0x4E" },
4597 { 0x4F, "unknown-0x4F" },
4598 { 0x50, "unknown-0x50" },
4599 { 0x51, "unknown-0x51" },
4600 { 0x52, "unknown-0x52" },
4601 { 0x53, "unknown-0x53" },
4602 { 0x54, "unknown-0x54" },
4603 { 0x55, "unknown-0x55" },
4604 { 0x56, "unknown-0x56" },
4605 { 0x57, "unknown-0x57" },
4606 { 0x58, "unknown-0x58" },
4607 { 0x59, "unknown-0x59" },
4608 { 0x5A, "unknown-0x5A" },
4609 { 0x5B, "unknown-0x5B" },
4610 { 0x5C, "unknown-0x5C" },
4611 { 0x5D, "unknown-0x5D" },
4612 { 0x5E, "unknown-0x5E" },
4613 { 0x5F, "unknown-0x5F" },
4614 { 0x60, "unknown-0x60" },
4615 { 0x61, "unknown-0x61" },
4616 { 0x62, "unknown-0x62" },
4617 { 0x63, "unknown-0x63" },
4618 { 0x64, "unknown-0x64" },
4619 { 0x65, "unknown-0x65" },
4620 { 0x66, "unknown-0x66" },
4621 { 0x67, "unknown-0x67" },
4622 { 0x68, "unknown-0x68" },
4623 { 0x69, "unknown-0x69" },
4624 { 0x6A, "unknown-0x6A" },
4625 { 0x6B, "unknown-0x6B" },
4626 { 0x6C, "unknown-0x6C" },
4627 { 0x6D, "unknown-0x6D" },
4628 { 0x6E, "unknown-0x6E" },
4629 { 0x6F, "unknown-0x6F" },
4630 { 0x70, "unknown-0x70" },
4631 { 0x71, "unknown-0x71" },
4632 { 0x72, "unknown-0x72" },
4633 { 0x73, "unknown-0x73" },
4634 { 0x74, "unknown-0x74" },
4635 { 0x75, "unknown-0x75" },
4636 { 0x76, "unknown-0x76" },
4637 { 0x77, "unknown-0x77" },
4638 { 0x78, "unknown-0x78" },
4639 { 0x79, "unknown-0x79" },
4640 { 0x7A, "unknown-0x7A" },
4641 { 0x7B, "unknown-0x7B" },
4642 { 0x7C, "unknown-0x7C" },
4643 { 0x7D, "unknown-0x7D" },
4644 { 0x7E, "unknown-0x7E" },
4645 { 0x7F, "unknown-0x7F" },
4646 { 0x80, "unknown-0x80" },
4647 { 0x81, "unknown-0x81" },
4648 { 0x82, "unknown-0x82" },
4649 { 0x83, "unknown-0x83" },
4650 { 0x84, "unknown-0x84" },
4651 { 0x85, "unknown-0x85" },
4652 { 0x86, "unknown-0x86" },
4653 { 0x87, "unknown-0x87" },
4654 { 0x88, "unknown-0x88" },
4655 { 0x89, "unknown-0x89" },
4656 { 0x8A, "unknown-0x8A" },
4657 { 0x8B, "unknown-0x8B" },
4658 { 0x8C, "unknown-0x8C" },
4659 { 0x8D, "unknown-0x8D" },
4660 { 0x8E, "unknown-0x8E" },
4661 { 0x8F, "unknown-0x8F" },
4662 { 0x90, "unknown-0x90" },
4663 { 0x91, "unknown-0x91" },
4664 { 0x92, "unknown-0x92" },
4665 { 0x93, "unknown-0x93" },
4666 { 0x94, "unknown-0x94" },
4667 { 0x95, "unknown-0x95" },
4668 { 0x96, "unknown-0x96" },
4669 { 0x97, "unknown-0x97" },
4670 { 0x98, "unknown-0x98" },
4671 { 0x99, "unknown-0x99" },
4672 { 0x9A, "unknown-0x9A" },
4673 { 0x9B, "unknown-0x9B" },
4674 { 0x9C, "unknown-0x9C" },
4675 { 0x9D, "unknown-0x9D" },
4676 { 0x9E, "unknown-0x9E" },
4677 { 0x9F, "unknown-0x9F" },
4678 { 0xA0, "unknown-0xA0" },
4679 { 0xA1, "unknown-0xA1" },
4680 { 0xA2, "unknown-0xA2" },
4681 { 0xA3, "unknown-0xA3" },
4682 { 0xA4, "unknown-0xA4" },
4683 { 0xA5, "unknown-0xA5" },
4684 { 0xA6, "unknown-0xA6" },
4685 { 0xA7, "unknown-0xA7" },
4686 { 0xA8, "unknown-0xA8" },
4687 { 0xA9, "unknown-0xA9" },
4688 { 0xAA, "unknown-0xAA" },
4689 { 0xAB, "unknown-0xAB" },
4690 { 0xAC, "unknown-0xAC" },
4691 { 0xAD, "unknown-0xAD" },
4692 { 0xAE, "unknown-0xAE" },
4693 { 0xAF, "unknown-0xAF" },
4694 { 0xB0, "unknown-0xB0" },
4695 { 0xB1, "unknown-0xB1" },
4696 { 0xB2, "unknown-0xB2" },
4697 { 0xB3, "unknown-0xB3" },
4698 { 0xB4, "unknown-0xB4" },
4699 { 0xB5, "unknown-0xB5" },
4700 { 0xB6, "unknown-0xB6" },
4701 { 0xB7, "unknown-0xB7" },
4702 { 0xB8, "unknown-0xB8" },
4703 { 0xB9, "unknown-0xB9" },
4704 { 0xBA, "unknown-0xBA" },
4705 { 0xBB, "unknown-0xBB" },
4706 { 0xBC, "unknown-0xBC" },
4707 { 0xBD, "unknown-0xBD" },
4708 { 0xBE, "unknown-0xBE" },
4709 { 0xBF, "unknown-0xBF" },
4710 { 0xC0, "unknown-0xC0" },
4711 { 0xC1, "unknown-0xC1" },
4712 { 0xC2, "unknown-0xC2" },
4713 { 0xC3, "unknown-0xC3" },
4714 { 0xC4, "unknown-0xC4" },
4715 { 0xC5, "unknown-0xC5" },
4716 { 0xC6, "unknown-0xC6" },
4717 { 0xC7, "unknown-0xC7" },
4718 { 0xC8, "unknown-0xC8" },
4719 { 0xC9, "unknown-0xC9" },
4720 { 0xCA, "unknown-0xCA" },
4721 { 0xCB, "unknown-0xCB" },
4722 { 0xCC, "unknown-0xCC" },
4723 { 0xCD, "unknown-0xCD" },
4724 { 0xCE, "unknown-0xCE" },
4725 { 0xCF, "unknown-0xCF" },
4726 { 0xD0, "unknown-0xD0" },
4727 { 0xD1, "unknown-0xD1" },
4728 { 0xD2, "unknown-0xD2" },
4729 { 0xD3, "unknown-0xD3" },
4730 { 0xD4, "unknown-0xD4" },
4731 { 0xD5, "unknown-0xD5" },
4732 { 0xD6, "unknown-0xD6" },
4733 { 0xD7, "unknown-0xD7" },
4734 { 0xD8, "unknown-0xD8" },
4735 { 0xD9, "unknown-0xD9" },
4736 { 0xDA, "unknown-0xDA" },
4737 { 0xDB, "unknown-0xDB" },
4738 { 0xDC, "unknown-0xDC" },
4739 { 0xDD, "unknown-0xDD" },
4740 { 0xDE, "unknown-0xDE" },
4741 { 0xDF, "unknown-0xDF" },
4742 { 0xE0, "unknown-0xE0" },
4743 { 0xE1, "unknown-0xE1" },
4744 { 0xE2, "unknown-0xE2" },
4745 { 0xE3, "unknown-0xE3" },
4746 { 0xE4, "unknown-0xE4" },
4747 { 0xE5, "unknown-0xE5" },
4748 { 0xE6, "unknown-0xE6" },
4749 { 0xE7, "unknown-0xE7" },
4750 { 0xE8, "unknown-0xE8" },
4751 { 0xE9, "unknown-0xE9" },
4752 { 0xEA, "unknown-0xEA" },
4753 { 0xEB, "unknown-0xEB" },
4754 { 0xEC, "unknown-0xEC" },
4755 { 0xED, "unknown-0xED" },
4756 { 0xEE, "unknown-0xEE" },
4757 { 0xEF, "unknown-0xEF" },
4758 { 0xF0, "unknown-0xF0" },
4759 { 0xF1, "unknown-0xF1" },
4760 { 0xF2, "unknown-0xF2" },
4761 { 0xF3, "unknown-0xF3" },
4762 { 0xF4, "unknown-0xF4" },
4763 { 0xF5, "unknown-0xF5" },
4764 { 0xF6, "unknown-0xF6" },
4765 { 0xF7, "unknown-0xF7" },
4766 { 0xF8, "unknown-0xF8" },
4767 { 0xF9, "unknown-0xF9" },
4768 { 0xFA, "unknown-0xFA" },
4769 { 0xFB, "unknown-0xFB" },
4770 { 0xFC, "unknown-0xFC" },
4771 { 0xFD, "unknown-0xFD" },
4772 { 0xFE, "unknown-0xFE" },
4773 { 0xFF, "unknown-0xFF" },
4776 static const char *decode_smb2_name(guint16 cmd)
4778 if (cmd > 0xFF) return "unknown";
4779 return(smb2_cmd_vals[cmd & 0xFF].strptr);
4782 static smb2_function smb2_dissector[256] = {
4783 /* 0x00 NegotiateProtocol*/
4784 {dissect_smb2_negotiate_protocol_request,
4785 dissect_smb2_negotiate_protocol_response},
4786 /* 0x01 SessionSetup*/
4787 {dissect_smb2_session_setup_request,
4788 dissect_smb2_session_setup_response},
4789 /* 0x02 SessionLogoff*/
4790 {dissect_smb2_sessionlogoff_request,
4791 dissect_smb2_sessionlogoff_response},
4792 /* 0x03 TreeConnect*/
4793 {dissect_smb2_tree_connect_request,
4794 dissect_smb2_tree_connect_response},
4795 /* 0x04 TreeDisconnect*/
4796 {dissect_smb2_tree_disconnect_request,
4797 dissect_smb2_tree_disconnect_response},
4799 {dissect_smb2_create_request,
4800 dissect_smb2_create_response},
4802 {dissect_smb2_close_request,
4803 dissect_smb2_close_response},
4805 {dissect_smb2_flush_request,
4806 dissect_smb2_flush_response},
4808 {dissect_smb2_read_request,
4809 dissect_smb2_read_response},
4811 {dissect_smb2_write_request,
4812 dissect_smb2_write_response},
4814 {dissect_smb2_lock_request,
4815 dissect_smb2_lock_response},
4817 {dissect_smb2_ioctl_request,
4818 dissect_smb2_ioctl_response},
4820 {dissect_smb2_cancel_request,
4823 {dissect_smb2_keepalive_request,
4824 dissect_smb2_keepalive_response},
4826 {dissect_smb2_find_request,
4827 dissect_smb2_find_response},
4829 {dissect_smb2_notify_request,
4830 dissect_smb2_notify_response},
4832 {dissect_smb2_getinfo_request,
4833 dissect_smb2_getinfo_response},
4835 {dissect_smb2_setinfo_request,
4836 dissect_smb2_setinfo_response},
4838 {dissect_smb2_break_request,
4839 dissect_smb2_break_response},
4840 /* 0x13 */ {NULL, NULL},
4841 /* 0x14 */ {NULL, NULL},
4842 /* 0x15 */ {NULL, NULL},
4843 /* 0x16 */ {NULL, NULL},
4844 /* 0x17 */ {NULL, NULL},
4845 /* 0x18 */ {NULL, NULL},
4846 /* 0x19 */ {NULL, NULL},
4847 /* 0x1a */ {NULL, NULL},
4848 /* 0x1b */ {NULL, NULL},
4849 /* 0x1c */ {NULL, NULL},
4850 /* 0x1d */ {NULL, NULL},
4851 /* 0x1e */ {NULL, NULL},
4852 /* 0x1f */ {NULL, NULL},
4853 /* 0x20 */ {NULL, NULL},
4854 /* 0x21 */ {NULL, NULL},
4855 /* 0x22 */ {NULL, NULL},
4856 /* 0x23 */ {NULL, NULL},
4857 /* 0x24 */ {NULL, NULL},
4858 /* 0x25 */ {NULL, NULL},
4859 /* 0x26 */ {NULL, NULL},
4860 /* 0x27 */ {NULL, NULL},
4861 /* 0x28 */ {NULL, NULL},
4862 /* 0x29 */ {NULL, NULL},
4863 /* 0x2a */ {NULL, NULL},
4864 /* 0x2b */ {NULL, NULL},
4865 /* 0x2c */ {NULL, NULL},
4866 /* 0x2d */ {NULL, NULL},
4867 /* 0x2e */ {NULL, NULL},
4868 /* 0x2f */ {NULL, NULL},
4869 /* 0x30 */ {NULL, NULL},
4870 /* 0x31 */ {NULL, NULL},
4871 /* 0x32 */ {NULL, NULL},
4872 /* 0x33 */ {NULL, NULL},
4873 /* 0x34 */ {NULL, NULL},
4874 /* 0x35 */ {NULL, NULL},
4875 /* 0x36 */ {NULL, NULL},
4876 /* 0x37 */ {NULL, NULL},
4877 /* 0x38 */ {NULL, NULL},
4878 /* 0x39 */ {NULL, NULL},
4879 /* 0x3a */ {NULL, NULL},
4880 /* 0x3b */ {NULL, NULL},
4881 /* 0x3c */ {NULL, NULL},
4882 /* 0x3d */ {NULL, NULL},
4883 /* 0x3e */ {NULL, NULL},
4884 /* 0x3f */ {NULL, NULL},
4885 /* 0x40 */ {NULL, NULL},
4886 /* 0x41 */ {NULL, NULL},
4887 /* 0x42 */ {NULL, NULL},
4888 /* 0x43 */ {NULL, NULL},
4889 /* 0x44 */ {NULL, NULL},
4890 /* 0x45 */ {NULL, NULL},
4891 /* 0x46 */ {NULL, NULL},
4892 /* 0x47 */ {NULL, NULL},
4893 /* 0x48 */ {NULL, NULL},
4894 /* 0x49 */ {NULL, NULL},
4895 /* 0x4a */ {NULL, NULL},
4896 /* 0x4b */ {NULL, NULL},
4897 /* 0x4c */ {NULL, NULL},
4898 /* 0x4d */ {NULL, NULL},
4899 /* 0x4e */ {NULL, NULL},
4900 /* 0x4f */ {NULL, NULL},
4901 /* 0x50 */ {NULL, NULL},
4902 /* 0x51 */ {NULL, NULL},
4903 /* 0x52 */ {NULL, NULL},
4904 /* 0x53 */ {NULL, NULL},
4905 /* 0x54 */ {NULL, NULL},
4906 /* 0x55 */ {NULL, NULL},
4907 /* 0x56 */ {NULL, NULL},
4908 /* 0x57 */ {NULL, NULL},
4909 /* 0x58 */ {NULL, NULL},
4910 /* 0x59 */ {NULL, NULL},
4911 /* 0x5a */ {NULL, NULL},
4912 /* 0x5b */ {NULL, NULL},
4913 /* 0x5c */ {NULL, NULL},
4914 /* 0x5d */ {NULL, NULL},
4915 /* 0x5e */ {NULL, NULL},
4916 /* 0x5f */ {NULL, NULL},
4917 /* 0x60 */ {NULL, NULL},
4918 /* 0x61 */ {NULL, NULL},
4919 /* 0x62 */ {NULL, NULL},
4920 /* 0x63 */ {NULL, NULL},
4921 /* 0x64 */ {NULL, NULL},
4922 /* 0x65 */ {NULL, NULL},
4923 /* 0x66 */ {NULL, NULL},
4924 /* 0x67 */ {NULL, NULL},
4925 /* 0x68 */ {NULL, NULL},
4926 /* 0x69 */ {NULL, NULL},
4927 /* 0x6a */ {NULL, NULL},
4928 /* 0x6b */ {NULL, NULL},
4929 /* 0x6c */ {NULL, NULL},
4930 /* 0x6d */ {NULL, NULL},
4931 /* 0x6e */ {NULL, NULL},
4932 /* 0x6f */ {NULL, NULL},
4933 /* 0x70 */ {NULL, NULL},
4934 /* 0x71 */ {NULL, NULL},
4935 /* 0x72 */ {NULL, NULL},
4936 /* 0x73 */ {NULL, NULL},
4937 /* 0x74 */ {NULL, NULL},
4938 /* 0x75 */ {NULL, NULL},
4939 /* 0x76 */ {NULL, NULL},
4940 /* 0x77 */ {NULL, NULL},
4941 /* 0x78 */ {NULL, NULL},
4942 /* 0x79 */ {NULL, NULL},
4943 /* 0x7a */ {NULL, NULL},
4944 /* 0x7b */ {NULL, NULL},
4945 /* 0x7c */ {NULL, NULL},
4946 /* 0x7d */ {NULL, NULL},
4947 /* 0x7e */ {NULL, NULL},
4948 /* 0x7f */ {NULL, NULL},
4949 /* 0x80 */ {NULL, NULL},
4950 /* 0x81 */ {NULL, NULL},
4951 /* 0x82 */ {NULL, NULL},
4952 /* 0x83 */ {NULL, NULL},
4953 /* 0x84 */ {NULL, NULL},
4954 /* 0x85 */ {NULL, NULL},
4955 /* 0x86 */ {NULL, NULL},
4956 /* 0x87 */ {NULL, NULL},
4957 /* 0x88 */ {NULL, NULL},
4958 /* 0x89 */ {NULL, NULL},
4959 /* 0x8a */ {NULL, NULL},
4960 /* 0x8b */ {NULL, NULL},
4961 /* 0x8c */ {NULL, NULL},
4962 /* 0x8d */ {NULL, NULL},
4963 /* 0x8e */ {NULL, NULL},
4964 /* 0x8f */ {NULL, NULL},
4965 /* 0x90 */ {NULL, NULL},
4966 /* 0x91 */ {NULL, NULL},
4967 /* 0x92 */ {NULL, NULL},
4968 /* 0x93 */ {NULL, NULL},
4969 /* 0x94 */ {NULL, NULL},
4970 /* 0x95 */ {NULL, NULL},
4971 /* 0x96 */ {NULL, NULL},
4972 /* 0x97 */ {NULL, NULL},
4973 /* 0x98 */ {NULL, NULL},
4974 /* 0x99 */ {NULL, NULL},
4975 /* 0x9a */ {NULL, NULL},
4976 /* 0x9b */ {NULL, NULL},
4977 /* 0x9c */ {NULL, NULL},
4978 /* 0x9d */ {NULL, NULL},
4979 /* 0x9e */ {NULL, NULL},
4980 /* 0x9f */ {NULL, NULL},
4981 /* 0xa0 */ {NULL, NULL},
4982 /* 0xa1 */ {NULL, NULL},
4983 /* 0xa2 */ {NULL, NULL},
4984 /* 0xa3 */ {NULL, NULL},
4985 /* 0xa4 */ {NULL, NULL},
4986 /* 0xa5 */ {NULL, NULL},
4987 /* 0xa6 */ {NULL, NULL},
4988 /* 0xa7 */ {NULL, NULL},
4989 /* 0xa8 */ {NULL, NULL},
4990 /* 0xa9 */ {NULL, NULL},
4991 /* 0xaa */ {NULL, NULL},
4992 /* 0xab */ {NULL, NULL},
4993 /* 0xac */ {NULL, NULL},
4994 /* 0xad */ {NULL, NULL},
4995 /* 0xae */ {NULL, NULL},
4996 /* 0xaf */ {NULL, NULL},
4997 /* 0xb0 */ {NULL, NULL},
4998 /* 0xb1 */ {NULL, NULL},
4999 /* 0xb2 */ {NULL, NULL},
5000 /* 0xb3 */ {NULL, NULL},
5001 /* 0xb4 */ {NULL, NULL},
5002 /* 0xb5 */ {NULL, NULL},
5003 /* 0xb6 */ {NULL, NULL},
5004 /* 0xb7 */ {NULL, NULL},
5005 /* 0xb8 */ {NULL, NULL},
5006 /* 0xb9 */ {NULL, NULL},
5007 /* 0xba */ {NULL, NULL},
5008 /* 0xbb */ {NULL, NULL},
5009 /* 0xbc */ {NULL, NULL},
5010 /* 0xbd */ {NULL, NULL},
5011 /* 0xbe */ {NULL, NULL},
5012 /* 0xbf */ {NULL, NULL},
5013 /* 0xc0 */ {NULL, NULL},
5014 /* 0xc1 */ {NULL, NULL},
5015 /* 0xc2 */ {NULL, NULL},
5016 /* 0xc3 */ {NULL, NULL},
5017 /* 0xc4 */ {NULL, NULL},
5018 /* 0xc5 */ {NULL, NULL},
5019 /* 0xc6 */ {NULL, NULL},
5020 /* 0xc7 */ {NULL, NULL},
5021 /* 0xc8 */ {NULL, NULL},
5022 /* 0xc9 */ {NULL, NULL},
5023 /* 0xca */ {NULL, NULL},
5024 /* 0xcb */ {NULL, NULL},
5025 /* 0xcc */ {NULL, NULL},
5026 /* 0xcd */ {NULL, NULL},
5027 /* 0xce */ {NULL, NULL},
5028 /* 0xcf */ {NULL, NULL},
5029 /* 0xd0 */ {NULL, NULL},
5030 /* 0xd1 */ {NULL, NULL},
5031 /* 0xd2 */ {NULL, NULL},
5032 /* 0xd3 */ {NULL, NULL},
5033 /* 0xd4 */ {NULL, NULL},
5034 /* 0xd5 */ {NULL, NULL},
5035 /* 0xd6 */ {NULL, NULL},
5036 /* 0xd7 */ {NULL, NULL},
5037 /* 0xd8 */ {NULL, NULL},
5038 /* 0xd9 */ {NULL, NULL},
5039 /* 0xda */ {NULL, NULL},
5040 /* 0xdb */ {NULL, NULL},
5041 /* 0xdc */ {NULL, NULL},
5042 /* 0xdd */ {NULL, NULL},
5043 /* 0xde */ {NULL, NULL},
5044 /* 0xdf */ {NULL, NULL},
5045 /* 0xe0 */ {NULL, NULL},
5046 /* 0xe1 */ {NULL, NULL},
5047 /* 0xe2 */ {NULL, NULL},
5048 /* 0xe3 */ {NULL, NULL},
5049 /* 0xe4 */ {NULL, NULL},
5050 /* 0xe5 */ {NULL, NULL},
5051 /* 0xe6 */ {NULL, NULL},
5052 /* 0xe7 */ {NULL, NULL},
5053 /* 0xe8 */ {NULL, NULL},
5054 /* 0xe9 */ {NULL, NULL},
5055 /* 0xea */ {NULL, NULL},
5056 /* 0xeb */ {NULL, NULL},
5057 /* 0xec */ {NULL, NULL},
5058 /* 0xed */ {NULL, NULL},
5059 /* 0xee */ {NULL, NULL},
5060 /* 0xef */ {NULL, NULL},
5061 /* 0xf0 */ {NULL, NULL},
5062 /* 0xf1 */ {NULL, NULL},
5063 /* 0xf2 */ {NULL, NULL},
5064 /* 0xf3 */ {NULL, NULL},
5065 /* 0xf4 */ {NULL, NULL},
5066 /* 0xf5 */ {NULL, NULL},
5067 /* 0xf6 */ {NULL, NULL},
5068 /* 0xf7 */ {NULL, NULL},
5069 /* 0xf8 */ {NULL, NULL},
5070 /* 0xf9 */ {NULL, NULL},
5071 /* 0xfa */ {NULL, NULL},
5072 /* 0xfb */ {NULL, NULL},
5073 /* 0xfc */ {NULL, NULL},
5074 /* 0xfd */ {NULL, NULL},
5075 /* 0xfe */ {NULL, NULL},
5076 /* 0xff */ {NULL, NULL},
5081 dissect_smb2_command(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, smb2_info_t *si)
5083 int (*cmd_dissector)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si);
5084 proto_item *cmd_item;
5085 proto_tree *cmd_tree;
5086 int old_offset = offset;
5088 cmd_item = proto_tree_add_text(tree, tvb, offset, -1,
5090 decode_smb2_name(si->opcode),
5091 (si->flags & SMB2_FLAGS_RESPONSE)?"Response":"Request",
5093 cmd_tree = proto_item_add_subtree(cmd_item, ett_smb2_command);
5096 cmd_dissector=(si->flags & SMB2_FLAGS_RESPONSE)?
5097 smb2_dissector[si->opcode&0xff].response:
5098 smb2_dissector[si->opcode&0xff].request;
5100 offset=(*cmd_dissector)(tvb, pinfo, cmd_tree, offset, si);
5102 proto_tree_add_item(cmd_tree, hf_smb2_unknown, tvb, offset, -1, FALSE);
5103 offset=tvb_length(tvb);
5106 proto_item_set_len(cmd_item, offset-old_offset);
5112 dissect_smb2_tid_sesid(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, smb2_info_t *si)
5114 proto_item *tid_item=NULL;
5115 proto_tree *tid_tree=NULL;
5116 smb2_tid_info_t tid_key;
5118 proto_item *sesid_item=NULL;
5119 proto_tree *sesid_tree=NULL;
5120 smb2_sesid_info_t sesid_key;
5126 if (si->flags&SMB2_FLAGS_ASYNC_CMD) {
5127 proto_tree_add_item(tree, hf_smb2_aid, tvb, offset, 8, TRUE);
5131 pid=tvb_get_letohl(tvb, offset);
5132 proto_tree_add_uint_format(tree, hf_smb2_pid, tvb, offset, 4, pid, "Process Id: %08x",pid);
5136 tid_offset = offset;
5137 si->tid=tvb_get_letohl(tvb, offset);
5138 tid_item=proto_tree_add_item(tree, hf_smb2_tid, tvb, offset, 4, TRUE);
5140 tid_tree=proto_item_add_subtree(tid_item, ett_smb2_tid_tree);
5146 sesid_offset = offset;
5147 si->sesid=tvb_get_letoh64(tvb, offset);
5148 sesid_item=proto_tree_add_item(tree, hf_smb2_sesid, tvb, offset, 8, TRUE);
5150 sesid_tree=proto_item_add_subtree(sesid_item, ett_smb2_sesid_tree);
5154 /* now we need to first lookup the uid session */
5155 sesid_key.sesid=si->sesid;
5156 si->session=g_hash_table_lookup(si->conv->sesids, &sesid_key);
5158 if (si->opcode != 0x03) return offset;
5160 /* if we come to a session that is unknown, and the operation is
5161 * a tree connect, we create a dummy sessison, so we can hang the
5164 si->session=se_alloc(sizeof(smb2_sesid_info_t));
5165 si->session->sesid=si->sesid;
5166 si->session->acct_name=NULL;
5167 si->session->domain_name=NULL;
5168 si->session->host_name=NULL;
5169 si->session->auth_frame=(guint32)-1;
5170 si->session->tids= g_hash_table_new(smb2_tid_info_hash, smb2_tid_info_equal);
5171 g_hash_table_insert(si->conv->sesids, si->session, si->session);
5176 if (si->session->auth_frame != (guint32)-1) {
5177 item=proto_tree_add_string(sesid_tree, hf_smb2_acct_name, tvb, sesid_offset, 0, si->session->acct_name);
5178 PROTO_ITEM_SET_GENERATED(item);
5179 proto_item_append_text(sesid_item, " Acct:%s", si->session->acct_name);
5181 item=proto_tree_add_string(sesid_tree, hf_smb2_domain_name, tvb, sesid_offset, 0, si->session->domain_name);
5182 PROTO_ITEM_SET_GENERATED(item);
5183 proto_item_append_text(sesid_item, " Domain:%s", si->session->domain_name);
5185 item=proto_tree_add_string(sesid_tree, hf_smb2_host_name, tvb, sesid_offset, 0, si->session->host_name);
5186 PROTO_ITEM_SET_GENERATED(item);
5187 proto_item_append_text(sesid_item, " Host:%s", si->session->host_name);
5189 item=proto_tree_add_uint(sesid_tree, hf_smb2_auth_frame, tvb, sesid_offset, 0, si->session->auth_frame);
5190 PROTO_ITEM_SET_GENERATED(item);
5193 if (!(si->flags&SMB2_FLAGS_ASYNC_CMD)) {
5194 /* see if we can find the name for this tid */
5195 tid_key.tid=si->tid;
5196 si->tree=g_hash_table_lookup(si->session->tids, &tid_key);
5197 if(!si->tree) return offset;
5199 item=proto_tree_add_string(tid_tree, hf_smb2_tree, tvb, tid_offset, 4, si->tree->name);
5200 PROTO_ITEM_SET_GENERATED(item);
5201 proto_item_append_text(tid_item, " %s", si->tree->name);
5203 item=proto_tree_add_uint(tid_tree, hf_smb2_share_type, tvb, tid_offset, 0, si->tree->share_type);
5204 PROTO_ITEM_SET_GENERATED(item);
5206 item=proto_tree_add_uint(tid_tree, hf_smb2_tcon_frame, tvb, tid_offset, 0, si->tree->connect_frame);
5207 PROTO_ITEM_SET_GENERATED(item);
5214 dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolean first_in_chain)
5216 proto_item *seqnum_item;
5217 proto_item *item=NULL;
5218 proto_tree *tree=NULL;
5219 proto_item *header_item=NULL;
5220 proto_tree *header_tree=NULL;
5221 proto_item *flags_item=NULL;
5222 proto_tree *flags_tree=NULL;
5224 int chain_offset = 0;
5226 conversation_t *conversation;
5227 smb2_saved_info_t *ssi=NULL, ssi_key;
5230 si=ep_alloc(sizeof(smb2_info_t));
5234 si->top_tree=parent_tree;
5236 /* find which conversation we are part of and get the data for that
5239 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
5241 /* OK this is a new conversation so lets create it */
5242 conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
5243 pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
5245 si->conv=conversation_get_proto_data(conversation, proto_smb2);
5247 /* no smb2_into_t structure for this conversation yet,
5250 si->conv=se_alloc(sizeof(smb2_conv_info_t));
5251 /* qqq this leaks memory for now since we never free
5253 si->conv->matched= g_hash_table_new(smb2_saved_info_hash_matched,
5254 smb2_saved_info_equal_matched);
5255 si->conv->unmatched= g_hash_table_new(smb2_saved_info_hash_unmatched,
5256 smb2_saved_info_equal_unmatched);
5257 si->conv->sesids= g_hash_table_new(smb2_sesid_info_hash,
5258 smb2_sesid_info_equal);
5260 conversation_add_proto_data(conversation, proto_smb2, si->conv);
5264 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMB2");
5265 if (check_col(pinfo->cinfo, COL_INFO)){
5266 if (first_in_chain) {
5268 col_clear(pinfo->cinfo, COL_INFO);
5270 col_append_str(pinfo->cinfo, COL_INFO, ";");
5275 item = proto_tree_add_item(parent_tree, proto_smb2, tvb, offset,
5277 tree = proto_item_add_subtree(item, ett_smb2);
5282 header_item = proto_tree_add_text(tree, tvb, offset, -1, "SMB2 Header");
5283 header_tree = proto_item_add_subtree(header_item, ett_smb2_header);
5286 /* Decode the header */
5288 proto_tree_add_text(header_tree, tvb, offset, 4, "Server Component: SMB2");
5292 header_len=tvb_get_letohs(tvb, offset);
5293 proto_tree_add_item(header_tree, hf_smb2_header_len, tvb, offset, 2, TRUE);
5297 proto_tree_add_item(header_tree, hf_smb2_epoch, tvb, offset, 2, TRUE);
5301 si->status=tvb_get_letohl(tvb, offset);
5302 proto_tree_add_item(header_tree, hf_smb2_nt_status, tvb, offset, 4, TRUE);
5307 si->opcode=tvb_get_letohs(tvb, offset);
5308 proto_tree_add_item(header_tree, hf_smb2_cmd, tvb, offset, 2, TRUE);
5311 /* we need the flags before we know how to parse the credits field */
5312 si->flags=tvb_get_letohl(tvb, offset+2);
5315 if (si->flags & SMB2_FLAGS_RESPONSE) {
5316 proto_tree_add_item(header_tree, hf_smb2_credits_granted, tvb, offset, 2, TRUE);
5318 proto_tree_add_item(header_tree, hf_smb2_credits_requested, tvb, offset, 2, TRUE);
5324 flags_item = proto_tree_add_text(header_tree, tvb, offset, 4,
5325 "Flags: 0x%08x", si->flags);
5326 flags_tree = proto_item_add_subtree(flags_item, ett_smb2_flags);
5328 proto_tree_add_boolean(flags_tree, hf_smb2_flags_dfs_op, tvb, offset, 4, si->flags);
5329 proto_tree_add_boolean(flags_tree, hf_smb2_flags_signature, tvb, offset, 4, si->flags);
5330 proto_tree_add_boolean(flags_tree, hf_smb2_flags_chained, tvb, offset, 4, si->flags);
5331 proto_tree_add_boolean(flags_tree, hf_smb2_flags_async_cmd, tvb, offset, 4, si->flags);
5332 proto_tree_add_boolean(flags_tree, hf_smb2_flags_response, tvb, offset, 4, si->flags);
5336 /* some unknown bytes */
5337 chain_offset=tvb_get_letohl(tvb, offset);
5338 proto_tree_add_item(header_tree, hf_smb2_chain_offset, tvb, offset, 4, FALSE);
5341 /* command sequence number*/
5342 si->seqnum=tvb_get_letoh64(tvb, offset);
5343 ssi_key.seqnum=si->seqnum;
5344 seqnum_item=proto_tree_add_item(header_tree, hf_smb2_seqnum, tvb, offset, 8, TRUE);
5345 if(seqnum_item && (si->seqnum==-1)){
5346 proto_item_append_text(seqnum_item, " (unsolicited response)");
5350 /* Tree ID and Session ID */
5351 offset = dissect_smb2_tid_sesid(pinfo, header_tree, tvb, offset, si);
5354 proto_tree_add_item(header_tree, hf_smb2_signature, tvb, offset, 16, FALSE);
5357 proto_item_set_len(header_item, offset);
5360 if (check_col(pinfo->cinfo, COL_INFO)){
5361 col_append_fstr(pinfo->cinfo, COL_INFO, "%s %s",
5362 decode_smb2_name(si->opcode),
5363 (si->flags & SMB2_FLAGS_RESPONSE)?"Response":"Request");
5366 pinfo->cinfo, COL_INFO, ", Error: %s",
5367 val_to_str(si->status, NT_errors,
5368 "Unknown (0x%08X)"));
5373 if(!pinfo->fd->flags.visited){
5374 /* see if we can find this seqnum in the unmatched table */
5375 ssi=g_hash_table_lookup(si->conv->unmatched, &ssi_key);
5377 if(!(si->flags & SMB2_FLAGS_RESPONSE)){
5378 /* This is a request */
5380 /* this is a request and we already found
5381 * an older ssi so just delete the previous
5384 g_hash_table_remove(si->conv->unmatched, ssi);
5389 /* no we couldnt find it, so just add it then
5390 * if was a request we are decoding
5392 ssi=se_alloc(sizeof(smb2_saved_info_t));
5395 ssi->seqnum=ssi_key.seqnum;
5396 ssi->frame_req=pinfo->fd->num;
5398 ssi->req_time=pinfo->fd->abs_ts;
5399 ssi->extra_info=NULL;
5400 ssi->extra_info_type=SMB2_EI_NONE;
5401 g_hash_table_insert(si->conv->unmatched, ssi, ssi);
5404 /* This is a response */
5406 /* just set the response frame and move it to the matched table */
5407 ssi->frame_res=pinfo->fd->num;
5408 g_hash_table_remove(si->conv->unmatched, ssi);
5409 g_hash_table_insert(si->conv->matched, ssi, ssi);
5413 /* see if we can find this seqnum in the matched table */
5414 ssi=g_hash_table_lookup(si->conv->matched, &ssi_key);
5415 /* if we couldnt find it in the matched table, it might still
5416 * be in the unmatched table
5419 ssi=g_hash_table_lookup(si->conv->unmatched, &ssi_key);
5424 if(!(si->flags & SMB2_FLAGS_RESPONSE)){
5426 proto_item *tmp_item;
5427 tmp_item=proto_tree_add_uint(header_tree, hf_smb2_response_in, tvb, 0, 0, ssi->frame_res);
5428 PROTO_ITEM_SET_GENERATED(tmp_item);
5432 proto_item *tmp_item;
5435 tmp_item=proto_tree_add_uint(header_tree, hf_smb2_response_to, tvb, 0, 0, ssi->frame_req);
5436 PROTO_ITEM_SET_GENERATED(tmp_item);
5437 t = pinfo->fd->abs_ts;
5438 nstime_delta(&deltat, &t, &ssi->req_time);
5439 tmp_item=proto_tree_add_time(header_tree, hf_smb2_time, tvb,
5441 PROTO_ITEM_SET_GENERATED(tmp_item);
5445 /* if we dont have ssi yet we must fake it */
5449 tap_queue_packet(smb2_tap, pinfo, si);
5451 /* Decode the payload */
5452 offset = dissect_smb2_command(pinfo, tree, tvb, offset, si);
5454 if (chain_offset > 0) {
5457 if (chain_offset < offset) {
5458 THROW(ReportedBoundsError);
5460 proto_item_set_len(item, chain_offset);
5462 next_tvb = tvb_new_subset_remaining(tvb, chain_offset);
5463 offset = dissect_smb2(next_tvb, pinfo, parent_tree, FALSE);
5470 dissect_smb2_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
5474 /* must check that this really is a smb2 packet */
5475 if (tvb_length(tvb) < 4)
5478 if( (tvb_get_guint8(tvb, 0) != 0xfe)
5479 || (tvb_get_guint8(tvb, 1) != 'S')
5480 || (tvb_get_guint8(tvb, 2) != 'M')
5481 || (tvb_get_guint8(tvb, 3) != 'B') ){
5485 offset = dissect_smb2(tvb, pinfo, parent_tree, TRUE);
5491 proto_register_smb2(void)
5493 static hf_register_info hf[] = {
5495 { "Command", "smb2.cmd", FT_UINT16, BASE_DEC,
5496 VALS(smb2_cmd_vals), 0, "SMB2 Command Opcode", HFILL }},
5497 { &hf_smb2_response_to,
5498 { "Response to", "smb2.response_to", FT_FRAMENUM, BASE_NONE,
5499 NULL, 0, "This packet is a response to the packet in this frame", HFILL }},
5500 { &hf_smb2_response_in,
5501 { "Response in", "smb2.response_in", FT_FRAMENUM, BASE_NONE,
5502 NULL, 0, "The response to this packet is in this packet", HFILL }},
5504 { "Time from request", "smb2.time", FT_RELATIVE_TIME, BASE_NONE,
5505 NULL, 0, "Time between Request and Response for SMB2 cmds", HFILL }},
5506 { &hf_smb2_header_len,
5507 { "Header Length", "smb2.header_len", FT_UINT16, BASE_DEC,
5508 NULL, 0, "SMB2 Size of Header", HFILL }},
5509 { &hf_smb2_nt_status,
5510 { "NT Status", "smb2.nt_status", FT_UINT32, BASE_HEX,
5511 VALS(NT_errors), 0, "NT Status code", HFILL }},
5513 { "Command Sequence Number", "smb2.seq_num", FT_INT64, BASE_DEC,
5514 NULL, 0, "SMB2 Command Sequence Number", HFILL }},
5516 { "Tree Id", "smb2.tid", FT_UINT32, BASE_HEX,
5517 NULL, 0, "SMB2 Tree Id", HFILL }},
5519 { "Async Id", "smb2.aid", FT_UINT64, BASE_HEX,
5520 NULL, 0, "SMB2 Async Id", HFILL }},
5522 { "Session Id", "smb2.sesid", FT_UINT64, BASE_HEX,
5523 NULL, 0, "SMB2 Session Id", HFILL }},
5524 { &hf_smb2_previous_sesid,
5525 { "Previous Session Id", "smb2.previous_sesid", FT_UINT64, BASE_HEX,
5526 NULL, 0, "SMB2 Previous Session Id", HFILL }},
5527 { &hf_smb2_chain_offset,
5528 { "Chain Offset", "smb2.chain_offset", FT_UINT32, BASE_HEX,
5529 NULL, 0, "SMB2 Chain Offset", HFILL }},
5530 { &hf_smb2_end_of_file,
5531 { "End Of File", "smb2.eof", FT_UINT64, BASE_DEC,
5532 NULL, 0, "SMB2 End Of File/File size", HFILL }},
5534 { "Number of Links", "smb2.nlinks", FT_UINT32, BASE_DEC,
5535 NULL, 0, "Number of links to this object", HFILL }},
5537 { "File Id", "smb2.file_id", FT_UINT64, BASE_HEX,
5538 NULL, 0, "SMB2 File Id", HFILL }},
5539 { &hf_smb2_allocation_size,
5540 { "Allocation Size", "smb2.allocation_size", FT_UINT64, BASE_DEC,
5541 NULL, 0, "SMB2 Allocation Size for this object", HFILL }},
5542 { &hf_smb2_max_response_size,
5543 { "Max Response Size", "smb2.max_response_size", FT_UINT32, BASE_DEC,
5544 NULL, 0, "SMB2 Maximum response size", HFILL }},
5545 { &hf_smb2_setinfo_size,
5546 { "Setinfo Size", "smb2.setinfo_size", FT_UINT32, BASE_DEC,
5547 NULL, 0, "SMB2 setinfo size", HFILL }},
5548 { &hf_smb2_setinfo_offset,
5549 { "Setinfo Offset", "smb2.setinfo_offset", FT_UINT16, BASE_HEX,
5550 NULL, 0, "SMB2 setinfo offset", HFILL }},
5551 { &hf_smb2_max_ioctl_out_size,
5552 { "Max Ioctl Out Size", "smb2.max_ioctl_out_size", FT_UINT32, BASE_DEC,
5553 NULL, 0, "SMB2 Maximum ioctl out size", HFILL }},
5554 { &hf_smb2_max_ioctl_in_size,
5555 { "Max Ioctl In Size", "smb2.max_ioctl_in_size", FT_UINT32, BASE_DEC,
5556 NULL, 0, "SMB2 Maximum ioctl out size", HFILL }},
5557 { &hf_smb2_response_size,
5558 { "Response Size", "smb2.response_size", FT_UINT32, BASE_DEC,
5559 NULL, 0, "SMB2 response size", HFILL }},
5560 { &hf_smb2_required_buffer_size,
5561 { "Required Buffer Size", "smb2.required_size", FT_UINT32, BASE_DEC,
5562 NULL, 0, "SMB2 required buffer size", HFILL }},
5564 { "Process Id", "smb2.pid", FT_UINT32, BASE_HEX,
5565 NULL, 0, "SMB2 Process Id", HFILL }},
5566 { &hf_smb2_flags_response,
5567 { "Response", "smb2.flags.response", FT_BOOLEAN, 32,
5568 TFS(&tfs_flags_response), SMB2_FLAGS_RESPONSE, "Whether this is an SMB2 Request or Response", HFILL }},
5569 { &hf_smb2_flags_async_cmd,
5570 { "Async command", "smb2.flags.async", FT_BOOLEAN, 32,
5571 TFS(&tfs_flags_async_cmd), SMB2_FLAGS_ASYNC_CMD, NULL, HFILL }},
5572 { &hf_smb2_flags_dfs_op,
5573 { "DFS operation", "smb2.flags.dfs", FT_BOOLEAN, 32,
5574 TFS(&tfs_flags_dfs_op), SMB2_FLAGS_DFS_OP, NULL, HFILL }},
5575 { &hf_smb2_flags_chained,
5576 { "Chained", "smb2.flags.chained", FT_BOOLEAN, 32,
5577 TFS(&tfs_flags_chained), SMB2_FLAGS_CHAINED, "Whether the pdu continues a chain or not", HFILL }},
5578 { &hf_smb2_flags_signature,
5579 { "Signing", "smb2.flags.signature", FT_BOOLEAN, 32,
5580 TFS(&tfs_flags_signature), SMB2_FLAGS_SIGNATURE, "Whether the pdu is signed or not", HFILL }},
5582 { "Tree", "smb2.tree", FT_STRING, BASE_NONE,
5583 NULL, 0, "Name of the Tree/Share", HFILL }},
5584 { &hf_smb2_filename,
5585 { "Filename", "smb2.filename", FT_STRING, BASE_NONE,
5586 NULL, 0, "Name of the file", HFILL }},
5587 { &hf_smb2_filename_len,
5588 { "Filename Length", "smb2.filename.len", FT_UINT32, BASE_DEC,
5589 NULL, 0, "Length of the file name", HFILL }},
5591 { &hf_smb2_security_blob_len,
5592 { "Security Blob Length", "smb2.security_blob_len", FT_UINT16, BASE_DEC,
5593 NULL, 0, "Security blob length", HFILL }},
5595 { &hf_smb2_security_blob_offset,
5596 { "Security Blob Offset", "smb2.security_blob_offset", FT_UINT16, BASE_HEX,
5597 NULL, 0, "Offset into the SMB2 PDU of the blob", HFILL }},
5599 { &hf_smb2_response_buffer_offset,
5600 { "Response Buffer Offset", "smb2.response_buffer_offset", FT_UINT16, BASE_HEX,
5601 NULL, 0, "Offset of the response buffer", HFILL }},
5603 { &hf_smb2_data_offset,
5604 { "Data Offset", "smb2.data_offset", FT_UINT16, BASE_HEX,
5605 NULL, 0, "Offset to data", HFILL }},
5607 { &hf_smb2_find_info_level,
5608 { "Info Level", "smb2.find.infolevel", FT_UINT32, BASE_DEC,
5609 VALS(smb2_find_info_levels), 0, "Find_Info Infolevel", HFILL }},
5610 { &hf_smb2_find_flags,
5611 { "Find Flags", "smb2.find.flags", FT_UINT8, BASE_HEX,
5612 NULL, 0, NULL, HFILL }},
5614 { &hf_smb2_find_pattern,
5615 { "Search Pattern", "smb2.find.pattern", FT_STRING, BASE_NONE,
5616 NULL, 0, "Find pattern", HFILL }},
5618 { &hf_smb2_find_info_blob,
5619 { "Info", "smb2.security_blob", FT_BYTES, BASE_NONE,
5620 NULL, 0, "Find Info", HFILL }},
5623 { "EA Size", "smb2.ea_size", FT_UINT32, BASE_DEC,
5624 NULL, 0, "Size of EA data", HFILL }},
5627 { "Class", "smb2.class", FT_UINT8, BASE_HEX,
5628 VALS(smb2_class_vals), 0, "Info class", HFILL }},
5630 { &hf_smb2_infolevel,
5631 { "InfoLevel", "smb2.infolevel", FT_UINT8, BASE_HEX,
5632 NULL, 0, "Infolevel", HFILL }},
5634 { &hf_smb2_infolevel_file_info,
5635 { "InfoLevel", "smb2.file_info.infolevel", FT_UINT8, BASE_HEX,
5636 VALS(smb2_file_info_levels), 0, "File_Info Infolevel", HFILL }},
5638 { &hf_smb2_infolevel_fs_info,
5639 { "InfoLevel", "smb2.fs_info.infolevel", FT_UINT8, BASE_HEX,
5640 VALS(smb2_fs_info_levels), 0, "Fs_Info Infolevel", HFILL }},
5642 { &hf_smb2_infolevel_sec_info,
5643 { "InfoLevel", "smb2.sec_info.infolevel", FT_UINT8, BASE_HEX,
5644 VALS(smb2_sec_info_levels), 0, "Sec_Info Infolevel", HFILL }},
5646 { &hf_smb2_write_length,
5647 { "Write Length", "smb2.write_length", FT_UINT32, BASE_DEC,
5648 NULL, 0, "Amount of data to write", HFILL }},
5650 { &hf_smb2_read_length,
5651 { "Read Length", "smb2.read_length", FT_UINT32, BASE_DEC,
5652 NULL, 0, "Amount of data to read", HFILL }},
5654 { &hf_smb2_read_remaining,
5655 { "Read Remaining", "smb2.read_remaining", FT_UINT32, BASE_DEC,
5656 NULL, 0, NULL, HFILL }},
5658 { &hf_smb2_create_flags,
5659 { "Create Flags", "smb2.create_flags", FT_UINT64, BASE_HEX,
5660 NULL, 0, NULL, HFILL }},
5662 { &hf_smb2_file_offset,
5663 { "File Offset", "smb2.file_offset", FT_UINT64, BASE_DEC,
5664 NULL, 0, NULL, HFILL }},
5666 { &hf_smb2_security_blob,
5667 { "Security Blob", "smb2.security_blob", FT_BYTES, BASE_NONE,
5668 NULL, 0, "Security blob", HFILL }},
5670 { &hf_smb2_ioctl_out_data,
5671 { "Out Data", "smb2.ioctl.out", FT_NONE, BASE_NONE,
5672 NULL, 0, "Ioctl Out", HFILL }},
5674 { &hf_smb2_ioctl_in_data,
5675 { "In Data", "smb2.ioctl.in", FT_NONE, BASE_NONE,
5676 NULL, 0, "Ioctl In", HFILL }},
5678 { &hf_smb2_server_guid,
5679 { "Server Guid", "smb2.server_guid", FT_GUID, BASE_NONE,
5680 NULL, 0, "Server GUID", HFILL }},
5682 { &hf_smb2_client_guid,
5683 { "Client Guid", "smb2.client_guid", FT_GUID, BASE_NONE,
5684 NULL, 0, "Client GUID", HFILL }},
5686 { &hf_smb2_object_id,
5687 { "ObjectId", "smb2.object_id", FT_GUID, BASE_NONE,
5688 NULL, 0, "ObjectID for this FID", HFILL }},
5690 { &hf_smb2_birth_volume_id,
5691 { "BirthVolumeId", "smb2.birth_volume_id", FT_GUID, BASE_NONE,
5692 NULL, 0, "ObjectID for the volume where this FID was originally created", HFILL }},
5694 { &hf_smb2_birth_object_id,
5695 { "BirthObjectId", "smb2.birth_object_id", FT_GUID, BASE_NONE,
5696 NULL, 0, "ObjectID for this FID when it was originally created", HFILL }},
5698 { &hf_smb2_domain_id,
5699 { "DomainId", "smb2.domain_id", FT_GUID, BASE_NONE,
5700 NULL, 0, NULL, HFILL }},
5702 { &hf_smb2_create_timestamp,
5703 { "Create", "smb2.create.time", FT_ABSOLUTE_TIME, BASE_NONE,
5704 NULL, 0, "Time when this object was created", HFILL }},
5707 { "File Id", "smb2.fid", FT_GUID, BASE_NONE,
5708 NULL, 0, "SMB2 File Id", HFILL }},
5710 { &hf_smb2_write_data,
5711 { "Write Data", "smb2.write_data", FT_BYTES, BASE_NONE,
5712 NULL, 0, "SMB2 Data to be written", HFILL }},
5714 { &hf_smb2_read_data,
5715 { "Read Data", "smb2.read_data", FT_BYTES, BASE_NONE,
5716 NULL, 0, "SMB2 Data that is read", HFILL }},
5718 { &hf_smb2_last_access_timestamp,
5719 { "Last Access", "smb2.last_access.time", FT_ABSOLUTE_TIME, BASE_NONE,
5720 NULL, 0, "Time when this object was last accessed", HFILL }},
5722 { &hf_smb2_last_write_timestamp,
5723 { "Last Write", "smb2.last_write.time", FT_ABSOLUTE_TIME, BASE_NONE,
5724 NULL, 0, "Time when this object was last written to", HFILL }},
5726 { &hf_smb2_last_change_timestamp,
5727 { "Last Change", "smb2.last_change.time", FT_ABSOLUTE_TIME, BASE_NONE,
5728 NULL, 0, "Time when this object was last changed", HFILL }},
5730 { &hf_smb2_file_all_info,
5731 { "SMB2_FILE_ALL_INFO", "smb2.smb2_file_all_info", FT_NONE, BASE_NONE,
5732 NULL, 0, "SMB2_FILE_ALL_INFO structure", HFILL }},
5734 { &hf_smb2_file_allocation_info,
5735 { "SMB2_FILE_ALLOCATION_INFO", "smb2.smb2_file_allocation_info", FT_NONE, BASE_NONE,
5736 NULL, 0, "SMB2_FILE_ALLOCATION_INFO structure", HFILL }},
5738 { &hf_smb2_file_endoffile_info,
5739 { "SMB2_FILE_ENDOFFILE_INFO", "smb2.smb2_file_endoffile_info", FT_NONE, BASE_NONE,
5740 NULL, 0, "SMB2_FILE_ENDOFFILE_INFO structure", HFILL }},
5742 { &hf_smb2_file_alternate_name_info,
5743 { "SMB2_FILE_ALTERNATE_NAME_INFO", "smb2.smb2_file_alternate_name_info", FT_NONE, BASE_NONE,
5744 NULL, 0, "SMB2_FILE_ALTERNATE_NAME_INFO structure", HFILL }},
5746 { &hf_smb2_file_stream_info,
5747 { "SMB2_FILE_STREAM_INFO", "smb2.smb2_file_stream_info", FT_NONE, BASE_NONE,
5748 NULL, 0, "SMB2_FILE_STREAM_INFO structure", HFILL }},
5750 { &hf_smb2_file_pipe_info,
5751 { "SMB2_FILE_PIPE_INFO", "smb2.smb2_file_pipe_info", FT_NONE, BASE_NONE,
5752 NULL, 0, "SMB2_FILE_PIPE_INFO structure", HFILL }},
5754 { &hf_smb2_file_compression_info,
5755 { "SMB2_FILE_COMPRESSION_INFO", "smb2.smb2_file_compression_info", FT_NONE, BASE_NONE,
5756 NULL, 0, "SMB2_FILE_COMPRESSION_INFO structure", HFILL }},
5758 { &hf_smb2_file_basic_info,
5759 { "SMB2_FILE_BASIC_INFO", "smb2.smb2_file_basic_info", FT_NONE, BASE_NONE,
5760 NULL, 0, "SMB2_FILE_BASIC_INFO structure", HFILL }},
5762 { &hf_smb2_file_standard_info,
5763 { "SMB2_FILE_STANDARD_INFO", "smb2.smb2_file_standard_info", FT_NONE, BASE_NONE,
5764 NULL, 0, "SMB2_FILE_STANDARD_INFO structure", HFILL }},
5766 { &hf_smb2_file_internal_info,
5767 { "SMB2_FILE_INTERNAL_INFO", "smb2.smb2_file_internal_info", FT_NONE, BASE_NONE,
5768 NULL, 0, "SMB2_FILE_INTERNAL_INFO structure", HFILL }},
5770 { &hf_smb2_file_mode_info,
5771 { "SMB2_FILE_MODE_INFO", "smb2.smb2_file_mode_info", FT_NONE, BASE_NONE,
5772 NULL, 0, "SMB2_FILE_MODE_INFO structure", HFILL }},
5774 { &hf_smb2_file_alignment_info,
5775 { "SMB2_FILE_ALIGNMENT_INFO", "smb2.smb2_file_alignment_info", FT_NONE, BASE_NONE,
5776 NULL, 0, "SMB2_FILE_ALIGNMENT_INFO structure", HFILL }},
5778 { &hf_smb2_file_position_info,
5779 { "SMB2_FILE_POSITION_INFO", "smb2.smb2_file_position_info", FT_NONE, BASE_NONE,
5780 NULL, 0, "SMB2_FILE_POSITION_INFO structure", HFILL }},
5782 { &hf_smb2_file_access_info,
5783 { "SMB2_FILE_ACCESS_INFO", "smb2.smb2_file_access_info", FT_NONE, BASE_NONE,
5784 NULL, 0, "SMB2_FILE_ACCESS_INFO structure", HFILL }},
5786 { &hf_smb2_file_ea_info,
5787 { "SMB2_FILE_EA_INFO", "smb2.smb2_file_ea_info", FT_NONE, BASE_NONE,
5788 NULL, 0, "SMB2_FILE_EA_INFO structure", HFILL }},
5790 { &hf_smb2_file_network_open_info,
5791 { "SMB2_FILE_NETWORK_OPEN_INFO", "smb2.smb2_file_network_open_info", FT_NONE, BASE_NONE,
5792 NULL, 0, "SMB2_FILE_NETWORK_OPEN_INFO structure", HFILL }},
5794 { &hf_smb2_file_attribute_tag_info,
5795 { "SMB2_FILE_ATTRIBUTE_TAG_INFO", "smb2.smb2_file_attribute_tag_info", FT_NONE, BASE_NONE,
5796 NULL, 0, "SMB2_FILE_ATTRIBUTE_TAG_INFO structure", HFILL }},
5798 { &hf_smb2_file_disposition_info,
5799 { "SMB2_FILE_DISPOSITION_INFO", "smb2.smb2_file_disposition_info", FT_NONE, BASE_NONE,
5800 NULL, 0, "SMB2_FILE_DISPOSITION_INFO structure", HFILL }},
5802 { &hf_smb2_file_info_0f,
5803 { "SMB2_FILE_INFO_0f", "smb2.smb2_file_info_0f", FT_NONE, BASE_NONE,
5804 NULL, 0, "SMB2_FILE_INFO_0f structure", HFILL }},
5806 { &hf_smb2_file_rename_info,
5807 { "SMB2_FILE_RENAME_INFO", "smb2.smb2_file_rename_info", FT_NONE, BASE_NONE,
5808 NULL, 0, "SMB2_FILE_RENAME_INFO structure", HFILL }},
5810 { &hf_smb2_fs_info_01,
5811 { "SMB2_FS_INFO_01", "smb2.smb2_fs_info_01", FT_NONE, BASE_NONE,
5812 NULL, 0, "SMB2_FS_INFO_01 structure", HFILL }},
5814 { &hf_smb2_fs_info_03,
5815 { "SMB2_FS_INFO_03", "smb2.smb2_fs_info_03", FT_NONE, BASE_NONE,
5816 NULL, 0, "SMB2_FS_INFO_03 structure", HFILL }},
5818 { &hf_smb2_fs_info_04,
5819 { "SMB2_FS_INFO_04", "smb2.smb2_fs_info_04", FT_NONE, BASE_NONE,
5820 NULL, 0, "SMB2_FS_INFO_04 structure", HFILL }},
5822 { &hf_smb2_fs_info_05,
5823 { "SMB2_FS_INFO_05", "smb2.smb2_fs_info_05", FT_NONE, BASE_NONE,
5824 NULL, 0, "SMB2_FS_INFO_05 structure", HFILL }},
5826 { &hf_smb2_fs_info_06,
5827 { "SMB2_FS_INFO_06", "smb2.smb2_fs_info_06", FT_NONE, BASE_NONE,
5828 NULL, 0, "SMB2_FS_INFO_06 structure", HFILL }},
5830 { &hf_smb2_fs_info_07,
5831 { "SMB2_FS_INFO_07", "smb2.smb2_fs_info_07", FT_NONE, BASE_NONE,
5832 NULL, 0, "SMB2_FS_INFO_07 structure", HFILL }},
5834 { &hf_smb2_fs_objectid_info,
5835 { "SMB2_FS_OBJECTID_INFO", "smb2.smb2_fs_objectid_info", FT_NONE, BASE_NONE,
5836 NULL, 0, "SMB2_FS_OBJECTID_INFO structure", HFILL }},
5838 { &hf_smb2_sec_info_00,
5839 { "SMB2_SEC_INFO_00", "smb2.smb2_sec_info_00", FT_NONE, BASE_NONE,
5840 NULL, 0, "SMB2_SEC_INFO_00 structure", HFILL }},
5842 { &hf_smb2_disposition_delete_on_close,
5843 { "Delete on close", "smb2.disposition.delete_on_close", FT_BOOLEAN, 8,
5844 TFS(&tfs_disposition_delete_on_close), 0x01, NULL, HFILL }},
5847 { &hf_smb2_create_disposition,
5848 { "Disposition", "smb2.create.disposition", FT_UINT32, BASE_DEC,
5849 VALS(create_disposition_vals), 0, "Create disposition, what to do if the file does/does not exist", HFILL }},
5851 { &hf_smb2_create_action,
5852 { "Create Action", "smb2.create.action", FT_UINT32, BASE_DEC,
5853 VALS(oa_open_vals), 0, NULL, HFILL }},
5855 { &hf_smb2_extrainfo,
5856 { "ExtraInfo", "smb2.create.extrainfo", FT_NONE, BASE_NONE,
5857 NULL, 0, "Create ExtraInfo", HFILL }},
5859 { &hf_smb2_create_chain_offset,
5860 { "Chain Offset", "smb2.create.chain_offset", FT_UINT32, BASE_HEX,
5861 NULL, 0, "Offset to next entry in chain or 0", HFILL }},
5863 { &hf_smb2_create_chain_data,
5864 { "Data", "smb2.create.chain_data", FT_NONE, BASE_NONE,
5865 NULL, 0, "Chain Data", HFILL }},
5867 { &hf_smb2_FILE_OBJECTID_BUFFER,
5868 { "FILE_OBJECTID_BUFFER", "smb2.FILE_OBJECTID_BUFFER", FT_NONE, BASE_NONE,
5869 NULL, 0, "A FILE_OBJECTID_BUFFER structure", HFILL }},
5871 { &hf_smb2_data_length,
5872 { "Data Length", "smb2.create.data_length", FT_UINT32, BASE_DEC,
5873 NULL, 0, "Length Data or 0", HFILL }},
5875 { &hf_smb2_next_offset,
5876 { "Next Offset", "smb2.next_offset", FT_UINT32, BASE_DEC,
5877 NULL, 0, "Offset to next buffer or 0", HFILL }},
5879 { &hf_smb2_current_time,
5880 { "Current Time", "smb2.current_time", FT_ABSOLUTE_TIME, BASE_NONE,
5881 NULL, 0, "Current Time at server", HFILL }},
5883 { &hf_smb2_boot_time,
5884 { "Boot Time", "smb2.boot_time", FT_ABSOLUTE_TIME, BASE_NONE,
5885 NULL, 0, "Boot Time at server", HFILL }},
5887 { &hf_smb2_ea_flags,
5888 { "EA Flags", "smb2.ea.flags", FT_UINT8, BASE_HEX,
5889 NULL, 0, NULL, HFILL }},
5891 { &hf_smb2_ea_name_len,
5892 { "EA Name Length", "smb2.ea.name_len", FT_UINT8, BASE_DEC,
5893 NULL, 0, NULL, HFILL }},
5895 { &hf_smb2_ea_data_len,
5896 { "EA Data Length", "smb2.ea.data_len", FT_UINT8, BASE_DEC,
5897 NULL, 0, NULL, HFILL }},
5899 { &hf_smb2_delete_pending,
5900 { "Delete Pending", "smb2.delete_pending", FT_UINT8, BASE_DEC,
5901 NULL, 0, NULL, HFILL }},
5903 { &hf_smb2_is_directory,
5904 { "Is Directory", "smb2.is_directory", FT_UINT8, BASE_DEC,
5905 NULL, 0, "Is this a directory?", HFILL }},
5908 { "Oplock", "smb2.create.oplock", FT_UINT8, BASE_HEX,
5909 VALS(oplock_vals), 0, "Oplock type", HFILL }},
5911 { &hf_smb2_close_flags,
5912 { "Close Flags", "smb2.close.flags", FT_UINT16, BASE_HEX,
5913 NULL, 0, "close flags", HFILL }},
5915 { &hf_smb2_notify_flags,
5916 { "Notify Flags", "smb2.notify.flags", FT_UINT16, BASE_HEX,
5917 NULL, 0, NULL, HFILL }},
5919 { &hf_smb2_buffer_code_len,
5920 { "Length", "smb2.buffer_code.length", FT_UINT16, BASE_DEC,
5921 NULL, 0, "Length of fixed portion of PDU", HFILL }},
5923 { &hf_smb2_olb_length,
5924 { "Length", "smb2.olb.length", FT_UINT32, BASE_DEC,
5925 NULL, 0, "Length of the buffer", HFILL }},
5927 { &hf_smb2_olb_offset,
5928 { "Offset", "smb2.olb.offset", FT_UINT32, BASE_HEX,
5929 NULL, 0, "Offset to the buffer", HFILL }},
5931 { &hf_smb2_buffer_code_flags_dyn,
5932 { "Dynamic Part", "smb2.buffer_code.dynamic", FT_BOOLEAN, 16,
5933 NULL, 0x0001, "Whether a dynamic length blob follows", HFILL }},
5936 { "EA Data", "smb2.ea.data", FT_STRING, BASE_NONE,
5937 NULL, 0, NULL, HFILL }},
5940 { "EA Name", "smb2.ea.name", FT_STRING, BASE_NONE,
5941 NULL, 0, NULL, HFILL }},
5943 { &hf_smb2_impersonation_level,
5944 { "Impersonation", "smb2.impersonation.level", FT_UINT32, BASE_DEC,
5945 VALS(impersonation_level_vals), 0, "Impersonation level", HFILL }},
5947 { &hf_smb2_ioctl_function,
5948 { "Function", "smb2.ioctl.function", FT_UINT32, BASE_HEX,
5949 VALS(smb2_ioctl_vals), 0, "Ioctl function", HFILL }},
5951 { &hf_smb2_ioctl_function_device,
5952 { "Device", "smb2.ioctl.function.device", FT_UINT32, BASE_HEX,
5953 VALS(smb2_ioctl_device_vals), 0xffff0000, "Device for Ioctl", HFILL }},
5955 { &hf_smb2_ioctl_function_access,
5956 { "Access", "smb2.ioctl.function.access", FT_UINT32, BASE_HEX,
5957 VALS(smb2_ioctl_access_vals), 0x0000c000, "Access for Ioctl", HFILL }},
5959 { &hf_smb2_ioctl_function_function,
5960 { "Function", "smb2.ioctl.function.function", FT_UINT32, BASE_HEX,
5961 NULL, 0x00003ffc, "Function for Ioctl", HFILL }},
5963 { &hf_smb2_ioctl_function_method,
5964 { "Method", "smb2.ioctl.function.method", FT_UINT32, BASE_HEX,
5965 VALS(smb2_ioctl_method_vals), 0x00000003, "Method for Ioctl", HFILL }},
5967 { &hf_smb2_ioctl_shadow_copy_num_volumes,
5968 { "Num Volumes", "smb2.ioctl.shadow_copy.num_volumes", FT_UINT32, BASE_DEC,
5969 NULL, 0, "Number of shadow copy volumes", HFILL }},
5971 { &hf_smb2_ioctl_shadow_copy_num_labels,
5972 { "Num Labels", "smb2.ioctl.shadow_copy.num_labels", FT_UINT32, BASE_DEC,
5973 NULL, 0, "Number of shadow copy labels", HFILL }},
5975 { &hf_smb2_ioctl_shadow_copy_label,
5976 { "Label", "smb2.ioctl.shadow_copy.label", FT_STRING, BASE_NONE,
5977 NULL, 0, "Shadow copy label", HFILL }},
5979 { &hf_smb2_compression_format,
5980 { "Compression Format", "smb2.compression_format", FT_UINT16, BASE_DEC,
5981 VALS(compression_format_vals), 0, "Compression to use", HFILL }},
5983 { &hf_smb2_share_type,
5984 { "Share Type", "smb2.share_type", FT_UINT16, BASE_DEC,
5985 VALS(smb2_share_type_vals), 0, "Type of share", HFILL }},
5988 { "Epoch", "smb2.epoch", FT_UINT16, BASE_DEC,
5989 NULL, 0, NULL, HFILL }},
5991 { &hf_smb2_credits_requested,
5992 { "Credits requested", "smb2.credits.requested", FT_UINT16, BASE_DEC,
5993 NULL, 0, NULL, HFILL }},
5995 { &hf_smb2_credits_granted,
5996 { "Credits granted", "smb2.credits.granted", FT_UINT16, BASE_DEC,
5997 NULL, 0, NULL, HFILL }},
5999 { &hf_smb2_dialect_count,
6000 { "Dialect count", "smb2.dialect_count", FT_UINT16, BASE_DEC,
6001 NULL, 0, NULL, HFILL }},
6004 { "Dialect", "smb2.dialect", FT_UINT16, BASE_HEX,
6005 NULL, 0, NULL, HFILL }},
6007 { &hf_smb2_security_mode,
6008 { "Security mode", "smb2.sec_mode", FT_UINT8, BASE_HEX,
6009 NULL, 0, NULL, HFILL }},
6011 { &hf_smb2_session_flags,
6012 { "Session Flags", "smb2.session_flags", FT_UINT16, BASE_HEX,
6013 NULL, 0, NULL, HFILL }},
6015 { &hf_smb2_lock_count,
6016 { "Lock Count", "smb2.lock_count", FT_UINT16, BASE_DEC,
6017 NULL, 0, NULL, HFILL }},
6019 { &hf_smb2_capabilities,
6020 { "Capabilities", "smb2.capabilities", FT_UINT32, BASE_HEX,
6021 NULL, 0, NULL, HFILL }},
6023 { &hf_smb2_ioctl_shadow_copy_count,
6024 { "Count", "smb2.ioctl.shadow_copy.count", FT_UINT32, BASE_DEC,
6025 NULL, 0, "Number of bytes for shadow copy label strings", HFILL }},
6027 { &hf_smb2_auth_frame,
6028 { "Authenticated in Frame", "smb2.auth_frame", FT_UINT32, BASE_DEC,
6029 NULL, 0, "Which frame this user was authenticated in", HFILL }},
6031 { &hf_smb2_tcon_frame,
6032 { "Connected in Frame", "smb2.tcon_frame", FT_UINT32, BASE_DEC,
6033 NULL, 0, "Which frame this share was connected in", HFILL }},
6036 { "Tag", "smb2.tag", FT_STRING, BASE_NONE,
6037 NULL, 0, "Tag of chain entry", HFILL }},
6039 { &hf_smb2_acct_name,
6040 { "Account", "smb2.acct", FT_STRING, BASE_NONE,
6041 NULL, 0, "Account Name", HFILL }},
6043 { &hf_smb2_domain_name,
6044 { "Domain", "smb2.domain", FT_STRING, BASE_NONE,
6045 NULL, 0, "Domain Name", HFILL }},
6047 { &hf_smb2_host_name,
6048 { "Host", "smb2.host", FT_STRING, BASE_NONE,
6049 NULL, 0, "Host Name", HFILL }},
6051 { &hf_smb2_signature,
6052 { "Signature", "smb2.signature", FT_BYTES, BASE_NONE,
6053 NULL, 0, NULL, HFILL }},
6056 { "unknown", "smb2.unknown", FT_BYTES, BASE_NONE,
6057 NULL, 0, "Unknown bytes", HFILL }},
6059 { &hf_smb2_unknown_timestamp,
6060 { "Timestamp", "smb2.unknown.timestamp", FT_ABSOLUTE_TIME, BASE_NONE,
6061 NULL, 0, "Unknown timestamp", HFILL }},
6063 { &hf_smb2_ses_flags_guest,
6064 { "Guest", "smb2.ses_flags.guest", FT_BOOLEAN, 16,
6065 NULL, SES_FLAGS_GUEST, NULL, HFILL }},
6067 { &hf_smb2_ses_flags_null,
6068 { "Null", "smb2.ses_flags.null", FT_BOOLEAN, 16,
6069 NULL, SES_FLAGS_NULL, NULL, HFILL }},
6071 { &hf_smb2_secmode_flags_sign_required,
6072 { "Signing required", "smb2.sec_mode.sign_required", FT_BOOLEAN, 8,
6073 NULL, NEGPROT_SIGN_REQ, "Is signing required", HFILL }},
6075 { &hf_smb2_secmode_flags_sign_enabled,
6076 { "Signing enabled", "smb2.sec_mode.sign_enabled", FT_BOOLEAN, 8,
6077 NULL, NEGPROT_SIGN_ENABLED, "Is signing enabled", HFILL }},
6080 { "DFS", "smb2.capabilities.dfs", FT_BOOLEAN, 32,
6081 TFS(&tfs_cap_dfs), NEGPROT_CAP_DFS, "If the host supports dfs", HFILL }},
6083 { &hf_smb2_max_trans_size,
6084 { "Max Transaction Size", "smb2.max_trans_size", FT_UINT32, BASE_DEC,
6085 NULL, 0, "Maximum size of a transaction", HFILL }},
6087 { &hf_smb2_max_read_size,
6088 { "Max Read Size", "smb2.max_read_size", FT_UINT32, BASE_DEC,
6089 NULL, 0, "Maximum size of a read", HFILL }},
6091 { &hf_smb2_max_write_size,
6092 { "Max Write Size", "smb2.max_write_size", FT_UINT32, BASE_DEC,
6093 NULL, 0, "Maximum size of a write", HFILL }},
6096 { "VC Num", "smb2.num_vc", FT_UINT8, BASE_DEC,
6097 NULL, 0, "Number of VCs", HFILL }},
6100 { "Channel", "smb2.channel", FT_UINT32, BASE_DEC,
6101 NULL, 0, NULL, HFILL }},
6103 { &hf_smb2_share_flags,
6104 { "Share flags", "smb2.share_flags", FT_UINT32, BASE_HEX,
6105 NULL, 0, "share flags", HFILL }},
6107 { &hf_smb2_share_flags_dfs,
6108 { "dfs", "smb2.share_flags.dfs", FT_BOOLEAN, 32,
6109 NULL, SHARE_FLAGS_dfs, NULL, HFILL }},
6111 { &hf_smb2_share_flags_dfs_root,
6112 { "dfs_root", "smb2.share_flags.dfs_root", FT_BOOLEAN, 32,
6113 NULL, SHARE_FLAGS_dfs_root, NULL, HFILL }},
6115 { &hf_smb2_share_flags_restrict_exclusive_opens,
6116 { "restrict_exclusive_opens", "smb2.share_flags.restrict_exclusive_opens", FT_BOOLEAN, 32,
6117 NULL, SHARE_FLAGS_restrict_exclusive_opens, NULL, HFILL }},
6119 { &hf_smb2_share_flags_force_shared_delete,
6120 { "force_shared_delete", "smb2.share_flags.force_shared_delete", FT_BOOLEAN, 32,
6121 NULL, SHARE_FLAGS_force_shared_delete, NULL, HFILL }},
6123 { &hf_smb2_share_flags_allow_namespace_caching,
6124 { "allow_namespace_caching", "smb2.share_flags.allow_namespace_caching", FT_BOOLEAN, 32,
6125 NULL, SHARE_FLAGS_allow_namespace_caching, NULL, HFILL }},
6127 { &hf_smb2_share_flags_access_based_dir_enum,
6128 { "access_based_dir_enum", "smb2.share_flags.access_based_dir_enum", FT_BOOLEAN, 32,
6129 NULL, SHARE_FLAGS_access_based_dir_enum, NULL, HFILL }},
6131 { &hf_smb2_share_caching,
6132 { "Caching policy", "smb2.share.caching", FT_UINT32, BASE_HEX,
6133 VALS(share_cache_vals), 0, NULL, HFILL }},
6135 { &hf_smb2_share_caps,
6136 { "Share Capabilities", "smb2.share_caps", FT_UINT32, BASE_HEX,
6137 NULL, 0, NULL, HFILL }},
6139 { &hf_smb2_ioctl_flags,
6140 { "Flags", "smb2.ioctl.flags", FT_UINT32, BASE_HEX,
6141 NULL, 0, NULL, HFILL }},
6143 { &hf_smb2_min_count,
6144 { "Min Count", "smb2.min_count", FT_UINT32, BASE_DEC,
6145 NULL, 0, NULL, HFILL }},
6147 { &hf_smb2_remaining_bytes,
6148 { "Remaining Bytes", "smb2.remaining_bytes", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
6150 { &hf_smb2_channel_info_offset,
6151 { "Channel Info Offset", "smb2.channel_info_offset", FT_UINT16, BASE_DEC,
6152 NULL, 0, NULL, HFILL }},
6154 { &hf_smb2_channel_info_length,
6155 { "Channel Info Length", "smb2.channel_info_length", FT_UINT16, BASE_DEC,
6156 NULL, 0, NULL, HFILL }},
6158 { &hf_smb2_share_caps_dfs,
6159 { "dfs", "smb2.share_caps.dfs", FT_BOOLEAN, 32,
6160 NULL, SHARE_CAPS_DFS, NULL, HFILL }},
6162 { &hf_smb2_ioctl_is_fsctl,
6163 { "Is FSCTL", "smb2.ioctl.is_fsctl", FT_BOOLEAN, 32,
6164 NULL, 0x00000001, NULL, HFILL }},
6166 { &hf_smb2_output_buffer_len,
6167 { "Output Buffer Length", "smb2.output_buffer_len", FT_UINT16, BASE_DEC,
6168 NULL, 0, NULL, HFILL }},
6170 { &hf_smb2_close_pq_attrib,
6171 { "PostQuery Attrib", "smb2.close.pq_attrib", FT_BOOLEAN, 16,
6172 NULL, 0x0001, NULL, HFILL }},
6174 { &hf_smb2_notify_watch_tree,
6175 { "Watch Tree", "smb2.notify.watch_tree", FT_BOOLEAN, 16,
6176 NULL, 0x0001, NULL, HFILL }},
6178 { &hf_smb2_notify_out_data,
6179 { "Out Data", "smb2.notify.out", FT_NONE, BASE_NONE,
6180 NULL, 0, NULL, HFILL }},
6182 { &hf_smb2_find_flags_restart_scans,
6183 { "Restart Scans", "smb2.find.restart_scans", FT_BOOLEAN, 8,
6184 NULL, SMB2_FIND_FLAG_RESTART_SCANS, NULL, HFILL }},
6186 { &hf_smb2_find_flags_single_entry,
6187 { "Single Entry", "smb2.find.single_entry", FT_BOOLEAN, 8,
6188 NULL, SMB2_FIND_FLAG_SINGLE_ENTRY, NULL, HFILL }},
6190 { &hf_smb2_find_flags_index_specified,
6191 { "Index Specified", "smb2.find.index_specified", FT_BOOLEAN, 8,
6192 NULL, SMB2_FIND_FLAG_INDEX_SPECIFIED, NULL, HFILL }},
6194 { &hf_smb2_find_flags_reopen,
6195 { "Reopen", "smb2.find.reopen", FT_BOOLEAN, 8,
6196 NULL, SMB2_FIND_FLAG_REOPEN, NULL, HFILL }},
6198 { &hf_smb2_file_index,
6199 { "File Index", "smb2.file_index", FT_UINT32, BASE_HEX,
6200 NULL, 0, NULL, HFILL }},
6202 { &hf_smb2_file_directory_info,
6203 { "FileDirectoryInfo", "smb2.find.file_directory_info", FT_NONE, BASE_NONE,
6204 NULL, 0, NULL, HFILL }},
6206 { &hf_smb2_full_directory_info,
6207 { "FullDirectoryInfo", "smb2.find.full_directory_info", FT_NONE, BASE_NONE,
6208 NULL, 0, NULL, HFILL }},
6210 { &hf_smb2_both_directory_info,
6211 { "FileBothDirectoryInfo", "smb2.find.both_directory_info", FT_NONE, BASE_NONE,
6212 NULL, 0, NULL, HFILL }},
6214 { &hf_smb2_id_both_directory_info,
6215 { "FileIdBothDirectoryInfo", "smb2.find.id_both_directory_info", FT_NONE, BASE_NONE,
6216 NULL, 0, NULL, HFILL }},
6218 { &hf_smb2_short_name_len,
6219 { "Short Name Length", "smb2.short_name_len", FT_UINT8, BASE_DEC,
6220 NULL, 0, NULL, HFILL }},
6222 { &hf_smb2_short_name,
6223 { "Short Name", "smb2.shortname", FT_STRING, BASE_NONE,
6224 NULL, 0, NULL, HFILL }},
6225 { &hf_smb2_file_name_info,
6226 { "FileNameInfo", "smb2.find.name_info", FT_NONE, BASE_NONE,
6227 NULL, 0, NULL, HFILL }},
6229 { &hf_smb2_lock_info,
6230 { "Lock Info", "smb2.lock_info", FT_NONE, BASE_NONE,
6231 NULL, 0, NULL, HFILL }},
6233 { &hf_smb2_lock_length,
6234 { "Length", "smb2.lock_length", FT_UINT64, BASE_DEC,
6235 NULL, 0, NULL, HFILL }},
6237 { &hf_smb2_lock_flags,
6238 { "Flags", "smb2.lock_flags", FT_UINT32, BASE_HEX,
6239 NULL, 0, NULL, HFILL }},
6241 { &hf_smb2_lock_flags_shared,
6242 { "Shared", "smb2.lock_flags.shared", FT_BOOLEAN, 32,
6243 NULL, 0x00000001, NULL, HFILL }},
6245 { &hf_smb2_lock_flags_exclusive,
6246 { "Exclusive", "smb2.lock_flags.exclusive", FT_BOOLEAN, 32,
6247 NULL, 0x00000002, NULL, HFILL }},
6249 { &hf_smb2_lock_flags_unlock,
6250 { "Unlock", "smb2.lock_flags.unlock", FT_BOOLEAN, 32,
6251 NULL, 0x00000004, NULL, HFILL }},
6253 { &hf_smb2_lock_flags_fail_immediately,
6254 { "Fail Immediately", "smb2.lock_flags.fail_immediately", FT_BOOLEAN, 32,
6255 NULL, 0x00000010, NULL, HFILL }},
6257 { &hf_smb2_error_reserved,
6258 { "Reserved", "smb2.error.reserved", FT_UINT16, BASE_HEX,
6259 NULL, 0, NULL, HFILL }},
6261 { &hf_smb2_error_byte_count,
6262 { "Byte Count", "smb2.error.byte_count", FT_UINT32, BASE_DEC,
6263 NULL, 0, NULL, HFILL }},
6265 { &hf_smb2_error_data,
6266 { "Error Data", "smb2.error.data", FT_BYTES, BASE_NONE,
6267 NULL, 0, NULL, HFILL }},
6271 static gint *ett[] = {
6278 &ett_smb2_file_basic_info,
6279 &ett_smb2_file_standard_info,
6280 &ett_smb2_file_internal_info,
6281 &ett_smb2_file_ea_info,
6282 &ett_smb2_file_access_info,
6283 &ett_smb2_file_rename_info,
6284 &ett_smb2_file_disposition_info,
6285 &ett_smb2_file_position_info,
6286 &ett_smb2_file_info_0f,
6287 &ett_smb2_file_mode_info,
6288 &ett_smb2_file_alignment_info,
6289 &ett_smb2_file_all_info,
6290 &ett_smb2_file_allocation_info,
6291 &ett_smb2_file_endoffile_info,
6292 &ett_smb2_file_alternate_name_info,
6293 &ett_smb2_file_stream_info,
6294 &ett_smb2_file_pipe_info,
6295 &ett_smb2_file_compression_info,
6296 &ett_smb2_file_network_open_info,
6297 &ett_smb2_file_attribute_tag_info,
6298 &ett_smb2_fs_info_01,
6299 &ett_smb2_fs_info_03,
6300 &ett_smb2_fs_info_04,
6301 &ett_smb2_fs_info_05,
6302 &ett_smb2_fs_info_06,
6303 &ett_smb2_fs_info_07,
6304 &ett_smb2_fs_objectid_info,
6305 &ett_smb2_sec_info_00,
6307 &ett_smb2_sesid_tree,
6308 &ett_smb2_create_chain_element,
6309 &ett_smb2_MxAc_buffer,
6310 &ett_smb2_ioctl_function,
6311 &ett_smb2_FILE_OBJECTID_BUFFER,
6314 &ett_smb2_capabilities,
6315 &ett_smb2_ses_flags,
6316 &ett_smb2_share_flags,
6317 &ett_smb2_share_caps,
6318 &ett_smb2_ioctl_flags,
6319 &ett_smb2_close_flags,
6320 &ett_smb2_notify_flags,
6321 &ett_smb2_find_flags,
6322 &ett_smb2_file_directory_info,
6323 &ett_smb2_both_directory_info,
6324 &ett_smb2_id_both_directory_info,
6325 &ett_smb2_full_directory_info,
6326 &ett_smb2_file_name_info,
6327 &ett_smb2_lock_info,
6328 &ett_smb2_lock_flags,
6331 proto_smb2 = proto_register_protocol("SMB2 (Server Message Block Protocol version 2)",
6333 proto_register_subtree_array(ett, array_length(ett));
6334 proto_register_field_array(proto_smb2, hf, array_length(hf));
6336 register_heur_dissector_list("smb2_heur_subdissectors", &smb2_heur_subdissector_list);
6337 smb2_tap = register_tap("smb2");
6341 proto_reg_handoff_smb2(void)
6343 gssapi_handle = find_dissector("gssapi");
6344 ntlmssp_handle = find_dissector("ntlmssp");
6345 heur_dissector_add("netbios", dissect_smb2_heur, proto_smb2);