2 * Routines for smb packet dissection
3 * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
4 * 2001 Rewrite by Ronnie Sahlberg and Guy Harris
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * Copied from packet-pop.c
12 * SPDX-License-Identifier: GPL-2.0-or-later
17 #include <epan/packet.h>
18 #include <epan/exceptions.h>
19 #include <epan/strutil.h>
20 #include <epan/prefs.h>
21 #include <epan/reassemble.h>
23 #include <epan/srt_table.h>
24 #include <epan/expert.h>
25 #include <epan/to_str.h>
26 #include <epan/export_object.h>
28 #include <wsutil/array.h>
30 #include "packet-windows-common.h"
31 #include "packet-smb.h"
32 #include "packet-ipx.h"
33 #include "packet-idp.h"
34 #include "packet-smb-common.h"
35 #include "packet-smb-mailslot.h"
36 #include "packet-smb-pipe.h"
37 #include "packet-ntlmssp.h"
38 #include "packet-smb2.h"
40 void proto_register_smb(void);
41 void proto_reg_handoff_smb(void);
44 * Various specifications and documents about SMB can be found in
46 * ftp://ftp.microsoft.com/developr/drg/CIFS/
48 * and a CIFS specification from the Storage Networking Industry Association
49 * can be found on a link from the page at
51 * http://www.snia.org/tech_activities/CIFS
53 * (it supercedes the document at
55 * ftp://ftp.microsoft.com/developr/drg/CIFS/draft-leach-cifs-v1-spec-01.txt
59 * There are also some Open Group publications documenting CIFS available
60 * for download; catalog entries for them are at:
62 * http://www.opengroup.org/products/publications/catalog/c209.htm
64 * http://www.opengroup.org/products/publications/catalog/c195.htm
66 * The document "NT LAN Manager SMB File Sharing Protocol Extensions"
69 * http://www.samba.org/samba/ftp/specs/smb-nt01.doc
71 * (or, presumably a similar path under the Samba mirrors). As the
72 * ".doc" indicates, it's a Word document. Some of the specs from the
73 * Microsoft FTP site can be found in the
75 * http://www.samba.org/samba/ftp/specs/
79 * Beware - these specs may have errors.
81 * Microsoft's public protocol specifications, including MS-CIFS and
82 * other SMB-related specifications, can be found at
84 * http://msdn.microsoft.com/en-us/library/cc216513.aspx
88 * https://wiki.samba.org/index.php/UNIX_Extensions
91 /* DFS referral entry flags */
92 #define REFENT_FLAGS_NAME_LIST_REFERRAL 0x0002
93 #define REFENT_FLAGS_TARGET_SET_BOUNDARY 0x0004
97 static int hf_smb_cmd
;
98 static int hf_smb_andxcmd
;
99 static int hf_smb_mapped_in
;
100 static int hf_smb_unmapped_in
;
101 static int hf_smb_opened_in
;
102 static int hf_smb_closed_in
;
103 static int hf_smb_key
;
104 static int hf_smb_session_id
;
105 static int hf_smb_sequence_num
;
106 static int hf_smb_group_id
;
107 static int hf_smb_pid
;
108 static int hf_smb_tid
;
109 static int hf_smb_uid
;
110 static int hf_smb_mid
;
111 static int hf_smb_pid_high
;
112 static int hf_smb_sig
;
113 static int hf_smb_response_to
;
114 static int hf_smb_time
;
115 static int hf_smb_response_in
;
116 static int hf_smb_continuation_of
;
117 static int hf_smb_nt_status
;
118 static int hf_smb_error_class
;
119 static int hf_smb_error_code
;
120 static int hf_smb_reserved
;
121 static int hf_smb_create_flags
;
122 static int hf_smb_create_options
;
123 static int hf_smb_share_access
;
124 static int hf_smb_access_mask
;
125 static int hf_smb_flags
;
126 static int hf_smb_flags_lock
;
127 static int hf_smb_flags_receive_buffer
;
128 static int hf_smb_flags_caseless
;
129 static int hf_smb_flags_canon
;
130 static int hf_smb_flags_oplock
;
131 static int hf_smb_flags_notify
;
132 static int hf_smb_flags_response
;
133 static int hf_smb_flags2
;
134 static int hf_smb_flags2_long_names_allowed
;
135 static int hf_smb_flags2_ea
;
136 static int hf_smb_flags2_sec_sig
;
137 static int hf_smb_flags2_compressed
;
138 static int hf_smb_flags2_sec_sig_required
;
139 static int hf_smb_flags2_long_names_used
;
140 static int hf_smb_flags2_reparse_path
;
141 static int hf_smb_flags2_esn
;
142 static int hf_smb_flags2_dfs
;
143 static int hf_smb_flags2_roe
;
144 static int hf_smb_flags2_nt_error
;
145 static int hf_smb_flags2_string
;
146 static int hf_smb_word_count
;
147 static int hf_smb_byte_count
;
148 static int hf_smb_buffer_format
;
149 static int hf_smb_dialect
;
150 static int hf_smb_dialect_name
;
151 static int hf_smb_dialect_index
;
152 static int hf_smb_max_trans_buf_size
;
153 static int hf_smb_max_mpx_count
;
154 static int hf_smb_max_vcs_num
;
155 static int hf_smb_session_key
;
156 static int hf_smb_server_timezone
;
157 static int hf_smb_challenge_length
;
158 static int hf_smb_challenge
;
159 static int hf_smb_primary_domain
;
160 static int hf_smb_server
;
161 static int hf_smb_max_raw_buf_size
;
162 static int hf_smb_server_guid
;
163 static int hf_smb_volume_guid
;
164 static int hf_smb_security_blob_len
;
165 static int hf_smb_security_blob
;
166 static int hf_smb_sm16
;
167 static int hf_smb_sm_mode16
;
168 static int hf_smb_sm_password16
;
169 static int hf_smb_sm
;
170 static int hf_smb_sm_mode
;
171 static int hf_smb_sm_password
;
172 static int hf_smb_sm_signatures
;
173 static int hf_smb_sm_sig_required
;
174 static int hf_smb_rm
;
175 static int hf_smb_rm_read
;
176 static int hf_smb_rm_write
;
177 static int hf_smb_server_date_time
;
178 static int hf_smb_server_smb_date
;
179 static int hf_smb_server_smb_time
;
180 static int hf_smb_server_cap
;
181 static int hf_smb_server_cap_raw_mode
;
182 static int hf_smb_server_cap_mpx_mode
;
183 static int hf_smb_server_cap_unicode
;
184 static int hf_smb_server_cap_large_files
;
185 static int hf_smb_server_cap_nt_smbs
;
186 static int hf_smb_server_cap_rpc_remote_apis
;
187 static int hf_smb_server_cap_nt_status
;
188 static int hf_smb_server_cap_level_ii_oplocks
;
189 static int hf_smb_server_cap_lock_and_read
;
190 static int hf_smb_server_cap_nt_find
;
191 static int hf_smb_server_cap_dfs
;
192 static int hf_smb_server_cap_infolevel_passthru
;
193 static int hf_smb_server_cap_large_readx
;
194 static int hf_smb_server_cap_large_writex
;
195 static int hf_smb_server_cap_lwio
;
196 static int hf_smb_server_cap_unix
;
197 static int hf_smb_server_cap_compressed_data
;
198 static int hf_smb_server_cap_dynamic_reauth
;
199 static int hf_smb_server_cap_extended_security
;
200 static int hf_smb_system_time
;
201 static int hf_smb_secondaries_will_follow
;
202 static int hf_smb_unknown
;
203 static int hf_smb_dir_name
;
204 static int hf_smb_echo_count
;
205 static int hf_smb_echo_data
;
206 static int hf_smb_echo_seq_num
;
207 static int hf_smb_max_buf_size
;
208 static int hf_smb_password
;
209 static int hf_smb_password_len
;
210 static int hf_smb_ansi_password
;
211 static int hf_smb_ansi_password_len
;
212 static int hf_smb_unicode_password
;
213 static int hf_smb_unicode_password_len
;
214 static int hf_smb_path
;
215 static int hf_smb_service
;
216 static int hf_smb_move_flags
;
217 static int hf_smb_move_flags_file
;
218 static int hf_smb_move_flags_dir
;
219 static int hf_smb_move_flags_verify
;
220 static int hf_smb_files_moved
;
221 static int hf_smb_file_access_mask_read_data
;
222 static int hf_smb_file_access_mask_write_data
;
223 static int hf_smb_file_access_mask_append_data
;
224 static int hf_smb_file_access_mask_read_ea
;
225 static int hf_smb_file_access_mask_write_ea
;
226 static int hf_smb_file_access_mask_execute
;
227 static int hf_smb_file_access_mask_read_attribute
;
228 static int hf_smb_file_access_mask_write_attribute
;
229 static int hf_smb_dir_access_mask_list
;
230 static int hf_smb_dir_access_mask_add_file
;
231 static int hf_smb_dir_access_mask_add_subdir
;
232 static int hf_smb_dir_access_mask_read_ea
;
233 static int hf_smb_dir_access_mask_write_ea
;
234 static int hf_smb_dir_access_mask_traverse
;
235 static int hf_smb_dir_access_mask_delete_child
;
236 static int hf_smb_dir_access_mask_read_attribute
;
237 static int hf_smb_dir_access_mask_write_attribute
;
238 static int hf_smb_copy_flags
;
239 static int hf_smb_copy_flags_file
;
240 static int hf_smb_copy_flags_dir
;
241 static int hf_smb_copy_flags_dest_mode
;
242 static int hf_smb_copy_flags_source_mode
;
243 static int hf_smb_copy_flags_verify
;
244 static int hf_smb_copy_flags_tree_copy
;
245 static int hf_smb_copy_flags_ea_action
;
246 static int hf_smb_count
;
247 static int hf_smb_count_low
;
248 static int hf_smb_count_high
;
249 static int hf_smb_file_name
;
250 static int hf_smb_open_function
;
251 static int hf_smb_open_function_open
;
252 static int hf_smb_open_function_create
;
253 static int hf_smb_fid
;
254 static int hf_smb_file_attr_16bit
;
255 static int hf_smb_file_attr_8bit
;
256 static int hf_smb_file_attr_read_only_16bit
;
257 static int hf_smb_file_attr_read_only_8bit
;
258 static int hf_smb_file_attr_hidden_16bit
;
259 static int hf_smb_file_attr_hidden_8bit
;
260 static int hf_smb_file_attr_system_16bit
;
261 static int hf_smb_file_attr_system_8bit
;
262 static int hf_smb_file_attr_volume_16bit
;
263 static int hf_smb_file_attr_volume_8bit
;
264 static int hf_smb_file_attr_directory_16bit
;
265 static int hf_smb_file_attr_directory_8bit
;
266 static int hf_smb_file_attr_archive_16bit
;
267 static int hf_smb_file_attr_archive_8bit
;
269 static int hf_smb_file_attr_device
;
270 static int hf_smb_file_attr_normal
;
271 static int hf_smb_file_attr_temporary
;
272 static int hf_smb_file_attr_sparse
;
273 static int hf_smb_file_attr_reparse
;
274 static int hf_smb_file_attr_compressed
;
275 static int hf_smb_file_attr_offline
;
276 static int hf_smb_file_attr_not_content_indexed
;
277 static int hf_smb_file_attr_encrypted
;
279 static int hf_smb_file_size
;
280 static int hf_smb_search_attribute
;
281 static int hf_smb_search_attribute_read_only
;
282 static int hf_smb_search_attribute_hidden
;
283 static int hf_smb_search_attribute_system
;
284 static int hf_smb_search_attribute_volume
;
285 static int hf_smb_search_attribute_directory
;
286 static int hf_smb_search_attribute_archive
;
287 static int hf_smb_access_mode
;
288 static int hf_smb_access_sharing
;
289 static int hf_smb_access_locality
;
290 static int hf_smb_access_caching
;
291 static int hf_smb_access_writetru
;
292 static int hf_smb_desired_access
;
293 static int hf_smb_granted_access
;
294 static int hf_smb_create_time
;
295 static int hf_smb_modify_time
;
296 static int hf_smb_backup_time
;
297 static int hf_smb_mac_alloc_block_count
;
298 static int hf_smb_mac_alloc_block_size
;
299 static int hf_smb_mac_free_block_count
;
300 static int hf_smb_mac_fndrinfo
;
301 static int hf_smb_mac_root_file_count
;
302 static int hf_smb_mac_root_dir_count
;
303 static int hf_smb_mac_file_count
;
304 static int hf_smb_mac_dir_count
;
305 static int hf_smb_mac_sup
;
306 static int hf_smb_mac_sup_access_ctrl
;
307 static int hf_smb_mac_sup_getset_comments
;
308 static int hf_smb_mac_sup_desktopdb_calls
;
309 static int hf_smb_mac_sup_unique_ids
;
310 static int hf_smb_mac_sup_streams
;
311 static int hf_smb_create_dos_date
;
312 static int hf_smb_create_dos_time
;
313 static int hf_smb_last_write_time
;
314 static int hf_smb_last_write_dos_date
;
315 static int hf_smb_last_write_dos_time
;
316 static int hf_smb_access_time
;
317 static int hf_smb_access_dos_date
;
318 static int hf_smb_access_dos_time
;
319 static int hf_smb_old_file_name
;
320 static int hf_smb_offset
;
321 static int hf_smb_remaining
;
322 static int hf_smb_padding
;
323 static int hf_smb_file_data
;
324 /* static int hf_smb_raw_ea_data; */
325 static int hf_smb_total_data_len
;
326 static int hf_smb_data_len
;
327 static int hf_smb_data_len_low
;
328 static int hf_smb_data_len_high
;
329 static int hf_bytes_until_total_data_count
;
330 static int hf_smb_seek_mode
;
331 static int hf_smb_data_size
;
332 static int hf_smb_alloc_size
;
333 static int hf_smb_alloc_size64
;
334 static int hf_smb_max_count
;
335 static int hf_smb_max_count_low
;
336 static int hf_smb_max_count_high
;
337 static int hf_smb_min_count
;
338 static int hf_smb_timeout
;
339 static int hf_smb_high_offset
;
340 static int hf_smb_units
;
341 static int hf_smb_bpu
;
342 static int hf_smb_blocksize
;
343 static int hf_smb_freeunits
;
344 static int hf_smb_data_offset
;
345 static int hf_smb_dcm
;
346 static int hf_smb_request_mask
;
347 static int hf_smb_response_mask
;
348 static int hf_smb_search_id
;
349 static int hf_smb_write_mode
;
350 static int hf_smb_write_mode_write_through
;
351 static int hf_smb_write_mode_return_remaining
;
352 static int hf_smb_write_mode_raw
;
353 static int hf_smb_write_mode_message_start
;
354 static int hf_smb_write_mode_connectionless
;
355 static int hf_smb_resume_key_len
;
356 static int hf_smb_resume_find_id
;
357 static int hf_smb_resume_server_cookie
;
358 static int hf_smb_resume_client_cookie
;
359 static int hf_smb_andxoffset
;
360 static int hf_smb_lock_type
;
361 static int hf_smb_lock_type_large
;
362 static int hf_smb_lock_type_cancel
;
363 static int hf_smb_lock_type_change
;
364 static int hf_smb_lock_type_oplock
;
365 static int hf_smb_lock_type_shared
;
366 static int hf_smb_locking_ol
;
367 static int hf_smb_number_of_locks
;
368 static int hf_smb_number_of_unlocks
;
369 static int hf_smb_lock_long_offset
;
370 static int hf_smb_lock_long_length
;
371 static int hf_smb_file_type
;
372 static int hf_smb_ipc_state
;
373 static int hf_smb_ipc_state_nonblocking
;
374 static int hf_smb_ipc_state_endpoint
;
375 static int hf_smb_ipc_state_pipe_type
;
376 static int hf_smb_ipc_state_read_mode
;
377 static int hf_smb_ipc_state_icount
;
378 static int hf_smb_server_fid
;
379 static int hf_smb_open_flags
;
380 static int hf_smb_open_flags_add_info
;
381 static int hf_smb_open_flags_ex_oplock
;
382 static int hf_smb_open_flags_batch_oplock
;
383 static int hf_smb_open_flags_ealen
;
384 static int hf_smb_open_action
;
385 static int hf_smb_open_action_open
;
386 static int hf_smb_open_action_lock
;
387 static int hf_smb_vc_num
;
388 static int hf_smb_account
;
389 static int hf_smb_os
;
390 static int hf_smb_lanman
;
391 static int hf_smb_setup_action
;
392 static int hf_smb_setup_action_guest
;
393 static int hf_smb_fs
;
394 static int hf_smb_connect_flags
;
395 static int hf_smb_connect_flags_dtid
;
396 static int hf_smb_connect_flags_ext_sig
;
397 static int hf_smb_connect_flags_ext_resp
;
398 static int hf_smb_connect_support
;
399 static int hf_smb_connect_support_search
;
400 static int hf_smb_connect_support_in_dfs
;
401 static int hf_smb_connect_support_csc_mask_vals
;
402 static int hf_smb_connect_support_uniquefilename
;
403 static int hf_smb_connect_support_extended_signature
;
404 static int hf_smb_max_setup_count
;
405 static int hf_smb_total_param_count
;
406 static int hf_smb_total_data_count
;
407 static int hf_smb_max_param_count
;
408 static int hf_smb_max_data_count
;
409 static int hf_smb_param_disp16
;
410 static int hf_smb_param_count16
;
411 static int hf_smb_param_offset16
;
412 static int hf_smb_param_disp32
;
413 static int hf_smb_param_count32
;
414 static int hf_smb_param_offset32
;
415 static int hf_smb_data_disp16
;
416 static int hf_smb_data_count16
;
417 static int hf_smb_data_offset16
;
418 static int hf_smb_data_disp32
;
419 static int hf_smb_data_count32
;
420 static int hf_smb_data_offset32
;
421 static int hf_smb_setup_count
;
422 static int hf_smb_nt_trans_subcmd
;
423 static int hf_smb_nt_ioctl_isfsctl
;
424 static int hf_smb_nt_ioctl_flags_completion_filter
;
425 static int hf_smb_nt_ioctl_flags_root_handle
;
426 static int hf_smb_nt_notify_action
;
427 static int hf_smb_nt_notify_watch_tree
;
428 static int hf_smb_nt_notify_completion_filter
;
429 static int hf_smb_nt_notify_stream_write
;
430 static int hf_smb_nt_notify_stream_size
;
431 static int hf_smb_nt_notify_stream_name
;
432 static int hf_smb_nt_notify_security
;
433 static int hf_smb_nt_notify_ea
;
434 static int hf_smb_nt_notify_creation
;
435 static int hf_smb_nt_notify_last_access
;
436 static int hf_smb_nt_notify_last_write
;
437 static int hf_smb_nt_notify_size
;
438 static int hf_smb_nt_notify_attributes
;
439 static int hf_smb_nt_notify_dir_name
;
440 static int hf_smb_nt_notify_file_name
;
441 static int hf_smb_root_dir_fid
;
442 static int hf_smb_nt_create_disposition
;
443 static int hf_smb_sd_length
;
444 static int hf_smb_ea_list_length
;
445 static int hf_smb_ea_flags
;
446 static int hf_smb_ea_name_length
;
447 static int hf_smb_ea_data_length
;
448 static int hf_smb_ea_name
;
449 static int hf_smb_ea_data
;
450 static int hf_smb_file_name_len
;
451 static int hf_smb_nt_impersonation_level
;
452 static int hf_smb_nt_security_flags
;
453 static int hf_smb_nt_security_flags_context_tracking
;
454 static int hf_smb_nt_security_flags_effective_only
;
455 static int hf_smb_nt_access_mask_generic_read
;
456 static int hf_smb_nt_access_mask_generic_write
;
457 static int hf_smb_nt_access_mask_generic_execute
;
458 static int hf_smb_nt_access_mask_generic_all
;
459 static int hf_smb_nt_access_mask_maximum_allowed
;
460 static int hf_smb_nt_access_mask_system_security
;
461 static int hf_smb_nt_access_mask_synchronize
;
462 static int hf_smb_nt_access_mask_write_owner
;
463 static int hf_smb_nt_access_mask_write_dac
;
464 static int hf_smb_nt_access_mask_read_control
;
465 static int hf_smb_nt_access_mask_delete
;
466 static int hf_smb_nt_access_mask_write_attributes
;
467 static int hf_smb_nt_access_mask_read_attributes
;
468 static int hf_smb_nt_access_mask_delete_child
;
469 static int hf_smb_nt_access_mask_execute
;
470 static int hf_smb_nt_access_mask_write_ea
;
471 static int hf_smb_nt_access_mask_read_ea
;
472 static int hf_smb_nt_access_mask_append
;
473 static int hf_smb_nt_access_mask_write
;
474 static int hf_smb_nt_access_mask_read
;
475 static int hf_smb_nt_create_bits_oplock
;
476 static int hf_smb_nt_create_bits_boplock
;
477 static int hf_smb_nt_create_bits_dir
;
478 static int hf_smb_nt_create_bits_ext_resp
;
479 static int hf_smb_nt_create_options_directory_file
;
480 static int hf_smb_nt_create_options_write_through
;
481 static int hf_smb_nt_create_options_sequential_only
;
482 static int hf_smb_nt_create_options_no_intermediate_buffering
;
483 static int hf_smb_nt_create_options_sync_io_alert
;
484 static int hf_smb_nt_create_options_sync_io_nonalert
;
485 static int hf_smb_nt_create_options_non_directory_file
;
486 static int hf_smb_nt_create_options_create_tree_connection
;
487 static int hf_smb_nt_create_options_complete_if_oplocked
;
488 static int hf_smb_nt_create_options_no_ea_knowledge
;
489 static int hf_smb_nt_create_options_file_open_for_recovery
;
490 static int hf_smb_nt_create_options_random_access
;
491 static int hf_smb_nt_create_options_delete_on_close
;
492 static int hf_smb_nt_create_options_open_by_fileid
;
493 static int hf_smb_nt_create_options_backup_intent
;
494 static int hf_smb_nt_create_options_no_compression
;
495 static int hf_smb_nt_create_options_reserve_opfilter
;
496 static int hf_smb_nt_create_options_open_reparse_point
;
497 static int hf_smb_nt_create_options_open_no_recall
;
498 static int hf_smb_nt_create_options_open_for_free_space_query
;
499 static int hf_smb_nt_share_access_read
;
500 static int hf_smb_nt_share_access_write
;
501 static int hf_smb_nt_share_access_delete
;
502 static int hf_smb_file_eattr
;
503 static int hf_smb_file_eattr_read_only
;
504 static int hf_smb_file_eattr_hidden
;
505 static int hf_smb_file_eattr_system
;
506 static int hf_smb_file_eattr_volume
;
507 static int hf_smb_file_eattr_directory
;
508 static int hf_smb_file_eattr_archive
;
509 static int hf_smb_file_eattr_device
;
510 static int hf_smb_file_eattr_normal
;
511 static int hf_smb_file_eattr_temporary
;
512 static int hf_smb_file_eattr_sparse
;
513 static int hf_smb_file_eattr_reparse
;
514 static int hf_smb_file_eattr_compressed
;
515 static int hf_smb_file_eattr_offline
;
516 static int hf_smb_file_eattr_not_content_indexed
;
517 static int hf_smb_file_eattr_encrypted
;
518 static int hf_smb_size_returned_quota_data
;
519 static int hf_smb_sec_desc_len
;
520 static int hf_smb_nt_qsd
;
521 static int hf_smb_nt_qsd_owner
;
522 static int hf_smb_nt_qsd_group
;
523 static int hf_smb_nt_qsd_dacl
;
524 static int hf_smb_nt_qsd_sacl
;
525 static int hf_smb_extended_attributes
;
526 static int hf_smb_oplock_level
;
527 static int hf_smb_response_type
;
528 static int hf_smb_create_action
;
529 static int hf_smb_file_id
;
530 static int hf_smb_file_id_64bit
;
531 static int hf_smb_ea_error_offset
;
532 static int hf_smb_end_of_file
;
533 static int hf_smb_replace
;
534 static int hf_smb_root_dir_handle
;
535 static int hf_smb_target_name_len
;
536 static int hf_smb_target_name
;
537 static int hf_smb_device_type
;
538 static int hf_smb_is_directory
;
539 static int hf_smb_next_entry_offset
;
540 static int hf_smb_change_time
;
541 static int hf_smb_setup_len
;
542 static int hf_smb_print_mode
;
543 static int hf_smb_print_identifier
;
544 static int hf_smb_restart_index
;
545 static int hf_smb_print_queue_date
;
546 static int hf_smb_print_queue_dos_date
;
547 static int hf_smb_print_queue_dos_time
;
548 static int hf_smb_print_status
;
549 static int hf_smb_print_spool_file_number
;
550 static int hf_smb_print_spool_file_size
;
551 static int hf_smb_print_spool_file_name
;
552 static int hf_smb_start_index
;
553 static int hf_smb_originator_name
;
554 static int hf_smb_destination_name
;
555 static int hf_smb_message_len
;
556 static int hf_smb_message
;
557 static int hf_smb_mgid
;
558 static int hf_smb_forwarded_name
;
559 static int hf_smb_machine_name
;
560 static int hf_smb_cancel_to
;
561 static int hf_smb_trans2_subcmd
;
562 static int hf_smb_trans_name
;
563 static int hf_smb_transaction_flags
;
564 static int hf_smb_transaction_flags_dtid
;
565 static int hf_smb_transaction_flags_owt
;
566 static int hf_smb_search_count_max
;
567 static int hf_smb_search_count_found
;
568 static int hf_smb_search_pattern
;
569 static int hf_smb_ff2
;
570 static int hf_smb_ff2_backup
;
571 static int hf_smb_ff2_continue
;
572 static int hf_smb_ff2_resume
;
573 static int hf_smb_ff2_close_eos
;
574 static int hf_smb_ff2_close
;
575 static int hf_smb_ff2_information_level
;
576 static int hf_smb_qpi_loi
;
577 static int hf_smb_spi_loi
;
579 static int hf_smb_sfi
;
580 static int hf_smb_sfi_writetru
;
581 static int hf_smb_sfi_caching
;
583 static int hf_smb_storage_type
;
584 static int hf_smb_resume
;
585 static int hf_smb_max_referral_level
;
586 static int hf_smb_qfsi_information_level
;
587 static int hf_smb_sfsi_information_level
;
588 static int hf_smb_number_of_links
;
589 static int hf_smb_delete_pending
;
590 static int hf_smb_index_number
;
591 static int hf_smb_position
;
592 /* static int hf_smb_current_offset; */
593 static int hf_smb_t2_alignment
;
594 static int hf_smb_t2_stream_name_length
;
595 static int hf_smb_t2_stream_size
;
596 static int hf_smb_t2_stream_name
;
597 static int hf_smb_t2_compressed_file_size
;
598 static int hf_smb_t2_compressed_format
;
599 static int hf_smb_t2_compressed_unit_shift
;
600 static int hf_smb_t2_compressed_chunk_shift
;
601 static int hf_smb_t2_compressed_cluster_shift
;
602 static int hf_smb_t2_marked_for_deletion
;
603 static int hf_smb_dfs_path_consumed
;
604 static int hf_smb_dfs_num_referrals
;
605 static int hf_smb_get_dfs_flags
;
606 static int hf_smb_get_dfs_server_hold_storage
;
607 static int hf_smb_get_dfs_fielding
;
608 static int hf_smb_dfs_referral_version
;
609 static int hf_smb_dfs_referral_size
;
610 static int hf_smb_dfs_referral_server_type
;
611 static int hf_smb_dfs_referral_flags
;
612 static int hf_smb_dfs_referral_flags_name_list_referral
;
613 static int hf_smb_dfs_referral_flags_target_set_boundary
;
614 static int hf_smb_dfs_referral_node_offset
;
615 static int hf_smb_dfs_referral_node
;
616 static int hf_smb_dfs_referral_proximity
;
617 static int hf_smb_dfs_referral_ttl
;
618 static int hf_smb_dfs_referral_path_offset
;
619 static int hf_smb_dfs_referral_path
;
620 static int hf_smb_dfs_referral_alt_path_offset
;
621 static int hf_smb_dfs_referral_alt_path
;
622 static int hf_smb_dfs_referral_domain_offset
;
623 static int hf_smb_dfs_referral_number_of_expnames
;
624 static int hf_smb_dfs_referral_expnames_offset
;
625 static int hf_smb_dfs_referral_domain_name
;
626 static int hf_smb_dfs_referral_expname
;
627 static int hf_smb_dfs_referral_server_guid
;
628 static int hf_smb_end_of_search
;
629 static int hf_smb_last_name_offset
;
630 static int hf_smb_fn_information_level
;
631 static int hf_smb_monitor_handle
;
632 static int hf_smb_change_count
;
633 static int hf_smb_file_index
;
634 static int hf_smb_short_file_name
;
635 static int hf_smb_short_file_name_len
;
636 static int hf_smb_fs_id
;
637 static int hf_smb_sector_unit
;
638 static int hf_smb_fs_units
;
639 static int hf_smb_fs_sector
;
640 static int hf_smb_avail_units
;
641 static int hf_smb_volume_serial_num
;
642 static int hf_smb_volume_label_len
;
643 static int hf_smb_volume_label
;
644 static int hf_smb_free_alloc_units64
;
645 static int hf_smb_caller_free_alloc_units64
;
646 static int hf_smb_actual_free_alloc_units64
;
647 static int hf_smb_max_name_len
;
648 static int hf_smb_fs_name_len
;
649 static int hf_smb_fs_name
;
650 static int hf_smb_device_char
;
651 static int hf_smb_device_char_removable
;
652 static int hf_smb_device_char_read_only
;
653 static int hf_smb_device_char_floppy
;
654 static int hf_smb_device_char_write_once
;
655 static int hf_smb_device_char_remote
;
656 static int hf_smb_device_char_mounted
;
657 static int hf_smb_device_char_virtual
;
658 static int hf_smb_device_char_secure_open
;
659 static int hf_smb_device_char_ts
;
660 static int hf_smb_device_char_webdav
;
661 static int hf_smb_device_char_aat
;
662 static int hf_smb_device_char_portable
;
663 static int hf_smb_fs_attr
;
664 static int hf_smb_fs_attr_css
;
665 static int hf_smb_fs_attr_cpn
;
666 static int hf_smb_fs_attr_uod
;
667 static int hf_smb_fs_attr_pacls
;
668 static int hf_smb_fs_attr_fc
;
669 static int hf_smb_fs_attr_vq
;
670 static int hf_smb_fs_attr_ssf
;
671 static int hf_smb_fs_attr_srp
;
672 static int hf_smb_fs_attr_srs
;
673 static int hf_smb_fs_attr_sla
;
674 static int hf_smb_fs_attr_vic
;
675 static int hf_smb_fs_attr_soids
;
676 static int hf_smb_fs_attr_se
;
677 static int hf_smb_fs_attr_ns
;
678 static int hf_smb_fs_attr_rov
;
679 static int hf_smb_fs_attr_swo
;
680 static int hf_smb_fs_attr_st
;
681 static int hf_smb_fs_attr_shl
;
682 static int hf_smb_fs_attr_sis
;
683 static int hf_smb_fs_attr_sbr
;
684 static int hf_smb_fs_attr_ssv
;
685 static int hf_smb_quota_flags
;
686 static int hf_smb_quota_flags_enabled
;
687 static int hf_smb_quota_flags_deny_disk
;
688 static int hf_smb_quota_flags_log_limit
;
689 static int hf_smb_quota_flags_log_warning
;
690 static int hf_smb_soft_quota_limit
;
691 static int hf_smb_hard_quota_limit
;
692 static int hf_smb_user_quota_used
;
693 static int hf_smb_user_quota_change_time
;
694 static int hf_smb_length_of_sid
;
695 static int hf_smb_user_quota_offset
;
696 static int hf_smb_nt_rename_level
;
697 static int hf_smb_cluster_count
;
698 static int hf_smb_segments
;
699 static int hf_smb_segment
;
700 static int hf_smb_segment_overlap
;
701 static int hf_smb_segment_overlap_conflict
;
702 static int hf_smb_segment_multiple_tails
;
703 static int hf_smb_segment_too_long_fragment
;
704 static int hf_smb_segment_error
;
705 static int hf_smb_segment_count
;
706 static int hf_smb_reassembled_length
;
707 static int hf_smb_pipe_write_len
;
708 static int hf_smb_unix_major_version
;
709 static int hf_smb_unix_minor_version
;
710 static int hf_smb_unix_capability
;
711 static int hf_smb_unix_capability_fcntl
;
712 static int hf_smb_unix_capability_posix_acl
;
713 static int hf_smb_unix_capability_xattr
;
714 static int hf_smb_unix_capability_attr
;
715 static int hf_smb_unix_capability_posix_paths
;
716 static int hf_smb_unix_capability_posix_path_ops
;
717 static int hf_smb_unix_capability_large_read
;
718 static int hf_smb_unix_capability_large_write
;
719 static int hf_smb_unix_capability_encryption
;
720 static int hf_smb_unix_capability_mandatory_crypto
;
721 static int hf_smb_unix_capability_proxy
;
722 static int hf_smb_unix_file_link_dest
;
723 static int hf_smb_unix_file_size
;
724 static int hf_smb_unix_file_num_bytes
;
725 static int hf_smb_unix_file_last_status
;
726 static int hf_smb_unix_file_last_access
;
727 static int hf_smb_unix_file_last_change
;
728 static int hf_smb_unix_file_creation_time
;
729 static int hf_smb_unix_file_uid
;
730 static int hf_smb_unix_file_gid
;
731 static int hf_smb_unix_file_type
;
732 static int hf_smb_unix_file_dev_major
;
733 static int hf_smb_unix_file_dev_minor
;
734 static int hf_smb_unix_file_unique_id
;
735 static int hf_smb_unix_file_permissions
;
736 static int hf_smb_unix_file_nlinks
;
737 static int hf_smb_unix_info2_file_flags
;
738 static int hf_smb_unix_info2_file_flags_mask
;
739 static int hf_smb_unix_info2_file_flags_secure_delete
;
740 static int hf_smb_unix_info2_file_flags_enable_undelete
;
741 static int hf_smb_unix_info2_file_flags_synchronous
;
742 static int hf_smb_unix_info2_file_flags_immutable
;
743 static int hf_smb_unix_info2_file_flags_append_only
;
744 static int hf_smb_unix_info2_file_flags_do_not_backup
;
745 static int hf_smb_unix_info2_file_flags_no_update_atime
;
746 static int hf_smb_unix_info2_file_flags_hidden
;
747 static int hf_smb_unix_file_name_length
;
748 static int hf_smb_unix_file_name
;
749 static int hf_smb_unix_find_file_nextoffset
;
750 static int hf_smb_unix_find_file_resumekey
;
751 static int hf_smb_unix_whoami_mapflags
;
752 static int hf_smb_unix_whoami_mapflags_mask
;
753 static int hf_smb_unix_whoami_num_supl_gids
;
754 static int hf_smb_unix_whoami_num_supl_sids
;
755 static int hf_smb_unix_whoami_sids_buflen
;
756 static int hf_smb_disposition_delete_on_close
;
757 static int hf_smb_pipe_info_flag
;
758 static int hf_smb_mode
;
759 static int hf_smb_attribute
;
760 static int hf_smb_reparse_tag
;
761 static int hf_smb_logged_in
;
762 static int hf_smb_logged_out
;
763 static int hf_smb_file_rw_offset
;
764 static int hf_smb_file_rw_length
;
765 static int hf_smb_posix_acl_version
;
766 static int hf_smb_posix_num_file_aces
;
767 static int hf_smb_posix_num_def_aces
;
768 static int hf_smb_posix_ace_type
;
769 static int hf_smb_posix_ace_flags
;
770 static int hf_smb_posix_ace_perm_read
;
771 static int hf_smb_posix_ace_perm_write
;
772 static int hf_smb_posix_ace_perm_execute
;
773 static int hf_smb_posix_ace_perm_owner_uid
;
774 static int hf_smb_posix_ace_perm_owner_gid
;
775 static int hf_smb_posix_ace_perm_uid
;
776 static int hf_smb_posix_ace_perm_gid
;
777 static int hf_smb_trans_data_setup_word
;
778 static int hf_smb_trans_data_parameters
;
779 static int hf_smb_trans_data
;
780 static int hf_smb_extra_byte_parameters
;
781 static int hf_smb_file_access_mask_full_control
;
782 static int hf_smb_dir_access_mask_full_control
;
783 static int hf_smb_word_unk_response_format
;
784 static int hf_smb_nt_transaction_setup
;
785 static int hf_smb_server_component
;
786 static int hf_smb_byte_parameters
;
787 static int hf_smb_word_parameters
;
790 static int ett_smb_fid
;
791 static int ett_smb_tid
;
792 static int ett_smb_uid
;
793 static int ett_smb_hdr
;
794 static int ett_smb_command
;
795 static int ett_smb_fileattributes
;
796 static int ett_smb_capabilities
;
797 static int ett_smb_aflags
;
798 static int ett_smb_dialect
;
799 static int ett_smb_dialects
;
800 static int ett_smb_mode
;
801 static int ett_smb_rawmode
;
802 static int ett_smb_flags
;
803 static int ett_smb_flags2
;
804 static int ett_smb_desiredaccess
;
805 static int ett_smb_search
;
806 static int ett_smb_file
;
807 static int ett_smb_openfunction
;
808 static int ett_smb_filetype
;
809 static int ett_smb_openaction
;
810 static int ett_smb_writemode
;
811 static int ett_smb_lock_type
;
812 static int ett_smb_ssetupandxaction
;
813 static int ett_smb_optionsup
;
814 static int ett_smb_time_date
;
815 static int ett_smb_move_copy_flags
;
816 static int ett_smb_file_attributes
;
817 static int ett_smb_search_resume_key
;
818 static int ett_smb_search_dir_info
;
819 static int ett_smb_unlocks
;
820 static int ett_smb_unlock
;
821 static int ett_smb_locks
;
822 static int ett_smb_lock
;
823 static int ett_smb_open_flags
;
824 static int ett_smb_ipc_state
;
825 static int ett_smb_open_action
;
826 static int ett_smb_setup_action
;
827 static int ett_smb_connect_flags
;
828 static int ett_smb_connect_support_bits
;
829 static int ett_smb_nt_access_mask
;
830 static int ett_smb_nt_create_bits
;
831 static int ett_smb_nt_create_options
;
832 static int ett_smb_nt_share_access
;
833 static int ett_smb_nt_security_flags
;
834 static int ett_smb_nt_trans_setup
;
835 static int ett_smb_nt_trans_data
;
836 static int ett_smb_nt_trans_param
;
837 static int ett_smb_nt_notify_completion_filter
;
838 static int ett_smb_nt_ioctl_flags
;
839 static int ett_smb_security_information_mask
;
840 static int ett_smb_print_queue_entry
;
841 static int ett_smb_transaction_flags
;
842 static int ett_smb_transaction_params
;
843 static int ett_smb_find_first2_flags
;
844 static int ett_smb_mac_support_flags
;
846 static int ett_smb_ioflag
;
848 static int ett_smb_transaction_data
;
849 static int ett_smb_stream_info
;
850 static int ett_smb_dfs_referrals
;
851 static int ett_smb_dfs_referral
;
852 static int ett_smb_dfs_referral_flags
;
853 static int ett_smb_dfs_referral_expnames
;
854 static int ett_smb_get_dfs_flags
;
855 static int ett_smb_ff2_data
;
856 static int ett_smb_device_characteristics
;
857 static int ett_smb_fs_attributes
;
858 static int ett_smb_segments
;
859 static int ett_smb_segment
;
860 static int ett_smb_quotaflags
;
861 static int ett_smb_secblob
;
862 static int ett_smb_unicode_password
;
863 static int ett_smb_ea
;
864 static int ett_smb_unix_capabilities
;
865 static int ett_smb_unix_whoami_gids
;
866 static int ett_smb_unix_whoami_sids
;
867 static int ett_smb_posix_ace
;
868 static int ett_smb_posix_ace_perms
;
869 static int ett_smb_info2_file_flags
;
871 static expert_field ei_smb_missing_word_parameters
;
872 static expert_field ei_smb_mal_information_level
;
873 static expert_field ei_smb_not_implemented
;
874 static expert_field ei_smb_nt_transaction_setup
;
875 static expert_field ei_smb_posix_ace_type
;
876 static expert_field ei_smb_info_level_unknown
;
877 static expert_field ei_smb_info_level_not_understood
;
880 static int smb_eo_tap
;
882 static dissector_handle_t smb_handle
;
883 static dissector_handle_t gssapi_handle
;
884 static dissector_handle_t ntlmssp_handle
;
886 static const fragment_items smb_frag_items
= {
892 &hf_smb_segment_overlap
,
893 &hf_smb_segment_overlap_conflict
,
894 &hf_smb_segment_multiple_tails
,
895 &hf_smb_segment_too_long_fragment
,
896 &hf_smb_segment_error
,
897 &hf_smb_segment_count
,
899 &hf_smb_reassembled_length
,
900 /* Reassembled data field */
905 static proto_tree
*top_tree_global
; /* ugly */
907 static int dissect_smb_command(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*smb_tree
, uint8_t cmd
, bool first_pdu
, smb_info_t
*si
);
909 #define SMB_NUM_PROCEDURES 256
910 #define SMB_SRT_TABLE_INDEX 0
911 #define TRANS2_SRT_TABLE_INDEX 1
912 #define NT_SRT_TABLE_INDEX 2
915 smbstat_init(struct register_srt
* srt _U_
, GArray
* srt_array
)
917 srt_stat_table
*smb_srt_table
;
918 srt_stat_table
*trans2_srt_table
;
919 srt_stat_table
*nt_srt_table
;
922 smb_srt_table
= init_srt_table("SMB Commands", NULL
, srt_array
, SMB_NUM_PROCEDURES
, "Commands", "smb.cmd", NULL
);
923 trans2_srt_table
= init_srt_table("Transaction2 Sub-Commands", NULL
, srt_array
, SMB_NUM_PROCEDURES
, "Transaction2 Commands", "smb.trans2.cmd", NULL
);
924 nt_srt_table
= init_srt_table("NT Transaction Sub-Commands", NULL
, srt_array
, SMB_NUM_PROCEDURES
, "NT Transaction Sub-Commands", "smb.nt.function", NULL
);
925 for (i
= 0; i
< SMB_NUM_PROCEDURES
; i
++)
927 init_srt_table_row(smb_srt_table
, i
, val_to_str_ext_const(i
, &smb_cmd_vals_ext
, "<unknown>"));
928 init_srt_table_row(trans2_srt_table
, i
, val_to_str_ext_const(i
, &trans2_cmd_vals_ext
, "<unknown>"));
929 init_srt_table_row(nt_srt_table
, i
, val_to_str_ext_const(i
, &nt_cmd_vals_ext
, "<unknown>"));
933 static tap_packet_status
934 smbstat_packet(void *pss
, packet_info
*pinfo
, epan_dissect_t
*edt _U_
, const void *prv
, tap_flags_t flags _U_
)
937 srt_stat_table
*smb_srt_table
;
938 srt_data_t
*data
= (srt_data_t
*)pss
;
939 const smb_info_t
*si
= (const smb_info_t
*)prv
;
941 /* we are only interested in reply packets */
943 return TAP_PACKET_DONT_REDRAW
;
945 /* if we haven't seen the request, just ignore it */
947 return TAP_PACKET_DONT_REDRAW
;
950 if (si
->cmd
== 0xA0 && si
->sip
->extra_info_type
== SMB_EI_NTI
) {
951 smb_nt_transact_info_t
*sti
= (smb_nt_transact_info_t
*)si
->sip
->extra_info
;
955 i
= NT_SRT_TABLE_INDEX
;
956 smb_srt_table
= g_array_index(data
->srt_array
, srt_stat_table
*, i
);
957 add_srt_table_data(smb_srt_table
, sti
->subcmd
, &si
->sip
->req_time
, pinfo
);
959 } else if (si
->cmd
== 0x32 && si
->sip
->extra_info_type
== SMB_EI_T2I
) {
960 smb_transact2_info_t
*st2i
= (smb_transact2_info_t
*)si
->sip
->extra_info
;
964 i
= TRANS2_SRT_TABLE_INDEX
;
965 smb_srt_table
= g_array_index(data
->srt_array
, srt_stat_table
*, i
);
966 add_srt_table_data(smb_srt_table
, st2i
->subcmd
, &si
->sip
->req_time
, pinfo
);
969 i
= SMB_SRT_TABLE_INDEX
;
970 smb_srt_table
= g_array_index(data
->srt_array
, srt_stat_table
*, i
);
971 add_srt_table_data(smb_srt_table
, si
->cmd
, &si
->sip
->req_time
, pinfo
);
974 return TAP_PACKET_REDRAW
;
979 * Export object functionality
981 /* These flags show what kind of data the object contains
982 (designed to be or'ed) */
983 #define SMB_EO_CONTAINS_NOTHING 0x00
984 #define SMB_EO_CONTAINS_READS 0x01
985 #define SMB_EO_CONTAINS_WRITES 0x02
986 #define SMB_EO_CONTAINS_READSANDWRITES 0x03
988 static const value_string smb_eo_contains_string
[] = {
989 {SMB_EO_CONTAINS_NOTHING
, "" },
990 {SMB_EO_CONTAINS_READS
, "R" },
991 {SMB_EO_CONTAINS_WRITES
, "W" },
992 {SMB_EO_CONTAINS_READSANDWRITES
, "R&W"},
996 /* Strings that describes the SMB object type */
997 static const value_string smb_fid_types
[] = {
998 {SMB_FID_TYPE_UNKNOWN
,"UNKNOWN"},
999 {SMB_FID_TYPE_FILE
,"FILE"},
1000 {SMB_FID_TYPE_DIR
,"DIRECTORY (Not Implemented)"},
1001 {SMB_FID_TYPE_PIPE
,"PIPE (Not Implemented)"},
1005 static const value_string smb2_fid_types
[] = {
1006 {SMB2_FID_TYPE_UNKNOWN
,"UNKNOWN"},
1007 {SMB2_FID_TYPE_FILE
,"FILE"},
1008 {SMB2_FID_TYPE_DIR
,"DIRECTORY (Not Implemented)"},
1009 {SMB2_FID_TYPE_PIPE
,"PIPE (Not Implemented)"},
1010 {SMB2_FID_TYPE_OTHER
,"OTHER (Not Implemented)"},
1015 /* This struct contains the relationship between
1016 the row# in the export_object window and the file being captured;
1017 the row# in this GSList will match the row# in the entry list */
1019 typedef struct _active_file
{
1021 uint32_t fid
; /* 16-bit fid (smb) or 32-bit compressed fid (smb2) */
1022 uint64_t file_length
; /* The last free reported offset. We treat it as the file length */
1023 uint64_t data_gathered
; /* The actual total of data gathered */
1024 uint8_t flag_contains
; /* What kind of data it contains */
1025 GSList
*free_chunk_list
; /* A list of virtual "holes" in the file stream stored in memory */
1026 bool is_out_of_memory
; /* true if we cannot allocate memory for this file */
1029 /* This is the GSList that will contain all the files that we are tracking */
1030 static GSList
*GSL_active_files
;
1032 /* We define a free chunk in a file as an start offset and end offset
1033 Consider a free chunk as a "hole" in a file that we are capturing */
1034 typedef struct _free_chunk
{
1035 uint64_t start_offset
;
1036 uint64_t end_offset
;
1039 /* insert_chunk function will recalculate the free_chunk_list, the data_size,
1040 the end_of_file, and the data_gathered as appropriate.
1041 It will also insert the data chunk that is coming in the right
1042 place of the file in memory.
1044 file->data_gathered contains the real data gathered independently from the file length
1045 file->file_length contains the length of the file in memory, i.e.,
1046 the last offset captured. In most cases, the real
1047 file length would be different.
1050 insert_chunk(active_file
*file
, export_object_entry_t
*entry
, const smb_eo_t
*eo_info
)
1052 int nfreechunks
= g_slist_length(file
->free_chunk_list
);
1054 free_chunk
*current_free_chunk
;
1055 free_chunk
*new_free_chunk
;
1056 uint64_t chunk_offset
= eo_info
->smb_file_offset
;
1057 uint64_t chunk_length
= eo_info
->payload_len
;
1058 uint64_t chunk_end_offset
= chunk_offset
+ chunk_length
-1;
1059 /* Size of file in memory */
1060 uint64_t calculated_size
= chunk_offset
+ chunk_length
;
1061 void * dest_memory_addr
;
1063 /* Let's recalculate the file length and data gathered */
1064 if ((file
->data_gathered
== 0) && (nfreechunks
== 0)) {
1065 /* If this is the first entry for this file, we first create an initial free chunk */
1066 new_free_chunk
= g_new(free_chunk
, 1);
1067 new_free_chunk
->start_offset
= 0;
1068 new_free_chunk
->end_offset
= MAX(file
->file_length
, chunk_end_offset
+1) - 1;
1069 file
->free_chunk_list
= NULL
;
1070 file
->free_chunk_list
= g_slist_append(file
->free_chunk_list
, new_free_chunk
);
1073 if (chunk_end_offset
> file
->file_length
-1) {
1074 new_free_chunk
= g_new(free_chunk
, 1);
1075 new_free_chunk
->start_offset
= file
->file_length
;
1076 new_free_chunk
->end_offset
= chunk_end_offset
;
1077 file
->free_chunk_list
= g_slist_append(file
->free_chunk_list
, new_free_chunk
);
1081 file
->file_length
= MAX(file
->file_length
, chunk_end_offset
+1);
1083 /* Recalculate each free chunk according with the incoming data chunk */
1084 for (i
=0; i
<nfreechunks
; i
++) {
1085 current_free_chunk
= (free_chunk
*)g_slist_nth_data(file
->free_chunk_list
, i
);
1086 /* 1. data chunk before the free chunk? */
1087 /* -> free chunk is not altered and no new data gathered */
1088 if (chunk_end_offset
<current_free_chunk
->start_offset
) {
1091 /* 2. data chunk overlaps the first part of free_chunk */
1092 /* -> free chunk shrinks from the beginning */
1093 if (chunk_offset
<=current_free_chunk
->start_offset
&& chunk_end_offset
>=current_free_chunk
->start_offset
&& chunk_end_offset
<current_free_chunk
->end_offset
) {
1094 file
->data_gathered
+= chunk_end_offset
-current_free_chunk
->start_offset
+1;
1095 current_free_chunk
->start_offset
=chunk_end_offset
+1;
1098 /* 3. data chunk overlaps completely the free chunk */
1099 /* -> free chunk is removed */
1100 if (chunk_offset
<=current_free_chunk
->start_offset
&& chunk_end_offset
>=current_free_chunk
->end_offset
) {
1101 file
->data_gathered
+= current_free_chunk
->end_offset
-current_free_chunk
->start_offset
+1;
1102 file
->free_chunk_list
= g_slist_remove(file
->free_chunk_list
, current_free_chunk
);
1103 g_free(current_free_chunk
);
1105 if (nfreechunks
== 0) { /* The free chunk list is empty */
1106 g_slist_free(file
->free_chunk_list
);
1107 file
->free_chunk_list
= NULL
;
1113 /* 4. data chunk is inside the free chunk */
1114 /* -> free chunk is split into two */
1115 if (chunk_offset
>current_free_chunk
->start_offset
&& chunk_end_offset
<current_free_chunk
->end_offset
) {
1116 new_free_chunk
= g_new(free_chunk
, 1);
1117 new_free_chunk
->start_offset
= chunk_end_offset
+ 1;
1118 new_free_chunk
->end_offset
= current_free_chunk
->end_offset
;
1119 current_free_chunk
->end_offset
= chunk_offset
-1;
1120 file
->free_chunk_list
= g_slist_insert(file
->free_chunk_list
, new_free_chunk
, i
+ 1);
1121 file
->data_gathered
+= chunk_length
;
1124 /* 5.- data chunk overlaps the end part of free chunk */
1125 /* -> free chunk shrinks from the end */
1126 if (chunk_offset
>current_free_chunk
->start_offset
&& chunk_offset
<=current_free_chunk
->end_offset
&& chunk_end_offset
>=current_free_chunk
->end_offset
) {
1127 file
->data_gathered
+= current_free_chunk
->end_offset
-chunk_offset
+1;
1128 current_free_chunk
->end_offset
= chunk_offset
-1;
1131 /* 6.- data chunk is after the free chunk */
1132 /* -> free chunk is not altered and no new data gathered */
1133 if (chunk_offset
>current_free_chunk
->end_offset
) {
1138 /* Now, let's insert the data chunk into memory
1139 ...first, we shall be able to allocate the memory */
1140 if (!entry
->payload_data
) {
1141 /* This is a New file */
1142 if (calculated_size
> UINT32_MAX
) {
1144 * The argument to g_try_malloc() is
1145 * a size_t, however the maximum size of a file
1146 * is 32-bit. If the calculated size is
1147 * bigger than that, we just say the attempt
1148 * to allocate memory failed.
1150 entry
->payload_data
= NULL
;
1152 entry
->payload_data
= (uint8_t *)g_try_malloc((size_t)calculated_size
);
1153 entry
->payload_len
= (size_t)calculated_size
;
1155 if (!entry
->payload_data
) {
1157 file
->is_out_of_memory
= true;
1160 /* This is an existing file in memory */
1161 if (calculated_size
> (uint64_t) entry
->payload_len
&&
1162 !file
->is_out_of_memory
) {
1163 /* We need more memory */
1164 if (calculated_size
> UINT32_MAX
) {
1166 * As for g_try_malloc(), so for
1169 dest_memory_addr
= NULL
;
1171 dest_memory_addr
= g_try_realloc(
1172 entry
->payload_data
,
1173 (size_t)calculated_size
);
1175 if (!dest_memory_addr
) {
1177 file
->is_out_of_memory
= true;
1178 /* We don't have memory for this file.
1179 Free the current file content from memory */
1180 g_free(entry
->payload_data
);
1181 entry
->payload_data
= NULL
;
1182 entry
->payload_len
= 0;
1184 entry
->payload_data
= (uint8_t *)dest_memory_addr
;
1185 entry
->payload_len
= (size_t)calculated_size
;
1189 /* ...then, put the chunk of the file in the right place */
1190 if (!file
->is_out_of_memory
) {
1191 dest_memory_addr
= entry
->payload_data
+ chunk_offset
;
1192 memmove(dest_memory_addr
, eo_info
->payload_data
, eo_info
->payload_len
);
1196 /* We use this function to obtain the index in the GSL of a given file */
1198 find_incoming_file(GSList
*GSL_active_files_p
, active_file
*incoming_file
)
1201 active_file
*in_list_file
;
1204 last
= g_slist_length(GSL_active_files_p
) - 1;
1206 /* We lookup in reverse order because it is more likely that the file
1207 is one of the latest */
1208 for (i
=last
; i
>=0; i
--) {
1209 in_list_file
= (active_file
*)g_slist_nth_data(GSL_active_files_p
, i
);
1210 /* The best-working criteria of two identical files is that the file
1211 that is the same of the file that we are analyzing is the last one
1212 in the list that has the same tid and the same fid */
1213 /* note that we have excluded in_list_file->uid == incoming_file->uid
1214 from the comparison, because a file can be opened by different
1215 SMB users and it is still the same file */
1216 if (in_list_file
->tid
== incoming_file
->tid
&&
1217 in_list_file
->fid
== incoming_file
->fid
) {
1226 static tap_packet_status
1227 smb_eo_packet(void *tapdata
, packet_info
*pinfo
, epan_dissect_t
*edt _U_
, const void *data
, tap_flags_t flags _U_
)
1229 export_object_list_t
*object_list
= (export_object_list_t
*)tapdata
;
1230 const smb_eo_t
*eo_info
= (const smb_eo_t
*)data
;
1232 export_object_entry_t
*entry
;
1233 export_object_entry_t
*current_entry
;
1234 active_file incoming_file
;
1236 active_file
*new_file
;
1237 active_file
*current_file
;
1239 bool is_supported_filetype
;
1242 const char *aux_smb_fid_type_string
;
1244 if (eo_info
->smbversion
==1) {
1245 /* Is this an eo_smb supported file_type? (right now we only support FILE) */
1246 is_supported_filetype
= (eo_info
->fid_type
== SMB_FID_TYPE_FILE
);
1247 aux_smb_fid_type_string
= val_to_str_const(eo_info
->fid_type
, smb_fid_types
, "?");
1249 /* What kind of data this packet contains? */
1250 switch(eo_info
->cmd
) {
1251 case SMB_COM_READ_ANDX
:
1253 contains
= SMB_EO_CONTAINS_READS
;
1255 case SMB_COM_WRITE_ANDX
:
1257 contains
= SMB_EO_CONTAINS_WRITES
;
1260 contains
= SMB_EO_CONTAINS_NOTHING
;
1264 /* Is this an eo_smb supported file_type? (right now we only support FILE) */
1265 is_supported_filetype
= (eo_info
->fid_type
== SMB2_FID_TYPE_FILE
);
1266 aux_smb_fid_type_string
= val_to_str_const(eo_info
->fid_type
, smb2_fid_types
, "?");
1268 /* What kind of data this packet contains? */
1269 switch(eo_info
->cmd
) {
1271 contains
= SMB_EO_CONTAINS_READS
;
1273 case SMB2_COM_WRITE
:
1274 contains
= SMB_EO_CONTAINS_WRITES
;
1277 contains
= SMB_EO_CONTAINS_NOTHING
;
1283 /* Is this data from an already tracked file or not? */
1284 incoming_file
.tid
= eo_info
->tid
;
1285 incoming_file
.uid
= eo_info
->uid
;
1286 incoming_file
.fid
= eo_info
->fid
;
1287 active_row
= find_incoming_file(GSL_active_files
, &incoming_file
);
1289 if (active_row
== -1) { /* This is a new-tracked file */
1290 /* Construct the entry in the list of active files */
1291 entry
= g_new(export_object_entry_t
, 1);
1292 entry
->payload_data
= NULL
;
1293 entry
->payload_len
= 0;
1294 new_file
= g_new(active_file
, 1);
1295 new_file
->tid
= incoming_file
.tid
;
1296 new_file
->uid
= incoming_file
.uid
;
1297 new_file
->fid
= incoming_file
.fid
;
1298 new_file
->file_length
= eo_info
->end_of_file
;
1299 new_file
->flag_contains
= contains
;
1300 new_file
->free_chunk_list
= NULL
;
1301 new_file
->data_gathered
= 0;
1302 new_file
->is_out_of_memory
= false;
1303 entry
->pkt_num
= pinfo
->num
;
1305 entry
->hostname
=g_filename_display_name(eo_info
->hostname
);
1306 entry
->filename
=g_filename_display_name(eo_info
->filename
);
1308 /* Insert the first chunk in the chunk list of this file */
1309 if (is_supported_filetype
) {
1310 insert_chunk(new_file
, entry
, eo_info
);
1313 if (new_file
->is_out_of_memory
) {
1314 entry
->content_type
=
1315 ws_strdup_printf("%s (%"PRIu64
"?/%"PRIu64
") %s [mem!!]",
1316 aux_smb_fid_type_string
,
1317 new_file
->data_gathered
,
1318 new_file
->file_length
,
1319 try_val_to_str(contains
, smb_eo_contains_string
));
1321 if (new_file
->file_length
> 0) {
1322 percent
= (float) (100*new_file
->data_gathered
/new_file
->file_length
);
1327 entry
->content_type
=
1328 ws_strdup_printf("%s (%"PRIu64
"/%"PRIu64
") %s [%5.2f%%]",
1329 aux_smb_fid_type_string
,
1330 new_file
->data_gathered
,
1331 new_file
->file_length
,
1332 try_val_to_str(contains
, smb_eo_contains_string
),
1336 object_list
->add_entry(object_list
->gui_data
, entry
);
1337 GSL_active_files
= g_slist_append(GSL_active_files
, new_file
);
1339 else if (is_supported_filetype
) {
1340 current_file
= (active_file
*)g_slist_nth_data(GSL_active_files
, active_row
);
1341 /* Recalculate the current file flags */
1342 current_file
->flag_contains
= current_file
->flag_contains
|contains
;
1343 current_entry
= object_list
->get_entry(object_list
->gui_data
, active_row
);
1345 insert_chunk(current_file
, current_entry
, eo_info
);
1347 /* Modify the current_entry object_type string */
1348 if (current_file
->is_out_of_memory
) {
1349 current_entry
->content_type
=
1350 ws_strdup_printf("%s (%"PRIu64
"?/%"PRIu64
") %s [mem!!]",
1351 aux_smb_fid_type_string
,
1352 current_file
->data_gathered
,
1353 current_file
->file_length
,
1354 try_val_to_str(current_file
->flag_contains
, smb_eo_contains_string
));
1356 percent
= (float) (100*current_file
->data_gathered
/current_file
->file_length
);
1357 current_entry
->content_type
=
1358 ws_strdup_printf("%s (%"PRIu64
"/%"PRIu64
") %s [%5.2f%%]",
1359 aux_smb_fid_type_string
,
1360 current_file
->data_gathered
,
1361 current_file
->file_length
,
1362 try_val_to_str(current_file
->flag_contains
, smb_eo_contains_string
),
1367 return TAP_PACKET_REDRAW
; /* State changed - window should be redrawn */
1370 /* This is the eo_reset_cb function that is used in the export_object module
1371 to cleanup any previous private data of the export object functionality before perform
1372 the eo_reset function or when the window closes */
1374 smb_eo_cleanup(void)
1377 active_file
*in_list_file
;
1379 /* Free any previous data structures used in previous invocation to the
1380 export_object_smb function */
1381 last
= g_slist_length(GSL_active_files
);
1382 if (GSL_active_files
) {
1383 for (i
=last
-1; i
>=0; i
--) {
1384 in_list_file
= (active_file
*)g_slist_nth_data(GSL_active_files
, i
);
1385 if (in_list_file
->free_chunk_list
) {
1386 g_slist_free(in_list_file
->free_chunk_list
);
1387 in_list_file
->free_chunk_list
= NULL
;
1389 g_free(in_list_file
);
1391 g_slist_free(GSL_active_files
);
1392 GSL_active_files
= NULL
;
1397 * Macros for use in the main dissector routines for an SMB.
1400 #define WORD_COUNT \
1402 wc = tvb_get_uint8(tvb, offset); \
1403 proto_tree_add_uint(tree, hf_smb_word_count, \
1404 tvb, offset, 1, wc); \
1406 if (wc == 0) goto bytecount;
1408 #define BYTE_COUNT \
1410 bc = tvb_get_letohs(tvb, offset); \
1411 proto_tree_add_uint(tree, hf_smb_byte_count, \
1412 tvb, offset, 2, bc); \
1414 if (bc == 0) goto endofcommand;
1416 #define CHECK_BYTE_COUNT(len) \
1417 if (bc < len) goto endofcommand;
1419 #define COUNT_BYTES(len) {\
1426 #define END_OF_SMB \
1429 bc_remaining = tvb_reported_length_remaining(tvb, offset); \
1430 if ( ((int)bc) > bc_remaining) { \
1431 bc = bc_remaining; \
1434 proto_tree_add_item(tree, hf_smb_extra_byte_parameters, tvb, offset, bc, ENC_NA); \
1441 * Macros for use in routines called by them.
1443 #define CHECK_BYTE_COUNT_SUBR(len) \
1449 #define CHECK_STRING_SUBR(fn) \
1455 #define COUNT_BYTES_SUBR(len) \
1460 * Macros for use when dissecting transaction parameters and data
1462 #define CHECK_BYTE_COUNT_TRANS(len) \
1463 if (bc < len) return offset;
1465 #define CHECK_STRING_TRANS(fn) \
1466 if (fn == NULL) return offset;
1468 #define COUNT_BYTES_TRANS(len) \
1473 * Macros for use in subrroutines dissecting transaction parameters or data
1475 #define CHECK_BYTE_COUNT_TRANS_SUBR(len) \
1476 if (*bcp < len) return offset;
1478 #define CHECK_STRING_TRANS_SUBR(fn) \
1479 if (fn == NULL) return offset;
1481 #define COUNT_BYTES_TRANS_SUBR(len) \
1485 bool sid_display_hex
;
1486 bool sid_name_snooping
;
1488 /* ExportObject preferences variable */
1489 bool eosmb_take_name_as_fid
= false ;
1490 /* Utility to get an str representing ipv4 or ipv6 address */
1491 const char *tree_ip_str(packet_info
*pinfo
, uint16_t cmd
) {
1494 if ( cmd
== SMB_COM_READ_ANDX
||
1495 cmd
== SMB_COM_READ
||
1496 cmd
== SMB2_COM_READ
) {
1497 buf
= address_to_str(pinfo
->pool
, &pinfo
->src
);
1499 buf
= address_to_str(pinfo
->pool
, &pinfo
->dst
);
1506 /* ExportObject feed function*/
1508 feed_eo_smb(uint16_t cmd
, uint16_t fid
, tvbuff_t
* tvb
, packet_info
*pinfo
, uint16_t dataoffset
, uint32_t datalen
, uint32_t chunk_len
,
1509 uint64_t file_offset
, smb_info_t
*si
) {
1511 smb_eo_t
*eo_info
; /* eo_info variable to pass info. to
1512 export object and aux */
1513 smb_tid_info_t
*tid_info
= NULL
;
1514 smb_fid_info_t
*fid_info
= NULL
;
1515 smb_fid_info_t
*suspect_fid_info
= NULL
;
1517 GSList
*GSL_iterator
;
1519 /* Create a new tvb to point to the payload data */
1520 data_tvb
= tvb_new_subset_length(tvb
, dataoffset
, datalen
);
1521 /* Create the eo_info to pass to the listener */
1522 eo_info
= wmem_new(pinfo
->pool
, smb_eo_t
);
1524 /* Try to get fid_info and tid_info */
1525 if (fid_info
== NULL
) {
1526 GSL_iterator
= si
->ct
->GSL_fid_info
;
1527 while (GSL_iterator
) {
1528 suspect_fid_info
= (smb_fid_info_t
*)GSL_iterator
->data
;
1529 if (suspect_fid_info
->opened_in
> pinfo
->num
) break;
1530 if ((suspect_fid_info
->tid
== si
->tid
) && (suspect_fid_info
->fid
== fid
))
1531 fid_info
= suspect_fid_info
;
1532 GSL_iterator
= g_slist_next(GSL_iterator
);
1537 tid_info
= (smb_tid_info_t
*)wmem_tree_lookup32(si
->ct
->tid_tree
, si
->tid
);
1539 /* Construct the eo_info structure */
1540 eo_info
->smbversion
= 1;
1542 if (tid_info
->filename
) {
1543 eo_info
->hostname
= tid_info
->filename
;
1545 eo_info
->hostname
= wmem_strdup_printf(pinfo
->pool
, "\\\\%s\\TREEID_UNKNOWN", tree_ip_str(pinfo
, cmd
));
1548 else eo_info
->hostname
= wmem_strdup_printf(pinfo
->pool
, "\\\\%s\\TREEID_%i", tree_ip_str(pinfo
, cmd
), si
->tid
);
1550 eo_info
->filename
= NULL
;
1552 if (fid_info
->fsi
->filename
)
1553 eo_info
->filename
= (char *) fid_info
->fsi
->filename
;
1554 if (!eo_info
->filename
) eo_info
->filename
= wmem_strdup_printf(pinfo
->pool
, "\\FILEID_%i", fid
);
1555 eo_info
->fid_type
= fid_info
->type
;
1556 eo_info
->end_of_file
= fid_info
->end_of_file
;
1558 eo_info
->fid_type
= SMB_FID_TYPE_UNKNOWN
;
1559 eo_info
->filename
= wmem_strdup_printf(pinfo
->pool
, "\\FILEID_%i", fid
);
1560 eo_info
->end_of_file
= 0;
1562 if (eosmb_take_name_as_fid
) {
1563 eo_info
->fid
= g_str_hash(eo_info
->filename
);
1567 eo_info
->tid
= si
->tid
;
1568 eo_info
->uid
= si
->uid
;
1569 eo_info
->payload_len
= datalen
;
1570 eo_info
->payload_data
= tvb_get_ptr(data_tvb
, 0, datalen
);
1571 eo_info
->smb_file_offset
= file_offset
;
1572 eo_info
->smb_chunk_len
= chunk_len
;
1574 /* Queue data to the listener */
1576 tap_queue_packet(smb_eo_tap
, pinfo
, eo_info
);
1579 /* Compare function to maintain the GSL_fid_info ordered
1580 Order criteria: packet where the fid was opened */
1582 fid_cmp(smb_fid_info_t
*fida
, smb_fid_info_t
*fidb
)
1584 return (fida
->opened_in
- fidb
->opened_in
);
1587 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1588 These are needed by the reassembly of SMB Transaction payload and DCERPC over SMB
1589 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
1590 static bool smb_trans_reassembly
= true;
1591 bool smb_dcerpc_reassembly
= true;
1593 static reassembly_table smb_trans_reassembly_table
;
1595 static fragment_head
*
1596 smb_trans_defragment(proto_tree
*tree _U_
, packet_info
*pinfo
, tvbuff_t
*tvb
,
1597 int offset
, unsigned count
, unsigned pos
, unsigned totlen
, smb_info_t
*si
)
1599 fragment_head
*fd_head
= NULL
;
1602 /* Don't pass the reassembly code data that doesn't exist */
1603 /* Fail if some or all of the fragment is located beyond the total length */
1604 if ( !tvb_bytes_exist(tvb
, offset
, count
) || (pos
> totlen
) || (count
> totlen
) || ((pos
+ count
) > totlen
)) {
1605 THROW(ReportedBoundsError
);
1608 more_frags
= totlen
> (pos
+ count
);
1610 DISSECTOR_ASSERT(si
);
1612 if (si
->sip
== NULL
) {
1614 * We don't have the frame number of the request.
1619 if (!pinfo
->fd
->visited
) {
1620 fd_head
= fragment_add(&smb_trans_reassembly_table
, tvb
, offset
,
1621 pinfo
, si
->sip
->frame_req
, NULL
,
1622 pos
, count
, more_frags
);
1624 fd_head
= fragment_get(&smb_trans_reassembly_table
,
1625 pinfo
, si
->sip
->frame_req
, NULL
);
1628 if (!fd_head
|| !(fd_head
->flags
& FD_DEFRAGMENTED
)) {
1629 /* This is continued - mark it as such, so we recognize
1630 continuation responses.
1632 si
->sip
->flags
|= SMB_SIF_IS_CONTINUED
;
1634 /* We've finished reassembling, so there are no more
1635 continuation responses.
1637 si
->sip
->flags
&= ~SMB_SIF_IS_CONTINUED
;
1640 /* we only show the defragmented packet for the first fragment,
1641 or else we might end up with dissecting one HUGE transaction PDU
1642 a LOT of times. (first fragment is the only one containing the setup
1644 I have seen ONE Transaction PDU that is ~60kb, spanning many Transaction
1645 SMBs. Takes a LOT of time dissecting and is not fun.
1647 if ( (pos
== 0) && fd_head
&& (fd_head
->flags
& FD_DEFRAGMENTED
)) {
1658 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1659 These variables and functions are used to match
1660 responses with calls
1661 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
1663 * The information we need to save about a request in order to show the
1664 * frame number of the request in the dissection of the reply.
1669 } smb_saved_info_key_t
;
1671 /* unmatched smb_saved_info structures.
1672 For unmatched smb_saved_info structures we store the smb_saved_info
1673 structure using the MID and the PID as the key.
1675 Oh, yes, the key is really a pointer, but we use it as if it was an integer.
1676 Ugly, yes. Not portable to DEC-20 Yes. But it saves a few bytes.
1677 The key is the PID in the upper 16 bits and the MID in the lower 16 bits.
1680 smb_saved_info_equal_unmatched(const void *k1
, const void *k2
)
1682 register uint32_t key1
= GPOINTER_TO_UINT(k1
);
1683 register uint32_t key2
= GPOINTER_TO_UINT(k2
);
1684 return key1
== key2
;
1687 smb_saved_info_hash_unmatched(const void *k
)
1689 register uint32_t key
= GPOINTER_TO_UINT(k
);
1693 /* matched smb_saved_info structures.
1694 For matched smb_saved_info structures we store the smb_saved_info
1695 structure twice in the table using the frame number, and a combination
1696 of the MID and the PID, as the key.
1697 The frame number is guaranteed to be unique but if ever someone makes
1698 some change that will renumber the frames in a capture we are in BIG trouble.
1699 This is not likely though since that would break (among other things) all the
1700 reassembly routines as well.
1702 We also need the MID as there may be more than one SMB request or reply
1703 in a single frame, and we also need the PID as there may be more than
1704 one outstanding request with the same MID and different PIDs.
1707 smb_saved_info_equal_matched(const void *k1
, const void *k2
)
1709 const smb_saved_info_key_t
*key1
= (const smb_saved_info_key_t
*)k1
;
1710 const smb_saved_info_key_t
*key2
= (const smb_saved_info_key_t
*)k2
;
1711 return (key1
->frame
== key2
->frame
) && (key1
->pid_mid
== key2
->pid_mid
);
1714 smb_saved_info_hash_matched(const void *k
)
1716 const smb_saved_info_key_t
*key
= (const smb_saved_info_key_t
*)k
;
1717 return key
->frame
+ key
->pid_mid
;
1720 static GSList
*conv_tables
;
1723 smb_find_unicode_null_offset(tvbuff_t
*tvb
, int offset
, const int maxlength
, const uint16_t needle
, const unsigned encoding
)
1725 unsigned captured_length
= tvb_captured_length(tvb
);
1726 if (G_LIKELY((unsigned) offset
> captured_length
)) {
1730 unsigned limit
= captured_length
- offset
;
1732 /* Only search to end of tvbuff, w/o throwing exception. */
1733 if (maxlength
>= 0 && limit
> (unsigned) maxlength
) {
1734 /* Maximum length doesn't go past end of tvbuff; search
1736 limit
= (unsigned) maxlength
;
1742 if (needle
== tvb_get_uint16(tvb
, offset
, encoding
)){
1751 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1752 End of request/response matching functions
1753 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
1755 /* Turn a little-endian Unicode '\0'-terminated string into a string we
1757 If exactlen==true then us_lenp contains the exact len of the string in
1758 bytes. It might not be null terminated !
1759 bc specifies the number of bytes in the byte parameters; Windows 2000,
1760 at least, appears, in some cases, to put only 1 byte of 0 at the end
1761 of a Unicode string if the byte count
1764 unicode_to_str(wmem_allocator_t
*scope
, tvbuff_t
*tvb
, int offset
, int *us_lenp
, bool exactlen
,
1769 return tvb_get_string_enc(scope
, tvb
, offset
, *us_lenp
, ENC_UTF_16
|ENC_LITTLE_ENDIAN
);
1771 /* Handle the odd cases where Windows 2000 has a Unicode
1772 * string followed by a single NUL byte when the string
1773 * takes up the entire byte count.
1775 len
= smb_find_unicode_null_offset(tvb
, offset
, bc
, 0, ENC_LITTLE_ENDIAN
);
1777 if (bc
% 2 == 1 && tvb_get_uint8(tvb
, offset
+ bc
- 1) == 0) {
1779 return tvb_get_string_enc(scope
, tvb
, offset
, bc
- 1, ENC_UTF_16
|ENC_LITTLE_ENDIAN
);
1782 return tvb_get_stringz_enc(scope
, tvb
, offset
, us_lenp
, ENC_UTF_16
|ENC_LITTLE_ENDIAN
);
1786 /* nopad == true : Do not add any padding before this string
1787 * exactlen == true : len contains the exact len of the string in bytes.
1788 * bc: pointer to variable with amount of data left in the byte parameters
1792 get_unicode_or_ascii_string(wmem_allocator_t
*scope
, tvbuff_t
*tvb
, int *offsetp
,
1793 bool useunicode
, int *len
, bool nopad
, bool exactlen
,
1801 /* Not enough data in buffer */
1806 if ((!nopad
) && (*offsetp
% 2)) {
1807 (*offsetp
)++; /* Looks like a pad byte there sometimes */
1811 /* Not enough data in buffer */
1818 if (string_len
< 0) {
1819 /* This probably means it's a very large unsigned number; just set
1820 it to the largest signed number, so that we throw the appropriate
1822 string_len
= INT_MAX
;
1823 } else if (string_len
> *bcp
){
1828 string
= unicode_to_str(scope
, tvb
, *offsetp
, &string_len
, exactlen
, *bcp
);
1830 /* XXX: Use the local OEM (extended ASCII DOS) code page.
1831 * On US English machines that means ENC_CP437, but it
1832 * could be CP850 (which contains the characters of
1833 * ISO-8859-1, arranged differently), CP866, etc.
1834 * Using ENC_ASCII is safest.
1836 * There could be a preference for local code page.
1837 * (The same should apply in packet-smb-browser.c too)
1843 /* This probably means it's a very large unsigned number; just set
1844 it to the largest signed number, so that we throw the appropriate
1849 return tvb_get_string_enc(scope
, tvb
, *offsetp
, copylen
, ENC_ASCII
);
1851 return tvb_get_stringz_enc(scope
, tvb
, *offsetp
, len
, ENC_ASCII
);
1859 typedef struct _smb_uid_t
{
1867 smb_file_specific_rights(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, uint32_t mask
)
1869 static int * const mask_flags
[] = {
1870 &hf_smb_file_access_mask_write_attribute
,
1871 &hf_smb_file_access_mask_read_attribute
,
1872 &hf_smb_file_access_mask_execute
,
1873 &hf_smb_file_access_mask_write_ea
,
1874 &hf_smb_file_access_mask_read_ea
,
1875 &hf_smb_file_access_mask_append_data
,
1876 &hf_smb_file_access_mask_write_data
,
1877 &hf_smb_file_access_mask_read_data
,
1882 if (mask
== 0x000001ff) {
1883 proto_tree_add_uint(tree
, hf_smb_file_access_mask_full_control
, tvb
, offset
, 4, mask
);
1886 proto_tree_add_bitmask_list_value(tree
, tvb
, offset
, 4, mask_flags
, mask
);
1888 static struct access_mask_info smb_file_access_mask_info
= {
1889 "FILE", /* Name of specific rights */
1890 smb_file_specific_rights
, /* Dissection function */
1891 NULL
, /* Generic mapping table */
1892 NULL
/* Standard mapping table */
1897 smb_dir_specific_rights(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, uint32_t mask
)
1899 static int * const mask_flags
[] = {
1900 &hf_smb_dir_access_mask_write_attribute
,
1901 &hf_smb_dir_access_mask_read_attribute
,
1902 &hf_smb_dir_access_mask_delete_child
,
1903 &hf_smb_dir_access_mask_traverse
,
1904 &hf_smb_dir_access_mask_write_ea
,
1905 &hf_smb_dir_access_mask_read_ea
,
1906 &hf_smb_dir_access_mask_add_subdir
,
1907 &hf_smb_dir_access_mask_add_file
,
1908 &hf_smb_dir_access_mask_list
,
1913 if (mask
== 0x000001ff) {
1914 proto_tree_add_uint(tree
, hf_smb_dir_access_mask_full_control
, tvb
, offset
, 4, mask
);
1917 proto_tree_add_bitmask_list_value(tree
, tvb
, offset
, 4, mask_flags
, mask
);
1919 static struct access_mask_info smb_dir_access_mask_info
= {
1920 "DIR", /* Name of specific rights */
1921 smb_dir_specific_rights
, /* Dissection function */
1922 NULL
, /* Generic mapping table */
1923 NULL
/* Standard mapping table */
1928 static const value_string buffer_format_vals
[] = {
1933 {5, "Variable Block"},
1937 #define POSIX_ACE_TYPE_USER_OBJ 0x01
1938 #define POSIX_ACE_TYPE_USER 0x02
1939 #define POSIX_ACE_TYPE_GROUP_OBJ 0x04
1940 #define POSIX_ACE_TYPE_GROUP 0x08
1941 #define POSIX_ACE_TYPE_MASK 0x10
1942 #define POSIX_ACE_TYPE_OTHER 0x20
1943 static const value_string ace_type_vals
[] = {
1944 {POSIX_ACE_TYPE_USER_OBJ
, "User Obj"},
1945 {POSIX_ACE_TYPE_USER
, "User"},
1946 {POSIX_ACE_TYPE_GROUP_OBJ
, "Group Obj"},
1947 {POSIX_ACE_TYPE_GROUP
, "Group"},
1948 {POSIX_ACE_TYPE_MASK
, "Mask"},
1949 {POSIX_ACE_TYPE_OTHER
, "Other"},
1954 * UTIME - this is *almost* like a UNIX time stamp, except that it's
1955 * in seconds since January 1, 1970, 00:00:00 *local* time, not since
1956 * January 1, 1970, 00:00:00 GMT.
1958 * This means we have to do some extra work to convert it. This code is
1959 * based on the Samba code:
1961 * Unix SMB/Netbios implementation.
1963 * time handling functions
1964 * Copyright (C) Andrew Tridgell 1992-1998
1968 * Yield the difference between *A and *B, in seconds, ignoring leap
1971 #define TM_YEAR_BASE 1900
1974 tm_diff(struct tm
*a
, struct tm
*b
)
1976 int ay
= a
->tm_year
+ (TM_YEAR_BASE
- 1);
1977 int by
= b
->tm_year
+ (TM_YEAR_BASE
- 1);
1978 int intervening_leap_days
=
1979 (ay
/4 - by
/4) - (ay
/100 - by
/100) + (ay
/400 - by
/400);
1980 int years
= ay
- by
;
1982 365*years
+ intervening_leap_days
+ (a
->tm_yday
- b
->tm_yday
);
1983 int hours
= 24*days
+ (a
->tm_hour
- b
->tm_hour
);
1984 int minutes
= 60*hours
+ (a
->tm_min
- b
->tm_min
);
1985 int seconds
= 60*minutes
+ (a
->tm_sec
- b
->tm_sec
);
1991 * Return the UTC offset in seconds west of UTC, or 0 if it cannot be
1997 struct tm
*tm
= gmtime(&t
);
2006 return tm_diff(&tm_utc
, tm
);
2010 * Return the same value as TimeZone, but it should be more efficient.
2012 * We keep a table of DST offsets to prevent calling localtime() on each
2013 * call of this function. This saves a LOT of time on many unixes.
2015 * Updated by Paul Eggert <eggert@twinsun.com>
2022 #define TIME_T_MIN ((time_t) ((time_t)0 < (time_t) -1 ? (time_t) 0 \
2023 : ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1)))
2026 #define TIME_T_MAX ((time_t) (~ (time_t) 0 - TIME_T_MIN))
2030 TimeZoneFaster(time_t t
)
2032 static struct dst_table
{time_t start
, end
; int zone
;} *tdt
;
2033 static struct dst_table
*dst_table
= NULL
;
2034 static int table_size
= 0;
2041 /* Tunis has a 8 day DST region, we need to be careful ... */
2042 #define MAX_DST_WIDTH (365*24*60*60)
2043 #define MAX_DST_SKIP (7*24*60*60)
2045 for (i
= 0; i
< table_size
; i
++) {
2046 if ((t
>= dst_table
[i
].start
) && (t
<= dst_table
[i
].end
))
2050 if (i
< table_size
) {
2051 zone
= dst_table
[i
].zone
;
2056 if (dst_table
== NULL
)
2057 tdt
= (struct dst_table
*)g_malloc(sizeof(dst_table
[0])*(i
+1));
2059 tdt
= (struct dst_table
*)g_realloc(dst_table
, sizeof(dst_table
[0])*(i
+1));
2067 dst_table
[i
].zone
= zone
;
2068 dst_table
[i
].start
= dst_table
[i
].end
= t
;
2070 /* no entry will cover more than 6 months */
2071 low
= t
- MAX_DST_WIDTH
/2;
2072 /* XXX - what if t < MAX_DST_WIDTH/2? */
2074 high
= t
+ MAX_DST_WIDTH
/2;
2075 /* XXX - what if this overflows? */
2078 * Widen the new entry using two bisection searches.
2080 while (low
+60*60 < dst_table
[i
].start
) {
2081 if (dst_table
[i
].start
- low
> MAX_DST_SKIP
*2)
2082 t
= dst_table
[i
].start
- MAX_DST_SKIP
;
2084 t
= low
+ (dst_table
[i
].start
-low
)/2;
2085 if (TimeZone(t
) == zone
)
2086 dst_table
[i
].start
= t
;
2091 while (high
-60*60 > dst_table
[i
].end
) {
2092 if (high
- dst_table
[i
].end
> MAX_DST_SKIP
*2)
2093 t
= dst_table
[i
].end
+ MAX_DST_SKIP
;
2095 t
= high
- (high
-dst_table
[i
].end
)/2;
2096 if (TimeZone(t
) == zone
)
2097 dst_table
[i
].end
= t
;
2107 * Return the UTC offset in seconds west of UTC, adjusted for extra time
2108 * offset, for a local time value. If ut = lt + LocTimeDiff(lt), then
2109 * lt = ut - TimeDiff(ut), but the converse does not necessarily hold near
2110 * daylight savings transitions because some local times are ambiguous.
2111 * LocTimeDiff(t) equals TimeDiff(t) except near daylight savings transitions.
2114 LocTimeDiff(time_t lt
)
2116 int d
= TimeZoneFaster(lt
);
2119 /* if overflow occurred, ignore all the adjustments so far */
2120 if (((t
< lt
) ^ (d
< 0)))
2124 * Now t should be close enough to the true UTC to yield the
2127 return TimeZoneFaster(t
);
2131 dissect_smb_UTIME(tvbuff_t
*tvb
, proto_tree
*tree
, int offset
, int hf_date
)
2136 ts
.secs
= timeval
= tvb_get_letohl(tvb
, offset
);
2138 if (timeval
== 0xffffffff) {
2139 proto_tree_add_time_format_value(tree
, hf_date
, tvb
, offset
, 4, &ts
,
2140 "No time specified (0xffffffff)");
2146 * We add the local time offset.
2148 ts
.secs
= timeval
+ LocTimeDiff(timeval
);
2150 proto_tree_add_time(tree
, hf_date
, tvb
, offset
, 4, &ts
);
2157 dissect_smb_datetime(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
,
2158 int hf_date
, int hf_dos_date
, int hf_dos_time
, bool time_first
)
2160 uint16_t dos_time
, dos_date
;
2161 proto_item
*item
= NULL
;
2162 proto_tree
*tree
= NULL
;
2167 static const int mday_noleap
[12] = {
2168 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
2170 static const int mday_leap
[12] = {
2171 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
2174 #define ISLEAP(y) ((((y) % 4) == 0) && ((((y) % 100) != 0) || (((y) % 400) == 0)))
2177 dos_time
= tvb_get_letohs(tvb
, offset
);
2178 dos_date
= tvb_get_letohs(tvb
, offset
+2);
2180 dos_date
= tvb_get_letohs(tvb
, offset
);
2181 dos_time
= tvb_get_letohs(tvb
, offset
+2);
2184 if (((dos_date
== 0xffff) && (dos_time
== 0xffff)) ||
2185 ((dos_date
== 0) && (dos_time
== 0))) {
2187 * No date/time specified.
2192 proto_tree_add_time_format_value(parent_tree
, hf_date
, tvb
, offset
, 4,
2193 &tv
, "No time specified (0x%08x)",
2194 ((dos_date
<< 16) | dos_time
));
2200 tm
.tm_sec
= (dos_time
& 0x1f) * 2;
2201 tm
.tm_min
= (dos_time
>>5) & 0x3f;
2202 tm
.tm_hour
= (dos_time
>>11) & 0x1f;
2203 tm
.tm_mday
= dos_date
& 0x1f;
2204 tm
.tm_mon
= ((dos_date
>>5) & 0x0f) - 1;
2205 tm
.tm_year
= ((dos_date
>>9) & 0x7f) + 1980 - 1900;
2209 * Do some sanity checks before calling "mktime()";
2210 * "mktime()" doesn't do them, it "normalizes" out-of-range
2213 if ((tm
.tm_sec
> 59) || (tm
.tm_min
> 59) || (tm
.tm_hour
> 23) ||
2214 (tm
.tm_mon
< 0) || (tm
.tm_mon
> 11) ||
2215 (ISLEAP(tm
.tm_year
+ 1900) ?
2216 (tm
.tm_mday
> mday_leap
[tm
.tm_mon
]) :
2217 (tm
.tm_mday
> mday_noleap
[tm
.tm_mon
])) ||
2218 ((t
= mktime(&tm
)) == -1)) {
2220 * Invalid date/time.
2225 item
= proto_tree_add_time_format_value(parent_tree
, hf_date
, tvb
, offset
, 4,
2226 &tv
, "Invalid time (0x%08x)", ((dos_date
<< 16) | dos_time
));
2227 tree
= proto_item_add_subtree(item
, ett_smb_time_date
);
2229 proto_tree_add_uint_format(tree
, hf_dos_time
, tvb
, offset
, 2, dos_time
, "DOS Time: %02d:%02d:%02d (0x%04x)", tm
.tm_hour
, tm
.tm_min
, tm
.tm_sec
, dos_time
);
2230 proto_tree_add_uint_format(tree
, hf_dos_date
, tvb
, offset
+2, 2, dos_date
, "DOS Date: %04d-%02d-%02d (0x%04x)", tm
.tm_year
+ 1900, tm
.tm_mon
+ 1, tm
.tm_mday
, dos_date
);
2232 proto_tree_add_uint_format(tree
, hf_dos_date
, tvb
, offset
, 2, dos_date
, "DOS Date: %04d-%02d-%02d (0x%04x)", tm
.tm_year
+ 1900, tm
.tm_mon
+ 1, tm
.tm_mday
, dos_date
);
2233 proto_tree_add_uint_format(tree
, hf_dos_time
, tvb
, offset
+2, 2, dos_time
, "DOS Time: %02d:%02d:%02d (0x%04x)", tm
.tm_hour
, tm
.tm_min
, tm
.tm_sec
, dos_time
);
2244 item
= proto_tree_add_time(parent_tree
, hf_date
, tvb
, offset
, 4, &tv
);
2245 tree
= proto_item_add_subtree(item
, ett_smb_time_date
);
2247 proto_tree_add_uint_format(tree
, hf_dos_time
, tvb
, offset
, 2, dos_time
, "DOS Time: %02d:%02d:%02d (0x%04x)", tm
.tm_hour
, tm
.tm_min
, tm
.tm_sec
, dos_time
);
2248 proto_tree_add_uint_format(tree
, hf_dos_date
, tvb
, offset
+2, 2, dos_date
, "DOS Date: %04d-%02d-%02d (0x%04x)", tm
.tm_year
+ 1900, tm
.tm_mon
+ 1, tm
.tm_mday
, dos_date
);
2250 proto_tree_add_uint_format(tree
, hf_dos_date
, tvb
, offset
, 2, dos_date
, "DOS Date: %04d-%02d-%02d (0x%04x)", tm
.tm_year
+ 1900, tm
.tm_mon
+ 1, tm
.tm_mday
, dos_date
);
2251 proto_tree_add_uint_format(tree
, hf_dos_time
, tvb
, offset
+2, 2, dos_time
, "DOS Time: %02d:%02d:%02d (0x%04x)", tm
.tm_hour
, tm
.tm_min
, tm
.tm_sec
, dos_time
);
2260 static const true_false_string tfs_disposition_delete_on_close
= {
2261 "DELETE this file when closed",
2262 "Normal access, do not delete on close"
2265 static const true_false_string tfs_pipe_info_flag
= {
2266 "SET NAMED PIPE mode",
2267 "Clear NAMED PIPE mode"
2271 static const value_string da_access_vals
[] = {
2272 { 0, "Open for reading"},
2273 { 1, "Open for writing"},
2274 { 2, "Open for reading and writing"},
2275 { 3, "Open for execute"},
2278 static const value_string da_sharing_vals
[] = {
2279 { 0, "Compatibility mode"},
2280 { 1, "Deny read/write/execute (exclusive)"},
2282 { 3, "Deny read/execute"},
2286 static const value_string da_locality_vals
[] = {
2287 { 0, "Locality of reference unknown"},
2288 { 1, "Mainly sequential access"},
2289 { 2, "Mainly random access"},
2290 { 3, "Random access with some locality"},
2293 static const true_false_string tfs_da_caching
= {
2294 "Do not cache this file",
2295 "Caching permitted on this file"
2297 static const true_false_string tfs_da_writetru
= {
2298 "Write through enabled",
2299 "Write through disabled"
2302 dissect_access(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, int hf_access
)
2304 static int * const flags
[] = {
2305 &hf_smb_access_writetru
,
2306 &hf_smb_access_caching
,
2307 &hf_smb_access_locality
,
2308 &hf_smb_access_sharing
,
2309 &hf_smb_access_mode
,
2313 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_access
, ett_smb_desiredaccess
, flags
, ENC_LITTLE_ENDIAN
);
2319 #define SMB_FILE_ATTRIBUTE_READ_ONLY 0x00000001
2320 #define SMB_FILE_ATTRIBUTE_HIDDEN 0x00000002
2321 #define SMB_FILE_ATTRIBUTE_SYSTEM 0x00000004
2322 #define SMB_FILE_ATTRIBUTE_VOLUME 0x00000008
2323 #define SMB_FILE_ATTRIBUTE_DIRECTORY 0x00000010
2324 #define SMB_FILE_ATTRIBUTE_ARCHIVE 0x00000020
2325 #define SMB_FILE_ATTRIBUTE_DEVICE 0x00000040
2326 #define SMB_FILE_ATTRIBUTE_NORMAL 0x00000080
2327 #define SMB_FILE_ATTRIBUTE_TEMPORARY 0x00000100
2328 #define SMB_FILE_ATTRIBUTE_SPARSE 0x00000200
2329 #define SMB_FILE_ATTRIBUTE_REPARSE 0x00000400
2330 #define SMB_FILE_ATTRIBUTE_COMPRESSED 0x00000800
2331 #define SMB_FILE_ATTRIBUTE_OFFLINE 0x00001000
2332 #define SMB_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
2333 #define SMB_FILE_ATTRIBUTE_ENCRYPTED 0x00004000
2335 static const true_false_string tfs_file_attribute_read_only
= {
2339 static const true_false_string tfs_file_attribute_hidden
= {
2343 static const true_false_string tfs_file_attribute_system
= {
2345 "NOT a system file/dir"
2347 static const true_false_string tfs_file_attribute_volume
= {
2351 static const true_false_string tfs_file_attribute_directory
= {
2355 static const true_false_string tfs_file_attribute_archive
= {
2356 "Modified since last ARCHIVE",
2357 "Has NOT been modified since last archive"
2359 static const true_false_string tfs_file_attribute_device
= {
2363 static const true_false_string tfs_file_attribute_normal
= {
2364 "An ordinary file/dir",
2365 "Has some attribute set"
2367 static const true_false_string tfs_file_attribute_temporary
= {
2369 "NOT a temporary file"
2371 static const true_false_string tfs_file_attribute_sparse
= {
2375 static const true_false_string tfs_file_attribute_reparse
= {
2376 "Has an associated REPARSE POINT",
2377 "Does NOT have an associated reparse point"
2379 static const true_false_string tfs_file_attribute_compressed
= {
2383 static const true_false_string tfs_file_attribute_offline
= {
2387 static const true_false_string tfs_file_attribute_not_content_indexed
= {
2389 "NOT content indexed"
2391 static const true_false_string tfs_file_attribute_encrypted
= {
2392 "This is an ENCRYPTED file",
2393 "This is NOT an encrypted file"
2397 * Dissects an SMB_FILE_ATTRIBUTES, to use the term given to it by
2398 * section 2.2.1.2.4 of [MS-CIFS], in cases where it's just file attributes,
2399 * not search attributes.
2402 dissect_file_attributes(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
2404 static int * const flags
[] = {
2405 &hf_smb_file_attr_archive_16bit
,
2406 &hf_smb_file_attr_directory_16bit
,
2407 &hf_smb_file_attr_volume_16bit
,
2408 &hf_smb_file_attr_system_16bit
,
2409 &hf_smb_file_attr_hidden_16bit
,
2410 &hf_smb_file_attr_read_only_16bit
,
2414 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_file_attr_16bit
, ett_smb_file_attributes
, flags
, ENC_LITTLE_ENDIAN
);
2421 * 3.11 in the SNIA CIFS spec
2422 * SMB_EXT_FILE_ATTR, section 2.2.1.2.3 in the [MS-CIFS] spec
2425 dissect_file_ext_attr_bits(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
,
2426 int len
, uint32_t mask
)
2430 * XXX - Network Monitor disagrees on some of the
2431 * bits, e.g. the bits above temporary are "atomic write"
2432 * and "transaction write", and it says nothing about the
2435 * Does the Win32 API documentation, or the NT Native API book,
2438 static int * const mask_fields
[] = {
2439 &hf_smb_file_eattr_read_only
,
2440 &hf_smb_file_eattr_hidden
,
2441 &hf_smb_file_eattr_system
,
2442 &hf_smb_file_eattr_volume
,
2443 &hf_smb_file_eattr_directory
,
2444 &hf_smb_file_eattr_archive
,
2445 &hf_smb_file_eattr_device
,
2446 &hf_smb_file_eattr_normal
,
2447 &hf_smb_file_eattr_temporary
,
2448 &hf_smb_file_eattr_sparse
,
2449 &hf_smb_file_eattr_reparse
,
2450 &hf_smb_file_eattr_compressed
,
2451 &hf_smb_file_eattr_offline
,
2452 &hf_smb_file_eattr_not_content_indexed
,
2453 &hf_smb_file_eattr_encrypted
,
2457 item
= proto_tree_add_bitmask_value_with_flags(parent_tree
, tvb
, offset
,
2458 hf_smb_file_eattr
, ett_smb_file_attributes
, mask_fields
, mask
, BMT_NO_APPEND
);
2460 proto_item_set_generated(item
);
2469 dissect_file_ext_attr(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
2473 mask
= tvb_get_letohl(tvb
, offset
);
2475 offset
= dissect_file_ext_attr_bits(tvb
, parent_tree
, offset
, 4, mask
);
2481 dissect_dir_info_file_attributes(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
2483 static int * const flags
[] = {
2484 &hf_smb_file_attr_read_only_8bit
,
2485 &hf_smb_file_attr_hidden_8bit
,
2486 &hf_smb_file_attr_system_8bit
,
2487 &hf_smb_file_attr_volume_8bit
,
2488 &hf_smb_file_attr_directory_8bit
,
2489 &hf_smb_file_attr_archive_8bit
,
2493 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_file_attr_8bit
, ett_smb_file_attributes
, flags
, ENC_NA
);
2499 static const true_false_string tfs_search_attribute_read_only
= {
2500 "Include READ ONLY files in search results",
2501 "Do NOT include read only files in search results",
2503 static const true_false_string tfs_search_attribute_hidden
= {
2504 "Include HIDDEN files in search results",
2505 "Do NOT include hidden files in search results"
2507 static const true_false_string tfs_search_attribute_system
= {
2508 "Include SYSTEM files in search results",
2509 "Do NOT include system files in search results"
2511 static const true_false_string tfs_search_attribute_volume
= {
2512 "Include VOLUME IDs in search results",
2513 "Do NOT include volume IDs in search results"
2515 static const true_false_string tfs_search_attribute_directory
= {
2516 "Include DIRECTORIES in search results",
2517 "Do NOT include directories in search results"
2519 static const true_false_string tfs_search_attribute_archive
= {
2520 "Include ARCHIVE files in search results",
2521 "Do NOT include archive files in search results"
2525 * Dissects an SMB_FILE_ATTRIBUTES, to use the term given to it by
2526 * section 2.2.1.2.4 of [MS-CIFS], in cases where it's search attributes.
2529 dissect_search_attributes(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
2531 static int * const flags
[] = {
2532 &hf_smb_search_attribute_read_only
,
2533 &hf_smb_search_attribute_hidden
,
2534 &hf_smb_search_attribute_system
,
2535 &hf_smb_search_attribute_volume
,
2536 &hf_smb_search_attribute_directory
,
2537 &hf_smb_search_attribute_archive
,
2541 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_search_attribute
, ett_smb_search
, flags
, ENC_LITTLE_ENDIAN
);
2549 * XXX - this isn't used.
2550 * Is this used for anything? NT Create AndX doesn't use it.
2551 * Is there some 16-bit attribute field with more bits than Read Only,
2552 * Hidden, System, Volume ID, Directory, and Archive?
2555 dissect_extended_file_attributes(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
, int offset
)
2557 static int * const flags
[] = {
2558 &hf_smb_file_attr_read_only_16bit
,
2559 &hf_smb_file_attr_hidden_16bit
,
2560 &hf_smb_file_attr_system_16bit
,
2561 &hf_smb_file_attr_volume_16bit
,
2562 &hf_smb_file_attr_directory_16bit
,
2563 &hf_smb_file_attr_archive_16bit
,
2564 &hf_smb_file_attr_device
,
2565 &hf_smb_file_attr_normal
,
2566 &hf_smb_file_attr_temporary
,
2567 &hf_smb_file_attr_sparse
,
2568 &hf_smb_file_attr_reparse
,
2569 &hf_smb_file_attr_compressed
,
2570 &hf_smb_file_attr_offline
,
2571 &hf_smb_file_attr_not_content_indexed
,
2572 &hf_smb_file_attr_encrypted
,
2576 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_file_eattr
, ett_smb_file_attributes
, flags
, ENC_LITTLE_ENDIAN
);
2584 #define SERVER_CAP_RAW_MODE 0x00000001
2585 #define SERVER_CAP_MPX_MODE 0x00000002
2586 #define SERVER_CAP_UNICODE 0x00000004
2587 #define SERVER_CAP_LARGE_FILES 0x00000008
2588 #define SERVER_CAP_NT_SMBS 0x00000010
2589 #define SERVER_CAP_RPC_REMOTE_APIS 0x00000020
2590 #define SERVER_CAP_STATUS32 0x00000040
2591 #define SERVER_CAP_LEVEL_II_OPLOCKS 0x00000080
2592 #define SERVER_CAP_LOCK_AND_READ 0x00000100
2593 #define SERVER_CAP_NT_FIND 0x00000200
2594 #define SERVER_CAP_DFS 0x00001000
2595 #define SERVER_CAP_INFOLEVEL_PASSTHRU 0x00002000
2596 #define SERVER_CAP_LARGE_READX 0x00004000
2597 #define SERVER_CAP_LARGE_WRITEX 0x00008000
2598 #define SERVER_CAP_LWIO 0x00010000
2599 #define SERVER_CAP_UNIX 0x00800000
2600 #define SERVER_CAP_COMPRESSED_DATA 0x02000000
2601 #define SERVER_CAP_DYNAMIC_REAUTH 0x20000000
2602 #define SERVER_CAP_EXTENDED_SECURITY 0x80000000
2604 static const true_false_string tfs_server_cap_raw_mode
= {
2605 "Read Raw and Write Raw are supported",
2606 "Read Raw and Write Raw are not supported"
2608 static const true_false_string tfs_server_cap_mpx_mode
= {
2609 "Read Mpx and Write Mpx are supported",
2610 "Read Mpx and Write Mpx are not supported"
2612 static const true_false_string tfs_server_cap_unicode
= {
2613 "Unicode strings are supported",
2614 "Unicode strings are not supported"
2616 static const true_false_string tfs_server_cap_large_files
= {
2617 "Large files are supported",
2618 "Large files are not supported",
2620 static const true_false_string tfs_server_cap_nt_smbs
= {
2621 "NT SMBs are supported",
2622 "NT SMBs are not supported"
2624 static const true_false_string tfs_server_cap_rpc_remote_apis
= {
2625 "RPC remote APIs are supported",
2626 "RPC remote APIs are not supported"
2628 static const true_false_string tfs_server_cap_nt_status
= {
2629 "NT status codes are supported",
2630 "NT status codes are not supported"
2632 static const true_false_string tfs_server_cap_level_ii_oplocks
= {
2633 "Level 2 oplocks are supported",
2634 "Level 2 oplocks are not supported"
2636 static const true_false_string tfs_server_cap_lock_and_read
= {
2637 "Lock and Read is supported",
2638 "Lock and Read is not supported"
2640 static const true_false_string tfs_server_cap_nt_find
= {
2641 "NT Find is supported",
2642 "NT Find is not supported"
2644 static const true_false_string tfs_server_cap_dfs
= {
2646 "Dfs is not supported"
2648 static const true_false_string tfs_server_cap_infolevel_passthru
= {
2649 "NT information level request passthrough is supported",
2650 "NT information level request passthrough is not supported"
2652 static const true_false_string tfs_server_cap_large_readx
= {
2653 "Large Read andX is supported",
2654 "Large Read andX is not supported"
2656 static const true_false_string tfs_server_cap_large_writex
= {
2657 "Large Write andX is supported",
2658 "Large Write andX is not supported"
2660 static const true_false_string tfs_server_cap_lwio
= {
2661 "LWIO ioctl/fsctl is supported",
2662 "LWIO ioctl/fsctl is not supported"
2664 static const true_false_string tfs_server_cap_unix
= {
2665 "UNIX extensions are supported",
2666 "UNIX extensions are not supported"
2668 static const true_false_string tfs_server_cap_compressed_data
= {
2669 "Compressed data transfer is supported",
2670 "Compressed data transfer is not supported"
2672 static const true_false_string tfs_server_cap_dynamic_reauth
= {
2673 "Dynamic Reauth is supported",
2674 "Dynamic Reauth is not supported"
2676 static const true_false_string tfs_server_cap_extended_security
= {
2677 "Extended security exchanges are supported",
2678 "Extended security exchanges are not supported"
2681 dissect_negprot_capabilities(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
2685 static int * const flags
[] = {
2686 &hf_smb_server_cap_raw_mode
,
2687 &hf_smb_server_cap_mpx_mode
,
2688 &hf_smb_server_cap_unicode
,
2689 &hf_smb_server_cap_large_files
,
2690 &hf_smb_server_cap_nt_smbs
,
2691 &hf_smb_server_cap_rpc_remote_apis
,
2692 &hf_smb_server_cap_nt_status
,
2693 &hf_smb_server_cap_level_ii_oplocks
,
2694 &hf_smb_server_cap_lock_and_read
,
2695 &hf_smb_server_cap_nt_find
,
2696 &hf_smb_server_cap_dfs
,
2697 &hf_smb_server_cap_infolevel_passthru
,
2698 &hf_smb_server_cap_large_readx
,
2699 &hf_smb_server_cap_large_writex
,
2700 &hf_smb_server_cap_lwio
,
2701 &hf_smb_server_cap_unix
,
2702 &hf_smb_server_cap_compressed_data
,
2703 &hf_smb_server_cap_dynamic_reauth
,
2704 &hf_smb_server_cap_extended_security
,
2708 mask
= tvb_get_letohl(tvb
, offset
);
2709 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_server_cap
, ett_smb_capabilities
, flags
, ENC_LITTLE_ENDIAN
);
2714 #define RAWMODE_READ 0x0001
2715 #define RAWMODE_WRITE 0x0002
2716 static const true_false_string tfs_rm_read
= {
2717 "Read Raw is supported",
2718 "Read Raw is not supported"
2720 static const true_false_string tfs_rm_write
= {
2721 "Write Raw is supported",
2722 "Write Raw is not supported"
2726 dissect_negprot_rawmode(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
2728 static int * const flags
[] = {
2734 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_rm
, ett_smb_rawmode
, flags
, ENC_LITTLE_ENDIAN
);
2741 #define SECURITY_MODE_MODE 0x01
2742 #define SECURITY_MODE_PASSWORD 0x02
2743 #define SECURITY_MODE_SIGNATURES 0x04
2744 #define SECURITY_MODE_SIG_REQUIRED 0x08
2745 static const true_false_string tfs_sm_mode
= {
2746 "USER security mode",
2747 "SHARE security mode"
2749 static const true_false_string tfs_sm_password
= {
2750 "ENCRYPTED password. Use challenge/response",
2751 "PLAINTEXT password"
2753 static const true_false_string tfs_sm_signatures
= {
2754 "Security signatures ENABLED",
2755 "Security signatures NOT enabled"
2757 static const true_false_string tfs_sm_sig_required
= {
2758 "Security signatures REQUIRED",
2759 "Security signatures NOT required"
2763 dissect_negprot_security_mode(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, int wc
)
2765 static int * const flags13
[] = {
2767 &hf_smb_sm_password16
,
2770 static int * const flags17
[] = {
2772 &hf_smb_sm_password
,
2773 &hf_smb_sm_signatures
,
2774 &hf_smb_sm_sig_required
,
2780 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_sm16
, ett_smb_mode
, flags13
, ENC_LITTLE_ENDIAN
);
2785 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_sm
, ett_smb_mode
, flags17
, ENC_LITTLE_ENDIAN
);
2793 #define MAX_DIALECTS 20
2794 struct negprot_dialects
{
2796 char *name
[MAX_DIALECTS
+1];
2800 dissect_negprot_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
2802 proto_tree
*tr
= NULL
;
2806 struct negprot_dialects
*dialects
= NULL
;
2808 DISSECTOR_ASSERT(si
);
2814 tr
= proto_tree_add_subtree(tree
, tvb
, offset
, -1, ett_smb_dialects
, &ti
, "Requested Dialects");
2816 if (!pinfo
->fd
->visited
&& si
->sip
) {
2817 dialects
= wmem_new(wmem_file_scope(), struct negprot_dialects
);
2819 si
->sip
->extra_info_type
= SMB_EI_DIALECTS
;
2820 si
->sip
->extra_info
= dialects
;
2826 proto_item
*dit
= NULL
;
2827 proto_tree
*dtr
= NULL
;
2829 /* XXX - what if this runs past bc? */
2830 tvb_ensure_bytes_exist(tvb
, offset
+1, 1);
2832 /* XXX: This is an OEM String according to MS-CIFS and
2833 * should use the local OEM (extended ASCII DOS) code page,
2834 * It doesn't appear than any known dialect strings use
2835 * anything outside ASCII, though.
2837 * There could be a dissector preference for local code page.
2839 str
= tvb_get_stringz_enc(pinfo
->pool
, tvb
, offset
+1, &len
, ENC_ASCII
);
2842 dit
= proto_tree_add_string(tr
, hf_smb_dialect
, tvb
, offset
, len
+1, str
);
2843 dtr
= proto_item_add_subtree(dit
, ett_smb_dialect
);
2847 CHECK_BYTE_COUNT(1);
2848 proto_tree_add_item(dtr
, hf_smb_buffer_format
, tvb
, offset
, 1,
2853 CHECK_BYTE_COUNT(len
);
2854 proto_tree_add_item(dtr
, hf_smb_dialect_name
, tvb
,
2855 offset
, len
, ENC_ASCII
);
2858 if (!pinfo
->fd
->visited
&& dialects
&& (dialects
->num
< MAX_DIALECTS
)) {
2859 dialects
->name
[dialects
->num
++] = wmem_strdup(wmem_file_scope(), str
);
2862 proto_item_set_len(ti
, bc
);
2870 dissect_negprot_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
2880 const char *dialect_name
= NULL
;
2881 struct negprot_dialects
*dialects
= NULL
;
2883 DISSECTOR_ASSERT(si
);
2888 dialect
= tvb_get_letohs(tvb
, offset
);
2890 if (si
->sip
&& (si
->sip
->extra_info_type
== SMB_EI_DIALECTS
)) {
2891 dialects
= (struct negprot_dialects
*)si
->sip
->extra_info
;
2892 if (dialect
< dialects
->num
) {
2893 dialect_name
= dialects
->name
[dialect
];
2896 if (!dialect_name
) {
2897 dialect_name
= "unknown";
2902 if (dialect
== 0xffff) {
2904 * Server doesn't support any of the dialects the
2907 proto_tree_add_uint_format_value(tree
, hf_smb_dialect_index
,
2908 tvb
, offset
, 2, dialect
,
2909 "-1, server does not support any of the listed dialects");
2912 * A dialect was selected; this should be
2915 proto_tree_add_uint(tree
, hf_smb_dialect_index
,
2916 tvb
, offset
, 2, dialect
);
2921 * Server selected a dialect from LAN Manager 1.0 through
2924 proto_tree_add_uint_format_value(tree
, hf_smb_dialect_index
,
2925 tvb
, offset
, 2, dialect
,
2926 "%u, Greater than CORE PROTOCOL and up to LANMAN2.1", dialect
);
2930 * Server selected NT LAN Manager.
2932 proto_tree_add_uint_format_value(tree
, hf_smb_dialect_index
,
2933 tvb
, offset
, 2, dialect
,
2934 "%u: %s", dialect
, dialect_name
);
2937 proto_tree_add_item(tree
, hf_smb_word_unk_response_format
, tvb
, offset
, wc
*2, ENC_NA
);
2946 * Server selected a dialect from LAN Manager 1.0 through
2951 offset
= dissect_negprot_security_mode(tvb
, tree
, offset
, wc
);
2953 /* Maximum Transmit Buffer Size */
2954 proto_tree_add_item(tree
, hf_smb_max_trans_buf_size
,
2955 tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
2958 /* Maximum Multiplex Count */
2959 proto_tree_add_item(tree
, hf_smb_max_mpx_count
,
2960 tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
2963 /* Maximum Vcs Number */
2964 proto_tree_add_item(tree
, hf_smb_max_vcs_num
,
2965 tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
2969 offset
= dissect_negprot_rawmode(tvb
, tree
, offset
);
2972 proto_tree_add_item(tree
, hf_smb_session_key
,
2973 tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
2976 /* current time and date at server */
2977 offset
= dissect_smb_datetime(tvb
, tree
, offset
, hf_smb_server_date_time
, hf_smb_server_smb_date
, hf_smb_server_smb_time
,
2981 tz
= tvb_get_letohs(tvb
, offset
);
2982 proto_tree_add_int_format_value(tree
, hf_smb_server_timezone
, tvb
, offset
, 2, tz
, "%d min from UTC", tz
);
2986 * The LAN Manager 1 and 2.0 specs say these are the
2987 * first 2 of 4 reserved bytes; the LAN Manager 2.1
2988 * spec says it's a 2-byte encryption key (challenge)
2991 chl
= tvb_get_letohs(tvb
, offset
);
2992 proto_tree_add_uint(tree
, hf_smb_challenge_length
, tvb
, offset
, 2, chl
);
2995 /* 2 reserved bytes */
2996 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
3003 * Server selected NT LAN Manager.
3007 offset
= dissect_negprot_security_mode(tvb
, tree
, offset
, wc
);
3009 /* Maximum Multiplex Count */
3010 proto_tree_add_item(tree
, hf_smb_max_mpx_count
,
3011 tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
3014 /* Maximum Vcs Number */
3015 proto_tree_add_item(tree
, hf_smb_max_vcs_num
,
3016 tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
3019 /* Maximum Transmit Buffer Size */
3020 proto_tree_add_item(tree
, hf_smb_max_trans_buf_size
,
3021 tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
3024 /* maximum raw buffer size */
3025 proto_tree_add_item(tree
, hf_smb_max_raw_buf_size
,
3026 tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
3030 proto_tree_add_item(tree
, hf_smb_session_key
,
3031 tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
3034 /* server capabilities */
3035 caps
= dissect_negprot_capabilities(tvb
, tree
, offset
);
3039 dissect_nttime(tvb
, tree
, offset
,
3040 hf_smb_system_time
, ENC_LITTLE_ENDIAN
);
3044 tz
= tvb_get_letohs(tvb
, offset
);
3045 proto_tree_add_int_format_value(tree
, hf_smb_server_timezone
,
3047 "%d min from UTC", tz
);
3050 /* challenge length */
3051 chl
= tvb_get_uint8(tvb
, offset
);
3052 proto_tree_add_uint(tree
, hf_smb_challenge_length
,
3053 tvb
, offset
, 1, chl
);
3064 * Server selected a dialect from LAN Manager 1.0 through
3068 /* encrypted challenge/response data */
3070 CHECK_BYTE_COUNT(chl
);
3071 proto_tree_add_item(tree
, hf_smb_challenge
, tvb
, offset
, chl
, ENC_NA
);
3078 * XXX - not present if negotiated dialect isn't
3079 * "DOS LANMAN 2.1" or "LANMAN2.1", but we'd either
3080 * have to see the request, or assume what dialect strings
3081 * were sent, to determine that.
3083 * Is this something other than a primary domain if the
3084 * negotiated dialect is Windows for Workgroups 3.1a?
3085 * It appears to be 8 bytes of binary data in at least
3086 * one capture - is that an encryption key or something
3089 dn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
3090 si
->unicode
, &dn_len
, false, false, &bc
);
3093 proto_tree_add_string(tree
, hf_smb_primary_domain
, tvb
,
3094 offset
, dn_len
, dn
);
3095 COUNT_BYTES(dn_len
);
3100 * Server selected NT LAN Manager.
3102 if (!(caps
& SERVER_CAP_EXTENDED_SECURITY
)) {
3103 /* encrypted challenge/response data */
3104 /* XXX - is this aligned on an even boundary? */
3106 CHECK_BYTE_COUNT(chl
);
3107 proto_tree_add_item(tree
, hf_smb_challenge
,
3108 tvb
, offset
, chl
, ENC_NA
);
3114 * This string is special; at least in some captures,
3115 * it's in Unicode, even if "Unicode strings" isn't
3116 * set in the flags2 field. If the "Unicode support"
3117 * flag is set in the server capabilities field,
3118 * that seems to indicate that it's in Unicode for
3121 * So fetch it in Unicode either if it's set in the
3122 * flags2 field *or* in the capabilities field.
3124 * XXX - I've seen captures where "Unicode strings"
3125 * isn't set, "Unicode support" is set in the server
3126 * capabilities field, and the primary domain string
3127 * is in the local code page; that may just have
3128 * a buggy server, though.
3130 * Clients tend, at least according to the
3131 * footnote in MS-CIFS for the DomainName field
3132 * in the Negotiate response, to ignore that
3133 * field, so maybe servers put extra bytes in
3134 * there without clients noticing.
3136 si
->unicode
= (caps
& SERVER_CAP_UNICODE
) || si
->unicode
;
3139 * If we're fetching Unicode strings:
3141 * This string is NOT padded to be 16-bit
3142 * aligned; it's unaligned in some captures.
3144 * However, it sometimes has an extra byte
3145 * before it. If the byte count is not a
3146 * multiple of 2, there must be an extra byte
3147 * somewhere; it appears to be the byte just
3148 * before this string, so check for an odd
3149 * byte count, and skip that byte.
3151 * If we're fetching local code page strings:
3153 * In some cases there appears to be an extra
3154 * byte before it. It's not clear what
3155 * indicates its presence, if anything.
3157 * However, at least one of those cases
3158 * was one of the "the server set the
3159 * Unicode support flag in capabilities,
3160 * but sent the domain name in the local
3161 * code page" captures mentioned above,
3162 * so maybe it was just a buggy server.
3164 * Again, as noted above, clients may just
3165 * ignore that field, leaving servers "free"
3168 if (si
->unicode
&& (bc
% 2) != 0) {
3169 /* Skip the padding */
3170 CHECK_BYTE_COUNT(1);
3173 dn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
,
3174 &offset
, si
->unicode
, &dn_len
, true, false,
3178 proto_tree_add_string(tree
, hf_smb_primary_domain
,
3179 tvb
, offset
, dn_len
, dn
);
3180 COUNT_BYTES(dn_len
);
3182 /* server name, seen in w2k pro capture */
3183 dn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
,
3184 &offset
, si
->unicode
, &dn_len
, true, false,
3188 proto_tree_add_string(tree
, hf_smb_server
,
3189 tvb
, offset
, dn_len
, dn
);
3190 COUNT_BYTES(dn_len
);
3193 proto_item
*blob_item
;
3197 /* XXX - show it in the standard Microsoft format
3199 CHECK_BYTE_COUNT(16);
3200 proto_tree_add_item(tree
, hf_smb_server_guid
,
3201 tvb
, offset
, 16, ENC_NA
);
3205 /* If it runs past the end of the captured data, don't
3206 * try to put all of it into the protocol tree as the
3207 * raw security blob; we might get an exception on
3208 * short frames and then we will not see anything at all
3209 * of the security blob.
3212 if (sbloblen
> tvb_reported_length_remaining(tvb
, offset
)) {
3213 sbloblen
= tvb_reported_length_remaining(tvb
, offset
);
3215 blob_item
= proto_tree_add_item(
3216 tree
, hf_smb_security_blob
,
3217 tvb
, offset
, sbloblen
, ENC_NA
);
3220 * If Extended security and BCC == 16, then raw
3221 * NTLMSSP is in use. We need to save this info
3225 tvbuff_t
*gssapi_tvb
;
3226 proto_tree
*gssapi_tree
;
3228 gssapi_tree
= proto_item_add_subtree(
3229 blob_item
, ett_smb_secblob
);
3232 * Set the reported length of this to
3233 * the reported length of the blob,
3234 * rather than the amount of data
3235 * available from the blob, so that
3236 * we'll throw the right exception if
3239 gssapi_tvb
= tvb_new_subset_length_caplen(
3240 tvb
, offset
, sbloblen
, bc
);
3243 gssapi_handle
, gssapi_tvb
, pinfo
,
3247 si
->ct
->raw_ntlmssp
= 0;
3254 * There is no blob. We just have to make sure
3255 * that subsequent routines know to call the
3260 si
->ct
->raw_ntlmssp
= 1;
3274 dissect_old_dir_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
3281 DISSECTOR_ASSERT(si
);
3288 CHECK_BYTE_COUNT(1);
3289 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
3293 dn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &dn_len
,
3296 if ((!pinfo
->fd
->visited
) && si
->sip
) {
3297 si
->sip
->extra_info_type
= SMB_EI_FILENAME
;
3298 si
->sip
->extra_info
= wmem_strdup(wmem_file_scope(), dn
);
3303 proto_tree_add_string(tree
, hf_smb_dir_name
, tvb
, offset
, dn_len
,
3305 COUNT_BYTES(dn_len
);
3307 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Directory: %s",
3308 format_text(pinfo
->pool
, (const unsigned char *)dn
, strlen(dn
)));
3316 dissect_empty(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
3320 proto_item
*item
= NULL
;
3322 DISSECTOR_ASSERT(si
);
3324 if (si
->sip
&& (si
->sip
->extra_info_type
== SMB_EI_FILENAME
)) {
3325 item
= proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, 0, 0, (const char *)si
->sip
->extra_info
);
3326 proto_item_set_generated(item
);
3340 dissect_rename_file_response(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
3344 proto_item
*item
= NULL
;
3346 DISSECTOR_ASSERT(si
);
3348 if (si
->sip
&& (si
->sip
->extra_info_type
== SMB_EI_RENAMEDATA
)) {
3349 smb_rename_saved_info_t
*rni
= (smb_rename_saved_info_t
*)si
->sip
->extra_info
;
3351 item
= proto_tree_add_string(tree
, hf_smb_old_file_name
, tvb
, 0, 0, rni
->old_name
);
3352 proto_item_set_generated(item
);
3353 item
= proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, 0, 0, rni
->new_name
);
3354 proto_item_set_generated(item
);
3368 dissect_echo_request(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
3376 ec
= tvb_get_letohs(tvb
, offset
);
3377 proto_tree_add_uint(tree
, hf_smb_echo_count
, tvb
, offset
, 2, ec
);
3384 proto_tree_add_item(tree
, hf_smb_echo_data
, tvb
, offset
, bc
, ENC_NA
);
3394 dissect_echo_response(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
3401 /* echo sequence number */
3402 proto_tree_add_item(tree
, hf_smb_echo_seq_num
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
3409 proto_tree_add_item(tree
, hf_smb_echo_data
, tvb
, offset
, bc
, ENC_NA
);
3419 dissect_tree_connect_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
3426 DISSECTOR_ASSERT(si
);
3433 CHECK_BYTE_COUNT(1);
3434 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
3438 an
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
3439 si
->unicode
, &an_len
, false, false, &bc
);
3442 proto_tree_add_string(tree
, hf_smb_path
, tvb
,
3443 offset
, an_len
, an
);
3444 COUNT_BYTES(an_len
);
3446 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Path: %s",
3447 format_text(pinfo
->pool
, (const unsigned char*)an
, strlen(an
)));
3450 CHECK_BYTE_COUNT(1);
3451 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
3454 /* password, ANSI */
3455 /* XXX - what if this runs past bc? */
3456 pwlen
= tvb_strsize(tvb
, offset
);
3457 CHECK_BYTE_COUNT(pwlen
);
3458 proto_tree_add_item(tree
, hf_smb_password
,
3459 tvb
, offset
, pwlen
, ENC_NA
);
3463 CHECK_BYTE_COUNT(1);
3464 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
3469 * XXX - the SNIA CIFS spec "Strings that are never passed in
3470 * Unicode are: ... The service name string in the
3471 * Tree_Connect_AndX SMB". Is that claim false?
3473 an
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
3474 si
->unicode
, &an_len
, false, false, &bc
);
3477 proto_tree_add_string(tree
, hf_smb_service
, tvb
,
3478 offset
, an_len
, an
);
3479 COUNT_BYTES(an_len
);
3487 dissect_smb_uid(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, smb_info_t
*si
)
3489 proto_item
*item
, *subitem
;
3491 smb_uid_t
*smb_uid
= NULL
;
3493 item
= proto_tree_add_uint(parent_tree
, hf_smb_uid
, tvb
, offset
, 2, si
->uid
);
3494 tree
= proto_item_add_subtree(item
, ett_smb_uid
);
3496 smb_uid
= (smb_uid_t
*)wmem_tree_lookup32(si
->ct
->uid_tree
, si
->uid
);
3498 if (smb_uid
->domain
&& smb_uid
->account
)
3499 proto_item_append_text(item
, " (");
3500 if (smb_uid
->domain
) {
3501 proto_item_append_text(item
, "%s", smb_uid
->domain
);
3502 subitem
= proto_tree_add_string(tree
, hf_smb_primary_domain
, tvb
, 0, 0, smb_uid
->domain
);
3503 proto_item_set_generated(subitem
);
3505 if (smb_uid
->account
) {
3506 proto_item_append_text(item
, "\\%s", smb_uid
->account
);
3507 subitem
= proto_tree_add_string(tree
, hf_smb_account
, tvb
, 0, 0, smb_uid
->account
);
3508 proto_item_set_generated(subitem
);
3510 if (smb_uid
->domain
&& smb_uid
->account
)
3511 proto_item_append_text(item
, ")");
3512 if (smb_uid
->logged_in
> 0) {
3513 subitem
= proto_tree_add_uint(tree
, hf_smb_logged_in
, tvb
, 0, 0, smb_uid
->logged_in
);
3514 proto_item_set_generated(subitem
);
3516 if (smb_uid
->logged_out
> 0) {
3517 subitem
= proto_tree_add_uint(tree
, hf_smb_logged_out
, tvb
, 0, 0, smb_uid
->logged_out
);
3518 proto_item_set_generated(subitem
);
3527 dissect_smb_tid(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, uint16_t tid
, bool is_created
, bool is_closed
, smb_info_t
*si
)
3531 smb_tid_info_t
*tid_info
= NULL
;
3533 DISSECTOR_ASSERT(si
);
3536 it
= proto_tree_add_uint(tree
, hf_smb_tid
, tvb
, offset
, 2, tid
);
3537 tr
= proto_item_add_subtree(it
, ett_smb_tid
);
3540 if ((!pinfo
->fd
->visited
) && is_created
) {
3541 tid_info
= wmem_new(wmem_file_scope(), smb_tid_info_t
);
3542 tid_info
->opened_in
= pinfo
->num
;
3543 tid_info
->closed_in
= 0;
3544 tid_info
->type
= SMB_FID_TYPE_UNKNOWN
;
3545 if (si
->sip
&& (si
->sip
->extra_info_type
== SMB_EI_TIDNAME
)) {
3546 tid_info
->filename
= (char *)si
->sip
->extra_info
;
3548 tid_info
->filename
= NULL
;
3550 wmem_tree_insert32(si
->ct
->tid_tree
, tid
, tid_info
);
3554 tid_info
= (smb_tid_info_t
*)wmem_tree_lookup32_le(si
->ct
->tid_tree
, tid
);
3560 if ((!pinfo
->fd
->visited
) && is_closed
) {
3561 tid_info
->closed_in
= pinfo
->num
;
3564 if (tid_info
->opened_in
) {
3565 if (tid_info
->filename
) {
3566 proto_item_append_text(it
, " (%s)", tid_info
->filename
);
3568 it
= proto_tree_add_string(tr
, hf_smb_path
, tvb
, 0, 0, tid_info
->filename
);
3569 proto_item_set_generated(it
);
3572 it
= proto_tree_add_uint(tr
, hf_smb_mapped_in
, tvb
, 0, 0, tid_info
->opened_in
);
3573 proto_item_set_generated(it
);
3575 if (tid_info
->closed_in
) {
3576 it
= proto_tree_add_uint(tr
, hf_smb_unmapped_in
, tvb
, 0, 0, tid_info
->closed_in
);
3577 proto_item_set_generated(it
);
3585 dissect_tree_connect_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
3592 /* Maximum Buffer Size */
3593 proto_tree_add_item(tree
, hf_smb_max_buf_size
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
3597 offset
= dissect_smb_tid(tvb
, pinfo
, tree
, offset
, tvb_get_letohs(tvb
, offset
), true, false, si
);
3607 static const true_false_string tfs_of_create
= {
3608 "Create file if it does not exist",
3609 "Fail if file does not exist"
3611 static const value_string of_open
[] = {
3612 { 0, "Fail if file exists"},
3613 { 1, "Open file if it exists"},
3614 { 2, "Truncate file if it exists"},
3618 dissect_open_function(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
3620 static int * const flags
[] = {
3621 &hf_smb_open_function_create
,
3622 &hf_smb_open_function_open
,
3626 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_open_function
, ett_smb_openfunction
, flags
, ENC_LITTLE_ENDIAN
);
3633 static const true_false_string tfs_mf_file
= {
3634 "Target must be a file",
3635 "Target needn't be a file"
3637 static const true_false_string tfs_mf_dir
= {
3638 "Target must be a directory",
3639 "Target needn't be a directory"
3641 static const true_false_string tfs_mf_verify
= {
3642 "MUST verify all writes",
3643 "Don't have to verify writes"
3646 dissect_move_flags(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
3648 static int * const flags
[] = {
3649 &hf_smb_move_flags_verify
,
3650 &hf_smb_move_flags_dir
,
3651 &hf_smb_move_flags_file
,
3655 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_move_flags
, ett_smb_move_copy_flags
, flags
, ENC_LITTLE_ENDIAN
);
3661 static const true_false_string tfs_cf_mode
= {
3665 static const true_false_string tfs_cf_tree_copy
= {
3666 "Copy is a tree copy",
3667 "Copy is a file copy"
3669 static const true_false_string tfs_cf_ea_action
= {
3674 dissect_copy_flags(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
3676 static int * const flags
[] = {
3677 &hf_smb_copy_flags_ea_action
,
3678 &hf_smb_copy_flags_tree_copy
,
3679 &hf_smb_copy_flags_verify
,
3680 &hf_smb_copy_flags_source_mode
,
3681 &hf_smb_copy_flags_dest_mode
,
3682 &hf_smb_copy_flags_dir
,
3683 &hf_smb_copy_flags_file
,
3687 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_copy_flags
, ett_smb_move_copy_flags
, flags
, ENC_LITTLE_ENDIAN
);
3694 dissect_move_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
3702 DISSECTOR_ASSERT(si
);
3707 tid
= tvb_get_letohs(tvb
, offset
);
3708 offset
= dissect_smb_tid(tvb
, pinfo
, tree
, offset
, tid
, false, false, si
);
3711 offset
= dissect_open_function(tvb
, tree
, offset
);
3714 offset
= dissect_move_flags(tvb
, tree
, offset
);
3719 CHECK_BYTE_COUNT(1);
3720 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
3724 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
3728 proto_tree_add_string_format(tree
, hf_smb_file_name
, tvb
, offset
,
3729 fn_len
, fn
, "Old File Name: %s", format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
3730 COUNT_BYTES(fn_len
);
3732 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Old Name: %s",
3733 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
3736 CHECK_BYTE_COUNT(1);
3737 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
3741 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
3745 proto_tree_add_string_format(tree
, hf_smb_file_name
, tvb
, offset
,
3746 fn_len
, fn
, "New File Name: %s", format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
3747 COUNT_BYTES(fn_len
);
3749 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", New Name: %s",
3750 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
3758 dissect_copy_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
3766 DISSECTOR_ASSERT(si
);
3771 tid
= tvb_get_letohs(tvb
, offset
);
3772 offset
= dissect_smb_tid(tvb
, pinfo
, tree
, offset
, tid
, false, false, si
);
3775 offset
= dissect_open_function(tvb
, tree
, offset
);
3778 offset
= dissect_copy_flags(tvb
, tree
, offset
);
3783 CHECK_BYTE_COUNT(1);
3784 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
3788 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
3792 proto_tree_add_string_format(tree
, hf_smb_file_name
, tvb
, offset
,
3793 fn_len
, fn
, "Source File Name: %s", format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
3794 COUNT_BYTES(fn_len
);
3796 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Source Name: %s",
3797 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
3800 CHECK_BYTE_COUNT(1);
3801 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
3805 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
3809 proto_tree_add_string_format(tree
, hf_smb_file_name
, tvb
, offset
,
3810 fn_len
, fn
, "Destination File Name: %s",
3811 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
3812 COUNT_BYTES(fn_len
);
3814 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Destination Name: %s", format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
3822 dissect_move_copy_response(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
3829 DISSECTOR_ASSERT(si
);
3833 /* # of files moved */
3834 proto_tree_add_item(tree
, hf_smb_files_moved
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
3840 CHECK_BYTE_COUNT(1);
3841 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
3845 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
3849 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
3851 COUNT_BYTES(fn_len
);
3859 dissect_open_file_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
3865 smb_fid_saved_info_t
*fsi
; /* eo_smb needs to track this info */
3867 DISSECTOR_ASSERT(si
);
3871 /* desired access */
3872 offset
= dissect_access(tvb
, tree
, offset
, hf_smb_desired_access
);
3874 /* Search Attributes */
3875 offset
= dissect_search_attributes(tvb
, tree
, offset
);
3880 CHECK_BYTE_COUNT(1);
3881 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
3885 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
3889 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
3891 COUNT_BYTES(fn_len
);
3893 /* store it for the fid->name/openframe/closeframe matching in
3894 * dissect_smb_fid() called from the response.
3896 if ((!pinfo
->fd
->visited
) && si
->sip
&& fn
) {
3897 fsi
= wmem_new0(wmem_file_scope(), smb_fid_saved_info_t
);
3898 fsi
->filename
= wmem_strdup(wmem_file_scope(), fn
);
3900 si
->sip
->extra_info_type
= SMB_EI_FILEDATA
;
3901 si
->sip
->extra_info
= fsi
;
3904 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Path: %s",
3905 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
3915 dissect_nt_create_bits(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
,
3916 int len
, uint32_t mask
)
3918 proto_item
*item
= NULL
;
3920 * XXX - it's 0x00000016 in at least one capture, but
3921 * Network Monitor doesn't say what the 0x00000010 bit is.
3922 * Does the Win32 API documentation, or NT Native API book,
3925 * That is the extended response desired bit ... RJS, from Samba
3926 * Well, maybe. Samba thinks it is, and uses it to encode
3927 * OpLock granted as the high order bit of the Action field
3928 * in the response. However, Windows does not do that. Or at least
3931 static int * const fields
[] = {
3932 &hf_smb_nt_create_bits_oplock
,
3933 &hf_smb_nt_create_bits_boplock
,
3934 &hf_smb_nt_create_bits_dir
,
3935 &hf_smb_nt_create_bits_ext_resp
,
3939 item
= proto_tree_add_bitmask_value_with_flags(parent_tree
, tvb
, offset
, hf_smb_create_flags
, ett_smb_nt_create_bits
,
3940 fields
, mask
, BMT_NO_APPEND
);
3943 proto_item_set_generated(item
);
3950 /* FIXME: need to call dissect_nt_access_mask() instead */
3952 dissect_smb_access_mask_bits(tvbuff_t
*tvb
, proto_tree
*parent_tree
,
3953 int offset
, int len
, uint32_t mask
)
3957 * Some of these bits come from
3959 * http://www.samba.org/samba/ftp/specs/smb-nt01.doc
3961 * and others come from the section on ZwOpenFile in "Windows(R)
3962 * NT(R)/2000 Native API Reference".
3964 static int * const fields
[] = {
3965 &hf_smb_nt_access_mask_read
,
3966 &hf_smb_nt_access_mask_write
,
3967 &hf_smb_nt_access_mask_append
,
3968 &hf_smb_nt_access_mask_read_ea
,
3969 &hf_smb_nt_access_mask_write_ea
,
3970 &hf_smb_nt_access_mask_execute
,
3971 &hf_smb_nt_access_mask_delete_child
,
3972 &hf_smb_nt_access_mask_read_attributes
,
3973 &hf_smb_nt_access_mask_write_attributes
,
3974 &hf_smb_nt_access_mask_delete
,
3975 &hf_smb_nt_access_mask_read_control
,
3976 &hf_smb_nt_access_mask_write_dac
,
3977 &hf_smb_nt_access_mask_write_owner
,
3978 &hf_smb_nt_access_mask_synchronize
,
3979 &hf_smb_nt_access_mask_system_security
,
3980 &hf_smb_nt_access_mask_maximum_allowed
,
3981 &hf_smb_nt_access_mask_generic_all
,
3982 &hf_smb_nt_access_mask_generic_execute
,
3983 &hf_smb_nt_access_mask_generic_write
,
3984 &hf_smb_nt_access_mask_generic_read
,
3988 item
= proto_tree_add_bitmask_value_with_flags(parent_tree
, tvb
, offset
, hf_smb_access_mask
, ett_smb_nt_access_mask
,
3989 fields
, mask
, BMT_NO_APPEND
);
3992 proto_item_set_generated(item
);
3999 dissect_smb_access_mask(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
4003 mask
= tvb_get_letohl(tvb
, offset
);
4005 offset
= dissect_smb_access_mask_bits(tvb
, parent_tree
, offset
, 4, mask
);
4010 #define SHARE_ACCESS_READ 0x00000001
4011 #define SHARE_ACCESS_WRITE 0x00000002
4012 #define SHARE_ACCESS_DELETE 0x00000004
4015 dissect_nt_share_access_bits(tvbuff_t
*tvb
, proto_tree
*parent_tree
,
4016 int offset
, int len
, uint32_t mask
)
4019 static int * const fields
[] = {
4020 &hf_smb_nt_share_access_read
,
4021 &hf_smb_nt_share_access_write
,
4022 &hf_smb_nt_share_access_delete
,
4026 item
= proto_tree_add_bitmask_value(parent_tree
, tvb
, offset
, hf_smb_share_access
, ett_smb_nt_share_access
, fields
, mask
);
4029 proto_item_set_generated(item
);
4037 dissect_nt_share_access(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
4041 mask
= tvb_get_letohl(tvb
, offset
);
4043 offset
= dissect_nt_share_access_bits(tvb
, parent_tree
, offset
, 4, mask
);
4050 dissect_nt_create_options_bits(tvbuff_t
*tvb
, proto_tree
*parent_tree
,
4051 int offset
, int len
, uint32_t mask
)
4057 * http://www.samba.org/samba/ftp/specs/smb-nt01.doc
4059 static int * const fields
[] = {
4060 &hf_smb_nt_create_options_directory_file
,
4061 &hf_smb_nt_create_options_write_through
,
4062 &hf_smb_nt_create_options_sequential_only
,
4063 &hf_smb_nt_create_options_no_intermediate_buffering
,
4064 &hf_smb_nt_create_options_sync_io_alert
,
4065 &hf_smb_nt_create_options_sync_io_nonalert
,
4066 &hf_smb_nt_create_options_non_directory_file
,
4067 &hf_smb_nt_create_options_create_tree_connection
,
4068 &hf_smb_nt_create_options_complete_if_oplocked
,
4069 &hf_smb_nt_create_options_no_ea_knowledge
,
4070 &hf_smb_nt_create_options_file_open_for_recovery
,
4071 &hf_smb_nt_create_options_random_access
,
4072 &hf_smb_nt_create_options_delete_on_close
,
4073 &hf_smb_nt_create_options_open_by_fileid
,
4074 &hf_smb_nt_create_options_backup_intent
,
4075 &hf_smb_nt_create_options_no_compression
,
4076 &hf_smb_nt_create_options_reserve_opfilter
,
4077 &hf_smb_nt_create_options_open_reparse_point
,
4078 &hf_smb_nt_create_options_open_no_recall
,
4079 &hf_smb_nt_create_options_open_for_free_space_query
,
4083 item
= proto_tree_add_bitmask_value_with_flags(parent_tree
, tvb
, offset
, hf_smb_create_options
, ett_smb_nt_create_options
, fields
, mask
, BMT_NO_APPEND
);
4085 proto_item_set_generated(item
);
4093 dissect_nt_create_options(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
4097 mask
= tvb_get_letohl(tvb
, offset
);
4099 offset
= dissect_nt_create_options_bits(tvb
, parent_tree
, offset
, 4, mask
);
4105 /* fids are scoped by tcp session */
4107 dissect_smb_fid(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
,
4108 int len
, uint16_t fid
, bool is_created
, bool is_closed
, bool is_generated
, smb_info_t
* si
)
4110 smb_saved_info_t
*sip
;
4113 smb_fid_info_t
*fid_info
= NULL
;
4114 smb_fid_info_t
*suspect_fid_info
= NULL
;
4115 /* We need this to use an array-accessed tree */
4116 GSList
*GSL_iterator
;
4118 DISSECTOR_ASSERT(si
);
4122 it
= proto_tree_add_uint(tree
, hf_smb_fid
, tvb
, offset
, len
, fid
);
4124 proto_item_set_generated(it
);
4126 tr
= proto_item_add_subtree(it
, ett_smb_fid
);
4127 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", FID: 0x%04x", fid
);
4129 if ((!pinfo
->fd
->visited
) && is_created
) {
4130 fid_info
= wmem_new(wmem_file_scope(), smb_fid_info_t
);
4131 fid_info
->opened_in
= pinfo
->num
;
4132 fid_info
->closed_in
= 0;
4133 fid_info
->type
= SMB_FID_TYPE_UNKNOWN
;
4134 fid_info
->fid
= fid
;
4135 fid_info
->tid
= si
->tid
;
4136 if (si
->sip
&& (si
->sip
->extra_info_type
== SMB_EI_FILEDATA
)) {
4137 fid_info
->fsi
= (smb_fid_saved_info_t
*)si
->sip
->extra_info
;
4139 fid_info
->fsi
= NULL
;
4141 /* We don't use the fid_tree anymore to access and
4142 maintain the fid information of analyzed files.
4143 (was wmem_tree_insert32(si->ct->fid_tree, fid, fid_info);)
4144 We'll use a single list instead to keep track of the
4146 Note that the insert_sorted function allows to insert duplicates
4147 but being inside this if section should prevent it */
4148 si
->ct
->GSL_fid_info
= g_slist_insert_sorted(
4149 si
->ct
->GSL_fid_info
,
4151 (GCompareFunc
)fid_cmp
);
4155 /* we use the single linked list to access this fid_info
4156 (was fid_info = wmem_tree_lookup32(si->ct->fid_tree, fid);) */
4157 GSL_iterator
= si
->ct
->GSL_fid_info
;
4158 while (GSL_iterator
) {
4159 suspect_fid_info
= (smb_fid_info_t
*)GSL_iterator
->data
;
4160 if (suspect_fid_info
->opened_in
> pinfo
->num
) break;
4161 if ((suspect_fid_info
->tid
== si
->tid
) && (suspect_fid_info
->fid
== fid
))
4162 fid_info
= (smb_fid_info_t
*)suspect_fid_info
;
4163 GSL_iterator
= g_slist_next(GSL_iterator
);
4170 /* Store the fid in the transaction structure and remember if
4171 it was in the request or in the reply we saw it
4173 if (sip
&& (!is_generated
) && (!pinfo
->fd
->visited
)) {
4176 sip
->fid_seen_in_request
= true;
4178 sip
->fid_seen_in_request
= false;
4182 if ((!pinfo
->fd
->visited
) && is_closed
) {
4183 fid_info
->closed_in
= pinfo
->num
;
4186 if (fid_info
->opened_in
) {
4187 it
= proto_tree_add_uint(tr
, hf_smb_opened_in
, tvb
, 0, 0, fid_info
->opened_in
);
4188 proto_item_set_generated(it
);
4191 if (fid_info
->closed_in
) {
4192 it
= proto_tree_add_uint(tr
, hf_smb_closed_in
, tvb
, 0, 0, fid_info
->closed_in
);
4193 proto_item_set_generated(it
);
4197 if (fid_info
->opened_in
) {
4198 if (fid_info
->fsi
&& fid_info
->fsi
->filename
) {
4199 it
= proto_tree_add_string(tr
, hf_smb_file_name
, tvb
, 0, 0, fid_info
->fsi
->filename
);
4200 proto_item_set_generated(it
);
4201 proto_item_append_text(tr
, " (%s)", fid_info
->fsi
->filename
);
4202 dissect_nt_create_bits(tvb
, tr
, 0, 0, fid_info
->fsi
->create_flags
);
4203 dissect_smb_access_mask_bits(tvb
, tr
, 0, 0, fid_info
->fsi
->access_mask
);
4204 dissect_file_ext_attr_bits(tvb
, tr
, 0, 0, fid_info
->fsi
->file_attributes
);
4205 dissect_nt_share_access_bits(tvb
, tr
, 0, 0, fid_info
->fsi
->share_access
);
4206 dissect_nt_create_options_bits(tvb
, tr
, 0, 0, fid_info
->fsi
->create_options
);
4207 it
= proto_tree_add_uint(tr
, hf_smb_nt_create_disposition
, tvb
, 0, 0, fid_info
->fsi
->create_disposition
);
4208 proto_item_set_generated(it
);
4216 dissect_open_file_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4221 smb_fid_info_t
*fid_info
= NULL
; /* eo_smb needs to track this info */
4228 fid
= tvb_get_letohs(tvb
, offset
);
4230 fid_info
= dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, true, false, false, si
);
4232 /* This command is used to create and open a new file or open
4233 and truncate an existing file to zero length */
4234 fid_info
->end_of_file
= 0;
4235 if (fid_info
->fsi
) {
4237 fattr
= fid_info
->fsi
->file_attributes
;
4238 /* XXX Volumes considered as directories */
4239 isdir
= (fattr
& SMB_FILE_ATTRIBUTE_DIRECTORY
) || (fattr
& SMB_FILE_ATTRIBUTE_VOLUME
);
4241 fid_info
->type
= SMB_FID_TYPE_FILE
;
4243 fid_info
->type
= SMB_FID_TYPE_DIR
;
4250 /* File Attributes */
4251 offset
= dissect_file_attributes(tvb
, tree
, offset
);
4253 /* last write time */
4254 offset
= dissect_smb_UTIME(tvb
, tree
, offset
, hf_smb_last_write_time
);
4257 proto_tree_add_item(tree
, hf_smb_file_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
4260 /* granted access */
4261 offset
= dissect_access(tvb
, tree
, offset
, hf_smb_granted_access
);
4271 dissect_query_information2_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4280 fid
= tvb_get_letohs(tvb
, offset
);
4281 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
4292 dissect_close_print_file_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4301 fid
= tvb_get_letohs(tvb
, offset
);
4302 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, true, false, si
);
4313 dissect_open_print_file_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4322 fid
= tvb_get_letohs(tvb
, offset
);
4323 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
4334 dissect_create_new_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4343 fid
= tvb_get_letohs(tvb
, offset
);
4344 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, true, false, false, si
);
4355 dissect_flush_file_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4364 fid
= tvb_get_letohs(tvb
, offset
);
4365 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
4376 dissect_create_file_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4381 smb_fid_info_t
*fid_info
= NULL
; /* eo_smb needs to track this info */
4388 fid
= tvb_get_letohs(tvb
, offset
);
4389 fid_info
= dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, true, false, false, si
);
4391 /* This command is used to create and open a new file or open
4392 and truncate an existing file to zero length */
4393 fid_info
->end_of_file
= 0;
4394 if (fid_info
->fsi
) {
4396 fattr
= fid_info
->fsi
->file_attributes
;
4397 /* XXX Volumes considered as directories */
4398 isdir
= (fattr
& SMB_FILE_ATTRIBUTE_DIRECTORY
) || (fattr
& SMB_FILE_ATTRIBUTE_VOLUME
);
4400 fid_info
->type
= SMB_FID_TYPE_FILE
;
4402 fid_info
->type
= SMB_FID_TYPE_DIR
;
4417 dissect_create_file_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4423 smb_fid_saved_info_t
*fsi
; /* eo_smb needs to track this info */
4424 uint32_t file_attributes
= 0;
4426 DISSECTOR_ASSERT(si
);
4430 /* file attributes */
4431 /* We read the two lower bytes into the four-bytes file-attributes, because they are compatible */
4432 file_attributes
= tvb_get_letohs(tvb
, offset
);
4433 offset
= dissect_file_attributes(tvb
, tree
, offset
);
4436 offset
= dissect_smb_UTIME(tvb
, tree
, offset
, hf_smb_create_time
);
4441 CHECK_BYTE_COUNT(1);
4442 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
4446 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
4450 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
4452 COUNT_BYTES(fn_len
);
4454 /* store it for the fid->name/openframe/closeframe matching in
4455 * dissect_smb_fid() called from the response.
4457 if ((!pinfo
->fd
->visited
) && si
->sip
&& fn
) {
4458 fsi
= wmem_new0(wmem_file_scope(), smb_fid_saved_info_t
);
4459 fsi
->filename
= wmem_strdup(wmem_file_scope(), fn
);
4460 fsi
->file_attributes
= file_attributes
;
4462 si
->sip
->extra_info_type
= SMB_EI_FILEDATA
;
4463 si
->sip
->extra_info
= fsi
;
4467 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Path: %s",
4468 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
4476 dissect_close_file_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4484 fid
= tvb_get_letohs(tvb
, offset
);
4485 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, true, false, si
);
4488 /* last write time */
4489 offset
= dissect_smb_UTIME(tvb
, tree
, offset
, hf_smb_last_write_time
);
4499 dissect_delete_file_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4506 DISSECTOR_ASSERT(si
);
4510 /* search attributes */
4511 offset
= dissect_search_attributes(tvb
, tree
, offset
);
4516 CHECK_BYTE_COUNT(1);
4517 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
4521 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
4524 if ((!pinfo
->fd
->visited
) && si
->sip
) {
4525 si
->sip
->extra_info_type
= SMB_EI_FILENAME
;
4526 si
->sip
->extra_info
= wmem_strdup(wmem_file_scope(), fn
);
4531 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
4533 COUNT_BYTES(fn_len
);
4535 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Path: %s",
4536 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
4544 dissect_rename_file_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4547 const char *fn
, *old_name
= NULL
, *new_name
= NULL
;
4550 smb_rename_saved_info_t
*rni
= NULL
;
4552 DISSECTOR_ASSERT(si
);
4556 /* search attributes */
4557 offset
= dissect_search_attributes(tvb
, tree
, offset
);
4562 CHECK_BYTE_COUNT(1);
4563 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
4567 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
4572 proto_tree_add_string(tree
, hf_smb_old_file_name
, tvb
, offset
, fn_len
,
4574 COUNT_BYTES(fn_len
);
4576 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Old Name: %s",
4577 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
4580 CHECK_BYTE_COUNT(1);
4581 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
4585 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
4590 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
4592 COUNT_BYTES(fn_len
);
4594 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", New Name: %s",
4595 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
4599 /* save the offset/len for this transaction */
4600 if (si
->sip
&& !pinfo
->fd
->visited
) {
4601 rni
= wmem_new(wmem_file_scope(), smb_rename_saved_info_t
);
4602 rni
->old_name
= wmem_strdup(wmem_file_scope(), old_name
);
4603 rni
->new_name
= wmem_strdup(wmem_file_scope(), new_name
);
4605 si
->sip
->extra_info_type
= SMB_EI_RENAMEDATA
;
4606 si
->sip
->extra_info
= rni
;
4613 dissect_nt_rename_file_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4620 DISSECTOR_ASSERT(si
);
4624 /* search attributes */
4625 offset
= dissect_search_attributes(tvb
, tree
, offset
);
4627 proto_tree_add_item(tree
, hf_smb_nt_rename_level
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
4630 proto_tree_add_item(tree
, hf_smb_cluster_count
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
4636 CHECK_BYTE_COUNT(1);
4637 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
4641 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
4645 proto_tree_add_string(tree
, hf_smb_old_file_name
, tvb
, offset
, fn_len
,
4647 COUNT_BYTES(fn_len
);
4649 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Old Name: %s",
4650 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
4653 CHECK_BYTE_COUNT(1);
4654 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
4658 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
4662 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
4664 COUNT_BYTES(fn_len
);
4666 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", New Name: %s",
4667 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
4676 dissect_query_information_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4683 DISSECTOR_ASSERT(si
);
4690 CHECK_BYTE_COUNT(1);
4691 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
4695 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
4699 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
4701 COUNT_BYTES(fn_len
);
4703 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Path: %s",
4704 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
4712 dissect_query_information_response(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
4719 /* File Attributes */
4720 offset
= dissect_file_attributes(tvb
, tree
, offset
);
4722 /* Last Write Time */
4723 offset
= dissect_smb_UTIME(tvb
, tree
, offset
, hf_smb_last_write_time
);
4726 proto_tree_add_item(tree
, hf_smb_file_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
4729 /* 10 reserved bytes */
4730 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 10, ENC_NA
);
4741 dissect_set_information_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4748 DISSECTOR_ASSERT(si
);
4752 /* file attributes */
4753 offset
= dissect_file_attributes(tvb
, tree
, offset
);
4755 /* last write time */
4756 offset
= dissect_smb_UTIME(tvb
, tree
, offset
, hf_smb_last_write_time
);
4758 /* 10 reserved bytes */
4759 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 10, ENC_NA
);
4765 CHECK_BYTE_COUNT(1);
4766 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
4770 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
4774 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
4776 COUNT_BYTES(fn_len
);
4778 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Path: %s",
4779 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
4786 typedef struct _rw_info_t
{
4793 dissect_read_file_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4796 uint16_t cnt
= 0, bc
;
4799 rw_info_t
*rwi
= NULL
;
4804 fid
= tvb_get_letohs(tvb
, offset
);
4805 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, (uint16_t) fid
, false, false, false, si
);
4809 cnt
= tvb_get_letohs(tvb
, offset
);
4810 proto_tree_add_item(tree
, hf_smb_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
4814 ofs
= tvb_get_letohl(tvb
, offset
);
4815 proto_tree_add_item(tree
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
4818 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
4819 ", %u byte%s at offset %u", cnt
,
4820 (cnt
== 1) ? "" : "s", ofs
);
4823 proto_tree_add_item(tree
, hf_smb_remaining
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
4826 /* save the offset/len for this transaction */
4827 if (si
->sip
&& !pinfo
->fd
->visited
) {
4828 rwi
= wmem_new(wmem_file_scope(), rw_info_t
);
4832 si
->sip
->extra_info_type
= SMB_EI_RWINFO
;
4833 si
->sip
->extra_info
= rwi
;
4844 dissect_file_data(tvbuff_t
*tvb
, proto_tree
*tree
, int offset
, uint16_t bc
, int dataoffset
, uint16_t datalen
)
4849 /* We have some initial padding bytes. */
4850 /* XXX - use the data offset here instead? */
4851 proto_tree_add_item(tree
, hf_smb_padding
, tvb
, offset
, bc
-datalen
,
4853 offset
+= bc
-datalen
;
4856 tvblen
= tvb_reported_length_remaining(tvb
, dataoffset
> 0 ? dataoffset
: offset
);
4858 proto_tree_add_bytes_format_value(tree
, hf_smb_file_data
, tvb
, dataoffset
> 0 ? dataoffset
: offset
, tvblen
, NULL
, "Incomplete. Only %d of %u bytes", tvblen
, bc
);
4859 if (dataoffset
== -1 || dataoffset
== offset
)
4862 proto_tree_add_item(tree
, hf_smb_file_data
, tvb
, dataoffset
> 0 ? dataoffset
: offset
, bc
, ENC_NA
);
4863 if (dataoffset
== -1 || dataoffset
== offset
)
4870 dissect_file_data_dcerpc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
4871 proto_tree
*top_tree
, int offset
, uint16_t bc
, uint16_t datalen
, uint16_t fid
,
4875 tvbuff_t
*dcerpc_tvb
;
4878 /* We have some initial padding bytes. */
4879 /* XXX - use the data offset here instead? */
4880 proto_tree_add_item(tree
, hf_smb_padding
, tvb
, offset
, bc
-datalen
,
4882 offset
+= bc
-datalen
;
4885 tvblen
= tvb_reported_length_remaining(tvb
, offset
);
4886 dcerpc_tvb
= tvb_new_subset_length_caplen(tvb
, offset
, tvblen
, bc
);
4887 dissect_pipe_dcerpc(dcerpc_tvb
, pinfo
, top_tree
, tree
, fid
, data
);
4896 * transporting DCERPC over SMB seems to be implemented in various
4897 * ways. We might just assume it can be done by an almost random
4898 * mix of Trans/Read/Write calls
4900 * if we suspect dcerpc, just send them all down to packet-smb-pipe.c
4901 * and let him sort them out
4904 dissect_file_data_maybe_dcerpc(tvbuff_t
*tvb
, packet_info
*pinfo
,
4905 proto_tree
*tree
, proto_tree
*top_tree
, int offset
, uint16_t bc
,
4906 int dataoffset
, uint16_t datalen
, uint32_t ofs
, uint16_t fid
, smb_info_t
*si
)
4908 DISSECTOR_ASSERT(si
);
4910 if ( (si
->sip
&& (si
->sip
->flags
& SMB_SIF_TID_IS_IPC
)) && (ofs
== 0) ) {
4912 /* XXX - use the data offset to determine where the data starts? */
4913 return dissect_file_data_dcerpc(tvb
, pinfo
, tree
,
4914 top_tree
, offset
, bc
, datalen
, fid
, si
);
4916 /* ordinary file data */
4917 return dissect_file_data(tvb
, tree
, offset
, bc
, dataoffset
, datalen
);
4922 dissect_read_file_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
4924 uint16_t cnt
= 0, bc
;
4927 uint32_t datalen
= 0, dataoffset
= 0;
4929 rw_info_t
*rwi
= NULL
;
4931 DISSECTOR_ASSERT(si
);
4936 cnt
= tvb_get_letohs(tvb
, offset
);
4937 proto_tree_add_uint(tree
, hf_smb_count
, tvb
, offset
, 2, cnt
);
4940 /* 8 reserved bytes */
4941 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 8, ENC_NA
);
4946 CHECK_BYTE_COUNT(1);
4947 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
4951 CHECK_BYTE_COUNT(2);
4952 proto_tree_add_item(tree
, hf_smb_data_len
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
4953 datalen
= tvb_get_letohs(tvb
, offset
);
4955 dataoffset
= offset
;
4957 /* file data, might be DCERPC on a pipe */
4959 offset
= dissect_file_data_maybe_dcerpc(tvb
, pinfo
, tree
,
4960 top_tree_global
, offset
, bc
, -1, bc
, 0, (uint16_t) fid
, si
);
4964 /* If we have seen the request, then print which FID this refers to */
4965 if ((si
->sip
!= NULL
) && (si
->sip
->frame_req
> 0) && (si
->sip
->extra_info_type
== SMB_EI_FID
)) {
4966 fid
= GPOINTER_TO_INT(si
->sip
->extra_info
);
4969 if (si
->sip
&& (si
->sip
->extra_info_type
== SMB_EI_RWINFO
)) {
4970 rwi
= (rw_info_t
*)si
->sip
->extra_info
;
4975 it
= proto_tree_add_uint64(tree
, hf_smb_file_rw_offset
, tvb
, 0, 0, rwi
->offset
);
4977 proto_item_set_generated(it
);
4978 it
= proto_tree_add_uint(tree
, hf_smb_file_rw_length
, tvb
, 0, 0, rwi
->len
);
4979 proto_item_set_generated(it
);
4981 /* we need the fid for the call to dcerpc below */
4985 /* feed the export object tap listener */
4986 tvblen
= tvb_reported_length_remaining(tvb
, dataoffset
);
4987 if (have_tap_listener(smb_eo_tap
) && (datalen
== tvblen
) && rwi
) {
4988 feed_eo_smb(SMB_COM_READ
, fid
, tvb
, pinfo
, dataoffset
, datalen
, rwi
->len
, rwi
->offset
, si
);
4997 dissect_lock_and_read_response(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
5005 cnt
= tvb_get_letohs(tvb
, offset
);
5006 proto_tree_add_uint(tree
, hf_smb_count
, tvb
, offset
, 2, cnt
);
5009 /* 8 reserved bytes */
5010 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 8, ENC_NA
);
5016 CHECK_BYTE_COUNT(1);
5017 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
5021 CHECK_BYTE_COUNT(2);
5022 proto_tree_add_item(tree
, hf_smb_data_len
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5033 dissect_write_file_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
5036 uint16_t cnt
= 0, bc
, fid
= 0;
5038 rw_info_t
*rwi
= NULL
;
5039 uint32_t datalen
= 0, dataoffset
= 0;
5042 DISSECTOR_ASSERT(si
);
5047 fid
= tvb_get_letohs(tvb
, offset
);
5048 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
5052 cnt
= tvb_get_letohs(tvb
, offset
);
5054 proto_tree_add_uint(tree
, hf_smb_count
, tvb
, offset
, 2, cnt
);
5058 ofs
= tvb_get_letohl(tvb
, offset
);
5059 proto_tree_add_item(tree
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5062 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
5063 ", %u byte%s at offset %u", cnt
,
5064 (cnt
== 1) ? "" : "s", ofs
);
5066 /* save the offset/len for this transaction */
5067 if (si
->sip
&& !pinfo
->fd
->visited
) {
5068 rwi
= wmem_new(wmem_file_scope(), rw_info_t
);
5073 si
->sip
->extra_info_type
= SMB_EI_RWINFO
;
5074 si
->sip
->extra_info
= rwi
;
5076 if (si
->sip
&& (si
->sip
->extra_info_type
== SMB_EI_RWINFO
)) {
5077 rwi
= (rw_info_t
*)si
->sip
->extra_info
;
5082 it
= proto_tree_add_uint64(tree
, hf_smb_file_rw_offset
, tvb
, 0, 0, rwi
->offset
);
5084 proto_item_set_generated(it
);
5085 it
= proto_tree_add_uint(tree
, hf_smb_file_rw_length
, tvb
, 0, 0, rwi
->len
);
5086 proto_item_set_generated(it
);
5090 proto_tree_add_item(tree
, hf_smb_remaining
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5096 CHECK_BYTE_COUNT(1);
5097 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
5101 CHECK_BYTE_COUNT(2);
5102 proto_tree_add_item(tree
, hf_smb_data_len
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5104 dataoffset
= offset
;
5106 /* file data, might be DCERPC on a pipe */
5108 offset
= dissect_file_data_maybe_dcerpc(tvb
, pinfo
, tree
,
5109 top_tree_global
, offset
, bc
, -1, bc
, ofs
, fid
, si
);
5113 /* feed the export object tap listener */
5114 tvblen
= tvb_reported_length_remaining(tvb
, dataoffset
);
5115 if (have_tap_listener(smb_eo_tap
) && (datalen
== tvblen
) && rwi
) {
5116 feed_eo_smb(SMB_COM_WRITE
, fid
, tvb
, pinfo
, dataoffset
, datalen
, rwi
->len
, rwi
->offset
, si
);
5125 dissect_write_file_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
5129 rw_info_t
*rwi
= NULL
;
5131 DISSECTOR_ASSERT(si
);
5136 cnt
= tvb_get_letohs(tvb
, offset
);
5137 proto_tree_add_item(tree
, hf_smb_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5140 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
5141 ", %u byte%s", cnt
, (cnt
== 1) ? "" : "s");
5143 if (si
->sip
&& (si
->sip
->extra_info_type
== SMB_EI_RWINFO
)) {
5144 rwi
= (rw_info_t
*)si
->sip
->extra_info
;
5149 it
= proto_tree_add_uint64(tree
, hf_smb_file_rw_offset
, tvb
, 0, 0, rwi
->offset
);
5151 proto_item_set_generated(it
);
5152 it
= proto_tree_add_uint(tree
, hf_smb_file_rw_length
, tvb
, 0, 0, rwi
->len
);
5153 proto_item_set_generated(it
);
5164 dissect_lock_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
5172 fid
= tvb_get_letohs(tvb
, offset
);
5173 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
5177 proto_tree_add_item(tree
, hf_smb_count
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5181 proto_tree_add_item(tree
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5192 dissect_create_temporary_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
5199 DISSECTOR_ASSERT(si
);
5203 /* 2 reserved bytes */
5204 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
5208 offset
= dissect_smb_UTIME(tvb
, tree
, offset
, hf_smb_create_time
);
5213 CHECK_BYTE_COUNT(1);
5214 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
5220 * MS-CIFS says this is a "null-terminated string", without saying
5221 * it's always ASCII, so we honor the "Unicode strings" flag.
5223 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
5227 proto_tree_add_string(tree
, hf_smb_dir_name
, tvb
, offset
, fn_len
,
5229 COUNT_BYTES(fn_len
);
5231 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Path: %s",
5232 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
5240 dissect_create_temporary_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
5247 DISSECTOR_ASSERT(si
);
5252 fid
= tvb_get_letohs(tvb
, offset
);
5253 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, true, false, false, si
);
5261 * MS-CIFS says "The string SHOULD be a null-terminated array of
5262 * ASCII characters.", so we ignore the "Unicode strings" flag.
5264 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, false, &fn_len
,
5268 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
5270 COUNT_BYTES(fn_len
);
5277 static const value_string seek_mode_vals
[] = {
5278 {0, "From Start Of File"},
5279 {1, "From Current Position"},
5280 {2, "From End Of File"},
5285 dissect_seek_file_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
5293 fid
= tvb_get_letohs(tvb
, offset
);
5294 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
5298 proto_tree_add_item(tree
, hf_smb_seek_mode
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5302 proto_tree_add_item(tree
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5313 dissect_seek_file_response(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
5321 proto_tree_add_item(tree
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5332 dissect_set_information2_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
5340 fid
= tvb_get_letohs(tvb
, offset
);
5341 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
5345 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
5347 hf_smb_create_dos_date
, hf_smb_create_dos_time
, false);
5350 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
5352 hf_smb_access_dos_date
, hf_smb_access_dos_time
, false);
5354 /* last write time */
5355 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
5356 hf_smb_last_write_time
,
5357 hf_smb_last_write_dos_date
, hf_smb_last_write_dos_time
, false);
5367 dissect_query_information2_response(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
5375 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
5377 hf_smb_create_dos_date
, hf_smb_create_dos_time
, false);
5380 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
5382 hf_smb_access_dos_date
, hf_smb_access_dos_time
, false);
5384 /* last write time */
5385 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
5386 hf_smb_last_write_time
,
5387 hf_smb_last_write_dos_date
, hf_smb_last_write_dos_time
, false);
5390 proto_tree_add_item(tree
, hf_smb_data_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5393 /* allocation size */
5394 proto_tree_add_item(tree
, hf_smb_alloc_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5397 /* File Attributes */
5398 offset
= dissect_file_attributes(tvb
, tree
, offset
);
5408 dissect_write_and_close_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
5417 fid
= tvb_get_letohs(tvb
, offset
);
5418 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, true, false, si
);
5422 cnt
= tvb_get_letohs(tvb
, offset
);
5423 proto_tree_add_uint(tree
, hf_smb_count
, tvb
, offset
, 2, cnt
);
5427 proto_tree_add_item(tree
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5430 /* last write time */
5431 offset
= dissect_smb_UTIME(tvb
, tree
, offset
, hf_smb_last_write_time
);
5434 /* 12 reserved bytes */
5435 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 12, ENC_NA
);
5442 CHECK_BYTE_COUNT(1);
5443 proto_tree_add_item(tree
, hf_smb_padding
, tvb
, offset
, 1, ENC_NA
);
5446 offset
= dissect_file_data(tvb
, tree
, offset
, cnt
, -1, cnt
);
5455 dissect_write_and_close_response(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
5463 proto_tree_add_item(tree
, hf_smb_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5473 /* Timeout is defined on page 117 of SMB Protocol Extensions version 2.0
5474 available at http://us1.samba.org/samba/ftp/SMB-info/DOSEXTP.TXT
5477 smbext20_timeout_msecs_to_str(wmem_allocator_t
*scope
, int32_t timeout
)
5480 #define SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN 60
5483 buf
= (char *)wmem_alloc(scope
, SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN
+1);
5485 snprintf(buf
, SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN
+1, "Return immediately (0)");
5486 } else if (timeout
== -1) {
5487 snprintf(buf
, SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN
+1, "Wait indefinitely (-1)");
5488 } else if (timeout
== -2) {
5489 snprintf(buf
, SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN
+1, "Use default timeout (-2)");
5491 snprintf(buf
, SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN
+1, "Unknown reserved value (%d)", timeout
);
5496 return signed_time_msecs_to_str(scope
, timeout
);
5500 dissect_read_raw_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
5509 fid
= tvb_get_letohs(tvb
, offset
);
5510 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
5514 proto_tree_add_item(tree
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5518 proto_tree_add_item(tree
, hf_smb_max_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5522 proto_tree_add_item(tree
, hf_smb_min_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5526 to
= tvb_get_letohl(tvb
, offset
);
5527 proto_tree_add_uint_format_value(tree
, hf_smb_timeout
, tvb
, offset
, 4, to
, "%s", smbext20_timeout_msecs_to_str(pinfo
->pool
, to
));
5530 /* 2 reserved bytes */
5531 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
5536 proto_tree_add_item(tree
, hf_smb_high_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5548 dissect_query_information_disk_response(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
5556 proto_tree_add_item(tree
, hf_smb_units
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5560 proto_tree_add_item(tree
, hf_smb_bpu
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5564 proto_tree_add_item(tree
, hf_smb_blocksize
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5568 proto_tree_add_item(tree
, hf_smb_freeunits
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5571 /* 2 reserved bytes */
5572 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
5583 dissect_read_mpx_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
5591 fid
= tvb_get_letohs(tvb
, offset
);
5592 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
5596 proto_tree_add_item(tree
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5600 proto_tree_add_item(tree
, hf_smb_max_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5604 proto_tree_add_item(tree
, hf_smb_min_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5607 /* 6 reserved bytes */
5608 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 6, ENC_NA
);
5619 dissect_read_mpx_response(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
5621 uint16_t datalen
= 0, bc
;
5627 proto_tree_add_item(tree
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5631 proto_tree_add_item(tree
, hf_smb_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5634 /* 2 reserved bytes */
5635 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
5638 /* data compaction mode */
5639 proto_tree_add_item(tree
, hf_smb_dcm
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5642 /* 2 reserved bytes */
5643 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
5647 datalen
= tvb_get_letohs(tvb
, offset
);
5648 proto_tree_add_uint(tree
, hf_smb_data_len
, tvb
, offset
, 2, datalen
);
5652 proto_tree_add_item(tree
, hf_smb_data_offset
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5658 /* XXX - use the data offset to determine where the data starts? */
5659 offset
= dissect_file_data(tvb
, tree
, offset
, bc
, -1, datalen
);
5668 static const true_false_string tfs_write_mode_write_through
= {
5669 "WRITE THROUGH requested",
5670 "Write through not requested"
5672 static const true_false_string tfs_write_mode_return_remaining
= {
5673 "RETURN REMAINING (pipe/dev) requested",
5674 "DON'T return remaining (pipe/dev)"
5676 static const true_false_string tfs_write_mode_raw
= {
5677 "Use WriteRawNamedPipe (pipe)",
5678 "DON'T use WriteRawNamedPipe (pipe)"
5680 static const true_false_string tfs_write_mode_message_start
= {
5681 "This is the START of a MESSAGE (pipe)",
5682 "This is NOT the start of a message (pipe)"
5684 static const true_false_string tfs_write_mode_connectionless
= {
5685 "CONNECTIONLESS mode requested",
5686 "Connectionless mode NOT requested"
5689 #define WRITE_MODE_CONNECTIONLESS 0x0080
5690 #define WRITE_MODE_MESSAGE_START 0x0008
5691 #define WRITE_MODE_RAW 0x0004
5692 #define WRITE_MODE_RETURN_REMAINING 0x0002
5693 #define WRITE_MODE_WRITE_THROUGH 0x0001
5696 dissect_write_mode(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, int bm
)
5702 mask
= tvb_get_letohs(tvb
, offset
);
5705 item
= proto_tree_add_item(parent_tree
, hf_smb_write_mode
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5706 tree
= proto_item_add_subtree(item
, ett_smb_rawmode
);
5708 if (bm
&WRITE_MODE_CONNECTIONLESS
) {
5709 proto_tree_add_boolean(tree
, hf_smb_write_mode_connectionless
,
5710 tvb
, offset
, 2, mask
);
5712 if (bm
&WRITE_MODE_MESSAGE_START
) {
5713 proto_tree_add_boolean(tree
, hf_smb_write_mode_message_start
,
5714 tvb
, offset
, 2, mask
);
5716 if (bm
&WRITE_MODE_RAW
) {
5717 proto_tree_add_boolean(tree
, hf_smb_write_mode_raw
,
5718 tvb
, offset
, 2, mask
);
5720 if (bm
&WRITE_MODE_RETURN_REMAINING
) {
5721 proto_tree_add_boolean(tree
, hf_smb_write_mode_return_remaining
,
5722 tvb
, offset
, 2, mask
);
5724 if (bm
&WRITE_MODE_WRITE_THROUGH
) {
5725 proto_tree_add_boolean(tree
, hf_smb_write_mode_write_through
,
5726 tvb
, offset
, 2, mask
);
5735 dissect_write_raw_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
5738 uint16_t datalen
= 0, bc
, fid
;
5744 fid
= tvb_get_letohs(tvb
, offset
);
5745 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
5748 /* total data length */
5749 proto_tree_add_item(tree
, hf_smb_total_data_len
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5752 /* 2 reserved bytes */
5753 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
5757 proto_tree_add_item(tree
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5761 to
= tvb_get_letohl(tvb
, offset
);
5762 proto_tree_add_uint_format_value(tree
, hf_smb_timeout
, tvb
, offset
, 4, to
, "%s", smbext20_timeout_msecs_to_str(pinfo
->pool
, to
));
5766 offset
= dissect_write_mode(tvb
, tree
, offset
, 0x0003);
5768 /* 4 reserved bytes */
5769 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 4, ENC_NA
);
5773 datalen
= tvb_get_letohs(tvb
, offset
);
5774 proto_tree_add_uint(tree
, hf_smb_data_len
, tvb
, offset
, 2, datalen
);
5778 proto_tree_add_item(tree
, hf_smb_data_offset
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5784 /* XXX - use the data offset to determine where the data starts? */
5785 offset
= dissect_file_data(tvb
, tree
, offset
, bc
, -1, datalen
);
5794 dissect_write_raw_response(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
5802 proto_tree_add_item(tree
, hf_smb_remaining
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5813 dissect_write_mpx_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
5816 uint16_t datalen
= 0, bc
, fid
;
5822 fid
= tvb_get_letohs(tvb
, offset
);
5823 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
5826 /* total data length */
5827 proto_tree_add_item(tree
, hf_smb_total_data_len
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5830 /* 2 reserved bytes */
5831 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
5835 proto_tree_add_item(tree
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5839 to
= tvb_get_letohl(tvb
, offset
);
5840 proto_tree_add_uint_format_value(tree
, hf_smb_timeout
, tvb
, offset
, 4, to
, "%s", smbext20_timeout_msecs_to_str(pinfo
->pool
, to
));
5844 offset
= dissect_write_mode(tvb
, tree
, offset
, 0x0083);
5847 proto_tree_add_item(tree
, hf_smb_request_mask
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5851 datalen
= tvb_get_letohs(tvb
, offset
);
5852 proto_tree_add_uint(tree
, hf_smb_data_len
, tvb
, offset
, 2, datalen
);
5856 proto_tree_add_item(tree
, hf_smb_data_offset
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
5862 /* XXX - use the data offset to determine where the data starts? */
5863 offset
= dissect_file_data(tvb
, tree
, offset
, bc
, -1,datalen
);
5872 dissect_write_mpx_response(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
5880 proto_tree_add_item(tree
, hf_smb_response_mask
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
5891 dissect_search_id(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
5900 proto_tree_add_item_ret_uint(tree
, hf_smb_search_id
, tvb
, offset
, 2,
5901 ENC_LITTLE_ENDIAN
, &search_id
);
5902 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Search ID: %u", (uint16_t)search_id
);
5913 dissect_search_resume_key(tvbuff_t
*tvb
, packet_info
*pinfo
,
5914 proto_tree
*parent_tree
, int offset
, uint16_t *bcp
, bool *trunc
,
5915 bool has_find_id
, smb_info_t
*si
)
5921 DISSECTOR_ASSERT(si
);
5923 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, 21,
5924 ett_smb_search_resume_key
, NULL
, "Resume Key");
5927 CHECK_BYTE_COUNT_SUBR(1);
5928 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
5929 COUNT_BYTES_SUBR(1);
5933 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, false/*never Unicode*/, &fn_len
,
5935 CHECK_STRING_SUBR(fn
);
5936 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, 11, fn
);
5937 COUNT_BYTES_SUBR(fn_len
);
5940 CHECK_BYTE_COUNT_SUBR(1);
5941 proto_tree_add_item(tree
, hf_smb_resume_find_id
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
5942 COUNT_BYTES_SUBR(1);
5945 CHECK_BYTE_COUNT_SUBR(4);
5946 proto_tree_add_item(tree
, hf_smb_resume_server_cookie
, tvb
, offset
, 4, ENC_NA
);
5947 COUNT_BYTES_SUBR(4);
5950 CHECK_BYTE_COUNT_SUBR(5);
5951 proto_tree_add_item(tree
, hf_smb_resume_server_cookie
, tvb
, offset
, 5, ENC_NA
);
5952 COUNT_BYTES_SUBR(5);
5956 CHECK_BYTE_COUNT_SUBR(4);
5957 proto_tree_add_item(tree
, hf_smb_resume_client_cookie
, tvb
, offset
, 4, ENC_NA
);
5958 COUNT_BYTES_SUBR(4);
5965 dissect_search_dir_info(tvbuff_t
*tvb
, packet_info
*pinfo
,
5966 proto_tree
*parent_tree
, int offset
, uint16_t *bcp
, bool *trunc
,
5967 bool has_find_id
, smb_info_t
*si
)
5973 DISSECTOR_ASSERT(si
);
5975 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, 43,
5976 ett_smb_search_dir_info
, NULL
, "Directory Information");
5979 offset
= dissect_search_resume_key(tvb
, pinfo
, tree
, offset
, bcp
,
5980 trunc
, has_find_id
, si
);
5984 /* File Attributes */
5985 CHECK_BYTE_COUNT_SUBR(1);
5986 offset
= dissect_dir_info_file_attributes(tvb
, tree
, offset
);
5989 /* last write time */
5990 CHECK_BYTE_COUNT_SUBR(4);
5991 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
5992 hf_smb_last_write_time
,
5993 hf_smb_last_write_dos_date
, hf_smb_last_write_dos_time
,
5998 CHECK_BYTE_COUNT_SUBR(4);
5999 proto_tree_add_item(tree
, hf_smb_file_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
6000 COUNT_BYTES_SUBR(4);
6003 /* [MS-CIFS] says this is 13 *bytes*, and also says "Unicode is
6004 not supported; names are returned in the extended ASCII
6005 (OEM) character set only." */
6007 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, false/*Never Unicode*/, &fn_len
,
6009 CHECK_STRING_SUBR(fn
);
6010 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
, fn
);
6011 COUNT_BYTES_SUBR(fn_len
);
6019 dissect_search_find_request(tvbuff_t
*tvb
, packet_info
*pinfo
,
6020 proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
,
6030 DISSECTOR_ASSERT(si
);
6035 proto_tree_add_item(tree
, hf_smb_max_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
6038 /* Search Attributes */
6039 offset
= dissect_search_attributes(tvb
, tree
, offset
);
6044 CHECK_BYTE_COUNT(1);
6045 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
6049 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
6053 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
6055 COUNT_BYTES(fn_len
);
6057 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", File: %s",
6058 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
6061 CHECK_BYTE_COUNT(1);
6062 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
6065 /* resume key length */
6066 CHECK_BYTE_COUNT(2);
6067 rkl
= tvb_get_letohs(tvb
, offset
);
6068 proto_tree_add_uint(tree
, hf_smb_resume_key_len
, tvb
, offset
, 2, rkl
);
6073 offset
= dissect_search_resume_key(tvb
, pinfo
, tree
, offset
,
6074 &bc
, &trunc
, has_find_id
, si
);
6085 dissect_search_dir_request(tvbuff_t
*tvb
, packet_info
*pinfo
,
6086 proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
6088 return dissect_search_find_request(tvb
, pinfo
, tree
, offset
,
6089 smb_tree
, si
, false);
6093 dissect_find_request(tvbuff_t
*tvb
, packet_info
*pinfo
,
6094 proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
6096 return dissect_search_find_request(tvb
, pinfo
, tree
, offset
,
6097 smb_tree
, si
, true);
6101 dissect_find_close_request(tvbuff_t
*tvb
, packet_info
*pinfo
,
6102 proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
6104 return dissect_search_find_request(tvb
, pinfo
, tree
, offset
,
6105 smb_tree
, si
, true);
6109 dissect_search_find_response(tvbuff_t
*tvb
, packet_info
*pinfo
,
6110 proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
,
6111 bool has_find_id
, smb_info_t
*si
)
6121 count
= tvb_get_letohs(tvb
, offset
);
6122 proto_tree_add_uint(tree
, hf_smb_count
, tvb
, offset
, 2, count
);
6128 CHECK_BYTE_COUNT(1);
6129 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
6133 CHECK_BYTE_COUNT(2);
6134 proto_tree_add_item(tree
, hf_smb_data_len
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
6138 offset
= dissect_search_dir_info(tvb
, pinfo
, tree
, offset
,
6139 &bc
, &trunc
, has_find_id
, si
);
6150 dissect_search_dir_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
6152 return dissect_search_find_response(tvb
, pinfo
, tree
, offset
, smb_tree
,
6157 dissect_find_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
6159 return dissect_search_find_response(tvb
, pinfo
, tree
, offset
, smb_tree
,
6164 dissect_find_close_response(tvbuff_t
*tvb
, packet_info
*pinfo _U_
,
6165 proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
6174 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
6180 CHECK_BYTE_COUNT(1);
6181 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
6185 CHECK_BYTE_COUNT(2);
6186 data_len
= tvb_get_ntohs(tvb
, offset
);
6187 proto_tree_add_uint(tree
, hf_smb_data_len
, tvb
, offset
, 2, data_len
);
6190 if (data_len
!= 0) {
6191 CHECK_BYTE_COUNT(data_len
);
6192 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
,
6194 COUNT_BYTES(data_len
);
6202 static const value_string locking_ol_vals
[] = {
6203 {0, "Client is not holding oplock on this file"},
6204 {1, "Level 2 oplock currently held by client"},
6208 static const true_false_string tfs_lock_type_large
= {
6209 "Large file locking format requested",
6210 "Large file locking format not requested"
6212 static const true_false_string tfs_lock_type_cancel
= {
6213 "Cancel outstanding lock request",
6214 "Don't cancel outstanding lock request"
6216 static const true_false_string tfs_lock_type_change
= {
6218 "Don't change lock type"
6220 static const true_false_string tfs_lock_type_oplock
= {
6221 "This is an oplock break notification/response",
6222 "This is not an oplock break notification/response"
6224 static const true_false_string tfs_lock_type_shared
= {
6225 "This is a shared lock",
6226 "This is an exclusive lock"
6229 dissect_locking_andx_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
6231 uint8_t wc
, cmd
= 0xff, lt
= 0, ol
= 0;
6232 uint16_t andxoffset
= 0, un
= 0, ln
= 0, bc
, fid
, num_lock
= 0, num_unlock
= 0;
6234 proto_item
*it
= NULL
;
6235 proto_tree
*tr
= NULL
;
6236 int old_offset
= offset
;
6237 smb_locking_saved_info_t
*ld
= NULL
;
6238 static int * const locks
[] = {
6239 &hf_smb_lock_type_large
,
6240 &hf_smb_lock_type_cancel
,
6241 &hf_smb_lock_type_change
,
6242 &hf_smb_lock_type_oplock
,
6243 &hf_smb_lock_type_shared
,
6247 DISSECTOR_ASSERT(si
);
6251 /* next smb command */
6252 cmd
= tvb_get_uint8(tvb
, offset
);
6254 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
6256 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
6261 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
6265 andxoffset
= tvb_get_letohs(tvb
, offset
);
6266 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
6270 fid
= tvb_get_letohs(tvb
, offset
);
6271 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
6275 lt
= tvb_get_uint8(tvb
, offset
);
6276 proto_tree_add_bitmask(tree
, tvb
, offset
, hf_smb_lock_type
, ett_smb_lock_type
, locks
, ENC_NA
);
6280 ol
= tvb_get_uint8(tvb
, offset
);
6281 proto_tree_add_item(tree
, hf_smb_locking_ol
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
6285 to
= tvb_get_letohl(tvb
, offset
);
6286 proto_tree_add_uint_format_value(tree
, hf_smb_timeout
, tvb
, offset
, 4, to
, "%s", smbext20_timeout_msecs_to_str(pinfo
->pool
, to
));
6289 /* number of unlocks */
6290 un
= tvb_get_letohs(tvb
, offset
);
6292 proto_tree_add_uint(tree
, hf_smb_number_of_unlocks
, tvb
, offset
, 2, un
);
6295 /* number of locks */
6296 ln
= tvb_get_letohs(tvb
, offset
);
6298 proto_tree_add_uint(tree
, hf_smb_number_of_locks
, tvb
, offset
, 2, ln
);
6303 /* store the locking data for the response */
6304 if ((!pinfo
->fd
->visited
) && si
->sip
) {
6305 ld
= wmem_new(wmem_file_scope(), smb_locking_saved_info_t
);
6307 ld
->oplock_level
= ol
;
6308 ld
->num_lock
= num_lock
;
6309 ld
->num_unlock
= num_unlock
;
6312 si
->sip
->extra_info_type
= SMB_EI_LOCKDATA
;
6313 si
->sip
->extra_info
= ld
;
6318 old_offset
= offset
;
6320 tr
= proto_tree_add_subtree(tree
, tvb
, offset
, -1, ett_smb_unlocks
, &it
, "Unlocks");
6322 proto_tree
*ltree_2
;
6326 uint64_t lock_offset
;
6327 uint64_t lock_length
;
6329 /* large lock format */
6330 ltree_2
= proto_tree_add_subtree(tr
, tvb
, offset
, 20, ett_smb_unlock
, NULL
, "Unlock");
6333 CHECK_BYTE_COUNT(2);
6334 lock_pid
= tvb_get_letohs(tvb
, offset
);
6335 proto_tree_add_item(ltree_2
, hf_smb_pid
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
6338 /* 2 reserved bytes */
6339 CHECK_BYTE_COUNT(2);
6340 proto_tree_add_item(ltree_2
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
6344 CHECK_BYTE_COUNT(8);
6345 val
= ((uint64_t)tvb_get_letohl(tvb
, offset
)) << 32
6346 | tvb_get_letohl(tvb
, offset
+4);
6348 proto_tree_add_uint64(ltree_2
, hf_smb_lock_long_offset
, tvb
, offset
, 8, val
);
6352 CHECK_BYTE_COUNT(8);
6353 val
= ((uint64_t)tvb_get_letohl(tvb
, offset
)) << 32
6354 | tvb_get_letohl(tvb
, offset
+4);
6356 proto_tree_add_uint64(ltree_2
, hf_smb_lock_long_length
, tvb
, offset
, 8, val
);
6359 /* remember the unlock for the reply */
6361 smb_lock_info_t
*li
;
6362 li
= wmem_new(wmem_file_scope(), smb_lock_info_t
);
6363 li
->next
= ld
->unlocks
;
6366 li
->offset
= lock_offset
;
6367 li
->length
= lock_length
;
6370 /* normal lock format */
6371 ltree_2
= proto_tree_add_subtree(tr
, tvb
, offset
, 10, ett_smb_unlock
, NULL
, "Unlock");
6374 CHECK_BYTE_COUNT(2);
6375 proto_tree_add_item(ltree_2
, hf_smb_pid
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
6379 CHECK_BYTE_COUNT(4);
6380 proto_tree_add_item(ltree_2
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
6384 CHECK_BYTE_COUNT(4);
6385 proto_tree_add_item(ltree_2
, hf_smb_count
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
6389 proto_item_set_len(it
, offset
-old_offset
);
6395 old_offset
= offset
;
6397 tr
= proto_tree_add_subtree(tree
, tvb
, offset
, -1, ett_smb_locks
, &it
, "Locks");
6399 proto_tree
*ltree_2
;
6403 uint64_t lock_offset
;
6404 uint64_t lock_length
;
6406 /* large lock format */
6407 ltree_2
= proto_tree_add_subtree(tr
, tvb
, offset
, 20, ett_smb_lock
, NULL
, "Lock");
6410 CHECK_BYTE_COUNT(2);
6411 lock_pid
= tvb_get_letohs(tvb
, offset
);
6412 proto_tree_add_item(ltree_2
, hf_smb_pid
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
6415 /* 2 reserved bytes */
6416 CHECK_BYTE_COUNT(2);
6417 proto_tree_add_item(ltree_2
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
6421 CHECK_BYTE_COUNT(8);
6422 val
= ((uint64_t)tvb_get_letohl(tvb
, offset
)) << 32
6423 | tvb_get_letohl(tvb
, offset
+4);
6425 proto_tree_add_uint64(ltree_2
, hf_smb_lock_long_offset
, tvb
, offset
, 8, val
);
6429 CHECK_BYTE_COUNT(8);
6430 val
= ((uint64_t)tvb_get_letohl(tvb
, offset
)) << 32
6431 | tvb_get_letohl(tvb
, offset
+4);
6433 proto_tree_add_uint64(ltree_2
, hf_smb_lock_long_length
, tvb
, offset
, 8, val
);
6436 /* remember the lock for the reply */
6438 smb_lock_info_t
*li
;
6439 li
= wmem_new(wmem_file_scope(), smb_lock_info_t
);
6440 li
->next
= ld
->locks
;
6443 li
->offset
= lock_offset
;
6444 li
->length
= lock_length
;
6447 /* normal lock format */
6448 ltree_2
= proto_tree_add_subtree(tr
, tvb
, offset
, 10, ett_smb_lock
, NULL
, "Lock");
6451 CHECK_BYTE_COUNT(2);
6452 proto_tree_add_item(ltree_2
, hf_smb_pid
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
6456 CHECK_BYTE_COUNT(4);
6457 proto_tree_add_item(ltree_2
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
6461 CHECK_BYTE_COUNT(4);
6462 proto_tree_add_item(ltree_2
, hf_smb_count
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
6466 proto_item_set_len(it
, offset
-old_offset
);
6474 * We ran out of byte count in the middle of dissecting
6475 * the locks or the unlocks; set the site of the item
6476 * we were dissecting.
6478 proto_item_set_len(it
, offset
-old_offset
);
6481 if (cmd
!= 0xff) { /* there is an andX command */
6482 if (andxoffset
< offset
) {
6483 THROW(ReportedBoundsError
);
6485 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
6492 dissect_locking_andx_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
6494 uint8_t wc
, cmd
= 0xff;
6495 uint16_t andxoffset
= 0;
6498 DISSECTOR_ASSERT(si
);
6500 /* print the lock info from the request */
6501 if ((si
->sip
!= NULL
) && (si
->sip
->extra_info_type
== SMB_EI_LOCKDATA
)) {
6502 smb_locking_saved_info_t
*ld
;
6503 proto_item
*litem
= NULL
;
6504 proto_tree
*ltree
= NULL
;
6506 ld
= (smb_locking_saved_info_t
*)si
->sip
->extra_info
;
6509 smb_lock_info_t
*li
;
6511 litem
= proto_tree_add_uint(tree
, hf_smb_lock_type
, tvb
, 0, 0, ld
->type
);
6512 proto_item_set_generated(litem
);
6513 ltree
= proto_item_add_subtree(litem
, ett_smb_lock_type
);
6515 proto_tree_add_boolean(ltree
, hf_smb_lock_type_large
, tvb
, 0, 0, ld
->type
);
6516 proto_tree_add_boolean(ltree
, hf_smb_lock_type_cancel
, tvb
, 0, 0, ld
->type
);
6517 proto_tree_add_boolean(ltree
, hf_smb_lock_type_change
, tvb
, 0, 0, ld
->type
);
6518 proto_tree_add_boolean(ltree
, hf_smb_lock_type_oplock
, tvb
, 0, 0, ld
->type
);
6519 proto_tree_add_boolean(ltree
, hf_smb_lock_type_shared
, tvb
, 0, 0, ld
->type
);
6520 proto_tree_add_uint(ltree
, hf_smb_locking_ol
, tvb
, 0, 0, ld
->oplock_level
);
6521 proto_tree_add_uint(ltree
, hf_smb_number_of_unlocks
, tvb
, 0, 0, ld
->num_unlock
);
6522 proto_tree_add_uint(ltree
, hf_smb_number_of_locks
, tvb
, 0, 0, ld
->num_lock
);
6524 ltr
= proto_tree_add_subtree(ltree
, tvb
, 0, 0, ett_smb_lock
, NULL
, "Locks");
6527 proto_tree_add_uint(ltr
, hf_smb_pid
, tvb
, 0, 0, li
->pid
);
6528 proto_tree_add_uint64(ltr
, hf_smb_lock_long_offset
, tvb
, 0, 0, li
->offset
);
6529 proto_tree_add_uint64(ltr
, hf_smb_lock_long_length
, tvb
, 0, 0, li
->length
);
6532 ltr
= proto_tree_add_subtree(ltree
, tvb
, 0, 0, ett_smb_unlock
, NULL
, "Unlocks");
6535 proto_tree_add_uint(ltr
, hf_smb_pid
, tvb
, 0, 0, li
->pid
);
6536 proto_tree_add_uint64(ltr
, hf_smb_lock_long_offset
, tvb
, 0, 0, li
->offset
);
6537 proto_tree_add_uint64(ltr
, hf_smb_lock_long_length
, tvb
, 0, 0, li
->length
);
6546 /* next smb command */
6547 cmd
= tvb_get_uint8(tvb
, offset
);
6549 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
6551 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
6556 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
6560 andxoffset
= tvb_get_letohs(tvb
, offset
);
6561 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
6568 if (cmd
!= 0xff) { /* there is an andX command */
6569 if (andxoffset
< offset
) {
6570 THROW(ReportedBoundsError
);
6572 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
6579 const value_string oa_open_vals
[] = {
6580 { 0, "No action taken?"},
6581 { 1, "The file existed and was opened"},
6582 { 2, "The file did not exist but was created"},
6583 { 3, "The file existed and was truncated"},
6584 { 0x8001, "The file existed and was opened, and an OpLock was granted"},
6585 { 0x8002, "The file did not exist but was created, and an OpLock was granted"},
6586 { 0x8003, "The file existed and was truncated, and an OpLock was granted"},
6589 static const true_false_string tfs_oa_lock
= {
6590 "File is currently opened only by this user",
6591 "File is opened by another user (or mode not supported by server)"
6594 dissect_open_action(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
6596 static int * const flags
[] = {
6597 &hf_smb_open_action_lock
,
6598 &hf_smb_open_action_open
,
6602 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_open_action
, ett_smb_open_action
, flags
, ENC_LITTLE_ENDIAN
);
6608 static const true_false_string tfs_open_flags_add_info
= {
6609 "Additional information requested",
6610 "Additional information not requested"
6612 static const true_false_string tfs_open_flags_ex_oplock
= {
6613 "Exclusive oplock requested",
6614 "Exclusive oplock not requested"
6616 static const true_false_string tfs_open_flags_batch_oplock
= {
6617 "Batch oplock requested",
6618 "Batch oplock not requested"
6620 static const true_false_string tfs_open_flags_ealen
= {
6621 "Total length of EAs requested",
6622 "Total length of EAs not requested"
6625 dissect_open_flags(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, int bm
)
6631 mask
= tvb_get_letohs(tvb
, offset
);
6634 item
= proto_tree_add_item(parent_tree
, hf_smb_open_flags
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
6635 tree
= proto_item_add_subtree(item
, ett_smb_open_flags
);
6638 proto_tree_add_boolean(tree
, hf_smb_open_flags_add_info
,
6639 tvb
, offset
, 2, mask
);
6642 proto_tree_add_boolean(tree
, hf_smb_open_flags_ex_oplock
,
6643 tvb
, offset
, 2, mask
);
6646 proto_tree_add_boolean(tree
, hf_smb_open_flags_batch_oplock
,
6647 tvb
, offset
, 2, mask
);
6650 proto_tree_add_boolean(tree
, hf_smb_open_flags_ealen
,
6651 tvb
, offset
, 2, mask
);
6660 /* [MS-CIFS].pdf 2.2.4.64.2 provides the last two file types, however
6661 [MS-SMB].PDF 2.2.4.9.2 elides value 4, Character mode device. */
6662 static const value_string filetype_vals
[] = {
6663 { 0, "Disk file or directory"},
6664 { 1, "Named pipe in byte mode"},
6665 { 2, "Named pipe in message mode"},
6666 { 3, "Spooled printer"},
6667 { 4, "Character mode device"},
6668 { 0xFFFF, "Unknown file type"},
6672 dissect_open_andx_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
6674 uint8_t wc
, cmd
= 0xff;
6675 uint16_t andxoffset
= 0, bc
;
6680 DISSECTOR_ASSERT(si
);
6684 /* next smb command */
6685 cmd
= tvb_get_uint8(tvb
, offset
);
6687 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
6689 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
6694 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
6698 andxoffset
= tvb_get_letohs(tvb
, offset
);
6699 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
6703 offset
= dissect_open_flags(tvb
, tree
, offset
, 0x0007);
6705 /* desired access */
6706 offset
= dissect_access(tvb
, tree
, offset
, hf_smb_desired_access
);
6708 /* Search Attributes */
6709 offset
= dissect_search_attributes(tvb
, tree
, offset
);
6711 /* File Attributes */
6712 offset
= dissect_file_attributes(tvb
, tree
, offset
);
6715 offset
= dissect_smb_UTIME(tvb
, tree
, offset
, hf_smb_create_time
);
6718 offset
= dissect_open_function(tvb
, tree
, offset
);
6720 /* allocation size */
6721 proto_tree_add_item(tree
, hf_smb_alloc_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
6724 /* timeout, described at http://us1.samba.org/samba/ftp/SMB-info/DOSEXTP.TXT */
6725 to
= tvb_get_letohl(tvb
, offset
);
6726 proto_tree_add_uint_format_value(tree
, hf_smb_timeout
, tvb
, offset
, 4, to
, "%s", smbext20_timeout_msecs_to_str(pinfo
->pool
, to
));
6729 /* 4 reserved bytes */
6730 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 4, ENC_NA
);
6736 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
6740 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
6742 COUNT_BYTES(fn_len
);
6744 /* Copied this portion of code from create_andx_request
6745 to guarantee that fsi and si->sip are always correctly filled out */
6746 if ((!pinfo
->fd
->visited
) && si
->sip
&& fn
) {
6747 smb_fid_saved_info_t
*fsi
;
6749 fsi
= wmem_new0(wmem_file_scope(), smb_fid_saved_info_t
);
6750 fsi
->filename
= wmem_strdup(wmem_file_scope(), fn
);
6752 si
->sip
->extra_info_type
= SMB_EI_FILEDATA
;
6753 si
->sip
->extra_info
= fsi
;
6756 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Path: %s",
6757 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
6761 if (cmd
!= 0xff) { /* there is an andX command */
6762 if (andxoffset
< offset
) {
6763 THROW(ReportedBoundsError
);
6765 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
6771 static const true_false_string tfs_ipc_state_nonblocking
= {
6772 "Reads/writes return immediately if no data available",
6773 "Reads/writes block if no data available"
6775 static const value_string ipc_state_endpoint_vals
[] = {
6776 { 0, "Consumer end of pipe"},
6777 { 1, "Server end of pipe"},
6780 static const value_string ipc_state_pipe_type_vals
[] = {
6781 { 0, "Byte stream pipe"},
6782 { 1, "Message pipe"},
6785 static const value_string ipc_state_read_mode_vals
[] = {
6786 { 0, "Read pipe as a byte stream"},
6787 { 1, "Read messages from pipe"},
6792 dissect_ipc_state(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, bool setstate_flag
)
6794 static int * const setstate_flags
[] = {
6795 &hf_smb_ipc_state_nonblocking
,
6796 &hf_smb_ipc_state_read_mode
,
6799 static int * const not_setstate_flags
[] = {
6800 &hf_smb_ipc_state_nonblocking
,
6801 &hf_smb_ipc_state_endpoint
,
6802 &hf_smb_ipc_state_pipe_type
,
6803 &hf_smb_ipc_state_read_mode
,
6804 &hf_smb_ipc_state_icount
,
6808 if (!setstate_flag
) {
6809 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_ipc_state
, ett_smb_ipc_state
, not_setstate_flags
, ENC_LITTLE_ENDIAN
);
6811 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_ipc_state
, ett_smb_ipc_state
, setstate_flags
, ENC_LITTLE_ENDIAN
);
6819 dissect_open_andx_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
6821 uint8_t wc
, cmd
= 0xff;
6822 uint16_t andxoffset
= 0, bc
;
6826 smb_fid_info_t
*fid_info
= NULL
;
6831 /* next smb command */
6832 cmd
= tvb_get_uint8(tvb
, offset
);
6834 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
6836 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
6841 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
6845 andxoffset
= tvb_get_letohs(tvb
, offset
);
6846 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
6850 fid
= tvb_get_letohs(tvb
, offset
);
6851 /* we add fid_info= to this call so that we save the result */
6852 fid_info
= dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, true, false, false, si
);
6856 /* File Attributes */
6857 fattr
= tvb_get_letohs(tvb
, offset
);
6858 isdir
= fattr
& SMB_FILE_ATTRIBUTE_DIRECTORY
;
6859 offset
= dissect_file_attributes(tvb
, tree
, offset
);
6861 /* last write time */
6862 offset
= dissect_smb_UTIME(tvb
, tree
, offset
, hf_smb_last_write_time
);
6865 /* We store the file_size in the fid_info */
6867 fid_info
->end_of_file
= (uint64_t) tvb_get_letohl(tvb
, offset
);
6869 proto_tree_add_item(tree
, hf_smb_file_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
6872 /* granted access */
6873 offset
= dissect_access(tvb
, tree
, offset
, hf_smb_granted_access
);
6876 ftype
= tvb_get_letohs(tvb
, offset
);
6877 proto_tree_add_item(tree
, hf_smb_file_type
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
6879 /* Copied from dissect_nt_create_andx_response
6880 Try to remember the type of this fid so that we can dissect
6881 any future security descriptor (access mask) properly
6884 fid_info
->type
= SMB_FID_TYPE_UNKNOWN
;
6889 fid_info
->type
= SMB_FID_TYPE_FILE
;
6893 fid_info
->type
= SMB_FID_TYPE_DIR
;
6897 if ((ftype
== 2) || (ftype
== 1)) {
6899 fid_info
->type
= SMB_FID_TYPE_PIPE
;
6904 offset
= dissect_ipc_state(tvb
, tree
, offset
, false);
6907 offset
= dissect_open_action(tvb
, tree
, offset
);
6910 proto_tree_add_item(tree
, hf_smb_server_fid
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
6913 /* 2 reserved bytes */
6914 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
6917 /* [MS-SMB] 2.2.4.1.2 Server Response Extensions */
6919 proto_tree
*tr
= NULL
;
6921 tr
= proto_tree_add_subtree(tree
, tvb
, offset
, 4,
6922 ett_smb_nt_access_mask
, NULL
, "Maximal Access Rights");
6923 offset
= dissect_smb_access_mask(tvb
, tr
, offset
);
6925 tr
= proto_tree_add_subtree(tree
, tvb
, offset
, 4,
6926 ett_smb_nt_access_mask
, NULL
, "Guest Maximal Access Rights");
6927 offset
= dissect_smb_access_mask(tvb
, tr
, offset
);
6934 if (cmd
!= 0xff) { /* there is an andX command */
6935 if (andxoffset
< offset
) {
6936 THROW(ReportedBoundsError
);
6938 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
6945 dissect_read_andx_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
6947 uint8_t wc
, cmd
= 0xff;
6948 uint16_t andxoffset
= 0, bc
, maxcnt_low
;
6949 uint32_t maxcnt_high
;
6950 uint32_t maxcnt
= 0;
6951 uint32_t offsetlow
, offsethigh
= 0;
6954 rw_info_t
*rwi
= NULL
;
6957 DISSECTOR_ASSERT(si
);
6961 /* next smb command */
6962 cmd
= tvb_get_uint8(tvb
, offset
);
6964 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
6966 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
6971 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
6975 andxoffset
= tvb_get_letohs(tvb
, offset
);
6976 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
6980 fid
= tvb_get_letohs(tvb
, offset
);
6981 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, (uint16_t) fid
, false, false, false, si
);
6985 offsetlow
= tvb_get_letohl(tvb
, offset
);
6986 proto_tree_add_item(tree
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
6990 maxcnt_low
= tvb_get_letohs(tvb
, offset
);
6991 proto_tree_add_uint(tree
, hf_smb_max_count_low
, tvb
, offset
, 2, maxcnt_low
);
6995 proto_tree_add_item(tree
, hf_smb_min_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
7001 * XXX - we should really only do this in case we have seen
7002 * LARGE FILE being negotiated. Unfortunately, we might not
7003 * have seen the negotiation phase in the capture....
7005 * XXX - this is shown as a ULONG in the SNIA SMB spec, i.e.
7006 * it's 32 bits, but the description says "High 16 bits of
7007 * MaxCount if CAP_LARGE_READX".
7009 * The SMB File Sharing Protocol Extensions Version 2.0,
7010 * Document Version 3.3 spec doesn't speak of an extra 16
7011 * bits in max count, but it does show a 32-bit timeout
7012 * after the min count field.
7014 * The Microsoft [MS-SMB] spec shows it as a ULONG named
7015 * Timeout_or_MaxCountHigh, which is
7017 * ...extended to be treated as a union of a 32-bit
7018 * Timeout field and a 16-bit MaxCountHigh field.
7019 * When reading from a regular file, the field
7020 * MUST be interpreted as MaxCountHigh and the
7021 * two unused bytes MUST be zero. When reading from
7022 * a name[sic] pipe or I/O device, the field MUST
7023 * be interpreted as Timeout.
7025 * Timeout is a timeout in milliseconds, with 0xffffffff
7026 * and 0xfffffffe having special meaning.
7028 * MaxCountHigh is 16 bits of the MaxCountHigh value
7029 * followed by 16 bits of Reserved.
7031 * We fetch and display it as 32 bits for now.
7033 * XXX if maxcount high is 0xFFFFFFFF we assume it is just padding
7034 * bytes and we just ignore it.
7036 maxcnt_high
= tvb_get_letohl(tvb
, offset
);
7037 if (maxcnt_high
== 0xffffffff) {
7040 proto_tree_add_uint(tree
, hf_smb_max_count_high
, tvb
, offset
, 4, maxcnt_high
);
7045 maxcnt
= maxcnt_high
;
7046 maxcnt
= (maxcnt
<<16) | maxcnt_low
;
7049 proto_tree_add_item(tree
, hf_smb_remaining
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
7054 offsethigh
= tvb_get_letohl(tvb
, offset
);
7055 proto_tree_add_item(tree
, hf_smb_high_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
7060 ofs
= (ofs
<<32) | offsetlow
;
7062 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
7063 ", %u byte%s at offset %" PRIu64
,
7064 maxcnt
, (maxcnt
== 1) ? "" : "s", ofs
);
7066 /* save the offset/len for this transaction */
7067 if (si
->sip
&& !pinfo
->fd
->visited
) {
7068 rwi
= wmem_new(wmem_file_scope(), rw_info_t
);
7073 si
->sip
->extra_info_type
= SMB_EI_RWINFO
;
7074 si
->sip
->extra_info
= rwi
;
7076 if (si
->sip
&& (si
->sip
->extra_info_type
== SMB_EI_RWINFO
)) {
7077 rwi
= (rw_info_t
*)si
->sip
->extra_info
;
7082 it
= proto_tree_add_uint64(tree
, hf_smb_file_rw_offset
, tvb
, 0, 0, rwi
->offset
);
7084 proto_item_set_generated(it
);
7085 it
= proto_tree_add_uint(tree
, hf_smb_file_rw_length
, tvb
, 0, 0, rwi
->len
);
7086 proto_item_set_generated(it
);
7093 if (cmd
!= 0xff) { /* there is an andX command */
7094 if (andxoffset
< offset
) {
7095 THROW(ReportedBoundsError
);
7097 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
7104 dissect_read_andx_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
7106 uint8_t wc
, cmd
= 0xff;
7107 uint16_t andxoffset
= 0, bc
, datalen_low
, dataoffset
= 0;
7108 uint32_t datalen
= 0, datalen_high
;
7109 rw_info_t
*rwi
= NULL
;
7110 uint16_t fid
= 0; /* was int fid = 0; */
7114 DISSECTOR_ASSERT(si
);
7118 /* next smb command */
7119 cmd
= tvb_get_uint8(tvb
, offset
);
7121 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
7123 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
7128 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
7132 andxoffset
= tvb_get_letohs(tvb
, offset
);
7133 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
7136 /* If we have seen the request, then print which FID this refers to */
7137 /* first check if we have seen the request */
7138 if ((si
->sip
!= NULL
) && (si
->sip
->frame_req
> 0) && (si
->sip
->extra_info_type
== SMB_EI_FID
)) {
7139 fid
= GPOINTER_TO_INT(si
->sip
->extra_info
);
7140 dissect_smb_fid(tvb
, pinfo
, tree
, 0, 0, (uint16_t) fid
, false, false, false, si
);
7143 if (si
->sip
&& (si
->sip
->extra_info_type
== SMB_EI_RWINFO
)) {
7144 rwi
= (rw_info_t
*)si
->sip
->extra_info
;
7149 it
= proto_tree_add_uint64(tree
, hf_smb_file_rw_offset
, tvb
, 0, 0, rwi
->offset
);
7151 proto_item_set_generated(it
);
7152 it
= proto_tree_add_uint(tree
, hf_smb_file_rw_length
, tvb
, 0, 0, rwi
->len
);
7153 proto_item_set_generated(it
);
7155 /* we need the fid for the call to dcerpc below */
7160 proto_tree_add_item(tree
, hf_smb_remaining
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
7163 /* data compaction mode */
7164 proto_tree_add_item(tree
, hf_smb_dcm
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
7167 /* 2 reserved bytes */
7168 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
7172 datalen_low
= tvb_get_letohs(tvb
, offset
);
7173 proto_tree_add_uint(tree
, hf_smb_data_len_low
, tvb
, offset
, 2, datalen_low
);
7177 dataoffset
= tvb_get_letohs(tvb
, offset
);
7178 proto_tree_add_uint(tree
, hf_smb_data_offset
, tvb
, offset
, 2, dataoffset
);
7182 * XXX - the SNIA SMB spec says this is a USHORT, not a
7185 * XXX - we should really only do this in case we have seen
7186 * LARGE FILE being negotiated. Unfortunately, we might not
7187 * have seen the negotiation phase in the capture....
7189 /* data length high */
7190 datalen_high
= tvb_get_letohl(tvb
, offset
);
7191 if (datalen_high
== 0xffffffff) {
7194 proto_tree_add_uint(tree
, hf_smb_data_len_high
, tvb
, offset
, 4, datalen_high
);
7198 datalen
= datalen_high
;
7199 datalen
= (datalen
<<16) | datalen_low
;
7202 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
7203 ", %u byte%s", datalen
,
7204 (datalen
== 1) ? "" : "s");
7207 /* 6 reserved bytes */
7208 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 6, ENC_NA
);
7213 /* file data, might be DCERPC on a pipe */
7215 offset
= dissect_file_data_maybe_dcerpc(tvb
, pinfo
, tree
,
7216 top_tree_global
, offset
, bc
, -1, (uint16_t) datalen
, 0, (uint16_t) fid
, si
);
7220 /* feed the export object tap listener */
7221 tvblen
= tvb_reported_length_remaining(tvb
, dataoffset
);
7222 if (have_tap_listener(smb_eo_tap
) && (datalen
== tvblen
) && rwi
) {
7223 feed_eo_smb(SMB_COM_READ_ANDX
, fid
, tvb
, pinfo
, dataoffset
, datalen
, rwi
->len
, rwi
->offset
, si
);
7228 if (cmd
!= 0xff) { /* there is an andX command */
7229 if (andxoffset
< offset
) {
7230 THROW(ReportedBoundsError
);
7232 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
7238 /* SMB_COM_WRITE_ANDX(0x2F)
7239 https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-cifs/a66126d2-a1db-446b-8736-b9f5559c49bd
7242 dissect_write_andx_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
7244 uint8_t wc
, cmd
= 0xff;
7245 uint16_t andxoffset
= 0, bc
, dataoffset
= 0, datalen_low
, datalen_high
;
7246 uint32_t offsetlow
, offsethigh
= 0;
7248 uint32_t datalen
= 0;
7249 uint16_t fid
= 0; /* was unsigned int fid = 0; */
7251 rw_info_t
*rwi
= NULL
;
7255 DISSECTOR_ASSERT(si
);
7259 /* next smb command */
7260 cmd
= tvb_get_uint8(tvb
, offset
);
7262 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
7264 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
7269 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
7273 andxoffset
= tvb_get_letohs(tvb
, offset
);
7274 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
7278 fid
= tvb_get_letohs(tvb
, offset
);
7279 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, (uint16_t) fid
, false, false, false, si
);
7283 offsetlow
= tvb_get_letohl(tvb
, offset
);
7284 proto_tree_add_item(tree
, hf_smb_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
7288 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 4, ENC_NA
);
7292 mode
= tvb_get_letohs(tvb
, offset
);
7293 offset
= dissect_write_mode(tvb
, tree
, offset
, 0x000f);
7296 proto_tree_add_item(tree
, hf_smb_remaining
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
7300 * XXX - we should really only do this in case we have seen
7301 * LARGE FILE being negotiated. Unfortunately, we might not
7302 * have seen the negotiation phase in the capture....
7304 /* data length high */
7305 datalen_high
= tvb_get_letohs(tvb
, offset
);
7306 proto_tree_add_uint(tree
, hf_smb_data_len_high
, tvb
, offset
, 2, datalen_high
);
7310 datalen_low
= tvb_get_letohs(tvb
, offset
);
7311 proto_tree_add_uint(tree
, hf_smb_data_len_low
, tvb
, offset
, 2, datalen_low
);
7314 datalen
= datalen_high
;
7315 datalen
= (datalen
<<16) | datalen_low
;
7318 dataoffset
= tvb_get_letohs(tvb
, offset
);
7319 proto_tree_add_uint(tree
, hf_smb_data_offset
, tvb
, offset
, 2, dataoffset
);
7324 offsethigh
= tvb_get_letohl(tvb
, offset
);
7325 proto_tree_add_item(tree
, hf_smb_high_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
7330 ofs
= (ofs
<<32) | offsetlow
;
7332 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
7333 ", %u byte%s at offset %" PRIu64
,
7334 datalen
, (datalen
== 1) ? "" : "s", ofs
);
7336 /* save the offset/len for this transaction */
7337 if (si
->sip
&& !pinfo
->fd
->visited
) {
7338 rwi
= wmem_new(wmem_file_scope(), rw_info_t
);
7343 si
->sip
->extra_info_type
= SMB_EI_RWINFO
;
7344 si
->sip
->extra_info
= rwi
;
7346 if (si
->sip
&& (si
->sip
->extra_info_type
== SMB_EI_RWINFO
)) {
7347 rwi
= (rw_info_t
*)si
->sip
->extra_info
;
7352 it
= proto_tree_add_uint64(tree
, hf_smb_file_rw_offset
, tvb
, 0, 0, rwi
->offset
);
7354 proto_item_set_generated(it
);
7355 it
= proto_tree_add_uint(tree
, hf_smb_file_rw_length
, tvb
, 0, 0, rwi
->len
);
7356 proto_item_set_generated(it
);
7362 /* if both the MessageStart and the WriteRawNamedPipe flags are set
7363 the first two bytes of the payload is the length of the data.
7364 Assume that all WriteAndX PDUs that have MESSAGE_START set to
7365 be over the IPC$ share and thus they all transport DCERPC.
7366 (if we didn't already know that from the TreeConnect call)
7368 if (mode
&WRITE_MODE_MESSAGE_START
) {
7369 if (mode
&WRITE_MODE_RAW
) {
7370 proto_tree_add_item(tree
, hf_smb_pipe_write_len
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
7376 if (!pinfo
->fd
->visited
) {
7377 /* In case we did not see the TreeConnect call,
7378 store this TID here as well as a IPC TID
7379 so we know that future Read/Writes to this
7380 TID is (probably) DCERPC.
7382 if (g_hash_table_lookup(si
->ct
->tid_service
, GUINT_TO_POINTER(si
->tid
))) {
7383 g_hash_table_remove(si
->ct
->tid_service
, GUINT_TO_POINTER(si
->tid
));
7385 g_hash_table_insert(si
->ct
->tid_service
, GUINT_TO_POINTER(si
->tid
), (void *)TID_IPC
);
7388 si
->sip
->flags
|= SMB_SIF_TID_IS_IPC
;
7392 /* file data, might be DCERPC on a pipe */
7394 /* https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-cifs/a66126d2-a1db-446b-8736-b9f5559c49bd
7395 The DataOffset field can be used to relocate the SMB_Data.Bytes.Data
7396 block to the end of the message,even if the message is a multi-part AndX
7397 chain. If the SMB_Data.Bytes.Data block is relocated, the contents of
7398 SMB_Data.Bytes will not be contiguous.
7400 offset
= dissect_file_data_maybe_dcerpc(tvb
, pinfo
, tree
,
7401 top_tree_global
, offset
, bc
, dataoffset
, (uint16_t) datalen
, 0, (uint16_t) fid
, si
);
7405 /* feed the export object tap listener */
7406 tvblen
= tvb_reported_length_remaining(tvb
, dataoffset
);
7407 if (have_tap_listener(smb_eo_tap
) && (datalen
== tvblen
) && rwi
) {
7408 feed_eo_smb(SMB_COM_WRITE_ANDX
, fid
, tvb
, pinfo
, dataoffset
, datalen
, rwi
->len
, rwi
->offset
, si
);
7413 if (cmd
!= 0xff) { /* there is an andX command */
7414 if (andxoffset
< offset
) {
7415 THROW(ReportedBoundsError
);
7417 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
7424 dissect_write_andx_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
7426 uint8_t wc
, cmd
= 0xff;
7427 uint16_t andxoffset
= 0, bc
, count_low
, count_high
;
7429 rw_info_t
*rwi
= NULL
;
7431 DISSECTOR_ASSERT(si
);
7435 /* next smb command */
7436 cmd
= tvb_get_uint8(tvb
, offset
);
7438 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
7440 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
7445 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
7449 andxoffset
= tvb_get_letohs(tvb
, offset
);
7450 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
7454 if (si
->sip
&& (si
->sip
->extra_info_type
== SMB_EI_RWINFO
)) {
7455 rwi
= (rw_info_t
*)si
->sip
->extra_info
;
7460 it
= proto_tree_add_uint64(tree
, hf_smb_file_rw_offset
, tvb
, 0, 0, rwi
->offset
);
7462 proto_item_set_generated(it
);
7463 it
= proto_tree_add_uint(tree
, hf_smb_file_rw_length
, tvb
, 0, 0, rwi
->len
);
7464 proto_item_set_generated(it
);
7468 /* write count low */
7469 count_low
= tvb_get_letohs(tvb
, offset
);
7470 proto_tree_add_uint(tree
, hf_smb_count_low
, tvb
, offset
, 2, count_low
);
7474 proto_tree_add_item(tree
, hf_smb_remaining
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
7477 /* XXX we should really only do this in case we have seen LARGE FILE being negotiated */
7478 /* write count high */
7479 count_high
= tvb_get_letohs(tvb
, offset
);
7480 proto_tree_add_uint(tree
, hf_smb_count_high
, tvb
, offset
, 2, count_high
);
7484 count
= (count
<<16) | count_low
;
7486 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
7487 ", %u byte%s", count
,
7488 (count
== 1) ? "" : "s");
7490 /* 2 reserved bytes */
7491 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
7498 if (cmd
!= 0xff) { /* there is an andX command */
7499 if (andxoffset
< offset
) {
7500 THROW(ReportedBoundsError
);
7502 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
7509 static const true_false_string tfs_setup_action_guest
= {
7510 "Logged in as GUEST",
7511 "Not logged in as GUEST"
7514 dissect_setup_action(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
7516 static int * const flags
[] = {
7517 &hf_smb_setup_action_guest
,
7521 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_setup_action
, ett_smb_setup_action
, flags
, ENC_LITTLE_ENDIAN
);
7529 dissect_session_setup_andx_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
7531 uint8_t wc
, cmd
= 0xff;
7533 uint16_t andxoffset
= 0;
7539 uint16_t sbloblen
= 0, sbloblen_short
;
7540 uint16_t apwlen
= 0, upwlen
= 0;
7542 static int ntlmssp_tap_id
= 0;
7543 const ntlmssp_header_t
*ntlmssph
;
7545 if (!ntlmssp_tap_id
) {
7546 GString
*error_string
;
7547 /* We don't specify any callbacks at all.
7548 * Instead we manually fetch the tapped data after the
7549 * security blob has been fully dissected and before
7550 * we exit from this dissector.
7552 error_string
= register_tap_listener("ntlmssp", NULL
, NULL
,
7553 TL_IS_DISSECTOR_HELPER
, NULL
, NULL
, NULL
, NULL
);
7554 if (!error_string
) {
7555 ntlmssp_tap_id
= find_tap_id("ntlmssp");
7557 g_string_free(error_string
, true);
7561 DISSECTOR_ASSERT(si
);
7565 /* next smb command */
7566 cmd
= tvb_get_uint8(tvb
, offset
);
7568 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
7570 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
7575 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
7579 andxoffset
= tvb_get_letohs(tvb
, offset
);
7580 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
7583 /* Maximum Buffer Size */
7584 proto_tree_add_item(tree
, hf_smb_max_buf_size
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
7587 /* Maximum Multiplex Count */
7588 proto_tree_add_item(tree
, hf_smb_max_mpx_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
7592 proto_tree_add_item(tree
, hf_smb_vc_num
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
7596 proto_tree_add_item(tree
, hf_smb_session_key
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
7601 /* password length, ASCII*/
7602 pwlen
= tvb_get_letohs(tvb
, offset
);
7603 proto_tree_add_uint(tree
, hf_smb_password_len
,
7604 tvb
, offset
, 2, pwlen
);
7607 /* 4 reserved bytes */
7608 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 4, ENC_NA
);
7614 /* security blob length */
7615 sbloblen
= tvb_get_letohs(tvb
, offset
);
7616 proto_tree_add_uint(tree
, hf_smb_security_blob_len
, tvb
, offset
, 2, sbloblen
);
7619 /* 4 reserved bytes */
7620 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 4, ENC_NA
);
7624 dissect_negprot_capabilities(tvb
, tree
, offset
);
7630 /* password length, ANSI*/
7631 apwlen
= tvb_get_letohs(tvb
, offset
);
7632 proto_tree_add_uint(tree
, hf_smb_ansi_password_len
,
7633 tvb
, offset
, 2, apwlen
);
7636 /* password length, Unicode*/
7637 upwlen
= tvb_get_letohs(tvb
, offset
);
7638 proto_tree_add_uint(tree
, hf_smb_unicode_password_len
,
7639 tvb
, offset
, 2, upwlen
);
7642 /* 4 reserved bytes */
7643 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 4, ENC_NA
);
7647 dissect_negprot_capabilities(tvb
, tree
, offset
);
7656 proto_item
*blob_item
;
7659 /* If it runs past the end of the captured data, don't
7660 * try to put all of it into the protocol tree as the
7661 * raw security blob; we might get an exception on
7662 * short frames and then we will not see anything at all
7663 * of the security blob.
7665 sbloblen_short
= sbloblen
;
7666 if (sbloblen_short
> tvb_reported_length_remaining(tvb
, offset
)) {
7667 sbloblen_short
= tvb_reported_length_remaining(tvb
, offset
);
7669 blob_item
= proto_tree_add_item(tree
, hf_smb_security_blob
,
7670 tvb
, offset
, sbloblen_short
,
7673 /* As an optimization, because Windows is perverse,
7674 we check to see if NTLMSSP is the first part of the
7675 blob, and if so, call the NTLMSSP dissector,
7676 otherwise we call the GSS-API dissector. This is because
7677 Windows can request RAW NTLMSSP, but will happily handle
7678 a client that wraps NTLMSSP in SPNEGO
7683 proto_tree
*blob_tree
;
7685 blob_tree
= proto_item_add_subtree(blob_item
,
7687 CHECK_BYTE_COUNT(sbloblen
);
7690 * Set the reported length of this to the reported
7691 * length of the blob, rather than the amount of
7692 * data available from the blob, so that we'll
7693 * throw the right exception if it's too short.
7695 blob_tvb
= tvb_new_subset_length_caplen(tvb
, offset
, sbloblen_short
,
7698 if (si
&& si
->ct
&& si
->ct
->raw_ntlmssp
&&
7699 (tvb_strneql(tvb
, offset
, "NTLMSSP", 7) == 0)) {
7700 call_dissector(ntlmssp_handle
, blob_tvb
, pinfo
,
7705 call_dissector(gssapi_handle
, blob_tvb
,
7709 /* If we have found a uid->acct_name mapping, store it */
7710 if (!pinfo
->fd
->visited
&& si
->sip
) {
7712 if ((ntlmssph
= (const ntlmssp_header_t
*)fetch_tapped_data(ntlmssp_tap_id
, idx
+ 1 )) != NULL
) {
7713 if (ntlmssph
&& (ntlmssph
->type
== 3)) {
7716 smb_uid
= wmem_new(wmem_file_scope(), smb_uid_t
);
7717 smb_uid
->logged_in
= -1;
7718 smb_uid
->logged_out
= -1;
7719 smb_uid
->domain
= wmem_strdup(wmem_file_scope(), ntlmssph
->domain_name
);
7720 smb_uid
->account
= wmem_strdup(wmem_file_scope(), ntlmssph
->acct_name
);
7722 si
->sip
->extra_info
= smb_uid
;
7723 si
->sip
->extra_info_type
= SMB_EI_UID
;
7728 COUNT_BYTES(sbloblen
);
7732 * Even though this field should honour the unicode flag
7733 * some ms clients gets this wrong.
7734 * At least XP SP1 sends this in ASCII
7735 * even when the unicode flag is on.
7736 * Test if the first three bytes are "Win"
7737 * and if so just override the flag.
7739 unicodeflag
= si
->unicode
;
7740 if ( tvb_strneql(tvb
, offset
, "Win", 3) == 0 ) {
7741 unicodeflag
= false;
7743 an
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
7744 unicodeflag
, &an_len
, false, false, &bc
);
7747 proto_tree_add_string(tree
, hf_smb_os
, tvb
,
7748 offset
, an_len
, an
);
7749 COUNT_BYTES(an_len
);
7752 /* XXX - pre-W2K NT systems appear to stick an extra 2 bytes of
7753 * padding/null string/whatever in front of this. W2K doesn't
7754 * appear to. I suspect that's a bug that got fixed; I also
7755 * suspect that, in practice, nobody ever looks at that field
7756 * because the bug didn't appear to get fixed until NT 5.0....
7758 * Even though this field should honour the unicode flag
7759 * some ms clients gets this wrong.
7760 * At least XP SP1 sends this in ASCII
7761 * even when the unicode flag is on.
7762 * Test if the first three bytes are "Win"
7763 * and if so just override the flag.
7765 unicodeflag
= si
->unicode
;
7766 if ( tvb_strneql(tvb
, offset
, "Win", 3) == 0 ) {
7767 unicodeflag
= false;
7769 an
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
7770 unicodeflag
, &an_len
, false, false, &bc
);
7773 proto_tree_add_string(tree
, hf_smb_lanman
, tvb
,
7774 offset
, an_len
, an
);
7775 COUNT_BYTES(an_len
);
7777 /* Primary domain */
7778 /* XXX - pre-W2K NT systems sometimes appear to stick an extra
7779 * byte in front of this, at least if all the strings are
7780 * ASCII and the account name is empty. Another bug?
7782 dn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
7783 si
->unicode
, &dn_len
, false, false, &bc
);
7786 proto_tree_add_string(tree
, hf_smb_primary_domain
, tvb
,
7787 offset
, dn_len
, dn
);
7788 COUNT_BYTES(dn_len
);
7794 /* password, ASCII */
7795 CHECK_BYTE_COUNT(pwlen
);
7796 proto_tree_add_item(tree
, hf_smb_password
,
7797 tvb
, offset
, pwlen
, ENC_NA
);
7805 /* password, ANSI */
7806 CHECK_BYTE_COUNT(apwlen
);
7807 proto_tree_add_item(tree
, hf_smb_ansi_password
,
7808 tvb
, offset
, apwlen
, ENC_NA
);
7809 COUNT_BYTES(apwlen
);
7815 /* password, Unicode */
7816 CHECK_BYTE_COUNT(upwlen
);
7817 item
= proto_tree_add_item(tree
, hf_smb_unicode_password
,
7818 tvb
, offset
, upwlen
, ENC_NA
);
7821 proto_tree
*subtree
;
7822 subtree
= proto_item_add_subtree(item
, ett_smb_unicode_password
);
7823 dissect_ntlmv2_response(tvb
, pinfo
, subtree
, offset
, upwlen
);
7826 COUNT_BYTES(upwlen
);
7833 an
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
7834 si
->unicode
, &an_len
, false, false, &bc
);
7837 proto_tree_add_string(tree
, hf_smb_account
, tvb
, offset
, an_len
,
7839 COUNT_BYTES(an_len
);
7841 /* Primary domain */
7842 /* XXX - pre-W2K NT systems sometimes appear to stick an extra
7843 * byte in front of this, at least if all the strings are
7844 * ASCII and the account name is empty. Another bug?
7846 dn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
7847 si
->unicode
, &dn_len
, false, false, &bc
);
7850 proto_tree_add_string(tree
, hf_smb_primary_domain
, tvb
,
7851 offset
, dn_len
, dn
);
7852 COUNT_BYTES(dn_len
);
7854 col_append_str(pinfo
->cinfo
, COL_INFO
, ", User: ");
7856 if (!dn
[0] && !an
[0])
7857 col_append_str(pinfo
->cinfo
, COL_INFO
, "anonymous");
7859 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
7861 format_text(pinfo
->pool
, (const unsigned char*)dn
, strlen(dn
)),
7862 format_text(pinfo
->pool
, (const unsigned char*)an
, strlen(an
)));
7865 an
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
7866 si
->unicode
, &an_len
, false, false, &bc
);
7869 proto_tree_add_string(tree
, hf_smb_os
, tvb
,
7870 offset
, an_len
, an
);
7871 COUNT_BYTES(an_len
);
7874 /* XXX - pre-W2K NT systems appear to stick an extra 2 bytes of
7875 * padding/null string/whatever in front of this. W2K doesn't
7876 * appear to. I suspect that's a bug that got fixed; I also
7877 * suspect that, in practice, nobody ever looks at that field
7878 * because the bug didn't appear to get fixed until NT 5.0....
7880 an
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
7881 si
->unicode
, &an_len
, false, false, &bc
);
7884 proto_tree_add_string(tree
, hf_smb_lanman
, tvb
,
7885 offset
, an_len
, an
);
7886 COUNT_BYTES(an_len
);
7891 if (cmd
!= 0xff) { /* there is an andX command */
7892 if (andxoffset
< offset
) {
7893 THROW(ReportedBoundsError
);
7895 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
7902 dissect_session_setup_andx_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
7904 uint8_t wc
, cmd
= 0xff;
7905 uint16_t andxoffset
= 0, bc
;
7906 uint16_t sbloblen
= 0;
7910 DISSECTOR_ASSERT(si
);
7914 if (!pinfo
->fd
->visited
&& si
->sip
&& si
->sip
->extra_info
&&
7915 (si
->sip
->extra_info_type
== SMB_EI_UID
)) {
7918 smb_uid
= (smb_uid_t
*)si
->sip
->extra_info
;
7919 smb_uid
->logged_in
= pinfo
->num
;
7920 wmem_tree_insert32(si
->ct
->uid_tree
, si
->uid
, smb_uid
);
7923 /* next smb command */
7924 cmd
= tvb_get_uint8(tvb
, offset
);
7926 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
7928 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
7933 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
7937 andxoffset
= tvb_get_letohs(tvb
, offset
);
7938 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
7942 offset
= dissect_setup_action(tvb
, tree
, offset
);
7945 /* security blob length */
7946 sbloblen
= tvb_get_letohs(tvb
, offset
);
7947 proto_tree_add_uint(tree
, hf_smb_security_blob_len
, tvb
, offset
, 2, sbloblen
);
7954 proto_item
*blob_item
;
7957 /* don't try to eat too much of we might get an exception on
7958 * short frames and then we will not see anything at all
7959 * of the security blob.
7961 if (sbloblen
> tvb_reported_length_remaining(tvb
, offset
)) {
7962 sbloblen
= tvb_reported_length_remaining(tvb
, offset
);
7964 blob_item
= proto_tree_add_item(tree
, hf_smb_security_blob
,
7965 tvb
, offset
, sbloblen
, ENC_NA
);
7969 proto_tree
*blob_tree
;
7971 blob_tree
= proto_item_add_subtree(blob_item
,
7973 CHECK_BYTE_COUNT(sbloblen
);
7975 blob_tvb
= tvb_new_subset_length(tvb
, offset
, sbloblen
);
7977 if (si
&& si
->ct
&& si
->ct
->raw_ntlmssp
&&
7978 (tvb_strneql(tvb
, offset
, "NTLMSSP", 7) == 0)) {
7979 call_dissector(ntlmssp_handle
, blob_tvb
, pinfo
,
7984 call_dissector(gssapi_handle
, blob_tvb
, pinfo
,
7989 COUNT_BYTES(sbloblen
);
7994 an
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
7995 si
->unicode
, &an_len
, false, false, &bc
);
7998 proto_tree_add_string(tree
, hf_smb_os
, tvb
,
7999 offset
, an_len
, an
);
8000 COUNT_BYTES(an_len
);
8003 an
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
8004 si
->unicode
, &an_len
, false, false, &bc
);
8007 proto_tree_add_string(tree
, hf_smb_lanman
, tvb
,
8008 offset
, an_len
, an
);
8009 COUNT_BYTES(an_len
);
8011 if ((wc
== 3) || (wc
== 4)) {
8012 /* Primary domain */
8013 an
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
8014 si
->unicode
, &an_len
, false, false, &bc
);
8017 proto_tree_add_string(tree
, hf_smb_primary_domain
, tvb
,
8018 offset
, an_len
, an
);
8019 COUNT_BYTES(an_len
);
8024 if (cmd
!= 0xff) { /* there is an andX command */
8025 if (andxoffset
< offset
) {
8026 THROW(ReportedBoundsError
);
8028 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
8036 dissect_empty_andx(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si _U_
)
8038 uint8_t wc
, cmd
= 0xff;
8039 uint16_t andxoffset
= 0;
8044 /* next smb command */
8045 cmd
= tvb_get_uint8(tvb
, offset
);
8047 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
8049 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
8054 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
8058 andxoffset
= tvb_get_letohs(tvb
, offset
);
8059 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
8066 if (cmd
!= 0xff) { /* there is an andX command */
8067 if (andxoffset
< offset
) {
8068 THROW(ReportedBoundsError
);
8070 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
8077 * From [MS-SMB] - v20100711 Server Message Block (SMB) Protocol Specification
8078 * http://download.microsoft.com/download/a/e/6/ae6e4142-aa58-45c6-8dcf-a657e5900cd3/%5BMS-SMB%5D.pdf
8079 * 2.2.4.7 SMB_COM_TREE_CONNECT_ANDX (0x75)
8082 static const true_false_string tfs_connect_support_search
= {
8083 "Exclusive search bits supported",
8084 "Exclusive search bits not supported"
8086 static const true_false_string tfs_connect_support_in_dfs
= {
8088 "Share isn't in Dfs"
8090 static const value_string connect_support_csc_mask_vals
[] = {
8091 { 0, "Automatic file-to-file reintegration NOT permitted"},
8092 { 1, "Automatic file-to-file reintegration permitted"},
8093 { 2, "Offline caching allow for the share"},
8094 { 3, "Offline caching NOT allow for the share"},
8097 static const true_false_string tfs_connect_support_uniquefilename
= {
8098 "Client allowed to cache share namespaces",
8099 "Client NOT allowed to cache share namespaces"
8101 static const true_false_string tfs_connect_support_extended_signature
= {
8102 "Extended signature",
8103 "NOT extended signature"
8107 dissect_connect_support_bits(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
8109 static int * const flags
[] = {
8110 &hf_smb_connect_support_search
,
8111 &hf_smb_connect_support_in_dfs
,
8112 &hf_smb_connect_support_csc_mask_vals
,
8113 &hf_smb_connect_support_uniquefilename
,
8114 &hf_smb_connect_support_extended_signature
,
8118 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_connect_support
, ett_smb_connect_support_bits
, flags
, ENC_LITTLE_ENDIAN
);
8124 static const true_false_string tfs_disconnect_tid
= {
8126 "Do NOT disconnect TID"
8129 static const true_false_string tfs_extended_signature
= {
8130 "Extended Signature",
8131 "NOT Extended Signature"
8134 static const true_false_string tfs_extended_response
= {
8135 "Extended Response",
8136 "NOT Extended Response"
8140 dissect_connect_flags(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
8142 static int * const flags
[] = {
8143 &hf_smb_connect_flags_dtid
,
8144 &hf_smb_connect_flags_ext_sig
,
8145 &hf_smb_connect_flags_ext_resp
,
8149 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_connect_flags
, ett_smb_connect_flags
, flags
, ENC_LITTLE_ENDIAN
);
8156 dissect_tree_connect_andx_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
8158 uint8_t wc
, cmd
= 0xff;
8160 uint16_t andxoffset
= 0, pwlen
= 0;
8164 DISSECTOR_ASSERT(si
);
8168 /* next smb command */
8169 cmd
= tvb_get_uint8(tvb
, offset
);
8171 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
8173 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
8178 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
8182 andxoffset
= tvb_get_letohs(tvb
, offset
);
8183 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
8187 offset
= dissect_connect_flags(tvb
, tree
, offset
);
8189 /* password length*/
8190 pwlen
= tvb_get_letohs(tvb
, offset
);
8191 proto_tree_add_uint(tree
, hf_smb_password_len
, tvb
, offset
, 2, pwlen
);
8197 CHECK_BYTE_COUNT(pwlen
);
8198 proto_tree_add_item(tree
, hf_smb_password
,
8199 tvb
, offset
, pwlen
, ENC_NA
);
8203 an
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
8204 si
->unicode
, &an_len
, false, false, &bc
);
8207 proto_tree_add_string(tree
, hf_smb_path
, tvb
,
8208 offset
, an_len
, an
);
8209 COUNT_BYTES(an_len
);
8211 /* store it for the tid->name/openframe/closeframe matching in
8212 * dissect_smb_tid() called from the response.
8214 if ((!pinfo
->fd
->visited
) && si
->sip
&& an
) {
8215 si
->sip
->extra_info_type
= SMB_EI_TIDNAME
;
8216 si
->sip
->extra_info
= wmem_strdup(wmem_file_scope(), an
);
8219 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Path: %s",
8220 format_text(pinfo
->pool
, (const unsigned char*)an
, strlen(an
)));
8223 * NOTE: the Service string is always ASCII, even if the
8224 * "strings are Unicode" bit is set in the flags2 field
8229 /* XXX - what if this runs past bc? */
8230 an_len
= tvb_strsize(tvb
, offset
);
8231 CHECK_BYTE_COUNT(an_len
);
8232 proto_tree_add_item_ret_string(tree
, hf_smb_service
, tvb
,
8233 offset
, an_len
, ENC_ASCII
|ENC_NA
, pinfo
->pool
, &an
);
8234 COUNT_BYTES(an_len
);
8238 if (cmd
!= 0xff) { /* there is an andX command */
8239 if (andxoffset
< offset
) {
8240 THROW(ReportedBoundsError
);
8242 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
8250 dissect_tree_connect_andx_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
8252 uint8_t wc
, cmd
= 0xff;
8253 uint16_t andxoffset
= 0;
8258 DISSECTOR_ASSERT(si
);
8262 /* next smb command */
8263 cmd
= tvb_get_uint8(tvb
, offset
);
8265 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
8267 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
8272 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
8276 andxoffset
= tvb_get_letohs(tvb
, offset
);
8277 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
8280 /* There are three valid formats of tree connect response.
8281 All have the first two words: andx_cmd, andx_off,
8282 and then have additional words as follows:
8283 wc=2: (ancient LanMan -- no more words)
8284 wc=3: (NT, non-ext) opt_support
8285 wc=7: (NT, extended) opt_support,
8286 tree_access(2w), guest_access(2w)
8287 byte_count follows those words as usual */
8291 offset
= dissect_connect_support_bits(tvb
, tree
, offset
);
8296 * Refer to [MS-SMB] - v20100711
8297 * When a server returns extended information, the response
8298 * takes the following format, with WordCount = 7.
8299 * MaximalShareAccessRights, and GuestMaximalShareAccessRights fields
8303 tr
= proto_tree_add_subtree(tree
, tvb
, offset
, 4,
8304 ett_smb_nt_access_mask
, NULL
, "Maximal Share Access Rights");
8305 offset
= dissect_smb_access_mask(tvb
, tr
, offset
);
8307 tr
= proto_tree_add_subtree(tree
, tvb
, offset
, 4,
8308 ett_smb_nt_access_mask
, NULL
, "Guest Maximal Share Access Rights");
8309 offset
= dissect_smb_access_mask(tvb
, tr
, offset
);
8315 * NOTE: even though the SNIA CIFS spec doesn't say there's
8316 * a "Service" string if there's a word count of 2, the
8319 * ftp://ftp.microsoft.com/developr/drg/CIFS/dosextp.txt
8321 * (it's in an ugly format - text intended to be sent to a
8322 * printer, with backspaces and overstrikes used for boldfacing
8323 * and underlining; UNIX "col -b" can be used to strip the
8324 * overstrikes out) says there's a "Service" string there, and
8325 * some network traffic has it.
8329 * NOTE: the Service string is always ASCII, even if the
8330 * "strings are Unicode" bit is set in the flags2 field
8335 /* XXX - what if this runs past bc? */
8336 an_len
= tvb_strsize(tvb
, offset
);
8337 CHECK_BYTE_COUNT(an_len
);
8338 proto_tree_add_item_ret_string(tree
, hf_smb_service
, tvb
,
8339 offset
, an_len
, ENC_ASCII
|ENC_NA
, pinfo
->pool
, &an
);
8340 COUNT_BYTES(an_len
);
8342 /* Now when we know the service type, store it so that we know it for later commands down
8344 if (!pinfo
->fd
->visited
) {
8345 /* Remove any previous entry for this TID */
8346 if (g_hash_table_lookup(si
->ct
->tid_service
, GUINT_TO_POINTER(si
->tid
))) {
8347 g_hash_table_remove(si
->ct
->tid_service
, GUINT_TO_POINTER(si
->tid
));
8349 if (strcmp(an
, "IPC") == 0) {
8350 g_hash_table_insert(si
->ct
->tid_service
, GUINT_TO_POINTER(si
->tid
), (void *)TID_IPC
);
8352 g_hash_table_insert(si
->ct
->tid_service
, GUINT_TO_POINTER(si
->tid
), (void *)TID_NORMAL
);
8358 * Sometimes this isn't present.
8362 an
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
8363 si
->unicode
, &an_len
, /*true*/false, false,
8367 proto_tree_add_string(tree
, hf_smb_fs
, tvb
,
8368 offset
, an_len
, an
);
8369 COUNT_BYTES(an_len
);
8374 if (cmd
!= 0xff) { /* there is an andX command */
8375 if (andxoffset
< offset
) {
8376 THROW(ReportedBoundsError
);
8378 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
8386 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8387 NT Transaction command begins here
8388 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
8389 #define NT_TRANS_CREATE 1
8390 #define NT_TRANS_IOCTL 2
8391 #define NT_TRANS_SSD 3
8392 #define NT_TRANS_NOTIFY 4
8393 #define NT_TRANS_RENAME 5
8394 #define NT_TRANS_QSD 6
8395 #define NT_TRANS_GET_USER_QUOTA 7
8396 #define NT_TRANS_SET_USER_QUOTA 8
8397 static const value_string nt_cmd_vals
[] = {
8398 {NT_TRANS_CREATE
, "NT CREATE"},
8399 {NT_TRANS_IOCTL
, "NT IOCTL"},
8400 {NT_TRANS_SSD
, "NT SET SECURITY DESC"},
8401 {NT_TRANS_NOTIFY
, "NT NOTIFY"},
8402 {NT_TRANS_RENAME
, "NT RENAME"},
8403 {NT_TRANS_QSD
, "NT QUERY SECURITY DESC"},
8404 {NT_TRANS_GET_USER_QUOTA
, "NT GET USER QUOTA"},
8405 {NT_TRANS_SET_USER_QUOTA
, "NT SET USER QUOTA"},
8408 value_string_ext nt_cmd_vals_ext
= VALUE_STRING_EXT_INIT(nt_cmd_vals
);
8410 static const value_string nt_ioctl_isfsctl_vals
[] = {
8411 {0, "Device IOCTL"},
8412 {1, "FS control : FSCTL"},
8416 #define NT_IOCTL_FLAGS_ROOT_HANDLE 0x01
8417 static const true_false_string tfs_nt_ioctl_flags_root_handle
= {
8418 "Apply the command to share root handle (MUST BE Dfs)",
8419 "Apply to this share",
8422 static const value_string nt_notify_action_vals
[] = {
8423 {1, "ADDED (object was added"},
8424 {2, "REMOVED (object was removed)"},
8425 {3, "MODIFIED (object was modified)"},
8426 {4, "RENAMED_OLD_NAME (this is the old name of object)"},
8427 {5, "RENAMED_NEW_NAME (this is the new name of object)"},
8428 {6, "ADDED_STREAM (a stream was added)"},
8429 {7, "REMOVED_STREAM (a stream was removed)"},
8430 {8, "MODIFIED_STREAM (a stream was modified)"},
8434 static const value_string watch_tree_vals
[] = {
8435 {0, "Current directory only"},
8436 {1, "Subdirectories also"},
8440 #define NT_NOTIFY_STREAM_WRITE 0x00000800
8441 #define NT_NOTIFY_STREAM_SIZE 0x00000400
8442 #define NT_NOTIFY_STREAM_NAME 0x00000200
8443 #define NT_NOTIFY_SECURITY 0x00000100
8444 #define NT_NOTIFY_EA 0x00000080
8445 #define NT_NOTIFY_CREATION 0x00000040
8446 #define NT_NOTIFY_LAST_ACCESS 0x00000020
8447 #define NT_NOTIFY_LAST_WRITE 0x00000010
8448 #define NT_NOTIFY_SIZE 0x00000008
8449 #define NT_NOTIFY_ATTRIBUTES 0x00000004
8450 #define NT_NOTIFY_DIR_NAME 0x00000002
8451 #define NT_NOTIFY_FILE_NAME 0x00000001
8452 static const true_false_string tfs_nt_notify_stream_write
= {
8453 "Notify on changes to STREAM WRITE",
8454 "Do NOT notify on changes to stream write",
8456 static const true_false_string tfs_nt_notify_stream_size
= {
8457 "Notify on changes to STREAM SIZE",
8458 "Do NOT notify on changes to stream size",
8460 static const true_false_string tfs_nt_notify_stream_name
= {
8461 "Notify on changes to STREAM NAME",
8462 "Do NOT notify on changes to stream name",
8464 static const true_false_string tfs_nt_notify_security
= {
8465 "Notify on changes to SECURITY",
8466 "Do NOT notify on changes to security",
8468 static const true_false_string tfs_nt_notify_ea
= {
8469 "Notify on changes to EA",
8470 "Do NOT notify on changes to EA",
8472 static const true_false_string tfs_nt_notify_creation
= {
8473 "Notify on changes to CREATION TIME",
8474 "Do NOT notify on changes to creation time",
8476 static const true_false_string tfs_nt_notify_last_access
= {
8477 "Notify on changes to LAST ACCESS TIME",
8478 "Do NOT notify on changes to last access time",
8480 static const true_false_string tfs_nt_notify_last_write
= {
8481 "Notify on changes to LAST WRITE TIME",
8482 "Do NOT notify on changes to last write time",
8484 static const true_false_string tfs_nt_notify_size
= {
8485 "Notify on changes to SIZE",
8486 "Do NOT notify on changes to size",
8488 static const true_false_string tfs_nt_notify_attributes
= {
8489 "Notify on changes to ATTRIBUTES",
8490 "Do NOT notify on changes to attributes",
8492 static const true_false_string tfs_nt_notify_dir_name
= {
8493 "Notify on changes to DIR NAME",
8494 "Do NOT notify on changes to dir name",
8496 static const true_false_string tfs_nt_notify_file_name
= {
8497 "Notify on changes to FILE NAME",
8498 "Do NOT notify on changes to file name",
8501 const value_string create_disposition_vals
[] = {
8502 {0, "Supersede (supersede existing file (if it exists))"},
8503 {1, "Open (if file exists open it, else fail)"},
8504 {2, "Create (if file exists fail, else create it)"},
8505 {3, "Open If (if file exists open it, else create it)"},
8506 {4, "Overwrite (if file exists overwrite, else fail)"},
8507 {5, "Overwrite If (if file exists overwrite, else create it)"},
8511 const value_string impersonation_level_vals
[] = {
8513 {1, "Identification"},
8514 {2, "Impersonation"},
8519 static const true_false_string tfs_nt_security_flags_context_tracking
= {
8520 "Security tracking mode is DYNAMIC",
8521 "Security tracking mode is STATIC",
8524 static const true_false_string tfs_nt_security_flags_effective_only
= {
8525 "ONLY ENABLED aspects of the client's security context are available",
8526 "ALL aspects of the client's security context are available",
8529 static const true_false_string tfs_nt_create_bits_oplock
= {
8530 "Requesting OPLOCK",
8531 "Does NOT request oplock"
8534 static const true_false_string tfs_nt_create_bits_boplock
= {
8535 "Requesting BATCH OPLOCK",
8536 "Does NOT request batch oplock"
8540 * XXX - must be a directory, and can be a file, or can be a directory,
8541 * and must be a file?
8543 static const true_false_string tfs_nt_create_bits_dir
= {
8544 "Target of open MUST be a DIRECTORY",
8545 "Target of open can be a file"
8548 static const true_false_string tfs_nt_create_bits_ext_resp
= {
8549 "Extended responses required",
8550 "Extended responses NOT required"
8553 static const true_false_string tfs_nt_access_mask_generic_read
= {
8554 "GENERIC READ is set",
8555 "Generic read is NOT set"
8557 static const true_false_string tfs_nt_access_mask_generic_write
= {
8558 "GENERIC WRITE is set",
8559 "Generic write is NOT set"
8561 static const true_false_string tfs_nt_access_mask_generic_execute
= {
8562 "GENERIC EXECUTE is set",
8563 "Generic execute is NOT set"
8565 static const true_false_string tfs_nt_access_mask_generic_all
= {
8566 "GENERIC ALL is set",
8567 "Generic all is NOT set"
8569 static const true_false_string tfs_nt_access_mask_maximum_allowed
= {
8570 "MAXIMUM ALLOWED is set",
8571 "Maximum allowed is NOT set"
8573 static const true_false_string tfs_nt_access_mask_system_security
= {
8574 "SYSTEM SECURITY is set",
8575 "System security is NOT set"
8577 static const true_false_string tfs_nt_access_mask_synchronize
= {
8578 "Can wait on handle to SYNCHRONIZE on completion of I/O",
8579 "Can NOT wait on handle to synchronize on completion of I/O"
8581 static const true_false_string tfs_nt_access_mask_write_owner
= {
8582 "Can WRITE OWNER (take ownership)",
8583 "Can NOT write owner (take ownership)"
8585 static const true_false_string tfs_nt_access_mask_write_dac
= {
8586 "OWNER may WRITE the DAC",
8587 "Owner may NOT write to the DAC"
8589 static const true_false_string tfs_nt_access_mask_read_control
= {
8590 "READ ACCESS to owner, group and ACL of the SID",
8591 "Read access is NOT granted to owner, group and ACL of the SID"
8593 static const true_false_string tfs_nt_access_mask_delete
= {
8597 static const true_false_string tfs_nt_access_mask_write_attributes
= {
8598 "WRITE ATTRIBUTES access",
8599 "NO write attributes access"
8601 static const true_false_string tfs_nt_access_mask_read_attributes
= {
8602 "READ ATTRIBUTES access",
8603 "NO read attributes access"
8605 static const true_false_string tfs_nt_access_mask_delete_child
= {
8606 "DELETE CHILD access",
8607 "NO delete child access"
8609 static const true_false_string tfs_nt_access_mask_execute
= {
8613 static const true_false_string tfs_nt_access_mask_write_ea
= {
8614 "WRITE EXTENDED ATTRIBUTES access",
8615 "NO write extended attributes access"
8617 static const true_false_string tfs_nt_access_mask_read_ea
= {
8618 "READ EXTENDED ATTRIBUTES access",
8619 "NO read extended attributes access"
8621 static const true_false_string tfs_nt_access_mask_append
= {
8625 static const true_false_string tfs_nt_access_mask_write
= {
8629 static const true_false_string tfs_nt_access_mask_read
= {
8634 static const true_false_string tfs_nt_share_access_delete
= {
8635 "Object can be shared for DELETE",
8636 "Object can NOT be shared for delete"
8638 static const true_false_string tfs_nt_share_access_write
= {
8639 "Object can be shared for WRITE",
8640 "Object can NOT be shared for write"
8642 static const true_false_string tfs_nt_share_access_read
= {
8643 "Object can be shared for READ",
8644 "Object can NOT be shared for read"
8647 static const value_string oplock_level_vals
[] = {
8648 {0, "No oplock granted"},
8649 {1, "Exclusive oplock granted"},
8650 {2, "Batch oplock granted"},
8651 {3, "Level II oplock granted"},
8655 static const value_string response_type_vals
[] = {
8656 {0x00, "Non-extended response"},
8657 {0x01, "Extended response"},
8661 static const value_string device_type_vals
[] = {
8662 {0x00000001, "Beep"},
8663 {0x00000002, "CDROM"},
8664 {0x00000003, "CDROM Filesystem"},
8665 {0x00000004, "Controller"},
8666 {0x00000005, "Datalink"},
8667 {0x00000006, "Dfs"},
8668 {0x00000007, "Disk"},
8669 {0x00000008, "Disk Filesystem"},
8670 {0x00000009, "Filesystem"},
8671 {0x0000000a, "Inport Port"},
8672 {0x0000000b, "Keyboard"},
8673 {0x0000000c, "Mailslot"},
8674 {0x0000000d, "MIDI-In"},
8675 {0x0000000e, "MIDI-Out"},
8676 {0x0000000f, "Mouse"},
8677 {0x00000010, "Multi UNC Provider"},
8678 {0x00000011, "Named Pipe"},
8679 {0x00000012, "Network"},
8680 {0x00000013, "Network Browser"},
8681 {0x00000014, "Network Filesystem"},
8682 {0x00000015, "NULL"},
8683 {0x00000016, "Parallel Port"},
8684 {0x00000017, "Physical card"},
8685 {0x00000018, "Printer"},
8686 {0x00000019, "Scanner"},
8687 {0x0000001a, "Serial Mouse port"},
8688 {0x0000001b, "Serial port"},
8689 {0x0000001c, "Screen"},
8690 {0x0000001d, "Sound"},
8691 {0x0000001e, "Streams"},
8692 {0x0000001f, "Tape"},
8693 {0x00000020, "Tape Filesystem"},
8694 {0x00000021, "Transport"},
8695 {0x00000022, "Unknown"},
8696 {0x00000023, "Video"},
8697 {0x00000024, "Virtual Disk"},
8698 {0x00000025, "WAVE-In"},
8699 {0x00000026, "WAVE-Out"},
8700 {0x00000027, "8042 Port"},
8701 {0x00000028, "Network Redirector"},
8702 {0x00000029, "Battery"},
8703 {0x0000002a, "Bus Extender"},
8704 {0x0000002b, "Modem"},
8705 {0x0000002c, "VDM"},
8708 static value_string_ext device_type_vals_ext
= VALUE_STRING_EXT_INIT(device_type_vals
);
8710 static const value_string is_directory_vals
[] = {
8711 {0, "This is NOT a directory"},
8712 {1, "This is a DIRECTORY"},
8717 dissect_nt_security_flags(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
8719 static int * const flags
[] = {
8720 &hf_smb_nt_security_flags_context_tracking
,
8721 &hf_smb_nt_security_flags_effective_only
,
8725 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_nt_security_flags
, ett_smb_nt_security_flags
, flags
, ENC_NA
);
8732 * XXX - there are some more flags in the description of "ZwOpenFile()"
8733 * in "Windows(R) NT(R)/2000 Native API Reference"; do those go over
8734 * the wire as well? (The spec at
8736 * http://www.samba.org/samba/ftp/specs/smb-nt01.doc
8738 * says that "the FILE_NO_INTERMEDIATE_BUFFERING option is not exported
8739 * via the SMB protocol. The NT redirector should convert this option
8740 * to FILE_WRITE_THROUGH."
8742 * The "Sync I/O Alert" and "Sync I/O Nonalert" are given the bit
8743 * values one would infer from their position in the list of flags for
8744 * "ZwOpenFile()". Most of the others probably have those values
8745 * as well, although "8.3 only" has been replaced by option FILE_OPEN_FOR_RECOVERY
8746 * which the server must ignore.).
8748 static const true_false_string tfs_nt_create_options_directory
= {
8749 "File being created/opened must be a directory",
8750 "File being created/opened must not be a directory"
8752 static const true_false_string tfs_nt_create_options_write_through
= {
8753 "Writes should flush buffered data before completing",
8754 "Writes need not flush buffered data before completing"
8756 static const true_false_string tfs_nt_create_options_sequential_only
= {
8757 "The file will only be accessed sequentially",
8758 "The file might not only be accessed sequentially"
8760 static const true_false_string tfs_nt_create_options_no_intermediate_buffering
= {
8761 "NO intermediate buffering is allowed",
8762 "Intermediate buffering is allowed"
8764 static const true_false_string tfs_nt_create_options_sync_io_alert
= {
8765 "All operations SYNCHRONOUS, waits subject to termination from alert",
8766 "Operations NOT necessarily synchronous"
8768 static const true_false_string tfs_nt_create_options_sync_io_nonalert
= {
8769 "All operations SYNCHRONOUS, waits not subject to alert",
8770 "Operations NOT necessarily synchronous"
8772 static const true_false_string tfs_nt_create_options_non_directory
= {
8773 "File being created/opened must not be a directory",
8774 "File being created/opened must be a directory"
8776 static const true_false_string tfs_nt_create_options_create_tree_connection
= {
8777 "Create Tree Connections is SET",
8778 "Create Tree Connections is NOT set"
8780 static const true_false_string tfs_nt_create_options_complete_if_oplocked
= {
8781 "Complete if oplocked is SET",
8782 "Complete if oplocked is NOT set"
8784 static const true_false_string tfs_nt_create_options_no_ea_knowledge
= {
8785 "The client does not understand extended attributes",
8786 "The client understands extended attributes"
8788 static const true_false_string tfs_nt_create_options_file_open_for_recovery
= {
8789 "The file is being opened for recovery",
8790 "The file is not being opened for recovery"
8792 static const true_false_string tfs_nt_create_options_random_access
= {
8793 "The file will be accessed randomly",
8794 "The file will not be accessed randomly"
8796 static const true_false_string tfs_nt_create_options_delete_on_close
= {
8797 "The file should be deleted when it is closed",
8798 "The file should not be deleted when it is closed"
8800 static const true_false_string tfs_nt_create_options_open_by_fileid
= {
8801 "OpenByFileID bit is SET",
8802 "OpenByFileID is NOT set"
8804 static const true_false_string tfs_nt_create_options_backup_intent
= {
8805 "This is a create with BACKUP INTENT",
8806 "This is a normal create"
8808 static const true_false_string tfs_nt_create_options_no_compression
= {
8809 "Open/Create with NO Compression",
8810 "Compression is allowed for Open/Create"
8812 static const true_false_string tfs_nt_create_options_reserve_opfilter
= {
8813 "Reserve Opfilter is SET",
8814 "Reserve Opfilter is NOT set"
8816 static const true_false_string tfs_nt_create_options_open_reparse_point
= {
8817 "Open a Reparse Point",
8820 static const true_false_string tfs_nt_create_options_open_no_recall
= {
8821 "Open No Recall is SET",
8822 "Open no recall is NOT set"
8824 static const true_false_string tfs_nt_create_options_open_for_free_space_query
= {
8825 "This is an OPEN FOR FREE SPACE QUERY",
8826 "This is NOT an open for free space query"
8830 dissect_nt_notify_completion_filter(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
8832 static int * const flags
[] = {
8833 &hf_smb_nt_notify_file_name
,
8834 &hf_smb_nt_notify_dir_name
,
8835 &hf_smb_nt_notify_attributes
,
8836 &hf_smb_nt_notify_size
,
8837 &hf_smb_nt_notify_last_write
,
8838 &hf_smb_nt_notify_last_access
,
8839 &hf_smb_nt_notify_creation
,
8840 &hf_smb_nt_notify_ea
,
8841 &hf_smb_nt_notify_security
,
8842 &hf_smb_nt_notify_stream_name
,
8843 &hf_smb_nt_notify_stream_size
,
8844 &hf_smb_nt_notify_stream_write
,
8848 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_nt_notify_completion_filter
, ett_smb_nt_notify_completion_filter
, flags
, ENC_LITTLE_ENDIAN
);
8855 dissect_nt_ioctl_flags(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
8857 static int * const flags
[] = {
8858 &hf_smb_nt_ioctl_flags_root_handle
,
8862 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_nt_ioctl_flags_completion_filter
, ett_smb_nt_ioctl_flags
, flags
, ENC_NA
);
8869 * From the section on ZwQuerySecurityObject in "Windows(R) NT(R)/2000
8870 * Native API Reference".
8872 static const true_false_string tfs_nt_qsd_owner
= {
8873 "Requesting OWNER security information",
8874 "NOT requesting owner security information",
8877 static const true_false_string tfs_nt_qsd_group
= {
8878 "Requesting GROUP security information",
8879 "NOT requesting group security information",
8882 static const true_false_string tfs_nt_qsd_dacl
= {
8883 "Requesting DACL security information",
8884 "NOT requesting DACL security information",
8887 static const true_false_string tfs_nt_qsd_sacl
= {
8888 "Requesting SACL security information",
8889 "NOT requesting SACL security information",
8892 #define NT_QSD_OWNER 0x00000001
8893 #define NT_QSD_GROUP 0x00000002
8894 #define NT_QSD_DACL 0x00000004
8895 #define NT_QSD_SACL 0x00000008
8898 dissect_security_information_mask(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
8900 static int * const flags
[] = {
8901 &hf_smb_nt_qsd_owner
,
8902 &hf_smb_nt_qsd_group
,
8903 &hf_smb_nt_qsd_dacl
,
8904 &hf_smb_nt_qsd_sacl
,
8908 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_nt_qsd
, ett_smb_security_information_mask
, flags
, ENC_LITTLE_ENDIAN
);
8915 dissect_nt_user_quota(tvbuff_t
*tvb
, proto_tree
*tree
, int offset
, uint16_t *bcp
)
8917 int old_offset
, old_sid_offset
;
8921 old_offset
= offset
;
8923 CHECK_BYTE_COUNT_TRANS_SUBR(4);
8924 qsize
= tvb_get_letohl(tvb
, offset
);
8925 proto_tree_add_uint(tree
, hf_smb_user_quota_offset
, tvb
, offset
, 4, qsize
);
8926 COUNT_BYTES_TRANS_SUBR(4);
8928 CHECK_BYTE_COUNT_TRANS_SUBR(4);
8930 proto_tree_add_item(tree
, hf_smb_length_of_sid
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
8931 COUNT_BYTES_TRANS_SUBR(4);
8934 CHECK_BYTE_COUNT_TRANS_SUBR(8);
8935 dissect_nttime(tvb
, tree
, offset
,
8936 hf_smb_user_quota_change_time
, ENC_LITTLE_ENDIAN
);
8937 COUNT_BYTES_TRANS_SUBR(8);
8939 /* number of bytes for used quota */
8940 CHECK_BYTE_COUNT_TRANS_SUBR(8);
8941 proto_tree_add_item(tree
, hf_smb_user_quota_used
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
8942 COUNT_BYTES_TRANS_SUBR(8);
8944 /* number of bytes for quota warning */
8945 CHECK_BYTE_COUNT_TRANS_SUBR(8);
8946 proto_tree_add_item(tree
, hf_smb_soft_quota_limit
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
8947 COUNT_BYTES_TRANS_SUBR(8);
8949 /* number of bytes for quota limit */
8950 CHECK_BYTE_COUNT_TRANS_SUBR(8);
8951 proto_tree_add_item(tree
, hf_smb_hard_quota_limit
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
8952 COUNT_BYTES_TRANS_SUBR(8);
8954 /* SID of the user */
8955 old_sid_offset
= offset
;
8956 offset
= dissect_nt_sid(tvb
, offset
, tree
, "Quota", NULL
, -1);
8957 *bcp
-= (offset
-old_sid_offset
);
8960 offset
= old_offset
+qsize
;
8970 dissect_nt_get_user_quota(tvbuff_t
*tvb
, proto_tree
*tree
, int offset
, uint32_t *bcp
)
8972 int old_offset
, old_sid_offset
;
8976 old_offset
= offset
;
8978 CHECK_BYTE_COUNT_TRANS_SUBR(4);
8979 qsize
= tvb_get_letohl(tvb
, offset
);
8980 proto_tree_add_uint(tree
, hf_smb_user_quota_offset
, tvb
, offset
, 4, qsize
);
8981 COUNT_BYTES_TRANS_SUBR(4);
8983 CHECK_BYTE_COUNT_TRANS_SUBR(4);
8985 proto_tree_add_item(tree
, hf_smb_length_of_sid
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
8986 COUNT_BYTES_TRANS_SUBR(4);
8988 /* SID of the user */
8989 old_sid_offset
= offset
;
8990 offset
= dissect_nt_sid(tvb
, offset
, tree
, "SID", NULL
, -1);
8991 *bcp
-= (offset
-old_sid_offset
);
8994 offset
= old_offset
+qsize
;
9004 dissect_nt_trans_data_request(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*parent_tree
, int bc
, smb_nt_transact_info_t
*nti
, smb_info_t
*si
, int subcmd
, uint32_t sd_len
, uint32_t ea_len
)
9007 int old_offset
= offset
;
9008 uint16_t bcp
= bc
; /* XXX fixme */
9009 struct access_mask_info
*ami
= NULL
;
9010 tvbuff_t
*ioctl_tvb
;
9012 DISSECTOR_ASSERT(si
);
9014 tree
= proto_tree_add_subtree_format(parent_tree
, tvb
, offset
, -1,
9015 ett_smb_nt_trans_data
, NULL
, "%s Data",
9016 val_to_str_ext(subcmd
, &nt_cmd_vals_ext
, "Unknown NT transaction (%u)"));
9019 case NT_TRANS_CREATE
:
9020 /* security descriptor */
9022 offset
= dissect_nt_sec_desc(
9023 tvb
, offset
, pinfo
, tree
, NULL
, true,
9027 /* extended attributes */
9029 proto_tree_add_item(tree
, hf_smb_extended_attributes
, tvb
, offset
, ea_len
, ENC_NA
);
9034 case NT_TRANS_IOCTL
:
9036 ioctl_tvb
= tvb_new_subset_length_caplen(tvb
, offset
, MIN((int)bc
, tvb_reported_length_remaining(tvb
, offset
)), bc
);
9038 dissect_smb2_ioctl_data(ioctl_tvb
, pinfo
, tree
, top_tree_global
, nti
->ioctl_function
, true, NULL
);
9046 switch(nti
->fid_type
) {
9047 case SMB_FID_TYPE_FILE
:
9048 ami
= &smb_file_access_mask_info
;
9050 case SMB_FID_TYPE_DIR
:
9051 ami
= &smb_dir_access_mask_info
;
9056 offset
= dissect_nt_sec_desc(
9057 tvb
, offset
, pinfo
, tree
, NULL
, true, bc
, ami
);
9059 if (offset
< (old_offset
+ bc
)) {
9060 offset
= old_offset
+ bc
;
9064 case NT_TRANS_NOTIFY
:
9066 case NT_TRANS_RENAME
:
9067 /* XXX not documented */
9071 case NT_TRANS_GET_USER_QUOTA
:
9072 /* unknown 4 bytes */
9073 proto_tree_add_item(tree
, hf_smb_unknown
, tvb
,
9078 proto_tree_add_item(tree
, hf_smb_length_of_sid
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
9081 offset
= dissect_nt_sid(tvb
, offset
, tree
, "Quota", NULL
, -1);
9083 case NT_TRANS_SET_USER_QUOTA
:
9084 offset
= dissect_nt_user_quota(tvb
, tree
, offset
, &bcp
);
9088 /* ooops there were data we didn't know how to process */
9089 if ((offset
-old_offset
) < bc
) {
9090 proto_tree_add_item(tree
, hf_smb_unknown
, tvb
, offset
,
9091 bc
- (offset
-old_offset
), ENC_NA
);
9092 offset
+= bc
- (offset
-old_offset
);
9099 dissect_nt_trans_param_request(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*parent_tree
, int len
, uint16_t bc
, smb_nt_transact_info_t
*nti
, smb_info_t
*si
, int subcmd
, uint32_t *sd_len
, uint32_t *ea_len
)
9102 uint32_t fn_len
, create_flags
, access_mask
, share_access
, create_options
;
9105 DISSECTOR_ASSERT(si
);
9107 tree
= proto_tree_add_subtree_format(parent_tree
, tvb
, offset
, len
,
9108 ett_smb_nt_trans_param
, NULL
, "%s Parameters",
9109 val_to_str_ext(subcmd
, &nt_cmd_vals_ext
, "Unknown NT transaction (%u)"));
9112 case NT_TRANS_CREATE
:
9114 create_flags
= tvb_get_letohl(tvb
, offset
);
9115 offset
= dissect_nt_create_bits(tvb
, tree
, offset
, 4, create_flags
);
9118 /* root directory fid */
9119 proto_tree_add_item(tree
, hf_smb_root_dir_fid
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
9122 /* nt access mask */
9123 access_mask
= tvb_get_letohl(tvb
, offset
);
9124 offset
= dissect_smb_access_mask_bits(tvb
, tree
, offset
, 4, access_mask
);
9127 /* allocation size */
9128 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
9131 /* Extended File Attributes */
9132 offset
= dissect_file_ext_attr(tvb
, tree
, offset
);
9136 share_access
= tvb_get_letohl(tvb
, offset
);
9137 offset
= dissect_nt_share_access_bits(tvb
, tree
, offset
, 4, share_access
);
9140 /* create disposition */
9141 proto_tree_add_item(tree
, hf_smb_nt_create_disposition
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
9144 /* create options */
9145 create_options
= tvb_get_letohl(tvb
, offset
);
9146 offset
= dissect_nt_create_options_bits(tvb
, tree
, offset
, 4, create_options
);
9150 proto_tree_add_item_ret_uint(tree
, hf_smb_sd_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
, sd_len
);
9154 proto_tree_add_item_ret_uint(tree
, hf_smb_ea_list_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
, ea_len
);
9158 fn_len
= (uint32_t)tvb_get_letohl(tvb
, offset
);
9159 proto_tree_add_uint(tree
, hf_smb_file_name_len
, tvb
, offset
, 4, fn_len
);
9162 /* impersonation level */
9163 proto_tree_add_item(tree
, hf_smb_nt_impersonation_level
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
9166 /* security flags */
9167 offset
= dissect_nt_security_flags(tvb
, tree
, offset
);
9170 /* May need to skip alignment padding. */
9173 proto_tree_add_item(tree
, hf_smb_padding
, tvb
, offset
, 1, ENC_NA
);
9178 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, true, true, &bc
);
9180 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
9182 COUNT_BYTES(fn_len
);
9186 case NT_TRANS_IOCTL
:
9188 case NT_TRANS_SSD
: {
9190 smb_fid_info_t
*fid_info
;
9193 fid
= tvb_get_letohs(tvb
, offset
);
9194 fid_info
= dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
9198 nti
->fid_type
= fid_info
->type
;
9200 nti
->fid_type
= SMB_FID_TYPE_UNKNOWN
;
9204 /* 2 reserved bytes */
9205 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
9208 /* security information */
9209 offset
= dissect_security_information_mask(tvb
, tree
, offset
);
9212 case NT_TRANS_NOTIFY
:
9214 case NT_TRANS_RENAME
:
9215 /* XXX not documented */
9217 case NT_TRANS_QSD
: {
9219 smb_fid_info_t
*fid_info
;
9222 fid
= tvb_get_letohs(tvb
, offset
);
9223 fid_info
= dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
9227 nti
->fid_type
= fid_info
->type
;
9229 nti
->fid_type
= SMB_FID_TYPE_UNKNOWN
;
9233 /* 2 reserved bytes */
9234 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
9237 /* security information */
9238 offset
= dissect_security_information_mask(tvb
, tree
, offset
);
9241 case NT_TRANS_GET_USER_QUOTA
:
9242 /* not decoded yet */
9244 case NT_TRANS_SET_USER_QUOTA
:
9245 /* not decoded yet */
9253 dissect_nt_trans_setup_request(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*parent_tree
, int len
, smb_info_t
*si
, int subcmd
)
9256 smb_nt_transact_info_t
*nti
= NULL
;
9257 smb_saved_info_t
*sip
;
9259 DISSECTOR_ASSERT(si
);
9261 if (sip
&& (sip
->extra_info_type
== SMB_EI_NTI
)) {
9262 nti
= (smb_nt_transact_info_t
*)sip
->extra_info
;
9265 tree
= proto_tree_add_subtree_format(parent_tree
, tvb
, offset
, len
,
9266 ett_smb_nt_trans_setup
, NULL
, "%s Setup",
9267 val_to_str_ext(subcmd
, &nt_cmd_vals_ext
, "Unknown NT transaction (%u)"));
9270 case NT_TRANS_CREATE
:
9273 case NT_TRANS_IOCTL
: {
9277 offset
= dissect_smb2_ioctl_function(tvb
, pinfo
, tree
, offset
, nti
? &nti
->ioctl_function
: NULL
);
9280 fid
= tvb_get_letohs(tvb
, offset
);
9281 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
9285 proto_tree_add_item(tree
, hf_smb_nt_ioctl_isfsctl
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
9289 offset
= dissect_nt_ioctl_flags(tvb
, tree
, offset
);
9296 case NT_TRANS_NOTIFY
: {
9299 /* completion filter */
9300 offset
= dissect_nt_notify_completion_filter(tvb
, tree
, offset
);
9303 fid
= tvb_get_letohs(tvb
, offset
);
9304 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
9308 proto_tree_add_item(tree
, hf_smb_nt_notify_watch_tree
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
9312 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
9317 case NT_TRANS_RENAME
:
9318 /* XXX not documented */
9323 case NT_TRANS_GET_USER_QUOTA
:
9324 /* not decoded yet */
9327 case NT_TRANS_SET_USER_QUOTA
:
9328 /* not decoded yet */
9338 dissect_nt_transaction_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
9341 uint32_t pc
= 0, pd
= 0, po
= 0, dc
= 0, od
= 0, dd
= 0;
9342 uint32_t td
= 0, tp
= 0;
9343 smb_saved_info_t
*sip
;
9345 uint32_t sd_len
, ea_len
;
9348 smb_nt_transact_info_t
*nti
= NULL
;
9349 fragment_head
*r_fd
= NULL
;
9350 tvbuff_t
*pd_tvb
= NULL
;
9351 bool save_fragmented
;
9353 save_fragmented
= pinfo
->fragmented
;
9359 DISSECTOR_ASSERT(si
);
9365 /* primary request */
9366 /* max setup count */
9367 proto_tree_add_item(tree
, hf_smb_max_setup_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
9370 /* 2 reserved bytes */
9371 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
9374 /* secondary request */
9375 /* 3 reserved bytes */
9376 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 3, ENC_NA
);
9381 /* total param count */
9382 tp
= tvb_get_letohl(tvb
, offset
);
9383 proto_tree_add_uint(tree
, hf_smb_total_param_count
, tvb
, offset
, 4, tp
);
9386 /* total data count */
9387 td
= tvb_get_letohl(tvb
, offset
);
9388 proto_tree_add_uint(tree
, hf_smb_total_data_count
, tvb
, offset
, 4, td
);
9392 /* primary request */
9393 /* max param count */
9394 proto_tree_add_item(tree
, hf_smb_max_param_count
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
9397 /* max data count */
9398 proto_tree_add_item(tree
, hf_smb_max_data_count
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
9403 pc
= tvb_get_letohl(tvb
, offset
);
9404 proto_tree_add_uint(tree
, hf_smb_param_count32
, tvb
, offset
, 4, pc
);
9408 po
= tvb_get_letohl(tvb
, offset
);
9409 proto_tree_add_uint(tree
, hf_smb_param_offset32
, tvb
, offset
, 4, po
);
9412 /* param displacement */
9414 /* primary request*/
9416 /* secondary request */
9418 proto_tree_add_item(tree
, hf_smb_param_disp32
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
9423 dc
= tvb_get_letohl(tvb
, offset
);
9424 proto_tree_add_uint(tree
, hf_smb_data_count32
, tvb
, offset
, 4, dc
);
9428 od
= tvb_get_letohl(tvb
, offset
);
9429 proto_tree_add_uint(tree
, hf_smb_data_offset32
, tvb
, offset
, 4, od
);
9432 /* data displacement */
9434 /* primary request */
9436 /* secondary request */
9437 dd
= tvb_get_letohl(tvb
, offset
);
9438 proto_tree_add_uint(tree
, hf_smb_data_disp32
, tvb
, offset
, 4, dd
);
9444 /* primary request */
9445 sc
= tvb_get_uint8(tvb
, offset
);
9446 proto_tree_add_uint(tree
, hf_smb_setup_count
, tvb
, offset
, 1, sc
);
9449 /* secondary request */
9455 /* primary request */
9456 subcmd
= tvb_get_letohs(tvb
, offset
);
9457 proto_tree_add_uint(tree
, hf_smb_nt_trans_subcmd
, tvb
, offset
, 2, subcmd
);
9458 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", %s",
9459 val_to_str_ext_const(subcmd
, &nt_cmd_vals_ext
, "<unknown>"));
9461 if (!si
->unidir
&& sip
) {
9462 if (!pinfo
->fd
->visited
) {
9464 * Allocate a new smb_nt_transact_info_t
9467 nti
= wmem_new(wmem_file_scope(), smb_nt_transact_info_t
);
9468 nti
->subcmd
= subcmd
;
9469 nti
->fid_type
= SMB_FID_TYPE_UNKNOWN
;
9470 nti
->ioctl_function
= 0;
9471 sip
->extra_info
= nti
;
9472 sip
->extra_info_type
= SMB_EI_NTI
;
9474 if (sip
->extra_info_type
== SMB_EI_NTI
) {
9475 nti
= (smb_nt_transact_info_t
*)sip
->extra_info
;
9480 /* secondary request */
9481 col_append_str(pinfo
->cinfo
, COL_INFO
, " (secondary request)");
9485 #if 0 /* XXX this is a padding byte? I don't think so. -gwr */
9488 proto_tree_add_item(tree
, hf_smb_padding
, tvb
, offset
, 1, ENC_NA
);
9493 /* if there were any setup bytes, decode them */
9495 dissect_nt_trans_setup_request(tvb
, pinfo
, offset
, tree
, sc
*2, si
, subcmd
);
9500 * Do we really need to even look at the byte count here?
9501 * Servers normally use byte_count only when assembling the
9502 * setup, parameters, and data segments. Once we know
9503 * how long each of those are, we should dissect them
9504 * using the lengths determined during assembly.
9508 /* reassembly of SMB NT Transaction data payload.
9509 In this section we do reassembly of both the data and parameters
9510 blocks of the SMB transaction command.
9512 /* do we need reassembly? */
9513 if ( (td
&& (td
!= dc
)) || (tp
&& (tp
!= pc
)) ) {
9514 /* oh yeah, either data or parameter section needs
9517 pinfo
->fragmented
= true;
9518 if (smb_trans_reassembly
) {
9519 /* ...and we were told to do reassembly */
9521 r_fd
= smb_trans_defragment(tree
, pinfo
, tvb
,
9522 po
, pc
, pd
, td
+tp
, si
);
9524 if ((r_fd
== NULL
) && dc
) {
9525 r_fd
= smb_trans_defragment(tree
, pinfo
, tvb
,
9526 od
, dc
, dd
+tp
, td
+tp
, si
);
9531 /* if we got a reassembled fd structure from the reassembly routine we
9532 must create pd_tvb from it
9535 proto_item
*frag_tree_item
;
9537 pd_tvb
= tvb_new_chain(tvb
, r_fd
->tvb_data
);
9538 add_new_data_source(pinfo
, pd_tvb
, "Reassembled SMB");
9540 show_fragment_tree(r_fd
, &smb_frag_items
, tree
, pinfo
, pd_tvb
, &frag_tree_item
);
9544 /* we have reassembled data, grab param and data from there */
9545 dissect_nt_trans_param_request(pd_tvb
, pinfo
, 0, tree
, tp
,
9546 (uint16_t) tvb_reported_length(pd_tvb
),
9547 nti
, si
, subcmd
, &sd_len
, &ea_len
);
9548 dissect_nt_trans_data_request(pd_tvb
, pinfo
, tp
, tree
, td
, nti
, si
,
9549 subcmd
, sd_len
, ea_len
);
9550 COUNT_BYTES(bc
); /* We are done */
9552 /* we do not have reassembled data, just use what we have in the
9553 packet as well as we can */
9555 if (po
> (uint32_t)offset
) {
9556 /* We have some initial padding bytes.
9561 CHECK_BYTE_COUNT(padcnt
);
9562 proto_tree_add_item(tree
, hf_smb_padding
, tvb
, offset
, padcnt
, ENC_NA
);
9563 COUNT_BYTES(padcnt
);
9566 CHECK_BYTE_COUNT(pc
);
9567 dissect_nt_trans_param_request(tvb
, pinfo
, offset
, tree
, pc
, bc
,
9568 nti
, si
, subcmd
, &sd_len
, &ea_len
);
9573 if (od
> (uint32_t)offset
) {
9574 /* We have some initial padding bytes.
9579 proto_tree_add_item(tree
, hf_smb_padding
, tvb
, offset
, padcnt
, ENC_NA
);
9580 COUNT_BYTES(padcnt
);
9583 CHECK_BYTE_COUNT(dc
);
9584 dissect_nt_trans_data_request(tvb
, pinfo
, offset
, tree
, dc
,
9585 nti
, si
, subcmd
, sd_len
, ea_len
);
9592 pinfo
->fragmented
= save_fragmented
;
9599 dissect_nt_trans_data_response(tvbuff_t
*tvb
, packet_info
*pinfo
,
9600 int offset
, proto_tree
*parent_tree
, int len
,
9601 smb_nt_transact_info_t
*nti
, smb_info_t
*si
)
9603 proto_tree
*tree
= NULL
;
9605 struct access_mask_info
*ami
= NULL
;
9606 tvbuff_t
*ioctl_tvb
;
9608 DISSECTOR_ASSERT(si
);
9612 tree
= proto_tree_add_subtree_format(parent_tree
, tvb
, offset
, len
,
9613 ett_smb_nt_trans_data
, NULL
, "%s Data",
9614 val_to_str_ext(nti
->subcmd
, &nt_cmd_vals_ext
, "Unknown NT Transaction (%u)"));
9617 * We never saw the request to which this is a
9620 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
,
9621 ett_smb_nt_trans_data
, NULL
, "Unknown NT Transaction Data (matching request not seen)");
9629 switch(nti
->subcmd
) {
9630 case NT_TRANS_CREATE
:
9632 case NT_TRANS_IOCTL
:
9634 ioctl_tvb
= tvb_new_subset_length_caplen(tvb
, offset
, MIN((int)len
, tvb_reported_length_remaining(tvb
, offset
)), len
);
9635 dissect_smb2_ioctl_data(ioctl_tvb
, pinfo
, tree
, top_tree_global
, nti
->ioctl_function
, false, NULL
);
9642 case NT_TRANS_NOTIFY
:
9644 case NT_TRANS_RENAME
:
9645 /* XXX not documented */
9649 switch(nti
->fid_type
) {
9650 case SMB_FID_TYPE_FILE
:
9651 ami
= &smb_file_access_mask_info
;
9653 case SMB_FID_TYPE_DIR
:
9654 ami
= &smb_dir_access_mask_info
;
9658 offset
= dissect_nt_sec_desc(
9659 tvb
, offset
, pinfo
, tree
, NULL
, true, len
, ami
);
9661 case NT_TRANS_GET_USER_QUOTA
:
9663 offset
= dissect_nt_user_quota(tvb
, tree
, offset
, &bcp
);
9665 case NT_TRANS_SET_USER_QUOTA
:
9666 /* not decoded yet */
9674 dissect_nt_trans_param_response(tvbuff_t
*tvb
, packet_info
*pinfo
,
9675 int offset
, proto_tree
*parent_tree
,
9676 int len
, uint16_t bc
, smb_info_t
*si
)
9678 proto_tree
*tree
= NULL
;
9681 smb_nt_transact_info_t
*nti
;
9686 smb_fid_info_t
*fid_info
= NULL
;
9689 uint8_t ext_resp
= 0;
9691 DISSECTOR_ASSERT(si
);
9693 if ((si
->sip
!= NULL
) && (si
->sip
->extra_info_type
== SMB_EI_NTI
))
9694 nti
= (smb_nt_transact_info_t
*)si
->sip
->extra_info
;
9700 tree
= proto_tree_add_subtree_format(parent_tree
, tvb
, offset
, len
,
9701 ett_smb_nt_trans_param
, NULL
, "%s Parameters",
9702 val_to_str_ext(nti
->subcmd
, &nt_cmd_vals_ext
, "Unknown NT Transaction (%u)"));
9705 * We never saw the request to which this is a
9708 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
,
9709 ett_smb_nt_trans_param
, NULL
, "Unknown NT Transaction Parameters (matching request not seen)");
9717 switch(nti
->subcmd
) {
9718 case NT_TRANS_CREATE
:
9720 proto_tree_add_item(tree
, hf_smb_oplock_level
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
9723 /* response type, as per MS-SMB 2.2.7.1.2 */
9724 ext_resp
= tvb_get_uint8(tvb
, offset
);
9725 proto_tree_add_item(tree
, hf_smb_response_type
, tvb
, offset
, 1, ENC_NA
);
9729 fid
= tvb_get_letohs(tvb
, offset
);
9730 fid_info
= dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, true, false, false, si
);
9734 proto_tree_add_item(tree
, hf_smb_create_action
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
9737 /* ea error offset */
9738 proto_tree_add_item(tree
, hf_smb_ea_error_offset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
9742 dissect_nttime(tvb
, tree
, offset
,
9743 hf_smb_create_time
, ENC_LITTLE_ENDIAN
);
9747 dissect_nttime(tvb
, tree
, offset
,
9748 hf_smb_access_time
, ENC_LITTLE_ENDIAN
);
9751 /* last write time */
9752 dissect_nttime(tvb
, tree
, offset
,
9753 hf_smb_last_write_time
, ENC_LITTLE_ENDIAN
);
9756 /* last change time */
9757 dissect_nttime(tvb
, tree
, offset
,
9758 hf_smb_change_time
, ENC_LITTLE_ENDIAN
);
9761 /* Extended File Attributes */
9762 offset
= dissect_file_ext_attr(tvb
, tree
, offset
);
9764 /* allocation size */
9765 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
9769 proto_tree_add_item(tree
, hf_smb_end_of_file
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
9773 ftype
= tvb_get_letohs(tvb
, offset
);
9774 proto_tree_add_item(tree
, hf_smb_file_type
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
9778 offset
= dissect_ipc_state(tvb
, tree
, offset
, false);
9781 isdir
= tvb_get_uint8(tvb
, offset
);
9782 proto_tree_add_item(tree
, hf_smb_is_directory
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
9785 /* decode extended response per [MS-SMB] 2.2.7.1.2
9786 (volume_guid, file_id, max_acc, guest_acc)
9787 Just like dissect_nt_create_andx_response */
9788 if (ext_resp
!= 0) {
9789 proto_tree
*tr
= NULL
;
9791 /* The first field is a Volume GUID ... */
9792 proto_tree_add_item(tree
, hf_smb_volume_guid
,
9793 tvb
, offset
, 16, ENC_NA
);
9796 /* The file ID comes next */
9797 proto_tree_add_item(tree
, hf_smb_file_id_64bit
,
9798 tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
9801 tr
= proto_tree_add_subtree(tree
, tvb
, offset
, 4,
9802 ett_smb_nt_access_mask
, NULL
, "Maximal Access Rights");
9803 offset
= dissect_smb_access_mask(tvb
, tr
, offset
);
9805 tr
= proto_tree_add_subtree(tree
, tvb
, offset
, 4,
9806 ett_smb_nt_access_mask
, NULL
, "Guest Maximal Access Rights");
9807 offset
= dissect_smb_access_mask(tvb
, tr
, offset
);
9810 /* Try to remember the type of this fid so that we can dissect
9811 * any future security descriptor (access mask) properly
9816 fid_info
->type
= SMB_FID_TYPE_FILE
;
9820 fid_info
->type
= SMB_FID_TYPE_DIR
;
9826 fid_info
->type
= SMB_FID_TYPE_PIPE
;
9830 case NT_TRANS_IOCTL
:
9834 case NT_TRANS_NOTIFY
:
9836 old_offset
= offset
;
9838 /* next entry offset */
9839 neo
= tvb_get_letohl(tvb
, offset
);
9840 proto_tree_add_uint(tree
, hf_smb_next_entry_offset
, tvb
, offset
, 4, neo
);
9843 /* broken implementations */
9847 proto_tree_add_item(tree
, hf_smb_nt_notify_action
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
9850 /* broken implementations */
9854 fn_len
= (uint32_t)tvb_get_letohl(tvb
, offset
);
9855 proto_tree_add_uint(tree
, hf_smb_file_name_len
, tvb
, offset
, 4, fn_len
);
9858 /* broken implementations */
9862 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, true, true, &bc
);
9865 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
9867 COUNT_BYTES(fn_len
);
9869 /* broken implementations */
9873 break; /* no more structures */
9875 /* skip to next structure */
9876 padcnt
= (old_offset
+ neo
) - offset
;
9879 * XXX - this is bogus; flag it?
9884 COUNT_BYTES(padcnt
);
9886 /* broken implementations */
9891 case NT_TRANS_RENAME
:
9892 /* XXX not documented */
9896 * This appears to be the size of the security
9897 * descriptor; the calling sequence of
9898 * "ZwQuerySecurityObject()" suggests that it would
9899 * be. The actual security descriptor wouldn't
9900 * follow if the max data count in the request
9901 * was smaller; this lets the client know how
9902 * big a buffer it needs to provide.
9904 proto_tree_add_item(tree
, hf_smb_sec_desc_len
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
9907 case NT_TRANS_GET_USER_QUOTA
:
9908 proto_tree_add_item(tree
, hf_smb_size_returned_quota_data
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
9911 case NT_TRANS_SET_USER_QUOTA
:
9912 /* not decoded yet */
9920 dissect_nt_trans_setup_response(tvbuff_t
*tvb
, packet_info
*pinfo
,
9921 int offset
, proto_tree
*parent_tree
,
9922 int len
, smb_info_t
*si
)
9924 smb_nt_transact_info_t
*nti
;
9926 DISSECTOR_ASSERT(si
);
9928 if ((si
->sip
!= NULL
) && (si
->sip
->extra_info_type
== SMB_EI_NTI
))
9929 nti
= (smb_nt_transact_info_t
*)si
->sip
->extra_info
;
9935 proto_tree_add_bytes_format(parent_tree
, hf_smb_nt_transaction_setup
, tvb
, offset
, len
,
9937 val_to_str_ext(nti
->subcmd
, &nt_cmd_vals_ext
, "Unknown NT Transaction (%u)"));
9940 * We never saw the request to which this is a
9943 proto_tree_add_expert(parent_tree
, pinfo
, &ei_smb_nt_transaction_setup
, tvb
, offset
, len
);
9951 switch(nti
->subcmd
) {
9952 case NT_TRANS_CREATE
:
9954 case NT_TRANS_IOCTL
:
9958 case NT_TRANS_NOTIFY
:
9960 case NT_TRANS_RENAME
:
9961 /* XXX not documented */
9965 case NT_TRANS_GET_USER_QUOTA
:
9966 /* not decoded yet */
9968 case NT_TRANS_SET_USER_QUOTA
:
9969 /* not decoded yet */
9977 dissect_nt_transaction_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
9980 uint32_t pc
= 0, po
= 0, pd
= 0, dc
= 0, od
= 0, dd
= 0;
9981 uint32_t td
= 0, tp
= 0;
9982 smb_nt_transact_info_t
*nti
= NULL
;
9985 fragment_head
*r_fd
= NULL
;
9986 tvbuff_t
*pd_tvb
= NULL
;
9987 bool save_fragmented
;
9989 DISSECTOR_ASSERT(si
);
9991 if ((si
->sip
!= NULL
) && (si
->sip
->extra_info_type
== SMB_EI_NTI
))
9992 nti
= (smb_nt_transact_info_t
*)si
->sip
->extra_info
;
9996 /* primary request */
9998 proto_tree_add_uint(tree
, hf_smb_nt_trans_subcmd
, tvb
, 0, 0, nti
->subcmd
);
9999 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", %s",
10000 val_to_str_ext(nti
->subcmd
, &nt_cmd_vals_ext
, "<unknown (%u)>"));
10002 proto_tree_add_uint_format_value(tree
, hf_smb_nt_trans_subcmd
, tvb
, offset
, 0, -1,
10003 "<unknown function - could not find matching request>");
10004 col_append_str(pinfo
->cinfo
, COL_INFO
, ", <unknown>");
10009 /* 3 reserved bytes */
10010 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 3, ENC_NA
);
10013 /* total param count */
10014 tp
= tvb_get_letohl(tvb
, offset
);
10015 proto_tree_add_uint(tree
, hf_smb_total_param_count
, tvb
, offset
, 4, tp
);
10018 /* total data count */
10019 td
= tvb_get_letohl(tvb
, offset
);
10020 proto_tree_add_uint(tree
, hf_smb_total_data_count
, tvb
, offset
, 4, td
);
10024 pc
= tvb_get_letohl(tvb
, offset
);
10025 proto_tree_add_uint(tree
, hf_smb_param_count32
, tvb
, offset
, 4, pc
);
10029 po
= tvb_get_letohl(tvb
, offset
);
10030 proto_tree_add_uint(tree
, hf_smb_param_offset32
, tvb
, offset
, 4, po
);
10033 /* param displacement */
10034 pd
= tvb_get_letohl(tvb
, offset
);
10035 proto_tree_add_uint(tree
, hf_smb_param_disp32
, tvb
, offset
, 4, pd
);
10039 dc
= tvb_get_letohl(tvb
, offset
);
10040 proto_tree_add_uint(tree
, hf_smb_data_count32
, tvb
, offset
, 4, dc
);
10044 od
= tvb_get_letohl(tvb
, offset
);
10045 proto_tree_add_uint(tree
, hf_smb_data_offset32
, tvb
, offset
, 4, od
);
10048 /* data displacement */
10049 dd
= tvb_get_letohl(tvb
, offset
);
10050 proto_tree_add_uint(tree
, hf_smb_data_disp32
, tvb
, offset
, 4, dd
);
10054 sc
= tvb_get_uint8(tvb
, offset
);
10055 proto_tree_add_uint(tree
, hf_smb_setup_count
, tvb
, offset
, 1, sc
);
10060 dissect_nt_trans_setup_response(tvb
, pinfo
, offset
, tree
, sc
*2, si
);
10066 /* reassembly of SMB NT Transaction data payload.
10067 In this section we do reassembly of both the data and parameters
10068 blocks of the SMB transaction command.
10070 save_fragmented
= pinfo
->fragmented
;
10071 /* do we need reassembly? */
10072 if ( (td
&& (td
!= dc
)) || (tp
&& (tp
!= pc
)) ) {
10073 /* oh yeah, either data or parameter section needs
10076 pinfo
->fragmented
= true;
10077 if (smb_trans_reassembly
) {
10078 /* ...and we were told to do reassembly */
10080 r_fd
= smb_trans_defragment(tree
, pinfo
, tvb
,
10081 po
, pc
, pd
, td
+tp
, si
);
10084 if ((r_fd
== NULL
) && dc
) {
10085 r_fd
= smb_trans_defragment(tree
, pinfo
, tvb
,
10086 od
, dc
, dd
+tp
, td
+tp
, si
);
10091 /* if we got a reassembled fd structure from the reassembly routine we
10092 must create pd_tvb from it
10095 proto_item
*frag_tree_item
;
10097 pd_tvb
= tvb_new_chain(tvb
, r_fd
->tvb_data
);
10098 add_new_data_source(pinfo
, pd_tvb
, "Reassembled SMB");
10100 show_fragment_tree(r_fd
, &smb_frag_items
, tree
, pinfo
, pd_tvb
, &frag_tree_item
);
10105 /* we have reassembled data, grab param and data from there */
10106 dissect_nt_trans_param_response(pd_tvb
, pinfo
, 0, tree
, tp
,
10107 (uint16_t) tvb_reported_length(pd_tvb
), si
);
10108 dissect_nt_trans_data_response(pd_tvb
, pinfo
, tp
, tree
, td
, nti
, si
);
10109 COUNT_BYTES(bc
); /* We are done */
10111 /* we do not have reassembled data, just use what we have in the
10112 packet as well as we can */
10114 if (po
> (uint32_t)offset
) {
10115 /* We have some initial padding bytes.
10117 padcnt
= po
-offset
;
10120 CHECK_BYTE_COUNT(padcnt
);
10121 proto_tree_add_item(tree
, hf_smb_padding
, tvb
, offset
, padcnt
, ENC_NA
);
10122 COUNT_BYTES(padcnt
);
10125 CHECK_BYTE_COUNT(pc
);
10126 dissect_nt_trans_param_response(tvb
, pinfo
, offset
, tree
, pc
, bc
, si
);
10131 if (od
> (uint32_t)offset
) {
10132 /* We have some initial padding bytes.
10134 padcnt
= od
-offset
;
10137 proto_tree_add_item(tree
, hf_smb_padding
, tvb
, offset
, padcnt
, ENC_NA
);
10138 COUNT_BYTES(padcnt
);
10141 CHECK_BYTE_COUNT(dc
);
10142 dissect_nt_trans_data_response(tvb
, pinfo
, offset
, tree
, dc
, nti
, si
);
10146 pinfo
->fragmented
= save_fragmented
;
10153 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
10154 NT Transaction command ends here
10155 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
10157 static const value_string print_mode_vals
[] = {
10159 {1, "Graphics Mode"},
10164 dissect_open_print_file_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
10171 DISSECTOR_ASSERT(si
);
10176 proto_tree_add_item(tree
, hf_smb_setup_len
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
10180 proto_tree_add_item(tree
, hf_smb_print_mode
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
10185 /* buffer format */
10186 CHECK_BYTE_COUNT(1);
10187 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
10190 /* print identifier */
10191 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, true, false, &bc
);
10194 proto_tree_add_string(tree
, hf_smb_print_identifier
, tvb
, offset
, fn_len
,
10196 COUNT_BYTES(fn_len
);
10205 dissect_write_print_file_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
10214 fid
= tvb_get_letohs(tvb
, offset
);
10215 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
10220 /* buffer format */
10221 CHECK_BYTE_COUNT(1);
10222 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
10226 CHECK_BYTE_COUNT(2);
10227 cnt
= tvb_get_letohs(tvb
, offset
);
10228 proto_tree_add_uint(tree
, hf_smb_data_len
, tvb
, offset
, 2, cnt
);
10232 offset
= dissect_file_data(tvb
, tree
, offset
, (uint16_t) cnt
, -1, (uint16_t) cnt
);
10240 static const value_string print_status_vals
[] = {
10241 {1, "Held or Stopped"},
10243 {3, "Awaiting print"},
10244 {4, "In intercept"},
10245 {5, "File had error"},
10246 {6, "Printer error"},
10251 dissect_get_print_queue_request(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
10259 proto_tree_add_item(tree
, hf_smb_max_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
10263 proto_tree_add_item(tree
, hf_smb_start_index
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
10274 dissect_print_queue_element(tvbuff_t
*tvb
, packet_info
*pinfo
,
10275 proto_tree
*parent_tree
, int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
10281 DISSECTOR_ASSERT(si
);
10283 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, 28,
10284 ett_smb_print_queue_entry
, NULL
, "Queue entry");
10287 CHECK_BYTE_COUNT_SUBR(4);
10288 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
10289 hf_smb_print_queue_date
,
10290 hf_smb_print_queue_dos_date
, hf_smb_print_queue_dos_time
, false);
10294 CHECK_BYTE_COUNT_SUBR(1);
10295 proto_tree_add_item(tree
, hf_smb_print_status
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
10296 COUNT_BYTES_SUBR(1);
10298 /* spool file number */
10299 CHECK_BYTE_COUNT_SUBR(2);
10300 proto_tree_add_item(tree
, hf_smb_print_spool_file_number
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
10301 COUNT_BYTES_SUBR(2);
10303 /* spool file size */
10304 CHECK_BYTE_COUNT_SUBR(4);
10305 proto_tree_add_item(tree
, hf_smb_print_spool_file_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
10306 COUNT_BYTES_SUBR(4);
10308 /* reserved byte */
10309 CHECK_BYTE_COUNT_SUBR(1);
10310 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
10311 COUNT_BYTES_SUBR(1);
10315 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, true, true, bcp
);
10316 CHECK_STRING_SUBR(fn
);
10317 proto_tree_add_string(tree
, hf_smb_print_spool_file_name
, tvb
, offset
, 16,
10319 COUNT_BYTES_SUBR(fn_len
);
10326 dissect_get_print_queue_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
10328 uint16_t cnt
= 0, len
;
10336 cnt
= tvb_get_letohs(tvb
, offset
);
10337 proto_tree_add_uint(tree
, hf_smb_count
, tvb
, offset
, 2, cnt
);
10340 /* restart index */
10341 proto_tree_add_item(tree
, hf_smb_restart_index
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
10346 /* buffer format */
10347 CHECK_BYTE_COUNT(1);
10348 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
10352 CHECK_BYTE_COUNT(2);
10353 len
= tvb_get_letohs(tvb
, offset
);
10354 proto_tree_add_uint(tree
, hf_smb_data_len
, tvb
, offset
, 2, len
);
10357 /* queue elements */
10359 offset
= dissect_print_queue_element(tvb
, pinfo
, tree
, offset
,
10372 dissect_send_single_block_message_request(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
10377 uint16_t message_len
;
10383 /* buffer format */
10384 CHECK_BYTE_COUNT(1);
10385 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
10388 /* originator name */
10389 /* XXX - what if this runs past bc? */
10390 name_len
= tvb_strsize(tvb
, offset
);
10391 CHECK_BYTE_COUNT(name_len
);
10392 proto_tree_add_item(tree
, hf_smb_originator_name
, tvb
, offset
,
10393 name_len
, ENC_ASCII
);
10394 COUNT_BYTES(name_len
);
10396 /* buffer format */
10397 CHECK_BYTE_COUNT(1);
10398 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
10401 /* destination name */
10402 /* XXX - what if this runs past bc? */
10403 name_len
= tvb_strsize(tvb
, offset
);
10404 CHECK_BYTE_COUNT(name_len
);
10405 proto_tree_add_item(tree
, hf_smb_destination_name
, tvb
, offset
,
10406 name_len
, ENC_ASCII
);
10407 COUNT_BYTES(name_len
);
10409 /* buffer format */
10410 CHECK_BYTE_COUNT(1);
10411 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
10415 CHECK_BYTE_COUNT(2);
10416 message_len
= tvb_get_letohs(tvb
, offset
);
10417 proto_tree_add_uint(tree
, hf_smb_message_len
, tvb
, offset
, 2,
10422 CHECK_BYTE_COUNT(message_len
);
10423 proto_tree_add_item(tree
, hf_smb_message
, tvb
, offset
, message_len
,
10425 COUNT_BYTES(message_len
);
10433 dissect_send_multi_block_message_start_request(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
10443 /* buffer format */
10444 CHECK_BYTE_COUNT(1);
10445 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
10448 /* originator name */
10449 /* XXX - what if this runs past bc? */
10450 name_len
= tvb_strsize(tvb
, offset
);
10451 CHECK_BYTE_COUNT(name_len
);
10452 proto_tree_add_item(tree
, hf_smb_originator_name
, tvb
, offset
,
10453 name_len
, ENC_ASCII
);
10454 COUNT_BYTES(name_len
);
10456 /* buffer format */
10457 CHECK_BYTE_COUNT(1);
10458 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
10461 /* destination name */
10462 /* XXX - what if this runs past bc? */
10463 name_len
= tvb_strsize(tvb
, offset
);
10464 CHECK_BYTE_COUNT(name_len
);
10465 proto_tree_add_item(tree
, hf_smb_destination_name
, tvb
, offset
,
10466 name_len
, ENC_ASCII
);
10467 COUNT_BYTES(name_len
);
10475 dissect_message_group_id(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
10482 /* message group ID */
10483 proto_tree_add_item(tree
, hf_smb_mgid
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
10494 dissect_send_multi_block_message_text_request(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
10498 uint16_t message_len
;
10504 /* buffer format */
10505 CHECK_BYTE_COUNT(1);
10506 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
10510 CHECK_BYTE_COUNT(2);
10511 message_len
= tvb_get_letohs(tvb
, offset
);
10512 proto_tree_add_uint(tree
, hf_smb_message_len
, tvb
, offset
, 2,
10517 CHECK_BYTE_COUNT(message_len
);
10518 proto_tree_add_item(tree
, hf_smb_message
, tvb
, offset
, message_len
,
10520 COUNT_BYTES(message_len
);
10528 dissect_forwarded_name(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
10538 /* buffer format */
10539 CHECK_BYTE_COUNT(1);
10540 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
10543 /* forwarded name */
10544 /* XXX - what if this runs past bc? */
10545 name_len
= tvb_strsize(tvb
, offset
);
10546 CHECK_BYTE_COUNT(name_len
);
10547 proto_tree_add_item(tree
, hf_smb_forwarded_name
, tvb
, offset
,
10548 name_len
, ENC_ASCII
);
10549 COUNT_BYTES(name_len
);
10557 dissect_get_machine_name_response(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
10567 /* buffer format */
10568 CHECK_BYTE_COUNT(1);
10569 proto_tree_add_item(tree
, hf_smb_buffer_format
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
10573 /* XXX - what if this runs past bc? */
10574 name_len
= tvb_strsize(tvb
, offset
);
10575 CHECK_BYTE_COUNT(name_len
);
10576 proto_tree_add_item(tree
, hf_smb_machine_name
, tvb
, offset
,
10577 name_len
, ENC_ASCII
);
10578 COUNT_BYTES(name_len
);
10587 dissect_nt_create_andx_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si _U_
)
10589 uint8_t wc
, cmd
= 0xff;
10590 uint16_t andxoffset
= 0;
10594 uint32_t create_flags
= 0, access_mask
= 0, file_attributes
= 0;
10595 uint32_t share_access
= 0, create_options
= 0, create_disposition
= 0;
10597 DISSECTOR_ASSERT(si
);
10601 /* next smb command */
10602 cmd
= tvb_get_uint8(tvb
, offset
);
10604 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
10606 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
10610 /* reserved byte */
10611 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
10615 andxoffset
= tvb_get_letohs(tvb
, offset
);
10616 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
10619 /* reserved byte */
10620 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
10623 /* file name len */
10624 fn_len
= tvb_get_letohs(tvb
, offset
);
10625 proto_tree_add_uint(tree
, hf_smb_file_name_len
, tvb
, offset
, 2, fn_len
);
10629 create_flags
= tvb_get_letohl(tvb
, offset
);
10630 offset
= dissect_nt_create_bits(tvb
, tree
, offset
, 4, create_flags
);
10632 /* root directory fid */
10633 proto_tree_add_item(tree
, hf_smb_root_dir_fid
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
10636 /* nt access mask */
10637 access_mask
= tvb_get_letohl(tvb
, offset
);
10638 offset
= dissect_smb_access_mask_bits(tvb
, tree
, offset
, 4, access_mask
);
10640 /* allocation size */
10641 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
10644 /* Extended File Attributes */
10645 file_attributes
= tvb_get_letohl(tvb
, offset
);
10646 offset
= dissect_file_ext_attr_bits(tvb
, tree
, offset
, 4, file_attributes
);
10649 share_access
= tvb_get_letohl(tvb
, offset
);
10650 offset
= dissect_nt_share_access_bits(tvb
, tree
, offset
, 4, share_access
);
10652 /* create disposition */
10653 create_disposition
= tvb_get_letohl(tvb
, offset
);
10654 proto_tree_add_item(tree
, hf_smb_nt_create_disposition
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
10657 /* create options */
10658 create_options
= tvb_get_letohl(tvb
, offset
);
10659 offset
= dissect_nt_create_options_bits(tvb
, tree
, offset
, 4, create_options
);
10661 /* impersonation level */
10662 proto_tree_add_item(tree
, hf_smb_nt_impersonation_level
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
10665 /* security flags */
10666 offset
= dissect_nt_security_flags(tvb
, tree
, offset
);
10671 if (fn_len
== -1) {
10673 * We never set the file name length, perhaps because
10674 * the word count was zero. This is not a valid
10677 proto_tree_add_expert(tree
, pinfo
, &ei_smb_missing_word_parameters
,
10681 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, false, &bc
);
10684 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
10686 COUNT_BYTES(fn_len
);
10688 /* store it for the fid->name/openframe/closeframe matching in
10689 * dissect_smb_fid() called from the response.
10691 if ((!pinfo
->fd
->visited
) && si
->sip
&& fn
) {
10692 smb_fid_saved_info_t
*fsi
;
10694 fsi
= wmem_new(wmem_file_scope(), smb_fid_saved_info_t
);
10695 fsi
->filename
= wmem_strdup(wmem_file_scope(), fn
);
10696 fsi
->create_flags
= create_flags
;
10697 fsi
->access_mask
= access_mask
;
10698 fsi
->file_attributes
= file_attributes
;
10699 fsi
->share_access
= share_access
;
10700 fsi
->create_options
= create_options
;
10701 fsi
->create_disposition
= create_disposition
;
10703 si
->sip
->extra_info_type
= SMB_EI_FILEDATA
;
10704 si
->sip
->extra_info
= fsi
;
10707 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Path: %s",
10708 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
10712 if (cmd
!= 0xff) { /* there is an andX command */
10713 if (andxoffset
< offset
)
10714 THROW(ReportedBoundsError
);
10715 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
10723 dissect_nt_create_andx_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
)
10725 uint8_t wc
, cmd
= 0xff;
10726 uint16_t andxoffset
= 0;
10731 smb_fid_info_t
*fid_info
= NULL
;
10735 /* next smb command */
10736 cmd
= tvb_get_uint8(tvb
, offset
);
10738 proto_tree_add_uint(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
);
10740 proto_tree_add_uint_format_value(tree
, hf_smb_andxcmd
, tvb
, offset
, 1, cmd
, "No further commands (0xff)");
10744 /* reserved byte */
10745 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
10749 andxoffset
= tvb_get_letohs(tvb
, offset
);
10750 proto_tree_add_uint(tree
, hf_smb_andxoffset
, tvb
, offset
, 2, andxoffset
);
10754 proto_tree_add_item(tree
, hf_smb_oplock_level
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
10758 fid
= tvb_get_letohs(tvb
, offset
);
10759 fid_info
= dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, true, false, false, si
);
10762 /* create action */
10763 /*XXX is this really the same as create disposition in the request? it looks so*/
10764 /* No, it is not. It is the same as the create action from an Open&X request ... RJS */
10765 proto_tree_add_item(tree
, hf_smb_create_action
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
10769 dissect_nttime(tvb
, tree
, offset
, hf_smb_create_time
, ENC_LITTLE_ENDIAN
);
10773 dissect_nttime(tvb
, tree
, offset
, hf_smb_access_time
, ENC_LITTLE_ENDIAN
);
10776 /* last write time */
10777 dissect_nttime(tvb
, tree
, offset
,
10778 hf_smb_last_write_time
, ENC_LITTLE_ENDIAN
);
10781 /* last change time */
10782 dissect_nttime(tvb
, tree
, offset
, hf_smb_change_time
, ENC_LITTLE_ENDIAN
);
10785 /* Extended File Attributes */
10786 offset
= dissect_file_ext_attr(tvb
, tree
, offset
);
10788 /* allocation size */
10789 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
10793 /* We store the end of file */
10795 fid_info
->end_of_file
= tvb_get_letoh64(tvb
, offset
);
10797 proto_tree_add_item(tree
, hf_smb_end_of_file
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
10801 ftype
= tvb_get_letohs(tvb
, offset
);
10802 proto_tree_add_item(tree
, hf_smb_file_type
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
10806 offset
= dissect_ipc_state(tvb
, tree
, offset
, false);
10809 isdir
= tvb_get_uint8(tvb
, offset
);
10810 proto_tree_add_item(tree
, hf_smb_is_directory
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
10813 /* Always use the word count to decide if this is an "extended" response.
10814 When the server doesn't support the 0x10 flag, it will send a normal
10815 34 word response, so the word count is the only way to tell which of
10816 the response formats we have. MS-SMB 2.2.4.9.2
10817 Also note that the extended format is actually 50 words, but in a
10818 "windows behavior note" they say Windows sets word count to 42.
10819 Handle anything 42 or larger as "extended" format. */
10821 proto_tree
*tr
= NULL
;
10823 /* The first field is a Volume GUID ... */
10824 proto_tree_add_item(tree
, hf_smb_volume_guid
,
10825 tvb
, offset
, 16, ENC_NA
);
10828 /* The file ID comes next */
10829 proto_tree_add_item(tree
, hf_smb_file_id_64bit
,
10830 tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
10833 tr
= proto_tree_add_subtree(tree
, tvb
, offset
, 4,
10834 ett_smb_nt_access_mask
, NULL
, "Maximal Access Rights");
10836 offset
= dissect_smb_access_mask(tvb
, tr
, offset
);
10838 tr
= proto_tree_add_subtree(tree
, tvb
, offset
, 4,
10839 ett_smb_nt_access_mask
, NULL
, "Guest Maximal Access Rights");
10841 offset
= dissect_smb_access_mask(tvb
, tr
, offset
);
10844 /* Try to remember the type of this fid so that we can dissect
10845 * any future security descriptor (access mask) properly
10850 fid_info
->type
= SMB_FID_TYPE_FILE
;
10854 fid_info
->type
= SMB_FID_TYPE_DIR
;
10860 fid_info
->type
= SMB_FID_TYPE_PIPE
;
10868 if (cmd
!= 0xff) { /* there is an andX command */
10869 if (andxoffset
< offset
)
10870 THROW(ReportedBoundsError
);
10871 dissect_smb_command(tvb
, pinfo
, andxoffset
, smb_tree
, cmd
, false, si
);
10874 /* if there was an error, add a generated filename to the tree */
10875 if (si
->nt_status
) {
10876 dissect_smb_fid(tvb
, pinfo
, tree
, 0, 0, fid
, true, true, true, si
);
10884 dissect_nt_cancel_request(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
10898 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
10899 BEGIN Transaction/Transaction2 Primary and secondary requests
10900 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
10903 static const value_string trans2_cmd_vals
[] = {
10905 { 0x01, "FIND_FIRST2" },
10906 { 0x02, "FIND_NEXT2" },
10907 { 0x03, "QUERY_FS_INFO" },
10908 { 0x04, "SET_FS_INFO" },
10909 { 0x05, "QUERY_PATH_INFO" },
10910 { 0x06, "SET_PATH_INFO" },
10911 { 0x07, "QUERY_FILE_INFO" },
10912 { 0x08, "SET_FILE_INFO" },
10914 { 0x0A, "IOCTL2" },
10915 { 0x0B, "FIND_NOTIFY_FIRST" },
10916 { 0x0C, "FIND_NOTIFY_NEXT" },
10917 { 0x0D, "CREATE_DIRECTORY" },
10918 { 0x0E, "SESSION_SETUP" },
10919 { 0x0F, "Unknown (0x0f)" }, /* dummy so val_to_str_ext can do indexed lookup */
10920 { 0x10, "GET_DFS_REFERRAL" },
10921 { 0x11, "REPORT_DFS_INCONSISTENCY" },
10924 value_string_ext trans2_cmd_vals_ext
= VALUE_STRING_EXT_INIT(trans2_cmd_vals
);
10926 static const true_false_string tfs_tf_dtid
= {
10927 "Also DISCONNECT TID",
10928 "Do NOT disconnect TID"
10930 static const true_false_string tfs_tf_owt
= {
10931 "One Way Transaction (NO RESPONSE)",
10932 "Two way transaction"
10935 static const true_false_string tfs_ff2_backup
= {
10936 "Find WITH backup intent",
10939 static const true_false_string tfs_ff2_continue
= {
10940 "CONTINUE search from previous position",
10941 "New search, do NOT continue from previous position"
10943 static const true_false_string tfs_ff2_resume
= {
10944 "Return RESUME keys",
10945 "Do NOT return resume keys"
10947 static const true_false_string tfs_ff2_close_eos
= {
10948 "CLOSE search if END OF SEARCH is reached",
10949 "Do NOT close search if end of search reached"
10951 static const true_false_string tfs_ff2_close
= {
10952 "CLOSE search after this request",
10953 "Do NOT close search after this request"
10957 TRANS2_FIND_FIRST2 and TRANS2_FIND_NEXT2
10959 static const value_string ff2_il_vals
[] = {
10960 { 1, "Info Standard"},
10961 { 2, "Info Query EA Size"},
10962 { 3, "Info Query EAs From List"},
10963 { 0x0101, "Find File Directory Info"},
10964 { 0x0102, "Find File Full Directory Info"},
10965 { 0x0103, "Find File Names Info"},
10966 { 0x0104, "Find File Both Directory Info"},
10967 { 0x0105, "Find File Full Directory Info"},
10968 { 0x0106, "Find File Id Both Directory Info"},
10969 { 0x0202, "Find File Unix"},
10970 { 0x020B, "Find File Unix Info2"},
10974 /* values used by :
10975 TRANS2_QUERY_PATH_INFORMATION
10976 TRANS2_QUERY_FILE_INFORMATION
10978 static const value_string qpi_loi_vals
[] = {
10979 { 1, "Info Standard"},
10980 { 2, "Info Query EA Size"},
10981 { 3, "Info Query EAs From List"},
10982 { 4, "Info Query All EAs"},
10983 { 6, "Info Is Name Valid"},
10984 { 0x0101, "Query File Basic Info"},
10985 { 0x0102, "Query File Standard Info"},
10986 { 0x0103, "Query File EA Info"},
10987 { 0x0104, "Query File Name Info"},
10988 { 0x0107, "Query File All Info"},
10989 { 0x0108, "Query File Alt Name Info"},
10990 { 0x0109, "Query File Stream Info"},
10991 { 0x010b, "Query File Compression Info"},
10992 { 0x0200, "Query File Unix Basic"},
10993 { 0x0201, "Query File Unix Link"},
10994 { 0x0202, "Query File Unix Hardlink"},
10995 { 0x0204, "Query File Posix ACL"},
10996 { 0x0205, "Query File Posix XATTR"},
10997 { 0x0206, "Query File Posix Attr Flags"},
10998 { 0x0207, "Query File Posix Permissions"},
10999 { 0x0208, "Query File Posix Lock"},
11000 { 0x020b, "Query File Unix Info2"},
11001 { 1004, "Query File Basic Info"},
11002 { 1005, "Query File Standard Info"},
11003 { 1006, "Query File Internal Info"},
11004 { 1007, "Query File EA Info"},
11005 { 1009, "Query File Name Info"},
11006 { 1010, "Query File Rename Info"},
11007 { 1011, "Query File Link Info"},
11008 { 1012, "Query File Names Info"},
11009 { 1013, "Query File Disposition Info"},
11010 { 1014, "Query File Position Info"},
11011 { 1015, "Query File Full EA Info"},
11012 { 1016, "Query File Mode Info"},
11013 { 1017, "Query File Alignment Info"},
11014 { 1018, "Query File All Info"},
11015 { 1019, "Query File Allocation Info"},
11016 { 1020, "Query File End of File Info"},
11017 { 1021, "Query File Alt Name Info"},
11018 { 1022, "Query File Stream Info"},
11019 { 1023, "Query File Pipe Info"},
11020 { 1024, "Query File Pipe Local Info"},
11021 { 1025, "Query File Pipe Remote Info"},
11022 { 1026, "Query File Mailslot Query Info"},
11023 { 1027, "Query File Mailslot Set Info"},
11024 { 1028, "Query File Compression Info"},
11025 { 1029, "Query File ObjectID Info"},
11026 { 1030, "Query File Completion Info"},
11027 { 1031, "Query File Move Cluster Info"},
11028 { 1032, "Query File Quota Info"},
11029 { 1033, "Query File Reparsepoint Info"},
11030 { 1034, "Query File Network Open Info"},
11031 { 1035, "Query File Attribute Tag Info"},
11032 { 1036, "Query File Tracking Info"},
11033 { 1037, "Query File Maximum Info"},
11036 static value_string_ext qpi_loi_vals_ext
= VALUE_STRING_EXT_INIT(qpi_loi_vals
);
11038 /* values used by :
11039 TRANS2_SET_PATH_INFORMATION
11040 TRANS2_SET_FILE_INFORMATION
11041 (the SNIA CIFS spec lists some only for TRANS2_SET_FILE_INFORMATION,
11042 but I'm assuming they apply to TRANS2_SET_PATH_INFORMATION as
11043 well; note that they're different from the QUERY_PATH_INFORMATION
11044 and QUERY_FILE_INFORMATION values!)
11046 static const value_string spi_loi_vals
[] = {
11047 { 1, "Info Standard"},
11048 { 2, "Info Set EAs"},
11049 { 4, "Info Query All EAs"},
11050 { 0x0101, "Set File Basic Info"},
11051 { 0x0102, "Set File Disposition Info"},
11052 { 0x0103, "Set File Allocation Info"},
11053 { 0x0104, "Set File End Of File Info"},
11054 { 0x0200, "Set File Unix Basic"},
11055 { 0x0201, "Set File Unix Link"},
11056 { 0x0202, "Set File Unix HardLink"},
11057 { 0x0204, "Set File Unix ACL"},
11058 { 0x0205, "Set File Unix XATTR"},
11059 { 0x0206, "Set File Unix Attr Flags"},
11060 { 0x0208, "Set File Posix Lock"},
11061 { 0x0209, "Set File Posix Open"},
11062 { 0x020a, "Set File Posix Unlink"},
11063 { 0x020b, "Set File Unix Info2"},
11064 { 1004, "Set File Basic Info"},
11065 { 1010, "Set Rename Information"},
11066 { 1013, "Set Disposition Information"},
11067 { 1014, "Set Position Information"},
11068 { 1016, "Set Mode Information"},
11069 { 1019, "Set Allocation Information"},
11070 { 1020, "Set EOF Information"},
11071 { 1023, "Set File Pipe Information"},
11072 { 1025, "Set File Pipe Remote Information"},
11073 { 1029, "Set Copy On Write Information"},
11074 { 1032, "Set OLE Class ID Information"},
11075 { 1039, "Set Inherit Context Index Information"},
11076 { 1040, "Set OLE Information (?)"},
11079 static value_string_ext spi_loi_vals_ext
= VALUE_STRING_EXT_INIT(spi_loi_vals
);
11081 static const value_string qfsi_vals
[] = {
11082 { 1, "Info Allocation"},
11083 { 2, "Info Volume"},
11084 { 0x0101, "Query FS Label Info"},
11085 { 0x0102, "Query FS Volume Info"},
11086 { 0x0103, "Query FS Size Info"},
11087 { 0x0104, "Query FS Device Info"},
11088 { 0x0105, "Query FS Attribute Info"},
11089 { 0x0200, "Unix Query FS Info"},
11090 { 0x0202, "Unix Query POSIX whoami"},
11091 { 0x0301, "Mac Query FS Info"},
11092 { 1001, "Query FS Label Info"},
11093 { 1002, "Query FS Volume Info"},
11094 { 1003, "Query FS Size Info"},
11095 { 1004, "Query FS Device Info"},
11096 { 1005, "Query FS Attribute Info"},
11097 { 1006, "Query FS Quota Info"},
11098 { 1007, "Query Full FS Size Info"},
11099 { 1008, "Object ID Information"},
11102 static value_string_ext qfsi_vals_ext
= VALUE_STRING_EXT_INIT(qfsi_vals
);
11104 static const value_string sfsi_vals
[] = {
11105 { 0x203, "Request Transport Encryption"},
11106 { 1006, "Set FS Quota Info"},
11110 static const value_string nt_rename_vals
[] = {
11111 { 0x0103, "Create Hard Link"},
11116 static const value_string delete_pending_vals
[] = {
11117 {0, "Normal, no pending delete"},
11118 {1, "This object has DELETE PENDING"},
11122 static const value_string alignment_vals
[] = {
11123 {0, "Byte alignment"},
11124 {1, "Word (16bit) alignment"},
11125 {3, "Long (32bit) alignment"},
11126 {7, "8 byte boundary alignment"},
11127 {0x0f, "16 byte boundary alignment"},
11128 {0x1f, "32 byte boundary alignment"},
11129 {0x3f, "64 byte boundary alignment"},
11130 {0x7f, "128 byte boundary alignment"},
11131 {0xff, "256 byte boundary alignment"},
11132 {0x1ff, "512 byte boundary alignment"},
11136 static const true_false_string tfs_marked_for_deletion
= {
11137 "File is MARKED FOR DELETION",
11138 "File is NOT marked for deletion"
11141 static const true_false_string tfs_get_dfs_server_hold_storage
= {
11142 "Referral SERVER HOLDS STORAGE for the file",
11143 "Referral server does NOT hold storage for the file"
11145 static const true_false_string tfs_get_dfs_fielding
= {
11146 "The server in referral is FIELDING CAPABLE",
11147 "The server in referrals is NOT fielding capable"
11150 static const true_false_string tfs_dfs_referral_flags_name_list_referral
= {
11151 "A domain/DC referral response",
11152 "NOT a domain/DC referral response"
11155 static const true_false_string tfs_dfs_referral_flags_target_set_boundary
= {
11156 "The first target in the target set",
11157 "NOT the first target in the target set"
11160 static const value_string dfs_referral_server_type_vals
[] = {
11161 {0, "Non-root targets returned"},
11162 {1, "Root targets returns"},
11167 static const true_false_string tfs_device_char_removable
= {
11168 "This is a REMOVABLE device",
11169 "This is NOT a removable device"
11171 static const true_false_string tfs_device_char_read_only
= {
11172 "This is a READ-ONLY device",
11173 "This is NOT a read-only device"
11175 static const true_false_string tfs_device_char_floppy
= {
11176 "This is a FLOPPY DISK device",
11177 "This is NOT a floppy disk device"
11179 static const true_false_string tfs_device_char_write_once
= {
11180 "This is a WRITE-ONCE device",
11181 "This is NOT a write-once device"
11183 static const true_false_string tfs_device_char_remote
= {
11184 "This is a REMOTE device",
11185 "This is NOT a remote device"
11187 static const true_false_string tfs_device_char_mounted
= {
11188 "This device is MOUNTED",
11189 "This device is NOT mounted"
11191 static const true_false_string tfs_device_char_virtual
= {
11192 "This is a VIRTUAL device",
11193 "This is NOT a virtual device"
11195 static const true_false_string tfs_device_char_secure_open
= {
11196 "This device supports SECURE OPEN",
11197 "This device does NOT support secure open"
11199 static const true_false_string tfs_device_char_ts
= {
11200 "This is a TERMINAL SERVICES device",
11201 "This is NOT a terminal services device"
11203 static const true_false_string tfs_device_char_webdav
= {
11204 "This is a WEBDAV device",
11205 "This is NOT a webdav device"
11207 static const true_false_string tfs_device_char_portable
= {
11208 "This is a PORTABLE device",
11209 "This is NOT a portable device"
11211 static const true_false_string tfs_device_char_aat
= {
11212 "This device ALLOWS APPCONTAINER TRAVERSAL",
11213 "This device does NOT allow appcontainer traversal"
11216 static const true_false_string tfs_fs_attr_css
= {
11217 "This FS supports CASE SENSITIVE SEARCHes",
11218 "This FS does NOT support case sensitive searches"
11220 static const true_false_string tfs_fs_attr_cpn
= {
11221 "This FS supports CASE PRESERVED NAMES",
11222 "This FS does NOT support case preserved names"
11224 static const true_false_string tfs_fs_attr_uod
= {
11225 "This FS supports UNICODE NAMES",
11226 "This FS does NOT support unicode names"
11228 static const true_false_string tfs_fs_attr_pacls
= {
11229 "This FS supports PERSISTENT ACLs",
11230 "This FS does NOT support persistent acls"
11232 static const true_false_string tfs_fs_attr_fc
= {
11233 "This FS supports COMPRESSED FILES",
11234 "This FS does NOT support compressed files"
11236 static const true_false_string tfs_fs_attr_vq
= {
11237 "This FS supports VOLUME QUOTAS",
11238 "This FS does NOT support volume quotas"
11240 static const true_false_string tfs_fs_attr_srp
= {
11241 "This FS supports REPARSE POINTS",
11242 "This FS does NOT support reparse points"
11244 static const true_false_string tfs_fs_attr_srs
= {
11245 "This FS supports REMOTE STORAGE",
11246 "This FS does NOT support remote storage"
11248 static const true_false_string tfs_fs_attr_ssf
= {
11249 "This FS supports SPARSE FILES",
11250 "This FS does NOT support sparse files"
11252 static const true_false_string tfs_fs_attr_sla
= {
11253 "This FS supports LFN APIs",
11254 "This FS does NOT support lfn apis"
11256 static const true_false_string tfs_fs_attr_vic
= {
11257 "This FS VOLUME IS COMPRESSED",
11258 "This FS volume is NOT compressed"
11260 static const true_false_string tfs_fs_attr_soids
= {
11261 "This FS supports OIDs",
11262 "This FS does NOT support OIDs"
11264 static const true_false_string tfs_fs_attr_se
= {
11265 "This FS supports ENCRYPTION",
11266 "This FS does NOT support encryption"
11268 static const true_false_string tfs_fs_attr_ns
= {
11269 "This FS supports NAMED STREAMS",
11270 "This FS does NOT support named streams"
11272 static const true_false_string tfs_fs_attr_rov
= {
11273 "This is a READ ONLY VOLUME",
11274 "This is a read/write volume"
11276 static const true_false_string tfs_fs_attr_swo
= {
11277 "This is a SEQUENTIAL WRITE ONCE VOLUME",
11278 "This is NOT a sequential write once volume"
11280 static const true_false_string tfs_fs_attr_st
= {
11281 "This filesystem supports TRANSACTIONS",
11282 "This filesystem does NOT support transactions"
11284 static const true_false_string tfs_fs_attr_shl
= {
11285 "This filesystem supports HARD LINKS",
11286 "This filesystem does NOT support hard links"
11288 static const true_false_string tfs_fs_attr_sis
= {
11289 "This filesystem supports INTEGRITY STREAMS",
11290 "This filesystem does NOT support integrity streams"
11292 static const true_false_string tfs_fs_attr_sbr
= {
11293 "This filesystem supports BLOCK REFCOUNTING",
11294 "This filesystem does NOT support block refcounting"
11296 static const true_false_string tfs_fs_attr_ssv
= {
11297 "This filesystem supports SPARSE VDL",
11298 "This filesystem does NOT support sparse vdl"
11301 #define FF2_RESUME 0x0004
11304 dissect_ff2_flags(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
, int offset
, smb_info_t
*si
)
11307 smb_transact2_info_t
*t2i
;
11308 static int * const flags
[] = {
11309 &hf_smb_ff2_backup
,
11310 &hf_smb_ff2_continue
,
11311 &hf_smb_ff2_resume
,
11312 &hf_smb_ff2_close_eos
,
11317 mask
= tvb_get_letohs(tvb
, offset
);
11319 DISSECTOR_ASSERT(si
);
11321 if ((si
->sip
!= NULL
) && (si
->sip
->extra_info_type
== SMB_EI_T2I
)) {
11322 t2i
= (smb_transact2_info_t
*)si
->sip
->extra_info
;
11324 if (!pinfo
->fd
->visited
)
11325 t2i
->resume_keys
= (mask
& FF2_RESUME
);
11329 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_ff2
, ett_smb_find_first2_flags
, flags
, ENC_LITTLE_ENDIAN
);
11337 dissect_sfi_ioflag(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
11339 static int * const flags
[] = {
11340 &hf_smb_sfi_writetru
,
11341 &hf_smb_sfi_caching
,
11345 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_sfi
, ett_smb_ioflag
, flags
, ENC_LITTLE_ENDIAN
);
11353 dissect_get_dfs_request_data(tvbuff_t
*tvb
, packet_info
*pinfo
,
11354 proto_tree
*tree
, int offset
, uint16_t *bcp
, bool unicode
)
11358 uint16_t bc
= *bcp
;
11360 /* referral level */
11361 CHECK_BYTE_COUNT_TRANS(2);
11362 proto_tree_add_item(tree
, hf_smb_max_referral_level
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
11363 COUNT_BYTES_TRANS(2);
11366 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, unicode
, &fn_len
, false, false, &bc
);
11367 CHECK_STRING_TRANS(fn
);
11368 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
11370 COUNT_BYTES_TRANS(fn_len
);
11372 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", File: %s",
11373 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
11380 dissect_transaction2_request_parameters(tvbuff_t
*tvb
, packet_info
*pinfo
,
11381 proto_tree
*parent_tree
, int offset
, int subcmd
, uint16_t bc
, smb_info_t
*si
)
11384 smb_transact2_info_t
*t2i
;
11387 uint32_t search_id
;
11389 DISSECTOR_ASSERT(si
);
11391 if ((si
->sip
!= NULL
) && (si
->sip
->extra_info_type
== SMB_EI_T2I
))
11392 t2i
= (smb_transact2_info_t
*)si
->sip
->extra_info
;
11396 tree
= proto_tree_add_subtree_format(parent_tree
, tvb
, offset
, bc
,
11397 ett_smb_transaction_params
, NULL
, "%s Parameters",
11398 val_to_str_ext(subcmd
, &trans2_cmd_vals_ext
,
11399 "Unknown (0x%02x)"));
11402 case 0x0000: /*TRANS2_OPEN2*/
11404 CHECK_BYTE_COUNT_TRANS(2);
11405 offset
= dissect_open_flags(tvb
, tree
, offset
, 0x000f);
11408 /* desired access */
11409 CHECK_BYTE_COUNT_TRANS(2);
11410 offset
= dissect_access(tvb
, tree
, offset
, hf_smb_desired_access
);
11413 /* Search Attributes */
11414 CHECK_BYTE_COUNT_TRANS(2);
11415 offset
= dissect_search_attributes(tvb
, tree
, offset
);
11418 /* File Attributes */
11419 CHECK_BYTE_COUNT_TRANS(2);
11420 offset
= dissect_file_attributes(tvb
, tree
, offset
);
11424 CHECK_BYTE_COUNT_TRANS(4);
11425 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
11426 hf_smb_create_time
,
11427 hf_smb_create_dos_date
, hf_smb_create_dos_time
,
11431 /* open function */
11432 CHECK_BYTE_COUNT_TRANS(2);
11433 offset
= dissect_open_function(tvb
, tree
, offset
);
11436 /* allocation size */
11437 CHECK_BYTE_COUNT_TRANS(4);
11438 proto_tree_add_item(tree
, hf_smb_alloc_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
11439 COUNT_BYTES_TRANS(4);
11441 /* 10 reserved bytes */
11442 CHECK_BYTE_COUNT_TRANS(10);
11443 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 10, ENC_NA
);
11444 COUNT_BYTES_TRANS(10);
11447 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, false, &bc
);
11448 CHECK_STRING_TRANS(fn
);
11449 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
11451 COUNT_BYTES_TRANS(fn_len
);
11453 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Path: %s",
11454 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
11456 case 0x0001: /*TRANS2_FIND_FIRST2*/
11457 /* Search Attributes */
11458 CHECK_BYTE_COUNT_TRANS(2);
11459 offset
= dissect_search_attributes(tvb
, tree
, offset
);
11463 CHECK_BYTE_COUNT_TRANS(2);
11464 proto_tree_add_item(tree
, hf_smb_search_count_max
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
11465 COUNT_BYTES_TRANS(2);
11467 /* Find First2 flags */
11468 CHECK_BYTE_COUNT_TRANS(2);
11469 offset
= dissect_ff2_flags(tvb
, pinfo
, tree
, offset
, si
);
11472 /* Find First2 information level */
11473 CHECK_BYTE_COUNT_TRANS(2);
11474 si
->info_level
= tvb_get_letohs(tvb
, offset
);
11475 if ((t2i
!= NULL
) && !pinfo
->fd
->visited
)
11476 t2i
->info_level
= si
->info_level
;
11477 proto_tree_add_uint(tree
, hf_smb_ff2_information_level
, tvb
, offset
, 2, si
->info_level
);
11478 COUNT_BYTES_TRANS(2);
11481 CHECK_BYTE_COUNT_TRANS(4);
11482 proto_tree_add_item(tree
, hf_smb_storage_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
11483 COUNT_BYTES_TRANS(4);
11485 /* search pattern */
11486 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, false, &bc
);
11487 CHECK_STRING_TRANS(fn
);
11488 if (t2i
&& !t2i
->name
) {
11489 t2i
->name
= wmem_strdup(wmem_file_scope(), fn
);
11491 proto_tree_add_string(tree
, hf_smb_search_pattern
, tvb
, offset
, fn_len
,
11493 COUNT_BYTES_TRANS(fn_len
);
11495 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Pattern: %s",
11496 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
11497 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", %s",
11498 val_to_str(si
->info_level
, ff2_il_vals
, "Unknown (0x%02x)"));
11501 case 0x0002: /*TRANS2_FIND_NEXT2*/
11503 CHECK_BYTE_COUNT_TRANS(2);
11504 proto_tree_add_item_ret_uint(tree
, hf_smb_search_id
, tvb
, offset
, 2,
11505 ENC_LITTLE_ENDIAN
, &search_id
);
11506 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Search ID: %u", (uint16_t)search_id
);
11507 COUNT_BYTES_TRANS(2);
11510 CHECK_BYTE_COUNT_TRANS(2);
11511 proto_tree_add_item(tree
, hf_smb_search_count_max
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
11512 COUNT_BYTES_TRANS(2);
11514 /* Find First2 information level */
11515 CHECK_BYTE_COUNT_TRANS(2);
11516 si
->info_level
= tvb_get_letohs(tvb
, offset
);
11517 if ((t2i
!= NULL
) && !pinfo
->fd
->visited
)
11518 t2i
->info_level
= si
->info_level
;
11519 proto_tree_add_uint(tree
, hf_smb_ff2_information_level
, tvb
, offset
, 2, si
->info_level
);
11520 COUNT_BYTES_TRANS(2);
11522 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", %s",
11523 val_to_str(si
->info_level
, ff2_il_vals
, "Unknown (0x%02x)"));
11526 CHECK_BYTE_COUNT_TRANS(4);
11527 proto_tree_add_item(tree
, hf_smb_resume
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
11528 COUNT_BYTES_TRANS(4);
11530 /* Find First2 flags */
11531 CHECK_BYTE_COUNT_TRANS(2);
11532 offset
= dissect_ff2_flags(tvb
, pinfo
, tree
, offset
, si
);
11536 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, false, &bc
);
11537 CHECK_STRING_TRANS(fn
);
11538 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
11540 COUNT_BYTES_TRANS(fn_len
);
11543 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Continue after: %s",
11544 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
11546 col_append_str(pinfo
->cinfo
, COL_INFO
, ", Continue after previous file");
11549 case 0x0003: /*TRANS2_QUERY_FS_INFORMATION*/
11550 /* level of interest */
11551 CHECK_BYTE_COUNT_TRANS(2);
11552 si
->info_level
= tvb_get_letohs(tvb
, offset
);
11553 if ((t2i
!= NULL
) && !pinfo
->fd
->visited
)
11554 t2i
->info_level
= si
->info_level
;
11555 proto_tree_add_uint(tree
, hf_smb_qfsi_information_level
, tvb
, offset
, 2, si
->info_level
);
11556 COUNT_BYTES_TRANS(2);
11558 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", %s",
11559 val_to_str_ext(si
->info_level
, &qfsi_vals_ext
,
11560 "Unknown (0x%02x)"));
11563 case 0x0004: /*TRANS2_SET_FS_INFORMATION*/
11564 /* level of interest */
11565 CHECK_BYTE_COUNT_TRANS(4);
11566 si
->info_level
= tvb_get_letohs(tvb
, offset
+2);
11567 if ((t2i
!= NULL
) && !pinfo
->fd
->visited
)
11568 t2i
->info_level
= si
->info_level
;
11569 proto_tree_add_uint(tree
, hf_smb_sfsi_information_level
, tvb
, offset
+2, 2, si
->info_level
);
11570 COUNT_BYTES_TRANS(4);
11572 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", %s",
11573 val_to_str(si
->info_level
, sfsi_vals
,
11574 "Unknown (0x%02x)"));
11577 case 0x0005: /*TRANS2_QUERY_PATH_INFORMATION*/
11578 /* level of interest */
11579 CHECK_BYTE_COUNT_TRANS(2);
11580 si
->info_level
= tvb_get_letohs(tvb
, offset
);
11581 if ((t2i
!= NULL
) && !pinfo
->fd
->visited
)
11582 t2i
->info_level
= si
->info_level
;
11583 proto_tree_add_uint(tree
, hf_smb_qpi_loi
, tvb
, offset
, 2, si
->info_level
);
11584 COUNT_BYTES_TRANS(2);
11587 pinfo
->cinfo
, COL_INFO
, ", %s",
11588 val_to_str_ext(si
->info_level
, &qpi_loi_vals_ext
,
11591 /* 4 reserved bytes */
11592 CHECK_BYTE_COUNT_TRANS(4);
11593 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 4, ENC_NA
);
11594 COUNT_BYTES_TRANS(4);
11597 fn
= tvb_get_stringz_enc(pinfo
->pool
, tvb
, offset
, &fn_len
, (si
->unicode
? ENC_UTF_16
|ENC_LITTLE_ENDIAN
: ENC_ASCII
|ENC_NA
));
11599 CHECK_STRING_TRANS(fn
);
11600 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
11602 COUNT_BYTES_TRANS(fn_len
);
11603 if (t2i
&& !t2i
->name
) {
11604 t2i
->name
= wmem_strdup(wmem_file_scope(), fn
);
11607 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Path: %s",
11608 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
11611 case 0x0006: /*TRANS2_SET_PATH_INFORMATION*/
11612 /* level of interest */
11613 CHECK_BYTE_COUNT_TRANS(2);
11614 si
->info_level
= tvb_get_letohs(tvb
, offset
);
11615 if ((t2i
!= NULL
) && !pinfo
->fd
->visited
)
11616 t2i
->info_level
= si
->info_level
;
11617 proto_tree_add_uint(tree
, hf_smb_spi_loi
, tvb
, offset
, 2, si
->info_level
);
11618 COUNT_BYTES_TRANS(2);
11620 /* 4 reserved bytes */
11621 CHECK_BYTE_COUNT_TRANS(4);
11622 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 4, ENC_NA
);
11623 COUNT_BYTES_TRANS(4);
11626 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, false, &bc
);
11627 CHECK_STRING_TRANS(fn
);
11628 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
11630 COUNT_BYTES_TRANS(fn_len
);
11632 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Path: %s",
11633 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
11636 case 0x0007: { /*TRANS2_QUERY_FILE_INFORMATION*/
11640 CHECK_BYTE_COUNT_TRANS(2);
11641 fid
= tvb_get_letohs(tvb
, offset
);
11642 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
11643 COUNT_BYTES_TRANS(2);
11645 /* level of interest */
11646 CHECK_BYTE_COUNT_TRANS(2);
11647 si
->info_level
= tvb_get_letohs(tvb
, offset
);
11648 if ((t2i
!= NULL
) && !pinfo
->fd
->visited
)
11649 t2i
->info_level
= si
->info_level
;
11650 proto_tree_add_uint(tree
, hf_smb_qpi_loi
, tvb
, offset
, 2, si
->info_level
);
11651 COUNT_BYTES_TRANS(2);
11654 pinfo
->cinfo
, COL_INFO
, ", %s",
11655 val_to_str_ext(si
->info_level
, &qpi_loi_vals_ext
,
11660 case 0x0008: { /*TRANS2_SET_FILE_INFORMATION*/
11664 CHECK_BYTE_COUNT_TRANS(2);
11665 fid
= tvb_get_letohs(tvb
, offset
);
11666 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
11667 COUNT_BYTES_TRANS(2);
11669 /* level of interest */
11670 CHECK_BYTE_COUNT_TRANS(2);
11671 si
->info_level
= tvb_get_letohs(tvb
, offset
);
11672 if ((t2i
!= NULL
) && !pinfo
->fd
->visited
)
11673 t2i
->info_level
= si
->info_level
;
11674 proto_tree_add_uint(tree
, hf_smb_spi_loi
, tvb
, offset
, 2, si
->info_level
);
11675 COUNT_BYTES_TRANS(2);
11679 * XXX - "Microsoft Networks SMB File Sharing Protocol
11680 * Extensions Version 3.0, Document Version 1.11,
11681 * July 19, 1990" says this is I/O flags, but it's
11682 * reserved in the SNIA spec, and some clients appear
11683 * to leave junk in it.
11685 * Is this some field used only if a particular
11686 * dialect was negotiated, so that clients can feel
11687 * safe not setting it if they haven't negotiated that
11688 * dialect? Or do the (non-OS/2) clients simply not care
11689 * about that particular OS/2-oriented dialect?
11693 CHECK_BYTE_COUNT_TRANS(2);
11694 offset
= dissect_sfi_ioflag(tvb
, tree
, offset
);
11697 /* 2 reserved bytes */
11698 CHECK_BYTE_COUNT_TRANS(2);
11699 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
11700 COUNT_BYTES_TRANS(2);
11705 case 0x0009: /*TRANS2_FSCTL*/
11706 /* this call has no parameter block in the request */
11709 * XXX - "Microsoft Networks SMB File Sharing Protocol
11710 * Extensions Version 3.0, Document Version 1.11,
11711 * July 19, 1990" says this contains a
11712 * "File system specific parameter block". (That means
11713 * we may not be able to dissect it in any case.)
11716 case 0x000a: /*TRANS2_IOCTL2*/
11717 /* this call has no parameter block in the request */
11720 * XXX - "Microsoft Networks SMB File Sharing Protocol
11721 * Extensions Version 3.0, Document Version 1.11,
11722 * July 19, 1990" says this contains a
11723 * "Device/function specific parameter block". (That
11724 * means we may not be able to dissect it in any case.)
11727 case 0x000b: /*TRANS2_FIND_NOTIFY_FIRST*/
11728 /* Search Attributes */
11729 CHECK_BYTE_COUNT_TRANS(2);
11730 offset
= dissect_search_attributes(tvb
, tree
, offset
);
11733 /* Number of changes to wait for */
11734 CHECK_BYTE_COUNT_TRANS(2);
11735 proto_tree_add_item(tree
, hf_smb_change_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
11736 COUNT_BYTES_TRANS(2);
11738 /* Find Notify information level */
11739 CHECK_BYTE_COUNT_TRANS(2);
11740 si
->info_level
= tvb_get_letohs(tvb
, offset
);
11741 if ((t2i
!= NULL
) && !pinfo
->fd
->visited
)
11742 t2i
->info_level
= si
->info_level
;
11743 proto_tree_add_uint(tree
, hf_smb_fn_information_level
, tvb
, offset
, 2, si
->info_level
);
11744 COUNT_BYTES_TRANS(2);
11746 /* 4 reserved bytes */
11747 CHECK_BYTE_COUNT_TRANS(4);
11748 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 4, ENC_NA
);
11749 COUNT_BYTES_TRANS(4);
11752 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, false, &bc
);
11753 CHECK_STRING_TRANS(fn
);
11754 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
11756 COUNT_BYTES_TRANS(fn_len
);
11758 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Path: %s",
11759 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
11762 case 0x000c: /*TRANS2_FIND_NOTIFY_NEXT*/
11763 /* Monitor handle */
11764 CHECK_BYTE_COUNT_TRANS(2);
11765 proto_tree_add_item(tree
, hf_smb_monitor_handle
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
11766 COUNT_BYTES_TRANS(2);
11768 /* Number of changes to wait for */
11769 CHECK_BYTE_COUNT_TRANS(2);
11770 proto_tree_add_item(tree
, hf_smb_change_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
11771 COUNT_BYTES_TRANS(2);
11774 case 0x000d: /*TRANS2_CREATE_DIRECTORY*/
11775 /* 4 reserved bytes */
11776 CHECK_BYTE_COUNT_TRANS(4);
11777 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 4, ENC_NA
);
11778 COUNT_BYTES_TRANS(4);
11781 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
,
11782 false, false, &bc
);
11783 CHECK_STRING_TRANS(fn
);
11784 proto_tree_add_string(tree
, hf_smb_dir_name
, tvb
, offset
, fn_len
,
11786 COUNT_BYTES_TRANS(fn_len
);
11788 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Dir: %s",
11789 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
11791 case 0x000e: /*TRANS2_SESSION_SETUP*/
11792 /* XXX unknown structure*/
11794 case 0x0010: /*TRANS2_GET_DFS_REFERRAL*/
11795 offset
= dissect_get_dfs_request_data(tvb
, pinfo
, tree
, offset
, &bc
, si
->unicode
);
11797 case 0x0011: /*TRANS2_REPORT_DFS_INCONSISTENCY*/
11799 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, false, &bc
);
11800 CHECK_STRING_TRANS(fn
);
11801 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
11803 COUNT_BYTES_TRANS(fn_len
);
11805 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", File: %s",
11806 format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
11810 /* ooops there were data we didn't know how to process */
11812 proto_tree_add_item(tree
, hf_smb_unknown
, tvb
, offset
, bc
, ENC_NA
);
11820 * XXX - just use "dissect_connect_flags()" here?
11823 dissect_transaction_flags(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
11826 static int * const flags
[] = {
11827 &hf_smb_transaction_flags_owt
,
11828 &hf_smb_transaction_flags_dtid
,
11832 mask
= tvb_get_letohs(tvb
, offset
);
11833 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_transaction_flags
, ett_smb_transaction_flags
, flags
, ENC_LITTLE_ENDIAN
);
11840 dissect_get_dfs_flags(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
11842 static int * const flags
[] = {
11843 &hf_smb_get_dfs_server_hold_storage
,
11844 &hf_smb_get_dfs_fielding
,
11848 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_get_dfs_flags
, ett_smb_get_dfs_flags
, flags
, ENC_LITTLE_ENDIAN
);
11855 dissect_dfs_referral_flags(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
11857 static int * const flags
[] = {
11858 &hf_smb_dfs_referral_flags_name_list_referral
,
11859 &hf_smb_dfs_referral_flags_target_set_boundary
,
11863 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_dfs_referral_flags
, ett_smb_dfs_referral_flags
, flags
, ENC_LITTLE_ENDIAN
);
11870 /* dfs inconsistency data (4.4.2)
11873 dissect_dfs_inconsistency_data(tvbuff_t
*tvb
, packet_info
*pinfo
,
11874 proto_tree
*tree
, int offset
, uint16_t *bcp
, smb_info_t
*si
)
11879 DISSECTOR_ASSERT(si
);
11881 /*XXX should this data hold version and size? unclear from doc*/
11882 /* referral version */
11883 CHECK_BYTE_COUNT_TRANS_SUBR(2);
11884 proto_tree_add_item(tree
, hf_smb_dfs_referral_version
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
11885 COUNT_BYTES_TRANS_SUBR(2);
11887 /* referral size */
11888 CHECK_BYTE_COUNT_TRANS_SUBR(2);
11889 proto_tree_add_item(tree
, hf_smb_dfs_referral_size
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
11890 COUNT_BYTES_TRANS_SUBR(2);
11892 /* referral server type */
11893 CHECK_BYTE_COUNT_TRANS_SUBR(2);
11894 proto_tree_add_item(tree
, hf_smb_dfs_referral_server_type
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
11895 COUNT_BYTES_TRANS_SUBR(2);
11897 /* referral flags */
11898 CHECK_BYTE_COUNT_TRANS_SUBR(2);
11899 offset
= dissect_dfs_referral_flags(tvb
, tree
, offset
);
11903 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, false, bcp
);
11904 CHECK_STRING_TRANS_SUBR(fn
);
11905 proto_tree_add_string(tree
, hf_smb_dfs_referral_node
, tvb
, offset
, fn_len
,
11907 COUNT_BYTES_TRANS_SUBR(fn_len
);
11913 dissect_dfs_referral_strings(tvbuff_t
*tvb
, proto_tree
*tree
, int hfindex
,
11914 int nstring
, int stroffset
, int oldoffset
, int offset
,
11915 uint16_t bc
, bool unicode
, int *end
)
11919 int str_len
; /* string length including the terminating NULL. */
11921 if (stroffset
<= oldoffset
)
11924 bc
-= (stroffset
- offset
);
11925 for (istring
= 0; istring
< nstring
; istring
++) {
11926 if ((int16_t)bc
> 0) {
11927 str
= get_unicode_or_ascii_string(wmem_packet_scope(), tvb
, &stroffset
, unicode
, &str_len
, false, false, &bc
);
11928 CHECK_STRING_TRANS_SUBR(str
);
11929 proto_tree_add_string(tree
, hfindex
, tvb
, stroffset
, str_len
, str
);
11930 stroffset
+= str_len
;
11932 if (end
&& (*end
< stroffset
))
11942 dissect_dfs_referral_string(tvbuff_t
*tvb
, proto_tree
*tree
, int hfindex
,
11943 int stroffset
, int oldoffset
, int offset
,
11944 uint16_t bc
, bool unicode
, int *end
)
11946 return dissect_dfs_referral_strings(tvb
, tree
, hfindex
,
11947 1, stroffset
, oldoffset
, offset
,
11952 dissect_dfs_referral_entry_v2(tvbuff_t
*tvb
, proto_tree
*tree
, int oldoffset
, int offset
,
11953 uint16_t refflags _U_
, uint16_t *bcp
, bool unicode
, int *ucstring_end
)
11956 uint16_t pathoffset
;
11957 uint16_t altpathoffset
;
11958 uint16_t nodeoffset
;
11961 CHECK_BYTE_COUNT_TRANS_SUBR(4);
11962 proto_tree_add_item(tree
, hf_smb_dfs_referral_proximity
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
11963 COUNT_BYTES_TRANS_SUBR(4);
11966 CHECK_BYTE_COUNT_TRANS_SUBR(4);
11967 proto_tree_add_item(tree
, hf_smb_dfs_referral_ttl
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
11968 COUNT_BYTES_TRANS_SUBR(4);
11971 CHECK_BYTE_COUNT_TRANS_SUBR(2);
11972 pathoffset
= tvb_get_letohs(tvb
, offset
);
11973 proto_tree_add_uint(tree
, hf_smb_dfs_referral_path_offset
, tvb
, offset
, 2, pathoffset
);
11974 COUNT_BYTES_TRANS_SUBR(2);
11976 /* alt path offset */
11977 CHECK_BYTE_COUNT_TRANS_SUBR(2);
11978 altpathoffset
= tvb_get_letohs(tvb
, offset
);
11979 proto_tree_add_uint(tree
, hf_smb_dfs_referral_alt_path_offset
, tvb
, offset
, 2, altpathoffset
);
11980 COUNT_BYTES_TRANS_SUBR(2);
11983 CHECK_BYTE_COUNT_TRANS_SUBR(2);
11984 nodeoffset
= tvb_get_letohs(tvb
, offset
);
11985 proto_tree_add_uint(tree
, hf_smb_dfs_referral_node_offset
, tvb
, offset
, 2, nodeoffset
);
11986 COUNT_BYTES_TRANS_SUBR(2);
11990 dissect_dfs_referral_string(tvb
, tree
, hf_smb_dfs_referral_path
,
11991 pathoffset
+oldoffset
, oldoffset
, offset
,
11992 *bcp
, unicode
, ucstring_end
);
11996 if (altpathoffset
) {
11997 dissect_dfs_referral_string(tvb
, tree
, hf_smb_dfs_referral_alt_path
,
11998 altpathoffset
+oldoffset
, oldoffset
, offset
,
11999 *bcp
, unicode
, ucstring_end
);
12004 dissect_dfs_referral_string(tvb
, tree
, hf_smb_dfs_referral_node
,
12005 nodeoffset
+oldoffset
, oldoffset
, offset
,
12006 *bcp
, unicode
, ucstring_end
);
12015 dissect_dfs_referral_entry_v3(tvbuff_t
*tvb
, proto_tree
*tree
, int oldoffset
, int offset
,
12016 uint16_t refflags
, uint16_t *bcp
, bool unicode
, int *ucstring_end
)
12018 uint16_t domoffset
;
12019 uint16_t nexpnames
;
12020 uint16_t expoffset
;
12021 uint16_t pathoffset
;
12022 uint16_t altpathoffset
;
12023 uint16_t nodeoffset
;
12026 CHECK_BYTE_COUNT_TRANS_SUBR(4);
12027 proto_tree_add_item(tree
, hf_smb_dfs_referral_ttl
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
12028 COUNT_BYTES_TRANS_SUBR(4);
12030 if (refflags
& REFENT_FLAGS_NAME_LIST_REFERRAL
) {
12031 /* domain name offset */
12032 CHECK_BYTE_COUNT_TRANS_SUBR(2);
12033 domoffset
= tvb_get_letohs(tvb
, offset
);
12034 proto_tree_add_uint(tree
, hf_smb_dfs_referral_domain_offset
, tvb
, offset
, 2, domoffset
);
12035 COUNT_BYTES_TRANS_SUBR(2);
12037 /* number of expanded names*/
12038 CHECK_BYTE_COUNT_TRANS_SUBR(2);
12039 nexpnames
= tvb_get_letohs(tvb
, offset
);
12040 proto_tree_add_uint(tree
, hf_smb_dfs_referral_number_of_expnames
, tvb
, offset
, 2, nexpnames
);
12041 COUNT_BYTES_TRANS_SUBR(2);
12043 /* expanded names offset */
12044 CHECK_BYTE_COUNT_TRANS_SUBR(2);
12045 expoffset
= tvb_get_letohs(tvb
, offset
);
12046 proto_tree_add_uint(tree
, hf_smb_dfs_referral_expnames_offset
, tvb
, offset
, 2, expoffset
);
12047 COUNT_BYTES_TRANS_SUBR(2);
12049 /* padding: zero or 16 bytes, which should be ignored by clients.
12050 * we ignore them too.
12055 dissect_dfs_referral_string(tvb
, tree
, hf_smb_dfs_referral_domain_name
,
12056 domoffset
+oldoffset
, oldoffset
, offset
,
12057 *bcp
, unicode
, ucstring_end
);
12059 /* expanded names */
12061 proto_tree
*exptree
;
12063 exptree
= proto_tree_add_subtree(tree
, tvb
, offset
, *bcp
, ett_smb_dfs_referral_expnames
, NULL
, "Expanded Names");
12065 dissect_dfs_referral_strings(tvb
, exptree
, hf_smb_dfs_referral_expname
,
12066 nexpnames
, expoffset
+oldoffset
, oldoffset
, offset
,
12067 *bcp
, unicode
, ucstring_end
);
12071 CHECK_BYTE_COUNT_TRANS_SUBR(2);
12072 pathoffset
= tvb_get_letohs(tvb
, offset
);
12073 proto_tree_add_uint(tree
, hf_smb_dfs_referral_path_offset
, tvb
, offset
, 2, pathoffset
);
12074 COUNT_BYTES_TRANS_SUBR(2);
12076 /* alt path offset */
12077 CHECK_BYTE_COUNT_TRANS_SUBR(2);
12078 altpathoffset
= tvb_get_letohs(tvb
, offset
);
12079 proto_tree_add_uint(tree
, hf_smb_dfs_referral_alt_path_offset
, tvb
, offset
, 2, altpathoffset
);
12080 COUNT_BYTES_TRANS_SUBR(2);
12083 CHECK_BYTE_COUNT_TRANS_SUBR(2);
12084 nodeoffset
= tvb_get_letohs(tvb
, offset
);
12085 proto_tree_add_uint(tree
, hf_smb_dfs_referral_node_offset
, tvb
, offset
, 2, nodeoffset
);
12086 COUNT_BYTES_TRANS_SUBR(2);
12088 /* service site guid */
12089 CHECK_BYTE_COUNT_TRANS_SUBR(16);
12090 proto_tree_add_item(tree
, hf_smb_dfs_referral_server_guid
, tvb
, offset
, 16, ENC_NA
);
12091 COUNT_BYTES_TRANS_SUBR(16);
12095 dissect_dfs_referral_string(tvb
, tree
, hf_smb_dfs_referral_path
,
12096 pathoffset
+oldoffset
, oldoffset
, offset
,
12097 *bcp
, unicode
, ucstring_end
);
12101 if (altpathoffset
) {
12102 dissect_dfs_referral_string(tvb
, tree
, hf_smb_dfs_referral_alt_path
,
12103 altpathoffset
+oldoffset
, oldoffset
, offset
,
12104 *bcp
, unicode
, ucstring_end
);
12109 dissect_dfs_referral_string(tvb
, tree
, hf_smb_dfs_referral_node
,
12110 nodeoffset
+oldoffset
, oldoffset
, offset
,
12111 *bcp
, unicode
, ucstring_end
);
12119 /* get dfs referral data (4.4.1)
12122 dissect_get_dfs_referral_data(tvbuff_t
*tvb
, packet_info
*pinfo
,
12123 proto_tree
*tree
, int offset
, uint16_t *bcp
, bool unicode
)
12134 /* path consumed */
12135 CHECK_BYTE_COUNT_TRANS_SUBR(2);
12136 proto_tree_add_item(tree
, hf_smb_dfs_path_consumed
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
12137 COUNT_BYTES_TRANS_SUBR(2);
12139 /* num referrals */
12140 CHECK_BYTE_COUNT_TRANS_SUBR(2);
12141 numref
= tvb_get_letohs(tvb
, offset
);
12142 proto_tree_add_uint(tree
, hf_smb_dfs_num_referrals
, tvb
, offset
, 2, numref
);
12143 COUNT_BYTES_TRANS_SUBR(2);
12145 /* get dfs flags */
12146 CHECK_BYTE_COUNT_TRANS_SUBR(2);
12147 offset
= dissect_get_dfs_flags(tvb
, tree
, offset
);
12150 /* XXX - in at least one capture there appears to be 2 bytes
12151 of stuff after the Dfs flags, perhaps so that the header
12152 in front of the referral list is a multiple of 4 bytes long. */
12153 CHECK_BYTE_COUNT_TRANS_SUBR(2);
12154 proto_tree_add_item(tree
, hf_smb_padding
, tvb
, offset
, 2, ENC_NA
);
12155 COUNT_BYTES_TRANS_SUBR(2);
12157 /* if there are any referrals */
12159 proto_item
*ref_item
;
12160 proto_tree
*ref_tree
;
12161 int old_offset
= offset
;
12163 ref_tree
= proto_tree_add_subtree(tree
,
12164 tvb
, offset
, *bcp
, ett_smb_dfs_referrals
, &ref_item
, "Referrals");
12170 int old_offset_2
= offset
;
12173 rt
= proto_tree_add_subtree(ref_tree
,
12174 tvb
, offset
, *bcp
, ett_smb_dfs_referral
, &ri
, "Referral");
12176 /* referral version */
12177 CHECK_BYTE_COUNT_TRANS_SUBR(2);
12178 version
= tvb_get_letohs(tvb
, offset
);
12179 proto_tree_add_uint(rt
, hf_smb_dfs_referral_version
,
12180 tvb
, offset
, 2, version
);
12181 COUNT_BYTES_TRANS_SUBR(2);
12183 /* referral size */
12184 CHECK_BYTE_COUNT_TRANS_SUBR(2);
12185 refsize
= tvb_get_letohs(tvb
, offset
);
12186 proto_tree_add_uint(rt
, hf_smb_dfs_referral_size
, tvb
, offset
, 2, refsize
);
12187 COUNT_BYTES_TRANS_SUBR(2);
12189 /* referral server type */
12190 CHECK_BYTE_COUNT_TRANS_SUBR(2);
12191 proto_tree_add_item(rt
, hf_smb_dfs_referral_server_type
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
12192 COUNT_BYTES_TRANS_SUBR(2);
12194 /* referral flags */
12195 CHECK_BYTE_COUNT_TRANS_SUBR(2);
12196 refflags
= tvb_get_letohs(tvb
, offset
);
12197 offset
= dissect_dfs_referral_flags(tvb
, rt
, offset
);
12204 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, unicode
, &fn_len
, false, false, bcp
);
12205 CHECK_STRING_TRANS_SUBR(fn
);
12206 proto_tree_add_string(rt
, hf_smb_dfs_referral_node
, tvb
, offset
, fn_len
,
12208 COUNT_BYTES_TRANS_SUBR(fn_len
);
12212 offset
= dissect_dfs_referral_entry_v2(tvb
, rt
, old_offset_2
, offset
,
12213 refflags
, bcp
, unicode
, &ucstring_end
);
12216 offset
= dissect_dfs_referral_entry_v3(tvb
, rt
, old_offset_2
, offset
,
12217 refflags
, bcp
, unicode
, &ucstring_end
);
12220 /* V4 is extactly same as V3, except the version number and
12221 * one more ReferralEntryFlags */
12222 offset
= dissect_dfs_referral_entry_v3(tvb
, rt
, old_offset_2
, offset
,
12223 refflags
, bcp
, unicode
, &ucstring_end
);
12228 * Show anything beyond the length of the referral
12231 unklen
= (old_offset_2
+ refsize
) - offset
;
12234 * XXX - the length is bogus.
12239 CHECK_BYTE_COUNT_TRANS_SUBR(unklen
);
12240 proto_tree_add_item(rt
, hf_smb_unknown
, tvb
,
12241 offset
, unklen
, ENC_NA
);
12242 COUNT_BYTES_TRANS_SUBR(unklen
);
12245 proto_item_set_len(ri
, offset
-old_offset_2
);
12249 * Treat the offset past the end of the last Unicode
12250 * string after the referrals (if any) as the last
12253 if (ucstring_end
> offset
) {
12254 ucstring_len
= ucstring_end
- offset
;
12255 if (*bcp
< ucstring_len
)
12256 ucstring_len
= *bcp
;
12257 offset
+= ucstring_len
;
12258 *bcp
-= ucstring_len
;
12260 proto_item_set_len(ref_item
, offset
-old_offset
);
12266 /* This dissects the standard four 8-byte Windows timestamps ...
12269 dissect_smb_standard_8byte_timestamps(tvbuff_t
*tvb
,
12270 packet_info
*pinfo _U_
, proto_tree
*tree
,
12271 int offset
, uint16_t *bcp
, bool *trunc
)
12274 CHECK_BYTE_COUNT_SUBR(8);
12275 dissect_nttime(tvb
, tree
, offset
, hf_smb_create_time
, ENC_LITTLE_ENDIAN
);
12276 COUNT_BYTES_SUBR(8);
12279 CHECK_BYTE_COUNT_SUBR(8);
12280 dissect_nttime(tvb
, tree
, offset
, hf_smb_access_time
, ENC_LITTLE_ENDIAN
);
12281 COUNT_BYTES_SUBR(8);
12283 /* last write time */
12284 CHECK_BYTE_COUNT_SUBR(8);
12285 dissect_nttime(tvb
, tree
, offset
,
12286 hf_smb_last_write_time
, ENC_LITTLE_ENDIAN
);
12287 COUNT_BYTES_SUBR(8);
12289 /* last change time */
12290 CHECK_BYTE_COUNT_SUBR(8);
12291 dissect_nttime(tvb
, tree
, offset
, hf_smb_change_time
, ENC_LITTLE_ENDIAN
);
12292 COUNT_BYTES_SUBR(8);
12298 /* this dissects the SMB_INFO_STANDARD
12299 as described in 4.2.16.1 of the CIFS 1.0 specification
12300 or as described in 2.2.8.3.1 of the MS-CIFS specification for query
12301 section 2.2.8.4.1 of the MS-CIFS specification describes it for set;
12302 it says that everything past the last write time is "reserved",
12303 presumably meaning that you can fetch it but not set it
12304 for now we just use it for both query and set
12307 dissect_qsfi_SMB_INFO_STANDARD(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
12308 int offset
, uint16_t *bcp
, bool *trunc
)
12311 CHECK_BYTE_COUNT_SUBR(4);
12312 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
12313 hf_smb_create_time
, hf_smb_create_dos_date
, hf_smb_create_dos_time
,
12318 CHECK_BYTE_COUNT_SUBR(4);
12319 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
12320 hf_smb_access_time
, hf_smb_access_dos_date
, hf_smb_access_dos_time
,
12324 /* last write time */
12325 CHECK_BYTE_COUNT_SUBR(4);
12326 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
12327 hf_smb_last_write_time
, hf_smb_last_write_dos_date
, hf_smb_last_write_dos_time
,
12332 CHECK_BYTE_COUNT_SUBR(4);
12333 proto_tree_add_item(tree
, hf_smb_data_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
12334 COUNT_BYTES_SUBR(4);
12336 /* allocation size */
12337 CHECK_BYTE_COUNT_SUBR(4);
12338 proto_tree_add_item(tree
, hf_smb_alloc_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
12339 COUNT_BYTES_SUBR(4);
12341 /* File Attributes */
12342 CHECK_BYTE_COUNT_SUBR(2);
12343 offset
= dissect_file_attributes(tvb
, tree
, offset
);
12347 * The MS-CIFS spec says this doesn't have an EA length field;
12348 * the SNIA CIFS spec says it does, as does the 1996
12349 * "Microsoft Networks SMB FILE SHARING PROTOCOL Document
12350 * Version 6.0p" document.
12352 * Some older SMB documents point to the documentation
12353 * for the OS/2 DosQFileInfo() API; the page at
12355 * http://cyberkinetica.homeunix.net/os2tk45/prcp/111_L2_DosQFileInfo.html
12357 * says that, for level 1 (SMB_INFO_STANDARD), there is no EA
12358 * length - that's just for level 2 (SMB_INFO_QUERY_EA_SIZE).
12360 * I've seen captures with it and without it; given the mixed
12361 * messages sent by different documents, this is not surprising.
12363 * We display it if it's there; we don't set *trunc if it's
12366 * Note: in FIND_FIRST2/FIND_NEXT2, the EA length is *not*
12370 CHECK_BYTE_COUNT_SUBR(4);
12371 proto_tree_add_item(tree
, hf_smb_ea_list_length
, tvb
, offset
,
12372 4, ENC_LITTLE_ENDIAN
);
12373 COUNT_BYTES_SUBR(4);
12380 /* this dissects the SMB_INFO_QUERY_EA_SIZE
12381 as described in 4.2.16.1 of the CIFS 1.0 specification
12382 and as described in 2.2.8.3.2 of the MS-CIFS specification
12385 dissect_qfi_SMB_INFO_QUERY_EA_SIZE(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
12386 int offset
, uint16_t *bcp
, bool *trunc
)
12389 CHECK_BYTE_COUNT_SUBR(4);
12390 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
12391 hf_smb_create_time
, hf_smb_create_dos_date
, hf_smb_create_dos_time
,
12396 CHECK_BYTE_COUNT_SUBR(4);
12397 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
12398 hf_smb_access_time
, hf_smb_access_dos_date
, hf_smb_access_dos_time
,
12402 /* last write time */
12403 CHECK_BYTE_COUNT_SUBR(4);
12404 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
12405 hf_smb_last_write_time
, hf_smb_last_write_dos_date
, hf_smb_last_write_dos_time
,
12410 CHECK_BYTE_COUNT_SUBR(4);
12411 proto_tree_add_item(tree
, hf_smb_data_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
12412 COUNT_BYTES_SUBR(4);
12414 /* allocation size */
12415 CHECK_BYTE_COUNT_SUBR(4);
12416 proto_tree_add_item(tree
, hf_smb_alloc_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
12417 COUNT_BYTES_SUBR(4);
12419 /* File Attributes */
12420 CHECK_BYTE_COUNT_SUBR(2);
12421 offset
= dissect_file_attributes(tvb
, tree
, offset
);
12425 CHECK_BYTE_COUNT_SUBR(4);
12426 proto_tree_add_item(tree
, hf_smb_ea_list_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
12427 COUNT_BYTES_SUBR(4);
12433 /* this dissects the SMB_INFO_QUERY_EAS_FROM_LIST, SMB_INFO_QUERY_ALL_EAS,
12434 * and TRANS2_SET_FILE_INFORMATION as described in 4.2.16.2 and
12435 * [MS-CIFS] 2.2.6.9. This the "EA (Extended Attribute) subtree.
12438 dissect_4_2_16_2(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
12439 int offset
, uint16_t *bcp
, bool *trunc
)
12445 CHECK_BYTE_COUNT_SUBR(4);
12446 proto_tree_add_item(tree
, hf_smb_ea_list_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
12447 COUNT_BYTES_SUBR(4);
12451 proto_tree
*subtree
;
12452 char *display_string
;
12453 int start_offset
= offset
;
12455 subtree
= proto_tree_add_subtree(
12456 tree
, tvb
, offset
, 0, ett_smb_ea
, &item
, "Extended Attribute");
12460 CHECK_BYTE_COUNT_SUBR(1);
12461 proto_tree_add_item(
12462 subtree
, hf_smb_ea_flags
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
12463 COUNT_BYTES_SUBR(1);
12465 /* EA name length */
12467 name_len
= tvb_get_uint8(tvb
, offset
);
12469 CHECK_BYTE_COUNT_SUBR(1);
12470 proto_tree_add_item(
12471 subtree
, hf_smb_ea_name_length
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
12472 COUNT_BYTES_SUBR(1);
12474 /* EA data length */
12476 data_len
= tvb_get_letohs(tvb
, offset
);
12478 CHECK_BYTE_COUNT_SUBR(2);
12479 proto_tree_add_item(
12480 subtree
, hf_smb_ea_data_length
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
12481 COUNT_BYTES_SUBR(2);
12485 CHECK_BYTE_COUNT_SUBR(name_len
+ 1);
12486 proto_tree_add_item_ret_display_string(
12487 subtree
, hf_smb_ea_name
, tvb
, offset
, name_len
+ 1,
12489 pinfo
->pool
, &display_string
);
12490 proto_item_append_text(item
, ": %s", display_string
);
12491 COUNT_BYTES_SUBR(name_len
+ 1);
12495 /* If the data length is greater than the buffer size then SECONDARY requests will follow.
12496 * This often occurs with LOI "Info Set EAs". */
12497 if (data_len
> *bcp
)
12500 proto_tree_add_item(
12501 subtree
, hf_smb_ea_data
, tvb
, offset
, data_len
, ENC_NA
);
12503 COUNT_BYTES_SUBR(data_len
);
12504 proto_item_set_len(item
, offset
- start_offset
);
12511 /* this dissects the SMB_INFO_IS_NAME_VALID
12512 as described in 4.2.16.3
12515 dissect_4_2_16_3(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
12516 int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
12521 DISSECTOR_ASSERT(si
);
12524 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, false, bcp
);
12525 CHECK_STRING_SUBR(fn
);
12526 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
12528 COUNT_BYTES_SUBR(fn_len
);
12534 /* this dissects the SMB_QUERY_FILE_BASIC_INFO
12535 as described in 4.2.16.4
12538 dissect_4_2_16_4(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
12539 int offset
, uint16_t *bcp
, bool *trunc
)
12542 offset
= dissect_smb_standard_8byte_timestamps(tvb
, pinfo
, tree
, offset
, bcp
, trunc
);
12547 /* File Attributes */
12548 CHECK_BYTE_COUNT_SUBR(4);
12549 offset
= dissect_file_ext_attr(tvb
, tree
, offset
);
12556 /* this dissects the SMB_QUERY_FILE_STANDARD_INFO
12557 as described in 4.2.16.5 of the SNIA CIFS spec
12558 and section 2.2.8.3.7 of the MS-CIFS spec
12561 dissect_qfi_SMB_FILE_STANDARD_INFO(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
12562 int offset
, uint16_t *bcp
, bool *trunc
)
12564 /* allocation size */
12565 CHECK_BYTE_COUNT_SUBR(8);
12566 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12567 COUNT_BYTES_SUBR(8);
12570 CHECK_BYTE_COUNT_SUBR(8);
12571 proto_tree_add_item(tree
, hf_smb_end_of_file
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12572 COUNT_BYTES_SUBR(8);
12574 /* number of links */
12575 CHECK_BYTE_COUNT_SUBR(4);
12576 proto_tree_add_item(tree
, hf_smb_number_of_links
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
12577 COUNT_BYTES_SUBR(4);
12579 /* delete pending */
12580 CHECK_BYTE_COUNT_SUBR(1);
12581 proto_tree_add_item(tree
, hf_smb_delete_pending
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
12582 COUNT_BYTES_SUBR(1);
12585 CHECK_BYTE_COUNT_SUBR(1);
12586 proto_tree_add_item(tree
, hf_smb_is_directory
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
12587 COUNT_BYTES_SUBR(1);
12593 /* this dissects the SMB_QUERY_FILE_INTERNAL_INFO
12596 dissect_qfi_SMB_FILE_INTERNAL_INFO(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
12597 int offset
, uint16_t *bcp
, bool *trunc
)
12600 CHECK_BYTE_COUNT_SUBR(8);
12601 proto_tree_add_item(tree
, hf_smb_index_number
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12602 COUNT_BYTES_SUBR(8);
12608 /* this dissects the SMB_QUERY_FILE_POSITION_INFO
12611 dissect_qsfi_SMB_FILE_POSITION_INFO(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
12612 int offset
, uint16_t *bcp
, bool *trunc
)
12614 /* file position */
12615 CHECK_BYTE_COUNT_SUBR(8);
12616 proto_tree_add_item(tree
, hf_smb_position
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12617 COUNT_BYTES_SUBR(8);
12623 /* this dissects the SMB_QUERY_FILE_MODE_INFO
12626 dissect_qsfi_SMB_FILE_MODE_INFO(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
12627 int offset
, uint16_t *bcp
, bool *trunc
)
12630 CHECK_BYTE_COUNT_SUBR(4);
12631 proto_tree_add_item(tree
, hf_smb_mode
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
12632 COUNT_BYTES_SUBR(4);
12638 /* this dissects the SMB_QUERY_FILE_ALIGNMENT_INFO
12641 dissect_qfi_SMB_FILE_ALIGNMENT_INFO(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
12642 int offset
, uint16_t *bcp
, bool *trunc
)
12645 CHECK_BYTE_COUNT_SUBR(4);
12646 proto_tree_add_item(tree
, hf_smb_t2_alignment
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
12647 COUNT_BYTES_SUBR(4);
12653 /* this dissects the SMB_QUERY_FILE_EA_INFO
12654 as described in 4.2.16.6 of the SNIA CIFS spec
12655 and 2.2.8.3.8 of the MS-CIFS spec
12658 dissect_qfi_SMB_FILE_EA_INFO(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
12659 int offset
, uint16_t *bcp
, bool *trunc
)
12662 CHECK_BYTE_COUNT_SUBR(4);
12663 proto_tree_add_item(tree
, hf_smb_ea_list_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
12664 COUNT_BYTES_SUBR(4);
12670 /* this dissects the SMB_FILE_ALLOCATION_INFO
12671 as described in 4.2.19.3 in the SNIA CIFS spec
12672 and the SMB_SET_FILE_ALLOCATION_INFO
12673 as described in 2.2.8.4.5 in the MS-CIFS spec for set (MS-CIFS doesn't
12674 say it can be queried)
12677 dissect_qsfi_SMB_FILE_ALLOCATION_INFO(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
12678 int offset
, uint16_t *bcp
, bool *trunc
)
12680 /* allocation size */
12681 CHECK_BYTE_COUNT_SUBR(8);
12682 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12683 COUNT_BYTES_SUBR(8);
12689 /* this dissects the SMB_FILE_ENDOFFILE_INFO
12690 as described in 4.2.19.4 in the SNIA CIFS spec
12691 and the SMB_SET_FILE_END_OF_FILE_INFO
12692 as described in 2.2.8.4.6 in the MS-CIFS spec for set (MS-CIFS doesn't
12693 say it can be queried)
12696 dissect_qsfi_SMB_FILE_ENDOFFILE_INFO(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
12697 int offset
, uint16_t *bcp
, bool *trunc
)
12699 /* offset of end of file */
12700 CHECK_BYTE_COUNT_SUBR(8);
12701 proto_tree_add_item(tree
, hf_smb_end_of_file
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12702 COUNT_BYTES_SUBR(8);
12708 /* this dissects the SMB_QUERY_FILE_NAME_INFO
12709 as described in 4.2.16.7 of the SNIA CIFS spec
12710 and in 2.2.8.3.9 of the MS-CIFS spec
12711 this is the same as SMB_QUERY_FILE_ALT_NAME_INFO
12712 as described in 4.2.16.9 of the SNIA CIFS spec
12713 and 2.2.8.3.11 of the MS-CIFS spec
12714 although the latter two are used to fetch the 8.3 name
12715 rather than the long name
12717 https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/4718fc40-e539-4014-8e33-b675af74e3e1
12719 FileNormalizedNameInformation:
12720 https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/20bcadba-808c-4880-b757-4af93e41edf6
12723 dissect_qfi_SMB_FILE_NAME_INFO(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
12724 int offset
, uint16_t *bcp
, bool *trunc
, bool unicode
)
12729 /* file name len */
12730 CHECK_BYTE_COUNT_SUBR(4);
12731 proto_tree_add_item_ret_uint(tree
, hf_smb_file_name_len
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
, &fn_len
);
12732 COUNT_BYTES_SUBR(4);
12735 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, unicode
, &fn_len
, true, true, bcp
);
12737 CHECK_STRING_SUBR(fn
);
12739 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
12741 COUNT_BYTES_SUBR(fn_len
);
12747 /* this dissects the SMB_QUERY_FILE_ALL_INFO
12748 as described in 2.2.8.3.8 of the MS-CIFS spec
12749 but not as described in 4.2.16.8 since SNIA spec is wrong
12752 dissect_qfi_SMB_FILE_ALL_INFO(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
12753 int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
12758 DISSECTOR_ASSERT(si
);
12760 offset
= dissect_smb_standard_8byte_timestamps(tvb
, pinfo
, tree
, offset
, bcp
, trunc
);
12765 /* File Attributes */
12766 CHECK_BYTE_COUNT_SUBR(4);
12767 offset
= dissect_file_ext_attr(tvb
, tree
, offset
);
12774 /* allocation size */
12775 CHECK_BYTE_COUNT_SUBR(8);
12776 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12777 COUNT_BYTES_SUBR(8);
12780 CHECK_BYTE_COUNT_SUBR(8);
12781 proto_tree_add_item(tree
, hf_smb_end_of_file
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12782 COUNT_BYTES_SUBR(8);
12784 /* number of links */
12785 CHECK_BYTE_COUNT_SUBR(4);
12786 proto_tree_add_item(tree
, hf_smb_number_of_links
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
12787 COUNT_BYTES_SUBR(4);
12789 /* delete pending */
12790 CHECK_BYTE_COUNT_SUBR(1);
12791 proto_tree_add_item(tree
, hf_smb_delete_pending
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
12792 COUNT_BYTES_SUBR(1);
12795 CHECK_BYTE_COUNT_SUBR(1);
12796 proto_tree_add_item(tree
, hf_smb_is_directory
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
12797 COUNT_BYTES_SUBR(1);
12804 CHECK_BYTE_COUNT_SUBR(4);
12805 proto_tree_add_item(tree
, hf_smb_ea_list_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
12806 COUNT_BYTES_SUBR(4);
12808 /* file name len */
12809 CHECK_BYTE_COUNT_SUBR(4);
12810 fn_len
= (uint32_t)tvb_get_letohl(tvb
, offset
);
12811 proto_tree_add_uint(tree
, hf_smb_file_name_len
, tvb
, offset
, 4, fn_len
);
12812 COUNT_BYTES_SUBR(4);
12816 CHECK_BYTE_COUNT_SUBR(fn_len
);
12817 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, true, true, bcp
);
12819 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
12821 COUNT_BYTES_SUBR(fn_len
);
12831 /* this dissects the SMB_QUERY_FILE_STREAM_INFO
12832 as described in 4.2.16.10 of the SNIA CIFS spec
12833 and 2.2.8.3.12 of the MS-CIFS spec
12836 dissect_qfi_SMB_FILE_STREAM_INFO(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
,
12837 int offset
, uint16_t *bcp
, bool *trunc
, int unicode
)
12849 old_offset
= offset
;
12851 /* next entry offset */
12852 CHECK_BYTE_COUNT_SUBR(4);
12853 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, *bcp
, ett_smb_ff2_data
, &item
, "Stream Info");
12855 neo
= tvb_get_letohl(tvb
, offset
);
12856 proto_tree_add_uint(tree
, hf_smb_next_entry_offset
, tvb
, offset
, 4, neo
);
12857 COUNT_BYTES_SUBR(4);
12859 /* stream name len */
12860 CHECK_BYTE_COUNT_SUBR(4);
12861 fn_len
= tvb_get_letohl(tvb
, offset
);
12862 proto_tree_add_uint(tree
, hf_smb_t2_stream_name_length
, tvb
, offset
, 4, fn_len
);
12863 COUNT_BYTES_SUBR(4);
12866 CHECK_BYTE_COUNT_SUBR(8);
12867 proto_tree_add_item(tree
, hf_smb_t2_stream_size
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12868 COUNT_BYTES_SUBR(8);
12870 /* allocation size */
12871 CHECK_BYTE_COUNT_SUBR(8);
12872 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12873 COUNT_BYTES_SUBR(8);
12876 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, unicode
, &fn_len
, false, true, bcp
);
12877 CHECK_STRING_SUBR(fn
);
12878 proto_tree_add_string(tree
, hf_smb_t2_stream_name
, tvb
, offset
, fn_len
,
12880 COUNT_BYTES_SUBR(fn_len
);
12882 proto_item_append_text(item
, ": %s", format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
12883 proto_item_set_len(item
, offset
-old_offset
);
12886 break; /* no more structures */
12888 /* skip to next structure */
12889 padcnt
= (old_offset
+ neo
) - offset
;
12892 * XXX - this is bogus; flag it?
12897 CHECK_BYTE_COUNT_SUBR(padcnt
);
12898 COUNT_BYTES_SUBR(padcnt
);
12906 /* this dissects the SMB_QUERY_FILE_COMPRESSION_INFO
12907 as described in 4.2.16.11 of the SNIA CIFS spec
12908 and 2.2.8.3.13 of the MS-CIFS spec
12911 dissect_qfi_SMB_FILE_COMPRESSION_INFO(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
12912 int offset
, uint16_t *bcp
, bool *trunc
)
12914 /* compressed file size */
12915 CHECK_BYTE_COUNT_SUBR(8);
12916 proto_tree_add_item(tree
, hf_smb_t2_compressed_file_size
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12917 COUNT_BYTES_SUBR(8);
12919 /* compression format */
12920 CHECK_BYTE_COUNT_SUBR(2);
12921 proto_tree_add_item(tree
, hf_smb_t2_compressed_format
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
12922 COUNT_BYTES_SUBR(2);
12924 /* compression unit shift */
12925 CHECK_BYTE_COUNT_SUBR(1);
12926 proto_tree_add_item(tree
, hf_smb_t2_compressed_unit_shift
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
12927 COUNT_BYTES_SUBR(1);
12929 /* compression chunk shift */
12930 CHECK_BYTE_COUNT_SUBR(1);
12931 proto_tree_add_item(tree
, hf_smb_t2_compressed_chunk_shift
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
12932 COUNT_BYTES_SUBR(1);
12934 /* compression cluster shift */
12935 CHECK_BYTE_COUNT_SUBR(1);
12936 proto_tree_add_item(tree
, hf_smb_t2_compressed_cluster_shift
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
12937 COUNT_BYTES_SUBR(1);
12939 /* 3 reserved bytes */
12940 CHECK_BYTE_COUNT_SUBR(3);
12941 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 3, ENC_NA
);
12942 COUNT_BYTES_SUBR(3);
12948 /* 4.2.16.12 - SMB_QUERY_FILE_UNIX_BASIC */
12950 static const value_string unix_file_type_vals
[] = {
12952 { 1, "Directory" },
12953 { 2, "Symbolic link" },
12954 { 3, "Character device" },
12955 { 4, "Block device" },
12962 dissect_4_2_16_12(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
12963 int offset
, uint16_t *bcp
, bool *trunc
)
12965 /* End of file (file size) */
12966 CHECK_BYTE_COUNT_SUBR(8);
12967 proto_tree_add_item(tree
, hf_smb_unix_file_size
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12968 COUNT_BYTES_SUBR(8);
12970 /* Number of bytes */
12971 CHECK_BYTE_COUNT_SUBR(8);
12972 proto_tree_add_item(tree
, hf_smb_unix_file_num_bytes
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12973 COUNT_BYTES_SUBR(8);
12975 /* Last status change */
12976 CHECK_BYTE_COUNT_SUBR(8);
12977 dissect_nttime(tvb
, tree
, offset
, hf_smb_unix_file_last_status
, ENC_LITTLE_ENDIAN
);
12978 COUNT_BYTES_SUBR(8);
12980 /* Last access time */
12981 CHECK_BYTE_COUNT_SUBR(8);
12982 dissect_nttime(tvb
, tree
, offset
, hf_smb_unix_file_last_access
, ENC_LITTLE_ENDIAN
);
12983 COUNT_BYTES_SUBR(8);
12985 /* Last modification time */
12986 CHECK_BYTE_COUNT_SUBR(8);
12987 dissect_nttime(tvb
, tree
, offset
, hf_smb_unix_file_last_change
, ENC_LITTLE_ENDIAN
);
12988 COUNT_BYTES_SUBR(8);
12990 /* File owner uid */
12991 CHECK_BYTE_COUNT_SUBR(8);
12992 proto_tree_add_item(tree
, hf_smb_unix_file_uid
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12993 COUNT_BYTES_SUBR(8);
12995 /* File group gid */
12996 CHECK_BYTE_COUNT_SUBR(8);
12997 proto_tree_add_item(tree
, hf_smb_unix_file_gid
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
12998 COUNT_BYTES_SUBR(8);
13001 CHECK_BYTE_COUNT_SUBR(4);
13002 proto_tree_add_item(tree
, hf_smb_unix_file_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
13003 COUNT_BYTES_SUBR(4);
13005 /* Major device number */
13006 CHECK_BYTE_COUNT_SUBR(8);
13007 proto_tree_add_item(tree
, hf_smb_unix_file_dev_major
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13008 COUNT_BYTES_SUBR(8);
13010 /* Minor device number */
13011 CHECK_BYTE_COUNT_SUBR(8);
13012 proto_tree_add_item(tree
, hf_smb_unix_file_dev_minor
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13013 COUNT_BYTES_SUBR(8);
13016 CHECK_BYTE_COUNT_SUBR(8);
13017 proto_tree_add_item(tree
, hf_smb_unix_file_unique_id
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13018 COUNT_BYTES_SUBR(8);
13021 CHECK_BYTE_COUNT_SUBR(8);
13022 proto_tree_add_item(tree
, hf_smb_unix_file_permissions
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13023 COUNT_BYTES_SUBR(8);
13026 CHECK_BYTE_COUNT_SUBR(8);
13027 proto_tree_add_item(tree
, hf_smb_unix_file_nlinks
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13028 COUNT_BYTES_SUBR(8);
13030 /* Sometimes there is one extra byte in the data field which I
13031 guess could be padding, but we are only using 4 or 8 byte
13032 data types so this is a bit confusing. -tpot */
13038 /* 4.2.16.13 - SMB_QUERY_FILE_UNIX_LINK */
13041 dissect_4_2_16_13(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
13042 int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
13047 DISSECTOR_ASSERT(si
);
13049 /* Link destination */
13051 fn
= get_unicode_or_ascii_string(pinfo
->pool
,
13052 tvb
, &offset
, si
->unicode
, &fn_len
, false, true, bcp
);
13054 CHECK_STRING_SUBR(fn
);
13055 proto_tree_add_string(
13056 tree
, hf_smb_unix_file_link_dest
, tvb
, offset
, fn_len
, fn
);
13057 COUNT_BYTES_SUBR(fn_len
);
13066 dissect_qspi_unix_acl(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
13067 int offset
, uint16_t *bcp
, bool *trunc
)
13069 uint16_t num_file_aces
;
13070 static int * const perm_fields
[] = {
13071 &hf_smb_posix_ace_perm_read
,
13072 &hf_smb_posix_ace_perm_write
,
13073 &hf_smb_posix_ace_perm_execute
,
13078 CHECK_BYTE_COUNT_SUBR(2);
13079 proto_tree_add_item(tree
, hf_smb_posix_acl_version
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
13080 COUNT_BYTES_SUBR(2);
13082 /* num file acls */
13083 CHECK_BYTE_COUNT_SUBR(2);
13084 num_file_aces
= tvb_get_letohs(tvb
, offset
);
13085 proto_tree_add_item(tree
, hf_smb_posix_num_file_aces
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
13086 COUNT_BYTES_SUBR(2);
13088 /* num default acls */
13089 CHECK_BYTE_COUNT_SUBR(2);
13090 proto_tree_add_item(tree
, hf_smb_posix_num_def_aces
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
13091 COUNT_BYTES_SUBR(2);
13093 while (num_file_aces
--) {
13094 proto_item
*it
, *type_item
;
13096 int old_offset
= offset
;
13099 tr
= proto_tree_add_subtree(tree
, tvb
, offset
, 0, ett_smb_posix_ace
, &it
, "ACE");
13102 CHECK_BYTE_COUNT_SUBR(1);
13103 ace_type
= tvb_get_uint8(tvb
, offset
);
13104 type_item
= proto_tree_add_item(tr
, hf_smb_posix_ace_type
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
13105 COUNT_BYTES_SUBR(1);
13107 CHECK_BYTE_COUNT_SUBR(1);
13108 proto_tree_add_bitmask(tr
, tvb
, offset
, hf_smb_posix_ace_flags
, ett_smb_posix_ace_perms
, perm_fields
, ENC_BIG_ENDIAN
);
13109 COUNT_BYTES_SUBR(1);
13112 case POSIX_ACE_TYPE_USER_OBJ
:
13113 CHECK_BYTE_COUNT_SUBR(4);
13114 proto_tree_add_item(tr
, hf_smb_posix_ace_perm_owner_uid
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
13115 COUNT_BYTES_SUBR(4);
13117 CHECK_BYTE_COUNT_SUBR(4);
13118 /* 4 reserved bytes */
13119 COUNT_BYTES_SUBR(4);
13121 case POSIX_ACE_TYPE_GROUP_OBJ
:
13122 CHECK_BYTE_COUNT_SUBR(4);
13123 proto_tree_add_item(tr
, hf_smb_posix_ace_perm_owner_gid
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
13124 COUNT_BYTES_SUBR(4);
13126 CHECK_BYTE_COUNT_SUBR(4);
13127 /* 4 reserved bytes */
13128 COUNT_BYTES_SUBR(4);
13131 case POSIX_ACE_TYPE_MASK
:
13132 case POSIX_ACE_TYPE_OTHER
:
13133 CHECK_BYTE_COUNT_SUBR(8);
13134 /* 8 reserved bytes */
13135 COUNT_BYTES_SUBR(8);
13138 case POSIX_ACE_TYPE_USER
:
13139 CHECK_BYTE_COUNT_SUBR(4);
13140 proto_tree_add_item(tr
, hf_smb_posix_ace_perm_uid
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
13141 COUNT_BYTES_SUBR(4);
13143 CHECK_BYTE_COUNT_SUBR(4);
13144 /* 4 reserved bytes */
13145 COUNT_BYTES_SUBR(4);
13148 case POSIX_ACE_TYPE_GROUP
:
13149 CHECK_BYTE_COUNT_SUBR(4);
13150 proto_tree_add_item(tr
, hf_smb_posix_ace_perm_gid
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
13151 COUNT_BYTES_SUBR(4);
13153 CHECK_BYTE_COUNT_SUBR(4);
13154 /* 4 reserved bytes */
13155 COUNT_BYTES_SUBR(4);
13158 expert_add_info(pinfo
, type_item
, &ei_smb_posix_ace_type
);
13159 CHECK_BYTE_COUNT_SUBR(8);
13161 COUNT_BYTES_SUBR(8);
13164 proto_item_set_len(it
, offset
-old_offset
);
13172 dissect_qspi_unix_xattr(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
13173 int offset
, uint16_t *bcp _U_
, bool *trunc
)
13175 proto_tree_add_expert(tree
, pinfo
, &ei_smb_not_implemented
, tvb
, offset
, 0);
13182 dissect_qspi_unix_attr_flags(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
13183 int offset
, uint16_t *bcp _U_
, bool *trunc
)
13185 proto_tree_add_expert(tree
, pinfo
, &ei_smb_not_implemented
, tvb
, offset
, 0);
13192 dissect_qpi_unix_permissions(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
13193 int offset
, uint16_t *bcp _U_
, bool *trunc
)
13195 proto_tree_add_expert(tree
, pinfo
, &ei_smb_not_implemented
, tvb
, offset
, 0);
13202 dissect_qspi_unix_lock(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
13203 int offset
, uint16_t *bcp _U_
, bool *trunc
)
13205 proto_tree_add_expert(tree
, pinfo
, &ei_smb_not_implemented
, tvb
, offset
, 0);
13212 dissect_qspi_unix_open(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
13213 int offset
, uint16_t *bcp _U_
, bool *trunc
)
13215 proto_tree_add_expert(tree
, pinfo
, &ei_smb_not_implemented
, tvb
, offset
, 0);
13222 dissect_qspi_unix_unlink(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
13223 int offset
, uint16_t *bcp _U_
, bool *trunc
)
13225 proto_tree_add_expert(tree
, pinfo
, &ei_smb_not_implemented
, tvb
, offset
, 0);
13231 /* SMB_FIND_FILE_UNIX_INFO2 */
13234 static const true_false_string tfs_i2f_secure_delete
= {
13235 "File should be erased such that the data is not recoverable",
13236 "File need not be erased such that the data is not recoverable"
13238 static const true_false_string tfs_i2f_enable_undelete
= {
13239 "File should opt-in to a server-specific deletion recovery scheme",
13240 "File should not opt-in to a server-specific deletion recovery scheme"
13242 static const true_false_string tfs_i2f_synchronous
= {
13243 "I/O to this file should be performed synchronously",
13244 "I/O to this file need not be performed synchronously"
13246 static const true_false_string tfs_i2f_immutable
= {
13247 "NO changes can be made to this file",
13248 "Changes can be made to this file if permissions allow it"
13250 static const true_false_string tfs_i2f_append_only
= {
13251 "Only appends can be made to this file",
13252 "Writes can be made atop existing data in this file"
13254 static const true_false_string tfs_i2f_do_not_backup
= {
13255 "Backup programs should ignore this file",
13256 "Backup programs should not ignore this file"
13258 static const true_false_string tfs_i2f_no_update_atime
= {
13259 "The server is not required to update the last access time on this file",
13260 "The server is required to update the last access time on this file"
13262 static const true_false_string tfs_i2f_hidden
= {
13263 "User interface programs may ignore this file",
13264 "User interface programs should not ignore this file based solely on this flag"
13269 dissect_unix_info2_file_flags(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, int hf
)
13271 static int * const flags
[] = {
13272 &hf_smb_unix_info2_file_flags_secure_delete
,
13273 &hf_smb_unix_info2_file_flags_enable_undelete
,
13274 &hf_smb_unix_info2_file_flags_synchronous
,
13275 &hf_smb_unix_info2_file_flags_immutable
,
13276 &hf_smb_unix_info2_file_flags_append_only
,
13277 &hf_smb_unix_info2_file_flags_do_not_backup
,
13278 &hf_smb_unix_info2_file_flags_no_update_atime
,
13279 &hf_smb_unix_info2_file_flags_hidden
,
13283 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf
, ett_smb_info2_file_flags
, flags
, ENC_LITTLE_ENDIAN
);
13290 dissect_qspi_unix_info2(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
13291 int offset
, uint16_t *bcp
, bool *trunc
)
13293 /* End of file (file size) */
13294 CHECK_BYTE_COUNT_SUBR(8);
13295 proto_tree_add_item(tree
, hf_smb_unix_file_size
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13296 COUNT_BYTES_SUBR(8);
13298 /* Number of bytes (or blocks? The SNIA spec for UNIX basic
13299 info says "bytes", the Samba page for this says "blocks") */
13300 CHECK_BYTE_COUNT_SUBR(8);
13301 proto_tree_add_item(tree
, hf_smb_unix_file_num_bytes
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13302 COUNT_BYTES_SUBR(8);
13304 /* Last status change */
13305 CHECK_BYTE_COUNT_SUBR(8);
13306 dissect_nttime(tvb
, tree
, offset
, hf_smb_unix_file_last_status
, ENC_LITTLE_ENDIAN
);
13307 COUNT_BYTES_SUBR(8);
13309 /* Last access time */
13310 CHECK_BYTE_COUNT_SUBR(8);
13311 dissect_nttime(tvb
, tree
, offset
, hf_smb_unix_file_last_access
, ENC_LITTLE_ENDIAN
);
13312 COUNT_BYTES_SUBR(8);
13314 /* Last modification time */
13315 CHECK_BYTE_COUNT_SUBR(8);
13316 dissect_nttime(tvb
, tree
, offset
, hf_smb_unix_file_last_change
, ENC_LITTLE_ENDIAN
);
13317 COUNT_BYTES_SUBR(8);
13319 /* File owner uid */
13320 CHECK_BYTE_COUNT_SUBR(8);
13321 proto_tree_add_item(tree
, hf_smb_unix_file_uid
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13322 COUNT_BYTES_SUBR(8);
13324 /* File group gid */
13325 CHECK_BYTE_COUNT_SUBR(8);
13326 proto_tree_add_item(tree
, hf_smb_unix_file_gid
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13327 COUNT_BYTES_SUBR(8);
13330 CHECK_BYTE_COUNT_SUBR(4);
13331 proto_tree_add_item(tree
, hf_smb_unix_file_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
13332 COUNT_BYTES_SUBR(4);
13334 /* Major device number */
13335 CHECK_BYTE_COUNT_SUBR(8);
13336 proto_tree_add_item(tree
, hf_smb_unix_file_dev_major
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13337 COUNT_BYTES_SUBR(8);
13339 /* Minor device number */
13340 CHECK_BYTE_COUNT_SUBR(8);
13341 proto_tree_add_item(tree
, hf_smb_unix_file_dev_minor
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13342 COUNT_BYTES_SUBR(8);
13345 CHECK_BYTE_COUNT_SUBR(8);
13346 proto_tree_add_item(tree
, hf_smb_unix_file_unique_id
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13347 COUNT_BYTES_SUBR(8);
13350 CHECK_BYTE_COUNT_SUBR(8);
13351 proto_tree_add_item(tree
, hf_smb_unix_file_permissions
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13352 COUNT_BYTES_SUBR(8);
13355 CHECK_BYTE_COUNT_SUBR(8);
13356 proto_tree_add_item(tree
, hf_smb_unix_file_nlinks
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13357 COUNT_BYTES_SUBR(8);
13359 /* Creation time */
13360 CHECK_BYTE_COUNT_SUBR(8);
13361 dissect_nttime(tvb
, tree
, offset
, hf_smb_unix_file_creation_time
, ENC_LITTLE_ENDIAN
);
13362 COUNT_BYTES_SUBR(8);
13365 CHECK_BYTE_COUNT_SUBR(4);
13366 offset
= dissect_unix_info2_file_flags(tvb
, tree
, offset
, hf_smb_unix_info2_file_flags
);
13369 /* File flags mask */
13370 CHECK_BYTE_COUNT_SUBR(4);
13371 offset
= dissect_unix_info2_file_flags(tvb
, tree
, offset
, hf_smb_unix_info2_file_flags_mask
);
13378 /* this dissects the SMB_QUERY_FILE_NETWORK_OPEN_INFO
13381 dissect_qfi_SMB_FILE_NETWORK_OPEN_INFO(tvbuff_t
*tvb
,
13382 packet_info
*pinfo
, proto_tree
*tree
,
13383 int offset
, uint16_t *bcp
, bool *trunc
)
13386 offset
= dissect_smb_standard_8byte_timestamps(tvb
, pinfo
, tree
, offset
, bcp
, trunc
);
13391 /* allocation size */
13392 CHECK_BYTE_COUNT_SUBR(8);
13393 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13394 COUNT_BYTES_SUBR(8);
13397 CHECK_BYTE_COUNT_SUBR(8);
13398 proto_tree_add_item(tree
, hf_smb_end_of_file
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13399 COUNT_BYTES_SUBR(8);
13401 /* File Attributes */
13402 CHECK_BYTE_COUNT_SUBR(4);
13403 offset
= dissect_file_ext_attr(tvb
, tree
, offset
);
13406 /* 4 reserved bytes */
13407 CHECK_BYTE_COUNT_SUBR(4);
13408 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 4, ENC_NA
);
13409 COUNT_BYTES_SUBR(4);
13415 /* this dissects the SMB_FILE_ATTRIBUTE_TAG_INFO
13418 dissect_qfi_SMB_FILE_ATTRIBUTE_TAG_INFO(tvbuff_t
*tvb
,
13419 packet_info
*pinfo _U_
, proto_tree
*tree
,
13420 int offset
, uint16_t *bcp
, bool *trunc
)
13423 CHECK_BYTE_COUNT_SUBR(4);
13424 proto_tree_add_item(tree
, hf_smb_attribute
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
13425 COUNT_BYTES_SUBR(4);
13428 CHECK_BYTE_COUNT_SUBR(4);
13429 proto_tree_add_item(tree
, hf_smb_reparse_tag
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
13430 COUNT_BYTES_SUBR(4);
13436 /* this dissects the SMB_SET_FILE_DISPOSITION_INFO
13437 as described in 4.2.19.2
13440 dissect_4_2_19_2(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
13441 int offset
, uint16_t *bcp
, bool *trunc
)
13443 /* marked for deletion? */
13444 CHECK_BYTE_COUNT_SUBR(1);
13445 proto_tree_add_item(tree
, hf_smb_t2_marked_for_deletion
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
13446 COUNT_BYTES_SUBR(1);
13452 /* Set File Rename Info */
13454 static const true_false_string tfs_smb_replace
= {
13455 "Remove target file if it exists",
13456 "Do NOT remove target file if it exists",
13460 dissect_rename_info(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
13461 int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
13464 uint32_t target_name_len
;
13467 DISSECTOR_ASSERT(si
);
13470 CHECK_BYTE_COUNT_SUBR(4);
13471 proto_tree_add_item(tree
, hf_smb_replace
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
13472 COUNT_BYTES_SUBR(4);
13474 /* Root directory handle */
13475 CHECK_BYTE_COUNT_SUBR(4);
13476 proto_tree_add_item(tree
, hf_smb_root_dir_handle
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
13477 COUNT_BYTES_SUBR(4);
13479 /* Target name length */
13480 CHECK_BYTE_COUNT_SUBR(4);
13481 target_name_len
= tvb_get_letohl(tvb
, offset
);
13482 proto_tree_add_uint(tree
, hf_smb_target_name_len
, tvb
, offset
, 4, target_name_len
);
13483 COUNT_BYTES_SUBR(4);
13486 fn_len
= target_name_len
;
13487 fn
= get_unicode_or_ascii_string(pinfo
->pool
,
13488 tvb
, &offset
, si
->unicode
, &fn_len
, false, true, bcp
);
13490 CHECK_STRING_SUBR(fn
);
13491 proto_tree_add_string(
13492 tree
, hf_smb_target_name
, tvb
, offset
, fn_len
, fn
);
13493 COUNT_BYTES_SUBR(fn_len
);
13500 dissect_disposition_info(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
13501 int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
13505 uint32_t target_name_len
;*/
13509 DISSECTOR_ASSERT(si
);
13511 /* Disposition flags */
13512 CHECK_BYTE_COUNT_SUBR(1);
13513 proto_tree_add_item(tree
, hf_smb_disposition_delete_on_close
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
13514 COUNT_BYTES_SUBR(1);
13521 dissect_sfi_SMB_FILE_PIPE_INFO(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
13522 int offset
, uint16_t *bcp
, bool *trunc
)
13524 /* pipe info flag */
13525 CHECK_BYTE_COUNT_SUBR(1);
13526 proto_tree_add_item(tree
, hf_smb_pipe_info_flag
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
13527 COUNT_BYTES_SUBR(1);
13533 /*dissect the data block for TRANS2_QUERY_PATH_INFORMATION and
13534 TRANS2_QUERY_FILE_INFORMATION*/
13536 dissect_qpi_loi_vals(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
,
13537 proto_item
*item _U_
, int offset
, uint16_t *bcp
, smb_info_t
*si
)
13539 bool trunc
= false;
13545 DISSECTOR_ASSERT(si
);
13547 switch(si
->info_level
) {
13548 case 1: /*Info Standard*/
13549 offset
= dissect_qsfi_SMB_INFO_STANDARD(tvb
, pinfo
, tree
, offset
, bcp
,
13553 case 2: /*Info Query EA Size*/
13554 offset
= dissect_qfi_SMB_INFO_QUERY_EA_SIZE(tvb
, pinfo
, tree
, offset
, bcp
,
13557 case 3: /*Info Query EAs From List*/
13558 case 4: /*Info Query All EAs*/
13559 offset
= dissect_4_2_16_2(tvb
, pinfo
, tree
, offset
, bcp
,
13562 case 6: /*Info Is Name Valid*/
13563 offset
= dissect_4_2_16_3(tvb
, pinfo
, tree
, offset
, bcp
,
13566 case 0x0101: /*Query File Basic Info*/
13567 case 1004: /* SMB_FILE_BASIC_INFORMATION */
13568 offset
= dissect_4_2_16_4(tvb
, pinfo
, tree
, offset
, bcp
,
13571 case 0x0102: /*Query File Standard Info*/
13572 case 1005: /* SMB_FILE_STANDARD_INFORMATION */
13573 offset
= dissect_qfi_SMB_FILE_STANDARD_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13576 case 1006: /* SMB_FILE_INTERNAL_INFORMATION */
13577 offset
= dissect_qfi_SMB_FILE_INTERNAL_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13580 case 0x0103: /*Query File EA Info*/
13581 case 1007: /* SMB_FILE_EA_INFORMATION */
13582 offset
= dissect_qfi_SMB_FILE_EA_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13585 case 0x0104: /*Query File Name Info*/
13586 case 1009: /* SMB_FILE_NAME_INFORMATION */
13587 offset
= dissect_qfi_SMB_FILE_NAME_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13588 &trunc
, si
->unicode
);
13590 case 1014: /* SMB_FILE_POSITION_INFORMATION */
13591 offset
= dissect_qsfi_SMB_FILE_POSITION_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13594 case 1016: /* SMB_FILE_MODE_INFORMATION */
13595 offset
= dissect_qsfi_SMB_FILE_MODE_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13598 case 1017: /* SMB_FILE_ALIGNMENT_INFORMATION */
13599 offset
= dissect_qfi_SMB_FILE_ALIGNMENT_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13602 case 0x0107: /*Query File All Info*/
13603 case 1018: /* SMB_FILE_ALL_INFORMATION */
13604 offset
= dissect_qfi_SMB_FILE_ALL_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13607 case 1019: /* SMB_FILE_ALLOCATION_INFORMATION */
13608 offset
= dissect_qsfi_SMB_FILE_ALLOCATION_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13611 case 1020: /* SMB_FILE_ENDOFFILE_INFORMATION */
13612 offset
= dissect_qsfi_SMB_FILE_ENDOFFILE_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13615 case 0x0108: /*Query File Alt File Info*/
13616 case 1021: /* SMB_FILE_ALTERNATE_NAME_INFORMATION */
13617 offset
= dissect_qfi_SMB_FILE_NAME_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13618 &trunc
, si
->unicode
);
13620 case 1022: /* SMB_FILE_STREAM_INFORMATION */
13621 si
->unicode
= true;
13623 case 0x0109: /*Query File Stream Info*/
13624 offset
= dissect_qfi_SMB_FILE_STREAM_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13625 &trunc
, si
->unicode
);
13627 case 0x010b: /*Query File Compression Info*/
13628 case 1028: /* SMB_FILE_COMPRESSION_INFORMATION */
13629 offset
= dissect_qfi_SMB_FILE_COMPRESSION_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13632 case 1034: /* SMB_FILE_NETWORK_OPEN_INFO */
13633 offset
= dissect_qfi_SMB_FILE_NETWORK_OPEN_INFO(tvb
, pinfo
, tree
, offset
, bcp
, &trunc
);
13635 case 1035: /* SMB_FILE_ATTRIBUTE_TAG_INFO */
13636 offset
= dissect_qfi_SMB_FILE_ATTRIBUTE_TAG_INFO(tvb
, pinfo
, tree
, offset
, bcp
, &trunc
);
13638 case 0x0200: /* Query File Unix Basic*/
13639 offset
= dissect_4_2_16_12(tvb
, pinfo
, tree
, offset
, bcp
,
13642 case 0x0201: /* Query File Unix Link*/
13643 offset
= dissect_4_2_16_13(tvb
, pinfo
, tree
, offset
, bcp
,
13646 case 0x0202: /* Query File Unix HardLink*/
13647 /* XXX add this from the SNIA doc */
13649 case 0x0204: /* Query File Unix ACL*/
13650 offset
= dissect_qspi_unix_acl(tvb
, pinfo
, tree
, offset
, bcp
,
13653 case 0x0205: /* Query File Unix XATTR*/
13654 offset
= dissect_qspi_unix_xattr(tvb
, pinfo
, tree
, offset
, bcp
,
13657 case 0x0206: /* Query File Unix Attr Flags*/
13658 offset
= dissect_qspi_unix_attr_flags(tvb
, pinfo
, tree
, offset
, bcp
,
13661 case 0x0207: /* Query File Unix Permissions*/
13662 offset
= dissect_qpi_unix_permissions(tvb
, pinfo
, tree
, offset
, bcp
,
13665 case 0x0208: /* Query File Unix Lock*/
13666 offset
= dissect_qspi_unix_lock(tvb
, pinfo
, tree
, offset
, bcp
,
13669 case 0x020b: /* Query File Unix Info2*/
13670 offset
= dissect_qspi_unix_info2(tvb
, pinfo
, tree
, offset
, bcp
,
13675 proto_tree_add_expert(tree
, pinfo
, &ei_smb_info_level_unknown
, tvb
, offset
, *bcp
);
13685 /*dissect the data block for TRANS2_SET_PATH_INFORMATION and
13686 TRANS2_SET_FILE_INFORMATION*/
13688 dissect_spi_loi_vals(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
,
13689 proto_item
*item
, int offset
, uint16_t *bcp
, smb_info_t
*si
)
13697 DISSECTOR_ASSERT(si
);
13699 switch(si
->info_level
) {
13700 case 1: /*Info Standard*/
13701 offset
= dissect_qsfi_SMB_INFO_STANDARD(tvb
, pinfo
, tree
, offset
, bcp
,
13704 case 2: /*Info Set EAs*/
13705 offset
= dissect_4_2_16_2(tvb
, pinfo
, tree
, offset
, bcp
,
13708 case 4: /*Info Query All EAs - not in [MS-CIFS]*/
13709 offset
= dissect_4_2_16_2(tvb
, pinfo
, tree
, offset
, bcp
,
13712 case 0x0101: /*Set File Basic Info*/
13713 case 1004: /* SMB_FILE_BASIC_INFORMATION */
13714 offset
= dissect_4_2_16_4(tvb
, pinfo
, tree
, offset
, bcp
,
13717 case 0x0102: /*Set File Disposition Info*/
13718 offset
= dissect_4_2_19_2(tvb
, pinfo
, tree
, offset
, bcp
,
13721 case 0x0103: /*Set File Allocation Info*/
13722 case 1019: /* Set File Allocation Information */
13723 offset
= dissect_qsfi_SMB_FILE_ALLOCATION_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13726 case 0x0104: /*Set End Of File Info*/
13727 case 1020: /* SMB_FILE_ENDOFFILE_INFORMATION */
13728 offset
= dissect_qsfi_SMB_FILE_ENDOFFILE_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13731 case 0x0200: /*Set File Unix Basic. Same as query. */
13732 offset
= dissect_4_2_16_12(tvb
, pinfo
, tree
, offset
, bcp
,
13735 case 0x0201: /*Set File Unix Link. Same as query. */
13736 offset
= dissect_4_2_16_13(tvb
, pinfo
, tree
, offset
, bcp
,
13739 case 0x0202: /*Set File Unix HardLink. Same as link query. */
13740 offset
= dissect_4_2_16_13(tvb
, pinfo
, tree
, offset
, bcp
,
13743 case 0x0204: /* Set File Unix ACL*/
13744 offset
= dissect_qspi_unix_acl(tvb
, pinfo
, tree
, offset
, bcp
,
13747 case 0x0205: /* Set File Unix XATTR*/
13748 offset
= dissect_qspi_unix_xattr(tvb
, pinfo
, tree
, offset
, bcp
,
13751 case 0x0206: /* Set File Unix Attr Flags*/
13752 offset
= dissect_qspi_unix_attr_flags(tvb
, pinfo
, tree
, offset
, bcp
,
13755 case 0x0208: /* Set File Unix Lock*/
13756 offset
= dissect_qspi_unix_lock(tvb
, pinfo
, tree
, offset
, bcp
,
13759 case 0x0209: /* Set File Unix Open*/
13760 offset
= dissect_qspi_unix_open(tvb
, pinfo
, tree
, offset
, bcp
,
13763 case 0x020a: /* Set File Unix Unlink*/
13764 offset
= dissect_qspi_unix_unlink(tvb
, pinfo
, tree
, offset
, bcp
,
13767 case 0x020b: /* Set File Unix Info2*/
13768 offset
= dissect_qspi_unix_info2(tvb
, pinfo
, tree
, offset
, bcp
,
13771 case 1010: /* Set File Rename */
13772 offset
= dissect_rename_info(tvb
, pinfo
, tree
, offset
, bcp
,
13775 case 1013: /* Set Disposition Information */
13776 offset
= dissect_disposition_info(tvb
, pinfo
, tree
, offset
, bcp
,
13779 case 1014: /* SMB_FILE_POSITION_INFORMATION */
13780 offset
= dissect_qsfi_SMB_FILE_POSITION_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13783 case 1016: /* SMB_FILE_MODE_INFORMATION */
13784 offset
= dissect_qsfi_SMB_FILE_MODE_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13787 case 1023: /* Set Pipe Info */
13788 offset
= dissect_sfi_SMB_FILE_PIPE_INFO(tvb
, pinfo
, tree
, offset
, bcp
,
13796 /* XXX: TODO, extra levels discovered by tridge */
13797 proto_tree_add_expert(tree
, pinfo
, &ei_smb_info_level_not_understood
, tvb
, offset
, *bcp
);
13804 proto_tree_add_expert(tree
, pinfo
, &ei_smb_info_level_unknown
, tvb
, offset
, *bcp
);
13812 expert_add_info(pinfo
, item
, &ei_smb_mal_information_level
);
13818 static const true_false_string tfs_quota_flags_deny_disk
= {
13819 "DENY DISK SPACE for users exceeding quota limit",
13820 "Do NOT deny disk space for users exceeding quota limit"
13822 static const true_false_string tfs_quota_flags_log_limit
= {
13823 "LOG EVENT when a user exceeds their QUOTA LIMIT",
13824 "Do NOT log event when a user exceeds their quota limit"
13826 static const true_false_string tfs_quota_flags_log_warning
= {
13827 "LOG EVENT when a user exceeds their WARNING LEVEL",
13828 "Do NOT log event when a user exceeds their warning level"
13830 static const true_false_string tfs_quota_flags_enabled
= {
13831 "Quotas are ENABLED of this fs",
13832 "Quotas are NOT enabled on this fs"
13835 dissect_quota_flags(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
13837 static int * const mask
[] = {
13838 &hf_smb_quota_flags_deny_disk
,
13839 &hf_smb_quota_flags_log_warning
,
13840 &hf_smb_quota_flags_log_limit
,
13841 &hf_smb_quota_flags_enabled
,
13845 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_quota_flags
,
13846 ett_smb_quotaflags
, mask
, ENC_NA
);
13850 dissect_nt_quota(tvbuff_t
*tvb
, proto_tree
*tree
, int offset
, uint16_t *bcp
)
13852 /* first 24 bytes are unknown */
13853 CHECK_BYTE_COUNT_TRANS_SUBR(24);
13854 proto_tree_add_item(tree
, hf_smb_unknown
, tvb
,
13855 offset
, 24, ENC_NA
);
13856 COUNT_BYTES_TRANS_SUBR(24);
13858 /* number of bytes for quota warning */
13859 CHECK_BYTE_COUNT_TRANS_SUBR(8);
13860 proto_tree_add_item(tree
, hf_smb_soft_quota_limit
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13861 COUNT_BYTES_TRANS_SUBR(8);
13863 /* number of bytes for quota limit */
13864 CHECK_BYTE_COUNT_TRANS_SUBR(8);
13865 proto_tree_add_item(tree
, hf_smb_hard_quota_limit
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
13866 COUNT_BYTES_TRANS_SUBR(8);
13868 /* one byte of quota flags */
13869 CHECK_BYTE_COUNT_TRANS_SUBR(1);
13870 dissect_quota_flags(tvb
, tree
, offset
);
13871 COUNT_BYTES_TRANS_SUBR(1);
13873 /* these 7 bytes are unknown */
13874 CHECK_BYTE_COUNT_TRANS_SUBR(7);
13875 proto_tree_add_item(tree
, hf_smb_unknown
, tvb
,
13876 offset
, 7, ENC_NA
);
13877 COUNT_BYTES_TRANS_SUBR(7);
13883 dissect_sfsi_request(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
,
13884 int offset
, uint16_t *bcp
, smb_info_t
*si
)
13890 DISSECTOR_ASSERT(si
);
13892 switch(si
->info_level
) {
13893 case 0x203: /* REQUEST_TRANSPORT_ENCRYPTION */ {
13894 proto_item
*blob_item
;
13895 tvbuff_t
*blob_tvb
;
13896 proto_tree
*blob_tree
;
13898 /* security blob */
13899 blob_item
= proto_tree_add_item(tree
, hf_smb_security_blob
,
13901 tvb_reported_length_remaining(tvb
, offset
),
13904 /* As an optimization, because Windows is perverse,
13905 we check to see if NTLMSSP is the first part of the
13906 blob, and if so, call the NTLMSSP dissector,
13907 otherwise we call the GSS-API dissector. This is because
13908 Windows can request RAW NTLMSSP, but will happily handle
13909 a client that wraps NTLMSSP in SPNEGO
13912 blob_tree
= proto_item_add_subtree(blob_item
,
13915 blob_tvb
= tvb_new_subset_remaining(tvb
, offset
);
13917 if (tvb_strneql(blob_tvb
, 0, "NTLMSSP", 7) == 0) {
13918 call_dissector(ntlmssp_handle
, blob_tvb
, pinfo
, blob_tree
);
13920 call_dissector(gssapi_handle
, blob_tvb
, pinfo
, blob_tree
);
13923 offset
+= tvb_reported_length_remaining(tvb
, offset
);
13927 case 1006: /* QUERY_FS_QUOTA_INFO */
13928 offset
= dissect_nt_quota(tvb
, tree
, offset
, bcp
);
13936 dissect_sfsi_response(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
,
13937 int offset
, uint16_t *bcp
, smb_info_t
*si
)
13943 DISSECTOR_ASSERT(si
);
13945 switch(si
->info_level
) {
13946 case 0x203: /* REQUEST_TRANSPORT_ENCRYPTION */ {
13947 proto_item
*blob_item
;
13948 tvbuff_t
*blob_tvb
;
13949 proto_tree
*blob_tree
;
13951 /* security blob */
13952 blob_item
= proto_tree_add_item(tree
, hf_smb_security_blob
,
13954 tvb_reported_length_remaining(tvb
, offset
),
13957 /* As an optimization, because Windows is perverse,
13958 we check to see if NTLMSSP is the first part of the
13959 blob, and if so, call the NTLMSSP dissector,
13960 otherwise we call the GSS-API dissector. This is because
13961 Windows can request RAW NTLMSSP, but will happily handle
13962 a client that wraps NTLMSSP in SPNEGO
13965 blob_tree
= proto_item_add_subtree(blob_item
,
13968 blob_tvb
= tvb_new_subset_remaining(tvb
, offset
);
13970 if (tvb_strneql(blob_tvb
, 0, "NTLMSSP", 7) == 0) {
13971 call_dissector(ntlmssp_handle
, blob_tvb
, pinfo
, blob_tree
);
13973 call_dissector(gssapi_handle
, blob_tvb
, pinfo
, blob_tree
);
13976 offset
+= tvb_reported_length_remaining(tvb
, offset
);
13980 case 1006: /* QUERY_FS_QUOTA_INFO */
13989 dissect_transaction2_request_data(tvbuff_t
*tvb
, packet_info
*pinfo
,
13990 proto_tree
*parent_tree
, int offset
, int subcmd
, uint16_t dc
, smb_info_t
*si
)
13995 DISSECTOR_ASSERT(si
);
13997 tree
= proto_tree_add_subtree_format(parent_tree
, tvb
, offset
, dc
,
13998 ett_smb_transaction_data
, &item
, "%s Data",
13999 val_to_str_ext(subcmd
, &trans2_cmd_vals_ext
,
14000 "Unknown (0x%02x)"));
14003 case 0x0000: /*TRANS2_OPEN2*/
14004 /* XXX don't know how to decode FEAList */
14006 case 0x0001: /*TRANS2_FIND_FIRST2*/
14007 /* XXX don't know how to decode FEAList */
14009 case 0x0002: /*TRANS2_FIND_NEXT2*/
14010 /* XXX don't know how to decode FEAList */
14012 case 0x0003: /*TRANS2_QUERY_FS_INFORMATION*/
14013 /* no data field in this request */
14015 case 0x0004: /* TRANS2_SET_FS_INFORMATION */
14016 offset
= dissect_sfsi_request(tvb
, pinfo
, tree
, offset
, &dc
, si
);
14018 case 0x0005: /*TRANS2_QUERY_PATH_INFORMATION*/
14019 /* no data field in this request */
14021 * XXX - "Microsoft Networks SMB File Sharing Protocol
14022 * Extensions Version 3.0, Document Version 1.11,
14023 * July 19, 1990" says there may be "Additional
14024 * FileInfoLevel dependent information" here.
14026 * Was that just a cut-and-pasteo?
14027 * TRANS2_SET_PATH_INFORMATION *does* have that information
14031 case 0x0006: /*TRANS2_SET_PATH_INFORMATION*/
14032 offset
= dissect_spi_loi_vals(tvb
, pinfo
, tree
, item
, offset
, &dc
, si
);
14034 case 0x0007: /*TRANS2_QUERY_FILE_INFORMATION*/
14035 /* no data field in this request */
14037 * XXX - "Microsoft Networks SMB File Sharing Protocol
14038 * Extensions Version 3.0, Document Version 1.11,
14039 * July 19, 1990" says there may be "Additional
14040 * FileInfoLevel dependent information" here.
14042 * Was that just a cut-and-pasteo?
14043 * TRANS2_SET_FILE_INFORMATION *does* have that information
14047 case 0x0008: /*TRANS2_SET_FILE_INFORMATION*/
14048 offset
= dissect_spi_loi_vals(tvb
, pinfo
, tree
, item
, offset
, &dc
, si
);
14050 case 0x0009: /*TRANS2_FSCTL*/
14051 /*XXX don't know how to decode this yet */
14054 * XXX - "Microsoft Networks SMB File Sharing Protocol
14055 * Extensions Version 3.0, Document Version 1.11,
14056 * July 19, 1990" says this contains a
14057 * "File system specific data block". (That means we
14058 * may not be able to dissect it in any case.)
14061 case 0x000a: /*TRANS2_IOCTL2*/
14062 /*XXX don't know how to decode this yet */
14065 * XXX - "Microsoft Networks SMB File Sharing Protocol
14066 * Extensions Version 3.0, Document Version 1.11,
14067 * July 19, 1990" says this contains a
14068 * "Device/function specific data block". (That
14069 * means we may not be able to dissect it in any case.)
14072 case 0x000b: /*TRANS2_FIND_NOTIFY_FIRST*/
14073 /*XXX don't know how to decode this yet */
14076 * XXX - "Microsoft Networks SMB File Sharing Protocol
14077 * Extensions Version 3.0, Document Version 1.11,
14078 * July 19, 1990" says this contains "additional
14079 * level dependent match data".
14082 case 0x000c: /*TRANS2_FIND_NOTIFY_NEXT*/
14083 /*XXX don't know how to decode this yet */
14086 * XXX - "Microsoft Networks SMB File Sharing Protocol
14087 * Extensions Version 3.0, Document Version 1.11,
14088 * July 19, 1990" says this contains "additional
14089 * level dependent monitor information".
14092 case 0x000d: /*TRANS2_CREATE_DIRECTORY*/
14093 /* XXX optional FEAList, unknown what FEAList looks like*/
14095 case 0x000e: /*TRANS2_SESSION_SETUP*/
14096 /*XXX don't know how to decode this yet */
14098 case 0x0010: /*TRANS2_GET_DFS_REFERRAL*/
14099 /* no data field in this request */
14101 case 0x0011: /*TRANS2_REPORT_DFS_INCONSISTENCY*/
14102 offset
= dissect_dfs_inconsistency_data(tvb
, pinfo
, tree
, offset
, &dc
, si
);
14107 if (si
->info_level
== 2) {
14108 /* The LOI is "Info Set EAs (2), and dc is greater than zero, thus
14109 * SECONDARY requests will follow carrying the remainder of the data. */
14110 proto_tree_add_item(tree
, hf_smb_secondaries_will_follow
, tvb
, offset
, dc
, ENC_NA
);
14113 /* ooops there were data we didn't know how to process */
14114 proto_tree_add_item(tree
, hf_smb_unknown
, tvb
, offset
, dc
, ENC_NA
);
14124 dissect_trans_data(tvbuff_t
*s_tvb
, tvbuff_t
*p_tvb
, tvbuff_t
*d_tvb
,
14132 * Show the setup words.
14134 if (s_tvb
!= NULL
) {
14135 length
= tvb_reported_length(s_tvb
);
14136 for (i
= 0, offset
= 0; length
>= 2;
14137 i
++, offset
+= 2, length
-= 2) {
14139 * XXX - add a setup word filterable field?
14141 proto_tree_add_uint_format(tree
, hf_smb_trans_data_setup_word
, s_tvb
, offset
, 2,
14142 tvb_get_letohs(s_tvb
, offset
), "Setup Word %d: 0x%04x", i
, tvb_get_letohs(s_tvb
, offset
));
14147 * Show the parameters, if any.
14149 if (p_tvb
!= NULL
) {
14150 length
= tvb_reported_length(p_tvb
);
14152 proto_tree_add_item(tree
, hf_smb_trans_data_parameters
, p_tvb
, 0, length
, ENC_NA
);
14157 * Show the data, if any.
14159 if (d_tvb
!= NULL
) {
14160 length
= tvb_reported_length(d_tvb
);
14162 proto_tree_add_item(tree
, hf_smb_trans_data
, d_tvb
, 0, length
, ENC_NA
);
14167 /* This routine handles the following 4 calls
14169 Transaction Secondary 0x26
14171 Transaction2 Secondary 0x33
14174 dissect_transaction_request(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
14176 uint8_t wc
, sc
= 0;
14181 uint16_t od
= 0, po
= 0, pc
= 0, dc
= 0, pd
, dd
= 0;
14186 const char *an
= NULL
;
14187 smb_transact2_info_t
*t2i
;
14188 smb_transact_info_t
*tri
;
14191 bool dissected_trans
;
14194 DISSECTOR_ASSERT(si
);
14198 if (wc
== 8 || (wc
== 9 && si
->cmd
== SMB_COM_TRANSACTION2_SECONDARY
)) {
14199 /*secondary client request*/
14201 /* total param count, only a 16bit integer here*/
14202 proto_tree_add_item(tree
, hf_smb_total_param_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
14205 /* total data count , only 16bit integer here*/
14206 tdc
= tvb_get_letohs(tvb
, offset
);
14207 proto_tree_add_item(tree
, hf_smb_total_data_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
14211 pc
= tvb_get_letohs(tvb
, offset
);
14212 proto_tree_add_uint(tree
, hf_smb_param_count16
, tvb
, offset
, 2, pc
);
14216 po
= tvb_get_letohs(tvb
, offset
);
14217 proto_tree_add_uint(tree
, hf_smb_param_offset16
, tvb
, offset
, 2, po
);
14221 pd
= tvb_get_letohs(tvb
, offset
);
14222 proto_tree_add_uint(tree
, hf_smb_param_disp16
, tvb
, offset
, 2, pd
);
14226 dc
= tvb_get_letohs(tvb
, offset
);
14227 proto_tree_add_uint(tree
, hf_smb_data_count16
, tvb
, offset
, 2, dc
);
14231 od
= tvb_get_letohs(tvb
, offset
);
14232 proto_tree_add_uint(tree
, hf_smb_data_offset16
, tvb
, offset
, 2, od
);
14235 /* data displacement (dd)
14236 * The amount of data sent NOT including the data in this packet. If there are more
14237 * data to send per "Total Data Count" (tdc) [MS-CIFS] 2.2.4.46.1, additional
14238 * "TRANS2 Secondary Requests" ([MS-CIFS] 2.2.4.46.2) will follow, each increasing dd
14239 * until the tdc is reached (dd + dc = tdc).
14241 dd
= tvb_get_letohs(tvb
, offset
);
14242 proto_tree_add_uint(tree
, hf_smb_data_disp16
, tvb
, offset
, 2, dd
);
14245 if (tdc
&& tdc
>= dc
) {
14246 uint16_t diff
= tdc
- (dc
+ dd
);
14247 it
= proto_tree_add_uint(tree
, hf_bytes_until_total_data_count
, tvb
, 0, 0, diff
);
14248 proto_item_set_generated(it
);
14251 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Data: %u of %u", dd
+ dc
, tdc
);
14253 if (si
->cmd
== SMB_COM_TRANSACTION2
|| si
->cmd
== SMB_COM_TRANSACTION2_SECONDARY
) {
14257 fid
= tvb_get_letohs(tvb
, offset
);
14258 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, false, false, false, si
);
14263 /* There are no setup words. */
14267 /* it is NOT a secondary request */
14269 /* total param count , only a 16 bit integer here*/
14270 proto_tree_add_item(tree
, hf_smb_total_param_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
14273 /* total data count , only 16bit integer here*/
14274 tdc
= tvb_get_letohs(tvb
, offset
);
14275 proto_tree_add_item(tree
, hf_smb_total_data_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
14278 /* max param count , only 16bit integer here*/
14279 proto_tree_add_item(tree
, hf_smb_max_param_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
14282 /* max data count, only 16bit integer here*/
14283 proto_tree_add_item(tree
, hf_smb_max_data_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
14286 /* max setup count, only 16bit integer here*/
14287 proto_tree_add_item(tree
, hf_smb_max_setup_count
, tvb
, offset
, 1, ENC_NA
);
14290 /* reserved byte */
14291 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
14294 /* transaction flags */
14295 dissect_transaction_flags(tvb
, tree
, offset
);
14299 to
= tvb_get_letohl(tvb
, offset
);
14300 proto_tree_add_uint_format_value(tree
, hf_smb_timeout
, tvb
, offset
, 4, to
, "%s", smbext20_timeout_msecs_to_str(pinfo
->pool
, to
));
14303 /* 2 reserved bytes */
14304 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
14308 pc
= tvb_get_letohs(tvb
, offset
);
14309 proto_tree_add_uint(tree
, hf_smb_param_count16
, tvb
, offset
, 2, pc
);
14313 po
= tvb_get_letohs(tvb
, offset
);
14314 proto_tree_add_uint(tree
, hf_smb_param_offset16
, tvb
, offset
, 2, po
);
14318 * The amount of data carried in this request. If there are more data to send per
14319 * Total Data Count (tdc) [MS-CIFS] 2.2.4.46.1, TRANS2 Secondary Requests
14320 * ([MS-CIFS] 2.2.4.46.2) will follow, each increasing Data displacement (dd)until
14321 * tdc is reached (dd + dc = tdc).
14323 dc
= tvb_get_letohs(tvb
, offset
);
14324 proto_tree_add_uint(tree
, hf_smb_data_count16
, tvb
, offset
, 2, dc
);
14327 if (tdc
&& tdc
>= dc
) {
14328 uint16_t diff
= tdc
- dc
;
14329 it
= proto_tree_add_uint(tree
, hf_bytes_until_total_data_count
, tvb
, 0, 0, diff
);
14330 proto_item_set_generated(it
);
14334 od
= tvb_get_letohs(tvb
, offset
);
14335 proto_tree_add_uint(tree
, hf_smb_data_offset16
, tvb
, offset
, 2, od
);
14338 /* data displacement is zero here */
14342 sc
= tvb_get_uint8(tvb
, offset
);
14343 proto_tree_add_uint(tree
, hf_smb_setup_count
, tvb
, offset
, 1, sc
);
14346 /* reserved byte */
14347 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
14350 /* this is where the setup bytes, if any start */
14354 /* if there were any setup bytes, decode them */
14358 case SMB_COM_TRANSACTION2
:
14359 /* TRANSACTION2 only has one setup word and
14360 that is the subcommand code.
14362 XXX - except for TRANS2_FSCTL
14363 and TRANS2_IOCTL. */
14364 subcmd
= tvb_get_letohs(tvb
, offset
);
14365 proto_tree_add_uint(tree
, hf_smb_trans2_subcmd
,
14366 tvb
, offset
, 2, subcmd
);
14367 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", %s",
14368 val_to_str_ext(subcmd
, &trans2_cmd_vals_ext
,
14369 "Unknown (0x%02x)"));
14371 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Data: %u of %u", dc
, tdc
);
14374 if (!pinfo
->fd
->visited
&& si
->sip
) {
14377 * smb_transact2_info_t
14380 t2i
= wmem_new(wmem_file_scope(), smb_transact2_info_t
);
14381 t2i
->subcmd
= subcmd
;
14382 t2i
->info_level
= -1;
14383 t2i
->resume_keys
= false;
14385 si
->sip
->extra_info
= t2i
;
14386 si
->sip
->extra_info_type
= SMB_EI_T2I
;
14391 * XXX - process TRANS2_FSCTL and
14392 * TRANS2_IOCTL setup words here.
14396 case SMB_COM_TRANSACTION
:
14397 /* TRANSACTION setup words processed below */
14408 /* primary request */
14409 /* name is NULL if transaction2 */
14410 if (si
->cmd
== SMB_COM_TRANSACTION
) {
14411 /* Transaction Name */
14412 an
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
,
14413 si
->unicode
, &an_len
, false, false, &bc
);
14416 proto_tree_add_string(tree
, hf_smb_trans_name
, tvb
,
14417 offset
, an_len
, an
);
14418 COUNT_BYTES(an_len
);
14423 * The pipe or mailslot arguments for Transaction start with
14424 * the first setup word (or where the first setup word would
14425 * be if there were any setup words), and run to the current
14426 * offset (which could mean that there aren't any).
14429 spc
= offset
- spo
;
14433 /* We have some initial padding bytes.
14435 padcnt
= po
-offset
;
14438 proto_tree_add_item(tree
, hf_smb_padding
, tvb
, offset
, padcnt
, ENC_NA
);
14439 COUNT_BYTES(padcnt
);
14442 CHECK_BYTE_COUNT(pc
);
14445 case SMB_COM_TRANSACTION2
:
14446 /* TRANSACTION2 parameters*/
14447 offset
= dissect_transaction2_request_parameters(tvb
,
14448 pinfo
, tree
, offset
, subcmd
, pc
, si
);
14452 case SMB_COM_TRANSACTION
:
14453 /* TRANSACTION parameters processed below */
14461 /* We have some initial padding bytes.
14463 padcnt
= od
-offset
;
14466 proto_tree_add_item(tree
, hf_smb_padding
, tvb
, offset
, padcnt
, ENC_NA
);
14467 COUNT_BYTES(padcnt
);
14470 CHECK_BYTE_COUNT(dc
);
14473 case SMB_COM_TRANSACTION2
:
14474 /* TRANSACTION2 data*/
14475 offset
= dissect_transaction2_request_data(tvb
, pinfo
,
14476 tree
, offset
, subcmd
, dc
, si
);
14480 case SMB_COM_TRANSACTION
:
14481 /* TRANSACTION data processed below */
14487 /*TRANSACTION request parameters */
14488 if (si
->cmd
== SMB_COM_TRANSACTION
) {
14489 /*XXX replace this block with a function and use that one
14490 for both requests/responses*/
14492 tvbuff_t
*p_tvb
, *d_tvb
, *s_tvb
;
14493 tvbuff_t
*sp_tvb
, *pd_tvb
;
14496 if (pc
>tvb_reported_length_remaining(tvb
, po
)) {
14497 p_tvb
= tvb_new_subset_length_caplen(tvb
, po
, tvb_reported_length_remaining(tvb
, po
), pc
);
14499 p_tvb
= tvb_new_subset_length(tvb
, po
, pc
);
14505 if (dc
>tvb_reported_length_remaining(tvb
, od
)) {
14506 d_tvb
= tvb_new_subset_length_caplen(tvb
, od
, tvb_reported_length_remaining(tvb
, od
), dc
);
14508 d_tvb
= tvb_new_subset_length(tvb
, od
, dc
);
14514 if (sl
>tvb_reported_length_remaining(tvb
, so
)) {
14515 s_tvb
= tvb_new_subset_length_caplen(tvb
, so
, tvb_reported_length_remaining(tvb
, so
), sl
);
14517 s_tvb
= tvb_new_subset_length(tvb
, so
, sl
);
14524 if (!pinfo
->fd
->visited
&& si
->sip
) {
14526 * Allocate a new smb_transact_info_t
14529 tri
= wmem_new(wmem_file_scope(), smb_transact_info_t
);
14531 tri
->trans_subcmd
= -1;
14532 tri
->function
= -1;
14534 tri
->lanman_cmd
= 0;
14535 tri
->param_descrip
= NULL
;
14536 tri
->data_descrip
= NULL
;
14537 tri
->aux_data_descrip
= NULL
;
14538 tri
->info_level
= -1;
14539 si
->sip
->extra_info
= tri
;
14540 si
->sip
->extra_info_type
= SMB_EI_TRI
;
14543 * We already filled the structure
14544 * in; don't bother doing so again.
14550 * This is a unidirectional message, for
14551 * which there will be no reply; don't
14552 * bother allocating an "smb_transact_info_t"
14553 * structure for it.
14557 dissected_trans
= false;
14560 if (strncmp("\\PIPE\\", an
, 6) == 0) {
14562 tri
->subcmd
= TRANSACTION_PIPE
;
14565 * A tvbuff containing the setup words and
14568 sp_tvb
= tvb_new_subset_length(tvb
, spo
, spc
);
14571 * A tvbuff containing the parameters and the
14574 pd_tvb
= tvb_new_subset_remaining(tvb
, po
);
14576 dissected_trans
= dissect_pipe_smb(sp_tvb
,
14577 s_tvb
, pd_tvb
, p_tvb
, d_tvb
, an
+6, pinfo
,
14578 top_tree_global
, si
);
14580 /* In case we did not see the TreeConnect call,
14581 store this TID here as well as a IPC TID
14582 so we know that future Read/Writes to this
14583 TID is (probably) DCERPC.
14585 if (g_hash_table_lookup(si
->ct
->tid_service
, GUINT_TO_POINTER(si
->tid
))) {
14586 g_hash_table_remove(si
->ct
->tid_service
, GUINT_TO_POINTER(si
->tid
));
14588 g_hash_table_insert(si
->ct
->tid_service
, GUINT_TO_POINTER(si
->tid
), (void *)TID_IPC
);
14589 } else if (strncmp("\\MAILSLOT\\", an
, 10) == 0) {
14591 tri
->subcmd
= TRANSACTION_MAILSLOT
;
14594 * A tvbuff containing the setup words and
14595 * the mailslot path.
14597 sp_tvb
= tvb_new_subset_length(tvb
, spo
, spc
);
14598 dissected_trans
= dissect_mailslot_smb(sp_tvb
,
14599 s_tvb
, d_tvb
, an
+10, pinfo
, top_tree_global
, si
);
14601 if (!dissected_trans
)
14602 dissect_trans_data(s_tvb
, p_tvb
, d_tvb
, tree
);
14605 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Data: %u of %u", dc
+ dd
, tdc
);
14617 dissect_4_3_4_1(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
,
14618 int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
14622 int old_offset
= offset
;
14625 smb_transact2_info_t
*t2i
;
14626 bool resume_keys
= false;
14627 uint32_t bytes_needed
= 0;
14629 DISSECTOR_ASSERT(si
);
14631 if ((si
->sip
!= NULL
) && (si
->sip
->extra_info_type
== SMB_EI_T2I
)) {
14632 t2i
= (smb_transact2_info_t
*)si
->sip
->extra_info
;
14634 resume_keys
= t2i
->resume_keys
;
14637 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, *bcp
, ett_smb_ff2_data
, &item
,
14638 val_to_str(si
->info_level
, ff2_il_vals
, "Unknown (0x%02x)"));
14641 * Figure out of there are enough bytes to display the whole entry.
14642 * This consistes of 22 bytes or 26 bytes if resume_keys, followed
14643 * by a length byte and that many chars.
14645 bytes_needed
= 23 + (resume_keys
? 4 : 0);
14646 tvb_ensure_bytes_exist(tvb
, offset
, bytes_needed
);
14648 /* Now, get the length */
14649 fn_len
= tvb_get_uint8(tvb
, offset
+ bytes_needed
- 1);
14650 tvb_ensure_bytes_exist(tvb
, offset
, bytes_needed
+ fn_len
);
14654 CHECK_BYTE_COUNT_SUBR(4);
14655 proto_tree_add_item(tree
, hf_smb_resume
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
14656 COUNT_BYTES_SUBR(4);
14660 CHECK_BYTE_COUNT_SUBR(4);
14661 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
14662 hf_smb_create_time
,
14663 hf_smb_create_dos_date
, hf_smb_create_dos_time
, false);
14667 CHECK_BYTE_COUNT_SUBR(4);
14668 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
14669 hf_smb_access_time
,
14670 hf_smb_access_dos_date
, hf_smb_access_dos_time
, false);
14673 /* last write time */
14674 CHECK_BYTE_COUNT_SUBR(4);
14675 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
14676 hf_smb_last_write_time
,
14677 hf_smb_last_write_dos_date
, hf_smb_last_write_dos_time
, false);
14681 CHECK_BYTE_COUNT_SUBR(4);
14682 proto_tree_add_item(tree
, hf_smb_data_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
14683 COUNT_BYTES_SUBR(4);
14685 /* allocation size */
14686 CHECK_BYTE_COUNT_SUBR(4);
14687 proto_tree_add_item(tree
, hf_smb_alloc_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
14688 COUNT_BYTES_SUBR(4);
14690 /* File Attributes */
14691 CHECK_BYTE_COUNT_SUBR(2);
14692 offset
= dissect_file_attributes(tvb
, tree
, offset
);
14695 /* file name len */
14696 CHECK_BYTE_COUNT_SUBR(1);
14697 fn_len
= tvb_get_uint8(tvb
, offset
);
14698 proto_tree_add_uint(tree
, hf_smb_file_name_len
, tvb
, offset
, 1, fn_len
);
14699 COUNT_BYTES_SUBR(1);
14701 fn_len
+= 2; /* include terminating '\0' */
14703 fn_len
++; /* include terminating '\0' */
14706 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, true, bcp
);
14707 CHECK_STRING_SUBR(fn
);
14708 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
14710 COUNT_BYTES_SUBR(fn_len
);
14712 proto_item_append_text(item
, " File: %s", format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
14713 proto_item_set_len(item
, offset
-old_offset
);
14720 dissect_4_3_4_2(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
,
14721 int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
14725 int old_offset
= offset
;
14728 smb_transact2_info_t
*t2i
;
14729 bool resume_keys
= false;
14730 uint32_t bytes_needed
= 0;
14732 DISSECTOR_ASSERT(si
);
14734 if ((si
->sip
!= NULL
) && (si
->sip
->extra_info_type
== SMB_EI_T2I
)) {
14735 t2i
= (smb_transact2_info_t
*)si
->sip
->extra_info
;
14737 resume_keys
= t2i
->resume_keys
;
14740 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, *bcp
, ett_smb_ff2_data
, &item
,
14741 val_to_str(si
->info_level
, ff2_il_vals
, "Unknown (0x%02x)"));
14744 * Figure out of there are enough bytes to display the whole entry.
14745 * This consistes of 26 bytes or 30 bytes if resume_keys, followed
14746 * by a length byte and that many chars.
14748 bytes_needed
= 27 + (resume_keys
? 4 : 0);
14749 tvb_ensure_bytes_exist(tvb
, offset
, bytes_needed
);
14751 /* Now, get the length */
14752 fn_len
= tvb_get_uint8(tvb
, offset
+ bytes_needed
- 1);
14753 tvb_ensure_bytes_exist(tvb
, offset
, bytes_needed
+ fn_len
);
14757 CHECK_BYTE_COUNT_SUBR(4);
14758 proto_tree_add_item(tree
, hf_smb_resume
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
14759 COUNT_BYTES_SUBR(4);
14763 CHECK_BYTE_COUNT_SUBR(4);
14764 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
14765 hf_smb_create_time
,
14766 hf_smb_create_dos_date
, hf_smb_create_dos_time
, false);
14770 CHECK_BYTE_COUNT_SUBR(4);
14771 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
14772 hf_smb_access_time
,
14773 hf_smb_access_dos_date
, hf_smb_access_dos_time
, false);
14776 /* last write time */
14777 CHECK_BYTE_COUNT_SUBR(4);
14778 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
14779 hf_smb_last_write_time
,
14780 hf_smb_last_write_dos_date
, hf_smb_last_write_dos_time
, false);
14784 CHECK_BYTE_COUNT_SUBR(4);
14785 proto_tree_add_item(tree
, hf_smb_data_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
14786 COUNT_BYTES_SUBR(4);
14788 /* allocation size */
14789 CHECK_BYTE_COUNT_SUBR(4);
14790 proto_tree_add_item(tree
, hf_smb_alloc_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
14791 COUNT_BYTES_SUBR(4);
14793 /* File Attributes */
14794 CHECK_BYTE_COUNT_SUBR(2);
14795 offset
= dissect_file_attributes(tvb
, tree
, offset
);
14799 CHECK_BYTE_COUNT_SUBR(4);
14800 proto_tree_add_item(tree
, hf_smb_ea_list_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
14801 COUNT_BYTES_SUBR(4);
14803 /* file name len */
14804 CHECK_BYTE_COUNT_SUBR(1);
14805 fn_len
= tvb_get_uint8(tvb
, offset
);
14806 proto_tree_add_uint(tree
, hf_smb_file_name_len
, tvb
, offset
, 1, fn_len
);
14807 COUNT_BYTES_SUBR(1);
14810 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, true, true, bcp
);
14811 CHECK_STRING_SUBR(fn
);
14812 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
14814 COUNT_BYTES_SUBR(fn_len
);
14815 proto_item_append_text(item
, " File: %s", format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
14818 * To quote the footnote for FileName in Section 2.2.8.1.2:
14820 * Windows NT servers always append a single NULL padding byte
14821 * to the FileName field. The length of this additional byte
14822 * is not included in the value of the FileNameLength field.
14824 * That's "single byte", not "UTF-16 null character".
14826 * XXX - what about other servers? Do we need to somehow
14827 * determine whether the server is a "Windows NT server" or
14830 CHECK_BYTE_COUNT_SUBR(1);
14831 COUNT_BYTES_SUBR(1);
14833 proto_item_set_len(item
, offset
-old_offset
);
14840 * According to MS-CIFS 2.2.8.1.3 this is like the function above with the
14841 * addition of the list of EA name value pairs before the file name.
14843 * The EAs are formatted as an SMB_FEA as in 2.2.1.2.2. We will deal with
14847 dissect_4_3_4_3(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
,
14848 int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
14852 int old_offset
= offset
;
14856 smb_transact2_info_t
*t2i
;
14857 bool resume_keys
= false;
14860 DISSECTOR_ASSERT(si
);
14862 if ((si
->sip
!= NULL
) && (si
->sip
->extra_info_type
== SMB_EI_T2I
)) {
14863 t2i
= (smb_transact2_info_t
*)si
->sip
->extra_info
;
14865 resume_keys
= t2i
->resume_keys
;
14868 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, *bcp
, ett_smb_ff2_data
, &item
,
14869 val_to_str(si
->info_level
, ff2_il_vals
, "Unknown (0x%02x)"));
14873 CHECK_BYTE_COUNT_SUBR(4);
14874 proto_tree_add_item(tree
, hf_smb_resume
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
14875 COUNT_BYTES_SUBR(4);
14879 CHECK_BYTE_COUNT_SUBR(4);
14880 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
14881 hf_smb_create_time
,
14882 hf_smb_create_dos_date
, hf_smb_create_dos_time
, false);
14886 CHECK_BYTE_COUNT_SUBR(4);
14887 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
14888 hf_smb_access_time
,
14889 hf_smb_access_dos_date
, hf_smb_access_dos_time
, false);
14892 /* last write time */
14893 CHECK_BYTE_COUNT_SUBR(4);
14894 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
14895 hf_smb_last_write_time
,
14896 hf_smb_last_write_dos_date
, hf_smb_last_write_dos_time
, false);
14900 CHECK_BYTE_COUNT_SUBR(4);
14901 proto_tree_add_item(tree
, hf_smb_data_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
14902 COUNT_BYTES_SUBR(4);
14904 /* allocation size */
14905 CHECK_BYTE_COUNT_SUBR(4);
14906 proto_tree_add_item(tree
, hf_smb_alloc_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
14907 COUNT_BYTES_SUBR(4);
14909 /* File Attributes */
14910 CHECK_BYTE_COUNT_SUBR(2);
14911 offset
= dissect_file_attributes(tvb
, tree
, offset
);
14915 CHECK_BYTE_COUNT_SUBR(4);
14916 ea_size
= tvb_get_letohl(tvb
, offset
);
14917 proto_tree_add_item(tree
, hf_smb_ea_list_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
14918 COUNT_BYTES_SUBR(4);
14920 /* The EAs ... they are formatted as in MS-CIFS 2.2.1.2.2 */
14921 proto_tree_add_bytes_format(tree
, hf_smb_file_data
, tvb
, offset
, ea_size
, NULL
, "EAs");
14922 COUNT_BYTES_SUBR(ea_size
);
14925 /* file name len */
14926 CHECK_BYTE_COUNT_SUBR(1);
14927 fn_len
= tvb_get_uint8(tvb
, offset
);
14928 proto_tree_add_uint(tree
, hf_smb_file_name_len
, tvb
, offset
, 1, fn_len
);
14929 COUNT_BYTES_SUBR(1);
14931 fn_len
+= 2; /* include terminating '\0' */
14933 fn_len
++; /* include terminating '\0' */
14936 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, true, bcp
);
14937 CHECK_STRING_SUBR(fn
);
14938 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
14940 COUNT_BYTES_SUBR(fn_len
);
14942 proto_item_append_text(item
, " File: %s", format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
14943 proto_item_set_len(item
, offset
-old_offset
);
14949 dissect_4_3_4_4(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
,
14950 int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
14954 int old_offset
= offset
;
14960 DISSECTOR_ASSERT(si
);
14963 * We check this first before adding the sub-tree so things do not
14967 /* next entry offset */
14968 CHECK_BYTE_COUNT_SUBR(4);
14969 neo
= tvb_get_letohl(tvb
, offset
);
14971 /* Ensure we have the bytes we need, which is up to neo */
14972 tvb_ensure_bytes_exist(tvb
, offset
, neo
? neo
: *bcp
);
14974 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, *bcp
, ett_smb_ff2_data
, &item
,
14975 val_to_str(si
->info_level
, ff2_il_vals
, "Unknown (0x%02x)"));
14978 * We assume that the presence of a next entry offset implies the
14979 * absence of a resume key, as appears to be the case for 4.3.4.6.
14982 CHECK_BYTE_COUNT_SUBR(4);
14983 proto_tree_add_uint(tree
, hf_smb_next_entry_offset
, tvb
, offset
, 4, neo
);
14984 COUNT_BYTES_SUBR(4);
14987 CHECK_BYTE_COUNT_SUBR(4);
14988 proto_tree_add_item(tree
, hf_smb_file_index
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
14989 COUNT_BYTES_SUBR(4);
14991 offset
= dissect_smb_standard_8byte_timestamps(tvb
, pinfo
, tree
, offset
, bcp
, trunc
);
14997 CHECK_BYTE_COUNT_SUBR(8);
14998 proto_tree_add_item(tree
, hf_smb_end_of_file
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
14999 COUNT_BYTES_SUBR(8);
15001 /* allocation size */
15002 CHECK_BYTE_COUNT_SUBR(8);
15003 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
15004 COUNT_BYTES_SUBR(8);
15006 /* Extended File Attributes */
15007 CHECK_BYTE_COUNT_SUBR(4);
15008 offset
= dissect_file_ext_attr(tvb
, tree
, offset
);
15011 /* file name len */
15012 CHECK_BYTE_COUNT_SUBR(4);
15013 fn_len
= tvb_get_letohl(tvb
, offset
);
15014 proto_tree_add_uint(tree
, hf_smb_file_name_len
, tvb
, offset
, 4, fn_len
);
15015 COUNT_BYTES_SUBR(4);
15018 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, true, bcp
);
15019 CHECK_STRING_SUBR(fn
);
15020 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
15022 COUNT_BYTES_SUBR(fn_len
);
15024 /* skip to next structure */
15026 padcnt
= (old_offset
+ neo
) - offset
;
15029 * XXX - this is bogus; flag it?
15034 CHECK_BYTE_COUNT_SUBR(padcnt
);
15035 COUNT_BYTES_SUBR(padcnt
);
15039 proto_item_append_text(item
, " File: %s", format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
15040 proto_item_set_len(item
, offset
-old_offset
);
15047 dissect_4_3_4_5(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
,
15048 int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
15052 int old_offset
= offset
;
15058 DISSECTOR_ASSERT(si
);
15061 * We check this first before adding the sub-tree so things do not
15065 /* next entry offset */
15066 CHECK_BYTE_COUNT_SUBR(4);
15067 neo
= tvb_get_letohl(tvb
, offset
);
15069 /* Ensure we have the bytes we need, which is up to neo */
15070 tvb_ensure_bytes_exist(tvb
, offset
, neo
? neo
: *bcp
);
15072 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, *bcp
, ett_smb_ff2_data
, &item
,
15073 val_to_str(si
->info_level
, ff2_il_vals
, "Unknown (0x%02x)"));
15076 * We assume that the presence of a next entry offset implies the
15077 * absence of a resume key, as appears to be the case for 4.3.4.6.
15080 CHECK_BYTE_COUNT_SUBR(4);
15081 proto_tree_add_uint(tree
, hf_smb_next_entry_offset
, tvb
, offset
, 4, neo
);
15082 COUNT_BYTES_SUBR(4);
15085 CHECK_BYTE_COUNT_SUBR(4);
15086 proto_tree_add_item(tree
, hf_smb_file_index
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15087 COUNT_BYTES_SUBR(4);
15089 /* standard 8-byte timestamps */
15090 offset
= dissect_smb_standard_8byte_timestamps(tvb
, pinfo
, tree
, offset
, bcp
, trunc
);
15096 CHECK_BYTE_COUNT_SUBR(8);
15097 proto_tree_add_item(tree
, hf_smb_end_of_file
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
15098 COUNT_BYTES_SUBR(8);
15100 /* allocation size */
15101 CHECK_BYTE_COUNT_SUBR(8);
15102 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
15103 COUNT_BYTES_SUBR(8);
15105 /* Extended File Attributes */
15106 CHECK_BYTE_COUNT_SUBR(4);
15107 offset
= dissect_file_ext_attr(tvb
, tree
, offset
);
15110 /* file name len */
15111 CHECK_BYTE_COUNT_SUBR(4);
15112 fn_len
= tvb_get_letohl(tvb
, offset
);
15113 proto_tree_add_uint(tree
, hf_smb_file_name_len
, tvb
, offset
, 4, fn_len
);
15114 COUNT_BYTES_SUBR(4);
15117 CHECK_BYTE_COUNT_SUBR(4);
15118 proto_tree_add_item(tree
, hf_smb_ea_list_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15119 COUNT_BYTES_SUBR(4);
15122 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, true, bcp
);
15123 CHECK_STRING_SUBR(fn
);
15124 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
15126 COUNT_BYTES_SUBR(fn_len
);
15128 /* skip to next structure */
15130 padcnt
= (old_offset
+ neo
) - offset
;
15133 * XXX - this is bogus; flag it?
15138 CHECK_BYTE_COUNT_SUBR(padcnt
);
15139 COUNT_BYTES_SUBR(padcnt
);
15143 proto_item_append_text(item
, " File: %s", format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
15144 proto_item_set_len(item
, offset
-old_offset
);
15151 dissect_4_3_4_6(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
,
15152 int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
15154 int fn_len
, sfn_len
;
15155 const char *fn
, *sfn
;
15156 int old_offset
= offset
;
15162 DISSECTOR_ASSERT(si
);
15165 * We check this first before adding the sub-tree so things do not
15169 /* next entry offset */
15170 CHECK_BYTE_COUNT_SUBR(4);
15171 neo
= tvb_get_letohl(tvb
, offset
);
15173 /* Ensure we have the bytes we need, which is up to neo */
15174 tvb_ensure_bytes_exist(tvb
, offset
, neo
? neo
: *bcp
);
15176 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, *bcp
, ett_smb_ff2_data
, &item
,
15177 val_to_str(si
->info_level
, ff2_il_vals
, "Unknown (0x%02x)"));
15180 * XXX - I have not seen any of these that contain a resume
15181 * key, even though some of the requests had the "return resume
15185 CHECK_BYTE_COUNT_SUBR(4);
15186 proto_tree_add_uint(tree
, hf_smb_next_entry_offset
, tvb
, offset
, 4, neo
);
15187 COUNT_BYTES_SUBR(4);
15190 CHECK_BYTE_COUNT_SUBR(4);
15191 proto_tree_add_item(tree
, hf_smb_file_index
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15192 COUNT_BYTES_SUBR(4);
15194 /* dissect standard 8-byte timestamps */
15195 offset
= dissect_smb_standard_8byte_timestamps(tvb
, pinfo
, tree
, offset
, bcp
, trunc
);
15201 CHECK_BYTE_COUNT_SUBR(8);
15202 proto_tree_add_item(tree
, hf_smb_end_of_file
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
15203 COUNT_BYTES_SUBR(8);
15205 /* allocation size */
15206 CHECK_BYTE_COUNT_SUBR(8);
15207 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
15208 COUNT_BYTES_SUBR(8);
15210 /* Extended File Attributes */
15211 CHECK_BYTE_COUNT_SUBR(4);
15212 offset
= dissect_file_ext_attr(tvb
, tree
, offset
);
15215 /* file name len */
15216 CHECK_BYTE_COUNT_SUBR(4);
15217 fn_len
= tvb_get_letohl(tvb
, offset
);
15218 proto_tree_add_uint(tree
, hf_smb_file_name_len
, tvb
, offset
, 4, fn_len
);
15219 COUNT_BYTES_SUBR(4);
15224 * XXX - in one captures, this has the topmost bit set, and the
15225 * rest of the bits have the value 7. Is the topmost bit being
15226 * set some indication that the value *isn't* the length of
15229 CHECK_BYTE_COUNT_SUBR(4);
15230 proto_tree_add_item(tree
, hf_smb_ea_list_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15231 COUNT_BYTES_SUBR(4);
15233 /* short file name len */
15234 CHECK_BYTE_COUNT_SUBR(1);
15235 sfn_len
= tvb_get_uint8(tvb
, offset
);
15236 proto_tree_add_uint(tree
, hf_smb_short_file_name_len
, tvb
, offset
, 1, sfn_len
);
15237 COUNT_BYTES_SUBR(1);
15239 /* reserved byte */
15240 CHECK_BYTE_COUNT_SUBR(1);
15241 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
15242 COUNT_BYTES_SUBR(1);
15244 /* short file name - it's not always in Unicode */
15245 sfn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &sfn_len
, false, true, bcp
);
15246 CHECK_STRING_SUBR(sfn
);
15247 proto_tree_add_string(tree
, hf_smb_short_file_name
, tvb
, offset
, 24,
15249 COUNT_BYTES_SUBR(24);
15252 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, true, bcp
);
15253 CHECK_STRING_SUBR(fn
);
15254 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
15256 COUNT_BYTES_SUBR(fn_len
);
15258 /* skip to next structure */
15260 padcnt
= (old_offset
+ neo
) - offset
;
15263 * XXX - this is bogus; flag it?
15268 CHECK_BYTE_COUNT_SUBR(padcnt
);
15269 COUNT_BYTES_SUBR(padcnt
);
15273 proto_item_append_text(item
, " File: %s", format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
15274 proto_item_set_len(item
, offset
-old_offset
);
15281 dissect_4_3_4_6full(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
,
15282 int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
15286 int old_offset
= offset
;
15292 DISSECTOR_ASSERT(si
);
15295 * We check this first before adding the sub-tree so things do not
15299 /* next entry offset */
15300 CHECK_BYTE_COUNT_SUBR(4);
15301 neo
= tvb_get_letohl(tvb
, offset
);
15303 /* Ensure we have the bytes we need, which is up to neo */
15304 tvb_ensure_bytes_exist(tvb
, offset
, neo
? neo
: *bcp
);
15306 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, *bcp
, ett_smb_ff2_data
, &item
,
15307 val_to_str(si
->info_level
, ff2_il_vals
, "Unknown (0x%02x)"));
15310 * XXX - I have not seen any of these that contain a resume
15311 * key, even though some of the requests had the "return resume
15315 CHECK_BYTE_COUNT_SUBR(4);
15316 proto_tree_add_uint(tree
, hf_smb_next_entry_offset
, tvb
, offset
, 4, neo
);
15317 COUNT_BYTES_SUBR(4);
15320 CHECK_BYTE_COUNT_SUBR(4);
15321 proto_tree_add_item(tree
, hf_smb_file_index
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15322 COUNT_BYTES_SUBR(4);
15324 /* dissect standard 8-byte timestamps */
15325 offset
= dissect_smb_standard_8byte_timestamps(tvb
, pinfo
, tree
, offset
, bcp
, trunc
);
15331 CHECK_BYTE_COUNT_SUBR(8);
15332 proto_tree_add_item(tree
, hf_smb_end_of_file
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
15333 COUNT_BYTES_SUBR(8);
15335 /* allocation size */
15336 CHECK_BYTE_COUNT_SUBR(8);
15337 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
15338 COUNT_BYTES_SUBR(8);
15340 /* Extended File Attributes */
15341 CHECK_BYTE_COUNT_SUBR(4);
15342 offset
= dissect_file_ext_attr(tvb
, tree
, offset
);
15345 /* file name len */
15346 CHECK_BYTE_COUNT_SUBR(4);
15347 fn_len
= tvb_get_letohl(tvb
, offset
);
15348 proto_tree_add_uint(tree
, hf_smb_file_name_len
, tvb
, offset
, 4, fn_len
);
15349 COUNT_BYTES_SUBR(4);
15354 * XXX - in one captures, this has the topmost bit set, and the
15355 * rest of the bits have the value 7. Is the topmost bit being
15356 * set some indication that the value *isn't* the length of
15359 CHECK_BYTE_COUNT_SUBR(4);
15360 proto_tree_add_item(tree
, hf_smb_ea_list_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15361 COUNT_BYTES_SUBR(4);
15364 COUNT_BYTES_SUBR(4);
15366 CHECK_BYTE_COUNT_SUBR(8);
15367 proto_tree_add_item(tree
, hf_smb_index_number
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
15368 COUNT_BYTES_SUBR(8);
15371 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, true, bcp
);
15372 CHECK_STRING_SUBR(fn
);
15373 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
15375 COUNT_BYTES_SUBR(fn_len
);
15377 /* skip to next structure */
15379 padcnt
= (old_offset
+ neo
) - offset
;
15382 * XXX - this is bogus; flag it?
15387 CHECK_BYTE_COUNT_SUBR(padcnt
);
15388 COUNT_BYTES_SUBR(padcnt
);
15392 proto_item_append_text(item
, " File: %s", format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
15393 proto_item_set_len(item
, offset
-old_offset
);
15400 dissect_4_3_4_6_id_both(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
,
15401 int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
15403 int fn_len
, sfn_len
;
15404 const char *fn
, *sfn
;
15405 int old_offset
= offset
;
15411 DISSECTOR_ASSERT(si
);
15414 * We check this first before adding the sub-tree so things do not
15418 /* next entry offset */
15419 CHECK_BYTE_COUNT_SUBR(4);
15420 neo
= tvb_get_letohl(tvb
, offset
);
15422 /* Ensure we have the bytes we need, which is up to neo */
15423 tvb_ensure_bytes_exist(tvb
, offset
, neo
? neo
: *bcp
);
15425 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, *bcp
, ett_smb_ff2_data
, &item
,
15426 val_to_str(si
->info_level
, ff2_il_vals
, "Unknown (0x%02x)"));
15429 * XXX - I have not seen any of these that contain a resume
15430 * key, even though some of the requests had the "return resume
15434 CHECK_BYTE_COUNT_SUBR(4);
15435 proto_tree_add_uint(tree
, hf_smb_next_entry_offset
, tvb
, offset
, 4, neo
);
15436 COUNT_BYTES_SUBR(4);
15439 CHECK_BYTE_COUNT_SUBR(4);
15440 proto_tree_add_item(tree
, hf_smb_file_index
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15441 COUNT_BYTES_SUBR(4);
15443 /* dissect standard 8-byte timestamps */
15444 offset
= dissect_smb_standard_8byte_timestamps(tvb
, pinfo
, tree
, offset
, bcp
, trunc
);
15450 CHECK_BYTE_COUNT_SUBR(8);
15451 proto_tree_add_item(tree
, hf_smb_end_of_file
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
15452 COUNT_BYTES_SUBR(8);
15454 /* allocation size */
15455 CHECK_BYTE_COUNT_SUBR(8);
15456 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
15457 COUNT_BYTES_SUBR(8);
15459 /* Extended File Attributes */
15460 CHECK_BYTE_COUNT_SUBR(4);
15461 offset
= dissect_file_ext_attr(tvb
, tree
, offset
);
15464 /* file name len */
15465 CHECK_BYTE_COUNT_SUBR(4);
15466 fn_len
= tvb_get_letohl(tvb
, offset
);
15467 proto_tree_add_uint(tree
, hf_smb_file_name_len
, tvb
, offset
, 4, fn_len
);
15468 COUNT_BYTES_SUBR(4);
15473 * XXX - in one captures, this has the topmost bit set, and the
15474 * rest of the bits have the value 7. Is the topmost bit being
15475 * set some indication that the value *isn't* the length of
15478 CHECK_BYTE_COUNT_SUBR(4);
15479 proto_tree_add_item(tree
, hf_smb_ea_list_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15480 COUNT_BYTES_SUBR(4);
15482 /* short file name len */
15483 CHECK_BYTE_COUNT_SUBR(1);
15484 sfn_len
= tvb_get_uint8(tvb
, offset
);
15485 proto_tree_add_uint(tree
, hf_smb_short_file_name_len
, tvb
, offset
, 1, sfn_len
);
15486 COUNT_BYTES_SUBR(1);
15488 /* reserved byte */
15489 CHECK_BYTE_COUNT_SUBR(1);
15490 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
15491 COUNT_BYTES_SUBR(1);
15493 /* short file name - it's not always in Unicode */
15494 sfn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &sfn_len
, false, true, bcp
);
15495 CHECK_STRING_SUBR(sfn
);
15496 proto_tree_add_string(tree
, hf_smb_short_file_name
, tvb
, offset
, 24,
15498 COUNT_BYTES_SUBR(24);
15500 /* reserved bytes */
15501 CHECK_BYTE_COUNT_SUBR(2);
15502 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
15503 COUNT_BYTES_SUBR(2);
15506 CHECK_BYTE_COUNT_SUBR(8);
15507 proto_tree_add_item(tree
, hf_smb_index_number
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
15508 COUNT_BYTES_SUBR(8);
15511 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, true, bcp
);
15512 CHECK_STRING_SUBR(fn
);
15513 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
15515 COUNT_BYTES_SUBR(fn_len
);
15517 /* skip to next structure */
15519 padcnt
= (old_offset
+ neo
) - offset
;
15522 * XXX - this is bogus; flag it?
15527 CHECK_BYTE_COUNT_SUBR(padcnt
);
15528 COUNT_BYTES_SUBR(padcnt
);
15532 proto_item_append_text(item
, " File: %s", format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
15533 proto_item_set_len(item
, offset
-old_offset
);
15540 dissect_4_3_4_7(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
,
15541 int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
15545 int old_offset
= offset
;
15551 DISSECTOR_ASSERT(si
);
15554 * We check this first before adding the sub-tree so things do not
15558 /* next entry offset */
15559 CHECK_BYTE_COUNT_SUBR(4);
15560 neo
= tvb_get_letohl(tvb
, offset
);
15562 /* Ensure we have the bytes we need, which is up to neo */
15563 tvb_ensure_bytes_exist(tvb
, offset
, neo
? neo
: *bcp
);
15565 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, *bcp
, ett_smb_ff2_data
, &item
,
15566 val_to_str(si
->info_level
, ff2_il_vals
, "Unknown (0x%02x)"));
15569 * We assume that the presence of a next entry offset implies the
15570 * absence of a resume key, as appears to be the case for 4.3.4.6.
15573 CHECK_BYTE_COUNT_SUBR(4);
15574 proto_tree_add_uint(tree
, hf_smb_next_entry_offset
, tvb
, offset
, 4, neo
);
15575 COUNT_BYTES_SUBR(4);
15578 CHECK_BYTE_COUNT_SUBR(4);
15579 proto_tree_add_item(tree
, hf_smb_file_index
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15580 COUNT_BYTES_SUBR(4);
15582 /* file name len */
15583 CHECK_BYTE_COUNT_SUBR(4);
15584 fn_len
= tvb_get_letohl(tvb
, offset
);
15585 proto_tree_add_uint(tree
, hf_smb_file_name_len
, tvb
, offset
, 4, fn_len
);
15586 COUNT_BYTES_SUBR(4);
15589 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, true, bcp
);
15590 CHECK_STRING_SUBR(fn
);
15591 proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, offset
, fn_len
,
15593 COUNT_BYTES_SUBR(fn_len
);
15595 /* skip to next structure */
15597 padcnt
= (old_offset
+ neo
) - offset
;
15600 * XXX - this is bogus; flag it?
15605 CHECK_BYTE_COUNT_SUBR(padcnt
);
15606 COUNT_BYTES_SUBR(padcnt
);
15610 proto_item_append_text(item
, " File: %s", format_text(pinfo
->pool
, (const unsigned char*)fn
, strlen(fn
)));
15611 proto_item_set_len(item
, offset
-old_offset
);
15617 /* 4.3.4.8 - SMB_FIND_FILE_UNIX */
15620 dissect_4_3_4_8(tvbuff_t
*tvb
, packet_info
*pinfo
,
15621 proto_tree
*tree
, int offset
, uint16_t *bcp
,
15622 bool *trunc
, smb_info_t
*si
)
15628 DISSECTOR_ASSERT(si
);
15630 /* NextEntryOffset */
15631 CHECK_BYTE_COUNT_SUBR(4);
15632 proto_tree_add_item(tree
, hf_smb_unix_find_file_nextoffset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15633 COUNT_BYTES_SUBR(4);
15636 CHECK_BYTE_COUNT_SUBR(4);
15637 proto_tree_add_item(tree
, hf_smb_unix_find_file_resumekey
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15638 COUNT_BYTES_SUBR(4);
15640 /* Unix basic info */
15641 offset
= dissect_4_2_16_12(tvb
, pinfo
, tree
, offset
, bcp
, trunc
);
15647 fn
= get_unicode_or_ascii_string(pinfo
->pool
,
15648 tvb
, &offset
, si
->unicode
, &fn_len
, false, false, bcp
);
15650 CHECK_STRING_SUBR(fn
);
15651 proto_tree_add_string(
15652 tree
, hf_smb_unix_file_name
, tvb
, offset
, fn_len
, fn
);
15653 COUNT_BYTES_SUBR(fn_len
);
15655 /* Pad to 4 bytes */
15658 pad
= 4 - (offset
% 4);
15659 COUNT_BYTES_SUBR(pad
);
15667 dissect_find_file_unix_info2(tvbuff_t
*tvb
, packet_info
*pinfo
,
15668 proto_tree
*tree
, int offset
, uint16_t *bcp
,
15669 bool *trunc
, smb_info_t
*si
)
15676 DISSECTOR_ASSERT(si
);
15678 /* NextEntryOffset */
15679 CHECK_BYTE_COUNT_SUBR(4);
15680 proto_tree_add_item(tree
, hf_smb_unix_find_file_nextoffset
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15681 COUNT_BYTES_SUBR(4);
15684 CHECK_BYTE_COUNT_SUBR(4);
15685 proto_tree_add_item(tree
, hf_smb_unix_find_file_resumekey
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15686 COUNT_BYTES_SUBR(4);
15689 offset
= dissect_qspi_unix_info2(tvb
, pinfo
, tree
, offset
, bcp
, trunc
);
15694 CHECK_BYTE_COUNT_SUBR(4);
15695 namelen
= tvb_get_letohl(tvb
, offset
);
15696 proto_tree_add_uint(tree
, hf_smb_unix_file_name_length
, tvb
, offset
, 4, namelen
);
15697 COUNT_BYTES_SUBR(4);
15702 * namelen could be > 2^31-1; this will catch that.
15703 * The length argument to get_unicode_or_ascii_string() is an
15704 * int, not an unsigned int, so we have to worry about that.
15706 tvb_ensure_bytes_exist(tvb
, offset
, namelen
);
15708 fn
= get_unicode_or_ascii_string(pinfo
->pool
,
15709 tvb
, &offset
, si
->unicode
, &fn_len
, true, true, bcp
);
15711 CHECK_STRING_SUBR(fn
);
15712 proto_tree_add_string(
15713 tree
, hf_smb_unix_file_name
, tvb
, offset
, fn_len
, fn
);
15714 COUNT_BYTES_SUBR(fn_len
);
15716 /* Pad to 4 bytes */
15719 pad
= 4 - (offset
% 4);
15720 CHECK_BYTE_COUNT_SUBR(pad
);
15721 COUNT_BYTES_SUBR(pad
);
15728 /*dissect the data block for TRANS2_FIND_FIRST2*/
15730 dissect_ff2_response_data(tvbuff_t
* tvb
, packet_info
* pinfo
,
15731 proto_tree
* tree
, int offset
, uint16_t *bcp
, bool *trunc
, smb_info_t
*si
)
15738 DISSECTOR_ASSERT(si
);
15740 switch(si
->info_level
) {
15741 case 1: /*Info Standard*/
15742 offset
= dissect_4_3_4_1(tvb
, pinfo
, tree
, offset
, bcp
,
15745 case 2: /*Info Query EA Size*/
15746 offset
= dissect_4_3_4_2(tvb
, pinfo
, tree
, offset
, bcp
,
15749 case 3: /* Info Query EAs From List same as
15751 * Not according to MS-CIFS 2.2.8.1.3. RJS
15753 offset
= dissect_4_3_4_3(tvb
, pinfo
, tree
, offset
, bcp
,
15756 case 0x0101: /*Find File Directory Info*/
15757 offset
= dissect_4_3_4_4(tvb
, pinfo
, tree
, offset
, bcp
,
15760 case 0x0102: /*Find File Full Directory Info*/
15761 offset
= dissect_4_3_4_5(tvb
, pinfo
, tree
, offset
, bcp
,
15764 case 0x0103: /*Find File Names Info*/
15765 offset
= dissect_4_3_4_7(tvb
, pinfo
, tree
, offset
, bcp
,
15768 case 0x0104: /*Find File Both Directory Info*/
15769 offset
= dissect_4_3_4_6(tvb
, pinfo
, tree
, offset
, bcp
,
15772 case 0x0105: /*Find File Full Directory Info*/
15773 offset
= dissect_4_3_4_6full(tvb
, pinfo
, tree
, offset
, bcp
,
15776 case 0x0106: /*Find File Id Both Directory Info*/
15777 offset
= dissect_4_3_4_6_id_both(tvb
, pinfo
, tree
, offset
, bcp
,
15780 case 0x0202: /*Find File Unix*/
15781 offset
= dissect_4_3_4_8(tvb
, pinfo
, tree
, offset
, bcp
,
15784 case 0x020B: /*Find File Unix Info2*/
15785 offset
= dissect_find_file_unix_info2(tvb
, pinfo
, tree
, offset
, bcp
,
15788 default: /* unknown info level */
15796 /* is this one just wrong and should be dissect_fs0105_attributes above ? */
15798 dissect_fs_attributes(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
15800 static int * const flags
[] = {
15801 /* case sensitive search */
15802 &hf_smb_fs_attr_css
,
15803 /* case preserved names */
15804 &hf_smb_fs_attr_cpn
,
15805 /* unicode on disk */
15806 &hf_smb_fs_attr_uod
,
15807 /* persistent acls */
15808 &hf_smb_fs_attr_pacls
,
15809 /* file compression */
15810 &hf_smb_fs_attr_fc
,
15811 /* volume quotas */
15812 &hf_smb_fs_attr_vq
,
15814 &hf_smb_fs_attr_ssf
,
15815 /* reparse points */
15816 &hf_smb_fs_attr_srp
,
15817 /* remote storage */
15818 &hf_smb_fs_attr_srs
,
15820 &hf_smb_fs_attr_sla
,
15821 /* volume is compressed */
15822 &hf_smb_fs_attr_vic
,
15824 &hf_smb_fs_attr_soids
,
15826 &hf_smb_fs_attr_se
,
15827 /* named streams */
15828 &hf_smb_fs_attr_ns
,
15829 /* read only volume */
15830 &hf_smb_fs_attr_rov
,
15831 /* sequential write once */
15832 &hf_smb_fs_attr_swo
,
15833 /* supports transactions */
15834 &hf_smb_fs_attr_st
,
15835 /* supports hard links */
15836 &hf_smb_fs_attr_shl
,
15837 /* supports integrity streams */
15838 &hf_smb_fs_attr_sis
,
15839 /* supports block refcounting */
15840 &hf_smb_fs_attr_sbr
,
15841 /* supports sparse vdl */
15842 &hf_smb_fs_attr_ssv
,
15846 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_fs_attr
, ett_smb_fs_attributes
, flags
, ENC_LITTLE_ENDIAN
);
15854 dissect_device_characteristics(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
15856 static int * const mask
[] = {
15857 &hf_smb_device_char_removable
,
15858 &hf_smb_device_char_read_only
,
15859 &hf_smb_device_char_floppy
,
15860 &hf_smb_device_char_write_once
,
15861 &hf_smb_device_char_remote
,
15862 &hf_smb_device_char_mounted
,
15863 &hf_smb_device_char_virtual
,
15864 &hf_smb_device_char_secure_open
,
15865 &hf_smb_device_char_ts
,
15866 &hf_smb_device_char_webdav
,
15867 &hf_smb_device_char_portable
,
15868 &hf_smb_device_char_aat
,
15872 proto_tree_add_bitmask_with_flags(parent_tree
, tvb
, offset
, hf_smb_device_char
,
15873 ett_smb_device_characteristics
, mask
, ENC_LITTLE_ENDIAN
, BMT_NO_APPEND
);
15879 /*dissect the data block for TRANS2_QUERY_FS_INFORMATION*/
15881 static const true_false_string tfs_smb_mac_access_ctrl
= {
15882 "Macintosh Access Control Supported",
15883 "Macintosh Access Control Not Supported"
15886 static const true_false_string tfs_smb_mac_getset_comments
= {
15887 "Macintosh Get & Set Comments Supported",
15888 "Macintosh Get & Set Comments Not Supported"
15891 static const true_false_string tfs_smb_mac_desktopdb_calls
= {
15892 "Macintosh Get & Set Desktop Database Info Supported",
15893 "Macintosh Get & Set Desktop Database Info Not Supported"
15896 static const true_false_string tfs_smb_mac_unique_ids
= {
15897 "Macintosh Unique IDs Supported",
15898 "Macintosh Unique IDs Not Supported"
15901 static const true_false_string tfs_smb_mac_streams
= {
15902 "Macintosh and Streams Extensions Not Supported",
15903 "Macintosh and Streams Extensions Supported"
15907 dissect_qfsi_FS_VOLUME_INFO(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, int offset
, uint16_t *bcp
, int unicode
)
15913 CHECK_BYTE_COUNT_TRANS_SUBR(8);
15914 dissect_nttime(tvb
, tree
, offset
,
15915 hf_smb_create_time
, ENC_LITTLE_ENDIAN
);
15916 COUNT_BYTES_TRANS_SUBR(8);
15918 /* volume serial number */
15919 CHECK_BYTE_COUNT_TRANS_SUBR(4);
15920 proto_tree_add_item(tree
, hf_smb_volume_serial_num
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15921 COUNT_BYTES_TRANS_SUBR(4);
15923 /* volume label length */
15924 CHECK_BYTE_COUNT_TRANS_SUBR(4);
15925 vll
= tvb_get_letohl(tvb
, offset
);
15926 proto_tree_add_uint(tree
, hf_smb_volume_label_len
, tvb
, offset
, 4, vll
);
15927 COUNT_BYTES_TRANS_SUBR(4);
15929 /* 2 reserved bytes */
15930 CHECK_BYTE_COUNT_TRANS_SUBR(2);
15931 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
15932 COUNT_BYTES_TRANS_SUBR(2);
15936 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, unicode
, &fn_len
, false, true, bcp
);
15937 CHECK_STRING_TRANS_SUBR(fn
);
15938 proto_tree_add_string(tree
, hf_smb_volume_label
, tvb
, offset
, fn_len
,
15940 COUNT_BYTES_TRANS_SUBR(fn_len
);
15946 dissect_qfsi_FS_SIZE_INFO(tvbuff_t
* tvb
, packet_info
* pinfo _U_
, proto_tree
* tree
, int offset
, uint16_t *bcp
)
15948 /* allocation size */
15949 CHECK_BYTE_COUNT_TRANS_SUBR(8);
15950 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
15951 COUNT_BYTES_TRANS_SUBR(8);
15953 /* free allocation units */
15954 CHECK_BYTE_COUNT_TRANS_SUBR(8);
15955 proto_tree_add_item(tree
, hf_smb_free_alloc_units64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
15956 COUNT_BYTES_TRANS_SUBR(8);
15958 /* sectors per unit */
15959 CHECK_BYTE_COUNT_TRANS_SUBR(4);
15960 proto_tree_add_item(tree
, hf_smb_sector_unit
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15961 COUNT_BYTES_TRANS_SUBR(4);
15963 /* bytes per sector */
15964 CHECK_BYTE_COUNT_TRANS_SUBR(4);
15965 proto_tree_add_item(tree
, hf_smb_fs_sector
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15966 COUNT_BYTES_TRANS_SUBR(4);
15972 dissect_qfsi_FS_DEVICE_INFO(tvbuff_t
* tvb
, packet_info
* pinfo _U_
, proto_tree
* tree
, int offset
, uint16_t *bcp
)
15975 CHECK_BYTE_COUNT_TRANS_SUBR(4);
15976 proto_tree_add_item(tree
, hf_smb_device_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
15977 COUNT_BYTES_TRANS_SUBR(4);
15979 /* device characteristics */
15980 CHECK_BYTE_COUNT_TRANS_SUBR(4);
15981 offset
= dissect_device_characteristics(tvb
, tree
, offset
);
15988 dissect_qfsi_FS_ATTRIBUTE_INFO(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, int offset
, uint16_t *bcp
)
15993 /* FS attributes */
15994 CHECK_BYTE_COUNT_TRANS_SUBR(4);
15995 offset
= dissect_fs_attributes(tvb
, tree
, offset
);
15999 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16000 proto_tree_add_item(tree
, hf_smb_max_name_len
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16001 COUNT_BYTES_TRANS_SUBR(4);
16003 /* fs name length */
16004 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16005 fnl
= tvb_get_letohl(tvb
, offset
);
16006 proto_tree_add_uint(tree
, hf_smb_fs_name_len
, tvb
, offset
, 4, fnl
);
16007 COUNT_BYTES_TRANS_SUBR(4);
16011 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, true, &fn_len
, false, true, bcp
);
16012 CHECK_STRING_TRANS_SUBR(fn
);
16013 proto_tree_add_string(tree
, hf_smb_fs_name
, tvb
, offset
, fn_len
,
16015 COUNT_BYTES_TRANS_SUBR(fn_len
);
16021 dissect_qfsi_FS_OBJECTID_INFO(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, int offset
, uint16_t *bcp
)
16023 CHECK_BYTE_COUNT_TRANS_SUBR(64);
16025 dissect_smb2_FILE_OBJECTID_BUFFER(tvb
, pinfo
, tree
, offset
);
16027 COUNT_BYTES_TRANS_SUBR(64);
16033 dissect_qfsi_FS_FULL_SIZE_INFO(tvbuff_t
* tvb
, packet_info
* pinfo _U_
, proto_tree
* tree
, int offset
, uint16_t *bcp
)
16035 /* allocation size */
16036 CHECK_BYTE_COUNT_TRANS_SUBR(8);
16037 proto_tree_add_item(tree
, hf_smb_alloc_size64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
16038 COUNT_BYTES_TRANS_SUBR(8);
16040 /* caller free allocation units */
16041 CHECK_BYTE_COUNT_TRANS_SUBR(8);
16042 proto_tree_add_item(tree
, hf_smb_caller_free_alloc_units64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
16043 COUNT_BYTES_TRANS_SUBR(8);
16045 /* actual free allocation units */
16046 CHECK_BYTE_COUNT_TRANS_SUBR(8);
16047 proto_tree_add_item(tree
, hf_smb_actual_free_alloc_units64
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
16048 COUNT_BYTES_TRANS_SUBR(8);
16050 /* sectors per unit */
16051 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16052 proto_tree_add_item(tree
, hf_smb_sector_unit
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16053 COUNT_BYTES_TRANS_SUBR(4);
16055 /* bytes per sector */
16056 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16057 proto_tree_add_item(tree
, hf_smb_fs_sector
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16058 COUNT_BYTES_TRANS_SUBR(4);
16064 dissect_qfsi_vals(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
,
16065 int offset
, uint16_t *bcp
, smb_info_t
*si
)
16074 DISSECTOR_ASSERT(si
);
16076 switch(si
->info_level
) {
16077 case 1: /* SMB_INFO_ALLOCATION */
16078 /* filesystem id */
16079 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16080 proto_tree_add_item(tree
, hf_smb_fs_id
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16081 COUNT_BYTES_TRANS_SUBR(4);
16083 /* sectors per unit */
16084 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16085 proto_tree_add_item(tree
, hf_smb_sector_unit
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16086 COUNT_BYTES_TRANS_SUBR(4);
16089 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16090 proto_tree_add_item(tree
, hf_smb_fs_units
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16091 COUNT_BYTES_TRANS_SUBR(4);
16094 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16095 proto_tree_add_item(tree
, hf_smb_avail_units
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16096 COUNT_BYTES_TRANS_SUBR(4);
16098 /* bytes per sector, only 16bit integer here */
16099 CHECK_BYTE_COUNT_TRANS_SUBR(2);
16100 proto_tree_add_item(tree
, hf_smb_fs_sector
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16101 COUNT_BYTES_TRANS_SUBR(2);
16104 case 2: /* SMB_INFO_VOLUME */
16105 /* volume serial number */
16106 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16107 proto_tree_add_item(tree
, hf_smb_volume_serial_num
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16108 COUNT_BYTES_TRANS_SUBR(4);
16110 /* volume label length, only one byte here */
16111 CHECK_BYTE_COUNT_TRANS_SUBR(1);
16112 proto_tree_add_item_ret_uint(tree
, hf_smb_volume_label_len
, tvb
, offset
, 1, ENC_NA
, &fn_len
);
16113 COUNT_BYTES_TRANS_SUBR(1);
16115 /* label - not aligned! */
16116 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, true, true, bcp
);
16117 CHECK_STRING_TRANS_SUBR(fn
);
16118 proto_tree_add_string(tree
, hf_smb_volume_label
, tvb
, offset
, fn_len
, fn
);
16119 COUNT_BYTES_TRANS_SUBR(fn_len
);
16122 case 0x0101: /* SMB_QUERY_FS_LABEL_INFO */
16123 case 1002: /* SMB_FS_LABEL_INFORMATION */
16124 /* volume label length */
16125 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16126 vll
= tvb_get_letohl(tvb
, offset
);
16127 proto_tree_add_uint(tree
, hf_smb_volume_label_len
, tvb
, offset
, 4, vll
);
16128 COUNT_BYTES_TRANS_SUBR(4);
16132 fn
= get_unicode_or_ascii_string(pinfo
->pool
, tvb
, &offset
, si
->unicode
, &fn_len
, false, true, bcp
);
16133 CHECK_STRING_TRANS_SUBR(fn
);
16134 proto_tree_add_string(tree
, hf_smb_volume_label
, tvb
, offset
, fn_len
, fn
);
16135 COUNT_BYTES_TRANS_SUBR(fn_len
);
16138 case 0x0102: /* SMB_QUERY_FS_VOLUME_INFO */
16139 case 1001: /* SMB_FS_VOLUME_INFORMATION */
16140 offset
= dissect_qfsi_FS_VOLUME_INFO(tvb
, pinfo
, tree
, offset
, bcp
, si
->unicode
);
16142 case 0x0103: /* SMB_QUERY_FS_SIZE_INFO */
16143 case 1003: /* SMB_FS_SIZE_INFORMATION */
16144 offset
= dissect_qfsi_FS_SIZE_INFO(tvb
, pinfo
, tree
, offset
, bcp
);
16146 case 0x0104: /* SMB_QUERY_FS_DEVICE_INFO */
16147 case 1004: /* SMB_FS_DEVICE_INFORMATION */
16148 offset
= dissect_qfsi_FS_DEVICE_INFO(tvb
, pinfo
, tree
, offset
, bcp
);
16150 case 0x0105: /* SMB_QUERY_FS_ATTRIBUTE_INFO */
16151 case 1005: /* SMB_FS_ATTRIBUTE_INFORMATION */
16152 offset
= dissect_qfsi_FS_ATTRIBUTE_INFO(tvb
, pinfo
, tree
, offset
, bcp
);
16154 case 0x200: { /* SMB_QUERY_CIFS_UNIX_INFO */
16155 proto_item
*item_2
= NULL
;
16156 proto_tree
*subtree
= NULL
;
16158 /* MajorVersionNumber */
16159 CHECK_BYTE_COUNT_TRANS_SUBR(2);
16160 proto_tree_add_item(tree
, hf_smb_unix_major_version
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16161 COUNT_BYTES_TRANS_SUBR(2);
16163 /* MinorVersionNumber */
16164 CHECK_BYTE_COUNT_TRANS_SUBR(2);
16165 proto_tree_add_item(tree
, hf_smb_unix_minor_version
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16166 COUNT_BYTES_TRANS_SUBR(2);
16170 CHECK_BYTE_COUNT_TRANS_SUBR(8);
16173 item_2
= proto_tree_add_item(tree
, hf_smb_unix_capability
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
16174 subtree
= proto_item_add_subtree(
16175 item_2
, ett_smb_unix_capabilities
);
16178 proto_tree_add_item(
16179 subtree
, hf_smb_unix_capability_fcntl
, tvb
, offset
, 4,
16180 ENC_LITTLE_ENDIAN
);
16182 proto_tree_add_item(
16183 subtree
, hf_smb_unix_capability_posix_acl
, tvb
, offset
, 4,
16184 ENC_LITTLE_ENDIAN
);
16186 proto_tree_add_item(
16187 subtree
, hf_smb_unix_capability_xattr
, tvb
, offset
, 4,
16188 ENC_LITTLE_ENDIAN
);
16190 proto_tree_add_item(
16191 subtree
, hf_smb_unix_capability_attr
, tvb
, offset
, 4,
16192 ENC_LITTLE_ENDIAN
);
16194 proto_tree_add_item(
16195 subtree
, hf_smb_unix_capability_posix_paths
, tvb
, offset
, 4,
16196 ENC_LITTLE_ENDIAN
);
16198 proto_tree_add_item(
16199 subtree
, hf_smb_unix_capability_posix_path_ops
, tvb
, offset
, 4,
16200 ENC_LITTLE_ENDIAN
);
16202 proto_tree_add_item(
16203 subtree
, hf_smb_unix_capability_large_read
, tvb
, offset
, 4,
16204 ENC_LITTLE_ENDIAN
);
16206 proto_tree_add_item(
16207 subtree
, hf_smb_unix_capability_large_write
, tvb
, offset
, 4,
16208 ENC_LITTLE_ENDIAN
);
16210 proto_tree_add_item(
16211 subtree
, hf_smb_unix_capability_encryption
, tvb
, offset
, 4,
16212 ENC_LITTLE_ENDIAN
);
16214 proto_tree_add_item(
16215 subtree
, hf_smb_unix_capability_mandatory_crypto
, tvb
, offset
, 4,
16216 ENC_LITTLE_ENDIAN
);
16218 proto_tree_add_item(
16219 subtree
, hf_smb_unix_capability_proxy
, tvb
, offset
, 4,
16220 ENC_LITTLE_ENDIAN
);
16222 COUNT_BYTES_TRANS_SUBR(8);
16227 case 0x202: { /* SMB_QUERY_POSIX_WHOAMI */
16228 proto_tree
*st_gids
;
16231 proto_tree
*st_sids
;
16232 int old_sid_offset
;
16234 uint32_t sids_buflen
;
16236 /* Mapping flags */
16237 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16238 proto_tree_add_item(tree
, hf_smb_unix_whoami_mapflags
,
16239 tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16240 COUNT_BYTES_TRANS_SUBR(4);
16242 /* Mapping flags mask */
16243 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16244 proto_tree_add_item(tree
, hf_smb_unix_whoami_mapflags_mask
,
16245 tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16246 COUNT_BYTES_TRANS_SUBR(4);
16249 CHECK_BYTE_COUNT_TRANS_SUBR(8);
16250 proto_tree_add_item(tree
, hf_smb_unix_file_uid
,
16251 tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
16252 COUNT_BYTES_TRANS_SUBR(8);
16255 CHECK_BYTE_COUNT_TRANS_SUBR(8);
16256 proto_tree_add_item(tree
, hf_smb_unix_file_gid
,
16257 tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
16258 COUNT_BYTES_TRANS_SUBR(8);
16260 /* number of supplementary GIDs */
16261 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16262 num_gids
= tvb_get_letohl(tvb
, offset
);
16263 proto_tree_add_item(tree
, hf_smb_unix_whoami_num_supl_gids
,
16264 tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16265 COUNT_BYTES_TRANS_SUBR(4);
16267 /* number of supplementary SIDs */
16268 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16269 num_sids
= tvb_get_letohl(tvb
, offset
);
16270 proto_tree_add_item(tree
, hf_smb_unix_whoami_num_supl_sids
,
16271 tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16272 COUNT_BYTES_TRANS_SUBR(4);
16274 /* supplementary SIDs buffer length */
16275 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16276 sids_buflen
= tvb_get_letohl(tvb
, offset
);
16277 proto_tree_add_item(tree
, hf_smb_unix_whoami_sids_buflen
,
16278 tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16279 COUNT_BYTES_TRANS_SUBR(4);
16281 /* pad / reserved (must be zero) */
16282 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16283 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 4, ENC_NA
);
16284 COUNT_BYTES_TRANS_SUBR(4);
16288 st_gids
= proto_tree_add_subtree(tree
, tvb
, offset
, num_gids
* 8,
16289 ett_smb_unix_whoami_gids
, NULL
, "Supplementary UNIX GIDs");
16291 for (i
= 0; i
< num_gids
; i
++) {
16292 CHECK_BYTE_COUNT_TRANS_SUBR(8);
16293 proto_tree_add_item(st_gids
, hf_smb_unix_file_gid
,
16294 tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
16295 COUNT_BYTES_TRANS_SUBR(8);
16299 st_sids
= proto_tree_add_subtree(tree
, tvb
, offset
, sids_buflen
,
16300 ett_smb_unix_whoami_sids
, NULL
, "List of SIDs");
16302 for (i
= 0; i
< num_sids
; i
++) {
16303 old_sid_offset
= offset
;
16304 offset
= dissect_nt_sid(tvb
, offset
, st_sids
, "SID", NULL
, -1);
16305 CHECK_BYTE_COUNT_TRANS_SUBR(offset
-old_sid_offset
);
16306 *bcp
-= (offset
- old_sid_offset
);
16312 case 0x301: { /* MAC_QUERY_FS_INFO */
16313 static int * const support_flags
[] = {
16314 &hf_smb_mac_sup_access_ctrl
,
16315 &hf_smb_mac_sup_getset_comments
,
16316 &hf_smb_mac_sup_desktopdb_calls
,
16317 &hf_smb_mac_sup_unique_ids
,
16318 &hf_smb_mac_sup_streams
,
16323 CHECK_BYTE_COUNT_TRANS_SUBR(8);
16324 dissect_nttime(tvb
, tree
, offset
, hf_smb_create_time
, ENC_LITTLE_ENDIAN
);
16325 COUNT_BYTES_TRANS_SUBR(8);
16327 CHECK_BYTE_COUNT_TRANS_SUBR(8);
16328 dissect_nttime(tvb
, tree
, offset
, hf_smb_modify_time
, ENC_LITTLE_ENDIAN
);
16329 COUNT_BYTES_TRANS_SUBR(8);
16331 CHECK_BYTE_COUNT_TRANS_SUBR(8);
16332 dissect_nttime(tvb
, tree
, offset
, hf_smb_backup_time
, ENC_LITTLE_ENDIAN
);
16333 CHECK_BYTE_COUNT_TRANS_SUBR(8);
16334 /* Allocation blocks */
16335 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16336 proto_tree_add_item(tree
, hf_smb_mac_alloc_block_count
, tvb
,
16338 4, ENC_LITTLE_ENDIAN
);
16339 COUNT_BYTES_TRANS_SUBR(4);
16340 /* Allocation Block Size */
16341 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16342 proto_tree_add_item(tree
, hf_smb_mac_alloc_block_size
, tvb
,
16343 offset
, 4, ENC_LITTLE_ENDIAN
);
16344 COUNT_BYTES_TRANS_SUBR(4);
16345 /* Free Block Count */
16346 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16347 proto_tree_add_item(tree
, hf_smb_mac_free_block_count
, tvb
,
16348 offset
, 4, ENC_LITTLE_ENDIAN
);
16349 COUNT_BYTES_TRANS_SUBR(4);
16350 /* Finder Info ... */
16351 CHECK_BYTE_COUNT_TRANS_SUBR(32);
16352 proto_tree_add_bytes_format_value(tree
, hf_smb_mac_fndrinfo
, tvb
,
16355 tvb_format_text(pinfo
->pool
, tvb
, offset
, 32));
16356 COUNT_BYTES_TRANS_SUBR(32);
16358 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16359 proto_tree_add_item(tree
, hf_smb_mac_root_file_count
, tvb
,
16360 offset
, 4, ENC_LITTLE_ENDIAN
);
16361 COUNT_BYTES_TRANS_SUBR(4);
16362 /* Number of Root Directories */
16363 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16364 proto_tree_add_item(tree
, hf_smb_mac_root_dir_count
, tvb
,
16365 offset
, 4, ENC_LITTLE_ENDIAN
);
16366 COUNT_BYTES_TRANS_SUBR(4);
16367 /* Number of files */
16368 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16369 proto_tree_add_item(tree
, hf_smb_mac_file_count
, tvb
,
16370 offset
, 4, ENC_LITTLE_ENDIAN
);
16371 COUNT_BYTES_TRANS_SUBR(4);
16373 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16374 proto_tree_add_item(tree
, hf_smb_mac_dir_count
, tvb
,
16375 offset
, 4, ENC_LITTLE_ENDIAN
);
16376 COUNT_BYTES_TRANS_SUBR(4);
16377 /* Mac Support Flags */
16378 CHECK_BYTE_COUNT_TRANS_SUBR(4);
16379 proto_tree_add_bitmask(tree
, tvb
, offset
, hf_smb_mac_sup
, ett_smb_mac_support_flags
, support_flags
, ENC_LITTLE_ENDIAN
);
16380 COUNT_BYTES_TRANS_SUBR(4);
16383 case 1006: /* QUERY_FS_QUOTA_INFO */
16384 offset
= dissect_nt_quota(tvb
, tree
, offset
, bcp
);
16386 case 1007: /* SMB_FS_FULL_SIZE_INFORMATION */
16387 offset
= dissect_qfsi_FS_FULL_SIZE_INFO(tvb
, pinfo
, tree
, offset
, bcp
);
16389 case 1008: /* Query Object ID */ {
16390 offset
= dissect_qfsi_FS_OBJECTID_INFO(tvb
, pinfo
, tree
, offset
, bcp
);
16399 dissect_transaction2_response_data(tvbuff_t
*tvb
, packet_info
*pinfo
,
16400 proto_tree
*parent_tree
, smb_info_t
*si
)
16402 proto_item
*item
= NULL
;
16403 proto_tree
*tree
= NULL
;
16404 smb_transact2_info_t
*t2i
;
16406 bool trunc
= false;
16410 dc
= tvb_reported_length(tvb
);
16412 DISSECTOR_ASSERT(si
);
16414 if ((si
->sip
!= NULL
) && (si
->sip
->extra_info_type
== SMB_EI_T2I
))
16415 t2i
= (smb_transact2_info_t
*)si
->sip
->extra_info
;
16420 if ((t2i
!= NULL
) && (t2i
->subcmd
!= -1)) {
16421 tree
= proto_tree_add_subtree_format(parent_tree
, tvb
, offset
, dc
,
16422 ett_smb_transaction_data
, &item
, "%s Data",
16423 val_to_str_ext(t2i
->subcmd
, &trans2_cmd_vals_ext
,
16424 "Unknown (0x%02x)"));
16426 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, dc
,
16427 ett_smb_transaction_data
, &item
, "Unknown Transaction2 Data");
16435 switch(t2i
->subcmd
) {
16436 case 0x0000: /*TRANS2_OPEN2*/
16437 /* XXX not implemented yet. See SNIA doc */
16439 case 0x0001: /*TRANS2_FIND_FIRST2*/
16440 /* returned data */
16441 count
= si
->info_count
;
16446 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
16447 ", Files found: %u", count
);
16450 offset
= dissect_ff2_response_data(tvb
, pinfo
, tree
,
16451 offset
, &dc
, &trunc
, si
);
16456 col_append_str(pinfo
->cinfo
, COL_INFO
,
16457 ", No files found");
16460 case 0x0002: /*TRANS2_FIND_NEXT2*/
16461 /* returned data */
16462 count
= si
->info_count
;
16468 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
16469 ", Files found: %u", count
);
16471 offset
= dissect_ff2_response_data(tvb
, pinfo
, tree
,
16472 offset
, &dc
, &trunc
, si
);
16477 col_append_str(pinfo
->cinfo
, COL_INFO
,
16478 ", No files found");
16481 case 0x0003: /*TRANS2_QUERY_FS_INFORMATION*/
16482 offset
= dissect_qfsi_vals(tvb
, pinfo
, tree
, offset
, &dc
, si
);
16484 case 0x0004: /*TRANS2_SET_FS_INFORMATION*/
16485 offset
= dissect_sfsi_response(tvb
, pinfo
, tree
, offset
, &dc
, si
);
16487 case 0x0005: /*TRANS2_QUERY_PATH_INFORMATION*/
16488 offset
= dissect_qpi_loi_vals(tvb
, pinfo
, tree
, item
, offset
, &dc
, si
);
16490 case 0x0006: /*TRANS2_SET_PATH_INFORMATION*/
16491 /* no data in this response */
16493 case 0x0007: /*TRANS2_QUERY_FILE_INFORMATION*/
16494 /* identical to QUERY_PATH_INFO */
16495 offset
= dissect_qpi_loi_vals(tvb
, pinfo
, tree
, item
, offset
, &dc
, si
);
16497 case 0x0008: /*TRANS2_SET_FILE_INFORMATION*/
16498 /* no data in this response */
16500 case 0x0009: /*TRANS2_FSCTL*/
16501 /* XXX don't know how to dissect this one (yet)*/
16504 * XXX - "Microsoft Networks SMB File Sharing Protocol
16505 * Extensions Version 3.0, Document Version 1.11,
16506 * July 19, 1990" says this contains a
16507 * "File system specific return data block".
16508 * (That means we may not be able to dissect it in any
16512 case 0x000a: /*TRANS2_IOCTL2*/
16513 /* XXX don't know how to dissect this one (yet)*/
16516 * XXX - "Microsoft Networks SMB File Sharing Protocol
16517 * Extensions Version 3.0, Document Version 1.11,
16518 * July 19, 1990" says this contains a
16519 * "Device/function specific return data block".
16520 * (That means we may not be able to dissect it in any
16524 case 0x000b: /*TRANS2_FIND_NOTIFY_FIRST*/
16525 /* XXX don't know how to dissect this one (yet)*/
16528 * XXX - "Microsoft Networks SMB File Sharing Protocol
16529 * Extensions Version 3.0, Document Version 1.11,
16530 * July 19, 1990" says this contains "the level
16531 * dependent information about the changes which
16535 case 0x000c: /*TRANS2_FIND_NOTIFY_NEXT*/
16536 /* XXX don't know how to dissect this one (yet)*/
16539 * XXX - "Microsoft Networks SMB File Sharing Protocol
16540 * Extensions Version 3.0, Document Version 1.11,
16541 * July 19, 1990" says this contains "the level
16542 * dependent information about the changes which
16546 case 0x000d: /*TRANS2_CREATE_DIRECTORY*/
16547 /* no data in this response */
16549 case 0x000e: /*TRANS2_SESSION_SETUP*/
16550 /* XXX don't know how to dissect this one (yet)*/
16552 case 0x0010: /*TRANS2_GET_DFS_REFERRAL*/
16553 offset
= dissect_get_dfs_referral_data(tvb
, pinfo
, tree
, offset
, &dc
, si
->unicode
);
16555 case 0x0011: /*TRANS2_REPORT_DFS_INCONSISTENCY*/
16556 /* the SNIA spec appears to say the response has no data */
16560 * We don't know what the matching request was; don't
16561 * bother putting anything else into the tree for the data.
16568 /* ooops there were data we didn't know how to process */
16570 proto_tree_add_item(tree
, hf_smb_unknown
, tvb
, offset
, dc
, ENC_NA
);
16579 dissect_transaction2_response_parameters(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
, smb_info_t
*si
)
16581 proto_item
*item
= NULL
;
16582 proto_tree
*tree
= NULL
;
16583 smb_transact2_info_t
*t2i
;
16588 uint32_t search_id
;
16590 pc
= tvb_reported_length(tvb
);
16592 DISSECTOR_ASSERT(si
);
16594 if ((si
->sip
!= NULL
) && (si
->sip
->extra_info_type
== SMB_EI_T2I
))
16595 t2i
= (smb_transact2_info_t
*)si
->sip
->extra_info
;
16600 if ((t2i
!= NULL
) && (t2i
->subcmd
!= -1)) {
16601 tree
= proto_tree_add_subtree_format(parent_tree
, tvb
, offset
, pc
,
16602 ett_smb_transaction_params
, &item
, "%s Parameters",
16603 val_to_str_ext(t2i
->subcmd
, &trans2_cmd_vals_ext
,
16604 "Unknown (0x%02x)"));
16606 tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, pc
,
16607 ett_smb_transaction_params
, &item
, "Unknown Transaction2 Parameters");
16615 switch(t2i
->subcmd
) {
16616 case 0x00: /*TRANS2_OPEN2*/
16618 fid
= tvb_get_letohs(tvb
, offset
);
16619 dissect_smb_fid(tvb
, pinfo
, tree
, offset
, 2, fid
, true, false, false, si
);
16623 * XXX - Microsoft Networks SMB File Sharing Protocol
16624 * Extensions Version 3.0, Document Version 1.11,
16625 * July 19, 1990 says that the file attributes, create
16626 * time (which it says is the last modification time),
16627 * data size, granted access, file type, and IPC state
16628 * are returned only if bit 0 is set in the open flags,
16629 * and that the EA length is returned only if bit 3
16630 * is set in the open flags. Does that mean that,
16631 * at least in that SMB dialect, those fields are not
16632 * present in the reply parameters if the bits in
16633 * question aren't set?
16636 /* File Attributes */
16637 offset
= dissect_file_attributes(tvb
, tree
, offset
);
16640 offset
= dissect_smb_datetime(tvb
, tree
, offset
,
16641 hf_smb_create_time
,
16642 hf_smb_create_dos_date
, hf_smb_create_dos_time
, true);
16645 proto_tree_add_item(tree
, hf_smb_data_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16648 /* granted access */
16649 offset
= dissect_access(tvb
, tree
, offset
, hf_smb_granted_access
);
16652 proto_tree_add_item(tree
, hf_smb_file_type
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16656 offset
= dissect_ipc_state(tvb
, tree
, offset
, false);
16659 offset
= dissect_open_action(tvb
, tree
, offset
);
16661 /* server unique file ID */
16662 proto_tree_add_item(tree
, hf_smb_file_id
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16665 /* ea error offset, only a 16 bit integer here */
16666 proto_tree_add_item(tree
, hf_smb_ea_error_offset
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16670 proto_tree_add_item(tree
, hf_smb_ea_list_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
16674 case 0x01: /*TRANS2_FIND_FIRST2*/
16675 /* Find First2 information level */
16676 proto_tree_add_uint(tree
, hf_smb_ff2_information_level
, tvb
, 0, 0, si
->info_level
);
16680 proto_tree_add_item_ret_uint(tree
, hf_smb_search_id
, tvb
, offset
, 2,
16681 ENC_LITTLE_ENDIAN
, &search_id
);
16684 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Search ID: %u", (uint16_t)search_id
);
16687 si
->info_count
= tvb_get_letohs(tvb
, offset
);
16688 proto_tree_add_uint(tree
, hf_smb_search_count_found
, tvb
, offset
, 2, si
->info_count
);
16691 /* end of search */
16692 proto_tree_add_item(tree
, hf_smb_end_of_search
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16695 /* ea error offset, only a 16 bit integer here */
16696 proto_tree_add_item(tree
, hf_smb_ea_error_offset
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16699 /* last name offset */
16700 lno
= tvb_get_letohs(tvb
, offset
);
16701 proto_tree_add_uint(tree
, hf_smb_last_name_offset
, tvb
, offset
, 2, lno
);
16705 case 0x02: /*TRANS2_FIND_NEXT2*/
16707 si
->info_count
= tvb_get_letohs(tvb
, offset
);
16708 proto_tree_add_uint(tree
, hf_smb_search_count_found
, tvb
, offset
, 2, si
->info_count
);
16711 /* end of search */
16712 proto_tree_add_item(tree
, hf_smb_end_of_search
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16715 /* ea_error_offset, only a 16 bit integer here*/
16716 proto_tree_add_item(tree
, hf_smb_ea_error_offset
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16719 /* last name offset */
16720 lno
= tvb_get_letohs(tvb
, offset
);
16721 proto_tree_add_uint(tree
, hf_smb_last_name_offset
, tvb
, offset
, 2, lno
);
16725 case 0x03: /*TRANS2_QUERY_FS_INFORMATION*/
16726 /* no parameter block here */
16728 case 0x05: /*TRANS2_QUERY_PATH_INFORMATION*/
16729 /* ea_error_offset, only a 16 bit integer here*/
16730 proto_tree_add_item(tree
, hf_smb_ea_error_offset
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16734 case 0x06: /*TRANS2_SET_PATH_INFORMATION*/
16735 /* ea_error_offset, only a 16 bit integer here*/
16736 proto_tree_add_item(tree
, hf_smb_ea_error_offset
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16740 case 0x07: /*TRANS2_QUERY_FILE_INFORMATION*/
16741 /* ea_error_offset, only a 16 bit integer here*/
16742 proto_tree_add_item(tree
, hf_smb_ea_error_offset
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16746 case 0x08: /*TRANS2_SET_FILE_INFORMATION*/
16747 /* ea_error_offset, only a 16 bit integer here*/
16748 proto_tree_add_item(tree
, hf_smb_ea_error_offset
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16752 case 0x09: /*TRANS2_FSCTL*/
16753 /* XXX don't know how to dissect this one (yet)*/
16756 * XXX - "Microsoft Networks SMB File Sharing Protocol
16757 * Extensions Version 3.0, Document Version 1.11,
16758 * July 19, 1990" says this contains a
16759 * "File system specific return parameter block".
16760 * (That means we may not be able to dissect it in any
16764 case 0x0a: /*TRANS2_IOCTL2*/
16765 /* XXX don't know how to dissect this one (yet)*/
16768 * XXX - "Microsoft Networks SMB File Sharing Protocol
16769 * Extensions Version 3.0, Document Version 1.11,
16770 * July 19, 1990" says this contains a
16771 * "Device/function specific return parameter block".
16772 * (That means we may not be able to dissect it in any
16776 case 0x0b: /*TRANS2_FIND_NOTIFY_FIRST*/
16777 /* Find Notify information level */
16778 proto_tree_add_uint(tree
, hf_smb_fn_information_level
, tvb
, 0, 0, si
->info_level
);
16780 /* Monitor handle */
16781 proto_tree_add_item(tree
, hf_smb_monitor_handle
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16785 si
->info_count
= tvb_get_letohs(tvb
, offset
);
16786 proto_tree_add_uint(tree
, hf_smb_change_count
, tvb
, offset
, 2, si
->info_count
);
16789 /* ea_error_offset, only a 16 bit integer here*/
16790 proto_tree_add_item(tree
, hf_smb_ea_error_offset
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16794 case 0x0c: /*TRANS2_FIND_NOTIFY_NEXT*/
16795 /* Find Notify information level */
16796 proto_tree_add_uint(tree
, hf_smb_fn_information_level
, tvb
, 0, 0, si
->info_level
);
16799 si
->info_count
= tvb_get_letohs(tvb
, offset
);
16800 proto_tree_add_uint(tree
, hf_smb_change_count
, tvb
, offset
, 2, si
->info_count
);
16803 /* ea_error_offset, only a 16 bit integer here*/
16804 proto_tree_add_item(tree
, hf_smb_ea_error_offset
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16808 case 0x0d: /*TRANS2_CREATE_DIRECTORY*/
16809 /* ea error offset, only a 16 bit integer here */
16810 proto_tree_add_item(tree
, hf_smb_ea_error_offset
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
16814 case 0x0e: /*TRANS2_SESSION_SETUP*/
16815 /* XXX don't know how to dissect this one (yet)*/
16817 case 0x10: /*TRANS2_GET_DFS_REFERRAL*/
16818 /* XXX don't know how to dissect this one (yet) see SNIA doc*/
16820 case 0x11: /*TRANS2_REPORT_DFS_INCONSISTENCY*/
16821 /* XXX don't know how to dissect this one (yet) see SNIA doc*/
16825 * We don't know what the matching request was; don't
16826 * bother putting anything else into the tree for the data.
16832 /* ooops there were data we didn't know how to process */
16834 proto_tree_add_item(tree
, hf_smb_unknown
, tvb
, offset
, pc
-offset
, ENC_NA
);
16835 offset
+= pc
-offset
;
16842 dissect_transaction_response(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si
)
16845 uint16_t od
= 0, po
= 0, pc
= 0, pd
= 0, dc
= 0, dd
= 0, td
= 0, tp
= 0;
16846 smb_transact2_info_t
*t2i
= NULL
;
16847 uint32_t pid_mid
= 0;
16850 bool dissected_trans
;
16851 fragment_head
*r_fd
= NULL
;
16852 tvbuff_t
*pd_tvb
= NULL
, *d_tvb
= NULL
, *p_tvb
= NULL
;
16853 tvbuff_t
*s_tvb
= NULL
, *sp_tvb
= NULL
;
16854 bool save_fragmented
;
16857 DISSECTOR_ASSERT(si
);
16860 case SMB_COM_TRANSACTION2
:
16862 if ((si
->sip
!= NULL
) && (si
->sip
->extra_info_type
== SMB_EI_T2I
)) {
16863 t2i
= (smb_transact2_info_t
*)si
->sip
->extra_info
;
16868 * We didn't see the matching request, so we don't
16869 * know what type of transaction this is.
16871 proto_tree_add_uint_format_value(tree
, hf_smb_trans2_subcmd
, tvb
, 0, 0, -1,
16872 "<UNKNOWN> since request packet wasn't seen");
16873 col_append_str(pinfo
->cinfo
, COL_INFO
, "<unknown>");
16875 si
->info_level
= t2i
->info_level
;
16876 if (t2i
->subcmd
== -1) {
16878 * We didn't manage to extract the subcommand
16879 * from the matching request (perhaps because
16880 * the frame was short), so we don't know what
16881 * type of transaction this is.
16883 proto_tree_add_uint_format_value(tree
, hf_smb_trans2_subcmd
, tvb
, 0, 0, t2i
->subcmd
,
16884 "<UNKNOWN> since transaction code wasn't found in request packet");
16885 col_append_str(pinfo
->cinfo
, COL_INFO
, "<unknown>");
16887 proto_tree_add_uint(tree
, hf_smb_trans2_subcmd
, tvb
, 0, 0, t2i
->subcmd
);
16888 switch (t2i
->subcmd
) {
16890 case 0x0001: /* FIND_FIRST2 */
16891 if (t2i
->info_level
== -1)
16892 item
= proto_tree_add_uint_format_value(tree
, hf_smb_ff2_information_level
, tvb
, 0, 0, t2i
->info_level
,
16893 "<UNKNOWN> since information level wasn't found in request packet");
16895 item
= proto_tree_add_uint(tree
, hf_smb_ff2_information_level
, tvb
, 0, 0, t2i
->info_level
);
16896 proto_item_set_generated(item
);
16898 item
= proto_tree_add_string(tree
, hf_smb_search_pattern
, tvb
, 0, 0, t2i
->name
);
16899 proto_item_set_generated(item
);
16903 case 0x0005: /* QUERY_PATH_INFORMATION */
16904 if (t2i
->info_level
== -1)
16905 item
= proto_tree_add_uint_format_value(tree
, hf_smb_qpi_loi
, tvb
, 0, 0, t2i
->info_level
,
16906 "<UNKNOWN> since information level wasn't found in request packet");
16908 item
= proto_tree_add_uint(tree
, hf_smb_qpi_loi
, tvb
, 0, 0, t2i
->info_level
);
16909 proto_item_set_generated(item
);
16911 item
= proto_tree_add_string(tree
, hf_smb_file_name
, tvb
, 0, 0, t2i
->name
);
16912 proto_item_set_generated(item
);
16916 case 0x0007: /* QUERY_FILE_INFORMATION */
16917 if (t2i
->info_level
== -1)
16918 item
= proto_tree_add_uint_format_value(tree
, hf_smb_qpi_loi
, tvb
, 0, 0, t2i
->info_level
,
16919 "<UNKNOWN> since information level wasn't found in request packet");
16921 item
= proto_tree_add_uint(tree
, hf_smb_qpi_loi
, tvb
, 0, 0, t2i
->info_level
);
16922 proto_item_set_generated(item
);
16925 case 0x0003: /* QUERY_FS_INFORMATION */
16926 if (t2i
->info_level
== -1)
16927 item
= proto_tree_add_uint_format_value(tree
, hf_smb_qfsi_information_level
, tvb
, 0, 0, si
->info_level
,
16928 "<UNKNOWN> since information level wasn't found in request packet");
16930 item
= proto_tree_add_uint(tree
, hf_smb_qfsi_information_level
, tvb
, 0, 0, si
->info_level
);
16931 proto_item_set_generated(item
);
16934 case 0x0004: /* SET_FS_INFORMATION */
16935 if (t2i
->info_level
== -1)
16936 item
= proto_tree_add_uint_format_value(tree
, hf_smb_sfsi_information_level
, tvb
, 0, 0, si
->info_level
,
16937 "<UNKNOWN> since information level wasn't found in request packet");
16939 item
= proto_tree_add_uint(tree
, hf_smb_sfsi_information_level
, tvb
, 0, 0, si
->info_level
);
16940 proto_item_set_generated(item
);
16944 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", %s",
16945 val_to_str_ext(t2i
->subcmd
,
16946 &trans2_cmd_vals_ext
,
16947 "<unknown (0x%02x)>"));
16955 /* total param count, only a 16bit integer here */
16956 tp
= tvb_get_letohs(tvb
, offset
);
16957 proto_tree_add_uint(tree
, hf_smb_total_param_count
, tvb
, offset
, 2, tp
);
16960 /* total data count, only a 16 bit integer here */
16961 td
= tvb_get_letohs(tvb
, offset
);
16962 proto_tree_add_uint(tree
, hf_smb_total_data_count
, tvb
, offset
, 2, td
);
16965 /* 2 reserved bytes */
16966 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
16970 pc
= tvb_get_letohs(tvb
, offset
);
16971 proto_tree_add_uint(tree
, hf_smb_param_count16
, tvb
, offset
, 2, pc
);
16975 po
= tvb_get_letohs(tvb
, offset
);
16976 proto_tree_add_uint(tree
, hf_smb_param_offset16
, tvb
, offset
, 2, po
);
16980 pd
= tvb_get_letohs(tvb
, offset
);
16981 proto_tree_add_uint(tree
, hf_smb_param_disp16
, tvb
, offset
, 2, pd
);
16985 dc
= tvb_get_letohs(tvb
, offset
);
16986 proto_tree_add_uint(tree
, hf_smb_data_count16
, tvb
, offset
, 2, dc
);
16990 od
= tvb_get_letohs(tvb
, offset
);
16991 proto_tree_add_uint(tree
, hf_smb_data_offset16
, tvb
, offset
, 2, od
);
16994 /* data displacement
16995 * The amount of data sent NOT including the data in this packet. If there are more
16996 * data to send per "Total Data Count", transact continuation packets will follow
16997 * until the td is reached (dd + dc = td).
16999 dd
= tvb_get_letohs(tvb
, offset
);
17000 proto_tree_add_uint(tree
, hf_smb_data_disp16
, tvb
, offset
, 2, dd
);
17003 /* Now that an FF2 FIND_NEXT2 or SET_FILE_INFO, or a SET_PATH_INFO response has been fully decoded,
17004 * we can remove it from the unmatched table. They were left in there to prevent
17005 * "response<unknown>" errors whenever there are multiple responses to the same request,
17006 * or requests with "Subcommand: <UNKNOWN>" errors, respectively.
17008 if (pinfo
->fd
->visited
&& t2i
) {
17009 if (t2i
->subcmd
== 0x0001 || t2i
->subcmd
== 0x0002 ||
17010 t2i
->subcmd
== 0x0006 || t2i
->subcmd
== 0x0008 ||
17011 si
->cmd
== SMB_COM_TRANSACTION2_SECONDARY
||
17012 si
->cmd
== SMB_COM_TRANSACTION_SECONDARY
||
17013 si
->cmd
== SMB_COM_NT_TRANSACT_SECONDARY
) {
17015 pid_mid
= (si
->pid
<< 16) | si
->mid
;
17016 g_hash_table_remove(si
->ct
->unmatched
, GUINT_TO_POINTER(pid_mid
));
17020 if (td
&& td
>= dc
+ dd
) {
17021 uint16_t diff
= td
- (dc
+ dd
);
17022 item
= proto_tree_add_uint(tree
, hf_bytes_until_total_data_count
, tvb
, 0, 0, diff
);
17023 proto_item_set_generated(item
);
17026 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
17027 ", Data: %u of %u", dc
+ dd
, td
);
17031 sc
= tvb_get_uint8(tvb
, offset
);
17032 proto_tree_add_uint(tree
, hf_smb_setup_count
, tvb
, offset
, 1, sc
);
17035 /* reserved byte */
17036 proto_tree_add_item(tree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
17040 /* if there were any setup bytes, put them in a tvb for later */
17042 if ((2*sc
) > tvb_reported_length_remaining(tvb
, offset
)) {
17043 s_tvb
= tvb_new_subset_length_caplen(tvb
, offset
, tvb_reported_length_remaining(tvb
, offset
), 2*sc
);
17045 s_tvb
= tvb_new_subset_length(tvb
, offset
, 2*sc
);
17047 sp_tvb
= tvb_new_subset_remaining(tvb
, offset
);
17058 /* reassembly of SMB Transaction data payload.
17059 In this section we do reassembly of both the data and parameters
17060 blocks of the SMB transaction command.
17062 save_fragmented
= pinfo
->fragmented
;
17063 /* do we need reassembly? */
17064 if ( (td
!= dc
) || (tp
!= pc
) ) {
17065 /* oh yeah, either data or parameter section needs
17068 pinfo
->fragmented
= true;
17069 if (smb_trans_reassembly
) {
17070 /* ...and we were told to do reassembly */
17072 r_fd
= smb_trans_defragment(tree
, pinfo
, tvb
,
17073 po
, pc
, pd
, td
+tp
, si
);
17076 if ((r_fd
== NULL
) && dc
) {
17077 r_fd
= smb_trans_defragment(tree
, pinfo
, tvb
,
17078 od
, dc
, dd
+tp
, td
+tp
, si
);
17083 /* if we got a reassembled fd structure from the reassembly routine we must
17084 create pd_tvb from it
17087 proto_item
*frag_tree_item
;
17089 pd_tvb
= tvb_new_chain(tvb
, r_fd
->tvb_data
);
17090 add_new_data_source(pinfo
, pd_tvb
, "Reassembled SMB");
17091 show_fragment_tree(r_fd
, &smb_frag_items
, tree
, pinfo
, pd_tvb
, &frag_tree_item
);
17096 /* OK we have reassembled data, extract d_tvb and p_tvb from it */
17098 p_tvb
= tvb_new_subset_length(pd_tvb
, 0, tp
);
17101 d_tvb
= tvb_new_subset_length(pd_tvb
, tp
, td
);
17104 /* It was not reassembled. Do as best as we can.
17105 * in this case we always try to dissect the stuff if
17106 * data and param displacement is 0. i.e. for the first
17107 * (and maybe only) packet.
17109 if ( (pd
== 0) && (dd
== 0) ) {
17112 min
= MIN(pc
, tvb_reported_length_remaining(tvb
, po
));
17113 reported_min
= MIN(pc
, tvb_reported_length_remaining(tvb
, po
));
17114 if (min
&& reported_min
) {
17115 p_tvb
= tvb_new_subset_length_caplen(tvb
, po
, min
, reported_min
);
17117 min
= MIN(dc
, tvb_reported_length_remaining(tvb
, od
));
17118 reported_min
= MIN(dc
, tvb_reported_length_remaining(tvb
, od
));
17119 if (min
&& reported_min
) {
17120 d_tvb
= tvb_new_subset_length_caplen(tvb
, od
, min
, reported_min
);
17123 * A tvbuff containing the parameters
17125 * XXX - check pc and dc as well?
17127 if (tvb_reported_length_remaining(tvb
, po
)) {
17128 pd_tvb
= tvb_new_subset_remaining(tvb
, po
);
17137 /* We have some padding bytes.
17139 padcnt
= po
-offset
;
17142 proto_tree_add_item(tree
, hf_smb_padding
, tvb
, offset
, padcnt
, ENC_NA
);
17143 COUNT_BYTES(padcnt
);
17145 if ((si
->cmd
== SMB_COM_TRANSACTION2
) && p_tvb
) {
17146 /* TRANSACTION2 parameters*/
17147 dissect_transaction2_response_parameters(p_tvb
, pinfo
, tree
, si
);
17154 /* We have some initial padding bytes.
17156 padcnt
= od
-offset
;
17159 proto_tree_add_item(tree
, hf_smb_padding
, tvb
, offset
, padcnt
, ENC_NA
);
17160 COUNT_BYTES(padcnt
);
17163 * If the data count is bigger than the count of bytes
17164 * remaining, clamp it so that the count of bytes remaining
17165 * doesn't go negative.
17173 /* from now on, everything is in separate tvbuffs so we don't count
17174 the bytes with COUNT_BYTES any more.
17175 neither do we reference offset any more (which by now points to the
17176 first byte AFTER this PDU */
17179 if ((si
->cmd
== SMB_COM_TRANSACTION2
) && d_tvb
) {
17180 /* TRANSACTION2 parameters*/
17181 dissect_transaction2_response_data(d_tvb
, pinfo
, tree
, si
);
17185 if (si
->cmd
== SMB_COM_TRANSACTION
) {
17186 smb_transact_info_t
*tri
;
17188 dissected_trans
= false;
17189 if ((si
->sip
!= NULL
) && (si
->sip
->extra_info_type
== SMB_EI_TRI
))
17190 tri
= (smb_transact_info_t
*)si
->sip
->extra_info
;
17194 switch(tri
->subcmd
) {
17196 case TRANSACTION_PIPE
:
17197 /* This function is safe to call for
17198 s_tvb == sp_tvb == NULL, i.e. if we don't
17199 know them at this point.
17200 It's also safe to call if "p_tvb"
17201 or "d_tvb" are null.
17204 dissected_trans
= dissect_pipe_smb(
17205 sp_tvb
, s_tvb
, pd_tvb
, p_tvb
,
17206 d_tvb
, NULL
, pinfo
, top_tree_global
, si
);
17210 case TRANSACTION_MAILSLOT
:
17211 /* This one should be safe to call
17212 even if s_tvb and sp_tvb is NULL
17215 dissected_trans
= dissect_mailslot_smb(
17216 sp_tvb
, s_tvb
, d_tvb
, NULL
, pinfo
,
17217 top_tree_global
, si
);
17222 if (!dissected_trans
) {
17223 /* This one is safe to call for s_tvb == p_tvb == d_tvb == NULL */
17224 dissect_trans_data(s_tvb
, p_tvb
, d_tvb
, tree
);
17228 pinfo
->fragmented
= save_fragmented
;
17236 dissect_find_notify_close(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
17243 /* Monitor handle */
17244 proto_tree_add_item(tree
, hf_smb_monitor_handle
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
17254 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
17255 END Transaction/Transaction2 Primary and secondary requests
17256 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
17260 dissect_unknown(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree _U_
, smb_info_t
*si _U_
)
17268 proto_tree_add_item(tree
, hf_smb_word_parameters
, tvb
, offset
, wc
*2, ENC_NA
);
17275 proto_tree_add_item(tree
, hf_smb_byte_parameters
, tvb
, offset
, bc
, ENC_NA
);
17285 typedef struct _smb_function
{
17286 int (*request
)(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
);
17287 int (*response
)(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
);
17290 static const smb_function smb_dissector
[256] = {
17291 /* 0x00 Create Dir*/ {dissect_old_dir_request
, dissect_empty
},
17292 /* 0x01 Delete Dir*/ {dissect_old_dir_request
, dissect_empty
},
17293 /* 0x02 Open File*/ {dissect_open_file_request
, dissect_open_file_response
},
17294 /* 0x03 Create File*/ {dissect_create_file_request
, dissect_create_file_response
},
17295 /* 0x04 Close File*/ {dissect_close_file_request
, dissect_empty
},
17296 /* 0x05 Flush File*/ {dissect_flush_file_request
, dissect_empty
},
17297 /* 0x06 Delete File*/ {dissect_delete_file_request
, dissect_empty
},
17298 /* 0x07 Rename File*/ {dissect_rename_file_request
, dissect_rename_file_response
},
17299 /* 0x08 Query Info*/ {dissect_query_information_request
, dissect_query_information_response
},
17300 /* 0x09 Set Info*/ {dissect_set_information_request
, dissect_empty
},
17301 /* 0x0a Read File*/ {dissect_read_file_request
, dissect_read_file_response
},
17302 /* 0x0b Write File*/ {dissect_write_file_request
, dissect_write_file_response
},
17303 /* 0x0c Lock Byte Range*/ {dissect_lock_request
, dissect_empty
},
17304 /* 0x0d Unlock Byte Range*/ {dissect_lock_request
, dissect_empty
},
17305 /* 0x0e Create Temp*/ {dissect_create_temporary_request
, dissect_create_temporary_response
},
17306 /* 0x0f Create New*/ {dissect_create_file_request
, dissect_create_new_response
},
17308 /* 0x10 Check Dir*/ {dissect_old_dir_request
, dissect_empty
},
17309 /* 0x11 Process Exit*/ {dissect_empty
, dissect_empty
},
17310 /* 0x12 Seek File*/ {dissect_seek_file_request
, dissect_seek_file_response
},
17311 /* 0x13 Lock And Read*/ {dissect_read_file_request
, dissect_lock_and_read_response
},
17312 /* 0x14 Write And Unlock*/ {dissect_write_file_request
, dissect_write_file_response
},
17313 /* 0x15 */ {dissect_unknown
, dissect_unknown
},
17314 /* 0x16 */ {dissect_unknown
, dissect_unknown
},
17315 /* 0x17 */ {dissect_unknown
, dissect_unknown
},
17316 /* 0x18 */ {dissect_unknown
, dissect_unknown
},
17317 /* 0x19 */ {dissect_unknown
, dissect_unknown
},
17318 /* 0x1a Read Raw*/ {dissect_read_raw_request
, dissect_unknown
},
17319 /* 0x1b Read MPX*/ {dissect_read_mpx_request
, dissect_read_mpx_response
},
17320 /* 0x1c Read MPX Secondary*/ {dissect_unknown
, dissect_unknown
},
17321 /* 0x1d Write Raw*/ {dissect_write_raw_request
, dissect_write_raw_response
},
17322 /* 0x1e Write MPX*/ {dissect_write_mpx_request
, dissect_write_mpx_response
},
17323 /* 0x1f Write MPX Secondary*/ {dissect_unknown
, dissect_unknown
},
17325 /* 0x20 Write Complete*/ {dissect_unknown
, dissect_write_and_close_response
},
17326 /* 0x21 */ {dissect_unknown
, dissect_unknown
},
17327 /* 0x22 Set Info2*/ {dissect_set_information2_request
, dissect_empty
},
17328 /* 0x23 Query Info2*/ {dissect_query_information2_request
, dissect_query_information2_response
},
17329 /* 0x24 Locking And X*/ {dissect_locking_andx_request
, dissect_locking_andx_response
},
17330 /* 0x25 Transaction*/ {dissect_transaction_request
, dissect_transaction_response
},
17331 /* 0x26 Transaction Secondary*/ {dissect_transaction_request
, dissect_unknown
}, /*This SMB has no response */
17332 /* 0x27 IOCTL*/ {dissect_unknown
, dissect_unknown
},
17333 /* 0x28 IOCTL Secondary*/ {dissect_unknown
, dissect_unknown
},
17334 /* 0x29 Copy File*/ {dissect_copy_request
, dissect_move_copy_response
},
17335 /* 0x2a Move File*/ {dissect_move_request
, dissect_move_copy_response
},
17336 /* 0x2b Echo*/ {dissect_echo_request
, dissect_echo_response
},
17337 /* 0x2c Write And Close*/ {dissect_write_and_close_request
, dissect_write_and_close_response
},
17338 /* 0x2d Open And X*/ {dissect_open_andx_request
, dissect_open_andx_response
},
17339 /* 0x2e Read And X*/ {dissect_read_andx_request
, dissect_read_andx_response
},
17340 /* 0x2f Write And X*/ {dissect_write_andx_request
, dissect_write_andx_response
},
17342 /* 0x30 */ {dissect_unknown
, dissect_unknown
},
17343 /* 0x31 Close And Tree Disconnect */ {dissect_close_file_request
, dissect_empty
},
17344 /* 0x32 Transaction2*/ {dissect_transaction_request
, dissect_transaction_response
},
17345 /* 0x33 Transaction2 Secondary*/ {dissect_transaction_request
, dissect_unknown
}, /*This SMB has no response */
17346 /* 0x34 Find Close2*/ {dissect_search_id
, dissect_empty
},
17347 /* 0x35 Find Notify Close*/ {dissect_find_notify_close
, dissect_empty
},
17348 /* 0x36 */ {dissect_unknown
, dissect_unknown
},
17349 /* 0x37 */ {dissect_unknown
, dissect_unknown
},
17350 /* 0x38 */ {dissect_unknown
, dissect_unknown
},
17351 /* 0x39 */ {dissect_unknown
, dissect_unknown
},
17352 /* 0x3a */ {dissect_unknown
, dissect_unknown
},
17353 /* 0x3b */ {dissect_unknown
, dissect_unknown
},
17354 /* 0x3c */ {dissect_unknown
, dissect_unknown
},
17355 /* 0x3d */ {dissect_unknown
, dissect_unknown
},
17356 /* 0x3e */ {dissect_unknown
, dissect_unknown
},
17357 /* 0x3f */ {dissect_unknown
, dissect_unknown
},
17359 /* 0x40 */ {dissect_unknown
, dissect_unknown
},
17360 /* 0x41 */ {dissect_unknown
, dissect_unknown
},
17361 /* 0x42 */ {dissect_unknown
, dissect_unknown
},
17362 /* 0x43 */ {dissect_unknown
, dissect_unknown
},
17363 /* 0x44 */ {dissect_unknown
, dissect_unknown
},
17364 /* 0x45 */ {dissect_unknown
, dissect_unknown
},
17365 /* 0x46 */ {dissect_unknown
, dissect_unknown
},
17366 /* 0x47 */ {dissect_unknown
, dissect_unknown
},
17367 /* 0x48 */ {dissect_unknown
, dissect_unknown
},
17368 /* 0x49 */ {dissect_unknown
, dissect_unknown
},
17369 /* 0x4a */ {dissect_unknown
, dissect_unknown
},
17370 /* 0x4b */ {dissect_unknown
, dissect_unknown
},
17371 /* 0x4c */ {dissect_unknown
, dissect_unknown
},
17372 /* 0x4d */ {dissect_unknown
, dissect_unknown
},
17373 /* 0x4e */ {dissect_unknown
, dissect_unknown
},
17374 /* 0x4f */ {dissect_unknown
, dissect_unknown
},
17376 /* 0x50 */ {dissect_unknown
, dissect_unknown
},
17377 /* 0x51 */ {dissect_unknown
, dissect_unknown
},
17378 /* 0x52 */ {dissect_unknown
, dissect_unknown
},
17379 /* 0x53 */ {dissect_unknown
, dissect_unknown
},
17380 /* 0x54 */ {dissect_unknown
, dissect_unknown
},
17381 /* 0x55 */ {dissect_unknown
, dissect_unknown
},
17382 /* 0x56 */ {dissect_unknown
, dissect_unknown
},
17383 /* 0x57 */ {dissect_unknown
, dissect_unknown
},
17384 /* 0x58 */ {dissect_unknown
, dissect_unknown
},
17385 /* 0x59 */ {dissect_unknown
, dissect_unknown
},
17386 /* 0x5a */ {dissect_unknown
, dissect_unknown
},
17387 /* 0x5b */ {dissect_unknown
, dissect_unknown
},
17388 /* 0x5c */ {dissect_unknown
, dissect_unknown
},
17389 /* 0x5d */ {dissect_unknown
, dissect_unknown
},
17390 /* 0x5e */ {dissect_unknown
, dissect_unknown
},
17391 /* 0x5f */ {dissect_unknown
, dissect_unknown
},
17393 /* 0x60 */ {dissect_unknown
, dissect_unknown
},
17394 /* 0x61 */ {dissect_unknown
, dissect_unknown
},
17395 /* 0x62 */ {dissect_unknown
, dissect_unknown
},
17396 /* 0x63 */ {dissect_unknown
, dissect_unknown
},
17397 /* 0x64 */ {dissect_unknown
, dissect_unknown
},
17398 /* 0x65 */ {dissect_unknown
, dissect_unknown
},
17399 /* 0x66 */ {dissect_unknown
, dissect_unknown
},
17400 /* 0x67 */ {dissect_unknown
, dissect_unknown
},
17401 /* 0x68 */ {dissect_unknown
, dissect_unknown
},
17402 /* 0x69 */ {dissect_unknown
, dissect_unknown
},
17403 /* 0x6a */ {dissect_unknown
, dissect_unknown
},
17404 /* 0x6b */ {dissect_unknown
, dissect_unknown
},
17405 /* 0x6c */ {dissect_unknown
, dissect_unknown
},
17406 /* 0x6d */ {dissect_unknown
, dissect_unknown
},
17407 /* 0x6e */ {dissect_unknown
, dissect_unknown
},
17408 /* 0x6f */ {dissect_unknown
, dissect_unknown
},
17410 /* 0x70 Tree Connect*/ {dissect_tree_connect_request
, dissect_tree_connect_response
},
17411 /* 0x71 Tree Disconnect*/ {dissect_empty
, dissect_empty
},
17412 /* 0x72 Negotiate Protocol*/ {dissect_negprot_request
, dissect_negprot_response
},
17413 /* 0x73 Session Setup And X*/ {dissect_session_setup_andx_request
, dissect_session_setup_andx_response
},
17414 /* 0x74 Logoff And X*/ {dissect_empty_andx
, dissect_empty_andx
},
17415 /* 0x75 Tree Connect And X*/ {dissect_tree_connect_andx_request
, dissect_tree_connect_andx_response
},
17416 /* 0x76 */ {dissect_unknown
, dissect_unknown
},
17417 /* 0x77 */ {dissect_unknown
, dissect_unknown
},
17418 /* 0x78 */ {dissect_unknown
, dissect_unknown
},
17419 /* 0x79 */ {dissect_unknown
, dissect_unknown
},
17420 /* 0x7a */ {dissect_unknown
, dissect_unknown
},
17421 /* 0x7b */ {dissect_unknown
, dissect_unknown
},
17422 /* 0x7c */ {dissect_unknown
, dissect_unknown
},
17423 /* 0x7d */ {dissect_unknown
, dissect_unknown
},
17424 /* 0x7e */ {dissect_unknown
, dissect_unknown
},
17425 /* 0x7f */ {dissect_unknown
, dissect_unknown
},
17427 /* 0x80 Query Info Disk*/ {dissect_empty
, dissect_query_information_disk_response
},
17428 /* 0x81 Search Dir*/ {dissect_search_dir_request
, dissect_search_dir_response
},
17429 /* 0x82 Find*/ {dissect_find_request
, dissect_find_response
},
17430 /* 0x83 Find Unique*/ {dissect_find_request
, dissect_find_response
},
17431 /* 0x84 Find Close*/ {dissect_find_close_request
, dissect_find_close_response
},
17432 /* 0x85 */ {dissect_unknown
, dissect_unknown
},
17433 /* 0x86 */ {dissect_unknown
, dissect_unknown
},
17434 /* 0x87 */ {dissect_unknown
, dissect_unknown
},
17435 /* 0x88 */ {dissect_unknown
, dissect_unknown
},
17436 /* 0x89 */ {dissect_unknown
, dissect_unknown
},
17437 /* 0x8a */ {dissect_unknown
, dissect_unknown
},
17438 /* 0x8b */ {dissect_unknown
, dissect_unknown
},
17439 /* 0x8c */ {dissect_unknown
, dissect_unknown
},
17440 /* 0x8d */ {dissect_unknown
, dissect_unknown
},
17441 /* 0x8e */ {dissect_unknown
, dissect_unknown
},
17442 /* 0x8f */ {dissect_unknown
, dissect_unknown
},
17444 /* 0x90 */ {dissect_unknown
, dissect_unknown
},
17445 /* 0x91 */ {dissect_unknown
, dissect_unknown
},
17446 /* 0x92 */ {dissect_unknown
, dissect_unknown
},
17447 /* 0x93 */ {dissect_unknown
, dissect_unknown
},
17448 /* 0x94 */ {dissect_unknown
, dissect_unknown
},
17449 /* 0x95 */ {dissect_unknown
, dissect_unknown
},
17450 /* 0x96 */ {dissect_unknown
, dissect_unknown
},
17451 /* 0x97 */ {dissect_unknown
, dissect_unknown
},
17452 /* 0x98 */ {dissect_unknown
, dissect_unknown
},
17453 /* 0x99 */ {dissect_unknown
, dissect_unknown
},
17454 /* 0x9a */ {dissect_unknown
, dissect_unknown
},
17455 /* 0x9b */ {dissect_unknown
, dissect_unknown
},
17456 /* 0x9c */ {dissect_unknown
, dissect_unknown
},
17457 /* 0x9d */ {dissect_unknown
, dissect_unknown
},
17458 /* 0x9e */ {dissect_unknown
, dissect_unknown
},
17459 /* 0x9f */ {dissect_unknown
, dissect_unknown
},
17461 /* 0xa0 NT Transaction*/ {dissect_nt_transaction_request
, dissect_nt_transaction_response
},
17462 /* 0xa1 NT Trans secondary*/ {dissect_nt_transaction_request
, dissect_nt_transaction_response
},
17463 /* 0xa2 NT CreateAndX*/ {dissect_nt_create_andx_request
, dissect_nt_create_andx_response
},
17464 /* 0xa3 */ {dissect_unknown
, dissect_unknown
},
17465 /* 0xa4 NT Cancel*/ {dissect_nt_cancel_request
, dissect_unknown
}, /*no response to this one*/
17466 /* 0xa5 NT Rename*/ {dissect_nt_rename_file_request
, dissect_empty
},
17467 /* 0xa6 */ {dissect_unknown
, dissect_unknown
},
17468 /* 0xa7 */ {dissect_unknown
, dissect_unknown
},
17469 /* 0xa8 */ {dissect_unknown
, dissect_unknown
},
17470 /* 0xa9 */ {dissect_unknown
, dissect_unknown
},
17471 /* 0xaa */ {dissect_unknown
, dissect_unknown
},
17472 /* 0xab */ {dissect_unknown
, dissect_unknown
},
17473 /* 0xac */ {dissect_unknown
, dissect_unknown
},
17474 /* 0xad */ {dissect_unknown
, dissect_unknown
},
17475 /* 0xae */ {dissect_unknown
, dissect_unknown
},
17476 /* 0xaf */ {dissect_unknown
, dissect_unknown
},
17478 /* 0xb0 */ {dissect_unknown
, dissect_unknown
},
17479 /* 0xb1 */ {dissect_unknown
, dissect_unknown
},
17480 /* 0xb2 */ {dissect_unknown
, dissect_unknown
},
17481 /* 0xb3 */ {dissect_unknown
, dissect_unknown
},
17482 /* 0xb4 */ {dissect_unknown
, dissect_unknown
},
17483 /* 0xb5 */ {dissect_unknown
, dissect_unknown
},
17484 /* 0xb6 */ {dissect_unknown
, dissect_unknown
},
17485 /* 0xb7 */ {dissect_unknown
, dissect_unknown
},
17486 /* 0xb8 */ {dissect_unknown
, dissect_unknown
},
17487 /* 0xb9 */ {dissect_unknown
, dissect_unknown
},
17488 /* 0xba */ {dissect_unknown
, dissect_unknown
},
17489 /* 0xbb */ {dissect_unknown
, dissect_unknown
},
17490 /* 0xbc */ {dissect_unknown
, dissect_unknown
},
17491 /* 0xbd */ {dissect_unknown
, dissect_unknown
},
17492 /* 0xbe */ {dissect_unknown
, dissect_unknown
},
17493 /* 0xbf */ {dissect_unknown
, dissect_unknown
},
17495 /* 0xc0 Open Print File*/ {dissect_open_print_file_request
, dissect_open_print_file_response
},
17496 /* 0xc1 Write Print File*/ {dissect_write_print_file_request
, dissect_empty
},
17497 /* 0xc2 Close Print File*/ {dissect_close_print_file_request
, dissect_empty
},
17498 /* 0xc3 Get Print Queue*/ {dissect_get_print_queue_request
, dissect_get_print_queue_response
},
17499 /* 0xc4 */ {dissect_unknown
, dissect_unknown
},
17500 /* 0xc5 */ {dissect_unknown
, dissect_unknown
},
17501 /* 0xc6 */ {dissect_unknown
, dissect_unknown
},
17502 /* 0xc7 */ {dissect_unknown
, dissect_unknown
},
17503 /* 0xc8 */ {dissect_unknown
, dissect_unknown
},
17504 /* 0xc9 */ {dissect_unknown
, dissect_unknown
},
17505 /* 0xca */ {dissect_unknown
, dissect_unknown
},
17506 /* 0xcb */ {dissect_unknown
, dissect_unknown
},
17507 /* 0xcc */ {dissect_unknown
, dissect_unknown
},
17508 /* 0xcd */ {dissect_unknown
, dissect_unknown
},
17509 /* 0xce */ {dissect_unknown
, dissect_unknown
},
17510 /* 0xcf */ {dissect_unknown
, dissect_unknown
},
17512 /* 0xd0 Send Single Block Message*/ {dissect_send_single_block_message_request
, dissect_empty
},
17513 /* 0xd1 Send Broadcast Message*/ {dissect_send_single_block_message_request
, dissect_empty
},
17514 /* 0xd2 Forward User Name*/ {dissect_forwarded_name
, dissect_empty
},
17515 /* 0xd3 Cancel Forward*/ {dissect_forwarded_name
, dissect_empty
},
17516 /* 0xd4 Get Machine Name*/ {dissect_empty
, dissect_get_machine_name_response
},
17517 /* 0xd5 Send Start of Multi-block Message*/ {dissect_send_multi_block_message_start_request
, dissect_message_group_id
},
17518 /* 0xd6 Send End of Multi-block Message*/ {dissect_message_group_id
, dissect_empty
},
17519 /* 0xd7 Send Text of Multi-block Message*/ {dissect_send_multi_block_message_text_request
, dissect_empty
},
17520 /* 0xd8 SMBreadbulk*/ {dissect_unknown
, dissect_unknown
},
17521 /* 0xd9 SMBwritebulk*/ {dissect_unknown
, dissect_unknown
},
17522 /* 0xda SMBwritebulkdata*/ {dissect_unknown
, dissect_unknown
},
17523 /* 0xdb */ {dissect_unknown
, dissect_unknown
},
17524 /* 0xdc */ {dissect_unknown
, dissect_unknown
},
17525 /* 0xdd */ {dissect_unknown
, dissect_unknown
},
17526 /* 0xde */ {dissect_unknown
, dissect_unknown
},
17527 /* 0xdf */ {dissect_unknown
, dissect_unknown
},
17529 /* 0xe0 */ {dissect_unknown
, dissect_unknown
},
17530 /* 0xe1 */ {dissect_unknown
, dissect_unknown
},
17531 /* 0xe2 */ {dissect_unknown
, dissect_unknown
},
17532 /* 0xe3 */ {dissect_unknown
, dissect_unknown
},
17533 /* 0xe4 */ {dissect_unknown
, dissect_unknown
},
17534 /* 0xe5 */ {dissect_unknown
, dissect_unknown
},
17535 /* 0xe6 */ {dissect_unknown
, dissect_unknown
},
17536 /* 0xe7 */ {dissect_unknown
, dissect_unknown
},
17537 /* 0xe8 */ {dissect_unknown
, dissect_unknown
},
17538 /* 0xe9 */ {dissect_unknown
, dissect_unknown
},
17539 /* 0xea */ {dissect_unknown
, dissect_unknown
},
17540 /* 0xeb */ {dissect_unknown
, dissect_unknown
},
17541 /* 0xec */ {dissect_unknown
, dissect_unknown
},
17542 /* 0xed */ {dissect_unknown
, dissect_unknown
},
17543 /* 0xee */ {dissect_unknown
, dissect_unknown
},
17544 /* 0xef */ {dissect_unknown
, dissect_unknown
},
17546 /* 0xf0 */ {dissect_unknown
, dissect_unknown
},
17547 /* 0xf1 */ {dissect_unknown
, dissect_unknown
},
17548 /* 0xf2 */ {dissect_unknown
, dissect_unknown
},
17549 /* 0xf3 */ {dissect_unknown
, dissect_unknown
},
17550 /* 0xf4 */ {dissect_unknown
, dissect_unknown
},
17551 /* 0xf5 */ {dissect_unknown
, dissect_unknown
},
17552 /* 0xf6 */ {dissect_unknown
, dissect_unknown
},
17553 /* 0xf7 */ {dissect_unknown
, dissect_unknown
},
17554 /* 0xf8 */ {dissect_unknown
, dissect_unknown
},
17555 /* 0xf9 */ {dissect_unknown
, dissect_unknown
},
17556 /* 0xfa */ {dissect_unknown
, dissect_unknown
},
17557 /* 0xfb */ {dissect_unknown
, dissect_unknown
},
17558 /* 0xfc */ {dissect_unknown
, dissect_unknown
},
17559 /* 0xfd */ {dissect_unknown
, dissect_unknown
},
17560 /* 0xfe */ {dissect_unknown
, dissect_unknown
},
17561 /* 0xff */ {dissect_unknown
, dissect_unknown
},
17565 dissect_smb_command(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*smb_tree
, uint8_t cmd
, bool first_pdu
, smb_info_t
*si
)
17567 smb_saved_info_t
*sip
;
17569 DISSECTOR_ASSERT(si
);
17572 proto_item
*cmd_item
;
17573 proto_tree
*cmd_tree
;
17574 int (*dissector
)(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, proto_tree
*smb_tree
, smb_info_t
*si
);
17577 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
17579 val_to_str_ext(cmd
, &smb_cmd_vals_ext
, "Unknown (0x%02x)"),
17580 (si
->request
)? "Request" : "Response");
17582 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
17584 val_to_str_ext(cmd
, &smb_cmd_vals_ext
, "Unknown (0x%02x)"));
17587 cmd_tree
= proto_tree_add_subtree_format(smb_tree
, tvb
, offset
, -1,
17588 ett_smb_command
, &cmd_item
, "%s %s (0x%02x)",
17589 val_to_str_ext_const(cmd
, &smb_cmd_vals_ext
, "Unknown"),
17590 (si
->request
)?"Request":"Response",
17593 /* we track FIDs on a per transaction basis.
17594 if this was a request and the fid was seen in a reply
17595 we add a "generated" fid tree for this pdu and v.v.
17598 if (sip
&& sip
->fid
) {
17599 if ( (si
->request
&& (!sip
->fid_seen_in_request
))
17600 || ((!si
->request
) && sip
->fid_seen_in_request
) ) {
17601 dissect_smb_fid(tvb
, pinfo
, cmd_tree
, offset
, 0, sip
->fid
, false, false, true, si
);
17605 dissector
= (si
->request
) ?
17606 smb_dissector
[cmd
].request
: smb_dissector
[cmd
].response
;
17608 offset
= (*dissector
)(tvb
, pinfo
, cmd_tree
, offset
, smb_tree
, si
);
17610 if (!tvb_offset_exists(tvb
, offset
-1)) {
17611 THROW(ReportedBoundsError
);
17613 proto_item_set_end(cmd_item
, tvb
, offset
);
17618 static const value_string smb_cmd_vals
[] = {
17619 { 0x00, "Create Directory" },
17620 { 0x01, "Delete Directory" },
17622 { 0x03, "Create" },
17625 { 0x06, "Delete" },
17626 { 0x07, "Rename" },
17627 { 0x08, "Query Information" },
17628 { 0x09, "Set Information" },
17631 { 0x0C, "Lock Byte Range" },
17632 { 0x0D, "Unlock Byte Range" },
17633 { 0x0E, "Create Temp" },
17634 { 0x0F, "Create New" },
17635 { 0x10, "Check Directory" },
17636 { 0x11, "Process Exit" },
17638 { 0x13, "Lock And Read" },
17639 { 0x14, "Write And Unlock" },
17640 { 0x15, "unknown-0x15" },
17641 { 0x16, "unknown-0x16" },
17642 { 0x17, "unknown-0x17" },
17643 { 0x18, "unknown-0x18" },
17644 { 0x19, "unknown-0x19" },
17645 { 0x1A, "Read Raw" },
17646 { 0x1B, "Read MPX" },
17647 { 0x1C, "Read MPX Secondary" },
17648 { 0x1D, "Write Raw" },
17649 { 0x1E, "Write MPX" },
17650 { 0x1F, "Write MPX Secondary" },
17651 { 0x20, "Write Complete" },
17656 * http://msdn.microsoft.com/en-us/library/ee442098.aspx
17658 * "This command was introduced in the NT LAN Manager dialect, and
17659 * was reserved but not implemented.
17661 * Clients SHOULD NOT send requests using this command code, and
17662 * servers receiving requests with this command code SHOULD return
17663 * STATUS_NOT_IMPLEMENTED (ERRDOS/ERRbadfunc)."
17665 { 0x21, "Query Server (reserved)" },
17667 { 0x22, "Set Information2" },
17668 { 0x23, "Query Information2" },
17669 { 0x24, "Locking AndX" },
17671 { 0x26, "Trans Secondary" },
17673 { 0x28, "IOCTL Secondary" },
17677 { 0x2C, "Write And Close" },
17678 { 0x2D, "Open AndX" },
17679 { 0x2E, "Read AndX" },
17680 { 0x2F, "Write AndX" },
17685 * http://msdn.microsoft.com/en-us/library/ee442127.aspx
17687 * "This command was reserved but not implemented. It was also never
17688 * defined. It is listed in [SNIA], but it is not defined in that
17689 * document and does not appear in any other references.
17691 * Clients SHOULD NOT send requests using this command code, and
17692 * servers receiving requests with this command code SHOULD return
17693 * STATUS_NOT_IMPLEMENTED (ERRDOC/ERRbadfunc)."
17695 { 0x30, "New File Size (reserved)" },
17697 { 0x31, "Close And Tree Disconnect" },
17698 { 0x32, "Trans2" },
17699 { 0x33, "Trans2 Secondary" },
17700 { 0x34, "Find Close2" },
17701 { 0x35, "Find Notify Close" },
17702 { 0x70, "Tree Connect" },
17703 { 0x71, "Tree Disconnect" },
17704 { 0x72, "Negotiate Protocol" },
17705 { 0x73, "Session Setup AndX" },
17706 { 0x74, "Logoff AndX" },
17707 { 0x75, "Tree Connect AndX" },
17708 { 0x80, "Query Information Disk" },
17709 { 0x81, "Search" },
17711 { 0x83, "Find Unique" },
17712 { 0x84, "Find Close" },
17713 { 0xA0, "NT Trans" },
17714 { 0xA1, "NT Trans Secondary" },
17715 { 0xA2, "NT Create AndX" },
17716 { 0xA3, "unknown-0xA3" },
17717 { 0xA4, "NT Cancel" },
17718 { 0xA5, "NT Rename" },
17719 { 0xC0, "Open Print File" },
17720 { 0xC1, "Write Print File" },
17721 { 0xC2, "Close Print File" },
17722 { 0xC3, "Get Print Queue" },
17723 { 0xD0, "Send Single Block Message" },
17724 { 0xD1, "Send Broadcast Message" },
17725 { 0xD2, "Forward User Name" },
17726 { 0xD3, "Cancel Forward" },
17727 { 0xD4, "Get Machine Name" },
17728 { 0xD5, "Send Start of Multi-block Message" },
17729 { 0xD6, "Send End of Multi-block Message" },
17730 { 0xD7, "Send Text of Multi-block Message" },
17731 { 0xD8, "SMBreadbulk" },
17732 { 0xD9, "SMBwritebulk" },
17733 { 0xDA, "SMBwritebulkdata" },
17734 { 0xFE, "SMBinvalid" },
17737 value_string_ext smb_cmd_vals_ext
= VALUE_STRING_EXT_INIT(smb_cmd_vals
);
17741 free_hash_tables(void *ctarg
, void *user_data _U_
)
17743 conv_tables_t
*ct
= (conv_tables_t
*)ctarg
;
17746 g_hash_table_destroy(ct
->unmatched
);
17748 g_hash_table_destroy(ct
->matched
);
17750 g_hash_table_destroy(ct
->primaries
);
17751 if (ct
->tid_service
)
17752 g_hash_table_destroy(ct
->tid_service
);
17753 g_slist_free(ct
->GSL_fid_info
);
17761 g_slist_foreach(conv_tables
, free_hash_tables
, NULL
);
17762 g_slist_free(conv_tables
);
17763 conv_tables
= NULL
;
17767 static const value_string errcls_types
[] = {
17768 { SMB_SUCCESS
, "Success"},
17769 { SMB_ERRDOS
, "DOS Error"},
17770 { SMB_ERRSRV
, "Server Error"},
17771 { SMB_ERRHRD
, "Hardware Error"},
17772 { SMB_ERRCMD
, "Command Error - Not an SMB format command"},
17776 /* Error codes for the ERRSRV class */
17778 #define SRV_errors_VALUE_STRING_LIST(XXX) \
17779 XXX( SMBE_SRV_error, 1, "Non specific error code") \
17780 XXX( SMBE_SRV_badpw, 2, "Bad password") \
17781 XXX( SMBE_SRV_badtype, 3, "Reserved") \
17782 XXX( SMBE_SRV_access, 4, "No permissions to perform the requested operation") \
17783 XXX( SMBE_SRV_invnid, 5, "TID invalid") \
17784 XXX( SMBE_SRV_invnetname, 6, "Invalid network name. Service not found") \
17785 XXX( SMBE_SRV_invdevice, 7, "Invalid device") \
17786 XXX( SMBE_SRV_unknownsmb, 22, "Unknown SMB, from NT 3.5 response") \
17787 XXX( SMBE_SRV_qfull, 49, "Print queue full") \
17788 XXX( SMBE_SRV_qtoobig, 50, "Queued item too big") \
17789 XXX( SMBE_SRV_qeof, 51, "EOF in print queue dump") \
17790 XXX( SMBE_SRV_invpfid, 52, "Invalid print file in smb_fid") \
17791 XXX( SMBE_SRV_smbcmd, 64, "Unrecognised command") \
17792 XXX( SMBE_SRV_srverror, 65, "SMB server internal error") \
17793 XXX( SMBE_SRV_filespecs, 67, "Fid and pathname invalid combination") \
17794 XXX( SMBE_SRV_badlink, 68, "Bad link in request ???") \
17795 XXX( SMBE_SRV_badpermits, 69, "Access specified for a file is not valid") \
17796 XXX( SMBE_SRV_badpid, 70, "Bad process id in request") \
17797 XXX( SMBE_SRV_setattrmode, 71, "Attribute mode invalid") \
17798 XXX( SMBE_SRV_paused, 81, "Message server paused") \
17799 XXX( SMBE_SRV_msgoff, 82, "Not receiving messages") \
17800 XXX( SMBE_SRV_noroom, 83, "No room for message") \
17801 XXX( SMBE_SRV_rmuns, 87, "Too many remote usernames") \
17802 XXX( SMBE_SRV_timeout, 88, "Operation timed out") \
17803 XXX( SMBE_SRV_noresource, 89, "No resources currently available for request.") \
17804 XXX( SMBE_SRV_toomanyuids, 90, "Too many userids") \
17805 XXX( SMBE_SRV_baduid, 91, "Bad userid") \
17806 XXX( SMBE_SRV_useMPX, 250, "Temporarily unable to use raw mode, use MPX mode") \
17807 XXX( SMBE_SRV_useSTD, 251, "Temporarily unable to use raw mode, use standard mode") \
17808 XXX( SMBE_SRV_contMPX, 252, "Resume MPX mode") \
17809 XXX( SMBE_SRV_badPW, 253, "Bad Password???") \
17810 XXX( SMBE_SRV_nosupport, 0xFFFF, "Operation not supported")
17812 #if 0 /* Values not needed */
17813 VALUE_STRING_ENUM(SRV_errors
);
17815 VALUE_STRING_ARRAY(SRV_errors
);
17816 static value_string_ext SRV_errors_ext
= VALUE_STRING_EXT_INIT(SRV_errors
);
17819 /* Error codes for the ERRHRD class */
17821 #define HRD_errors_VALUE_STRING_LIST(XXX) \
17822 XXX( SMBE_HRD_nowrite, 19, "Read only media") \
17823 XXX( SMBE_HRD_badunit, 20, "Unknown device") \
17824 XXX( SMBE_HRD_notready, 21, "Drive not ready") \
17825 XXX( SMBE_HRD_badcmd, 22, "Unknown command") \
17826 XXX( SMBE_HRD_data, 23, "Data (CRC) error") \
17827 XXX( SMBE_HRD_badreq, 24, "Bad request structure length") \
17828 XXX( SMBE_HRD_seek, 25, "Seek error") \
17829 XXX( SMBE_HRD_badmedia, 26, "Unknown media type") \
17830 XXX( SMBE_HRD_badsector, 27, "Sector not found") \
17831 XXX( SMBE_HRD_nopaper, 28, "Printer out of paper") \
17832 XXX( SMBE_HRD_write, 29, "Write fault") \
17833 XXX( SMBE_HRD_read, 30, "Read fault") \
17834 XXX( SMBE_HRD_general, 31, "General failure") \
17835 /* -- (really part of ERRDOS class ??) -- */ \
17836 XXX( SMBE_HRD_badshare, 32, "An open conflicts with an existing open") \
17837 XXX( SMBE_HRD_lock, 33, "Lock conflict/invalid mode, or unlock of another process's lock") \
17839 XXX( SMBE_HRD_wrongdisk, 34, "The wrong disk was found in a drive") \
17840 XXX( SMBE_HRD_FCBunavail, 35, "No FCBs are available to process request") \
17841 XXX( SMBE_HRD_sharebufexc, 36, "A sharing buffer has been exceeded") \
17842 XXX( SMBE_HRD_diskfull, 39, "Disk full???")
17844 #if 0 /* Values not needed */
17845 VALUE_STRING_ENUM(HRD_errors
);
17847 VALUE_STRING_ARRAY(HRD_errors
);
17848 static value_string_ext HRD_errors_ext
= VALUE_STRING_EXT_INIT(HRD_errors
);
17850 static const char *decode_smb_error(uint8_t errcls
, uint16_t errcode
)
17856 return "No Error"; /* No error ??? */
17859 return val_to_str_ext(errcode
, &DOS_errors_ext
, "Unknown DOS error (%x)");
17862 return val_to_str_ext(errcode
, &SRV_errors_ext
, "Unknown SRV error (%x)");
17865 return val_to_str_ext(errcode
, &HRD_errors_ext
, "Unknown HRD error (%x)");
17868 return "Unknown error class!";
17873 static const true_false_string tfs_smb_flags_lock
= {
17874 "Lock&Read, Write&Unlock are supported",
17875 "Lock&Read, Write&Unlock are not supported"
17877 static const true_false_string tfs_smb_flags_receive_buffer
= {
17878 "Receive buffer has been posted",
17879 "Receive buffer has not been posted"
17881 static const true_false_string tfs_smb_flags_caseless
= {
17882 "Path names are caseless",
17883 "Path names are case sensitive"
17885 static const true_false_string tfs_smb_flags_canon
= {
17886 "Pathnames are canonicalized",
17887 "Pathnames are not canonicalized"
17889 static const true_false_string tfs_smb_flags_oplock
= {
17890 "OpLock requested/granted",
17891 "OpLock not requested/granted"
17893 static const true_false_string tfs_smb_flags_notify
= {
17894 "Notify client on all modifications",
17895 "Notify client only on open"
17897 static const true_false_string tfs_smb_flags_response
= {
17898 "Message is a response to the client/redirector",
17899 "Message is a request to the server"
17903 dissect_smb_flags(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
17905 static int * const flags
[] = {
17906 &hf_smb_flags_response
,
17907 &hf_smb_flags_notify
,
17908 &hf_smb_flags_oplock
,
17909 &hf_smb_flags_canon
,
17910 &hf_smb_flags_caseless
,
17911 &hf_smb_flags_receive_buffer
,
17912 &hf_smb_flags_lock
,
17916 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_flags
, ett_smb_flags
, flags
, ENC_NA
);
17924 static const true_false_string tfs_smb_flags2_long_names_allowed
= {
17925 "Long file names are allowed in the response",
17926 "Long file names are not allowed in the response"
17928 static const true_false_string tfs_smb_flags2_ea
= {
17929 "Extended attributes are supported",
17930 "Extended attributes are not supported"
17932 static const true_false_string tfs_smb_flags2_sec_sig
= {
17933 "Security signatures are supported",
17934 "Security signatures are not supported"
17936 static const true_false_string tfs_smb_flags2_compressed
= {
17937 "Compression is requested",
17938 "Compression is not requested"
17940 static const true_false_string tfs_smb_flags2_sec_sig_required
= {
17941 "Security signatures are required",
17942 "Security signatures are not required"
17944 static const true_false_string tfs_smb_flags2_long_names_used
= {
17945 "Path names in request are long file names",
17946 "Path names in request are not long file names"
17948 static const true_false_string tfs_smb_flags2_reparse_path
= {
17949 "The request uses a @GMT reparse path",
17950 "The request does not use a @GMT reparse path"
17952 static const true_false_string tfs_smb_flags2_esn
= {
17953 "Extended security negotiation is supported",
17954 "Extended security negotiation is not supported"
17956 static const true_false_string tfs_smb_flags2_dfs
= {
17957 "Resolve pathnames with Dfs",
17958 "Don't resolve pathnames with Dfs"
17960 static const true_false_string tfs_smb_flags2_roe
= {
17961 "Permit reads if execute-only",
17962 "Don't permit reads if execute-only"
17964 static const true_false_string tfs_smb_flags2_nt_error
= {
17965 "Error codes are NT error codes",
17966 "Error codes are DOS error codes"
17968 static const true_false_string tfs_smb_flags2_string
= {
17969 "Strings are Unicode",
17970 "Strings are ASCII"
17973 dissect_smb_flags2(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
)
17975 static int * const flags
[] = {
17976 &hf_smb_flags2_string
,
17977 &hf_smb_flags2_nt_error
,
17978 &hf_smb_flags2_roe
,
17979 &hf_smb_flags2_dfs
,
17980 &hf_smb_flags2_esn
,
17981 &hf_smb_flags2_reparse_path
,
17982 &hf_smb_flags2_long_names_used
,
17983 &hf_smb_flags2_sec_sig_required
,
17984 &hf_smb_flags2_compressed
,
17985 &hf_smb_flags2_sec_sig
,
17987 &hf_smb_flags2_long_names_allowed
,
17991 proto_tree_add_bitmask(parent_tree
, tvb
, offset
, hf_smb_flags2
, ett_smb_flags2
, flags
, ENC_LITTLE_ENDIAN
);
17999 #define SMB_FLAGS_DIRN 0x80
18003 dissect_smb(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
, void* data _U_
)
18007 proto_tree
*tree
, *htree
;
18008 proto_item
*tmp_item
= NULL
;
18012 smb_saved_info_t
*sip
= NULL
;
18013 smb_saved_info_key_t key
;
18014 smb_saved_info_key_t
*new_key
;
18015 uint8_t errclass
= 0;
18016 uint16_t errcode
= 0;
18018 conversation_t
*conversation
;
18019 nstime_t t
, deltat
;
18020 smb_transact2_info_t
*t2i
= NULL
;
18021 bool remove
= true;
18023 si
= wmem_new0(pinfo
->pool
, smb_info_t
);
18024 top_tree_global
= parent_tree
;
18026 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "SMB");
18027 col_clear(pinfo
->cinfo
, COL_INFO
);
18029 /* start off using the local variable, we will allocate a new one if we
18031 si
->cmd
= tvb_get_uint8(tvb
, offset
+4);
18032 flags
= tvb_get_uint8(tvb
, offset
+9);
18034 * XXX - in some SMB-over-OSI-transport and SMB-over-Vines traffic,
18035 * the direction flag appears never to be set, even for what appear
18036 * to be replies. Do some SMB servers fail to set that flag,
18037 * under the assumption that the client knows it's a reply because
18040 si
->request
= !(flags
&SMB_FLAGS_DIRN
);
18041 flags2
= tvb_get_letohs(tvb
, offset
+10);
18042 if (flags2
& 0x8000) {
18043 si
->unicode
= true; /* Mark them as Unicode */
18045 si
->unicode
= false;
18047 si
->tid
= tvb_get_letohs(tvb
, offset
+24);
18048 si
->pid
= tvb_get_letohs(tvb
, offset
+26);
18049 si
->uid
= tvb_get_letohs(tvb
, offset
+28);
18050 si
->mid
= tvb_get_letohs(tvb
, offset
+30);
18051 pid_mid
= (si
->pid
<< 16) | si
->mid
;
18052 si
->info_level
= -1;
18053 si
->info_count
= -1;
18055 item
= proto_tree_add_item(parent_tree
, proto_smb
, tvb
, offset
,
18057 tree
= proto_item_add_subtree(item
, ett_smb
);
18059 htree
= proto_tree_add_subtree(tree
, tvb
, offset
, 32,
18060 ett_smb_hdr
, NULL
, "SMB Header");
18063 proto_tree_add_uint_format_value(htree
, hf_smb_server_component
, tvb
, offset
, 4, tvb_get_letohl(tvb
, offset
), "SMB");
18064 offset
+= 4; /* Skip the marker */
18066 /* find which conversation we are part of and get the tables for that
18068 conversation
= find_or_create_conversation(pinfo
);
18069 /* see if we already have the smb data for this conversation */
18070 si
->ct
= (conv_tables_t
*)conversation_get_proto_data(conversation
, proto_smb
);
18072 /* No, not yet. create it and attach it to the conversation */
18073 si
->ct
= g_new(conv_tables_t
, 1);
18075 conv_tables
= g_slist_prepend(conv_tables
, si
->ct
);
18076 si
->ct
->matched
= g_hash_table_new(smb_saved_info_hash_matched
,
18077 smb_saved_info_equal_matched
);
18078 si
->ct
->unmatched
= g_hash_table_new(smb_saved_info_hash_unmatched
,
18079 smb_saved_info_equal_unmatched
);
18080 /* We used the same key format as the unmatched entries */
18081 si
->ct
->primaries
= g_hash_table_new(
18082 smb_saved_info_hash_unmatched
,
18083 smb_saved_info_equal_unmatched
);
18084 si
->ct
->tid_service
= g_hash_table_new(
18085 smb_saved_info_hash_unmatched
,
18086 smb_saved_info_equal_unmatched
);
18087 si
->ct
->raw_ntlmssp
= 0;
18089 si
->ct
->fid_tree
= wmem_tree_new(wmem_file_scope());
18090 si
->ct
->tid_tree
= wmem_tree_new(wmem_file_scope());
18091 si
->ct
->uid_tree
= wmem_tree_new(wmem_file_scope());
18092 /* Initialize the GSL_fid_info for this ct */
18093 si
->ct
->GSL_fid_info
= NULL
;
18094 conversation_add_proto_data(conversation
, proto_smb
, si
->ct
);
18101 && (si
->tid
== 0) ) {
18102 /* this is a broadcast SMB packet, there will not be a reply.
18103 We don't need to do anything
18106 } else if (si
->cmd
== SMB_COM_NT_CANCEL
) /* NT Cancel */
18107 /* Ok, we got a special request type. This request is an
18108 an NT Cancel. We don't expect any responses to this packet.
18109 Anyway, we want to remembe0 this packet somehow and
18110 remember which original request it is associated with so
18111 we can say nice things such as "This is a Cancellation to
18112 the request in frame x", but we don't want the
18113 request/response matching to get messed up.
18115 The only thing we do in this case is trying to find which original
18116 request we match with and insert an entry for this "special"
18117 request for later reference. We continue to reference the original
18118 requests smb_saved_info_t but we don't touch it or change anything
18121 si
->unidir
= true; /*we don't expect an answer to this one*/
18123 else if ((si
->cmd
== SMB_COM_TRANSACTION_SECONDARY
) /* Transaction Secondary */
18124 || (si
->cmd
== SMB_COM_TRANSACTION2_SECONDARY
) /* Transaction2 Secondary */
18125 || (si
->cmd
== SMB_COM_NT_TRANSACT_SECONDARY
)) { /* NT Transaction Secondary */
18126 /* In the case of secondariy requests there is response to the initial request
18127 followed by one or more secondary *requests* then another response. Each
18128 of the secondaries should point to the second response as the response
18129 and have "Response in: <second response's frame number>".
18131 si
->unidir
= false;
18133 if (!pinfo
->fd
->visited
) {
18134 /* try to find which original call we match and if we
18135 find it add us to the matched table. Don't touch
18136 anything else since we don't want this one to mess
18137 up the request/response matching. We still consider
18138 the initial call the real request and this is only
18139 some sort of continuation.
18141 /* we only check the unmatched table and assume that the
18142 last seen MID matching ours is the right one.
18143 This can fail but is better than nothing
18145 sip
= (smb_saved_info_t
*)g_hash_table_lookup(si
->ct
->unmatched
, GUINT_TO_POINTER(pid_mid
));
18147 new_key
= wmem_new(wmem_file_scope(), smb_saved_info_key_t
);
18148 new_key
->frame
= pinfo
->num
;
18149 new_key
->pid_mid
= pid_mid
;
18151 * With secondary requests there is a command such as
18152 * SET_FILE_INFO, an immediate response, one or more
18153 * secondaries containing the remaining data, followed by
18154 * another response. Each secondary shows command as the
18155 * request, and the *second* response as the response.
18156 * The second request shows the command as the request.
18157 * Finally the command request shows the second response
18158 * as the response frame. We need to set sip->frame_res = 0
18159 * so that the second response will be matched to each
18160 * secondary request.
18162 if ((si
->cmd
== SMB_COM_TRANSACTION_SECONDARY
) ||
18163 (si
->cmd
== SMB_COM_TRANSACTION2_SECONDARY
) ||
18164 (si
->cmd
== SMB_COM_NT_TRANSACT_SECONDARY
)) {
18165 sip
->frame_res
= 0;
18167 g_hash_table_insert(si
->ct
->matched
, new_key
, sip
);
18169 if ((si
->cmd
== SMB_COM_TRANSACTION_SECONDARY
) ||
18170 (si
->cmd
== SMB_COM_TRANSACTION2_SECONDARY
) ||
18171 (si
->cmd
== SMB_COM_NT_TRANSACT_SECONDARY
)) {
18172 sip
= (smb_saved_info_t
*)g_hash_table_lookup(si
->ct
->primaries
, GUINT_TO_POINTER(pid_mid
));
18176 /* we have seen this packet before; check the
18179 key
.frame
= pinfo
->num
;
18180 key
.pid_mid
= pid_mid
;
18181 sip
= (smb_saved_info_t
*)g_hash_table_lookup(si
->ct
->matched
, &key
);
18185 Too bad, unfortunately there is not really much we can
18186 do now since this means that we never saw the initial
18193 if (sip
&& sip
->frame_req
) {
18195 case SMB_COM_NT_CANCEL
:
18196 tmp_item
= proto_tree_add_uint(htree
, hf_smb_cancel_to
,
18197 tvb
, 0, 0, sip
->frame_req
);
18198 proto_item_set_generated(tmp_item
);
18200 case SMB_COM_TRANSACTION_SECONDARY
:
18201 case SMB_COM_TRANSACTION2_SECONDARY
:
18202 case SMB_COM_NT_TRANSACT_SECONDARY
:
18203 tmp_item
= proto_tree_add_uint(htree
, hf_smb_continuation_of
,
18204 tvb
, 0, 0, sip
->frame_req
);
18205 proto_item_set_generated(tmp_item
);
18210 case SMB_COM_NT_CANCEL
:
18211 proto_tree_add_uint_format_value(htree
, hf_smb_cancel_to
, tvb
, 0, 0, 0, "<unknown frame>");
18213 case SMB_COM_TRANSACTION_SECONDARY
:
18214 case SMB_COM_TRANSACTION2_SECONDARY
:
18215 case SMB_COM_NT_TRANSACT_SECONDARY
:
18216 proto_tree_add_uint_format_value(htree
, hf_smb_continuation_of
, tvb
, 0, 0, 0, "<unknown frame>");
18220 } else { /* normal bidirectional request or response */
18221 si
->unidir
= false;
18223 if (!pinfo
->fd
->visited
) {
18224 /* first see if we find an unmatched smb "equal" to
18227 sip
= (smb_saved_info_t
*)g_hash_table_lookup(si
->ct
->unmatched
, GUINT_TO_POINTER(pid_mid
));
18229 bool cmd_match
= false;
18232 * Make sure the SMB we found was the
18233 * same command, or a different command
18234 * that's another valid type of reply
18237 if (si
->cmd
== sip
->cmd
) {
18240 else if (si
->cmd
== SMB_COM_NT_CANCEL
) {
18243 else if ((si
->cmd
== SMB_COM_TRANSACTION_SECONDARY
)
18244 && (sip
->cmd
== SMB_COM_TRANSACTION
)) {
18247 else if ((si
->cmd
== SMB_COM_TRANSACTION2_SECONDARY
)
18248 && (sip
->cmd
== SMB_COM_TRANSACTION2
)) {
18251 else if ((si
->cmd
== SMB_COM_NT_TRANSACT_SECONDARY
)
18252 && (sip
->cmd
== SMB_COM_NT_TRANSACT
)) {
18256 if ( (si
->request
) || (!cmd_match
) ) {
18257 /* We are processing an SMB request but there was already
18258 another "identical" smb request we had not matched yet.
18259 This must mean that either we have a retransmission or that the
18260 response to the previous one was lost and the client has reused
18261 the MID for this conversation. In either case it's not much more
18262 we can do than forget the old request and concentrate on the
18263 present one instead.
18265 We also do this cleanup if we see that the cmd in the original
18266 request in sip->cmd is not compatible with the current cmd.
18267 This is to prevent matching errors such as if there were two
18268 SMBs of different cmds but with identical MID and PID values and
18269 if wireshark lost the first reply and the second request.
18271 g_hash_table_remove(si
->ct
->unmatched
, GUINT_TO_POINTER(pid_mid
));
18272 sip
= NULL
; /* XXX should free it as well */
18274 /* we have found a response to some
18275 request we have seen earlier.
18276 What we do now depends on whether
18277 this is the first response to that
18278 request we see (id frame_res == 0) or
18279 if it's a response to a request
18280 for which we've seen an earlier
18281 response that's continued.
18283 if ((sip
->frame_res
== 0) ||
18284 (sip
->flags
& SMB_SIF_IS_CONTINUED
)) {
18285 /* OK, it is the first response
18286 we have seen to this packet,
18287 or it's a continuation of
18288 a response we've seen. */
18289 sip
->frame_res
= pinfo
->num
;
18290 new_key
= wmem_new(wmem_file_scope(), smb_saved_info_key_t
);
18291 new_key
->frame
= sip
->frame_res
;
18292 new_key
->pid_mid
= pid_mid
;
18293 g_hash_table_insert(si
->ct
->matched
, new_key
, sip
);
18294 /* We remove the entry for unmatched since we have found a match.
18295 * We have to do this since the MID value wraps so quickly
18296 * and if there is packetloss in the trace (maybe due to large holes
18297 * created by a sniffer device not being able to keep up
18298 * with the line rate.
18299 * There is a real possibility that the following would occur which is painful :
18300 * 1, -> Request MID:5
18301 * 2, <- Response MID:5
18302 * 3, -> Request MID:5 (missing from capture)
18303 * 4, <- Response MID:5
18304 * We DON'T want #4 to be presented as a response to #1
18306 /* Prevent "FIND_FIRST2 <unknown>", "FIND_NEXT2 <unknown>"
18307 * "SET_FILE_INFO <unknown>" INFO and "SET_PATH_INFO <unknown>" responses
18308 * when there are multiple responses to the same request. And prevent
18309 * "Continuation of: <unknown frame>" in Trans2 Secondary requests.
18310 * We leave the pid_mid of these responses and requests in the unmatched
18311 * table until all of them have been fully processed.
18313 if (sip
->extra_info_type
== SMB_EI_T2I
) {
18314 t2i
= (smb_transact2_info_t
*)sip
->extra_info
;
18316 /* FIND_FIRST2 or FIND_NEXT2 or
18317 * SET_FILE INFO or SET_PATH_INFO
18319 if (t2i
->subcmd
== 0x0001 || t2i
->subcmd
== 0x0002 ||
18320 t2i
->subcmd
== 0x0006 || t2i
->subcmd
== 0x0008) {
18325 if (si
->cmd
== SMB_COM_TRANSACTION2_SECONDARY
||
18326 si
->cmd
== SMB_COM_TRANSACTION_SECONDARY
||
18327 si
->cmd
== SMB_COM_NT_TRANSACT_SECONDARY
) {
18331 g_hash_table_remove(si
->ct
->unmatched
, GUINT_TO_POINTER(pid_mid
));
18335 /* We have already seen another response to this MID.
18341 if ((si
->cmd
== SMB_COM_TRANSACTION
) ||
18342 (si
->cmd
== SMB_COM_TRANSACTION2
) ||
18343 (si
->cmd
== SMB_COM_NT_TRANSACT
)) {
18344 sip
= (smb_saved_info_t
*)g_hash_table_lookup(si
->ct
->primaries
, GUINT_TO_POINTER(pid_mid
));
18349 sip
= wmem_new(wmem_file_scope(), smb_saved_info_t
);
18350 sip
->frame_req
= pinfo
->num
;
18351 sip
->frame_res
= 0;
18352 sip
->req_time
= pinfo
->abs_ts
;
18354 if (g_hash_table_lookup(si
->ct
->tid_service
, GUINT_TO_POINTER(si
->tid
))
18355 == (void *)TID_IPC
) {
18356 sip
->flags
|= SMB_SIF_TID_IS_IPC
;
18358 sip
->cmd
= si
->cmd
;
18359 sip
->extra_info
= NULL
;
18360 sip
->extra_info_type
= SMB_EI_NONE
;
18362 sip
->fid_seen_in_request
= 0;
18363 g_hash_table_insert(si
->ct
->unmatched
, GUINT_TO_POINTER(pid_mid
), sip
);
18364 new_key
= wmem_new(wmem_file_scope(), smb_saved_info_key_t
);
18365 new_key
->frame
= sip
->frame_req
;
18366 new_key
->pid_mid
= pid_mid
;
18367 g_hash_table_insert(si
->ct
->matched
, new_key
, sip
);
18369 /* If it is a TRANSACT cmd, insert in hash */
18370 if ((si
->cmd
== SMB_COM_TRANSACTION
) ||
18371 (si
->cmd
== SMB_COM_TRANSACTION2
) ||
18372 (si
->cmd
== SMB_COM_NT_TRANSACT
)) {
18373 g_hash_table_insert(si
->ct
->primaries
, GUINT_TO_POINTER(pid_mid
), sip
);
18377 /* we have seen this packet before; check the
18379 If we haven't yet seen the reply, we won't
18380 find the info for it; we don't need it, as
18381 we only use it to save information, and, as
18382 we've seen this packet before, we've already
18383 saved the information.
18385 key
.frame
= pinfo
->num
;
18386 key
.pid_mid
= pid_mid
;
18387 sip
= (smb_saved_info_t
*)g_hash_table_lookup(si
->ct
->matched
, &key
);
18392 * Pass the "sip" on to subdissectors through "si".
18398 * Put in fields for the frame number of the frame to which
18399 * this is a response or the frame with the response to this
18400 * frame - if we know the frame number (i.e., it's not 0).
18403 if (sip
->frame_res
!= 0) {
18404 tmp_item
= proto_tree_add_uint(htree
, hf_smb_response_in
, tvb
, 0, 0, sip
->frame_res
);
18405 proto_item_set_generated(tmp_item
);
18408 if (sip
->frame_req
!= 0) {
18409 tmp_item
= proto_tree_add_uint(htree
, hf_smb_response_to
, tvb
, 0, 0, sip
->frame_req
);
18410 proto_item_set_generated(tmp_item
);
18412 nstime_delta(&deltat
, &t
, &sip
->req_time
);
18413 tmp_item
= proto_tree_add_time(htree
, hf_smb_time
, tvb
,
18415 proto_item_set_generated(tmp_item
);
18421 proto_tree_add_uint(htree
, hf_smb_cmd
, tvb
, offset
, 1, si
->cmd
);
18424 if (flags2
& 0x4000) {
18425 /* handle NT 32 bit error code */
18427 si
->nt_status
= tvb_get_letohl(tvb
, offset
);
18429 proto_tree_add_item(htree
, hf_smb_nt_status
, tvb
, offset
, 4,
18430 ENC_LITTLE_ENDIAN
);
18434 /* handle DOS error code & class */
18435 errclass
= tvb_get_uint8(tvb
, offset
);
18436 proto_tree_add_uint(htree
, hf_smb_error_class
, tvb
, offset
, 1,
18440 /* reserved byte */
18441 proto_tree_add_item(htree
, hf_smb_reserved
, tvb
, offset
, 1, ENC_NA
);
18445 /* XXX - the type of this field depends on the value of
18446 * "errcls", so there is isn't a single value_string array
18447 * fo it, so there can't be a single field for it.
18449 errcode
= tvb_get_letohs(tvb
, offset
);
18450 proto_tree_add_uint_format_value(htree
, hf_smb_error_code
, tvb
,
18451 offset
, 2, errcode
, "%s",
18452 decode_smb_error(errclass
, errcode
));
18457 offset
= dissect_smb_flags(tvb
, htree
, offset
);
18460 offset
= dissect_smb_flags2(tvb
, htree
, offset
);
18465 * http://www.samba.org/samba/ftp/specs/smbpub.txt
18467 * (a text version of "Microsoft Networks SMB FILE SHARING
18468 * PROTOCOL, Document Version 6.0p") says that:
18470 * the first 2 bytes of these 12 bytes are, for NT Create and X,
18471 * the "High Part of PID";
18473 * the next four bytes are reserved;
18475 * the next four bytes are, for SMB-over-IPX (with no
18476 * NetBIOS involved) two bytes of Session ID and two bytes
18477 * of SequenceNumber.
18479 * Network Monitor 2.x dissects the four bytes before the Session ID
18480 * as a "Key", and the two bytes after the SequenceNumber as
18483 * The "High Part of PID" has been seen in calls other than NT
18484 * Create and X, although most of them appear to be I/O on DCE RPC
18485 * pipes opened with the NT Create and X in question.
18487 proto_tree_add_item(htree
, hf_smb_pid_high
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
18490 if ((pinfo
->ptype
== PT_IPX
) &&
18491 ((pinfo
->match_uint
== IPX_SOCKET_NWLINK_SMB_SERVER
) ||
18492 (pinfo
->match_uint
== IPX_SOCKET_NWLINK_SMB_REDIR
) ||
18493 (pinfo
->match_uint
== IPX_SOCKET_NWLINK_SMB_MESSENGER
))) {
18495 * This is SMB-over-IPX.
18496 * XXX - do we have to worry about "sequenced commands",
18497 * as per the Samba document? They say that for
18498 * "unsequenced commands" (with a sequence number of 0),
18499 * the Mid must be unique, but perhaps the Mid doesn't
18500 * have to be unique for sequenced commands. In at least
18501 * one capture with SMB-over-IPX, however, the Mids
18502 * are unique even for sequenced commands.
18505 proto_tree_add_item(htree
, hf_smb_key
, tvb
, offset
, 4,
18506 ENC_LITTLE_ENDIAN
);
18510 proto_tree_add_item(htree
, hf_smb_session_id
, tvb
, offset
, 2,
18511 ENC_LITTLE_ENDIAN
);
18514 /* Sequence number */
18515 proto_tree_add_item(htree
, hf_smb_sequence_num
, tvb
, offset
, 2,
18516 ENC_LITTLE_ENDIAN
);
18520 proto_tree_add_item(htree
, hf_smb_group_id
, tvb
, offset
, 2,
18521 ENC_LITTLE_ENDIAN
);
18525 * According to http://ubiqx.org/cifs/SMB.html#SMB.4.2.1
18526 * and http://ubiqx.org/cifs/SMB.html#SMB.5.5.1 the 8
18527 * bytes after the "High part of PID" are an 8-byte
18530 proto_tree_add_item(htree
, hf_smb_sig
, tvb
, offset
, 8, ENC_NA
);
18533 proto_tree_add_item(htree
, hf_smb_reserved
, tvb
, offset
, 2, ENC_NA
);
18538 * TreeConnectAndX(0x75) is special, here it is the mere fact of
18539 * having a response that means that the share was mapped and we
18542 if (!pinfo
->fd
->visited
&& (si
->cmd
== 0x75) && !si
->request
) {
18543 offset
= dissect_smb_tid(tvb
, pinfo
, htree
, offset
, (uint16_t)si
->tid
, true, false, si
);
18545 offset
= dissect_smb_tid(tvb
, pinfo
, htree
, offset
, (uint16_t)si
->tid
, false, false, si
);
18549 proto_tree_add_uint(htree
, hf_smb_pid
, tvb
, offset
, 2, si
->pid
);
18553 offset
= dissect_smb_uid(tvb
, htree
, offset
, si
);
18556 proto_tree_add_uint(htree
, hf_smb_mid
, tvb
, offset
, 2, si
->mid
);
18559 /* tap the packet before the dissectors are called so we still get
18560 the tap listener called even if there is an exception.
18562 tap_queue_packet(smb_tap
, pinfo
, si
);
18563 dissect_smb_command(tvb
, pinfo
, offset
, tree
, si
->cmd
, true, si
);
18565 /* Append error info from this packet to info string. */
18566 if (!si
->request
) {
18567 if (flags2
& 0x4000) {
18569 * The status is an NT status code; was there
18572 if ((si
->nt_status
& 0xC0000000) == 0xC0000000) {
18577 pinfo
->cinfo
, COL_INFO
, ", Error: %s",
18578 val_to_str_ext(si
->nt_status
, &NT_errors_ext
,
18579 "Unknown (0x%08X)"));
18583 * The status is a DOS error class and code; was
18586 if (errclass
!= SMB_SUCCESS
) {
18591 pinfo
->cinfo
, COL_INFO
, ", Error: %s",
18592 decode_smb_error(errclass
, errcode
));
18596 return tvb_captured_length(tvb
);
18600 dissect_smb_heur(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
, void *data
)
18602 /* must check that this really is a smb packet */
18603 if (tvb_reported_length(tvb
) < 4)
18606 if ( (tvb_get_uint8(tvb
, 0) != 0xff)
18607 || (tvb_get_uint8(tvb
, 1) != 'S')
18608 || (tvb_get_uint8(tvb
, 2) != 'M')
18609 || (tvb_get_uint8(tvb
, 3) != 'B') ) {
18613 dissect_smb(tvb
, pinfo
, parent_tree
, data
);
18618 proto_register_smb(void)
18620 static hf_register_info hf
[] = {
18622 { "SMB Command", "smb.cmd", FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
,
18623 &smb_cmd_vals_ext
, 0x0, NULL
, HFILL
}},
18626 { "AndXCommand", "smb.cmd", FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
,
18627 &smb_cmd_vals_ext
, 0x0, NULL
, HFILL
}},
18629 { &hf_smb_trans2_subcmd
,
18630 { "Subcommand", "smb.trans2.cmd", FT_UINT16
, BASE_HEX
|BASE_EXT_STRING
,
18631 &trans2_cmd_vals_ext
, 0, "Subcommand for TRANSACTION2", HFILL
}},
18633 { &hf_smb_nt_trans_subcmd
,
18634 { "Function", "smb.nt.function", FT_UINT16
, BASE_DEC
|BASE_EXT_STRING
,
18635 &nt_cmd_vals_ext
, 0, "Function for NT Transaction", HFILL
}},
18637 { &hf_smb_word_count
,
18638 { "Word Count (WCT)", "smb.wct", FT_UINT8
, BASE_DEC
,
18639 NULL
, 0x0, "Word Count, count of parameter words", HFILL
}},
18641 { &hf_smb_byte_count
,
18642 { "Byte Count (BCC)", "smb.bcc", FT_UINT16
, BASE_DEC
,
18643 NULL
, 0x0, "Byte Count, count of data bytes", HFILL
}},
18645 { &hf_smb_response_to
,
18646 { "Response to", "smb.response_to", FT_FRAMENUM
, BASE_NONE
,
18647 FRAMENUM_TYPE(FT_FRAMENUM_REQUEST
), 0, "This packet is a response to the packet in this frame", HFILL
}},
18650 { "Time from request", "smb.time", FT_RELATIVE_TIME
, BASE_NONE
,
18651 NULL
, 0, "Time between Request and Response for SMB cmds", HFILL
}},
18653 { &hf_smb_response_in
,
18654 { "Response in", "smb.response_in", FT_FRAMENUM
, BASE_NONE
,
18655 FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE
), 0, "The response to this packet is in this packet", HFILL
}},
18657 { &hf_smb_continuation_of
,
18658 { "Continuation of", "smb.continuation_of", FT_FRAMENUM
, BASE_NONE
,
18659 NULL
, 0, "This packet is a continuation of the packet in this frame", HFILL
}},
18661 { &hf_smb_nt_status
,
18662 { "NT Status", "smb.nt_status", FT_UINT32
, BASE_HEX
| BASE_EXT_STRING
,
18663 &NT_errors_ext
, 0, "NT Status code", HFILL
}},
18665 { &hf_smb_error_class
,
18666 { "Error Class", "smb.error_class", FT_UINT8
, BASE_HEX
,
18667 VALS(errcls_types
), 0, "DOS Error Class", HFILL
}},
18669 { &hf_smb_error_code
,
18670 { "Error Code", "smb.error_code", FT_UINT16
, BASE_HEX
,
18671 NULL
, 0, "DOS Error Code", HFILL
}},
18673 { &hf_smb_reserved
,
18674 { "Reserved", "smb.reserved", FT_BYTES
, BASE_NONE
,
18675 NULL
, 0, "Reserved bytes, must be zero", HFILL
}},
18678 { "Signature", "smb.signature", FT_BYTES
, BASE_NONE
,
18679 NULL
, 0, "Signature bytes", HFILL
}},
18682 { "Key", "smb.key", FT_UINT32
, BASE_HEX
,
18683 NULL
, 0, "SMB-over-IPX Key", HFILL
}},
18685 { &hf_smb_session_id
,
18686 { "Session ID", "smb.sessid", FT_UINT16
, BASE_DEC
,
18687 NULL
, 0, "SMB-over-IPX Session ID", HFILL
}},
18689 { &hf_smb_sequence_num
,
18690 { "Sequence Number", "smb.sequence_num", FT_UINT16
, BASE_DEC
,
18691 NULL
, 0, "SMB-over-IPX Sequence Number", HFILL
}},
18693 { &hf_smb_group_id
,
18694 { "Group ID", "smb.group_id", FT_UINT16
, BASE_DEC
,
18695 NULL
, 0, "SMB-over-IPX Group ID", HFILL
}},
18698 { "Process ID", "smb.pid", FT_UINT16
, BASE_DEC
,
18699 NULL
, 0, NULL
, HFILL
}},
18701 { &hf_smb_pid_high
,
18702 { "Process ID High", "smb.pid.high", FT_UINT16
, BASE_DEC
,
18703 NULL
, 0, "Process ID High Bytes", HFILL
}},
18706 { "Tree ID", "smb.tid", FT_UINT16
, BASE_DEC
,
18707 NULL
, 0, NULL
, HFILL
}},
18710 { "User ID", "smb.uid", FT_UINT16
, BASE_DEC
,
18711 NULL
, 0, NULL
, HFILL
}},
18714 { "Multiplex ID", "smb.mid", FT_UINT16
, BASE_DEC
,
18715 NULL
, 0, NULL
, HFILL
}},
18718 { "Flags", "smb.flags", FT_UINT8
, BASE_HEX
,
18719 NULL
, 0x0, NULL
, HFILL
}},
18721 { &hf_smb_flags_lock
,
18722 { "Lock and Read", "smb.flags.lock", FT_BOOLEAN
, 8,
18723 TFS(&tfs_smb_flags_lock
), 0x01, "Are Lock&Read and Write&Unlock operations supported?", HFILL
}},
18725 { &hf_smb_flags_receive_buffer
,
18726 { "Receive Buffer Posted", "smb.flags.receive_buffer", FT_BOOLEAN
, 8,
18727 TFS(&tfs_smb_flags_receive_buffer
), 0x02, "Have receive buffers been reported?", HFILL
}},
18729 { &hf_smb_flags_caseless
,
18730 { "Case Sensitivity", "smb.flags.caseless", FT_BOOLEAN
, 8,
18731 TFS(&tfs_smb_flags_caseless
), 0x08, "Are pathnames caseless or casesensitive?", HFILL
}},
18733 { &hf_smb_flags_canon
,
18734 { "Canonicalized Pathnames", "smb.flags.canon", FT_BOOLEAN
, 8,
18735 TFS(&tfs_smb_flags_canon
), 0x10, "Are pathnames canonicalized?", HFILL
}},
18737 { &hf_smb_flags_oplock
,
18738 { "Oplocks", "smb.flags.oplock", FT_BOOLEAN
, 8,
18739 TFS(&tfs_smb_flags_oplock
), 0x20, "Is an oplock requested/granted?", HFILL
}},
18741 { &hf_smb_flags_notify
,
18742 { "Notify", "smb.flags.notify", FT_BOOLEAN
, 8,
18743 TFS(&tfs_smb_flags_notify
), 0x40, "Notify on open or all?", HFILL
}},
18745 { &hf_smb_flags_response
,
18746 { "Request/Response", "smb.flags.response", FT_BOOLEAN
, 8,
18747 TFS(&tfs_smb_flags_response
), 0x80, "Is this a request or a response?", HFILL
}},
18750 { "Flags2", "smb.flags2", FT_UINT16
, BASE_HEX
,
18751 NULL
, 0x0, NULL
, HFILL
}},
18753 { &hf_smb_flags2_long_names_allowed
,
18754 { "Long Names Allowed", "smb.flags2.long_names_allowed", FT_BOOLEAN
, 16,
18755 TFS(&tfs_smb_flags2_long_names_allowed
), 0x0001, "Are long file names allowed in the response?", HFILL
}},
18757 { &hf_smb_flags2_ea
,
18758 { "Extended Attributes", "smb.flags2.ea", FT_BOOLEAN
, 16,
18759 TFS(&tfs_smb_flags2_ea
), 0x0002, "Are extended attributes supported?", HFILL
}},
18761 { &hf_smb_flags2_sec_sig
,
18762 { "Security Signatures", "smb.flags2.sec_sig", FT_BOOLEAN
, 16,
18763 TFS(&tfs_smb_flags2_sec_sig
), 0x0004, "Are security signatures supported?", HFILL
}},
18765 { &hf_smb_flags2_compressed
,
18766 { "Compressed", "smb.flags2.compressed", FT_BOOLEAN
, 16,
18767 TFS(&tfs_smb_flags2_compressed
), 0x0008, "Is compression requested?", HFILL
}},
18769 { &hf_smb_flags2_sec_sig_required
,
18770 { "Security Signatures Required", "smb.flags2.sec_sig_required", FT_BOOLEAN
, 16,
18771 TFS(&tfs_smb_flags2_sec_sig_required
), 0x0010, "Are security signatures required?", HFILL
}},
18773 { &hf_smb_flags2_long_names_used
,
18774 { "Long Names Used", "smb.flags2.long_names_used", FT_BOOLEAN
, 16,
18775 TFS(&tfs_smb_flags2_long_names_used
), 0x0040, "Are pathnames in this request long file names?", HFILL
}},
18777 { &hf_smb_flags2_reparse_path
,
18778 { "Reparse Path", "smb.flags2.reparse_path", FT_BOOLEAN
, 16,
18779 TFS(&tfs_smb_flags2_reparse_path
), 0x0400, "The request uses a @GMT reparse path", HFILL
}},
18781 { &hf_smb_flags2_esn
,
18782 { "Extended Security Negotiation", "smb.flags2.esn", FT_BOOLEAN
, 16,
18783 TFS(&tfs_smb_flags2_esn
), 0x0800, "Is extended security negotiation supported?", HFILL
}},
18785 { &hf_smb_flags2_dfs
,
18786 { "Dfs", "smb.flags2.dfs", FT_BOOLEAN
, 16,
18787 TFS(&tfs_smb_flags2_dfs
), 0x1000, "Can pathnames be resolved using Dfs?", HFILL
}},
18789 { &hf_smb_flags2_roe
,
18790 { "Execute-only Reads", "smb.flags2.roe", FT_BOOLEAN
, 16,
18791 TFS(&tfs_smb_flags2_roe
), 0x2000, "Will reads be allowed for execute-only files?", HFILL
}},
18793 { &hf_smb_flags2_nt_error
,
18794 { "Error Code Type", "smb.flags2.nt_error", FT_BOOLEAN
, 16,
18795 TFS(&tfs_smb_flags2_nt_error
), 0x4000, "Are error codes NT or DOS format?", HFILL
}},
18797 { &hf_smb_flags2_string
,
18798 { "Unicode Strings", "smb.flags2.string", FT_BOOLEAN
, 16,
18799 TFS(&tfs_smb_flags2_string
), 0x8000, "Are strings ASCII or Unicode?", HFILL
}},
18801 { &hf_smb_buffer_format
,
18802 { "Buffer Format", "smb.buffer_format", FT_UINT8
, BASE_DEC
,
18803 VALS(buffer_format_vals
), 0x0, "Buffer Format, type of buffer", HFILL
}},
18806 { "Dialect", "smb.dialect", FT_STRING
, BASE_NONE
,
18807 NULL
, 0x0, NULL
, HFILL
}},
18809 { &hf_smb_dialect_name
,
18810 { "Name", "smb.dialect.name", FT_STRING
, BASE_NONE
,
18811 NULL
, 0, "Name of dialect", HFILL
}},
18813 { &hf_smb_dialect_index
,
18814 { "Selected Index", "smb.dialect.index", FT_UINT16
, BASE_DEC
,
18815 NULL
, 0, "Index of selected dialect", HFILL
}},
18817 { &hf_smb_max_trans_buf_size
,
18818 { "Max Buffer Size", "smb.max_bufsize", FT_UINT32
, BASE_DEC
,
18819 NULL
, 0, "Maximum transmit buffer size", HFILL
}},
18821 { &hf_smb_max_mpx_count
,
18822 { "Max Mpx Count", "smb.max_mpx_count", FT_UINT16
, BASE_DEC
,
18823 NULL
, 0, "Maximum pending multiplexed requests", HFILL
}},
18825 { &hf_smb_max_vcs_num
,
18826 { "Max VCs", "smb.max_vcs", FT_UINT16
, BASE_DEC
,
18827 NULL
, 0, "Maximum VCs between client and server", HFILL
}},
18829 { &hf_smb_session_key
,
18830 { "Session Key", "smb.session_key", FT_UINT32
, BASE_HEX
,
18831 NULL
, 0, "Unique token identifying this session", HFILL
}},
18833 { &hf_smb_server_timezone
,
18834 { "Server Time Zone", "smb.server_timezone", FT_INT16
, BASE_DEC
,
18835 NULL
, 0, "Current timezone at server.", HFILL
}},
18837 { &hf_smb_challenge_length
,
18838 { "Challenge Length", "smb.challenge_length", FT_UINT16
, BASE_DEC
,
18839 NULL
, 0, "Challenge_length (must be 0 if not LM2.1 dialect)", HFILL
}},
18841 { &hf_smb_challenge
,
18842 { "Challenge", "smb.challenge", FT_BYTES
, BASE_NONE
,
18843 NULL
, 0, "Challenge Data (for LM2.1 dialect)", HFILL
}},
18845 { &hf_smb_primary_domain
,
18846 { "Primary Domain", "smb.primary_domain", FT_STRING
, BASE_NONE
,
18847 NULL
, 0, "The server's primary domain", HFILL
}},
18850 { "Server", "smb.server", FT_STRING
, BASE_NONE
,
18851 NULL
, 0, "The name of the DC/server", HFILL
}},
18853 { &hf_smb_max_raw_buf_size
,
18854 { "Max Raw Buffer", "smb.max_raw", FT_UINT32
, BASE_DEC
,
18855 NULL
, 0, "Maximum raw buffer size", HFILL
}},
18857 { &hf_smb_server_guid
,
18858 { "Server GUID", "smb.server_guid", FT_GUID
, BASE_NONE
,
18859 NULL
, 0, "Globally unique identifier for this server", HFILL
}},
18861 { &hf_smb_volume_guid
,
18862 { "Volume GUID", "smb.volume_guid", FT_GUID
, BASE_NONE
,
18863 NULL
, 0, "Globally unique identifier for this volume", HFILL
}},
18865 { &hf_smb_security_blob_len
,
18866 { "Security Blob Length", "smb.security_blob_len", FT_UINT16
, BASE_DEC
,
18867 NULL
, 0, NULL
, HFILL
}},
18869 { &hf_smb_security_blob
,
18870 { "Security Blob", "smb.security_blob", FT_BYTES
, BASE_NONE
,
18871 NULL
, 0, NULL
, HFILL
}},
18874 { "Security Mode", "smb.sm", FT_UINT16
, BASE_HEX
,
18875 NULL
, 0x0, NULL
, HFILL
}},
18877 { &hf_smb_sm_mode16
,
18878 { "Mode", "smb.sm.mode", FT_BOOLEAN
, 16,
18879 TFS(&tfs_sm_mode
), SECURITY_MODE_MODE
, "User or Share security mode?", HFILL
}},
18881 { &hf_smb_sm_password16
,
18882 { "Password", "smb.sm.password", FT_BOOLEAN
, 16,
18883 TFS(&tfs_sm_password
), SECURITY_MODE_PASSWORD
, "Encrypted or plaintext passwords?", HFILL
}},
18886 { "Security Mode", "smb.sm", FT_UINT8
, BASE_HEX
,
18887 NULL
, 0x0, NULL
, HFILL
}},
18890 { "Mode", "smb.sm.mode", FT_BOOLEAN
, 8,
18891 TFS(&tfs_sm_mode
), SECURITY_MODE_MODE
, "User or Share security mode?", HFILL
}},
18893 { &hf_smb_sm_password
,
18894 { "Password", "smb.sm.password", FT_BOOLEAN
, 8,
18895 TFS(&tfs_sm_password
), SECURITY_MODE_PASSWORD
, "Encrypted or plaintext passwords?", HFILL
}},
18897 { &hf_smb_sm_signatures
,
18898 { "Signatures", "smb.sm.signatures", FT_BOOLEAN
, 8,
18899 TFS(&tfs_sm_signatures
), SECURITY_MODE_SIGNATURES
, "Are security signatures enabled?", HFILL
}},
18901 { &hf_smb_sm_sig_required
,
18902 { "Sig Req", "smb.sm.sig_required", FT_BOOLEAN
, 8,
18903 TFS(&tfs_sm_sig_required
), SECURITY_MODE_SIG_REQUIRED
, "Are security signatures required?", HFILL
}},
18906 { "Raw Mode", "smb.rm", FT_UINT16
, BASE_HEX
,
18907 NULL
, 0x0, NULL
, HFILL
}},
18910 { "Read Raw", "smb.rm.read", FT_BOOLEAN
, 16,
18911 TFS(&tfs_rm_read
), RAWMODE_READ
, "Is Read Raw supported?", HFILL
}},
18913 { &hf_smb_rm_write
,
18914 { "Write Raw", "smb.rm.write", FT_BOOLEAN
, 16,
18915 TFS(&tfs_rm_write
), RAWMODE_WRITE
, "Is Write Raw supported?", HFILL
}},
18917 { &hf_smb_server_date_time
,
18918 { "Server Date and Time", "smb.server_date_time", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
18919 NULL
, 0, "Current date and time at server", HFILL
}},
18921 { &hf_smb_server_smb_date
,
18922 { "Server Date", "smb.server_date_time.smb_date", FT_UINT16
, BASE_HEX
,
18923 NULL
, 0, "Current date at server, SMB_DATE format", HFILL
}},
18925 { &hf_smb_server_smb_time
,
18926 { "Server Time", "smb.server_date_time.smb_time", FT_UINT16
, BASE_HEX
,
18927 NULL
, 0, "Current time at server, SMB_TIME format", HFILL
}},
18929 { &hf_smb_server_cap
,
18930 { "Capabilities", "smb.server_cap", FT_UINT32
, BASE_HEX
,
18931 NULL
, 0x0, NULL
, HFILL
}},
18933 { &hf_smb_server_cap_raw_mode
,
18934 { "Raw Mode", "smb.server_cap.raw_mode", FT_BOOLEAN
, 32,
18935 TFS(&tfs_server_cap_raw_mode
), SERVER_CAP_RAW_MODE
, "Are Raw Read and Raw Write supported?", HFILL
}},
18937 { &hf_smb_server_cap_mpx_mode
,
18938 { "MPX Mode", "smb.server_cap.mpx_mode", FT_BOOLEAN
, 32,
18939 TFS(&tfs_server_cap_mpx_mode
), SERVER_CAP_MPX_MODE
, "Are Read Mpx and Write Mpx supported?", HFILL
}},
18941 { &hf_smb_server_cap_unicode
,
18942 { "Unicode", "smb.server_cap.unicode", FT_BOOLEAN
, 32,
18943 TFS(&tfs_server_cap_unicode
), SERVER_CAP_UNICODE
, "Are Unicode strings supported?", HFILL
}},
18945 { &hf_smb_server_cap_large_files
,
18946 { "Large Files", "smb.server_cap.large_files", FT_BOOLEAN
, 32,
18947 TFS(&tfs_server_cap_large_files
), SERVER_CAP_LARGE_FILES
, "Are large files (>4GB) supported?", HFILL
}},
18949 { &hf_smb_server_cap_nt_smbs
,
18950 { "NT SMBs", "smb.server_cap.nt_smbs", FT_BOOLEAN
, 32,
18951 TFS(&tfs_server_cap_nt_smbs
), SERVER_CAP_NT_SMBS
, "Are NT SMBs supported?", HFILL
}},
18953 { &hf_smb_server_cap_rpc_remote_apis
,
18954 { "RPC Remote APIs", "smb.server_cap.rpc_remote_apis", FT_BOOLEAN
, 32,
18955 TFS(&tfs_server_cap_rpc_remote_apis
), SERVER_CAP_RPC_REMOTE_APIS
, "Are RPC Remote APIs supported?", HFILL
}},
18957 { &hf_smb_server_cap_nt_status
,
18958 { "NT Status Codes", "smb.server_cap.nt_status", FT_BOOLEAN
, 32,
18959 TFS(&tfs_server_cap_nt_status
), SERVER_CAP_STATUS32
, "Are NT Status Codes supported?", HFILL
}},
18961 { &hf_smb_server_cap_level_ii_oplocks
,
18962 { "Level 2 Oplocks", "smb.server_cap.level_2_oplocks", FT_BOOLEAN
, 32,
18963 TFS(&tfs_server_cap_level_ii_oplocks
), SERVER_CAP_LEVEL_II_OPLOCKS
, "Are Level 2 oplocks supported?", HFILL
}},
18965 { &hf_smb_server_cap_lock_and_read
,
18966 { "Lock and Read", "smb.server_cap.lock_and_read", FT_BOOLEAN
, 32,
18967 TFS(&tfs_server_cap_lock_and_read
), SERVER_CAP_LOCK_AND_READ
, "Is Lock and Read supported?", HFILL
}},
18969 { &hf_smb_server_cap_nt_find
,
18970 { "NT Find", "smb.server_cap.nt_find", FT_BOOLEAN
, 32,
18971 TFS(&tfs_server_cap_nt_find
), SERVER_CAP_NT_FIND
, "Is NT Find supported?", HFILL
}},
18973 { &hf_smb_server_cap_dfs
,
18974 { "Dfs", "smb.server_cap.dfs", FT_BOOLEAN
, 32,
18975 TFS(&tfs_server_cap_dfs
), SERVER_CAP_DFS
, "Is Dfs supported?", HFILL
}},
18977 { &hf_smb_server_cap_infolevel_passthru
,
18978 { "Infolevel Passthru", "smb.server_cap.infolevel_passthru", FT_BOOLEAN
, 32,
18979 TFS(&tfs_server_cap_infolevel_passthru
), SERVER_CAP_INFOLEVEL_PASSTHRU
, "Is NT information level request passthrough supported?", HFILL
}},
18981 { &hf_smb_server_cap_large_readx
,
18982 { "Large ReadX", "smb.server_cap.large_readx", FT_BOOLEAN
, 32,
18983 TFS(&tfs_server_cap_large_readx
), SERVER_CAP_LARGE_READX
, "Is Large Read andX supported?", HFILL
}},
18985 { &hf_smb_server_cap_large_writex
,
18986 { "Large WriteX", "smb.server_cap.large_writex", FT_BOOLEAN
, 32,
18987 TFS(&tfs_server_cap_large_writex
), SERVER_CAP_LARGE_WRITEX
, "Is Large Write andX supported?", HFILL
}},
18989 { &hf_smb_server_cap_lwio
,
18990 { "LWIO", "smb.server_cap.lwio", FT_BOOLEAN
, 32,
18991 TFS(&tfs_server_cap_lwio
), SERVER_CAP_LWIO
,
18992 "Is IOCTL/FSCTL supported", HFILL
}},
18994 { &hf_smb_server_cap_unix
,
18995 { "UNIX", "smb.server_cap.unix", FT_BOOLEAN
, 32,
18996 TFS(&tfs_server_cap_unix
), SERVER_CAP_UNIX
, "Are UNIX extensions supported?", HFILL
}},
18998 { &hf_smb_server_cap_compressed_data
,
18999 { "Compressed Data", "smb.server_cap.compressed_data", FT_BOOLEAN
, 32,
19000 TFS(&tfs_server_cap_compressed_data
), SERVER_CAP_COMPRESSED_DATA
, "Is compressed data transfer supported?", HFILL
}},
19002 { &hf_smb_server_cap_dynamic_reauth
,
19003 { "Dynamic Reauth", "smb.server_cap.dynamic_reauth", FT_BOOLEAN
, 32,
19004 TFS(&tfs_server_cap_dynamic_reauth
), SERVER_CAP_DYNAMIC_REAUTH
,
19005 "Is dynamic reauth supported?", HFILL
}},
19007 { &hf_smb_server_cap_extended_security
,
19008 { "Extended Security", "smb.server_cap.extended_security", FT_BOOLEAN
, 32,
19009 TFS(&tfs_server_cap_extended_security
), SERVER_CAP_EXTENDED_SECURITY
, "Are Extended security exchanges supported?", HFILL
}},
19011 { &hf_smb_system_time
,
19012 { "System Time", "smb.system.time", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
19013 NULL
, 0, NULL
, HFILL
}},
19015 { &hf_smb_secondaries_will_follow
,
19016 { "Secondaries will follow", "smb.secondaries_will_follow", FT_BYTES
, BASE_NONE
,
19017 NULL
, 0, "Level of interest is Info Set EAs and TDC > DC so SECONDARY reqs will follow", HFILL
}},
19020 { "Unknown Data", "smb.unknown_data", FT_BYTES
, BASE_NONE
,
19021 NULL
, 0, "Unknown Data. Should be implemented by someone", HFILL
}},
19023 { &hf_smb_dir_name
,
19024 { "Directory", "smb.dir_name", FT_STRING
, BASE_NONE
,
19025 NULL
, 0, "SMB Directory Name", HFILL
}},
19027 { &hf_smb_echo_count
,
19028 { "Echo Count", "smb.echo.count", FT_UINT16
, BASE_DEC
,
19029 NULL
, 0, "Number of times to echo data back", HFILL
}},
19031 { &hf_smb_echo_data
,
19032 { "Echo Data", "smb.echo.data", FT_BYTES
, BASE_NONE
,
19033 NULL
, 0, "Data for SMB Echo Request/Response", HFILL
}},
19035 { &hf_smb_echo_seq_num
,
19036 { "Echo Seq Num", "smb.echo.seq_num", FT_UINT16
, BASE_DEC
,
19037 NULL
, 0, "Sequence number for this echo response", HFILL
}},
19039 { &hf_smb_max_buf_size
,
19040 { "Max Buffer", "smb.max_buf", FT_UINT16
, BASE_DEC
,
19041 NULL
, 0, "Max client buffer size", HFILL
}},
19044 { "Path", "smb.path", FT_STRING
, BASE_NONE
,
19045 NULL
, 0, "Path. Server name and share name", HFILL
}},
19048 { "Service", "smb.service", FT_STRING
, BASE_NONE
,
19049 NULL
, 0, "Service name", HFILL
}},
19051 { &hf_smb_password
,
19052 { "Password", "smb.password", FT_BYTES
, BASE_NONE
,
19053 NULL
, 0, NULL
, HFILL
}},
19055 { &hf_smb_ansi_password
,
19056 { "ANSI Password", "smb.ansi_password", FT_BYTES
, BASE_NONE
,
19057 NULL
, 0, NULL
, HFILL
}},
19059 { &hf_smb_unicode_password
,
19060 { "Unicode Password", "smb.unicode_password", FT_BYTES
, BASE_NONE
,
19061 NULL
, 0, NULL
, HFILL
}},
19063 { &hf_smb_move_flags
,
19064 { "Flags", "smb.move.flags", FT_UINT16
, BASE_HEX
,
19065 NULL
, 0x0, NULL
, HFILL
}},
19067 { &hf_smb_move_flags_file
,
19068 { "Must be file", "smb.move.flags.file", FT_BOOLEAN
, 16,
19069 TFS(&tfs_mf_file
), 0x0001, "Must target be a file?", HFILL
}},
19071 { &hf_smb_move_flags_dir
,
19072 { "Must be directory", "smb.move.flags.dir", FT_BOOLEAN
, 16,
19073 TFS(&tfs_mf_dir
), 0x0002, "Must target be a directory?", HFILL
}},
19075 { &hf_smb_move_flags_verify
,
19076 { "Verify writes", "smb.move.flags.verify", FT_BOOLEAN
, 16,
19077 TFS(&tfs_mf_verify
), 0x0010, "Verify all writes?", HFILL
}},
19079 { &hf_smb_files_moved
,
19080 { "Files Moved", "smb.files_moved", FT_UINT16
, BASE_DEC
,
19081 NULL
, 0, "Number of files moved", HFILL
}},
19083 { &hf_smb_copy_flags
,
19084 { "Flags", "smb.copy.flags", FT_UINT16
, BASE_HEX
,
19085 NULL
, 0x0, NULL
, HFILL
}},
19087 { &hf_smb_copy_flags_file
,
19088 { "Must be file", "smb.copy.flags.file", FT_BOOLEAN
, 16,
19089 TFS(&tfs_mf_file
), 0x0001, "Must target be a file?", HFILL
}},
19091 { &hf_smb_copy_flags_dir
,
19092 { "Must be directory", "smb.copy.flags.dir", FT_BOOLEAN
, 16,
19093 TFS(&tfs_mf_dir
), 0x0002, "Must target be a directory?", HFILL
}},
19095 { &hf_smb_copy_flags_dest_mode
,
19096 { "Destination mode", "smb.copy.flags.dest_mode", FT_BOOLEAN
, 16,
19097 TFS(&tfs_cf_mode
), 0x0004, "Is destination in ASCII?", HFILL
}},
19099 { &hf_smb_copy_flags_source_mode
,
19100 { "Source mode", "smb.copy.flags.source_mode", FT_BOOLEAN
, 16,
19101 TFS(&tfs_cf_mode
), 0x0008, "Is source in ASCII?", HFILL
}},
19103 { &hf_smb_copy_flags_verify
,
19104 { "Verify writes", "smb.copy.flags.verify", FT_BOOLEAN
, 16,
19105 TFS(&tfs_mf_verify
), 0x0010, "Verify all writes?", HFILL
}},
19107 { &hf_smb_copy_flags_tree_copy
,
19108 { "Tree copy", "smb.copy.flags.tree_copy", FT_BOOLEAN
, 16,
19109 TFS(&tfs_cf_tree_copy
), 0x0020, "Is copy a tree copy?", HFILL
}},
19111 { &hf_smb_copy_flags_ea_action
,
19112 { "EA action if EAs not supported on dest", "smb.copy.flags.ea_action", FT_BOOLEAN
, 16,
19113 TFS(&tfs_cf_ea_action
), 0x0040, "Fail copy if source file has EAs and dest doesn't support EAs?", HFILL
}},
19116 { "Count", "smb.count", FT_UINT32
, BASE_DEC
,
19117 NULL
, 0, "Count number of items/bytes", HFILL
}},
19119 { &hf_smb_count_low
,
19120 { "Count Low", "smb.count_low", FT_UINT16
, BASE_DEC
,
19121 NULL
, 0, "Count number of items/bytes, Low 16 bits", HFILL
}},
19123 { &hf_smb_count_high
,
19124 { "Count High (multiply with 64K)", "smb.count_high", FT_UINT16
, BASE_DEC
,
19125 NULL
, 0, "Count number of items/bytes, High 16 bits", HFILL
}},
19127 { &hf_smb_file_name
,
19128 { "File Name", "smb.file", FT_STRING
, BASE_NONE
,
19129 NULL
, 0, NULL
, HFILL
}},
19131 { &hf_smb_open_function
,
19132 { "Open Function", "smb.open.function", FT_UINT16
, BASE_HEX
,
19133 NULL
, 0x0, NULL
, HFILL
}},
19135 { &hf_smb_open_function_create
,
19136 { "Create", "smb.open.function.create", FT_BOOLEAN
, 16,
19137 TFS(&tfs_of_create
), 0x0010, "Create file if it doesn't exist?", HFILL
}},
19139 { &hf_smb_open_function_open
,
19140 { "Open", "smb.open.function.open", FT_UINT16
, BASE_DEC
,
19141 VALS(of_open
), 0x0003, "Action to be taken on open if file exists", HFILL
}},
19144 { "FID", "smb.fid", FT_UINT16
, BASE_HEX
,
19145 NULL
, 0, "FID: File ID", HFILL
}},
19147 { &hf_smb_file_attr_16bit
,
19148 { "File Attributes", "smb.file_attribute", FT_UINT16
, BASE_HEX
,
19149 NULL
, 0x0, NULL
, HFILL
}},
19151 { &hf_smb_file_attr_8bit
,
19152 { "File Attributes", "smb.file_attribute", FT_UINT8
, BASE_HEX
,
19153 NULL
, 0x0, NULL
, HFILL
}},
19155 { &hf_smb_file_attr_read_only_16bit
,
19156 { "Read Only", "smb.file_attribute.read_only", FT_BOOLEAN
, 16,
19157 TFS(&tfs_file_attribute_read_only
), SMB_FILE_ATTRIBUTE_READ_ONLY
, "READ ONLY file attribute", HFILL
}},
19159 { &hf_smb_file_attr_read_only_8bit
,
19160 { "Read Only", "smb.file_attribute.read_only", FT_BOOLEAN
, 8,
19161 TFS(&tfs_file_attribute_read_only
), SMB_FILE_ATTRIBUTE_READ_ONLY
, "READ ONLY file attribute", HFILL
}},
19163 { &hf_smb_file_attr_hidden_16bit
,
19164 { "Hidden", "smb.file_attribute.hidden", FT_BOOLEAN
, 16,
19165 TFS(&tfs_file_attribute_hidden
), SMB_FILE_ATTRIBUTE_HIDDEN
, "HIDDEN file attribute", HFILL
}},
19167 { &hf_smb_file_attr_hidden_8bit
,
19168 { "Hidden", "smb.file_attribute.hidden", FT_BOOLEAN
, 8,
19169 TFS(&tfs_file_attribute_hidden
), SMB_FILE_ATTRIBUTE_HIDDEN
, "HIDDEN file attribute", HFILL
}},
19171 { &hf_smb_file_attr_system_16bit
,
19172 { "System", "smb.file_attribute.system", FT_BOOLEAN
, 16,
19173 TFS(&tfs_file_attribute_system
), SMB_FILE_ATTRIBUTE_SYSTEM
, "SYSTEM file attribute", HFILL
}},
19175 { &hf_smb_file_attr_system_8bit
,
19176 { "System", "smb.file_attribute.system", FT_BOOLEAN
, 8,
19177 TFS(&tfs_file_attribute_system
), SMB_FILE_ATTRIBUTE_SYSTEM
, "SYSTEM file attribute", HFILL
}},
19179 { &hf_smb_file_attr_volume_16bit
,
19180 { "Volume ID", "smb.file_attribute.volume", FT_BOOLEAN
, 16,
19181 TFS(&tfs_file_attribute_volume
), SMB_FILE_ATTRIBUTE_VOLUME
, "VOLUME file attribute", HFILL
}},
19183 { &hf_smb_file_attr_volume_8bit
,
19184 { "Volume ID", "smb.file_attribute.volume", FT_BOOLEAN
, 8,
19185 TFS(&tfs_file_attribute_volume
), SMB_FILE_ATTRIBUTE_VOLUME
, "VOLUME ID file attribute", HFILL
}},
19187 { &hf_smb_file_attr_directory_16bit
,
19188 { "Directory", "smb.file_attribute.directory", FT_BOOLEAN
, 16,
19189 TFS(&tfs_file_attribute_directory
), SMB_FILE_ATTRIBUTE_DIRECTORY
, "DIRECTORY file attribute", HFILL
}},
19191 { &hf_smb_file_attr_directory_8bit
,
19192 { "Directory", "smb.file_attribute.directory", FT_BOOLEAN
, 8,
19193 TFS(&tfs_file_attribute_directory
), SMB_FILE_ATTRIBUTE_DIRECTORY
, "DIRECTORY file attribute", HFILL
}},
19195 { &hf_smb_file_attr_archive_16bit
,
19196 { "Archive", "smb.file_attribute.archive", FT_BOOLEAN
, 16,
19197 TFS(&tfs_file_attribute_archive
), SMB_FILE_ATTRIBUTE_ARCHIVE
, "ARCHIVE file attribute", HFILL
}},
19199 { &hf_smb_file_attr_archive_8bit
,
19200 { "Archive", "smb.file_attribute.archive", FT_BOOLEAN
, 8,
19201 TFS(&tfs_file_attribute_archive
), SMB_FILE_ATTRIBUTE_ARCHIVE
, "ARCHIVE file attribute", HFILL
}},
19204 { &hf_smb_file_attr_device
,
19205 { "Device", "smb.file_attribute.device", FT_BOOLEAN
, 16,
19206 TFS(&tfs_file_attribute_device
), SMB_FILE_ATTRIBUTE_DEVICE
, "Is this file a device?", HFILL
}},
19208 { &hf_smb_file_attr_normal
,
19209 { "Normal", "smb.file_attribute.normal", FT_BOOLEAN
, 16,
19210 TFS(&tfs_file_attribute_normal
), SMB_FILE_ATTRIBUTE_NORMAL
, "Is this a normal file?", HFILL
}},
19212 { &hf_smb_file_attr_temporary
,
19213 { "Temporary", "smb.file_attribute.temporary", FT_BOOLEAN
, 16,
19214 TFS(&tfs_file_attribute_temporary
), SMB_FILE_ATTRIBUTE_TEMPORARY
, "Is this a temporary file?", HFILL
}},
19216 { &hf_smb_file_attr_sparse
,
19217 { "Sparse", "smb.file_attribute.sparse", FT_BOOLEAN
, 16,
19218 TFS(&tfs_file_attribute_sparse
), SMB_FILE_ATTRIBUTE_SPARSE
, "Is this a sparse file?", HFILL
}},
19220 { &hf_smb_file_attr_reparse
,
19221 { "Reparse Point", "smb.file_attribute.reparse", FT_BOOLEAN
, 16,
19222 TFS(&tfs_file_attribute_reparse
), SMB_FILE_ATTRIBUTE_REPARSE
, "Does this file have an associated reparse point?", HFILL
}},
19224 { &hf_smb_file_attr_compressed
,
19225 { "Compressed", "smb.file_attribute.compressed", FT_BOOLEAN
, 16,
19226 TFS(&tfs_file_attribute_compressed
), SMB_FILE_ATTRIBUTE_COMPRESSED
, "Is this file compressed?", HFILL
}},
19228 { &hf_smb_file_attr_offline
,
19229 { "Offline", "smb.file_attribute.offline", FT_BOOLEAN
, 16,
19230 TFS(&tfs_file_attribute_offline
), SMB_FILE_ATTRIBUTE_OFFLINE
, "Is this file offline?", HFILL
}},
19232 { &hf_smb_file_attr_not_content_indexed
,
19233 { "Content Indexed", "smb.file_attribute.not_content_indexed", FT_BOOLEAN
, 16,
19234 TFS(&tfs_file_attribute_not_content_indexed
), SMB_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
, "May this file be indexed by the content indexing service", HFILL
}},
19236 { &hf_smb_file_attr_encrypted
,
19237 { "Encrypted", "smb.file_attribute.encrypted", FT_BOOLEAN
, 16,
19238 TFS(&tfs_file_attribute_encrypted
), SMB_FILE_ATTRIBUTE_ENCRYPTED
, "Is this file encrypted?", HFILL
}},
19241 { &hf_smb_file_size
,
19242 { "File Size", "smb.file_size", FT_UINT32
, BASE_DEC
,
19243 NULL
, 0, NULL
, HFILL
}},
19245 { &hf_smb_search_attribute
,
19246 { "Search Attributes", "smb.search.attribute", FT_UINT16
, BASE_HEX
,
19247 NULL
, 0x0, NULL
, HFILL
}},
19249 { &hf_smb_search_attribute_read_only
,
19250 { "Read Only", "smb.search.attribute.read_only", FT_BOOLEAN
, 16,
19251 TFS(&tfs_search_attribute_read_only
), SMB_FILE_ATTRIBUTE_READ_ONLY
, "READ ONLY search attribute", HFILL
}},
19253 { &hf_smb_search_attribute_hidden
,
19254 { "Hidden", "smb.search.attribute.hidden", FT_BOOLEAN
, 16,
19255 TFS(&tfs_search_attribute_hidden
), SMB_FILE_ATTRIBUTE_HIDDEN
, "HIDDEN search attribute", HFILL
}},
19257 { &hf_smb_search_attribute_system
,
19258 { "System", "smb.search.attribute.system", FT_BOOLEAN
, 16,
19259 TFS(&tfs_search_attribute_system
), SMB_FILE_ATTRIBUTE_SYSTEM
, "SYSTEM search attribute", HFILL
}},
19261 { &hf_smb_search_attribute_volume
,
19262 { "Volume ID", "smb.search.attribute.volume", FT_BOOLEAN
, 16,
19263 TFS(&tfs_search_attribute_volume
), SMB_FILE_ATTRIBUTE_VOLUME
, "VOLUME ID search attribute", HFILL
}},
19265 { &hf_smb_search_attribute_directory
,
19266 { "Directory", "smb.search.attribute.directory", FT_BOOLEAN
, 16,
19267 TFS(&tfs_search_attribute_directory
), SMB_FILE_ATTRIBUTE_DIRECTORY
, "DIRECTORY search attribute", HFILL
}},
19269 { &hf_smb_search_attribute_archive
,
19270 { "Archive", "smb.search.attribute.archive", FT_BOOLEAN
, 16,
19271 TFS(&tfs_search_attribute_archive
), SMB_FILE_ATTRIBUTE_ARCHIVE
, "ARCHIVE search attribute", HFILL
}},
19273 { &hf_smb_access_mode
,
19274 { "Access Mode", "smb.access.mode", FT_UINT16
, BASE_DEC
,
19275 VALS(da_access_vals
), 0x0007, NULL
, HFILL
}},
19277 { &hf_smb_access_sharing
,
19278 { "Sharing Mode", "smb.access.sharing", FT_UINT16
, BASE_DEC
,
19279 VALS(da_sharing_vals
), 0x0070, NULL
, HFILL
}},
19281 { &hf_smb_access_locality
,
19282 { "Locality", "smb.access.locality", FT_UINT16
, BASE_DEC
,
19283 VALS(da_locality_vals
), 0x0700, "Locality of reference", HFILL
}},
19285 { &hf_smb_access_caching
,
19286 { "Caching", "smb.access.caching", FT_BOOLEAN
, 16,
19287 TFS(&tfs_da_caching
), 0x1000, "Caching mode?", HFILL
}},
19289 { &hf_smb_desired_access
,
19290 { "Desired Access", "smb.access.desired", FT_UINT16
, BASE_HEX
,
19291 NULL
, 0x0, NULL
, HFILL
}},
19293 { &hf_smb_granted_access
,
19294 { "Granted Access", "smb.access.granted", FT_UINT16
, BASE_HEX
,
19295 NULL
, 0x0, NULL
, HFILL
}},
19297 { &hf_smb_access_writetru
,
19298 { "Writethrough", "smb.access.writethrough", FT_BOOLEAN
, 16,
19299 TFS(&tfs_da_writetru
), 0x4000, "Writethrough mode?", HFILL
}},
19301 { &hf_smb_create_time
,
19302 { "Created", "smb.create.time", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
19303 NULL
, 0, "Creation Time", HFILL
}},
19305 { &hf_smb_modify_time
,
19306 { "Modified", "smb.modify.time", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
19307 NULL
, 0, "Modification Time", HFILL
}},
19309 { &hf_smb_backup_time
,
19310 { "Backed-up", "smb.backup.time", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
19311 NULL
, 0, "Backup time", HFILL
}},
19313 { &hf_smb_mac_alloc_block_count
,
19314 { "Allocation Block Count", "smb.alloc.count", FT_UINT32
, BASE_DEC
,
19315 NULL
, 0, NULL
, HFILL
}},
19317 { &hf_smb_mac_alloc_block_size
,
19318 { "Allocation Block Count", "smb.alloc.size", FT_UINT32
, BASE_DEC
,
19319 NULL
, 0, "Allocation Block Size", HFILL
}},
19321 { &hf_smb_mac_free_block_count
,
19322 { "Free Block Count", "smb.free_block.count", FT_UINT32
, BASE_DEC
,
19323 NULL
, 0, NULL
, HFILL
}},
19325 { &hf_smb_mac_root_file_count
,
19326 { "Root File Count", "smb.root.file.count", FT_UINT32
, BASE_DEC
,
19327 NULL
, 0, NULL
, HFILL
}},
19329 { &hf_smb_mac_root_dir_count
,
19330 { "Root Directory Count", "smb.root.dir.count", FT_UINT32
, BASE_DEC
,
19331 NULL
, 0, NULL
, HFILL
}},
19333 { &hf_smb_mac_file_count
,
19334 { "Root File Count", "smb.file.count", FT_UINT32
, BASE_DEC
,
19335 NULL
, 0, NULL
, HFILL
}},
19337 { &hf_smb_mac_dir_count
,
19338 { "Root Directory Count", "smb.dir.count", FT_UINT32
, BASE_DEC
,
19339 NULL
, 0, NULL
, HFILL
}},
19342 { "Mac Support Flags", "smb.mac", FT_UINT32
, BASE_HEX
,
19343 NULL
, 0x0, NULL
, HFILL
}},
19345 { &hf_smb_mac_sup_access_ctrl
,
19346 { "Mac Access Control", "smb.mac.access_control", FT_BOOLEAN
, 32,
19347 TFS(&tfs_smb_mac_access_ctrl
), 0x00000010, "Are Mac Access Control Supported", HFILL
}},
19349 { &hf_smb_mac_sup_getset_comments
,
19350 { "Get Set Comments", "smb.mac.get_set_comments", FT_BOOLEAN
, 32,
19351 TFS(&tfs_smb_mac_getset_comments
), 0x00000020, "Are Mac Get Set Comments supported?", HFILL
}},
19353 { &hf_smb_mac_sup_desktopdb_calls
,
19354 { "Desktop DB Calls", "smb.mac.desktop_db_calls", FT_BOOLEAN
, 32,
19355 TFS(&tfs_smb_mac_desktopdb_calls
), 0x00000040, "Are Macintosh Desktop DB Calls Supported?", HFILL
}},
19357 { &hf_smb_mac_sup_unique_ids
,
19358 { "Macintosh Unique IDs", "smb.mac.uids", FT_BOOLEAN
, 32,
19359 TFS(&tfs_smb_mac_unique_ids
), 0x00000080, "Are Unique IDs supported", HFILL
}},
19361 { &hf_smb_mac_sup_streams
,
19362 { "Mac Streams", "smb.mac.streams_support", FT_BOOLEAN
, 32,
19363 TFS(&tfs_smb_mac_streams
), 0x00000100, "Are Mac Extensions and streams supported?", HFILL
}},
19365 { &hf_smb_create_dos_date
,
19366 { "Create Date", "smb.create.smb.date", FT_UINT16
, BASE_HEX
,
19367 NULL
, 0, "Create Date, SMB_DATE format", HFILL
}},
19369 { &hf_smb_create_dos_time
,
19370 { "Create Time", "smb.create.smb.time", FT_UINT16
, BASE_HEX
,
19371 NULL
, 0, "Create Time, SMB_TIME format", HFILL
}},
19373 { &hf_smb_last_write_time
,
19374 { "Last Write", "smb.last_write.time", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
19375 NULL
, 0, "Time this file was last written to", HFILL
}},
19377 { &hf_smb_last_write_dos_date
,
19378 { "Last Write Date", "smb.last_write.smb.date", FT_UINT16
, BASE_HEX
,
19379 NULL
, 0, "Last Write Date, SMB_DATE format", HFILL
}},
19381 { &hf_smb_last_write_dos_time
,
19382 { "Last Write Time", "smb.last_write.smb.time", FT_UINT16
, BASE_HEX
,
19383 NULL
, 0, "Last Write Time, SMB_TIME format", HFILL
}},
19385 { &hf_smb_old_file_name
,
19386 { "Old File Name", "smb.old_file", FT_STRING
, BASE_NONE
,
19387 NULL
, 0, "Old File Name (When renaming a file)", HFILL
}},
19390 { "Offset", "smb.offset", FT_UINT32
, BASE_DEC
,
19391 NULL
, 0, "Offset in file", HFILL
}},
19393 { &hf_smb_remaining
,
19394 { "Remaining", "smb.remaining", FT_UINT32
, BASE_DEC
,
19395 NULL
, 0, "Remaining number of bytes", HFILL
}},
19398 { "Padding", "smb.padding", FT_BYTES
, BASE_NONE
,
19399 NULL
, 0, "Padding or unknown data", HFILL
}},
19401 { &hf_smb_file_data
,
19402 { "File Data", "smb.file_data", FT_BYTES
, BASE_NONE
,
19403 NULL
, 0, "Data read/written to the file", HFILL
}},
19406 { &hf_smb_raw_ea_data
,
19407 { "EA Data", "smb.ea_data", FT_BYTES
, BASE_NONE
,
19408 NULL
, 0, "Data in EA list", HFILL
}},
19411 { &hf_smb_mac_fndrinfo
,
19412 { "Finder Info", "smb.mac.finderinfo", FT_BYTES
, BASE_NONE
,
19413 NULL
, 0, NULL
, HFILL
}},
19415 { &hf_smb_total_data_len
,
19416 { "Total Data Length", "smb.total_data_len", FT_UINT16
, BASE_DEC
,
19417 NULL
, 0, "Total length of data", HFILL
}},
19419 { &hf_smb_data_len
,
19420 { "Data Length", "smb.data_len", FT_UINT16
, BASE_DEC
,
19421 NULL
, 0, "Length of data", HFILL
}},
19423 { &hf_smb_data_len_low
,
19424 { "Data Length Low", "smb.data_len_low", FT_UINT16
, BASE_DEC
,
19425 NULL
, 0, "Length of data, Low 16 bits", HFILL
}},
19427 { &hf_smb_data_len_high
,
19428 { "Data Length High (multiply with 64K)", "smb.data_len_high", FT_UINT16
, BASE_DEC
,
19429 NULL
, 0, "Length of data, High 16 bits", HFILL
}},
19431 { &hf_bytes_until_total_data_count
,
19432 { "Bytes remaining until TDC", "smb.bytes_until_tdc", FT_UINT16
, BASE_DEC
,
19433 NULL
, 0, "Bytes remaining until the total data length is reached", HFILL
}},
19435 { &hf_smb_seek_mode
,
19436 { "Seek Mode", "smb.seek_mode", FT_UINT16
, BASE_DEC
,
19437 VALS(seek_mode_vals
), 0, "Seek Mode, what type of seek", HFILL
}},
19439 { &hf_smb_access_time
,
19440 { "Last Access", "smb.access.time", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
19441 NULL
, 0, "Last Access Time", HFILL
}},
19443 { &hf_smb_access_dos_date
,
19444 { "Last Access Date", "smb.access.smb.date", FT_UINT16
, BASE_HEX
,
19445 NULL
, 0, "Last Access Date, SMB_DATE format", HFILL
}},
19447 { &hf_smb_access_dos_time
,
19448 { "Last Access Time", "smb.access.smb.time", FT_UINT16
, BASE_HEX
,
19449 NULL
, 0, "Last Access Time, SMB_TIME format", HFILL
}},
19451 { &hf_smb_data_size
,
19452 { "Data Size", "smb.data_size", FT_UINT32
, BASE_DEC
,
19453 NULL
, 0, NULL
, HFILL
}},
19455 { &hf_smb_alloc_size
,
19456 { "Allocation Size", "smb.alloc_size", FT_UINT32
, BASE_DEC
,
19457 NULL
, 0, "Number of bytes to reserve on create or truncate", HFILL
}},
19459 { &hf_smb_max_count
,
19460 { "Max Count", "smb.maxcount", FT_UINT16
, BASE_DEC
,
19461 NULL
, 0, "Maximum Count", HFILL
}},
19463 { &hf_smb_max_count_low
,
19464 { "Max Count Low", "smb.maxcount_low", FT_UINT16
, BASE_DEC
,
19465 NULL
, 0, "Maximum Count, Low 16 bits", HFILL
}},
19467 { &hf_smb_max_count_high
,
19468 { "Max Count High (multiply with 64K)", "smb.maxcount_high", FT_UINT16
, BASE_DEC
,
19469 NULL
, 0, "Maximum Count, High 16 bits", HFILL
}},
19471 { &hf_smb_min_count
,
19472 { "Min Count", "smb.mincount", FT_UINT16
, BASE_DEC
,
19473 NULL
, 0, "Minimum Count", HFILL
}},
19476 { "Timeout", "smb.timeout", FT_UINT32
, BASE_DEC
,
19477 NULL
, 0, "Timeout in milliseconds", HFILL
}},
19479 { &hf_smb_high_offset
,
19480 { "High Offset", "smb.offset_high", FT_UINT32
, BASE_DEC
,
19481 NULL
, 0, "High 32 Bits Of File Offset", HFILL
}},
19484 { "Total Units", "smb.units", FT_UINT16
, BASE_DEC
,
19485 NULL
, 0, "Total number of units at server", HFILL
}},
19488 { "Blocks Per Unit", "smb.bpu", FT_UINT16
, BASE_DEC
,
19489 NULL
, 0, "Blocks per unit at server", HFILL
}},
19491 { &hf_smb_blocksize
,
19492 { "Block Size", "smb.blocksize", FT_UINT16
, BASE_DEC
,
19493 NULL
, 0, "Block size (in bytes) at server", HFILL
}},
19495 { &hf_smb_freeunits
,
19496 { "Free Units", "smb.free_units", FT_UINT16
, BASE_DEC
,
19497 NULL
, 0, "Number of free units at server", HFILL
}},
19499 { &hf_smb_data_offset
,
19500 { "Data Offset", "smb.data_offset", FT_UINT16
, BASE_DEC
,
19501 NULL
, 0, NULL
, HFILL
}},
19504 { "Data Compaction Mode", "smb.dcm", FT_UINT16
, BASE_DEC
,
19505 NULL
, 0, NULL
, HFILL
}},
19507 { &hf_smb_request_mask
,
19508 { "Request Mask", "smb.request.mask", FT_UINT32
, BASE_HEX
,
19509 NULL
, 0, "Connectionless mode mask", HFILL
}},
19511 { &hf_smb_response_mask
,
19512 { "Response Mask", "smb.response.mask", FT_UINT32
, BASE_HEX
,
19513 NULL
, 0, "Connectionless mode mask", HFILL
}},
19515 { &hf_smb_search_id
,
19516 { "Search ID", "smb.search_id", FT_UINT16
, BASE_HEX
,
19517 NULL
, 0, "Search ID, handle for find operations", HFILL
}},
19519 { &hf_smb_write_mode
,
19520 { "Write Mode", "smb.write.mode", FT_UINT16
, BASE_HEX
,
19521 NULL
, 0x0, NULL
, HFILL
}},
19523 { &hf_smb_write_mode_write_through
,
19524 { "Write Through", "smb.write.mode.write_through", FT_BOOLEAN
, 16,
19525 TFS(&tfs_write_mode_write_through
), WRITE_MODE_WRITE_THROUGH
, "Write through mode requested?", HFILL
}},
19527 { &hf_smb_write_mode_return_remaining
,
19528 { "Return Remaining", "smb.write.mode.return_remaining", FT_BOOLEAN
, 16,
19529 TFS(&tfs_write_mode_return_remaining
), WRITE_MODE_RETURN_REMAINING
, "Return remaining data responses?", HFILL
}},
19531 { &hf_smb_write_mode_raw
,
19532 { "Write Raw", "smb.write.mode.raw", FT_BOOLEAN
, 16,
19533 TFS(&tfs_write_mode_raw
), WRITE_MODE_RAW
, "Use WriteRawNamedPipe?", HFILL
}},
19535 { &hf_smb_write_mode_message_start
,
19536 { "Message Start", "smb.write.mode.message_start", FT_BOOLEAN
, 16,
19537 TFS(&tfs_write_mode_message_start
), WRITE_MODE_MESSAGE_START
, "Is this the start of a message?", HFILL
}},
19539 { &hf_smb_write_mode_connectionless
,
19540 { "Connectionless", "smb.write.mode.connectionless", FT_BOOLEAN
, 16,
19541 TFS(&tfs_write_mode_connectionless
), WRITE_MODE_CONNECTIONLESS
, "Connectionless mode requested?", HFILL
}},
19543 { &hf_smb_resume_key_len
,
19544 { "Resume Key Length", "smb.resume.key_len", FT_UINT16
, BASE_DEC
,
19545 NULL
, 0, NULL
, HFILL
}},
19547 { &hf_smb_resume_find_id
,
19548 { "Find ID", "smb.resume.find_id", FT_UINT8
, BASE_HEX
,
19549 NULL
, 0, "Handle for Find operation", HFILL
}},
19551 { &hf_smb_resume_server_cookie
,
19552 { "Server Cookie", "smb.resume.server.cookie", FT_BYTES
, BASE_NONE
,
19553 NULL
, 0, "Cookie, must not be modified by the client", HFILL
}},
19555 { &hf_smb_resume_client_cookie
,
19556 { "Client Cookie", "smb.resume.client.cookie", FT_BYTES
, BASE_NONE
,
19557 NULL
, 0, "Cookie, must not be modified by the server", HFILL
}},
19559 { &hf_smb_andxoffset
,
19560 { "AndXOffset", "smb.andxoffset", FT_UINT16
, BASE_DEC
,
19561 NULL
, 0, "Offset to next command in this SMB packet", HFILL
}},
19563 { &hf_smb_lock_type
,
19564 { "Lock Type", "smb.lock.type", FT_UINT8
, BASE_HEX
,
19565 NULL
, 0x0, NULL
, HFILL
}},
19567 { &hf_smb_lock_type_large
,
19568 { "Large Files", "smb.lock.type.large", FT_BOOLEAN
, 8,
19569 TFS(&tfs_lock_type_large
), 0x10, "Large file locking requested?", HFILL
}},
19571 { &hf_smb_lock_type_cancel
,
19572 { "Cancel", "smb.lock.type.cancel", FT_BOOLEAN
, 8,
19573 TFS(&tfs_lock_type_cancel
), 0x08, "Cancel outstanding lock requests?", HFILL
}},
19575 { &hf_smb_lock_type_change
,
19576 { "Change", "smb.lock.type.change", FT_BOOLEAN
, 8,
19577 TFS(&tfs_lock_type_change
), 0x04, "Change type of lock?", HFILL
}},
19579 { &hf_smb_lock_type_oplock
,
19580 { "Oplock Break", "smb.lock.type.oplock_release", FT_BOOLEAN
, 8,
19581 TFS(&tfs_lock_type_oplock
), 0x02, "Is this a notification of, or a response to, an oplock break?", HFILL
}},
19583 { &hf_smb_lock_type_shared
,
19584 { "Shared", "smb.lock.type.shared", FT_BOOLEAN
, 8,
19585 TFS(&tfs_lock_type_shared
), 0x01, "Shared or exclusive lock requested?", HFILL
}},
19587 { &hf_smb_locking_ol
,
19588 { "Oplock Level", "smb.locking.oplock.level", FT_UINT8
, BASE_DEC
,
19589 VALS(locking_ol_vals
), 0, "Level of existing oplock at client (if any)", HFILL
}},
19591 { &hf_smb_number_of_locks
,
19592 { "Number of Locks", "smb.locking.num_locks", FT_UINT16
, BASE_DEC
,
19593 NULL
, 0, "Number of lock requests in this request", HFILL
}},
19595 { &hf_smb_number_of_unlocks
,
19596 { "Number of Unlocks", "smb.locking.num_unlocks", FT_UINT16
, BASE_DEC
,
19597 NULL
, 0, "Number of unlock requests in this request", HFILL
}},
19599 { &hf_smb_lock_long_length
,
19600 { "Length", "smb.lock.length", FT_UINT64
, BASE_DEC
,
19601 NULL
, 0, "Length of lock/unlock region", HFILL
}},
19603 { &hf_smb_lock_long_offset
,
19604 { "Offset", "smb.lock.offset", FT_UINT64
, BASE_DEC
,
19605 NULL
, 0, "Offset in the file of lock/unlock region", HFILL
}},
19607 { &hf_smb_file_type
,
19608 { "File Type", "smb.file_type", FT_UINT16
, BASE_DEC
,
19609 VALS(filetype_vals
), 0, "Type of file", HFILL
}},
19611 { &hf_smb_ipc_state
,
19612 { "IPC State", "smb.ipc_state", FT_UINT16
, BASE_HEX
,
19613 NULL
, 0x0, NULL
, HFILL
}},
19615 { &hf_smb_ipc_state_nonblocking
,
19616 { "Nonblocking", "smb.ipc_state.nonblocking", FT_BOOLEAN
, 16,
19617 TFS(&tfs_ipc_state_nonblocking
), 0x8000, "Is I/O to this pipe nonblocking?", HFILL
}},
19619 { &hf_smb_ipc_state_endpoint
,
19620 { "Endpoint", "smb.ipc_state.endpoint", FT_UINT16
, BASE_DEC
,
19621 VALS(ipc_state_endpoint_vals
), 0x4000, "Which end of the pipe this is", HFILL
}},
19623 { &hf_smb_ipc_state_pipe_type
,
19624 { "Pipe Type", "smb.ipc_state.pipe_type", FT_UINT16
, BASE_DEC
,
19625 VALS(ipc_state_pipe_type_vals
), 0x0c00, "What type of pipe this is", HFILL
}},
19627 { &hf_smb_ipc_state_read_mode
,
19628 { "Read Mode", "smb.ipc_state.read_mode", FT_UINT16
, BASE_DEC
,
19629 VALS(ipc_state_read_mode_vals
), 0x0300, "How this pipe should be read", HFILL
}},
19631 { &hf_smb_ipc_state_icount
,
19632 { "Icount", "smb.ipc_state.icount", FT_UINT16
, BASE_DEC
,
19633 NULL
, 0x00FF, "Count to control pipe instancing", HFILL
}},
19635 { &hf_smb_server_fid
,
19636 { "Server FID", "smb.server_fid", FT_UINT32
, BASE_HEX
,
19637 NULL
, 0, "Server unique File ID", HFILL
}},
19639 { &hf_smb_open_flags
,
19640 { "Flags", "smb.open.flags", FT_UINT16
, BASE_HEX
,
19641 NULL
, 0x0, NULL
, HFILL
}},
19643 { &hf_smb_open_flags_add_info
,
19644 { "Additional Info", "smb.open.flags.add_info", FT_BOOLEAN
, 16,
19645 TFS(&tfs_open_flags_add_info
), 0x0001, "Additional Information Requested?", HFILL
}},
19647 { &hf_smb_open_flags_ex_oplock
,
19648 { "Exclusive Oplock", "smb.open.flags.ex_oplock", FT_BOOLEAN
, 16,
19649 TFS(&tfs_open_flags_ex_oplock
), 0x0002, "Exclusive Oplock Requested?", HFILL
}},
19651 { &hf_smb_open_flags_batch_oplock
,
19652 { "Batch Oplock", "smb.open.flags.batch_oplock", FT_BOOLEAN
, 16,
19653 TFS(&tfs_open_flags_batch_oplock
), 0x0004, "Batch Oplock Requested?", HFILL
}},
19655 { &hf_smb_open_flags_ealen
,
19656 { "Total EA Len", "smb.open.flags.ealen", FT_BOOLEAN
, 16,
19657 TFS(&tfs_open_flags_ealen
), 0x0008, "Total EA Len Requested?", HFILL
}},
19659 { &hf_smb_open_action
,
19660 { "Action", "smb.open.action", FT_UINT16
, BASE_HEX
,
19661 NULL
, 0x0, NULL
, HFILL
}},
19663 { &hf_smb_open_action_open
,
19664 { "Open Action", "smb.open.action.open", FT_UINT16
, BASE_DEC
,
19665 VALS(oa_open_vals
), 0x0003, "Open Action, how the file was opened", HFILL
}},
19667 { &hf_smb_open_action_lock
,
19668 { "Exclusive Open", "smb.open.action.lock", FT_BOOLEAN
, 16,
19669 TFS(&tfs_oa_lock
), 0x8000, "Is this file opened by another user?", HFILL
}},
19672 { "VC Number", "smb.vc", FT_UINT16
, BASE_DEC
,
19673 NULL
, 0, NULL
, HFILL
}},
19675 { &hf_smb_password_len
,
19676 { "Password Length", "smb.pwlen", FT_UINT16
, BASE_DEC
,
19677 NULL
, 0, "Length of password", HFILL
}},
19679 { &hf_smb_ansi_password_len
,
19680 { "ANSI Password Length", "smb.ansi_pwlen", FT_UINT16
, BASE_DEC
,
19681 NULL
, 0, "Length of ANSI password", HFILL
}},
19683 { &hf_smb_unicode_password_len
,
19684 { "Unicode Password Length", "smb.unicode_pwlen", FT_UINT16
, BASE_DEC
,
19685 NULL
, 0, "Length of Unicode password", HFILL
}},
19688 { "Account", "smb.account", FT_STRING
, BASE_NONE
,
19689 NULL
, 0, "Account, username", HFILL
}},
19692 { "Native OS", "smb.native_os", FT_STRING
, BASE_NONE
,
19693 NULL
, 0, "Which OS we are running", HFILL
}},
19696 { "Native LAN Manager", "smb.native_lanman", FT_STRING
, BASE_NONE
,
19697 NULL
, 0, "Which LANMAN protocol we are running", HFILL
}},
19699 { &hf_smb_setup_action
,
19700 { "Action", "smb.setup.action", FT_UINT16
, BASE_HEX
,
19701 NULL
, 0x0, NULL
, HFILL
}},
19703 { &hf_smb_setup_action_guest
,
19704 { "Guest", "smb.setup.action.guest", FT_BOOLEAN
, 16,
19705 TFS(&tfs_setup_action_guest
), 0x0001, "Client logged in as GUEST?", HFILL
}},
19708 { "Native File System", "smb.native_fs", FT_STRING
, BASE_NONE
,
19709 NULL
, 0, NULL
, HFILL
}},
19711 { &hf_smb_connect_flags
,
19712 { "Flags", "smb.connect.flags", FT_UINT16
, BASE_HEX
,
19713 NULL
, 0x0, NULL
, HFILL
}},
19715 { &hf_smb_connect_flags_dtid
,
19716 { "Disconnect TID", "smb.connect.flags.dtid", FT_BOOLEAN
, 16,
19717 TFS(&tfs_disconnect_tid
), 0x0001, "Disconnect TID?", HFILL
}},
19719 { &hf_smb_connect_flags_ext_sig
,
19720 { "Extended Signature", "smb.connect.flags.extendedsig", FT_BOOLEAN
, 16,
19721 TFS(&tfs_extended_signature
), 0x0004, "Extended signature?", HFILL
}},
19723 { &hf_smb_connect_flags_ext_resp
,
19724 { "Extended Response", "smb.connect.flags.extendedresp", FT_BOOLEAN
, 16,
19725 TFS(&tfs_extended_response
), 0x0008, "Extended response?", HFILL
}},
19727 { &hf_smb_connect_support
,
19728 { "Optional Support", "smb.connect.support", FT_UINT16
, BASE_HEX
,
19729 NULL
, 0x0, NULL
, HFILL
}},
19731 { &hf_smb_connect_support_search
,
19732 { "Search Bits", "smb.connect.support.search", FT_BOOLEAN
, 16,
19733 TFS(&tfs_connect_support_search
), 0x0001, "Exclusive Search Bits supported?", HFILL
}},
19735 { &hf_smb_connect_support_in_dfs
,
19736 { "In Dfs", "smb.connect.support.dfs", FT_BOOLEAN
, 16,
19737 TFS(&tfs_connect_support_in_dfs
), 0x0002, "Is this in a Dfs tree?", HFILL
}},
19739 { &hf_smb_connect_support_csc_mask_vals
,
19740 { "CSC Mask", "smb.connect.support.cscmask", FT_UINT16
, BASE_DEC
,
19741 VALS(connect_support_csc_mask_vals
), 0x000c, "CSC mask?", HFILL
}},
19743 { &hf_smb_connect_support_uniquefilename
,
19744 { "Unique File Name", "smb.connect.support.uniqfilename", FT_BOOLEAN
, 16,
19745 TFS(&tfs_connect_support_uniquefilename
), 0x0010, "Unique file name supported?", HFILL
}},
19747 { &hf_smb_connect_support_extended_signature
,
19748 { "Extended Signatures", "smb.connect.support.extendedsig", FT_BOOLEAN
, 16,
19749 TFS(&tfs_connect_support_extended_signature
), 0x0020, "Extended signatures?", HFILL
}},
19751 { &hf_smb_max_setup_count
,
19752 { "Max Setup Count", "smb.msc", FT_UINT8
, BASE_DEC
,
19753 NULL
, 0, "Maximum number of setup words to return", HFILL
}},
19755 { &hf_smb_total_param_count
,
19756 { "Total Parameter Count", "smb.tpc", FT_UINT32
, BASE_DEC
,
19757 NULL
, 0, "Total number of parameter bytes", HFILL
}},
19759 { &hf_smb_total_data_count
,
19760 { "Total Data Count", "smb.tdc", FT_UINT16
, BASE_DEC
,
19761 NULL
, 0, "Total number of data bytes", HFILL
}},
19763 { &hf_smb_max_param_count
,
19764 { "Max Parameter Count", "smb.mpc", FT_UINT32
, BASE_DEC
,
19765 NULL
, 0, "Maximum number of parameter bytes to return", HFILL
}},
19767 { &hf_smb_max_data_count
,
19768 { "Max Data Count", "smb.mdc", FT_UINT32
, BASE_DEC
,
19769 NULL
, 0, "Maximum number of data bytes to return", HFILL
}},
19771 { &hf_smb_param_disp16
,
19772 { "Parameter Displacement", "smb.pd", FT_UINT16
, BASE_DEC
,
19773 NULL
, 0, "Displacement of these parameter bytes", HFILL
}},
19775 { &hf_smb_param_count16
,
19776 { "Parameter Count", "smb.pc", FT_UINT16
, BASE_DEC
,
19777 NULL
, 0, "Number of parameter bytes in this buffer", HFILL
}},
19779 { &hf_smb_param_offset16
,
19780 { "Parameter Offset", "smb.po", FT_UINT16
, BASE_DEC
,
19781 NULL
, 0, "Offset (from header start) to parameters", HFILL
}},
19783 { &hf_smb_param_disp32
,
19784 { "Parameter Displacement", "smb.pd", FT_UINT32
, BASE_DEC
,
19785 NULL
, 0, "Displacement of these parameter bytes", HFILL
}},
19787 { &hf_smb_param_count32
,
19788 { "Parameter Count", "smb.pc", FT_UINT32
, BASE_DEC
,
19789 NULL
, 0, "Number of parameter bytes in this buffer", HFILL
}},
19791 { &hf_smb_param_offset32
,
19792 { "Parameter Offset", "smb.po", FT_UINT32
, BASE_DEC
,
19793 NULL
, 0, "Offset (from header start) to parameters", HFILL
}},
19795 { &hf_smb_data_count16
,
19796 { "Data Count", "smb.dc", FT_UINT16
, BASE_DEC
,
19797 NULL
, 0, "Number of data bytes in this buffer", HFILL
}},
19799 { &hf_smb_data_disp16
,
19800 { "Data Displacement", "smb.data_disp", FT_UINT16
, BASE_DEC
,
19801 NULL
, 0, NULL
, HFILL
}},
19803 { &hf_smb_data_offset16
,
19804 { "Data Offset", "smb.data_offset", FT_UINT16
, BASE_DEC
,
19805 NULL
, 0, NULL
, HFILL
}},
19807 { &hf_smb_data_count32
,
19808 { "Data Count", "smb.dc", FT_UINT32
, BASE_DEC
,
19809 NULL
, 0, "Number of data bytes in this buffer", HFILL
}},
19811 { &hf_smb_data_disp32
,
19812 { "Data Displacement", "smb.data_disp", FT_UINT32
, BASE_DEC
,
19813 NULL
, 0, NULL
, HFILL
}},
19815 { &hf_smb_data_offset32
,
19816 { "Data Offset", "smb.data_offset", FT_UINT32
, BASE_DEC
,
19817 NULL
, 0, NULL
, HFILL
}},
19819 { &hf_smb_setup_count
,
19820 { "Setup Count", "smb.sc", FT_UINT8
, BASE_DEC
,
19821 NULL
, 0, "Number of setup words in this buffer", HFILL
}},
19823 { &hf_smb_nt_ioctl_isfsctl
,
19824 { "IsFSctl", "smb.nt.ioctl.isfsctl", FT_UINT8
, BASE_DEC
,
19825 VALS(nt_ioctl_isfsctl_vals
), 0, "Is this a device IOCTL (false) or FS Control (true)", HFILL
}},
19827 { &hf_smb_nt_ioctl_flags_completion_filter
,
19828 { "Completion Filter", "smb.nt.ioctl.completion_filter", FT_UINT8
, BASE_HEX
,
19829 NULL
, 0x0, NULL
, HFILL
}},
19831 { &hf_smb_nt_ioctl_flags_root_handle
,
19832 { "Root Handle", "smb.nt.ioctl.flags.root_handle", FT_BOOLEAN
, 8,
19833 TFS(&tfs_nt_ioctl_flags_root_handle
), NT_IOCTL_FLAGS_ROOT_HANDLE
, "Apply to this share or root Dfs share", HFILL
}},
19835 { &hf_smb_nt_notify_action
,
19836 { "Action", "smb.nt.notify.action", FT_UINT32
, BASE_DEC
,
19837 VALS(nt_notify_action_vals
), 0, "Which action caused this notify response", HFILL
}},
19839 { &hf_smb_nt_notify_watch_tree
,
19840 { "Watch Tree", "smb.nt.notify.watch_tree", FT_UINT8
, BASE_DEC
,
19841 VALS(watch_tree_vals
), 0, "Should Notify watch subdirectories also?", HFILL
}},
19844 { &hf_smb_nt_notify_completion_filter
,
19845 { "Completion Filter", "smb.nt.notify.completion_filter", FT_UINT32
, BASE_HEX
,
19846 NULL
, 0x0, NULL
, HFILL
}},
19847 { &hf_smb_nt_notify_file_name
,
19848 { "File Name Change", "smb.nt.notify.file_name", FT_BOOLEAN
, 32,
19849 TFS(&tfs_nt_notify_file_name
), NT_NOTIFY_FILE_NAME
, "Notify on changes to file name", HFILL
}},
19851 { &hf_smb_nt_notify_dir_name
,
19852 { "Directory Name Change", "smb.nt.notify.dir_name", FT_BOOLEAN
, 32,
19853 TFS(&tfs_nt_notify_dir_name
), NT_NOTIFY_DIR_NAME
, "Notify on changes to directory name", HFILL
}},
19855 { &hf_smb_nt_notify_attributes
,
19856 { "Attribute Change", "smb.nt.notify.attributes", FT_BOOLEAN
, 32,
19857 TFS(&tfs_nt_notify_attributes
), NT_NOTIFY_ATTRIBUTES
, "Notify on changes to attributes", HFILL
}},
19859 { &hf_smb_nt_notify_size
,
19860 { "Size Change", "smb.nt.notify.size", FT_BOOLEAN
, 32,
19861 TFS(&tfs_nt_notify_size
), NT_NOTIFY_SIZE
, "Notify on changes to size", HFILL
}},
19863 { &hf_smb_nt_notify_last_write
,
19864 { "Last Write Change", "smb.nt.notify.last_write", FT_BOOLEAN
, 32,
19865 TFS(&tfs_nt_notify_last_write
), NT_NOTIFY_LAST_WRITE
, "Notify on changes to last write", HFILL
}},
19867 { &hf_smb_nt_notify_last_access
,
19868 { "Last Access Change", "smb.nt.notify.last_access", FT_BOOLEAN
, 32,
19869 TFS(&tfs_nt_notify_last_access
), NT_NOTIFY_LAST_ACCESS
, "Notify on changes to last access", HFILL
}},
19871 { &hf_smb_nt_notify_creation
,
19872 { "Created Change", "smb.nt.notify.creation", FT_BOOLEAN
, 32,
19873 TFS(&tfs_nt_notify_creation
), NT_NOTIFY_CREATION
, "Notify on changes to creation time", HFILL
}},
19875 { &hf_smb_nt_notify_ea
,
19876 { "EA Change", "smb.nt.notify.ea", FT_BOOLEAN
, 32,
19877 TFS(&tfs_nt_notify_ea
), NT_NOTIFY_EA
, "Notify on changes to Extended Attributes", HFILL
}},
19879 { &hf_smb_nt_notify_security
,
19880 { "Security Change", "smb.nt.notify.security", FT_BOOLEAN
, 32,
19881 TFS(&tfs_nt_notify_security
), NT_NOTIFY_SECURITY
, "Notify on changes to security settings", HFILL
}},
19883 { &hf_smb_nt_notify_stream_name
,
19884 { "Stream Name Change", "smb.nt.notify.stream_name", FT_BOOLEAN
, 32,
19885 TFS(&tfs_nt_notify_stream_name
), NT_NOTIFY_STREAM_NAME
, "Notify on changes to stream name?", HFILL
}},
19887 { &hf_smb_nt_notify_stream_size
,
19888 { "Stream Size Change", "smb.nt.notify.stream_size", FT_BOOLEAN
, 32,
19889 TFS(&tfs_nt_notify_stream_size
), NT_NOTIFY_STREAM_SIZE
, "Notify on changes of stream size", HFILL
}},
19891 { &hf_smb_nt_notify_stream_write
,
19892 { "Stream Write", "smb.nt.notify.stream_write", FT_BOOLEAN
, 32,
19893 TFS(&tfs_nt_notify_stream_write
), NT_NOTIFY_STREAM_WRITE
, "Notify on stream write?", HFILL
}},
19896 { &hf_smb_root_dir_fid
,
19897 { "Root FID", "smb.rfid", FT_UINT32
, BASE_HEX
,
19898 NULL
, 0, "Open is relative to this FID (if nonzero)", HFILL
}},
19900 { &hf_smb_alloc_size64
,
19901 { "Allocation Size", "smb.alloc_size64", FT_UINT64
, BASE_DEC
,
19902 NULL
, 0, "Number of bytes to reserve on create or truncate", HFILL
}},
19904 { &hf_smb_nt_create_disposition
,
19905 { "Disposition", "smb.create.disposition", FT_UINT32
, BASE_DEC
,
19906 VALS(create_disposition_vals
), 0, "Create disposition, what to do if the file does/does not exist", HFILL
}},
19908 { &hf_smb_sd_length
,
19909 { "SD Length", "smb.sd.length", FT_UINT32
, BASE_DEC
,
19910 NULL
, 0, "Total length of security descriptor", HFILL
}},
19912 { &hf_smb_ea_list_length
,
19913 { "EA List Length", "smb.ea.list_length", FT_UINT32
, BASE_DEC
,
19914 NULL
, 0, "Total length of extended attributes", HFILL
}},
19916 { &hf_smb_ea_flags
,
19917 { "EA Flags", "smb.ea.flags", FT_UINT8
, BASE_HEX
,
19918 NULL
, 0, NULL
, HFILL
}},
19920 { &hf_smb_ea_name_length
,
19921 { "EA Name Length", "smb.ea.name_length", FT_UINT8
, BASE_DEC
,
19922 NULL
, 0, NULL
, HFILL
}},
19924 { &hf_smb_ea_data_length
,
19925 { "EA Data Length", "smb.ea.data_length", FT_UINT16
, BASE_DEC
,
19926 NULL
, 0, NULL
, HFILL
}},
19929 { "EA Name", "smb.ea.name", FT_STRING
, BASE_NONE
,
19930 NULL
, 0, NULL
, HFILL
}},
19933 { "EA Data", "smb.ea.data", FT_BYTES
, BASE_NONE
|BASE_SHOW_ASCII_PRINTABLE
,
19934 NULL
, 0, NULL
, HFILL
}},
19936 { &hf_smb_file_name_len
,
19937 { "File Name Len", "smb.file_name_len", FT_UINT32
, BASE_DEC
,
19938 NULL
, 0, "Length of File Name", HFILL
}},
19940 { &hf_smb_nt_impersonation_level
,
19941 { "Impersonation", "smb.impersonation.level", FT_UINT32
, BASE_DEC
,
19942 VALS(impersonation_level_vals
), 0, "Impersonation level", HFILL
}},
19944 { &hf_smb_nt_security_flags
,
19945 { "Security Flags", "smb.security.flags", FT_UINT8
, BASE_HEX
,
19946 NULL
, 0x0, NULL
, HFILL
}},
19948 { &hf_smb_nt_security_flags_context_tracking
,
19949 { "Context Tracking", "smb.security.flags.context_tracking", FT_BOOLEAN
, 8,
19950 TFS(&tfs_nt_security_flags_context_tracking
), 0x01, "Is security tracking static or dynamic?", HFILL
}},
19952 { &hf_smb_nt_security_flags_effective_only
,
19953 { "Effective Only", "smb.security.flags.effective_only", FT_BOOLEAN
, 8,
19954 TFS(&tfs_nt_security_flags_effective_only
), 0x02, "Are only enabled or all aspects uf the users SID available?", HFILL
}},
19956 { &hf_smb_nt_access_mask_generic_read
,
19957 { "Generic Read", "smb.access.generic_read", FT_BOOLEAN
, 32,
19958 TFS(&tfs_nt_access_mask_generic_read
), 0x80000000, "Is generic read allowed for this object?", HFILL
}},
19960 { &hf_smb_nt_access_mask_generic_write
,
19961 { "Generic Write", "smb.access.generic_write", FT_BOOLEAN
, 32,
19962 TFS(&tfs_nt_access_mask_generic_write
), 0x40000000, "Is generic write allowed for this object?", HFILL
}},
19964 { &hf_smb_nt_access_mask_generic_execute
,
19965 { "Generic Execute", "smb.access.generic_execute", FT_BOOLEAN
, 32,
19966 TFS(&tfs_nt_access_mask_generic_execute
), 0x20000000, "Is generic execute allowed for this object?", HFILL
}},
19968 { &hf_smb_nt_access_mask_generic_all
,
19969 { "Generic All", "smb.access.generic_all", FT_BOOLEAN
, 32,
19970 TFS(&tfs_nt_access_mask_generic_all
), 0x10000000, "Is generic all allowed for this attribute", HFILL
}},
19972 { &hf_smb_nt_access_mask_maximum_allowed
,
19973 { "Maximum Allowed", "smb.access.maximum_allowed", FT_BOOLEAN
, 32,
19974 TFS(&tfs_nt_access_mask_maximum_allowed
), 0x02000000, "?", HFILL
}},
19976 { &hf_smb_nt_access_mask_system_security
,
19977 { "System Security", "smb.access.system_security", FT_BOOLEAN
, 32,
19978 TFS(&tfs_nt_access_mask_system_security
), 0x01000000, "Access to a system ACL?", HFILL
}},
19980 { &hf_smb_nt_access_mask_synchronize
,
19981 { "Synchronize", "smb.access.synchronize", FT_BOOLEAN
, 32,
19982 TFS(&tfs_nt_access_mask_synchronize
), 0x00100000, "Windows NT: synchronize access", HFILL
}},
19984 { &hf_smb_nt_access_mask_write_owner
,
19985 { "Write Owner", "smb.access.write_owner", FT_BOOLEAN
, 32,
19986 TFS(&tfs_nt_access_mask_write_owner
), 0x00080000, "Can owner write to the object?", HFILL
}},
19988 { &hf_smb_nt_access_mask_write_dac
,
19989 { "Write DAC", "smb.access.write_dac", FT_BOOLEAN
, 32,
19990 TFS(&tfs_nt_access_mask_write_dac
), 0x00040000, "Is write allowed to the owner group or ACLs?", HFILL
}},
19992 { &hf_smb_nt_access_mask_read_control
,
19993 { "Read Control", "smb.access.read_control", FT_BOOLEAN
, 32,
19994 TFS(&tfs_nt_access_mask_read_control
), 0x00020000, "Are reads allowed of owner, group and ACL data of the SID?", HFILL
}},
19996 { &hf_smb_nt_access_mask_delete
,
19997 { "Delete", "smb.access.delete", FT_BOOLEAN
, 32,
19998 TFS(&tfs_nt_access_mask_delete
), 0x00010000, "Can object be deleted", HFILL
}},
20000 { &hf_smb_nt_access_mask_write_attributes
,
20001 { "Write Attributes", "smb.access.write_attributes", FT_BOOLEAN
, 32,
20002 TFS(&tfs_nt_access_mask_write_attributes
), 0x00000100, "Can object's attributes be written", HFILL
}},
20004 { &hf_smb_nt_access_mask_read_attributes
,
20005 { "Read Attributes", "smb.access.read_attributes", FT_BOOLEAN
, 32,
20006 TFS(&tfs_nt_access_mask_read_attributes
), 0x00000080, "Can object's attributes be read", HFILL
}},
20008 { &hf_smb_nt_access_mask_delete_child
,
20009 { "Delete Child", "smb.access.delete_child", FT_BOOLEAN
, 32,
20010 TFS(&tfs_nt_access_mask_delete_child
), 0x00000040, "Can object's subdirectories be deleted", HFILL
}},
20013 * "Execute" for files, "traverse" for directories.
20015 { &hf_smb_nt_access_mask_execute
,
20016 { "Execute", "smb.access.execute", FT_BOOLEAN
, 32,
20017 TFS(&tfs_nt_access_mask_execute
), 0x00000020, "Can object be executed (if file) or traversed (if directory)", HFILL
}},
20019 { &hf_smb_nt_access_mask_write_ea
,
20020 { "Write EA", "smb.access.write_ea", FT_BOOLEAN
, 32,
20021 TFS(&tfs_nt_access_mask_write_ea
), 0x00000010, "Can object's extended attributes be written", HFILL
}},
20023 { &hf_smb_nt_access_mask_read_ea
,
20024 { "Read EA", "smb.access.read_ea", FT_BOOLEAN
, 32,
20025 TFS(&tfs_nt_access_mask_read_ea
), 0x00000008, "Can object's extended attributes be read", HFILL
}},
20028 * "Append data" for files, "add subdirectory" for directories,
20029 * "create pipe instance" for named pipes.
20031 { &hf_smb_nt_access_mask_append
,
20032 { "Append", "smb.access.append", FT_BOOLEAN
, 32,
20033 TFS(&tfs_nt_access_mask_append
), 0x00000004, "Can object's contents be appended to", HFILL
}},
20036 * "Write data" for files and pipes, "add file" for directory.
20038 { &hf_smb_nt_access_mask_write
,
20039 { "Write", "smb.access.write", FT_BOOLEAN
, 32,
20040 TFS(&tfs_nt_access_mask_write
), 0x00000002, "Can object's contents be written", HFILL
}},
20043 * "Read data" for files and pipes, "list directory" for directory.
20045 { &hf_smb_nt_access_mask_read
,
20046 { "Read", "smb.access.read", FT_BOOLEAN
, 32,
20047 TFS(&tfs_nt_access_mask_read
), 0x00000001, "Can object's contents be read", HFILL
}},
20049 { &hf_smb_nt_create_bits_oplock
,
20050 { "Exclusive Oplock", "smb.nt.create.oplock", FT_BOOLEAN
, 32,
20051 TFS(&tfs_nt_create_bits_oplock
), 0x00000002, "Is an oplock requested", HFILL
}},
20053 { &hf_smb_nt_create_bits_boplock
,
20054 { "Batch Oplock", "smb.nt.create.batch_oplock", FT_BOOLEAN
, 32,
20055 TFS(&tfs_nt_create_bits_boplock
), 0x00000004, "Is a batch oplock requested?", HFILL
}},
20057 { &hf_smb_nt_create_bits_dir
,
20058 { "Create Directory", "smb.nt.create.dir", FT_BOOLEAN
, 32,
20059 TFS(&tfs_nt_create_bits_dir
), 0x00000008, "Must target of open be a directory?", HFILL
}},
20061 { &hf_smb_nt_create_bits_ext_resp
,
20062 { "Extended Response", "smb.nt.create.ext", FT_BOOLEAN
, 32,
20063 TFS(&tfs_nt_create_bits_ext_resp
), 0x00000010, "Extended response required?", HFILL
}},
20065 { &hf_smb_nt_create_options_directory_file
,
20066 { "Directory", "smb.nt.create_options.directory", FT_BOOLEAN
, 32,
20067 TFS(&tfs_nt_create_options_directory
), 0x00000001, "Should file being opened/created be a directory?", HFILL
}},
20069 { &hf_smb_nt_create_options_write_through
,
20070 { "Write Through", "smb.nt.create_options.write_through", FT_BOOLEAN
, 32,
20071 TFS(&tfs_nt_create_options_write_through
), 0x00000002, "Should writes to the file write buffered data out before completing?", HFILL
}},
20073 { &hf_smb_nt_create_options_sequential_only
,
20074 { "Sequential Only", "smb.nt.create_options.sequential_only", FT_BOOLEAN
, 32,
20075 TFS(&tfs_nt_create_options_sequential_only
), 0x00000004, "Will access to this file only be sequential?", HFILL
}},
20077 { &hf_smb_nt_create_options_no_intermediate_buffering
,
20078 { "Intermediate Buffering", "smb.nt.create_options.intermediate_buffering", FT_BOOLEAN
, 32,
20079 TFS(&tfs_nt_create_options_no_intermediate_buffering
), 0x00000008, "Is intermediate buffering allowed?", HFILL
}},
20081 { &hf_smb_nt_create_options_sync_io_alert
,
20082 { "Sync I/O Alert", "smb.nt.create_options.sync_io_alert", FT_BOOLEAN
, 32,
20083 TFS(&tfs_nt_create_options_sync_io_alert
), 0x00000010, "All operations are performed synchronous", HFILL
}},
20085 { &hf_smb_nt_create_options_sync_io_nonalert
,
20086 { "Sync I/O Nonalert", "smb.nt.create_options.sync_io_nonalert", FT_BOOLEAN
, 32,
20087 TFS(&tfs_nt_create_options_sync_io_nonalert
), 0x00000020, "All operations are synchronous and may block", HFILL
}},
20089 { &hf_smb_nt_create_options_non_directory_file
,
20090 { "Non-Directory", "smb.nt.create_options.non_directory", FT_BOOLEAN
, 32,
20091 TFS(&tfs_nt_create_options_non_directory
), 0x00000040, "Should file being opened/created be a non-directory?", HFILL
}},
20093 { &hf_smb_nt_create_options_create_tree_connection
,
20094 { "Create Tree Connection", "smb.nt.create_options.create_tree_connection", FT_BOOLEAN
, 32,
20095 TFS(&tfs_nt_create_options_create_tree_connection
), 0x00000080, "Create Tree Connection flag", HFILL
}},
20097 { &hf_smb_nt_create_options_complete_if_oplocked
,
20098 { "Complete If Oplocked", "smb.nt.create_options.complete_if_oplocked", FT_BOOLEAN
, 32,
20099 TFS(&tfs_nt_create_options_complete_if_oplocked
), 0x00000100, "Complete if oplocked flag", HFILL
}},
20101 { &hf_smb_nt_create_options_no_ea_knowledge
,
20102 { "No EA Knowledge", "smb.nt.create_options.no_ea_knowledge", FT_BOOLEAN
, 32,
20103 TFS(&tfs_nt_create_options_no_ea_knowledge
), 0x00000200, "Does the client not understand extended attributes?", HFILL
}},
20105 { &hf_smb_nt_create_options_file_open_for_recovery
,
20106 { "Opened for recovery", "smb.nt.create_options.file_open_for_recovery", FT_BOOLEAN
, 32,
20107 TFS(&tfs_nt_create_options_file_open_for_recovery
), 0x00000400, "This option must be ignored by the server", HFILL
}},
20109 { &hf_smb_nt_create_options_random_access
,
20110 { "Random Access", "smb.nt.create_options.random_access", FT_BOOLEAN
, 32,
20111 TFS(&tfs_nt_create_options_random_access
), 0x00000800, "Will the client be accessing the file randomly?", HFILL
}},
20113 { &hf_smb_nt_create_options_delete_on_close
,
20114 { "Delete On Close", "smb.nt.create_options.delete_on_close", FT_BOOLEAN
, 32,
20115 TFS(&tfs_nt_create_options_delete_on_close
), 0x00001000, "Should the file be deleted when closed?", HFILL
}},
20116 { &hf_smb_nt_create_options_open_by_fileid
,
20117 { "Open By FileID", "smb.nt.create_options.open_by_fileid", FT_BOOLEAN
, 32,
20118 TFS(&tfs_nt_create_options_open_by_fileid
), 0x00002000, "Open file by inode", HFILL
}},
20120 { &hf_smb_nt_create_options_backup_intent
,
20121 { "Backup Intent", "smb.nt.create_options.backup_intent", FT_BOOLEAN
, 32,
20122 TFS(&tfs_nt_create_options_backup_intent
), 0x00004000, "Is this opened by BACKUP ADMIN for backup intent?", HFILL
}},
20124 { &hf_smb_nt_create_options_no_compression
,
20125 { "No Compression", "smb.nt.create_options.no_compression", FT_BOOLEAN
, 32,
20126 TFS(&tfs_nt_create_options_no_compression
), 0x00008000, "Is compression allowed?", HFILL
}},
20128 { &hf_smb_nt_create_options_reserve_opfilter
,
20129 { "Reserve Opfilter", "smb.nt.create_options.reserve_opfilter", FT_BOOLEAN
, 32,
20130 TFS(&tfs_nt_create_options_reserve_opfilter
), 0x00100000, "Reserve Opfilter flag", HFILL
}},
20132 { &hf_smb_nt_create_options_open_reparse_point
,
20133 { "Open Reparse Point", "smb.nt.create_options.open_reparse_point", FT_BOOLEAN
, 32,
20134 TFS(&tfs_nt_create_options_open_reparse_point
), 0x00200000, "Is this an open of a reparse point or of the normal file?", HFILL
}},
20136 { &hf_smb_nt_create_options_open_no_recall
,
20137 { "Open No Recall", "smb.nt.create_options.open_no_recall", FT_BOOLEAN
, 32,
20138 TFS(&tfs_nt_create_options_open_no_recall
), 0x00400000, "Open no recall flag", HFILL
}},
20140 { &hf_smb_nt_create_options_open_for_free_space_query
,
20141 { "Open For Free Space query", "smb.nt.create_options.open_for_free_space_query", FT_BOOLEAN
, 32,
20142 TFS(&tfs_nt_create_options_open_for_free_space_query
), 0x00800000, "Open For Free Space Query flag", HFILL
}},
20144 { &hf_smb_nt_share_access_read
,
20145 { "Read", "smb.share.access.read", FT_BOOLEAN
, 32,
20146 TFS(&tfs_nt_share_access_read
), SHARE_ACCESS_READ
, "Can the object be shared for reading?", HFILL
}},
20148 { &hf_smb_nt_share_access_write
,
20149 { "Write", "smb.share.access.write", FT_BOOLEAN
, 32,
20150 TFS(&tfs_nt_share_access_write
), SHARE_ACCESS_WRITE
, "Can the object be shared for write?", HFILL
}},
20152 { &hf_smb_nt_share_access_delete
,
20153 { "Delete", "smb.share.access.delete", FT_BOOLEAN
, 32,
20154 TFS(&tfs_nt_share_access_delete
), SHARE_ACCESS_DELETE
, NULL
, HFILL
}},
20156 { &hf_smb_file_eattr
,
20157 { "File Attributes", "smb.file_attribute", FT_UINT32
, BASE_HEX
,
20158 NULL
, 0x0, NULL
, HFILL
}},
20160 { &hf_smb_file_eattr_read_only
,
20161 { "Read Only", "smb.file_attribute.read_only", FT_BOOLEAN
, 32,
20162 TFS(&tfs_file_attribute_read_only
), SMB_FILE_ATTRIBUTE_READ_ONLY
, "READ ONLY file attribute", HFILL
}},
20164 { &hf_smb_file_eattr_hidden
,
20165 { "Hidden", "smb.file_attribute.hidden", FT_BOOLEAN
, 32,
20166 TFS(&tfs_file_attribute_hidden
), SMB_FILE_ATTRIBUTE_HIDDEN
, "HIDDEN file attribute", HFILL
}},
20168 { &hf_smb_file_eattr_system
,
20169 { "System", "smb.file_attribute.system", FT_BOOLEAN
, 32,
20170 TFS(&tfs_file_attribute_system
), SMB_FILE_ATTRIBUTE_SYSTEM
, "SYSTEM file attribute", HFILL
}},
20172 { &hf_smb_file_eattr_volume
,
20173 { "Volume ID", "smb.file_attribute.volume", FT_BOOLEAN
, 32,
20174 TFS(&tfs_file_attribute_volume
), SMB_FILE_ATTRIBUTE_VOLUME
, "VOLUME file attribute", HFILL
}},
20176 { &hf_smb_file_eattr_directory
,
20177 { "Directory", "smb.file_attribute.directory", FT_BOOLEAN
, 32,
20178 TFS(&tfs_file_attribute_directory
), SMB_FILE_ATTRIBUTE_DIRECTORY
, "DIRECTORY file attribute", HFILL
}},
20180 { &hf_smb_file_eattr_archive
,
20181 { "Archive", "smb.file_attribute.archive", FT_BOOLEAN
, 32,
20182 TFS(&tfs_file_attribute_archive
), SMB_FILE_ATTRIBUTE_ARCHIVE
, "ARCHIVE file attribute", HFILL
}},
20184 { &hf_smb_file_eattr_device
,
20185 { "Device", "smb.file_attribute.device", FT_BOOLEAN
, 32,
20186 TFS(&tfs_file_attribute_device
), SMB_FILE_ATTRIBUTE_DEVICE
, "Is this file a device?", HFILL
}},
20188 { &hf_smb_file_eattr_normal
,
20189 { "Normal", "smb.file_attribute.normal", FT_BOOLEAN
, 32,
20190 TFS(&tfs_file_attribute_normal
), SMB_FILE_ATTRIBUTE_NORMAL
, "Is this a normal file?", HFILL
}},
20192 { &hf_smb_file_eattr_temporary
,
20193 { "Temporary", "smb.file_attribute.temporary", FT_BOOLEAN
, 32,
20194 TFS(&tfs_file_attribute_temporary
), SMB_FILE_ATTRIBUTE_TEMPORARY
, "Is this a temporary file?", HFILL
}},
20196 { &hf_smb_file_eattr_sparse
,
20197 { "Sparse", "smb.file_attribute.sparse", FT_BOOLEAN
, 32,
20198 TFS(&tfs_file_attribute_sparse
), SMB_FILE_ATTRIBUTE_SPARSE
, "Is this a sparse file?", HFILL
}},
20200 { &hf_smb_file_eattr_reparse
,
20201 { "Reparse Point", "smb.file_attribute.reparse", FT_BOOLEAN
, 32,
20202 TFS(&tfs_file_attribute_reparse
), SMB_FILE_ATTRIBUTE_REPARSE
, "Does this file have an associated reparse point?", HFILL
}},
20204 { &hf_smb_file_eattr_compressed
,
20205 { "Compressed", "smb.file_attribute.compressed", FT_BOOLEAN
, 32,
20206 TFS(&tfs_file_attribute_compressed
), SMB_FILE_ATTRIBUTE_COMPRESSED
, "Is this file compressed?", HFILL
}},
20208 { &hf_smb_file_eattr_offline
,
20209 { "Offline", "smb.file_attribute.offline", FT_BOOLEAN
, 32,
20210 TFS(&tfs_file_attribute_offline
), SMB_FILE_ATTRIBUTE_OFFLINE
, "Is this file offline?", HFILL
}},
20212 { &hf_smb_file_eattr_not_content_indexed
,
20213 { "Content Indexed", "smb.file_attribute.not_content_indexed", FT_BOOLEAN
, 32,
20214 TFS(&tfs_file_attribute_not_content_indexed
), SMB_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
, "May this file be indexed by the content indexing service", HFILL
}},
20216 { &hf_smb_file_eattr_encrypted
,
20217 { "Encrypted", "smb.file_attribute.encrypted", FT_BOOLEAN
, 32,
20218 TFS(&tfs_file_attribute_encrypted
), SMB_FILE_ATTRIBUTE_ENCRYPTED
, "Is this file encrypted?", HFILL
}},
20220 { &hf_smb_size_returned_quota_data
,
20221 { "Size of returned Quota data", "smb.size_returned_quota_data", FT_UINT32
, BASE_DEC
,
20222 NULL
, 0x0, NULL
, HFILL
}},
20224 { &hf_smb_sec_desc_len
,
20225 { "NT Security Descriptor Length", "smb.sec_desc_len", FT_UINT32
, BASE_DEC
,
20226 NULL
, 0, NULL
, HFILL
}},
20229 { "Security Information", "smb.nt_qsd", FT_UINT32
, BASE_HEX
,
20230 NULL
, 0x0, NULL
, HFILL
}},
20232 { &hf_smb_nt_qsd_owner
,
20233 { "Owner", "smb.nt_qsd.owner", FT_BOOLEAN
, 32,
20234 TFS(&tfs_nt_qsd_owner
), NT_QSD_OWNER
, "Is owner security information being queried?", HFILL
}},
20236 { &hf_smb_nt_qsd_group
,
20237 { "Group", "smb.nt_qsd.group", FT_BOOLEAN
, 32,
20238 TFS(&tfs_nt_qsd_group
), NT_QSD_GROUP
, "Is group security information being queried?", HFILL
}},
20240 { &hf_smb_nt_qsd_dacl
,
20241 { "DACL", "smb.nt_qsd.dacl", FT_BOOLEAN
, 32,
20242 TFS(&tfs_nt_qsd_dacl
), NT_QSD_DACL
, "Is DACL security information being queried?", HFILL
}},
20244 { &hf_smb_nt_qsd_sacl
,
20245 { "SACL", "smb.nt_qsd.sacl", FT_BOOLEAN
, 32,
20246 TFS(&tfs_nt_qsd_sacl
), NT_QSD_SACL
, "Is SACL security information being queried?", HFILL
}},
20248 { &hf_smb_extended_attributes
,
20249 { "Extended Attributes", "smb.ext_attr", FT_BYTES
, BASE_NONE
,
20250 NULL
, 0, NULL
, HFILL
}},
20252 { &hf_smb_oplock_level
,
20253 { "Oplock level", "smb.oplock.level", FT_UINT8
, BASE_DEC
,
20254 VALS(oplock_level_vals
), 0, "Level of oplock granted", HFILL
}},
20256 { &hf_smb_response_type
,
20257 { "Response type", "smb.response_type", FT_UINT8
, BASE_HEX
,
20258 VALS(response_type_vals
), 0, "NT Transaction Create response type", HFILL
}},
20260 { &hf_smb_create_action
,
20261 { "Create action", "smb.create.action", FT_UINT32
, BASE_DEC
,
20262 VALS(oa_open_vals
), 0, "Type of action taken", HFILL
}},
20265 { "Server unique file ID", "smb.create.file_id", FT_UINT32
, BASE_HEX
,
20266 NULL
, 0, NULL
, HFILL
}},
20268 { &hf_smb_file_id_64bit
,
20269 { "Server unique 64-bit file ID", "smb.create.file_id_64b", FT_UINT64
, BASE_HEX
,
20270 NULL
, 0, NULL
, HFILL
}},
20272 { &hf_smb_ea_error_offset
,
20273 { "EA Error offset", "smb.ea.error_offset", FT_UINT32
, BASE_DEC
,
20274 NULL
, 0, "Offset into EA list if EA error", HFILL
}},
20276 { &hf_smb_end_of_file
,
20277 { "End Of File", "smb.end_of_file", FT_UINT64
, BASE_DEC
,
20278 NULL
, 0, "Offset to the first free byte in the file", HFILL
}},
20281 { "Replace", "smb.replace", FT_BOOLEAN
, BASE_NONE
,
20282 TFS(&tfs_smb_replace
), 0x0, "Remove target if it exists?", HFILL
}},
20284 { &hf_smb_root_dir_handle
,
20285 { "Root Directory Handle", "smb.root_dir_handle", FT_UINT32
, BASE_HEX
,
20286 NULL
, 0, NULL
, HFILL
}},
20288 { &hf_smb_target_name_len
,
20289 { "Target name length", "smb.target_name_len", FT_UINT32
, BASE_DEC
,
20290 NULL
, 0, "Length of target file name", HFILL
}},
20292 { &hf_smb_target_name
,
20293 { "Target name", "smb.target_name", FT_STRING
, BASE_NONE
,
20294 NULL
, 0, "Target file name", HFILL
}},
20296 { &hf_smb_device_type
,
20297 { "Device Type", "smb.device.type", FT_UINT32
, BASE_HEX
| BASE_EXT_STRING
,
20298 &device_type_vals_ext
, 0, "Type of device", HFILL
}},
20300 { &hf_smb_is_directory
,
20301 { "Is Directory", "smb.is_directory", FT_UINT8
, BASE_DEC
,
20302 VALS(is_directory_vals
), 0, "Is this object a directory?", HFILL
}},
20304 { &hf_smb_next_entry_offset
,
20305 { "Next Entry Offset", "smb.next_entry_offset", FT_UINT32
, BASE_DEC
,
20306 NULL
, 0, "Offset to next entry", HFILL
}},
20308 { &hf_smb_change_time
,
20309 { "Change", "smb.change.time", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
20310 NULL
, 0, "Last Change Time", HFILL
}},
20312 { &hf_smb_setup_len
,
20313 { "Setup Len", "smb.print.setup.len", FT_UINT16
, BASE_DEC
,
20314 NULL
, 0, "Length of printer setup data", HFILL
}},
20316 { &hf_smb_print_mode
,
20317 { "Mode", "smb.print.mode", FT_UINT16
, BASE_DEC
,
20318 VALS(print_mode_vals
), 0, "Text or Graphics mode", HFILL
}},
20320 { &hf_smb_print_identifier
,
20321 { "Identifier", "smb.print.identifier", FT_STRING
, BASE_NONE
,
20322 NULL
, 0, "Identifier string for this print job", HFILL
}},
20324 { &hf_smb_restart_index
,
20325 { "Restart Index", "smb.print.restart_index", FT_UINT16
, BASE_DEC
,
20326 NULL
, 0, "Index of entry after last returned", HFILL
}},
20328 { &hf_smb_print_queue_date
,
20329 { "Queued", "smb.print.queued.date", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
20330 NULL
, 0, "Date when this entry was queued", HFILL
}},
20332 { &hf_smb_print_queue_dos_date
,
20333 { "Queued Date", "smb.print.queued.smb.date", FT_UINT16
, BASE_HEX
,
20334 NULL
, 0, "Date when this print job was queued, SMB_DATE format", HFILL
}},
20336 { &hf_smb_print_queue_dos_time
,
20337 { "Queued Time", "smb.print.queued.smb.time", FT_UINT16
, BASE_HEX
,
20338 NULL
, 0, "Time when this print job was queued, SMB_TIME format", HFILL
}},
20340 { &hf_smb_print_status
,
20341 { "Status", "smb.print.status", FT_UINT8
, BASE_HEX
,
20342 VALS(print_status_vals
), 0, "Status of this entry", HFILL
}},
20344 { &hf_smb_print_spool_file_number
,
20345 { "Spool File Number", "smb.print.spool.file_number", FT_UINT16
, BASE_DEC
,
20346 NULL
, 0, "Spool File Number, assigned by the spooler", HFILL
}},
20348 { &hf_smb_print_spool_file_size
,
20349 { "Spool File Size", "smb.print.spool.file_size", FT_UINT32
, BASE_DEC
,
20350 NULL
, 0, "Number of bytes in spool file", HFILL
}},
20352 { &hf_smb_print_spool_file_name
,
20353 { "Name", "smb.print.spool.name", FT_STRINGZ
, BASE_NONE
,
20354 NULL
, 0, "Name of client that submitted this job", HFILL
}},
20356 { &hf_smb_start_index
,
20357 { "Start Index", "smb.print.start_index", FT_UINT16
, BASE_DEC
,
20358 NULL
, 0, "First queue entry to return", HFILL
}},
20360 { &hf_smb_originator_name
,
20361 { "Originator Name", "smb.originator_name", FT_STRINGZ
, BASE_NONE
,
20362 NULL
, 0, "Name of sender of message", HFILL
}},
20364 { &hf_smb_destination_name
,
20365 { "Destination Name", "smb.destination_name", FT_STRINGZ
, BASE_NONE
,
20366 NULL
, 0, "Name of recipient of message", HFILL
}},
20368 { &hf_smb_message_len
,
20369 { "Message Len", "smb.message.len", FT_UINT16
, BASE_DEC
,
20370 NULL
, 0, "Length of message", HFILL
}},
20373 { "Message", "smb.message", FT_STRING
, BASE_NONE
,
20374 NULL
, 0, "Message text", HFILL
}},
20377 { "Message Group ID", "smb.mgid", FT_UINT16
, BASE_DEC
,
20378 NULL
, 0, "Message group ID for multi-block messages", HFILL
}},
20380 { &hf_smb_forwarded_name
,
20381 { "Forwarded Name", "smb.forwarded_name", FT_STRINGZ
, BASE_NONE
,
20382 NULL
, 0, "Recipient name being forwarded", HFILL
}},
20384 { &hf_smb_machine_name
,
20385 { "Machine Name", "smb.machine_name", FT_STRINGZ
, BASE_NONE
,
20386 NULL
, 0, "Name of target machine", HFILL
}},
20388 { &hf_smb_cancel_to
,
20389 { "Cancel to", "smb.cancel_to", FT_FRAMENUM
, BASE_NONE
,
20390 NULL
, 0, "This packet is a cancellation of the packet in this frame", HFILL
}},
20392 { &hf_smb_trans_name
,
20393 { "Transaction Name", "smb.trans_name", FT_STRING
, BASE_NONE
,
20394 NULL
, 0, "Name of transaction", HFILL
}},
20396 { &hf_smb_transaction_flags
,
20397 { "Flags", "smb.transaction.flags", FT_UINT16
, BASE_HEX
,
20398 NULL
, 0x0, NULL
, HFILL
}},
20400 { &hf_smb_transaction_flags_dtid
,
20401 { "Disconnect TID", "smb.transaction.flags.dtid", FT_BOOLEAN
, 16,
20402 TFS(&tfs_tf_dtid
), 0x0001, "Disconnect TID?", HFILL
}},
20404 { &hf_smb_transaction_flags_owt
,
20405 { "One Way Transaction", "smb.transaction.flags.owt", FT_BOOLEAN
, 16,
20406 TFS(&tfs_tf_owt
), 0x0002, "One Way Transaction (no response)?", HFILL
}},
20408 { &hf_smb_search_count_max
,
20409 { "Search Count Max", "smb.search_count_max", FT_UINT16
, BASE_DEC
,
20410 NULL
, 0, "Maximum number of search entries to return", HFILL
}},
20412 { &hf_smb_search_count_found
,
20413 { "Search Count Found", "smb.search_count_found", FT_UINT16
, BASE_DEC
,
20414 NULL
, 0, "The number of files found", HFILL
}},
20416 { &hf_smb_search_pattern
,
20417 { "Search Pattern", "smb.search_pattern", FT_STRING
, BASE_NONE
,
20418 NULL
, 0, NULL
, HFILL
}},
20421 { "Flags", "smb.find_first2.flags", FT_UINT16
, BASE_HEX
,
20422 NULL
, 0x0, NULL
, HFILL
}},
20424 { &hf_smb_ff2_backup
,
20425 { "Backup Intent", "smb.find_first2.flags.backup", FT_BOOLEAN
, 16,
20426 TFS(&tfs_ff2_backup
), 0x0010, "Find with backup intent", HFILL
}},
20428 { &hf_smb_ff2_continue
,
20429 { "Continue", "smb.find_first2.flags.continue", FT_BOOLEAN
, 16,
20430 TFS(&tfs_ff2_continue
), 0x0008, "Continue search from previous ending place", HFILL
}},
20432 { &hf_smb_ff2_resume
,
20433 { "Resume", "smb.find_first2.flags.resume", FT_BOOLEAN
, 16,
20434 TFS(&tfs_ff2_resume
), FF2_RESUME
, "Return resume keys for each entry found", HFILL
}},
20436 { &hf_smb_ff2_close_eos
,
20437 { "Close on EOS", "smb.find_first2.flags.eos", FT_BOOLEAN
, 16,
20438 TFS(&tfs_ff2_close_eos
), 0x0002, "Close search if end of search reached", HFILL
}},
20440 { &hf_smb_ff2_close
,
20441 { "Close", "smb.find_first2.flags.close", FT_BOOLEAN
, 16,
20442 TFS(&tfs_ff2_close
), 0x0001, "Close search after this request", HFILL
}},
20444 { &hf_smb_ff2_information_level
,
20445 { "Level of Interest", "smb.ff2_loi", FT_UINT16
, BASE_HEX
,
20446 VALS(ff2_il_vals
), 0, "Level of interest for FIND_FIRST2 command", HFILL
}},
20449 { "Level of Interest", "smb.qpi_loi", FT_UINT16
, BASE_HEX
,
20450 VALS(qpi_loi_vals
), 0, "Level of interest for TRANSACTION[2] QUERY_{FILE,PATH}_INFO commands", HFILL
}},
20453 { "Level of Interest", "smb.spi_loi", FT_UINT16
, BASE_HEX
| BASE_EXT_STRING
,
20454 &spi_loi_vals_ext
, 0, "Level of interest for TRANSACTION[2] SET_{FILE,PATH}_INFO commands", HFILL
}},
20458 { "IO Flag", "smb.sfi_flags", FT_UINT16
, BASE_HEX
,
20459 NULL
, 0x0, NULL
, HFILL
}},
20461 { &hf_smb_sfi_writetru
,
20462 { "Writethrough", "smb.sfi_writethrough", FT_BOOLEAN
, 16,
20463 TFS(&tfs_da_writetru
), 0x0010, "Writethrough mode?", HFILL
}},
20465 { &hf_smb_sfi_caching
,
20466 { "Caching", "smb.sfi_caching", FT_BOOLEAN
, 16,
20467 TFS(&tfs_da_caching
), 0x0020, "Caching mode?", HFILL
}},
20470 { &hf_smb_storage_type
,
20471 { "Storage Type", "smb.storage_type", FT_UINT32
, BASE_DEC
,
20472 NULL
, 0, "Type of storage", HFILL
}},
20475 { "Resume Key", "smb.resume", FT_UINT32
, BASE_DEC
,
20476 NULL
, 0, NULL
, HFILL
}},
20478 { &hf_smb_max_referral_level
,
20479 { "Max Referral Level", "smb.max_referral_level", FT_UINT16
, BASE_DEC
,
20480 NULL
, 0, "Latest referral version number understood", HFILL
}},
20482 { &hf_smb_qfsi_information_level
,
20483 { "Level of Interest", "smb.qfsi_loi", FT_UINT16
, BASE_HEX
| BASE_EXT_STRING
,
20484 &qfsi_vals_ext
, 0, "Level of interest for QUERY_FS_INFORMATION2 command", HFILL
}},
20486 { &hf_smb_sfsi_information_level
,
20487 { "Level of Interest", "smb.sfsi_loi", FT_UINT16
, BASE_HEX
,
20488 VALS(sfsi_vals
), 0, "Level of interest for SET_FS_INFORMATION2 command", HFILL
}},
20490 { &hf_smb_nt_rename_level
,
20491 { "Level of Interest", "smb.ntr_loi", FT_UINT16
, BASE_DEC
,
20492 VALS(nt_rename_vals
), 0, "NT Rename level", HFILL
}},
20494 { &hf_smb_cluster_count
,
20495 { "Cluster count", "smb.ntr_clu", FT_UINT32
, BASE_DEC
,
20496 NULL
, 0, "Number of clusters", HFILL
}},
20498 { &hf_smb_number_of_links
,
20499 { "Link Count", "smb.link_count", FT_UINT32
, BASE_DEC
,
20500 NULL
, 0, "Number of hard links to the file", HFILL
}},
20502 { &hf_smb_delete_pending
,
20503 { "Delete Pending", "smb.delete_pending", FT_UINT16
, BASE_DEC
,
20504 VALS(delete_pending_vals
), 0, "Is this object about to be deleted?", HFILL
}},
20506 { &hf_smb_index_number
,
20507 { "Index Number", "smb.index_number", FT_UINT64
, BASE_HEX
,
20508 NULL
, 0, "File system unique identifier", HFILL
}},
20510 { &hf_smb_position
,
20511 { "Position", "smb.position", FT_UINT64
, BASE_DEC
,
20512 NULL
, 0, "File position", HFILL
}},
20515 { &hf_smb_current_offset
,
20516 { "Current Offset", "smb.offset", FT_UINT64
, BASE_DEC
,
20517 NULL
, 0, "Current offset in the file", HFILL
}},
20520 { &hf_smb_t2_alignment
,
20521 { "Alignment", "smb.alignment", FT_UINT32
, BASE_DEC
,
20522 VALS(alignment_vals
), 0, "What alignment do we require for buffers", HFILL
}},
20524 { &hf_smb_t2_stream_name_length
,
20525 { "Stream Name Length", "smb.stream_name_len", FT_UINT32
, BASE_DEC
,
20526 NULL
, 0, "Length of stream name", HFILL
}},
20528 { &hf_smb_t2_stream_size
,
20529 { "Stream Size", "smb.stream_size", FT_UINT64
, BASE_DEC
,
20530 NULL
, 0, "Size of the stream in number of bytes", HFILL
}},
20532 { &hf_smb_t2_stream_name
,
20533 { "Stream Name", "smb.stream_name", FT_STRING
, BASE_NONE
,
20534 NULL
, 0, "Name of the stream", HFILL
}},
20536 { &hf_smb_t2_compressed_file_size
,
20537 { "Compressed Size", "smb.compressed.file_size", FT_UINT64
, BASE_DEC
,
20538 NULL
, 0, "Size of the compressed file", HFILL
}},
20540 { &hf_smb_t2_compressed_format
,
20541 { "Compression Format", "smb.compressed.format", FT_UINT16
, BASE_DEC
,
20542 NULL
, 0, "Compression algorithm used", HFILL
}},
20544 { &hf_smb_t2_compressed_unit_shift
,
20545 { "Unit Shift", "smb.compressed.unit_shift", FT_UINT8
, BASE_DEC
,
20546 NULL
, 0, "Size of the stream in number of bytes", HFILL
}},
20548 { &hf_smb_t2_compressed_chunk_shift
,
20549 { "Chunk Shift", "smb.compressed.chunk_shift", FT_UINT8
, BASE_DEC
,
20550 NULL
, 0, "Allocated size of the stream in number of bytes", HFILL
}},
20552 { &hf_smb_t2_compressed_cluster_shift
,
20553 { "Cluster Shift", "smb.compressed.cluster_shift", FT_UINT8
, BASE_DEC
,
20554 NULL
, 0, "Allocated size of the stream in number of bytes", HFILL
}},
20556 { &hf_smb_t2_marked_for_deletion
,
20557 { "Marked for Deletion", "smb.marked_for_deletion", FT_BOOLEAN
, BASE_NONE
,
20558 TFS(&tfs_marked_for_deletion
), 0x0, "Marked for deletion?", HFILL
}},
20560 { &hf_smb_dfs_path_consumed
,
20561 { "Path Consumed", "smb.dfs.path_consumed", FT_UINT16
, BASE_DEC
,
20562 NULL
, 0, "Number of RequestFilename bytes client", HFILL
}},
20564 { &hf_smb_dfs_num_referrals
,
20565 { "Num Referrals", "smb.dfs.num_referrals", FT_UINT16
, BASE_DEC
,
20566 NULL
, 0, "Number of referrals in this pdu", HFILL
}},
20568 { &hf_smb_get_dfs_flags
,
20569 { "Flags", "smb.dfs.flags", FT_UINT16
, BASE_HEX
,
20570 NULL
, 0x0, NULL
, HFILL
}},
20572 { &hf_smb_get_dfs_server_hold_storage
,
20573 { "Hold Storage", "smb.dfs.flags.server_hold_storage", FT_BOOLEAN
, 16,
20574 TFS(&tfs_get_dfs_server_hold_storage
), 0x0002, "The servers in referrals should hold storage for the file", HFILL
}},
20576 { &hf_smb_get_dfs_fielding
,
20577 { "Fielding", "smb.dfs.flags.fielding", FT_BOOLEAN
, 16,
20578 TFS(&tfs_get_dfs_fielding
), 0x0001, "The servers in referrals are capable of fielding", HFILL
}},
20580 { &hf_smb_dfs_referral_version
,
20581 { "Version", "smb.dfs.referral.version", FT_UINT16
, BASE_DEC
,
20582 NULL
, 0, "Version of referral element", HFILL
}},
20584 { &hf_smb_dfs_referral_size
,
20585 { "Size", "smb.dfs.referral.size", FT_UINT16
, BASE_DEC
,
20586 NULL
, 0, "Size of referral element", HFILL
}},
20588 { &hf_smb_dfs_referral_server_type
,
20589 { "Server Type", "smb.dfs.referral.server.type", FT_UINT16
, BASE_DEC
,
20590 VALS(dfs_referral_server_type_vals
), 0, "Type of referral server", HFILL
}},
20592 { &hf_smb_dfs_referral_flags
,
20593 { "Flags", "smb.dfs.referral.flags", FT_UINT16
, BASE_HEX
,
20594 NULL
, 0x0, NULL
, HFILL
}},
20596 { &hf_smb_dfs_referral_flags_name_list_referral
,
20597 { "NameListReferral", "smb.dfs.referral.flags.name_list_referral", FT_BOOLEAN
, 16,
20598 TFS(&tfs_dfs_referral_flags_name_list_referral
), REFENT_FLAGS_NAME_LIST_REFERRAL
, "Is a domain/DC referral response?", HFILL
}},
20600 { &hf_smb_dfs_referral_flags_target_set_boundary
,
20601 { "TargetSetBoundary", "smb.dfs.referral.flags.target_set_boundary", FT_BOOLEAN
, 16,
20602 TFS(&tfs_dfs_referral_flags_target_set_boundary
), REFENT_FLAGS_TARGET_SET_BOUNDARY
, "Is this a first target in the target set?", HFILL
}},
20604 { &hf_smb_dfs_referral_node_offset
,
20605 { "Node Offset", "smb.dfs.referral.node_offset", FT_UINT16
, BASE_DEC
,
20606 NULL
, 0, "Offset of name of entity to visit next", HFILL
}},
20608 { &hf_smb_dfs_referral_node
,
20609 { "Node", "smb.dfs.referral.node", FT_STRING
, BASE_NONE
,
20610 NULL
, 0, "Name of entity to visit next", HFILL
}},
20612 { &hf_smb_dfs_referral_proximity
,
20613 { "Proximity", "smb.dfs.referral.proximity", FT_UINT32
, BASE_DEC
,
20614 NULL
, 0, "Hint describing proximity of this server to the client", HFILL
}},
20616 { &hf_smb_dfs_referral_ttl
,
20617 { "TTL", "smb.dfs.referral.ttl", FT_UINT32
, BASE_DEC
,
20618 NULL
, 0, "Number of seconds the client can cache this referral", HFILL
}},
20620 { &hf_smb_dfs_referral_path_offset
,
20621 { "Path Offset", "smb.dfs.referral.path_offset", FT_UINT16
, BASE_DEC
,
20622 NULL
, 0, "Offset of Dfs Path that matched pathconsumed", HFILL
}},
20624 { &hf_smb_dfs_referral_path
,
20625 { "Path", "smb.dfs.referral.path", FT_STRING
, BASE_NONE
,
20626 NULL
, 0, "Dfs Path that matched pathconsumed", HFILL
}},
20628 { &hf_smb_dfs_referral_alt_path_offset
,
20629 { "Alt Path Offset", "smb.dfs.referral.alt_path_offset", FT_UINT16
, BASE_DEC
,
20630 NULL
, 0, "Offset of alternative(8.3) Path that matched pathconsumed", HFILL
}},
20632 { &hf_smb_dfs_referral_alt_path
,
20633 { "Alt Path", "smb.dfs.referral.alt_path", FT_STRING
, BASE_NONE
,
20634 NULL
, 0, "Alternative(8.3) Path that matched pathconsumed", HFILL
}},
20636 { &hf_smb_dfs_referral_domain_offset
,
20637 { "Domain Offset", "smb.dfs.referral.domain_offset", FT_UINT16
, BASE_DEC
,
20638 NULL
, 0, "Offset of Dfs Path that matched pathconsumed", HFILL
}},
20640 { &hf_smb_dfs_referral_number_of_expnames
,
20641 { "Number of Expanded Names", "smb.dfs.referral.number_of_expnames", FT_UINT16
, BASE_DEC
,
20642 NULL
, 0, NULL
, HFILL
}},
20644 { &hf_smb_dfs_referral_expnames_offset
,
20645 { "Expanded Names Offset", "smb.dfs.referral.expnames_offset", FT_UINT16
, BASE_DEC
,
20646 NULL
, 0, "Offset of Dfs Path that matched pathconsumed", HFILL
}},
20648 { &hf_smb_dfs_referral_domain_name
,
20649 { "Domain Name", "smb.dfs.referral.domain_name", FT_STRING
, BASE_NONE
,
20650 NULL
, 0, "Dfs referral domain name", HFILL
}},
20652 { &hf_smb_dfs_referral_expname
,
20653 { "Expanded Name", "smb.dfs.referral.expname", FT_STRING
, BASE_NONE
,
20654 NULL
, 0, "Dfs expanded name", HFILL
}},
20656 { &hf_smb_dfs_referral_server_guid
,
20657 { "Server GUID", "smb.dfs.referral.server_guid", FT_GUID
, BASE_NONE
,
20658 NULL
, 0, "Globally unique identifier for this server", HFILL
}},
20660 { &hf_smb_end_of_search
,
20661 { "End Of Search", "smb.end_of_search", FT_UINT16
, BASE_DEC
,
20662 NULL
, 0, "Was last entry returned?", HFILL
}},
20664 { &hf_smb_last_name_offset
,
20665 { "Last Name Offset", "smb.last_name_offset", FT_UINT16
, BASE_DEC
,
20666 NULL
, 0, "If non-0 this is the offset into the datablock for the file name of the last entry", HFILL
}},
20668 { &hf_smb_fn_information_level
,
20669 { "Level of Interest", "smb.fn_loi", FT_UINT16
, BASE_DEC
,
20670 NULL
, 0, "Level of interest for FIND_NOTIFY command", HFILL
}},
20672 { &hf_smb_monitor_handle
,
20673 { "Monitor Handle", "smb.monitor_handle", FT_UINT16
, BASE_HEX
,
20674 NULL
, 0, "Handle for Find Notify operations", HFILL
}},
20676 { &hf_smb_change_count
,
20677 { "Change Count", "smb.change_count", FT_UINT16
, BASE_DEC
,
20678 NULL
, 0, "Number of changes to wait for", HFILL
}},
20680 { &hf_smb_file_index
,
20681 { "File Index", "smb.file_index", FT_UINT32
, BASE_DEC
,
20682 NULL
, 0, NULL
, HFILL
}},
20684 { &hf_smb_short_file_name
,
20685 { "Short File Name", "smb.short_file", FT_STRING
, BASE_NONE
,
20686 NULL
, 0, "Short (8.3) File Name", HFILL
}},
20688 { &hf_smb_short_file_name_len
,
20689 { "Short File Name Len", "smb.short_file_name_len", FT_UINT32
, BASE_DEC
,
20690 NULL
, 0, "Length of Short (8.3) File Name", HFILL
}},
20693 { "FS Id", "smb.fs_id", FT_UINT32
, BASE_DEC
,
20694 NULL
, 0, "File System ID (NT Server always returns 0)", HFILL
}},
20696 { &hf_smb_sector_unit
,
20697 { "Sectors/Unit", "smb.fs_sector_per_unit", FT_UINT32
, BASE_DEC
,
20698 NULL
, 0, "Sectors per allocation unit", HFILL
}},
20700 { &hf_smb_fs_units
,
20701 { "Total Units", "smb.fs_units", FT_UINT32
, BASE_DEC
,
20702 NULL
, 0, "Total number of units on this filesystem", HFILL
}},
20704 { &hf_smb_fs_sector
,
20705 { "Bytes per Sector", "smb.fs_bytes_per_sector", FT_UINT32
, BASE_DEC
,
20706 NULL
, 0, NULL
, HFILL
}},
20708 { &hf_smb_avail_units
,
20709 { "Available Units", "smb.avail.units", FT_UINT32
, BASE_DEC
,
20710 NULL
, 0, "Total number of available units on this filesystem", HFILL
}},
20712 { &hf_smb_volume_serial_num
,
20713 { "Volume Serial Number", "smb.volume.serial", FT_UINT32
, BASE_HEX
,
20714 NULL
, 0, NULL
, HFILL
}},
20716 { &hf_smb_volume_label_len
,
20717 { "Label Length", "smb.volume.label.len", FT_UINT32
, BASE_DEC
,
20718 NULL
, 0, "Length of volume label", HFILL
}},
20720 { &hf_smb_volume_label
,
20721 { "Label", "smb.volume.label", FT_STRING
, BASE_NONE
,
20722 NULL
, 0, "Volume label", HFILL
}},
20724 { &hf_smb_free_alloc_units64
,
20725 { "Free Units", "smb.free_alloc_units", FT_UINT64
, BASE_DEC
,
20726 NULL
, 0, "Number of free allocation units", HFILL
}},
20728 { &hf_smb_caller_free_alloc_units64
,
20729 { "Caller Free Units", "smb.caller_free_alloc_units", FT_UINT64
, BASE_DEC
,
20730 NULL
, 0, "Number of caller free allocation units", HFILL
}},
20732 { &hf_smb_actual_free_alloc_units64
,
20733 { "Actual Free Units", "smb.actual_free_alloc_units", FT_UINT64
, BASE_DEC
,
20734 NULL
, 0, "Number of actual free allocation units", HFILL
}},
20736 { &hf_smb_soft_quota_limit
,
20737 { "(Soft) Quota Threshold", "smb.quota.soft.default", FT_UINT64
, BASE_DEC
,
20738 NULL
, 0, "Soft Quota threshold", HFILL
}},
20740 { &hf_smb_hard_quota_limit
,
20741 { "(Hard) Quota Limit", "smb.quota.hard.default", FT_UINT64
, BASE_DEC
,
20742 NULL
, 0, "Hard Quota limit", HFILL
}},
20744 { &hf_smb_user_quota_used
,
20745 { "Quota Used", "smb.quota.used", FT_UINT64
, BASE_DEC
,
20746 NULL
, 0, "How much Quota is used by this user", HFILL
}},
20748 { &hf_smb_max_name_len
,
20749 { "Max name length", "smb.fs_max_name_len", FT_UINT32
, BASE_DEC
,
20750 NULL
, 0, "Maximum length of each file name component in number of bytes", HFILL
}},
20752 { &hf_smb_fs_name_len
,
20753 { "Label Length", "smb.fs_name.len", FT_UINT32
, BASE_DEC
,
20754 NULL
, 0, "Length of filesystem name in bytes", HFILL
}},
20757 { "FS Name", "smb.fs_name", FT_STRING
, BASE_NONE
,
20758 NULL
, 0, "Name of filesystem", HFILL
}},
20760 { &hf_smb_device_char
,
20761 { "Device Characteristics", "smb.device", FT_UINT32
, BASE_HEX
,
20762 NULL
, 0x0, NULL
, HFILL
}},
20764 { &hf_smb_device_char_removable
,
20765 { "Removable", "smb.device.removable", FT_BOOLEAN
, 32,
20766 TFS(&tfs_device_char_removable
), 0x00000001, "Is this a removable device", HFILL
}},
20768 { &hf_smb_device_char_read_only
,
20769 { "Read Only", "smb.device.read_only", FT_BOOLEAN
, 32,
20770 TFS(&tfs_device_char_read_only
), 0x00000002, "Is this a read-only device", HFILL
}},
20772 { &hf_smb_device_char_floppy
,
20773 { "Floppy", "smb.device.floppy", FT_BOOLEAN
, 32,
20774 TFS(&tfs_device_char_floppy
), 0x00000004, "Is this a floppy disk", HFILL
}},
20776 { &hf_smb_device_char_write_once
,
20777 { "Write Once", "smb.device.write_once", FT_BOOLEAN
, 32,
20778 TFS(&tfs_device_char_write_once
), 0x00000008, "Is this a write-once device", HFILL
}},
20780 { &hf_smb_device_char_remote
,
20781 { "Remote", "smb.device.remote", FT_BOOLEAN
, 32,
20782 TFS(&tfs_device_char_remote
), 0x00000010, "Is this a remote device", HFILL
}},
20784 { &hf_smb_device_char_mounted
,
20785 { "Mounted", "smb.device.mounted", FT_BOOLEAN
, 32,
20786 TFS(&tfs_device_char_mounted
), 0x00000020, "Is this a mounted device", HFILL
}},
20788 { &hf_smb_device_char_virtual
,
20789 { "Virtual", "smb.device.virtual", FT_BOOLEAN
, 32,
20790 TFS(&tfs_device_char_virtual
), 0x00000040, "Is this a virtual device", HFILL
}},
20792 { &hf_smb_device_char_secure_open
,
20793 { "Secure Open", "smb.device.secure_open", FT_BOOLEAN
, 32,
20794 TFS(&tfs_device_char_secure_open
), 0x00000100, "Is this a secure open device", HFILL
}},
20796 { &hf_smb_device_char_ts
,
20797 { "Terminal Services", "smb.device.ts", FT_BOOLEAN
, 32,
20798 TFS(&tfs_device_char_ts
), 0x00001000, "Is this a terminal services device", HFILL
}},
20800 { &hf_smb_device_char_webdav
,
20801 { "Webdav", "smb.device.webdav", FT_BOOLEAN
, 32,
20802 TFS(&tfs_device_char_webdav
), 0x00002000, "Is this a WEBDAV device", HFILL
}},
20804 { &hf_smb_device_char_aat
,
20805 { "Allow Appcontainer Traversal", "smb.device.aat", FT_BOOLEAN
, 32,
20806 TFS(&tfs_device_char_aat
), 0x00020000, "Does this device allow appcontainer traversal", HFILL
}},
20808 { &hf_smb_device_char_portable
,
20809 { "Portable", "smb.device.portable", FT_BOOLEAN
, 32,
20810 TFS(&tfs_device_char_portable
), 0x00004000, "Is this a portable device", HFILL
}},
20813 { "FS Attributes", "smb.fs_attr", FT_UINT32
, BASE_HEX
,
20814 NULL
, 0x0, NULL
, HFILL
}},
20816 { &hf_smb_fs_attr_css
,
20817 { "Case Sensitive Search", "smb.fs_attr.css", FT_BOOLEAN
, 32,
20818 TFS(&tfs_fs_attr_css
), 0x00000001, "Does this FS support Case Sensitive Search?", HFILL
}},
20820 { &hf_smb_fs_attr_cpn
,
20821 { "Case Preserving", "smb.fs_attr.cpn", FT_BOOLEAN
, 32,
20822 TFS(&tfs_fs_attr_cpn
), 0x00000002, "Will this FS Preserve Name Case?", HFILL
}},
20824 { &hf_smb_fs_attr_uod
,
20825 { "Unicode On Disk", "smb.fs_attr.uod", FT_BOOLEAN
, 32,
20826 TFS(&tfs_fs_attr_uod
), 0x00000004, "Does this FS support Unicode On Disk?", HFILL
}},
20828 { &hf_smb_fs_attr_pacls
,
20829 { "Persistent ACLs", "smb.fs_attr.pacls", FT_BOOLEAN
, 32,
20830 TFS(&tfs_fs_attr_pacls
), 0x00000008, "Does this FS support Persistent ACLs?", HFILL
}},
20832 { &hf_smb_fs_attr_fc
,
20833 { "Compression", "smb.fs_attr.fc", FT_BOOLEAN
, 32,
20834 TFS(&tfs_fs_attr_fc
), 0x00000010, "Does this FS support File Compression?", HFILL
}},
20836 { &hf_smb_fs_attr_vq
,
20837 { "Volume Quotas", "smb.fs_attr.vq", FT_BOOLEAN
, 32,
20838 TFS(&tfs_fs_attr_vq
), 0x00000020, "Does this FS support Volume Quotas?", HFILL
}},
20840 { &hf_smb_fs_attr_ssf
,
20841 { "Sparse Files", "smb.fs_attr.ssf", FT_BOOLEAN
, 32,
20842 TFS(&tfs_fs_attr_ssf
), 0x00000040, "Does this FS support SPARSE FILES?", HFILL
}},
20844 { &hf_smb_fs_attr_srp
,
20845 { "Reparse Points", "smb.fs_attr.srp", FT_BOOLEAN
, 32,
20846 TFS(&tfs_fs_attr_srp
), 0x00000080, "Does this FS support REPARSE POINTS?", HFILL
}},
20848 { &hf_smb_fs_attr_srs
,
20849 { "Remote Storage", "smb.fs_attr.srs", FT_BOOLEAN
, 32,
20850 TFS(&tfs_fs_attr_srs
), 0x00000100, "Does this FS support REMOTE STORAGE?", HFILL
}},
20852 { &hf_smb_fs_attr_sla
,
20853 { "LFN APIs", "smb.fs_attr.sla", FT_BOOLEAN
, 32,
20854 TFS(&tfs_fs_attr_sla
), 0x00004000, "Does this FS support LFN APIs?", HFILL
}},
20856 { &hf_smb_fs_attr_vic
,
20857 { "Volume Is Compressed", "smb.fs_attr.vis", FT_BOOLEAN
, 32,
20858 TFS(&tfs_fs_attr_vic
), 0x00008000, "Is this FS on a compressed volume?", HFILL
}},
20860 { &hf_smb_fs_attr_soids
,
20861 { "Supports OIDs", "smb.fs_attr.soids", FT_BOOLEAN
, 32,
20862 TFS(&tfs_fs_attr_soids
), 0x00010000, "Does this FS support OIDs?", HFILL
}},
20864 { &hf_smb_fs_attr_se
,
20865 { "Supports Encryption", "smb.fs_attr.se", FT_BOOLEAN
, 32,
20866 TFS(&tfs_fs_attr_se
), 0x00020000, "Does this FS support encryption?", HFILL
}},
20868 { &hf_smb_fs_attr_ns
,
20869 { "Named Streams", "smb.fs_attr.ns", FT_BOOLEAN
, 32,
20870 TFS(&tfs_fs_attr_ns
), 0x00040000, "Does this FS support named streams?", HFILL
}},
20872 { &hf_smb_fs_attr_rov
,
20873 { "Read Only Volume", "smb.fs_attr.rov", FT_BOOLEAN
, 32,
20874 TFS(&tfs_fs_attr_rov
), 0x00080000, "Is this FS on a read only volume?", HFILL
}},
20876 { &hf_smb_fs_attr_swo
,
20877 { "Sequential Write Once", "smb.fs_attr.swo", FT_BOOLEAN
, 32,
20878 TFS(&tfs_fs_attr_swo
), 0x00100000, "Is this FS on a sequential write once volume?", HFILL
}},
20880 { &hf_smb_fs_attr_st
,
20881 { "Transactions", "smb.fs_attr.st", FT_BOOLEAN
, 32,
20882 TFS(&tfs_fs_attr_st
), 0x00200000, "Does this FS support transactions?", HFILL
}},
20884 { &hf_smb_fs_attr_shl
,
20885 { "Hard Links", "smb.fs_attr.shl", FT_BOOLEAN
, 32,
20886 TFS(&tfs_fs_attr_shl
), 0x00400000, "Does this FS support hard links?", HFILL
}},
20888 { &hf_smb_fs_attr_sis
,
20889 { "Integrity Streams", "smb.fs_attr.sis", FT_BOOLEAN
, 32,
20890 TFS(&tfs_fs_attr_sis
), 0x04000000, "Does this FS support integrity streams?", HFILL
}},
20892 { &hf_smb_fs_attr_sbr
,
20893 { "Block Refcounting", "smb.fs_attr.sbr", FT_BOOLEAN
, 32,
20894 TFS(&tfs_fs_attr_sbr
), 0x08000000, "Does this FS support block refcounting?", HFILL
}},
20896 { &hf_smb_fs_attr_ssv
,
20897 { "Sparse VDL", "smb.fs_attr.ssv", FT_BOOLEAN
, 32,
20898 TFS(&tfs_fs_attr_ssv
), 0x10000000, "Does this FS support sparse VDL?", HFILL
}},
20900 { &hf_smb_user_quota_change_time
,
20901 { "Change Time", "smb.quota.user.change_time", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
20902 NULL
, 0x0, "The last time the quota was changed", HFILL
}},
20904 { &hf_smb_length_of_sid
,
20905 { "Length of SID", "smb.length_of_sid", FT_UINT32
, BASE_DEC
,
20906 NULL
, 0x0, NULL
, HFILL
}},
20908 { &hf_smb_user_quota_offset
,
20909 { "Next Offset", "smb.quota.user.offset", FT_UINT32
, BASE_DEC
,
20910 NULL
, 0, "Relative offset to next user quota structure", HFILL
}},
20912 { &hf_smb_pipe_write_len
,
20913 { "Pipe Write Len", "smb.pipe.write_len", FT_UINT16
, BASE_DEC
,
20914 NULL
, 0, "Number of bytes written to pipe", HFILL
}},
20916 { &hf_smb_quota_flags_deny_disk
,
20917 { "Deny Disk", "smb.quota.flags.deny_disk", FT_BOOLEAN
, 8,
20918 TFS(&tfs_quota_flags_deny_disk
), 0x02, "Is the default quota limit enforced?", HFILL
}},
20920 { &hf_smb_quota_flags_log_limit
,
20921 { "Log Limit", "smb.quota.flags.log_limit", FT_BOOLEAN
, 8,
20922 TFS(&tfs_quota_flags_log_limit
), 0x20, "Should the server log an event when the limit is exceeded?", HFILL
}},
20924 { &hf_smb_quota_flags_log_warning
,
20925 { "Log Warning", "smb.quota.flags.log_warning", FT_BOOLEAN
, 8,
20926 TFS(&tfs_quota_flags_log_warning
), 0x10, "Should the server log an event when the warning level is exceeded?", HFILL
}},
20928 { &hf_smb_quota_flags
,
20929 { "Quota Flags", "smb.quota.flags", FT_UINT8
, BASE_HEX
,
20930 NULL
, 0x0, NULL
, HFILL
}},
20932 { &hf_smb_quota_flags_enabled
,
20933 { "Enabled", "smb.quota.flags.enabled", FT_BOOLEAN
, 8,
20934 TFS(&tfs_quota_flags_enabled
), 0x01, "Is quotas enabled of this FS?", HFILL
}},
20936 { &hf_smb_segment_overlap
,
20937 { "Fragment overlap", "smb.segment.overlap", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
20938 "Fragment overlaps with other fragments", HFILL
}},
20940 { &hf_smb_segment_overlap_conflict
,
20941 { "Conflicting data in fragment overlap", "smb.segment.overlap.conflict", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
20942 "Overlapping fragments contained conflicting data", HFILL
}},
20944 { &hf_smb_segment_multiple_tails
,
20945 { "Multiple tail fragments found", "smb.segment.multipletails", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
20946 "Several tails were found when defragmenting the packet", HFILL
}},
20948 { &hf_smb_segment_too_long_fragment
,
20949 { "Fragment too long", "smb.segment.toolongfragment", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
20950 "Fragment contained data past end of packet", HFILL
}},
20952 { &hf_smb_segment_error
,
20953 { "Defragmentation error", "smb.segment.error", FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
20954 "Defragmentation error due to illegal fragments", HFILL
}},
20956 { &hf_smb_segment_count
,
20957 { "Fragment count", "smb.fragment.count", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
20960 { &hf_smb_reassembled_length
,
20961 { "Reassembled SMB length", "smb.reassembled.length", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
20962 "The total length of the reassembled payload", HFILL
}},
20964 { &hf_smb_opened_in
,
20965 { "Opened in", "smb.fid.opened_in", FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
20966 "The frame this fid was opened", HFILL
}},
20968 { &hf_smb_closed_in
,
20969 { "Closed in", "smb.fid.closed_in", FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
20970 "The frame this fid was closed", HFILL
}},
20972 { &hf_smb_mapped_in
,
20973 { "Mapped in", "smb.fid.mapped_in", FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
20974 "The frame this share was mapped", HFILL
}},
20976 { &hf_smb_unmapped_in
,
20977 { "Unmapped in", "smb.fid.unmapped_in", FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
20978 "The frame this share was unmapped", HFILL
}},
20981 { "SMB Segment", "smb.segment", FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
20984 { &hf_smb_segments
,
20985 { "SMB Segments", "smb.segment.segments", FT_NONE
, BASE_NONE
, NULL
, 0x0,
20988 { &hf_smb_unix_major_version
,
20989 { "Major Version", "smb.unix.major_version", FT_UINT16
, BASE_DEC
,
20990 NULL
, 0, "UNIX Major Version", HFILL
}},
20992 { &hf_smb_unix_minor_version
,
20993 { "Minor Version", "smb.unix.minor_version", FT_UINT16
, BASE_DEC
,
20994 NULL
, 0, "UNIX Minor Version", HFILL
}},
20996 { &hf_smb_unix_capability
,
20997 { "Capabilities", "smb.unix.capability", FT_UINT64
, BASE_HEX
,
20998 NULL
, 0x0, NULL
, HFILL
}},
21000 { &hf_smb_unix_capability_fcntl
,
21001 { "FCNTL Capability", "smb.unix.capability.fcntl", FT_BOOLEAN
, 32,
21002 TFS(&tfs_set_notset
), 0x00000001, NULL
, HFILL
}},
21004 { &hf_smb_unix_capability_posix_acl
,
21005 { "POSIX ACL Capability", "smb.unix.capability.posix_acl", FT_BOOLEAN
, 32,
21006 TFS(&tfs_set_notset
), 0x00000002, NULL
, HFILL
}},
21008 { &hf_smb_unix_capability_xattr
,
21009 { "EA Capability", "smb.unix.capability.ea", FT_BOOLEAN
, 32,
21010 TFS(&tfs_set_notset
), 0x00000004, NULL
, HFILL
}},
21012 { &hf_smb_unix_capability_attr
,
21013 { "Additional Attributes Capability", "smb.unix.capability.attr", FT_BOOLEAN
, 32,
21014 TFS(&tfs_set_notset
), 0x00000008, NULL
, HFILL
}},
21016 { &hf_smb_unix_capability_posix_paths
,
21017 { "POSIX Pathnames Capability", "smb.unix.capability.posix_paths", FT_BOOLEAN
, 32,
21018 TFS(&tfs_set_notset
), 0x00000010, NULL
, HFILL
}},
21020 { &hf_smb_unix_capability_posix_path_ops
,
21021 { "POSIX Path Operations Capability", "smb.unix.capability.posix_path_ops", FT_BOOLEAN
, 32,
21022 TFS(&tfs_set_notset
), 0x00000020, NULL
, HFILL
}},
21024 { &hf_smb_unix_capability_large_read
,
21025 { "Large Read Capability", "smb.unix.capability.large_read", FT_BOOLEAN
, 32,
21026 TFS(&tfs_set_notset
), 0x00000040, NULL
, HFILL
}},
21028 { &hf_smb_unix_capability_large_write
,
21029 { "Large Write Capability", "smb.unix.capability.large_write", FT_BOOLEAN
, 32,
21030 TFS(&tfs_set_notset
), 0x00000080, NULL
, HFILL
}},
21032 { &hf_smb_unix_capability_encryption
,
21033 { "Encryption Capability", "smb.unix.capability.encryption", FT_BOOLEAN
, 32,
21034 TFS(&tfs_set_notset
), 0x00000100, NULL
, HFILL
}},
21036 { &hf_smb_unix_capability_mandatory_crypto
,
21037 { "Mandatory Encryption Capability", "smb.unix.capability.mandatory_crypto", FT_BOOLEAN
, 32,
21038 TFS(&tfs_set_notset
), 0x00000200, NULL
, HFILL
}},
21040 { &hf_smb_unix_capability_proxy
,
21041 { "Proxy Capability", "smb.unix.capability.proxy", FT_BOOLEAN
, 32,
21042 TFS(&tfs_set_notset
), 0x00000400, NULL
, HFILL
}},
21044 { &hf_smb_file_access_mask_read_data
,
21045 { "Read Data", "smb.file.accessmask.read_data", FT_BOOLEAN
, 32,
21046 TFS(&tfs_set_notset
), 0x00000001, NULL
, HFILL
}},
21048 { &hf_smb_file_access_mask_write_data
,
21049 { "Write Data", "smb.file.accessmask.write_data", FT_BOOLEAN
, 32,
21050 TFS(&tfs_set_notset
), 0x00000002, NULL
, HFILL
}},
21052 { &hf_smb_file_access_mask_append_data
,
21053 { "Append Data", "smb.file.accessmask.append_data", FT_BOOLEAN
, 32,
21054 TFS(&tfs_set_notset
), 0x00000004, NULL
, HFILL
}},
21056 { &hf_smb_file_access_mask_read_ea
,
21057 { "Read EA", "smb.file.accessmask.read_ea", FT_BOOLEAN
, 32,
21058 TFS(&tfs_set_notset
), 0x00000008, NULL
, HFILL
}},
21060 { &hf_smb_file_access_mask_write_ea
,
21061 { "Write EA", "smb.file.accessmask.write_ea", FT_BOOLEAN
, 32,
21062 TFS(&tfs_set_notset
), 0x00000010, NULL
, HFILL
}},
21064 { &hf_smb_file_access_mask_execute
,
21065 { "Execute", "smb.file.accessmask.execute", FT_BOOLEAN
, 32,
21066 TFS(&tfs_set_notset
), 0x00000020, NULL
, HFILL
}},
21068 { &hf_smb_file_access_mask_read_attribute
,
21069 { "Read Attribute", "smb.file.accessmask.read_attribute", FT_BOOLEAN
, 32,
21070 TFS(&tfs_set_notset
), 0x00000080, NULL
, HFILL
}},
21072 { &hf_smb_file_access_mask_write_attribute
,
21073 { "Write Attribute", "smb.file.accessmask.write_attribute", FT_BOOLEAN
, 32,
21074 TFS(&tfs_set_notset
), 0x00000100, NULL
, HFILL
}},
21076 { &hf_smb_dir_access_mask_list
,
21077 { "List", "smb.dir.accessmask.list", FT_BOOLEAN
, 32,
21078 TFS(&tfs_set_notset
), 0x00000001, NULL
, HFILL
}},
21080 { &hf_smb_dir_access_mask_add_file
,
21081 { "Add File", "smb.dir.accessmask.add_file", FT_BOOLEAN
, 32,
21082 TFS(&tfs_set_notset
), 0x00000002, NULL
, HFILL
}},
21084 { &hf_smb_dir_access_mask_add_subdir
,
21085 { "Add Subdir", "smb.dir.accessmask.add_subdir", FT_BOOLEAN
, 32,
21086 TFS(&tfs_set_notset
), 0x00000004, NULL
, HFILL
}},
21088 { &hf_smb_dir_access_mask_read_ea
,
21089 { "Read EA", "smb.dir.accessmask.read_ea", FT_BOOLEAN
, 32,
21090 TFS(&tfs_set_notset
), 0x00000008, NULL
, HFILL
}},
21092 { &hf_smb_dir_access_mask_write_ea
,
21093 { "Write EA", "smb.dir.accessmask.write_ea", FT_BOOLEAN
, 32,
21094 TFS(&tfs_set_notset
), 0x00000010, NULL
, HFILL
}},
21096 { &hf_smb_dir_access_mask_traverse
,
21097 { "Traverse", "smb.dir.accessmask.traverse", FT_BOOLEAN
, 32,
21098 TFS(&tfs_set_notset
), 0x00000020, NULL
, HFILL
}},
21100 { &hf_smb_dir_access_mask_delete_child
,
21101 { "Delete Child", "smb.dir.accessmask.delete_child", FT_BOOLEAN
, 32,
21102 TFS(&tfs_set_notset
), 0x00000040, NULL
, HFILL
}},
21104 { &hf_smb_dir_access_mask_read_attribute
,
21105 { "Read Attribute", "smb.dir.accessmask.read_attribute", FT_BOOLEAN
, 32,
21106 TFS(&tfs_set_notset
), 0x00000080, NULL
, HFILL
}},
21108 { &hf_smb_dir_access_mask_write_attribute
,
21109 { "Write Attribute", "smb.dir.accessmask.write_attribute", FT_BOOLEAN
, 32,
21110 TFS(&tfs_set_notset
), 0x00000100, NULL
, HFILL
}},
21112 { &hf_smb_unix_file_link_dest
,
21113 { "Link destination", "smb.unix.file.link_dest", FT_STRING
,
21114 BASE_NONE
, NULL
, 0, NULL
, HFILL
}},
21116 { &hf_smb_unix_file_size
,
21117 { "File size", "smb.unix.file.size", FT_UINT64
, BASE_DEC
,
21118 NULL
, 0, NULL
, HFILL
}},
21120 { &hf_smb_unix_file_num_bytes
,
21121 { "Number of bytes", "smb.unix.file.num_bytes", FT_UINT64
, BASE_DEC
,
21122 NULL
, 0, "Number of bytes used to store the file", HFILL
}},
21124 { &hf_smb_unix_file_last_status
,
21125 { "Last status change", "smb.unix.file.stime", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
21126 NULL
, 0, NULL
, HFILL
}},
21128 { &hf_smb_unix_file_last_access
,
21129 { "Last access", "smb.unix.file.atime", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
21130 NULL
, 0, NULL
, HFILL
}},
21132 { &hf_smb_unix_file_last_change
,
21133 { "Last modification", "smb.unix.file.mtime", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
21134 NULL
, 0, NULL
, HFILL
}},
21136 { &hf_smb_unix_file_creation_time
,
21137 { "Creation time", "smb.unix.file.crtime", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
21138 NULL
, 0, NULL
, HFILL
}},
21140 { &hf_smb_unix_file_uid
,
21141 { "UID", "smb.unix.file.uid", FT_UINT64
, BASE_DEC
,
21142 NULL
, 0, NULL
, HFILL
}},
21144 { &hf_smb_unix_file_gid
,
21145 { "GID", "smb.unix.file.gid", FT_UINT64
, BASE_DEC
,
21146 NULL
, 0, NULL
, HFILL
}},
21148 { &hf_smb_unix_file_type
,
21149 { "File type", "smb.unix.file.file_type", FT_UINT32
, BASE_DEC
,
21150 VALS(unix_file_type_vals
), 0, NULL
, HFILL
}},
21152 { &hf_smb_unix_file_dev_major
,
21153 { "Major device", "smb.unix.file.dev_major", FT_UINT64
, BASE_HEX
,
21154 NULL
, 0, NULL
, HFILL
}},
21156 { &hf_smb_unix_file_dev_minor
,
21157 { "Minor device", "smb.unix.file.dev_minor", FT_UINT64
, BASE_HEX
,
21158 NULL
, 0, NULL
, HFILL
}},
21160 { &hf_smb_unix_file_unique_id
,
21161 { "Unique ID", "smb.unix.file.unique_id", FT_UINT64
, BASE_HEX
,
21162 NULL
, 0, NULL
, HFILL
}},
21164 { &hf_smb_unix_file_permissions
,
21165 { "File permissions", "smb.unix.file.perms", FT_UINT64
, BASE_HEX
,
21166 NULL
, 0, NULL
, HFILL
}},
21168 { &hf_smb_unix_file_nlinks
,
21169 { "Num links", "smb.unix.file.num_links", FT_UINT64
, BASE_DEC
,
21170 NULL
, 0, NULL
, HFILL
}},
21172 { &hf_smb_unix_info2_file_flags
,
21173 { "Flags", "smb.unix_info2.file.flags", FT_UINT32
, BASE_HEX
,
21174 NULL
, 0, NULL
, HFILL
}},
21176 { &hf_smb_unix_info2_file_flags_mask
,
21177 { "Flags mask", "smb.unix_info2.file.flags_mask", FT_UINT32
, BASE_HEX
,
21178 NULL
, 0, NULL
, HFILL
}},
21180 { &hf_smb_unix_info2_file_flags_secure_delete
,
21181 { "Secure delete", "smb.unix_info2.file.flags.secure_delete", FT_BOOLEAN
, 32,
21182 NULL
, 0x00000001, NULL
, HFILL
}},
21184 { &hf_smb_unix_info2_file_flags_enable_undelete
,
21185 { "Enable undelete", "smb.unix_info2.file.flags.enable_undelete", FT_BOOLEAN
, 32,
21186 NULL
, 0x00000002, NULL
, HFILL
}},
21188 { &hf_smb_unix_info2_file_flags_synchronous
,
21189 { "Synchronous", "smb.unix_info2.file.flags.synchronous", FT_BOOLEAN
, 32,
21190 NULL
, 0x00000004, NULL
, HFILL
}},
21192 { &hf_smb_unix_info2_file_flags_immutable
,
21193 { "Immutable", "smb.unix_info2.file.flags.immutable", FT_BOOLEAN
, 32,
21194 NULL
, 0x00000008, NULL
, HFILL
}},
21196 { &hf_smb_unix_info2_file_flags_append_only
,
21197 { "Append-only", "smb.unix_info2.file.flags.append_only", FT_BOOLEAN
, 32,
21198 NULL
, 0x00000010, NULL
, HFILL
}},
21200 { &hf_smb_unix_info2_file_flags_do_not_backup
,
21201 { "Do not backup", "smb.unix_info2.file.flags.do_not_backup", FT_BOOLEAN
, 32,
21202 NULL
, 0x00000020, NULL
, HFILL
}},
21204 { &hf_smb_unix_info2_file_flags_no_update_atime
,
21205 { "Don't update atime", "smb.unix_info2.file.flags.no_update_atime", FT_BOOLEAN
, 32,
21206 NULL
, 0x00000040, NULL
, HFILL
}},
21208 { &hf_smb_unix_info2_file_flags_hidden
,
21209 { "Hidden", "smb.unix_info2.file.flags.hidden", FT_BOOLEAN
, 32,
21210 NULL
, 0x00000080, NULL
, HFILL
}},
21212 { &hf_smb_unix_file_name_length
,
21213 { "File name length", "smb.unix.file.name_length", FT_UINT32
, BASE_DEC
,
21214 NULL
, 0, NULL
, HFILL
}},
21216 { &hf_smb_unix_file_name
,
21217 { "File name", "smb.unix.file.name", FT_STRING
,
21218 BASE_NONE
, NULL
, 0, NULL
, HFILL
}},
21220 { &hf_smb_unix_find_file_nextoffset
,
21221 { "Next entry offset", "smb.unix.find_file.next_offset", FT_UINT32
, BASE_DEC
,
21222 NULL
, 0, NULL
, HFILL
}},
21224 { &hf_smb_unix_find_file_resumekey
,
21225 { "Resume key", "smb.unix.find_file.resume_key", FT_UINT32
, BASE_DEC
,
21226 NULL
, 0, NULL
, HFILL
}},
21228 { &hf_smb_unix_whoami_mapflags
,
21229 { "UNIX whoami mapping flags", "smb.unix.whoami.mapflags", FT_UINT32
, BASE_DEC
,
21230 NULL
, 0, NULL
, HFILL
}},
21232 { &hf_smb_unix_whoami_mapflags_mask
,
21233 { "UNIX whoami mapping flags mask", "smb.unix.whoami.mapflags_mask", FT_UINT32
, BASE_DEC
,
21234 NULL
, 0, NULL
, HFILL
}},
21236 { &hf_smb_unix_whoami_num_supl_gids
,
21237 { "Number of supplementary UNIX GIDs", "smb.unix.whoami.num_gids", FT_UINT32
, BASE_DEC
,
21238 NULL
, 0, NULL
, HFILL
}},
21240 { &hf_smb_unix_whoami_num_supl_sids
,
21241 { "Number of supplementary SIDs", "smb.unix.whoami.num_sids", FT_UINT32
, BASE_DEC
,
21242 NULL
, 0, NULL
, HFILL
}},
21244 { &hf_smb_unix_whoami_sids_buflen
,
21245 { "Supplementary SIDs buffer length", "smb.unix.whoami.sids_buflen", FT_UINT32
, BASE_DEC
,
21246 NULL
, 0, NULL
, HFILL
}},
21248 { &hf_smb_create_flags
,
21249 { "Create Flags", "smb.create_flags", FT_UINT32
, BASE_HEX
,
21250 NULL
, 0, NULL
, HFILL
}},
21252 { &hf_smb_create_options
,
21253 { "Create Options", "smb.create_options", FT_UINT32
, BASE_HEX
,
21254 NULL
, 0, NULL
, HFILL
}},
21256 { &hf_smb_share_access
,
21257 { "Share Access", "smb.share_access", FT_UINT32
, BASE_HEX
,
21258 NULL
, 0, NULL
, HFILL
}},
21260 { &hf_smb_access_mask
,
21261 { "Access Mask", "smb.access_mask", FT_UINT32
, BASE_HEX
,
21262 NULL
, 0, NULL
, HFILL
}},
21265 { "Mode", "smb.mode", FT_UINT32
, BASE_HEX
,
21266 NULL
, 0, NULL
, HFILL
}},
21268 { &hf_smb_attribute
,
21269 { "Attribute", "smb.attribute", FT_UINT32
, BASE_HEX
,
21270 NULL
, 0, NULL
, HFILL
}},
21272 { &hf_smb_reparse_tag
,
21273 { "Reparse Tag", "smb.reparse_tag", FT_UINT32
, BASE_HEX
,
21274 NULL
, 0, NULL
, HFILL
}},
21276 { &hf_smb_disposition_delete_on_close
,
21277 { "Delete on close", "smb.disposition.delete_on_close", FT_BOOLEAN
, 8,
21278 TFS(&tfs_disposition_delete_on_close
), 0x01, NULL
, HFILL
}},
21280 { &hf_smb_pipe_info_flag
,
21281 { "Pipe Info", "smb.pipe_info_flag", FT_BOOLEAN
, 8,
21282 TFS(&tfs_pipe_info_flag
), 0x01, NULL
, HFILL
}},
21284 { &hf_smb_logged_in
,
21285 { "Logged In", "smb.logged_in", FT_FRAMENUM
, BASE_NONE
,
21286 NULL
, 0, NULL
, HFILL
}},
21288 { &hf_smb_logged_out
,
21289 { "Logged Out", "smb.logged_out", FT_FRAMENUM
, BASE_NONE
,
21290 NULL
, 0, NULL
, HFILL
}},
21292 { &hf_smb_file_rw_offset
,
21293 { "File Offset", "smb.file.rw.offset", FT_UINT64
, BASE_DEC
,
21294 NULL
, 0, NULL
, HFILL
}},
21296 { &hf_smb_file_rw_length
,
21297 { "File RW Length", "smb.file.rw.length", FT_UINT32
, BASE_DEC
,
21298 NULL
, 0, NULL
, HFILL
}},
21300 { &hf_smb_posix_acl_version
,
21301 { "Posix ACL version", "smb.posix_acl.version", FT_UINT16
, BASE_DEC
,
21302 NULL
, 0, NULL
, HFILL
}},
21304 { &hf_smb_posix_num_file_aces
,
21305 { "Number of file ACEs", "smb.posix_acl.num_file_aces", FT_UINT16
, BASE_DEC
,
21306 NULL
, 0, NULL
, HFILL
}},
21308 { &hf_smb_posix_num_def_aces
,
21309 { "Number of default ACEs", "smb.posix_acl.num_def_aces", FT_UINT16
, BASE_DEC
,
21310 NULL
, 0, NULL
, HFILL
}},
21312 { &hf_smb_posix_ace_type
,
21313 { "ACE Type", "smb.posix_acl.ace_type", FT_UINT8
, BASE_DEC
,
21314 VALS(ace_type_vals
), 0, NULL
, HFILL
}},
21316 { &hf_smb_posix_ace_flags
,
21317 { "Permissions", "smb.posix_acl.ace_perms", FT_UINT8
, BASE_HEX
,
21318 NULL
, 0, NULL
, HFILL
}},
21320 { &hf_smb_posix_ace_perm_read
,
21321 {"READ", "smb.posix_acl.ace_perms.read", FT_BOOLEAN
, 8,
21322 NULL
, 0x04, NULL
, HFILL
}},
21324 { &hf_smb_posix_ace_perm_write
,
21325 {"WRITE", "smb.posix_acl.ace_perms.write", FT_BOOLEAN
, 8,
21326 NULL
, 0x02, NULL
, HFILL
}},
21328 { &hf_smb_posix_ace_perm_execute
,
21329 {"EXECUTE", "smb.posix_acl.ace_perms.execute", FT_BOOLEAN
, 8,
21330 NULL
, 0x01, NULL
, HFILL
}},
21332 { &hf_smb_posix_ace_perm_owner_uid
,
21333 { "Owner UID", "smb.posix_acl.ace_perms.owner_uid", FT_UINT32
, BASE_DEC
,
21334 NULL
, 0, NULL
, HFILL
}},
21336 { &hf_smb_posix_ace_perm_owner_gid
,
21337 { "Owner GID", "smb.posix_acl.ace_perms.owner_gid", FT_UINT32
, BASE_DEC
,
21338 NULL
, 0, NULL
, HFILL
}},
21340 { &hf_smb_posix_ace_perm_uid
,
21341 { "UID", "smb.posix_acl.ace_perms.uid", FT_UINT32
, BASE_DEC
,
21342 NULL
, 0, NULL
, HFILL
}},
21344 { &hf_smb_posix_ace_perm_gid
,
21345 { "GID", "smb.posix_acl.ace_perms.gid", FT_UINT32
, BASE_DEC
,
21346 NULL
, 0, NULL
, HFILL
}},
21348 { &hf_smb_trans_data_setup_word
,
21349 { "Setup Word", "smb.trans_data.setup_word", FT_UINT16
, BASE_HEX
,
21350 NULL
, 0x0, NULL
, HFILL
}},
21352 { &hf_smb_trans_data_parameters
,
21353 { "Parameters", "smb.trans_data.parameters", FT_BYTES
, BASE_NONE
,
21354 NULL
, 0x0, NULL
, HFILL
}},
21356 { &hf_smb_trans_data
,
21357 { "Data", "smb.trans_data", FT_BYTES
, BASE_NONE
,
21358 NULL
, 0x0, NULL
, HFILL
}},
21360 { &hf_smb_extra_byte_parameters
,
21361 { "Extra byte parameters", "smb.extra_byte_parameters", FT_BYTES
, BASE_NONE
,
21362 NULL
, 0x0, NULL
, HFILL
}},
21364 { &hf_smb_file_access_mask_full_control
,
21365 { "FULL CONTROL", "smb.file.accessmask.full_control", FT_UINT32
, BASE_HEX
,
21366 NULL
, 0x000001ff, NULL
, HFILL
}},
21368 { &hf_smb_dir_access_mask_full_control
,
21369 { "FULL CONTROL", "smb.dir.accessmask.full_control", FT_UINT32
, BASE_HEX
,
21370 NULL
, 0x000001ff, NULL
, HFILL
}},
21372 { &hf_smb_word_unk_response_format
,
21373 { "Words for unknown response format", "smb.word_unk_response_format", FT_BYTES
, BASE_NONE
,
21374 NULL
, 0x0, NULL
, HFILL
}},
21376 { &hf_smb_nt_transaction_setup
,
21377 { "NT Transaction Setup", "smb.nt_transaction_setup", FT_BYTES
, BASE_NONE
,
21378 NULL
, 0x0, NULL
, HFILL
}},
21380 { &hf_smb_server_component
,
21381 { "Server Component", "smb.server_component", FT_UINT32
, BASE_HEX
,
21382 NULL
, 0x0, NULL
, HFILL
}},
21384 { &hf_smb_byte_parameters
,
21385 { "Byte parameters", "smb.byte_parameters", FT_BYTES
, BASE_NONE
,
21386 NULL
, 0x0, NULL
, HFILL
}},
21388 { &hf_smb_word_parameters
,
21389 { "Word parameters", "smb.word_parameters", FT_BYTES
, BASE_NONE
,
21390 NULL
, 0x0, NULL
, HFILL
}},
21393 static int *ett
[] = {
21400 &ett_smb_fileattributes
,
21401 &ett_smb_capabilities
,
21409 &ett_smb_desiredaccess
,
21412 &ett_smb_openfunction
,
21414 &ett_smb_openaction
,
21415 &ett_smb_writemode
,
21416 &ett_smb_lock_type
,
21417 &ett_smb_ssetupandxaction
,
21418 &ett_smb_optionsup
,
21419 &ett_smb_time_date
,
21420 &ett_smb_move_copy_flags
,
21421 &ett_smb_file_attributes
,
21422 &ett_smb_search_resume_key
,
21423 &ett_smb_search_dir_info
,
21428 &ett_smb_open_flags
,
21429 &ett_smb_ipc_state
,
21430 &ett_smb_open_action
,
21431 &ett_smb_setup_action
,
21432 &ett_smb_connect_flags
,
21433 &ett_smb_connect_support_bits
,
21434 &ett_smb_nt_access_mask
,
21435 &ett_smb_nt_create_bits
,
21436 &ett_smb_nt_create_options
,
21437 &ett_smb_nt_share_access
,
21438 &ett_smb_nt_security_flags
,
21439 &ett_smb_nt_trans_setup
,
21440 &ett_smb_nt_trans_data
,
21441 &ett_smb_nt_trans_param
,
21442 &ett_smb_nt_notify_completion_filter
,
21443 &ett_smb_nt_ioctl_flags
,
21444 &ett_smb_security_information_mask
,
21445 &ett_smb_print_queue_entry
,
21446 &ett_smb_transaction_flags
,
21447 &ett_smb_transaction_params
,
21448 &ett_smb_find_first2_flags
,
21452 &ett_smb_transaction_data
,
21453 &ett_smb_stream_info
,
21454 &ett_smb_dfs_referrals
,
21455 &ett_smb_dfs_referral
,
21456 &ett_smb_dfs_referral_flags
,
21457 &ett_smb_dfs_referral_expnames
,
21458 &ett_smb_get_dfs_flags
,
21460 &ett_smb_device_characteristics
,
21461 &ett_smb_fs_attributes
,
21464 &ett_smb_quotaflags
,
21466 &ett_smb_mac_support_flags
,
21467 &ett_smb_unicode_password
,
21469 &ett_smb_unix_capabilities
,
21470 &ett_smb_unix_whoami_gids
,
21471 &ett_smb_unix_whoami_sids
,
21472 &ett_smb_posix_ace
,
21473 &ett_smb_posix_ace_perms
,
21474 &ett_smb_info2_file_flags
21477 static ei_register_info ei
[] = {
21478 { &ei_smb_missing_word_parameters
, {"smb.missing_word_parameters", PI_MALFORMED
, PI_ERROR
, "The word parameters are missing, so the byte parameters cannot be dissected.", EXPFILL
}},
21479 { &ei_smb_mal_information_level
, { "smb.information_level.malformed", PI_MALFORMED
, PI_ERROR
, "Information level structure goes past the end of the transaction data.", EXPFILL
}},
21480 { &ei_smb_not_implemented
, { "smb.not_implemented", PI_UNDECODED
, PI_WARN
, "Not Implemented yet", EXPFILL
}},
21481 { &ei_smb_nt_transaction_setup
, { "smb.nt_transaction_setup.unknown", PI_PROTOCOL
, PI_NOTE
, "Unknown NT Transaction Setup (matching request not seen)", EXPFILL
}},
21482 { &ei_smb_posix_ace_type
, { "smb.posix_acl.ace_type.unknown", PI_PROTOCOL
, PI_WARN
, "Unknown posix ace type", EXPFILL
}},
21483 { &ei_smb_info_level_unknown
, { "smb.info_level_unknown", PI_PROTOCOL
, PI_WARN
, "Information level unknown", EXPFILL
}},
21484 { &ei_smb_info_level_not_understood
, { "smb.info_level_not_understood", PI_PROTOCOL
, PI_WARN
, "Information level not understood", EXPFILL
}},
21487 module_t
*smb_module
;
21488 expert_module_t
* expert_smb
;
21490 proto_smb
= proto_register_protocol("SMB (Server Message Block Protocol)",
21492 proto_register_subtree_array(ett
, array_length(ett
));
21493 proto_register_field_array(proto_smb
, hf
, array_length(hf
));
21494 expert_smb
= expert_register_protocol(proto_smb
);
21495 expert_register_field_array(expert_smb
, ei
, array_length(ei
));
21497 proto_do_register_windows_common(proto_smb
);
21499 register_cleanup_routine(&smb_cleanup
);
21500 smb_module
= prefs_register_protocol(proto_smb
, NULL
);
21501 prefs_register_bool_preference(smb_module
, "trans_reassembly",
21502 "Reassemble SMB Transaction payload",
21503 "Whether the dissector should reassemble the payload of SMB Transaction commands spanning multiple SMB PDUs",
21504 &smb_trans_reassembly
);
21505 prefs_register_bool_preference(smb_module
, "dcerpc_reassembly",
21506 "Reassemble DCERPC over SMB",
21507 "Whether the dissector should reassemble DCERPC over SMB commands",
21508 &smb_dcerpc_reassembly
);
21509 prefs_register_bool_preference(smb_module
, "sid_name_snooping",
21510 "Snoop SID to Name mappings",
21511 "Whether the dissector should snoop SMB and related CIFS protocols to discover and display Names associated with SIDs",
21512 &sid_name_snooping
);
21514 /* For display of SIDs and RIDs in Hex option */
21515 prefs_register_bool_preference(smb_module
, "sid_display_hex",
21516 "Display SIDs in Hex",
21517 "Whether the dissector should display SIDs and RIDs in hexadecimal rather than decimal",
21520 /* Will Export Object take name as fid ? */
21521 prefs_register_bool_preference(smb_module
, "eosmb_take_name_as_fid",
21522 "Use the full file name as File ID when exporting an SMB object",
21523 "Whether the export object functionality will take the full path file name as file identifier",
21524 &eosmb_take_name_as_fid
);
21527 * XXX - addresses_ports_reassembly_table_functions?
21528 * Probably correct for SMB-over-NBT and SMB-over-TCP,
21529 * as stuff from two different connections should
21530 * probably not be combined, but what about other
21531 * transports for SMB, e.g. NBF or Netware?
21533 reassembly_table_register(&smb_trans_reassembly_table
,
21534 &addresses_reassembly_table_functions
);
21536 smb_tap
= register_tap("smb");
21538 smb_handle
= register_dissector("smb", dissect_smb
, proto_smb
);
21540 register_srt_table(proto_smb
, NULL
, 3, smbstat_packet
, smbstat_init
, NULL
);
21541 /* Register the tap for the "Export Object" function */
21542 smb_eo_tap
= register_export_object(proto_smb
, smb_eo_packet
, smb_eo_cleanup
);
21546 proto_reg_handoff_smb(void)
21548 gssapi_handle
= find_dissector_add_dependency("gssapi", proto_smb
);
21549 ntlmssp_handle
= find_dissector_add_dependency("ntlmssp", proto_smb
);
21551 heur_dissector_add("netbios", dissect_smb_heur
, "SMB over Netbios", "smb_netbios", proto_smb
, HEURISTIC_ENABLE
);
21552 heur_dissector_add("smb_direct", dissect_smb_heur
, "SMB over SMB Direct", "smb_smb_direct", proto_smb
, HEURISTIC_ENABLE
);
21553 heur_dissector_add("cotp", dissect_smb_heur
, "SMB over COTP", "smb_cotp", proto_smb
, HEURISTIC_ENABLE
);
21554 heur_dissector_add("vines_spp", dissect_smb_heur
, "SMB over Vines", "smb_vines", proto_smb
, HEURISTIC_ENABLE
);
21556 dissector_add_uint("ipx.socket", IPX_SOCKET_NWLINK_SMB_SERVER
, smb_handle
);
21557 dissector_add_uint("ipx.socket", IPX_SOCKET_NWLINK_SMB_REDIR
, smb_handle
);
21558 dissector_add_uint("ipx.socket", IPX_SOCKET_NWLINK_SMB_MESSENGER
, smb_handle
);
21559 dissector_add_uint("spp.socket", IDP_SOCKET_SMB
, smb_handle
);
21563 * Editor modelines - https://www.wireshark.org/tools/modelines.html
21566 * c-basic-offset: 8
21568 * indent-tabs-mode: t
21571 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
21572 * :indentSize=8:tabSize=8:noTabs=false: