diff options
Diffstat (limited to 'epan/dissectors/packet-smb.c')
-rw-r--r-- | epan/dissectors/packet-smb.c | 3868 |
1 files changed, 1995 insertions, 1873 deletions
diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index b62e6b25..1560ad50 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -91,788 +91,791 @@ void proto_reg_handoff_smb(void); #define REFENT_FLAGS_TARGET_SET_BOUNDARY 0x0004 -static int proto_smb = -1; -static int hf_smb_cmd = -1; -static int hf_smb_andxcmd = -1; -static int hf_smb_mapped_in = -1; -static int hf_smb_unmapped_in = -1; -static int hf_smb_opened_in = -1; -static int hf_smb_closed_in = -1; -static int hf_smb_key = -1; -static int hf_smb_session_id = -1; -static int hf_smb_sequence_num = -1; -static int hf_smb_group_id = -1; -static int hf_smb_pid = -1; -static int hf_smb_tid = -1; -static int hf_smb_uid = -1; -static int hf_smb_mid = -1; -static int hf_smb_pid_high = -1; -static int hf_smb_sig = -1; -static int hf_smb_response_to = -1; -static int hf_smb_time = -1; -static int hf_smb_response_in = -1; -static int hf_smb_continuation_to = -1; -static int hf_smb_nt_status = -1; -static int hf_smb_error_class = -1; -static int hf_smb_error_code = -1; -static int hf_smb_reserved = -1; -static int hf_smb_create_flags = -1; -static int hf_smb_create_options = -1; -static int hf_smb_share_access = -1; -static int hf_smb_access_mask = -1; -static int hf_smb_flags = -1; -static int hf_smb_flags_lock = -1; -static int hf_smb_flags_receive_buffer = -1; -static int hf_smb_flags_caseless = -1; -static int hf_smb_flags_canon = -1; -static int hf_smb_flags_oplock = -1; -static int hf_smb_flags_notify = -1; -static int hf_smb_flags_response = -1; -static int hf_smb_flags2 = -1; -static int hf_smb_flags2_long_names_allowed = -1; -static int hf_smb_flags2_ea = -1; -static int hf_smb_flags2_sec_sig = -1; -static int hf_smb_flags2_compressed = -1; -static int hf_smb_flags2_sec_sig_required = -1; -static int hf_smb_flags2_long_names_used = -1; -static int hf_smb_flags2_reparse_path = -1; -static int hf_smb_flags2_esn = -1; -static int hf_smb_flags2_dfs = -1; -static int hf_smb_flags2_roe = -1; -static int hf_smb_flags2_nt_error = -1; -static int hf_smb_flags2_string = -1; -static int hf_smb_word_count = -1; -static int hf_smb_byte_count = -1; -static int hf_smb_buffer_format = -1; -static int hf_smb_dialect = -1; -static int hf_smb_dialect_name = -1; -static int hf_smb_dialect_index = -1; -static int hf_smb_max_trans_buf_size = -1; -static int hf_smb_max_mpx_count = -1; -static int hf_smb_max_vcs_num = -1; -static int hf_smb_session_key = -1; -static int hf_smb_server_timezone = -1; -static int hf_smb_challenge_length = -1; -static int hf_smb_challenge = -1; -static int hf_smb_primary_domain = -1; -static int hf_smb_server = -1; -static int hf_smb_max_raw_buf_size = -1; -static int hf_smb_server_guid = -1; -static int hf_smb_volume_guid = -1; -static int hf_smb_security_blob_len = -1; -static int hf_smb_security_blob = -1; -static int hf_smb_sm16 = -1; -static int hf_smb_sm_mode16 = -1; -static int hf_smb_sm_password16 = -1; -static int hf_smb_sm = -1; -static int hf_smb_sm_mode = -1; -static int hf_smb_sm_password = -1; -static int hf_smb_sm_signatures = -1; -static int hf_smb_sm_sig_required = -1; -static int hf_smb_rm = -1; -static int hf_smb_rm_read = -1; -static int hf_smb_rm_write = -1; -static int hf_smb_server_date_time = -1; -static int hf_smb_server_smb_date = -1; -static int hf_smb_server_smb_time = -1; -static int hf_smb_server_cap = -1; -static int hf_smb_server_cap_raw_mode = -1; -static int hf_smb_server_cap_mpx_mode = -1; -static int hf_smb_server_cap_unicode = -1; -static int hf_smb_server_cap_large_files = -1; -static int hf_smb_server_cap_nt_smbs = -1; -static int hf_smb_server_cap_rpc_remote_apis = -1; -static int hf_smb_server_cap_nt_status = -1; -static int hf_smb_server_cap_level_ii_oplocks = -1; -static int hf_smb_server_cap_lock_and_read = -1; -static int hf_smb_server_cap_nt_find = -1; -static int hf_smb_server_cap_dfs = -1; -static int hf_smb_server_cap_infolevel_passthru = -1; -static int hf_smb_server_cap_large_readx = -1; -static int hf_smb_server_cap_large_writex = -1; -static int hf_smb_server_cap_lwio = -1; -static int hf_smb_server_cap_unix = -1; -static int hf_smb_server_cap_compressed_data = -1; -static int hf_smb_server_cap_dynamic_reauth = -1; -static int hf_smb_server_cap_extended_security = -1; -static int hf_smb_system_time = -1; -static int hf_smb_unknown = -1; -static int hf_smb_dir_name = -1; -static int hf_smb_echo_count = -1; -static int hf_smb_echo_data = -1; -static int hf_smb_echo_seq_num = -1; -static int hf_smb_max_buf_size = -1; -static int hf_smb_password = -1; -static int hf_smb_password_len = -1; -static int hf_smb_ansi_password = -1; -static int hf_smb_ansi_password_len = -1; -static int hf_smb_unicode_password = -1; -static int hf_smb_unicode_password_len = -1; -static int hf_smb_path = -1; -static int hf_smb_service = -1; -static int hf_smb_move_flags = -1; -static int hf_smb_move_flags_file = -1; -static int hf_smb_move_flags_dir = -1; -static int hf_smb_move_flags_verify = -1; -static int hf_smb_files_moved = -1; -static int hf_smb_file_access_mask_read_data = -1; -static int hf_smb_file_access_mask_write_data = -1; -static int hf_smb_file_access_mask_append_data = -1; -static int hf_smb_file_access_mask_read_ea = -1; -static int hf_smb_file_access_mask_write_ea = -1; -static int hf_smb_file_access_mask_execute = -1; -static int hf_smb_file_access_mask_read_attribute = -1; -static int hf_smb_file_access_mask_write_attribute = -1; -static int hf_smb_dir_access_mask_list = -1; -static int hf_smb_dir_access_mask_add_file = -1; -static int hf_smb_dir_access_mask_add_subdir = -1; -static int hf_smb_dir_access_mask_read_ea = -1; -static int hf_smb_dir_access_mask_write_ea = -1; -static int hf_smb_dir_access_mask_traverse = -1; -static int hf_smb_dir_access_mask_delete_child = -1; -static int hf_smb_dir_access_mask_read_attribute = -1; -static int hf_smb_dir_access_mask_write_attribute = -1; -static int hf_smb_copy_flags = -1; -static int hf_smb_copy_flags_file = -1; -static int hf_smb_copy_flags_dir = -1; -static int hf_smb_copy_flags_dest_mode = -1; -static int hf_smb_copy_flags_source_mode = -1; -static int hf_smb_copy_flags_verify = -1; -static int hf_smb_copy_flags_tree_copy = -1; -static int hf_smb_copy_flags_ea_action = -1; -static int hf_smb_count = -1; -static int hf_smb_count_low = -1; -static int hf_smb_count_high = -1; -static int hf_smb_file_name = -1; -static int hf_smb_open_function = -1; -static int hf_smb_open_function_open = -1; -static int hf_smb_open_function_create = -1; -static int hf_smb_fid = -1; -static int hf_smb_file_attr_16bit = -1; -static int hf_smb_file_attr_8bit = -1; -static int hf_smb_file_attr_read_only_16bit = -1; -static int hf_smb_file_attr_read_only_8bit = -1; -static int hf_smb_file_attr_hidden_16bit = -1; -static int hf_smb_file_attr_hidden_8bit = -1; -static int hf_smb_file_attr_system_16bit = -1; -static int hf_smb_file_attr_system_8bit = -1; -static int hf_smb_file_attr_volume_16bit = -1; -static int hf_smb_file_attr_volume_8bit = -1; -static int hf_smb_file_attr_directory_16bit = -1; -static int hf_smb_file_attr_directory_8bit = -1; -static int hf_smb_file_attr_archive_16bit = -1; -static int hf_smb_file_attr_archive_8bit = -1; +static int proto_smb; +static int hf_smb_cmd; +static int hf_smb_andxcmd; +static int hf_smb_mapped_in; +static int hf_smb_unmapped_in; +static int hf_smb_opened_in; +static int hf_smb_closed_in; +static int hf_smb_key; +static int hf_smb_session_id; +static int hf_smb_sequence_num; +static int hf_smb_group_id; +static int hf_smb_pid; +static int hf_smb_tid; +static int hf_smb_uid; +static int hf_smb_mid; +static int hf_smb_pid_high; +static int hf_smb_sig; +static int hf_smb_response_to; +static int hf_smb_time; +static int hf_smb_response_in; +static int hf_smb_continuation_of; +static int hf_smb_nt_status; +static int hf_smb_error_class; +static int hf_smb_error_code; +static int hf_smb_reserved; +static int hf_smb_create_flags; +static int hf_smb_create_options; +static int hf_smb_share_access; +static int hf_smb_access_mask; +static int hf_smb_flags; +static int hf_smb_flags_lock; +static int hf_smb_flags_receive_buffer; +static int hf_smb_flags_caseless; +static int hf_smb_flags_canon; +static int hf_smb_flags_oplock; +static int hf_smb_flags_notify; +static int hf_smb_flags_response; +static int hf_smb_flags2; +static int hf_smb_flags2_long_names_allowed; +static int hf_smb_flags2_ea; +static int hf_smb_flags2_sec_sig; +static int hf_smb_flags2_compressed; +static int hf_smb_flags2_sec_sig_required; +static int hf_smb_flags2_long_names_used; +static int hf_smb_flags2_reparse_path; +static int hf_smb_flags2_esn; +static int hf_smb_flags2_dfs; +static int hf_smb_flags2_roe; +static int hf_smb_flags2_nt_error; +static int hf_smb_flags2_string; +static int hf_smb_word_count; +static int hf_smb_byte_count; +static int hf_smb_buffer_format; +static int hf_smb_dialect; +static int hf_smb_dialect_name; +static int hf_smb_dialect_index; +static int hf_smb_max_trans_buf_size; +static int hf_smb_max_mpx_count; +static int hf_smb_max_vcs_num; +static int hf_smb_session_key; +static int hf_smb_server_timezone; +static int hf_smb_challenge_length; +static int hf_smb_challenge; +static int hf_smb_primary_domain; +static int hf_smb_server; +static int hf_smb_max_raw_buf_size; +static int hf_smb_server_guid; +static int hf_smb_volume_guid; +static int hf_smb_security_blob_len; +static int hf_smb_security_blob; +static int hf_smb_sm16; +static int hf_smb_sm_mode16; +static int hf_smb_sm_password16; +static int hf_smb_sm; +static int hf_smb_sm_mode; +static int hf_smb_sm_password; +static int hf_smb_sm_signatures; +static int hf_smb_sm_sig_required; +static int hf_smb_rm; +static int hf_smb_rm_read; +static int hf_smb_rm_write; +static int hf_smb_server_date_time; +static int hf_smb_server_smb_date; +static int hf_smb_server_smb_time; +static int hf_smb_server_cap; +static int hf_smb_server_cap_raw_mode; +static int hf_smb_server_cap_mpx_mode; +static int hf_smb_server_cap_unicode; +static int hf_smb_server_cap_large_files; +static int hf_smb_server_cap_nt_smbs; +static int hf_smb_server_cap_rpc_remote_apis; +static int hf_smb_server_cap_nt_status; +static int hf_smb_server_cap_level_ii_oplocks; +static int hf_smb_server_cap_lock_and_read; +static int hf_smb_server_cap_nt_find; +static int hf_smb_server_cap_dfs; +static int hf_smb_server_cap_infolevel_passthru; +static int hf_smb_server_cap_large_readx; +static int hf_smb_server_cap_large_writex; +static int hf_smb_server_cap_lwio; +static int hf_smb_server_cap_unix; +static int hf_smb_server_cap_compressed_data; +static int hf_smb_server_cap_dynamic_reauth; +static int hf_smb_server_cap_extended_security; +static int hf_smb_system_time; +static int hf_smb_secondaries_will_follow; +static int hf_smb_unknown; +static int hf_smb_dir_name; +static int hf_smb_echo_count; +static int hf_smb_echo_data; +static int hf_smb_echo_seq_num; +static int hf_smb_max_buf_size; +static int hf_smb_password; +static int hf_smb_password_len; +static int hf_smb_ansi_password; +static int hf_smb_ansi_password_len; +static int hf_smb_unicode_password; +static int hf_smb_unicode_password_len; +static int hf_smb_path; +static int hf_smb_service; +static int hf_smb_move_flags; +static int hf_smb_move_flags_file; +static int hf_smb_move_flags_dir; +static int hf_smb_move_flags_verify; +static int hf_smb_files_moved; +static int hf_smb_file_access_mask_read_data; +static int hf_smb_file_access_mask_write_data; +static int hf_smb_file_access_mask_append_data; +static int hf_smb_file_access_mask_read_ea; +static int hf_smb_file_access_mask_write_ea; +static int hf_smb_file_access_mask_execute; +static int hf_smb_file_access_mask_read_attribute; +static int hf_smb_file_access_mask_write_attribute; +static int hf_smb_dir_access_mask_list; +static int hf_smb_dir_access_mask_add_file; +static int hf_smb_dir_access_mask_add_subdir; +static int hf_smb_dir_access_mask_read_ea; +static int hf_smb_dir_access_mask_write_ea; +static int hf_smb_dir_access_mask_traverse; +static int hf_smb_dir_access_mask_delete_child; +static int hf_smb_dir_access_mask_read_attribute; +static int hf_smb_dir_access_mask_write_attribute; +static int hf_smb_copy_flags; +static int hf_smb_copy_flags_file; +static int hf_smb_copy_flags_dir; +static int hf_smb_copy_flags_dest_mode; +static int hf_smb_copy_flags_source_mode; +static int hf_smb_copy_flags_verify; +static int hf_smb_copy_flags_tree_copy; +static int hf_smb_copy_flags_ea_action; +static int hf_smb_count; +static int hf_smb_count_low; +static int hf_smb_count_high; +static int hf_smb_file_name; +static int hf_smb_open_function; +static int hf_smb_open_function_open; +static int hf_smb_open_function_create; +static int hf_smb_fid; +static int hf_smb_file_attr_16bit; +static int hf_smb_file_attr_8bit; +static int hf_smb_file_attr_read_only_16bit; +static int hf_smb_file_attr_read_only_8bit; +static int hf_smb_file_attr_hidden_16bit; +static int hf_smb_file_attr_hidden_8bit; +static int hf_smb_file_attr_system_16bit; +static int hf_smb_file_attr_system_8bit; +static int hf_smb_file_attr_volume_16bit; +static int hf_smb_file_attr_volume_8bit; +static int hf_smb_file_attr_directory_16bit; +static int hf_smb_file_attr_directory_8bit; +static int hf_smb_file_attr_archive_16bit; +static int hf_smb_file_attr_archive_8bit; #if 0 -static int hf_smb_file_attr_device = -1; -static int hf_smb_file_attr_normal = -1; -static int hf_smb_file_attr_temporary = -1; -static int hf_smb_file_attr_sparse = -1; -static int hf_smb_file_attr_reparse = -1; -static int hf_smb_file_attr_compressed = -1; -static int hf_smb_file_attr_offline = -1; -static int hf_smb_file_attr_not_content_indexed = -1; -static int hf_smb_file_attr_encrypted = -1; +static int hf_smb_file_attr_device; +static int hf_smb_file_attr_normal; +static int hf_smb_file_attr_temporary; +static int hf_smb_file_attr_sparse; +static int hf_smb_file_attr_reparse; +static int hf_smb_file_attr_compressed; +static int hf_smb_file_attr_offline; +static int hf_smb_file_attr_not_content_indexed; +static int hf_smb_file_attr_encrypted; #endif -static int hf_smb_file_size = -1; -static int hf_smb_search_attribute = -1; -static int hf_smb_search_attribute_read_only = -1; -static int hf_smb_search_attribute_hidden = -1; -static int hf_smb_search_attribute_system = -1; -static int hf_smb_search_attribute_volume = -1; -static int hf_smb_search_attribute_directory = -1; -static int hf_smb_search_attribute_archive = -1; -static int hf_smb_access_mode = -1; -static int hf_smb_access_sharing = -1; -static int hf_smb_access_locality = -1; -static int hf_smb_access_caching = -1; -static int hf_smb_access_writetru = -1; -static int hf_smb_desired_access = -1; -static int hf_smb_granted_access = -1; -static int hf_smb_create_time = -1; -static int hf_smb_modify_time = -1; -static int hf_smb_backup_time = -1; -static int hf_smb_mac_alloc_block_count = -1; -static int hf_smb_mac_alloc_block_size = -1; -static int hf_smb_mac_free_block_count = -1; -static int hf_smb_mac_fndrinfo = -1; -static int hf_smb_mac_root_file_count = -1; -static int hf_smb_mac_root_dir_count = -1; -static int hf_smb_mac_file_count = -1; -static int hf_smb_mac_dir_count = -1; -static int hf_smb_mac_sup = -1; -static int hf_smb_mac_sup_access_ctrl = -1; -static int hf_smb_mac_sup_getset_comments = -1; -static int hf_smb_mac_sup_desktopdb_calls = -1; -static int hf_smb_mac_sup_unique_ids = -1; -static int hf_smb_mac_sup_streams = -1; -static int hf_smb_create_dos_date = -1; -static int hf_smb_create_dos_time = -1; -static int hf_smb_last_write_time = -1; -static int hf_smb_last_write_dos_date = -1; -static int hf_smb_last_write_dos_time = -1; -static int hf_smb_access_time = -1; -static int hf_smb_access_dos_date = -1; -static int hf_smb_access_dos_time = -1; -static int hf_smb_old_file_name = -1; -static int hf_smb_offset = -1; -static int hf_smb_remaining = -1; -static int hf_smb_padding = -1; -static int hf_smb_file_data = -1; -/* static int hf_smb_raw_ea_data = -1; */ -static int hf_smb_total_data_len = -1; -static int hf_smb_data_len = -1; -static int hf_smb_data_len_low = -1; -static int hf_smb_data_len_high = -1; -static int hf_smb_seek_mode = -1; -static int hf_smb_data_size = -1; -static int hf_smb_alloc_size = -1; -static int hf_smb_alloc_size64 = -1; -static int hf_smb_max_count = -1; -static int hf_smb_max_count_low = -1; -static int hf_smb_max_count_high = -1; -static int hf_smb_min_count = -1; -static int hf_smb_timeout = -1; -static int hf_smb_high_offset = -1; -static int hf_smb_units = -1; -static int hf_smb_bpu = -1; -static int hf_smb_blocksize = -1; -static int hf_smb_freeunits = -1; -static int hf_smb_data_offset = -1; -static int hf_smb_dcm = -1; -static int hf_smb_request_mask = -1; -static int hf_smb_response_mask = -1; -static int hf_smb_search_id = -1; -static int hf_smb_write_mode = -1; -static int hf_smb_write_mode_write_through = -1; -static int hf_smb_write_mode_return_remaining = -1; -static int hf_smb_write_mode_raw = -1; -static int hf_smb_write_mode_message_start = -1; -static int hf_smb_write_mode_connectionless = -1; -static int hf_smb_resume_key_len = -1; -static int hf_smb_resume_find_id = -1; -static int hf_smb_resume_server_cookie = -1; -static int hf_smb_resume_client_cookie = -1; -static int hf_smb_andxoffset = -1; -static int hf_smb_lock_type = -1; -static int hf_smb_lock_type_large = -1; -static int hf_smb_lock_type_cancel = -1; -static int hf_smb_lock_type_change = -1; -static int hf_smb_lock_type_oplock = -1; -static int hf_smb_lock_type_shared = -1; -static int hf_smb_locking_ol = -1; -static int hf_smb_number_of_locks = -1; -static int hf_smb_number_of_unlocks = -1; -static int hf_smb_lock_long_offset = -1; -static int hf_smb_lock_long_length = -1; -static int hf_smb_file_type = -1; -static int hf_smb_ipc_state = -1; -static int hf_smb_ipc_state_nonblocking = -1; -static int hf_smb_ipc_state_endpoint = -1; -static int hf_smb_ipc_state_pipe_type = -1; -static int hf_smb_ipc_state_read_mode = -1; -static int hf_smb_ipc_state_icount = -1; -static int hf_smb_server_fid = -1; -static int hf_smb_open_flags = -1; -static int hf_smb_open_flags_add_info = -1; -static int hf_smb_open_flags_ex_oplock = -1; -static int hf_smb_open_flags_batch_oplock = -1; -static int hf_smb_open_flags_ealen = -1; -static int hf_smb_open_action = -1; -static int hf_smb_open_action_open = -1; -static int hf_smb_open_action_lock = -1; -static int hf_smb_vc_num = -1; -static int hf_smb_account = -1; -static int hf_smb_os = -1; -static int hf_smb_lanman = -1; -static int hf_smb_setup_action = -1; -static int hf_smb_setup_action_guest = -1; -static int hf_smb_fs = -1; -static int hf_smb_connect_flags = -1; -static int hf_smb_connect_flags_dtid = -1; -static int hf_smb_connect_flags_ext_sig = -1; -static int hf_smb_connect_flags_ext_resp = -1; -static int hf_smb_connect_support = -1; -static int hf_smb_connect_support_search = -1; -static int hf_smb_connect_support_in_dfs = -1; -static int hf_smb_connect_support_csc_mask_vals = -1; -static int hf_smb_connect_support_uniquefilename = -1; -static int hf_smb_connect_support_extended_signature = -1; -static int hf_smb_max_setup_count = -1; -static int hf_smb_total_param_count = -1; -static int hf_smb_total_data_count = -1; -static int hf_smb_max_param_count = -1; -static int hf_smb_max_data_count = -1; -static int hf_smb_param_disp16 = -1; -static int hf_smb_param_count16 = -1; -static int hf_smb_param_offset16 = -1; -static int hf_smb_param_disp32 = -1; -static int hf_smb_param_count32 = -1; -static int hf_smb_param_offset32 = -1; -static int hf_smb_data_disp16 = -1; -static int hf_smb_data_count16 = -1; -static int hf_smb_data_offset16 = -1; -static int hf_smb_data_disp32 = -1; -static int hf_smb_data_count32 = -1; -static int hf_smb_data_offset32 = -1; -static int hf_smb_setup_count = -1; -static int hf_smb_nt_trans_subcmd = -1; -static int hf_smb_nt_ioctl_isfsctl = -1; -static int hf_smb_nt_ioctl_flags_completion_filter = -1; -static int hf_smb_nt_ioctl_flags_root_handle = -1; -static int hf_smb_nt_notify_action = -1; -static int hf_smb_nt_notify_watch_tree = -1; -static int hf_smb_nt_notify_completion_filter = -1; -static int hf_smb_nt_notify_stream_write = -1; -static int hf_smb_nt_notify_stream_size = -1; -static int hf_smb_nt_notify_stream_name = -1; -static int hf_smb_nt_notify_security = -1; -static int hf_smb_nt_notify_ea = -1; -static int hf_smb_nt_notify_creation = -1; -static int hf_smb_nt_notify_last_access = -1; -static int hf_smb_nt_notify_last_write = -1; -static int hf_smb_nt_notify_size = -1; -static int hf_smb_nt_notify_attributes = -1; -static int hf_smb_nt_notify_dir_name = -1; -static int hf_smb_nt_notify_file_name = -1; -static int hf_smb_root_dir_fid = -1; -static int hf_smb_nt_create_disposition = -1; -static int hf_smb_sd_length = -1; -static int hf_smb_ea_list_length = -1; -static int hf_smb_ea_flags = -1; -static int hf_smb_ea_name_length = -1; -static int hf_smb_ea_data_length = -1; -static int hf_smb_ea_name = -1; -static int hf_smb_ea_data = -1; -static int hf_smb_file_name_len = -1; -static int hf_smb_nt_impersonation_level = -1; -static int hf_smb_nt_security_flags = -1; -static int hf_smb_nt_security_flags_context_tracking = -1; -static int hf_smb_nt_security_flags_effective_only = -1; -static int hf_smb_nt_access_mask_generic_read = -1; -static int hf_smb_nt_access_mask_generic_write = -1; -static int hf_smb_nt_access_mask_generic_execute = -1; -static int hf_smb_nt_access_mask_generic_all = -1; -static int hf_smb_nt_access_mask_maximum_allowed = -1; -static int hf_smb_nt_access_mask_system_security = -1; -static int hf_smb_nt_access_mask_synchronize = -1; -static int hf_smb_nt_access_mask_write_owner = -1; -static int hf_smb_nt_access_mask_write_dac = -1; -static int hf_smb_nt_access_mask_read_control = -1; -static int hf_smb_nt_access_mask_delete = -1; -static int hf_smb_nt_access_mask_write_attributes = -1; -static int hf_smb_nt_access_mask_read_attributes = -1; -static int hf_smb_nt_access_mask_delete_child = -1; -static int hf_smb_nt_access_mask_execute = -1; -static int hf_smb_nt_access_mask_write_ea = -1; -static int hf_smb_nt_access_mask_read_ea = -1; -static int hf_smb_nt_access_mask_append = -1; -static int hf_smb_nt_access_mask_write = -1; -static int hf_smb_nt_access_mask_read = -1; -static int hf_smb_nt_create_bits_oplock = -1; -static int hf_smb_nt_create_bits_boplock = -1; -static int hf_smb_nt_create_bits_dir = -1; -static int hf_smb_nt_create_bits_ext_resp = -1; -static int hf_smb_nt_create_options_directory_file = -1; -static int hf_smb_nt_create_options_write_through = -1; -static int hf_smb_nt_create_options_sequential_only = -1; -static int hf_smb_nt_create_options_no_intermediate_buffering = -1; -static int hf_smb_nt_create_options_sync_io_alert = -1; -static int hf_smb_nt_create_options_sync_io_nonalert = -1; -static int hf_smb_nt_create_options_non_directory_file = -1; -static int hf_smb_nt_create_options_create_tree_connection = -1; -static int hf_smb_nt_create_options_complete_if_oplocked = -1; -static int hf_smb_nt_create_options_no_ea_knowledge = -1; -static int hf_smb_nt_create_options_eight_dot_three_only = -1; -static int hf_smb_nt_create_options_random_access = -1; -static int hf_smb_nt_create_options_delete_on_close = -1; -static int hf_smb_nt_create_options_open_by_fileid = -1; -static int hf_smb_nt_create_options_backup_intent = -1; -static int hf_smb_nt_create_options_no_compression = -1; -static int hf_smb_nt_create_options_reserve_opfilter = -1; -static int hf_smb_nt_create_options_open_reparse_point = -1; -static int hf_smb_nt_create_options_open_no_recall = -1; -static int hf_smb_nt_create_options_open_for_free_space_query = -1; -static int hf_smb_nt_share_access_read = -1; -static int hf_smb_nt_share_access_write = -1; -static int hf_smb_nt_share_access_delete = -1; -static int hf_smb_file_eattr = -1; -static int hf_smb_file_eattr_read_only = -1; -static int hf_smb_file_eattr_hidden = -1; -static int hf_smb_file_eattr_system = -1; -static int hf_smb_file_eattr_volume = -1; -static int hf_smb_file_eattr_directory = -1; -static int hf_smb_file_eattr_archive = -1; -static int hf_smb_file_eattr_device = -1; -static int hf_smb_file_eattr_normal = -1; -static int hf_smb_file_eattr_temporary = -1; -static int hf_smb_file_eattr_sparse = -1; -static int hf_smb_file_eattr_reparse = -1; -static int hf_smb_file_eattr_compressed = -1; -static int hf_smb_file_eattr_offline = -1; -static int hf_smb_file_eattr_not_content_indexed = -1; -static int hf_smb_file_eattr_encrypted = -1; -static int hf_smb_size_returned_quota_data = -1; -static int hf_smb_sec_desc_len = -1; -static int hf_smb_nt_qsd = -1; -static int hf_smb_nt_qsd_owner = -1; -static int hf_smb_nt_qsd_group = -1; -static int hf_smb_nt_qsd_dacl = -1; -static int hf_smb_nt_qsd_sacl = -1; -static int hf_smb_extended_attributes = -1; -static int hf_smb_oplock_level = -1; -static int hf_smb_response_type = -1; -static int hf_smb_create_action = -1; -static int hf_smb_file_id = -1; -static int hf_smb_file_id_64bit = -1; -static int hf_smb_ea_error_offset = -1; -static int hf_smb_end_of_file = -1; -static int hf_smb_replace = -1; -static int hf_smb_root_dir_handle = -1; -static int hf_smb_target_name_len = -1; -static int hf_smb_target_name = -1; -static int hf_smb_device_type = -1; -static int hf_smb_is_directory = -1; -static int hf_smb_next_entry_offset = -1; -static int hf_smb_change_time = -1; -static int hf_smb_setup_len = -1; -static int hf_smb_print_mode = -1; -static int hf_smb_print_identifier = -1; -static int hf_smb_restart_index = -1; -static int hf_smb_print_queue_date = -1; -static int hf_smb_print_queue_dos_date = -1; -static int hf_smb_print_queue_dos_time = -1; -static int hf_smb_print_status = -1; -static int hf_smb_print_spool_file_number = -1; -static int hf_smb_print_spool_file_size = -1; -static int hf_smb_print_spool_file_name = -1; -static int hf_smb_start_index = -1; -static int hf_smb_originator_name = -1; -static int hf_smb_destination_name = -1; -static int hf_smb_message_len = -1; -static int hf_smb_message = -1; -static int hf_smb_mgid = -1; -static int hf_smb_forwarded_name = -1; -static int hf_smb_machine_name = -1; -static int hf_smb_cancel_to = -1; -static int hf_smb_trans2_subcmd = -1; -static int hf_smb_trans_name = -1; -static int hf_smb_transaction_flags = -1; -static int hf_smb_transaction_flags_dtid = -1; -static int hf_smb_transaction_flags_owt = -1; -static int hf_smb_search_count = -1; -static int hf_smb_search_pattern = -1; -static int hf_smb_ff2 = -1; -static int hf_smb_ff2_backup = -1; -static int hf_smb_ff2_continue = -1; -static int hf_smb_ff2_resume = -1; -static int hf_smb_ff2_close_eos = -1; -static int hf_smb_ff2_close = -1; -static int hf_smb_ff2_information_level = -1; -static int hf_smb_qpi_loi = -1; -static int hf_smb_spi_loi = -1; +static int hf_smb_file_size; +static int hf_smb_search_attribute; +static int hf_smb_search_attribute_read_only; +static int hf_smb_search_attribute_hidden; +static int hf_smb_search_attribute_system; +static int hf_smb_search_attribute_volume; +static int hf_smb_search_attribute_directory; +static int hf_smb_search_attribute_archive; +static int hf_smb_access_mode; +static int hf_smb_access_sharing; +static int hf_smb_access_locality; +static int hf_smb_access_caching; +static int hf_smb_access_writetru; +static int hf_smb_desired_access; +static int hf_smb_granted_access; +static int hf_smb_create_time; +static int hf_smb_modify_time; +static int hf_smb_backup_time; +static int hf_smb_mac_alloc_block_count; +static int hf_smb_mac_alloc_block_size; +static int hf_smb_mac_free_block_count; +static int hf_smb_mac_fndrinfo; +static int hf_smb_mac_root_file_count; +static int hf_smb_mac_root_dir_count; +static int hf_smb_mac_file_count; +static int hf_smb_mac_dir_count; +static int hf_smb_mac_sup; +static int hf_smb_mac_sup_access_ctrl; +static int hf_smb_mac_sup_getset_comments; +static int hf_smb_mac_sup_desktopdb_calls; +static int hf_smb_mac_sup_unique_ids; +static int hf_smb_mac_sup_streams; +static int hf_smb_create_dos_date; +static int hf_smb_create_dos_time; +static int hf_smb_last_write_time; +static int hf_smb_last_write_dos_date; +static int hf_smb_last_write_dos_time; +static int hf_smb_access_time; +static int hf_smb_access_dos_date; +static int hf_smb_access_dos_time; +static int hf_smb_old_file_name; +static int hf_smb_offset; +static int hf_smb_remaining; +static int hf_smb_padding; +static int hf_smb_file_data; +/* static int hf_smb_raw_ea_data; */ +static int hf_smb_total_data_len; +static int hf_smb_data_len; +static int hf_smb_data_len_low; +static int hf_smb_data_len_high; +static int hf_bytes_until_total_data_count; +static int hf_smb_seek_mode; +static int hf_smb_data_size; +static int hf_smb_alloc_size; +static int hf_smb_alloc_size64; +static int hf_smb_max_count; +static int hf_smb_max_count_low; +static int hf_smb_max_count_high; +static int hf_smb_min_count; +static int hf_smb_timeout; +static int hf_smb_high_offset; +static int hf_smb_units; +static int hf_smb_bpu; +static int hf_smb_blocksize; +static int hf_smb_freeunits; +static int hf_smb_data_offset; +static int hf_smb_dcm; +static int hf_smb_request_mask; +static int hf_smb_response_mask; +static int hf_smb_search_id; +static int hf_smb_write_mode; +static int hf_smb_write_mode_write_through; +static int hf_smb_write_mode_return_remaining; +static int hf_smb_write_mode_raw; +static int hf_smb_write_mode_message_start; +static int hf_smb_write_mode_connectionless; +static int hf_smb_resume_key_len; +static int hf_smb_resume_find_id; +static int hf_smb_resume_server_cookie; +static int hf_smb_resume_client_cookie; +static int hf_smb_andxoffset; +static int hf_smb_lock_type; +static int hf_smb_lock_type_large; +static int hf_smb_lock_type_cancel; +static int hf_smb_lock_type_change; +static int hf_smb_lock_type_oplock; +static int hf_smb_lock_type_shared; +static int hf_smb_locking_ol; +static int hf_smb_number_of_locks; +static int hf_smb_number_of_unlocks; +static int hf_smb_lock_long_offset; +static int hf_smb_lock_long_length; +static int hf_smb_file_type; +static int hf_smb_ipc_state; +static int hf_smb_ipc_state_nonblocking; +static int hf_smb_ipc_state_endpoint; +static int hf_smb_ipc_state_pipe_type; +static int hf_smb_ipc_state_read_mode; +static int hf_smb_ipc_state_icount; +static int hf_smb_server_fid; +static int hf_smb_open_flags; +static int hf_smb_open_flags_add_info; +static int hf_smb_open_flags_ex_oplock; +static int hf_smb_open_flags_batch_oplock; +static int hf_smb_open_flags_ealen; +static int hf_smb_open_action; +static int hf_smb_open_action_open; +static int hf_smb_open_action_lock; +static int hf_smb_vc_num; +static int hf_smb_account; +static int hf_smb_os; +static int hf_smb_lanman; +static int hf_smb_setup_action; +static int hf_smb_setup_action_guest; +static int hf_smb_fs; +static int hf_smb_connect_flags; +static int hf_smb_connect_flags_dtid; +static int hf_smb_connect_flags_ext_sig; +static int hf_smb_connect_flags_ext_resp; +static int hf_smb_connect_support; +static int hf_smb_connect_support_search; +static int hf_smb_connect_support_in_dfs; +static int hf_smb_connect_support_csc_mask_vals; +static int hf_smb_connect_support_uniquefilename; +static int hf_smb_connect_support_extended_signature; +static int hf_smb_max_setup_count; +static int hf_smb_total_param_count; +static int hf_smb_total_data_count; +static int hf_smb_max_param_count; +static int hf_smb_max_data_count; +static int hf_smb_param_disp16; +static int hf_smb_param_count16; +static int hf_smb_param_offset16; +static int hf_smb_param_disp32; +static int hf_smb_param_count32; +static int hf_smb_param_offset32; +static int hf_smb_data_disp16; +static int hf_smb_data_count16; +static int hf_smb_data_offset16; +static int hf_smb_data_disp32; +static int hf_smb_data_count32; +static int hf_smb_data_offset32; +static int hf_smb_setup_count; +static int hf_smb_nt_trans_subcmd; +static int hf_smb_nt_ioctl_isfsctl; +static int hf_smb_nt_ioctl_flags_completion_filter; +static int hf_smb_nt_ioctl_flags_root_handle; +static int hf_smb_nt_notify_action; +static int hf_smb_nt_notify_watch_tree; +static int hf_smb_nt_notify_completion_filter; +static int hf_smb_nt_notify_stream_write; +static int hf_smb_nt_notify_stream_size; +static int hf_smb_nt_notify_stream_name; +static int hf_smb_nt_notify_security; +static int hf_smb_nt_notify_ea; +static int hf_smb_nt_notify_creation; +static int hf_smb_nt_notify_last_access; +static int hf_smb_nt_notify_last_write; +static int hf_smb_nt_notify_size; +static int hf_smb_nt_notify_attributes; +static int hf_smb_nt_notify_dir_name; +static int hf_smb_nt_notify_file_name; +static int hf_smb_root_dir_fid; +static int hf_smb_nt_create_disposition; +static int hf_smb_sd_length; +static int hf_smb_ea_list_length; +static int hf_smb_ea_flags; +static int hf_smb_ea_name_length; +static int hf_smb_ea_data_length; +static int hf_smb_ea_name; +static int hf_smb_ea_data; +static int hf_smb_file_name_len; +static int hf_smb_nt_impersonation_level; +static int hf_smb_nt_security_flags; +static int hf_smb_nt_security_flags_context_tracking; +static int hf_smb_nt_security_flags_effective_only; +static int hf_smb_nt_access_mask_generic_read; +static int hf_smb_nt_access_mask_generic_write; +static int hf_smb_nt_access_mask_generic_execute; +static int hf_smb_nt_access_mask_generic_all; +static int hf_smb_nt_access_mask_maximum_allowed; +static int hf_smb_nt_access_mask_system_security; +static int hf_smb_nt_access_mask_synchronize; +static int hf_smb_nt_access_mask_write_owner; +static int hf_smb_nt_access_mask_write_dac; +static int hf_smb_nt_access_mask_read_control; +static int hf_smb_nt_access_mask_delete; +static int hf_smb_nt_access_mask_write_attributes; +static int hf_smb_nt_access_mask_read_attributes; +static int hf_smb_nt_access_mask_delete_child; +static int hf_smb_nt_access_mask_execute; +static int hf_smb_nt_access_mask_write_ea; +static int hf_smb_nt_access_mask_read_ea; +static int hf_smb_nt_access_mask_append; +static int hf_smb_nt_access_mask_write; +static int hf_smb_nt_access_mask_read; +static int hf_smb_nt_create_bits_oplock; +static int hf_smb_nt_create_bits_boplock; +static int hf_smb_nt_create_bits_dir; +static int hf_smb_nt_create_bits_ext_resp; +static int hf_smb_nt_create_options_directory_file; +static int hf_smb_nt_create_options_write_through; +static int hf_smb_nt_create_options_sequential_only; +static int hf_smb_nt_create_options_no_intermediate_buffering; +static int hf_smb_nt_create_options_sync_io_alert; +static int hf_smb_nt_create_options_sync_io_nonalert; +static int hf_smb_nt_create_options_non_directory_file; +static int hf_smb_nt_create_options_create_tree_connection; +static int hf_smb_nt_create_options_complete_if_oplocked; +static int hf_smb_nt_create_options_no_ea_knowledge; +static int hf_smb_nt_create_options_eight_dot_three_only; +static int hf_smb_nt_create_options_random_access; +static int hf_smb_nt_create_options_delete_on_close; +static int hf_smb_nt_create_options_open_by_fileid; +static int hf_smb_nt_create_options_backup_intent; +static int hf_smb_nt_create_options_no_compression; +static int hf_smb_nt_create_options_reserve_opfilter; +static int hf_smb_nt_create_options_open_reparse_point; +static int hf_smb_nt_create_options_open_no_recall; +static int hf_smb_nt_create_options_open_for_free_space_query; +static int hf_smb_nt_share_access_read; +static int hf_smb_nt_share_access_write; +static int hf_smb_nt_share_access_delete; +static int hf_smb_file_eattr; +static int hf_smb_file_eattr_read_only; +static int hf_smb_file_eattr_hidden; +static int hf_smb_file_eattr_system; +static int hf_smb_file_eattr_volume; +static int hf_smb_file_eattr_directory; +static int hf_smb_file_eattr_archive; +static int hf_smb_file_eattr_device; +static int hf_smb_file_eattr_normal; +static int hf_smb_file_eattr_temporary; +static int hf_smb_file_eattr_sparse; +static int hf_smb_file_eattr_reparse; +static int hf_smb_file_eattr_compressed; +static int hf_smb_file_eattr_offline; +static int hf_smb_file_eattr_not_content_indexed; +static int hf_smb_file_eattr_encrypted; +static int hf_smb_size_returned_quota_data; +static int hf_smb_sec_desc_len; +static int hf_smb_nt_qsd; +static int hf_smb_nt_qsd_owner; +static int hf_smb_nt_qsd_group; +static int hf_smb_nt_qsd_dacl; +static int hf_smb_nt_qsd_sacl; +static int hf_smb_extended_attributes; +static int hf_smb_oplock_level; +static int hf_smb_response_type; +static int hf_smb_create_action; +static int hf_smb_file_id; +static int hf_smb_file_id_64bit; +static int hf_smb_ea_error_offset; +static int hf_smb_end_of_file; +static int hf_smb_replace; +static int hf_smb_root_dir_handle; +static int hf_smb_target_name_len; +static int hf_smb_target_name; +static int hf_smb_device_type; +static int hf_smb_is_directory; +static int hf_smb_next_entry_offset; +static int hf_smb_change_time; +static int hf_smb_setup_len; +static int hf_smb_print_mode; +static int hf_smb_print_identifier; +static int hf_smb_restart_index; +static int hf_smb_print_queue_date; +static int hf_smb_print_queue_dos_date; +static int hf_smb_print_queue_dos_time; +static int hf_smb_print_status; +static int hf_smb_print_spool_file_number; +static int hf_smb_print_spool_file_size; +static int hf_smb_print_spool_file_name; +static int hf_smb_start_index; +static int hf_smb_originator_name; +static int hf_smb_destination_name; +static int hf_smb_message_len; +static int hf_smb_message; +static int hf_smb_mgid; +static int hf_smb_forwarded_name; +static int hf_smb_machine_name; +static int hf_smb_cancel_to; +static int hf_smb_trans2_subcmd; +static int hf_smb_trans_name; +static int hf_smb_transaction_flags; +static int hf_smb_transaction_flags_dtid; +static int hf_smb_transaction_flags_owt; +static int hf_smb_search_count_max; +static int hf_smb_search_count_found; +static int hf_smb_search_pattern; +static int hf_smb_ff2; +static int hf_smb_ff2_backup; +static int hf_smb_ff2_continue; +static int hf_smb_ff2_resume; +static int hf_smb_ff2_close_eos; +static int hf_smb_ff2_close; +static int hf_smb_ff2_information_level; +static int hf_smb_qpi_loi; +static int hf_smb_spi_loi; #if 0 -static int hf_smb_sfi = -1; -static int hf_smb_sfi_writetru = -1; -static int hf_smb_sfi_caching = -1; +static int hf_smb_sfi; +static int hf_smb_sfi_writetru; +static int hf_smb_sfi_caching; #endif -static int hf_smb_storage_type = -1; -static int hf_smb_resume = -1; -static int hf_smb_max_referral_level = -1; -static int hf_smb_qfsi_information_level = -1; -static int hf_smb_sfsi_information_level = -1; -static int hf_smb_number_of_links = -1; -static int hf_smb_delete_pending = -1; -static int hf_smb_index_number = -1; -static int hf_smb_position = -1; -/* static int hf_smb_current_offset = -1; */ -static int hf_smb_t2_alignment = -1; -static int hf_smb_t2_stream_name_length = -1; -static int hf_smb_t2_stream_size = -1; -static int hf_smb_t2_stream_name = -1; -static int hf_smb_t2_compressed_file_size = -1; -static int hf_smb_t2_compressed_format = -1; -static int hf_smb_t2_compressed_unit_shift = -1; -static int hf_smb_t2_compressed_chunk_shift = -1; -static int hf_smb_t2_compressed_cluster_shift = -1; -static int hf_smb_t2_marked_for_deletion = -1; -static int hf_smb_dfs_path_consumed = -1; -static int hf_smb_dfs_num_referrals = -1; -static int hf_smb_get_dfs_flags = -1; -static int hf_smb_get_dfs_server_hold_storage = -1; -static int hf_smb_get_dfs_fielding = -1; -static int hf_smb_dfs_referral_version = -1; -static int hf_smb_dfs_referral_size = -1; -static int hf_smb_dfs_referral_server_type = -1; -static int hf_smb_dfs_referral_flags = -1; -static int hf_smb_dfs_referral_flags_name_list_referral = -1; -static int hf_smb_dfs_referral_flags_target_set_boundary = -1; -static int hf_smb_dfs_referral_node_offset = -1; -static int hf_smb_dfs_referral_node = -1; -static int hf_smb_dfs_referral_proximity = -1; -static int hf_smb_dfs_referral_ttl = -1; -static int hf_smb_dfs_referral_path_offset = -1; -static int hf_smb_dfs_referral_path = -1; -static int hf_smb_dfs_referral_alt_path_offset = -1; -static int hf_smb_dfs_referral_alt_path = -1; -static int hf_smb_dfs_referral_domain_offset = -1; -static int hf_smb_dfs_referral_number_of_expnames = -1; -static int hf_smb_dfs_referral_expnames_offset = -1; -static int hf_smb_dfs_referral_domain_name = -1; -static int hf_smb_dfs_referral_expname = -1; -static int hf_smb_dfs_referral_server_guid = -1; -static int hf_smb_end_of_search = -1; -static int hf_smb_last_name_offset = -1; -static int hf_smb_fn_information_level = -1; -static int hf_smb_monitor_handle = -1; -static int hf_smb_change_count = -1; -static int hf_smb_file_index = -1; -static int hf_smb_short_file_name = -1; -static int hf_smb_short_file_name_len = -1; -static int hf_smb_fs_id = -1; -static int hf_smb_sector_unit = -1; -static int hf_smb_fs_units = -1; -static int hf_smb_fs_sector = -1; -static int hf_smb_avail_units = -1; -static int hf_smb_volume_serial_num = -1; -static int hf_smb_volume_label_len = -1; -static int hf_smb_volume_label = -1; -static int hf_smb_free_alloc_units64 = -1; -static int hf_smb_caller_free_alloc_units64 = -1; -static int hf_smb_actual_free_alloc_units64 = -1; -static int hf_smb_max_name_len = -1; -static int hf_smb_fs_name_len = -1; -static int hf_smb_fs_name = -1; -static int hf_smb_device_char = -1; -static int hf_smb_device_char_removable = -1; -static int hf_smb_device_char_read_only = -1; -static int hf_smb_device_char_floppy = -1; -static int hf_smb_device_char_write_once = -1; -static int hf_smb_device_char_remote = -1; -static int hf_smb_device_char_mounted = -1; -static int hf_smb_device_char_virtual = -1; -static int hf_smb_device_char_secure_open = -1; -static int hf_smb_device_char_ts = -1; -static int hf_smb_device_char_webdav = -1; -static int hf_smb_device_char_aat = -1; -static int hf_smb_device_char_portable = -1; -static int hf_smb_fs_attr = -1; -static int hf_smb_fs_attr_css = -1; -static int hf_smb_fs_attr_cpn = -1; -static int hf_smb_fs_attr_uod = -1; -static int hf_smb_fs_attr_pacls = -1; -static int hf_smb_fs_attr_fc = -1; -static int hf_smb_fs_attr_vq = -1; -static int hf_smb_fs_attr_ssf = -1; -static int hf_smb_fs_attr_srp = -1; -static int hf_smb_fs_attr_srs = -1; -static int hf_smb_fs_attr_sla = -1; -static int hf_smb_fs_attr_vic = -1; -static int hf_smb_fs_attr_soids = -1; -static int hf_smb_fs_attr_se = -1; -static int hf_smb_fs_attr_ns = -1; -static int hf_smb_fs_attr_rov = -1; -static int hf_smb_fs_attr_swo = -1; -static int hf_smb_fs_attr_st = -1; -static int hf_smb_fs_attr_shl = -1; -static int hf_smb_fs_attr_sis = -1; -static int hf_smb_fs_attr_sbr = -1; -static int hf_smb_fs_attr_ssv = -1; -static int hf_smb_quota_flags = -1; -static int hf_smb_quota_flags_enabled = -1; -static int hf_smb_quota_flags_deny_disk = -1; -static int hf_smb_quota_flags_log_limit = -1; -static int hf_smb_quota_flags_log_warning = -1; -static int hf_smb_soft_quota_limit = -1; -static int hf_smb_hard_quota_limit = -1; -static int hf_smb_user_quota_used = -1; -static int hf_smb_user_quota_change_time = -1; -static int hf_smb_length_of_sid = -1; -static int hf_smb_user_quota_offset = -1; -static int hf_smb_nt_rename_level = -1; -static int hf_smb_cluster_count = -1; -static int hf_smb_segments = -1; -static int hf_smb_segment = -1; -static int hf_smb_segment_overlap = -1; -static int hf_smb_segment_overlap_conflict = -1; -static int hf_smb_segment_multiple_tails = -1; -static int hf_smb_segment_too_long_fragment = -1; -static int hf_smb_segment_error = -1; -static int hf_smb_segment_count = -1; -static int hf_smb_reassembled_length = -1; -static int hf_smb_pipe_write_len = -1; -static int hf_smb_unix_major_version = -1; -static int hf_smb_unix_minor_version = -1; -static int hf_smb_unix_capability = -1; -static int hf_smb_unix_capability_fcntl = -1; -static int hf_smb_unix_capability_posix_acl = -1; -static int hf_smb_unix_capability_xattr = -1; -static int hf_smb_unix_capability_attr = -1; -static int hf_smb_unix_capability_posix_paths = -1; -static int hf_smb_unix_capability_posix_path_ops = -1; -static int hf_smb_unix_capability_large_read = -1; -static int hf_smb_unix_capability_large_write = -1; -static int hf_smb_unix_capability_encryption = -1; -static int hf_smb_unix_capability_mandatory_crypto = -1; -static int hf_smb_unix_capability_proxy = -1; -static int hf_smb_unix_file_link_dest = -1; -static int hf_smb_unix_file_size = -1; -static int hf_smb_unix_file_num_bytes = -1; -static int hf_smb_unix_file_last_status = -1; -static int hf_smb_unix_file_last_access = -1; -static int hf_smb_unix_file_last_change = -1; -static int hf_smb_unix_file_creation_time = -1; -static int hf_smb_unix_file_uid = -1; -static int hf_smb_unix_file_gid = -1; -static int hf_smb_unix_file_type = -1; -static int hf_smb_unix_file_dev_major = -1; -static int hf_smb_unix_file_dev_minor = -1; -static int hf_smb_unix_file_unique_id = -1; -static int hf_smb_unix_file_permissions = -1; -static int hf_smb_unix_file_nlinks = -1; -static int hf_smb_unix_info2_file_flags = -1; -static int hf_smb_unix_info2_file_flags_mask = -1; -static int hf_smb_unix_info2_file_flags_secure_delete = -1; -static int hf_smb_unix_info2_file_flags_enable_undelete = -1; -static int hf_smb_unix_info2_file_flags_synchronous = -1; -static int hf_smb_unix_info2_file_flags_immutable = -1; -static int hf_smb_unix_info2_file_flags_append_only = -1; -static int hf_smb_unix_info2_file_flags_do_not_backup = -1; -static int hf_smb_unix_info2_file_flags_no_update_atime = -1; -static int hf_smb_unix_info2_file_flags_hidden = -1; -static int hf_smb_unix_file_name_length = -1; -static int hf_smb_unix_file_name = -1; -static int hf_smb_unix_find_file_nextoffset = -1; -static int hf_smb_unix_find_file_resumekey = -1; -static int hf_smb_unix_whoami_mapflags = -1; -static int hf_smb_unix_whoami_mapflags_mask = -1; -static int hf_smb_unix_whoami_num_supl_gids = -1; -static int hf_smb_unix_whoami_num_supl_sids = -1; -static int hf_smb_unix_whoami_sids_buflen = -1; -static int hf_smb_disposition_delete_on_close = -1; -static int hf_smb_pipe_info_flag = -1; -static int hf_smb_mode = -1; -static int hf_smb_attribute = -1; -static int hf_smb_reparse_tag = -1; -static int hf_smb_logged_in = -1; -static int hf_smb_logged_out = -1; -static int hf_smb_file_rw_offset = -1; -static int hf_smb_file_rw_length = -1; -static int hf_smb_posix_acl_version = -1; -static int hf_smb_posix_num_file_aces = -1; -static int hf_smb_posix_num_def_aces = -1; -static int hf_smb_posix_ace_type = -1; -static int hf_smb_posix_ace_flags = -1; -static int hf_smb_posix_ace_perm_read = -1; -static int hf_smb_posix_ace_perm_write = -1; -static int hf_smb_posix_ace_perm_execute = -1; -static int hf_smb_posix_ace_perm_owner_uid = -1; -static int hf_smb_posix_ace_perm_owner_gid = -1; -static int hf_smb_posix_ace_perm_uid = -1; -static int hf_smb_posix_ace_perm_gid = -1; -static int hf_smb_trans_data_setup_word = -1; -static int hf_smb_trans_data_parameters = -1; -static int hf_smb_trans_data = -1; -static int hf_smb_extra_byte_parameters = -1; -static int hf_smb_file_access_mask_full_control = -1; -static int hf_smb_dir_access_mask_full_control = -1; -static int hf_smb_word_unk_response_format = -1; -static int hf_smb_nt_transaction_setup = -1; -static int hf_smb_server_component = -1; -static int hf_smb_byte_parameters = -1; -static int hf_smb_word_parameters = -1; - -static gint ett_smb = -1; -static gint ett_smb_fid = -1; -static gint ett_smb_tid = -1; -static gint ett_smb_uid = -1; -static gint ett_smb_hdr = -1; -static gint ett_smb_command = -1; -static gint ett_smb_fileattributes = -1; -static gint ett_smb_capabilities = -1; -static gint ett_smb_aflags = -1; -static gint ett_smb_dialect = -1; -static gint ett_smb_dialects = -1; -static gint ett_smb_mode = -1; -static gint ett_smb_rawmode = -1; -static gint ett_smb_flags = -1; -static gint ett_smb_flags2 = -1; -static gint ett_smb_desiredaccess = -1; -static gint ett_smb_search = -1; -static gint ett_smb_file = -1; -static gint ett_smb_openfunction = -1; -static gint ett_smb_filetype = -1; -static gint ett_smb_openaction = -1; -static gint ett_smb_writemode = -1; -static gint ett_smb_lock_type = -1; -static gint ett_smb_ssetupandxaction = -1; -static gint ett_smb_optionsup = -1; -static gint ett_smb_time_date = -1; -static gint ett_smb_move_copy_flags = -1; -static gint ett_smb_file_attributes = -1; -static gint ett_smb_search_resume_key = -1; -static gint ett_smb_search_dir_info = -1; -static gint ett_smb_unlocks = -1; -static gint ett_smb_unlock = -1; -static gint ett_smb_locks = -1; -static gint ett_smb_lock = -1; -static gint ett_smb_open_flags = -1; -static gint ett_smb_ipc_state = -1; -static gint ett_smb_open_action = -1; -static gint ett_smb_setup_action = -1; -static gint ett_smb_connect_flags = -1; -static gint ett_smb_connect_support_bits = -1; -static gint ett_smb_nt_access_mask = -1; -static gint ett_smb_nt_create_bits = -1; -static gint ett_smb_nt_create_options = -1; -static gint ett_smb_nt_share_access = -1; -static gint ett_smb_nt_security_flags = -1; -static gint ett_smb_nt_trans_setup = -1; -static gint ett_smb_nt_trans_data = -1; -static gint ett_smb_nt_trans_param = -1; -static gint ett_smb_nt_notify_completion_filter = -1; -static gint ett_smb_nt_ioctl_flags = -1; -static gint ett_smb_security_information_mask = -1; -static gint ett_smb_print_queue_entry = -1; -static gint ett_smb_transaction_flags = -1; -static gint ett_smb_transaction_params = -1; -static gint ett_smb_find_first2_flags = -1; -static gint ett_smb_mac_support_flags = -1; +static int hf_smb_storage_type; +static int hf_smb_resume; +static int hf_smb_max_referral_level; +static int hf_smb_qfsi_information_level; +static int hf_smb_sfsi_information_level; +static int hf_smb_number_of_links; +static int hf_smb_delete_pending; +static int hf_smb_index_number; +static int hf_smb_position; +/* static int hf_smb_current_offset; */ +static int hf_smb_t2_alignment; +static int hf_smb_t2_stream_name_length; +static int hf_smb_t2_stream_size; +static int hf_smb_t2_stream_name; +static int hf_smb_t2_compressed_file_size; +static int hf_smb_t2_compressed_format; +static int hf_smb_t2_compressed_unit_shift; +static int hf_smb_t2_compressed_chunk_shift; +static int hf_smb_t2_compressed_cluster_shift; +static int hf_smb_t2_marked_for_deletion; +static int hf_smb_dfs_path_consumed; +static int hf_smb_dfs_num_referrals; +static int hf_smb_get_dfs_flags; +static int hf_smb_get_dfs_server_hold_storage; +static int hf_smb_get_dfs_fielding; +static int hf_smb_dfs_referral_version; +static int hf_smb_dfs_referral_size; +static int hf_smb_dfs_referral_server_type; +static int hf_smb_dfs_referral_flags; +static int hf_smb_dfs_referral_flags_name_list_referral; +static int hf_smb_dfs_referral_flags_target_set_boundary; +static int hf_smb_dfs_referral_node_offset; +static int hf_smb_dfs_referral_node; +static int hf_smb_dfs_referral_proximity; +static int hf_smb_dfs_referral_ttl; +static int hf_smb_dfs_referral_path_offset; +static int hf_smb_dfs_referral_path; +static int hf_smb_dfs_referral_alt_path_offset; +static int hf_smb_dfs_referral_alt_path; +static int hf_smb_dfs_referral_domain_offset; +static int hf_smb_dfs_referral_number_of_expnames; +static int hf_smb_dfs_referral_expnames_offset; +static int hf_smb_dfs_referral_domain_name; +static int hf_smb_dfs_referral_expname; +static int hf_smb_dfs_referral_server_guid; +static int hf_smb_end_of_search; +static int hf_smb_last_name_offset; +static int hf_smb_fn_information_level; +static int hf_smb_monitor_handle; +static int hf_smb_change_count; +static int hf_smb_file_index; +static int hf_smb_short_file_name; +static int hf_smb_short_file_name_len; +static int hf_smb_fs_id; +static int hf_smb_sector_unit; +static int hf_smb_fs_units; +static int hf_smb_fs_sector; +static int hf_smb_avail_units; +static int hf_smb_volume_serial_num; +static int hf_smb_volume_label_len; +static int hf_smb_volume_label; +static int hf_smb_free_alloc_units64; +static int hf_smb_caller_free_alloc_units64; +static int hf_smb_actual_free_alloc_units64; +static int hf_smb_max_name_len; +static int hf_smb_fs_name_len; +static int hf_smb_fs_name; +static int hf_smb_device_char; +static int hf_smb_device_char_removable; +static int hf_smb_device_char_read_only; +static int hf_smb_device_char_floppy; +static int hf_smb_device_char_write_once; +static int hf_smb_device_char_remote; +static int hf_smb_device_char_mounted; +static int hf_smb_device_char_virtual; +static int hf_smb_device_char_secure_open; +static int hf_smb_device_char_ts; +static int hf_smb_device_char_webdav; +static int hf_smb_device_char_aat; +static int hf_smb_device_char_portable; +static int hf_smb_fs_attr; +static int hf_smb_fs_attr_css; +static int hf_smb_fs_attr_cpn; +static int hf_smb_fs_attr_uod; +static int hf_smb_fs_attr_pacls; +static int hf_smb_fs_attr_fc; +static int hf_smb_fs_attr_vq; +static int hf_smb_fs_attr_ssf; +static int hf_smb_fs_attr_srp; +static int hf_smb_fs_attr_srs; +static int hf_smb_fs_attr_sla; +static int hf_smb_fs_attr_vic; +static int hf_smb_fs_attr_soids; +static int hf_smb_fs_attr_se; +static int hf_smb_fs_attr_ns; +static int hf_smb_fs_attr_rov; +static int hf_smb_fs_attr_swo; +static int hf_smb_fs_attr_st; +static int hf_smb_fs_attr_shl; +static int hf_smb_fs_attr_sis; +static int hf_smb_fs_attr_sbr; +static int hf_smb_fs_attr_ssv; +static int hf_smb_quota_flags; +static int hf_smb_quota_flags_enabled; +static int hf_smb_quota_flags_deny_disk; +static int hf_smb_quota_flags_log_limit; +static int hf_smb_quota_flags_log_warning; +static int hf_smb_soft_quota_limit; +static int hf_smb_hard_quota_limit; +static int hf_smb_user_quota_used; +static int hf_smb_user_quota_change_time; +static int hf_smb_length_of_sid; +static int hf_smb_user_quota_offset; +static int hf_smb_nt_rename_level; +static int hf_smb_cluster_count; +static int hf_smb_segments; +static int hf_smb_segment; +static int hf_smb_segment_overlap; +static int hf_smb_segment_overlap_conflict; +static int hf_smb_segment_multiple_tails; +static int hf_smb_segment_too_long_fragment; +static int hf_smb_segment_error; +static int hf_smb_segment_count; +static int hf_smb_reassembled_length; +static int hf_smb_pipe_write_len; +static int hf_smb_unix_major_version; +static int hf_smb_unix_minor_version; +static int hf_smb_unix_capability; +static int hf_smb_unix_capability_fcntl; +static int hf_smb_unix_capability_posix_acl; +static int hf_smb_unix_capability_xattr; +static int hf_smb_unix_capability_attr; +static int hf_smb_unix_capability_posix_paths; +static int hf_smb_unix_capability_posix_path_ops; +static int hf_smb_unix_capability_large_read; +static int hf_smb_unix_capability_large_write; +static int hf_smb_unix_capability_encryption; +static int hf_smb_unix_capability_mandatory_crypto; +static int hf_smb_unix_capability_proxy; +static int hf_smb_unix_file_link_dest; +static int hf_smb_unix_file_size; +static int hf_smb_unix_file_num_bytes; +static int hf_smb_unix_file_last_status; +static int hf_smb_unix_file_last_access; +static int hf_smb_unix_file_last_change; +static int hf_smb_unix_file_creation_time; +static int hf_smb_unix_file_uid; +static int hf_smb_unix_file_gid; +static int hf_smb_unix_file_type; +static int hf_smb_unix_file_dev_major; +static int hf_smb_unix_file_dev_minor; +static int hf_smb_unix_file_unique_id; +static int hf_smb_unix_file_permissions; +static int hf_smb_unix_file_nlinks; +static int hf_smb_unix_info2_file_flags; +static int hf_smb_unix_info2_file_flags_mask; +static int hf_smb_unix_info2_file_flags_secure_delete; +static int hf_smb_unix_info2_file_flags_enable_undelete; +static int hf_smb_unix_info2_file_flags_synchronous; +static int hf_smb_unix_info2_file_flags_immutable; +static int hf_smb_unix_info2_file_flags_append_only; +static int hf_smb_unix_info2_file_flags_do_not_backup; +static int hf_smb_unix_info2_file_flags_no_update_atime; +static int hf_smb_unix_info2_file_flags_hidden; +static int hf_smb_unix_file_name_length; +static int hf_smb_unix_file_name; +static int hf_smb_unix_find_file_nextoffset; +static int hf_smb_unix_find_file_resumekey; +static int hf_smb_unix_whoami_mapflags; +static int hf_smb_unix_whoami_mapflags_mask; +static int hf_smb_unix_whoami_num_supl_gids; +static int hf_smb_unix_whoami_num_supl_sids; +static int hf_smb_unix_whoami_sids_buflen; +static int hf_smb_disposition_delete_on_close; +static int hf_smb_pipe_info_flag; +static int hf_smb_mode; +static int hf_smb_attribute; +static int hf_smb_reparse_tag; +static int hf_smb_logged_in; +static int hf_smb_logged_out; +static int hf_smb_file_rw_offset; +static int hf_smb_file_rw_length; +static int hf_smb_posix_acl_version; +static int hf_smb_posix_num_file_aces; +static int hf_smb_posix_num_def_aces; +static int hf_smb_posix_ace_type; +static int hf_smb_posix_ace_flags; +static int hf_smb_posix_ace_perm_read; +static int hf_smb_posix_ace_perm_write; +static int hf_smb_posix_ace_perm_execute; +static int hf_smb_posix_ace_perm_owner_uid; +static int hf_smb_posix_ace_perm_owner_gid; +static int hf_smb_posix_ace_perm_uid; +static int hf_smb_posix_ace_perm_gid; +static int hf_smb_trans_data_setup_word; +static int hf_smb_trans_data_parameters; +static int hf_smb_trans_data; +static int hf_smb_extra_byte_parameters; +static int hf_smb_file_access_mask_full_control; +static int hf_smb_dir_access_mask_full_control; +static int hf_smb_word_unk_response_format; +static int hf_smb_nt_transaction_setup; +static int hf_smb_server_component; +static int hf_smb_byte_parameters; +static int hf_smb_word_parameters; + +static int ett_smb; +static int ett_smb_fid; +static int ett_smb_tid; +static int ett_smb_uid; +static int ett_smb_hdr; +static int ett_smb_command; +static int ett_smb_fileattributes; +static int ett_smb_capabilities; +static int ett_smb_aflags; +static int ett_smb_dialect; +static int ett_smb_dialects; +static int ett_smb_mode; +static int ett_smb_rawmode; +static int ett_smb_flags; +static int ett_smb_flags2; +static int ett_smb_desiredaccess; +static int ett_smb_search; +static int ett_smb_file; +static int ett_smb_openfunction; +static int ett_smb_filetype; +static int ett_smb_openaction; +static int ett_smb_writemode; +static int ett_smb_lock_type; +static int ett_smb_ssetupandxaction; +static int ett_smb_optionsup; +static int ett_smb_time_date; +static int ett_smb_move_copy_flags; +static int ett_smb_file_attributes; +static int ett_smb_search_resume_key; +static int ett_smb_search_dir_info; +static int ett_smb_unlocks; +static int ett_smb_unlock; +static int ett_smb_locks; +static int ett_smb_lock; +static int ett_smb_open_flags; +static int ett_smb_ipc_state; +static int ett_smb_open_action; +static int ett_smb_setup_action; +static int ett_smb_connect_flags; +static int ett_smb_connect_support_bits; +static int ett_smb_nt_access_mask; +static int ett_smb_nt_create_bits; +static int ett_smb_nt_create_options; +static int ett_smb_nt_share_access; +static int ett_smb_nt_security_flags; +static int ett_smb_nt_trans_setup; +static int ett_smb_nt_trans_data; +static int ett_smb_nt_trans_param; +static int ett_smb_nt_notify_completion_filter; +static int ett_smb_nt_ioctl_flags; +static int ett_smb_security_information_mask; +static int ett_smb_print_queue_entry; +static int ett_smb_transaction_flags; +static int ett_smb_transaction_params; +static int ett_smb_find_first2_flags; +static int ett_smb_mac_support_flags; #if 0 -static gint ett_smb_ioflag = -1; +static int ett_smb_ioflag; #endif -static gint ett_smb_transaction_data = -1; -static gint ett_smb_stream_info = -1; -static gint ett_smb_dfs_referrals = -1; -static gint ett_smb_dfs_referral = -1; -static gint ett_smb_dfs_referral_flags = -1; -static gint ett_smb_dfs_referral_expnames = -1; -static gint ett_smb_get_dfs_flags = -1; -static gint ett_smb_ff2_data = -1; -static gint ett_smb_device_characteristics = -1; -static gint ett_smb_fs_attributes = -1; -static gint ett_smb_segments = -1; -static gint ett_smb_segment = -1; -static gint ett_smb_quotaflags = -1; -static gint ett_smb_secblob = -1; -static gint ett_smb_unicode_password = -1; -static gint ett_smb_ea = -1; -static gint ett_smb_unix_capabilities = -1; -static gint ett_smb_unix_whoami_gids = -1; -static gint ett_smb_unix_whoami_sids = -1; -static gint ett_smb_posix_ace = -1; -static gint ett_smb_posix_ace_perms = -1; -static gint ett_smb_info2_file_flags = -1; - -static expert_field ei_smb_missing_word_parameters = EI_INIT; -static expert_field ei_smb_mal_information_level = EI_INIT; -static expert_field ei_smb_not_implemented = EI_INIT; -static expert_field ei_smb_nt_transaction_setup = EI_INIT; -static expert_field ei_smb_posix_ace_type = EI_INIT; -static expert_field ei_smb_info_level_unknown = EI_INIT; -static expert_field ei_smb_info_level_not_understood = EI_INIT; - -static int smb_tap = -1; -static int smb_eo_tap = -1; +static int ett_smb_transaction_data; +static int ett_smb_stream_info; +static int ett_smb_dfs_referrals; +static int ett_smb_dfs_referral; +static int ett_smb_dfs_referral_flags; +static int ett_smb_dfs_referral_expnames; +static int ett_smb_get_dfs_flags; +static int ett_smb_ff2_data; +static int ett_smb_device_characteristics; +static int ett_smb_fs_attributes; +static int ett_smb_segments; +static int ett_smb_segment; +static int ett_smb_quotaflags; +static int ett_smb_secblob; +static int ett_smb_unicode_password; +static int ett_smb_ea; +static int ett_smb_unix_capabilities; +static int ett_smb_unix_whoami_gids; +static int ett_smb_unix_whoami_sids; +static int ett_smb_posix_ace; +static int ett_smb_posix_ace_perms; +static int ett_smb_info2_file_flags; + +static expert_field ei_smb_missing_word_parameters; +static expert_field ei_smb_mal_information_level; +static expert_field ei_smb_not_implemented; +static expert_field ei_smb_nt_transaction_setup; +static expert_field ei_smb_posix_ace_type; +static expert_field ei_smb_info_level_unknown; +static expert_field ei_smb_info_level_not_understood; + +static int smb_tap; +static int smb_eo_tap; static dissector_handle_t smb_handle; static dissector_handle_t gssapi_handle; @@ -897,9 +900,9 @@ static const fragment_items smb_frag_items = { "segments" }; -static proto_tree *top_tree_global = NULL; /* ugly */ +static proto_tree *top_tree_global; /* ugly */ -static int dissect_smb_command(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *smb_tree, guint8 cmd, gboolean first_pdu, smb_info_t *si); +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); #define SMB_NUM_PROCEDURES 256 #define SMB_SRT_TABLE_INDEX 0 @@ -912,7 +915,7 @@ smbstat_init(struct register_srt* srt _U_, GArray* srt_array) srt_stat_table *smb_srt_table; srt_stat_table *trans2_srt_table; srt_stat_table *nt_srt_table; - guint32 i; + uint32_t i; smb_srt_table = init_srt_table("SMB Commands", NULL, srt_array, SMB_NUM_PROCEDURES, "Commands", "smb.cmd", NULL); trans2_srt_table = init_srt_table("Transaction2 Sub-Commands", NULL, srt_array, SMB_NUM_PROCEDURES, "Transaction2 Commands", "smb.trans2.cmd", NULL); @@ -928,7 +931,7 @@ smbstat_init(struct register_srt* srt _U_, GArray* srt_array) static tap_packet_status smbstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *prv, tap_flags_t flags _U_) { - guint i = 0; + unsigned i = 0; srt_stat_table *smb_srt_table; srt_data_t *data = (srt_data_t *)pss; const smb_info_t *si = (const smb_info_t *)prv; @@ -937,7 +940,7 @@ smbstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const voi if (si->request) { return TAP_PACKET_DONT_REDRAW; } - /* if we havnt seen the request, just ignore it */ + /* if we haven't seen the request, just ignore it */ if (!si->sip) { return TAP_PACKET_DONT_REDRAW; } @@ -1012,23 +1015,23 @@ static const value_string smb2_fid_types[] = { the row# in this GSList will match the row# in the entry list */ typedef struct _active_file { - guint16 tid, uid; - guint32 fid; /* 16-bit fid (smb) or 32-bit compressed fid (smb2) */ - guint64 file_length; /* The last free reported offset. We treat it as the file length */ - guint64 data_gathered; /* The actual total of data gathered */ - guint8 flag_contains; /* What kind of data it contains */ + uint16_t tid, uid; + uint32_t fid; /* 16-bit fid (smb) or 32-bit compressed fid (smb2) */ + uint64_t file_length; /* The last free reported offset. We treat it as the file length */ + uint64_t data_gathered; /* The actual total of data gathered */ + uint8_t flag_contains; /* What kind of data it contains */ GSList *free_chunk_list; /* A list of virtual "holes" in the file stream stored in memory */ - gboolean is_out_of_memory; /* TRUE if we cannot allocate memory for this file */ + bool is_out_of_memory; /* true if we cannot allocate memory for this file */ } active_file ; /* This is the GSList that will contain all the files that we are tracking */ -static GSList *GSL_active_files = NULL; +static GSList *GSL_active_files; /* We define a free chunk in a file as an start offset and end offset Consider a free chunk as a "hole" in a file that we are capturing */ typedef struct _free_chunk { - guint64 start_offset; - guint64 end_offset; + uint64_t start_offset; + uint64_t end_offset; } free_chunk; /* insert_chunk function will recalculate the free_chunk_list, the data_size, @@ -1044,16 +1047,16 @@ typedef struct _free_chunk { static void insert_chunk(active_file *file, export_object_entry_t *entry, const smb_eo_t *eo_info) { - gint nfreechunks = g_slist_length(file->free_chunk_list); - gint i; + int nfreechunks = g_slist_length(file->free_chunk_list); + int i; free_chunk *current_free_chunk; free_chunk *new_free_chunk; - guint64 chunk_offset = eo_info->smb_file_offset; - guint64 chunk_length = eo_info->payload_len; - guint64 chunk_end_offset = chunk_offset + chunk_length-1; + uint64_t chunk_offset = eo_info->smb_file_offset; + uint64_t chunk_length = eo_info->payload_len; + uint64_t chunk_end_offset = chunk_offset + chunk_length-1; /* Size of file in memory */ - guint64 calculated_size = chunk_offset + chunk_length; - gpointer dest_memory_addr; + uint64_t calculated_size = chunk_offset + chunk_length; + void * dest_memory_addr; /* Let's recalculate the file length and data gathered */ if ((file->data_gathered == 0) && (nfreechunks == 0)) { @@ -1134,29 +1137,29 @@ insert_chunk(active_file *file, export_object_entry_t *entry, const smb_eo_t * ...first, we shall be able to allocate the memory */ if (!entry->payload_data) { /* This is a New file */ - if (calculated_size > G_MAXUINT32) { + if (calculated_size > UINT32_MAX) { /* * The argument to g_try_malloc() is - * a gsize, however the maximum size of a file + * a size_t, however the maximum size of a file * is 32-bit. If the calculated size is * bigger than that, we just say the attempt * to allocate memory failed. */ entry->payload_data = NULL; } else { - entry->payload_data = (guint8 *)g_try_malloc((gsize)calculated_size); + entry->payload_data = (uint8_t *)g_try_malloc((size_t)calculated_size); entry->payload_len = (size_t)calculated_size; } if (!entry->payload_data) { /* Memory error */ - file->is_out_of_memory = TRUE; + file->is_out_of_memory = true; } } else { /* This is an existing file in memory */ - if (calculated_size > (guint64) entry->payload_len && + if (calculated_size > (uint64_t) entry->payload_len && !file->is_out_of_memory) { /* We need more memory */ - if (calculated_size > G_MAXUINT32) { + if (calculated_size > UINT32_MAX) { /* * As for g_try_malloc(), so for * g_try_realloc(). @@ -1165,18 +1168,18 @@ insert_chunk(active_file *file, export_object_entry_t *entry, const smb_eo_t * } else { dest_memory_addr = g_try_realloc( entry->payload_data, - (gsize)calculated_size); + (size_t)calculated_size); } if (!dest_memory_addr) { /* Memory error */ - file->is_out_of_memory = TRUE; + file->is_out_of_memory = true; /* We don't have memory for this file. Free the current file content from memory */ g_free(entry->payload_data); entry->payload_data = NULL; entry->payload_len = 0; } else { - entry->payload_data = (guint8 *)dest_memory_addr; + entry->payload_data = (uint8_t *)dest_memory_addr; entry->payload_len = (size_t)calculated_size; } } @@ -1227,14 +1230,14 @@ smb_eo_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const export_object_entry_t *entry; export_object_entry_t *current_entry; active_file incoming_file; - gint active_row; + int active_row; active_file *new_file; active_file *current_file; - guint8 contains; - gboolean is_supported_filetype; - gfloat percent; + uint8_t contains; + bool is_supported_filetype; + float percent; - const gchar *aux_smb_fid_type_string; + const char *aux_smb_fid_type_string; if (eo_info->smbversion==1) { /* Is this an eo_smb supported file_type? (right now we only support FILE) */ @@ -1294,7 +1297,7 @@ smb_eo_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const new_file->flag_contains = contains; new_file->free_chunk_list = NULL; new_file->data_gathered = 0; - new_file->is_out_of_memory = FALSE; + new_file->is_out_of_memory = false; entry->pkt_num = pinfo->num; entry->hostname=g_filename_display_name(eo_info->hostname); @@ -1314,7 +1317,7 @@ smb_eo_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const try_val_to_str(contains, smb_eo_contains_string)); } else { if (new_file->file_length > 0) { - percent = (gfloat) (100*new_file->data_gathered/new_file->file_length); + percent = (float) (100*new_file->data_gathered/new_file->file_length); } else { percent = 0.0f; } @@ -1348,7 +1351,7 @@ smb_eo_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const current_file->file_length, try_val_to_str(current_file->flag_contains, smb_eo_contains_string)); } else { - percent = (gfloat) (100*current_file->data_gathered/current_file->file_length); + percent = (float) (100*current_file->data_gathered/current_file->file_length); current_entry->content_type = ws_strdup_printf("%s (%"PRIu64"/%"PRIu64") %s [%5.2f%%]", aux_smb_fid_type_string, @@ -1394,7 +1397,7 @@ smb_eo_cleanup(void) #define WORD_COUNT \ /* Word Count */ \ - wc = tvb_get_guint8(tvb, offset); \ + wc = tvb_get_uint8(tvb, offset); \ proto_tree_add_uint(tree, hf_smb_word_count, \ tvb, offset, 1, wc); \ offset += 1; \ @@ -1420,9 +1423,9 @@ smb_eo_cleanup(void) #define END_OF_SMB \ if (bc != 0) { \ - gint bc_remaining; \ + int bc_remaining; \ bc_remaining = tvb_reported_length_remaining(tvb, offset); \ - if ( ((gint)bc) > bc_remaining) { \ + if ( ((int)bc) > bc_remaining) { \ bc = bc_remaining; \ } \ if (bc) { \ @@ -1437,13 +1440,13 @@ smb_eo_cleanup(void) */ #define CHECK_BYTE_COUNT_SUBR(len) \ if (*bcp < len) { \ - *trunc = TRUE; \ + *trunc = true; \ return offset; \ } #define CHECK_STRING_SUBR(fn) \ if (fn == NULL) { \ - *trunc = TRUE; \ + *trunc = true; \ return offset; \ } @@ -1477,14 +1480,14 @@ smb_eo_cleanup(void) offset += len; \ *bcp -= len; -gboolean sid_display_hex = FALSE; -gboolean sid_name_snooping = FALSE; +bool sid_display_hex; +bool sid_name_snooping; /* ExportObject preferences variable */ -gboolean eosmb_take_name_as_fid = FALSE ; -/* Utility to get an str reprensenting ipv4 or ipv6 address */ -const gchar *tree_ip_str(packet_info *pinfo, guint16 cmd) { - const gchar *buf; +bool eosmb_take_name_as_fid = false ; +/* Utility to get an str representing ipv4 or ipv6 address */ +const char *tree_ip_str(packet_info *pinfo, uint16_t cmd) { + const char *buf; if ( cmd == SMB_COM_READ_ANDX || cmd == SMB_COM_READ || @@ -1500,8 +1503,8 @@ const gchar *tree_ip_str(packet_info *pinfo, guint16 cmd) { /* ExportObject feed function*/ static void -feed_eo_smb(guint16 cmd, guint16 fid, tvbuff_t * tvb, packet_info *pinfo, guint16 dataoffset, guint32 datalen, guint32 chunk_len, - guint64 file_offset, smb_info_t *si) { +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, + uint64_t file_offset, smb_info_t *si) { smb_eo_t *eo_info; /* eo_info variable to pass info. to export object and aux */ @@ -1545,7 +1548,7 @@ feed_eo_smb(guint16 cmd, guint16 fid, tvbuff_t * tvb, packet_info *pinfo, guint1 eo_info->filename = NULL; if (fid_info->fsi) if (fid_info->fsi->filename) - eo_info->filename = (gchar *) fid_info->fsi->filename; + eo_info->filename = (char *) fid_info->fsi->filename; if (!eo_info->filename) eo_info->filename = wmem_strdup_printf(wmem_packet_scope(), "\\FILEID_%i", fid); eo_info->fid_type = fid_info->type; eo_info->end_of_file = fid_info->end_of_file; @@ -1573,7 +1576,7 @@ feed_eo_smb(guint16 cmd, guint16 fid, tvbuff_t * tvb, packet_info *pinfo, guint1 /* Compare function to maintain the GSL_fid_info ordered Order criteria: packet where the fid was opened */ -static gint +static int fid_cmp(smb_fid_info_t *fida, smb_fid_info_t *fidb) { return (fida->opened_in - fidb->opened_in); @@ -1582,14 +1585,14 @@ fid_cmp(smb_fid_info_t *fida, smb_fid_info_t *fidb) /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX These are needed by the reassembly of SMB Transaction payload and DCERPC over SMB XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ -static gboolean smb_trans_reassembly = TRUE; -gboolean smb_dcerpc_reassembly = TRUE; +static bool smb_trans_reassembly = true; +bool smb_dcerpc_reassembly = true; static reassembly_table smb_trans_reassembly_table; static fragment_head * smb_trans_defragment(proto_tree *tree _U_, packet_info *pinfo, tvbuff_t *tvb, - int offset, guint count, guint pos, guint totlen, smb_info_t *si) + int offset, unsigned count, unsigned pos, unsigned totlen, smb_info_t *si) { fragment_head *fd_head = NULL; int more_frags; @@ -1659,8 +1662,8 @@ smb_trans_defragment(proto_tree *tree _U_, packet_info *pinfo, tvbuff_t *tvb, * frame number of the request in the dissection of the reply. */ typedef struct { - guint32 frame; - guint32 pid_mid; + uint32_t frame; + uint32_t pid_mid; } smb_saved_info_key_t; /* unmatched smb_saved_info structures. @@ -1671,17 +1674,17 @@ typedef struct { Ugly, yes. Not portable to DEC-20 Yes. But it saves a few bytes. The key is the PID in the upper 16 bits and the MID in the lower 16 bits. */ -static gint -smb_saved_info_equal_unmatched(gconstpointer k1, gconstpointer k2) +static int +smb_saved_info_equal_unmatched(const void *k1, const void *k2) { - register guint32 key1 = GPOINTER_TO_UINT(k1); - register guint32 key2 = GPOINTER_TO_UINT(k2); + register uint32_t key1 = GPOINTER_TO_UINT(k1); + register uint32_t key2 = GPOINTER_TO_UINT(k2); return key1 == key2; } -static guint -smb_saved_info_hash_unmatched(gconstpointer k) +static unsigned +smb_saved_info_hash_unmatched(const void *k) { - register guint32 key = GPOINTER_TO_UINT(k); + register uint32_t key = GPOINTER_TO_UINT(k); return key; } @@ -1698,43 +1701,43 @@ smb_saved_info_hash_unmatched(gconstpointer k) in a single frame, and we also need the PID as there may be more than one outstanding request with the same MID and different PIDs. */ -static gint -smb_saved_info_equal_matched(gconstpointer k1, gconstpointer k2) +static int +smb_saved_info_equal_matched(const void *k1, const void *k2) { const smb_saved_info_key_t *key1 = (const smb_saved_info_key_t *)k1; const smb_saved_info_key_t *key2 = (const smb_saved_info_key_t *)k2; return (key1->frame == key2->frame) && (key1->pid_mid == key2->pid_mid); } -static guint -smb_saved_info_hash_matched(gconstpointer k) +static unsigned +smb_saved_info_hash_matched(const void *k) { const smb_saved_info_key_t *key = (const smb_saved_info_key_t *)k; return key->frame + key->pid_mid; } -static GSList *conv_tables = NULL; +static GSList *conv_tables; -static gint -smb_find_unicode_null_offset(tvbuff_t *tvb, gint offset, const gint maxlength, const guint16 needle, const guint encoding) +static int +smb_find_unicode_null_offset(tvbuff_t *tvb, int offset, const int maxlength, const uint16_t needle, const unsigned encoding) { - guint captured_length = tvb_captured_length(tvb); - if (G_LIKELY((guint) offset > captured_length)) { + unsigned captured_length = tvb_captured_length(tvb); + if (G_LIKELY((unsigned) offset > captured_length)) { return -1; } - guint limit = captured_length - offset; + unsigned limit = captured_length - offset; /* Only search to end of tvbuff, w/o throwing exception. */ - if (maxlength >= 0 && limit > (guint) maxlength) { + if (maxlength >= 0 && limit > (unsigned) maxlength) { /* Maximum length doesn't go past end of tvbuff; search to that value. */ - limit = (guint) maxlength; + limit = (unsigned) maxlength; } limit = limit & ~1; while(limit){ - if (needle == tvb_get_guint16(tvb, offset, encoding)){ + if (needle == tvb_get_uint16(tvb, offset, encoding)){ return offset; } offset += 2; @@ -1749,15 +1752,15 @@ smb_find_unicode_null_offset(tvbuff_t *tvb, gint offset, const gint maxlength, c /* Turn a little-endian Unicode '\0'-terminated string into a string we can display. - If exactlen==TRUE then us_lenp contains the exact len of the string in + If exactlen==true then us_lenp contains the exact len of the string in bytes. It might not be null terminated ! bc specifies the number of bytes in the byte parameters; Windows 2000, at least, appears, in some cases, to put only 1 byte of 0 at the end of a Unicode string if the byte count */ -static gchar * -unicode_to_str(tvbuff_t *tvb, int offset, int *us_lenp, gboolean exactlen, - guint16 bc) +static char * +unicode_to_str(tvbuff_t *tvb, int offset, int *us_lenp, bool exactlen, + uint16_t bc) { int len; if (exactlen) { @@ -1769,7 +1772,7 @@ unicode_to_str(tvbuff_t *tvb, int offset, int *us_lenp, gboolean exactlen, */ len = smb_find_unicode_null_offset(tvb, offset, bc, 0, ENC_LITTLE_ENDIAN); if (len == -1) { - if (bc % 2 == 1 && tvb_get_guint8(tvb, offset + bc - 1) == 0) { + if (bc % 2 == 1 && tvb_get_uint8(tvb, offset + bc - 1) == 0) { *us_lenp = bc; return tvb_get_string_enc(wmem_packet_scope(), tvb, offset, bc - 1, ENC_UTF_16|ENC_LITTLE_ENDIAN); } @@ -1778,17 +1781,17 @@ unicode_to_str(tvbuff_t *tvb, int offset, int *us_lenp, gboolean exactlen, } } -/* nopad == TRUE : Do not add any padding before this string - * exactlen == TRUE : len contains the exact len of the string in bytes. +/* nopad == true : Do not add any padding before this string + * exactlen == true : len contains the exact len of the string in bytes. * bc: pointer to variable with amount of data left in the byte parameters * region */ -static const gchar * +static const char * get_unicode_or_ascii_string(tvbuff_t *tvb, int *offsetp, - gboolean useunicode, int *len, gboolean nopad, gboolean exactlen, - guint16 *bcp) + bool useunicode, int *len, bool nopad, bool exactlen, + uint16_t *bcp) { - const gchar *string; + const char *string; int string_len = 0; int copylen; @@ -1859,7 +1862,7 @@ typedef struct _smb_uid_t { } smb_uid_t; static void -smb_file_specific_rights(tvbuff_t *tvb, gint offset, proto_tree *tree, guint32 mask) +smb_file_specific_rights(tvbuff_t *tvb, int offset, proto_tree *tree, uint32_t mask) { static int * const mask_flags[] = { &hf_smb_file_access_mask_write_attribute, @@ -1889,7 +1892,7 @@ static struct access_mask_info smb_file_access_mask_info = { static void -smb_dir_specific_rights(tvbuff_t *tvb, gint offset, proto_tree *tree, guint32 mask) +smb_dir_specific_rights(tvbuff_t *tvb, int offset, proto_tree *tree, uint32_t mask) { static int * const mask_flags[] = { &hf_smb_dir_access_mask_write_attribute, @@ -2125,7 +2128,7 @@ LocTimeDiff(time_t lt) static int dissect_smb_UTIME(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_date) { - guint32 timeval; + uint32_t timeval; nstime_t ts; ts.secs = timeval = tvb_get_letohl(tvb, offset); @@ -2150,9 +2153,9 @@ dissect_smb_UTIME(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_date) static int dissect_smb_datetime(tvbuff_t *tvb, proto_tree *parent_tree, int offset, - int hf_date, int hf_dos_date, int hf_dos_time, gboolean time_first) + int hf_date, int hf_dos_date, int hf_dos_time, bool time_first) { - guint16 dos_time, dos_date; + uint16_t dos_time, dos_date; proto_item *item = NULL; proto_tree *tree = NULL; struct tm tm; @@ -2418,7 +2421,7 @@ dissect_file_attributes(tvbuff_t *tvb, proto_tree *parent_tree, int offset) */ static int dissect_file_ext_attr_bits(tvbuff_t *tvb, proto_tree *parent_tree, int offset, - int len, guint32 mask) + int len, uint32_t mask) { proto_item *item; /* @@ -2463,7 +2466,7 @@ dissect_file_ext_attr_bits(tvbuff_t *tvb, proto_tree *parent_tree, int offset, static int dissect_file_ext_attr(tvbuff_t *tvb, proto_tree *parent_tree, int offset) { - guint32 mask; + uint32_t mask; mask = tvb_get_letohl(tvb, offset); @@ -2675,7 +2678,7 @@ static const true_false_string tfs_server_cap_extended_security = { static int dissect_negprot_capabilities(tvbuff_t *tvb, proto_tree *parent_tree, int offset) { - guint32 mask; + uint32_t mask; static int * const flags[] = { &hf_smb_server_cap_raw_mode, @@ -2796,8 +2799,8 @@ dissect_negprot_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int { proto_tree *tr = NULL; proto_item *ti; - guint16 bc; - guint8 wc; + uint16_t bc; + uint8_t wc; struct negprot_dialects *dialects = NULL; DISSECTOR_ASSERT(si); @@ -2817,7 +2820,7 @@ dissect_negprot_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int while (bc) { int len; - const guint8 *str; + const uint8_t *str; proto_item *dit = NULL; proto_tree *dtr = NULL; @@ -2864,14 +2867,14 @@ dissect_negprot_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int static int dissect_negprot_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 dialect; + uint8_t wc; + uint16_t dialect; const char *dn; int dn_len; - guint16 bc; - guint16 chl = 0; - guint32 caps = 0; - gint16 tz; + uint16_t bc; + uint16_t chl = 0; + uint32_t caps = 0; + int16_t tz; const char *dialect_name = NULL; struct negprot_dialects *dialects = NULL; @@ -2970,7 +2973,7 @@ dissect_negprot_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in /* current time and date at server */ offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_server_date_time, hf_smb_server_smb_date, hf_smb_server_smb_time, - TRUE); + true); /* time zone */ tz = tvb_get_letohs(tvb, offset); @@ -3031,8 +3034,9 @@ dissect_negprot_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in offset += 4; /* system time */ - offset = dissect_nt_64bit_time(tvb, tree, offset, - hf_smb_system_time); + dissect_nttime(tvb, tree, offset, + hf_smb_system_time, ENC_LITTLE_ENDIAN); + offset += 8; /* time zone */ tz = tvb_get_letohs(tvb, offset); @@ -3042,7 +3046,7 @@ dissect_negprot_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in offset += 2; /* challenge length */ - chl = tvb_get_guint8(tvb, offset); + chl = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_smb_challenge_length, tvb, offset, 1, chl); offset += 1; @@ -3081,7 +3085,7 @@ dissect_negprot_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in * such as that? */ dn = get_unicode_or_ascii_string(tvb, &offset, - si->unicode, &dn_len, FALSE, FALSE, &bc); + si->unicode, &dn_len, false, false, &bc); if (dn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_primary_domain, tvb, @@ -3165,7 +3169,7 @@ dissect_negprot_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in COUNT_BYTES(1); } dn = get_unicode_or_ascii_string(tvb, - &offset, si->unicode, &dn_len, TRUE, FALSE, + &offset, si->unicode, &dn_len, true, false, &bc); if (dn == NULL) goto endofcommand; @@ -3175,7 +3179,7 @@ dissect_negprot_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in /* server name, seen in w2k pro capture */ dn = get_unicode_or_ascii_string(tvb, - &offset, si->unicode, &dn_len, TRUE, FALSE, + &offset, si->unicode, &dn_len, true, false, &bc); if (dn == NULL) goto endofcommand; @@ -3185,7 +3189,7 @@ dissect_negprot_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in } else { proto_item *blob_item; - guint16 sbloblen; + uint16_t sbloblen; /* guid */ /* XXX - show it in the standard Microsoft format @@ -3269,8 +3273,8 @@ dissect_old_dir_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int { int dn_len; const char *dn; - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; DISSECTOR_ASSERT(si); @@ -3285,7 +3289,7 @@ dissect_old_dir_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int /* dir name */ dn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &dn_len, - FALSE, FALSE, &bc); + false, false, &bc); if ((!pinfo->fd->visited) && si->sip) { si->sip->extra_info_type = SMB_EI_FILENAME; @@ -3299,7 +3303,7 @@ dissect_old_dir_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int COUNT_BYTES(dn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Directory: %s", - format_text(wmem_packet_scope(), (const guchar *)dn, strlen(dn))); + format_text(wmem_packet_scope(), (const unsigned char *)dn, strlen(dn))); END_OF_SMB @@ -3309,8 +3313,8 @@ dissect_old_dir_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int static int dissect_empty(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; proto_item *item = NULL; DISSECTOR_ASSERT(si); @@ -3333,8 +3337,8 @@ dissect_empty(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offse static int 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) { - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; proto_item *item = NULL; DISSECTOR_ASSERT(si); @@ -3361,8 +3365,8 @@ dissect_rename_file_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * static int 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_) { - guint16 ec, bc; - guint8 wc; + uint16_t ec, bc; + uint8_t wc; WORD_COUNT; @@ -3387,8 +3391,8 @@ dissect_echo_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, in static int 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_) { - guint16 bc; - guint8 wc; + uint16_t bc; + uint8_t wc; WORD_COUNT; @@ -3414,8 +3418,8 @@ dissect_tree_connect_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree { int an_len, pwlen; const char *an; - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; DISSECTOR_ASSERT(si); @@ -3430,7 +3434,7 @@ dissect_tree_connect_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* Path */ an = get_unicode_or_ascii_string(tvb, &offset, - si->unicode, &an_len, FALSE, FALSE, &bc); + si->unicode, &an_len, false, false, &bc); if (an == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_path, tvb, @@ -3438,7 +3442,7 @@ dissect_tree_connect_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree COUNT_BYTES(an_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(wmem_packet_scope(), (const guchar*)an, strlen(an))); + format_text(wmem_packet_scope(), (const unsigned char*)an, strlen(an))); /* buffer format */ CHECK_BYTE_COUNT(1); @@ -3465,7 +3469,7 @@ dissect_tree_connect_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree * Tree_Connect_AndX SMB". Is that claim false? */ an = get_unicode_or_ascii_string(tvb, &offset, - si->unicode, &an_len, FALSE, FALSE, &bc); + si->unicode, &an_len, false, false, &bc); if (an == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_service, tvb, @@ -3518,7 +3522,7 @@ dissect_smb_uid(tvbuff_t *tvb, proto_tree *parent_tree, int offset, smb_info_t * } static int -dissect_smb_tid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, guint16 tid, gboolean is_created, gboolean is_closed, smb_info_t *si) +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) { proto_item *it; proto_tree *tr; @@ -3578,8 +3582,8 @@ dissect_smb_tid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, static int dissect_tree_connect_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; WORD_COUNT; @@ -3588,7 +3592,7 @@ dissect_tree_connect_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre offset += 2; /* tid */ - offset = dissect_smb_tid(tvb, pinfo, tree, offset, tvb_get_letohs(tvb, offset), TRUE, FALSE, si); + offset = dissect_smb_tid(tvb, pinfo, tree, offset, tvb_get_letohs(tvb, offset), true, false, si); BYTE_COUNT; @@ -3688,9 +3692,9 @@ static int dissect_move_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { int fn_len; - guint16 tid; - guint16 bc; - guint8 wc; + uint16_t tid; + uint16_t bc; + uint8_t wc; const char *fn; DISSECTOR_ASSERT(si); @@ -3699,7 +3703,7 @@ dissect_move_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of /* tid */ tid = tvb_get_letohs(tvb, offset); - offset = dissect_smb_tid(tvb, pinfo, tree, offset, tid, FALSE, FALSE, si); + offset = dissect_smb_tid(tvb, pinfo, tree, offset, tid, false, false, si); /* open function */ offset = dissect_open_function(tvb, tree, offset); @@ -3716,15 +3720,15 @@ dissect_move_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of /* file name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string_format(tree, hf_smb_file_name, tvb, offset, - fn_len, fn, "Old File Name: %s", format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + fn_len, fn, "Old File Name: %s", format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); COUNT_BYTES(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Old Name: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); /* buffer format */ CHECK_BYTE_COUNT(1); @@ -3733,15 +3737,15 @@ dissect_move_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of /* file name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string_format(tree, hf_smb_file_name, tvb, offset, - fn_len, fn, "New File Name: %s", format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + fn_len, fn, "New File Name: %s", format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); COUNT_BYTES(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", New Name: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); END_OF_SMB @@ -3752,9 +3756,9 @@ static int dissect_copy_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { int fn_len; - guint16 tid; - guint16 bc; - guint8 wc; + uint16_t tid; + uint16_t bc; + uint8_t wc; const char *fn; DISSECTOR_ASSERT(si); @@ -3763,7 +3767,7 @@ dissect_copy_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of /* tid */ tid = tvb_get_letohs(tvb, offset); - offset = dissect_smb_tid(tvb, pinfo, tree, offset, tid, FALSE, FALSE, si); + offset = dissect_smb_tid(tvb, pinfo, tree, offset, tid, false, false, si); /* open function */ offset = dissect_open_function(tvb, tree, offset); @@ -3780,15 +3784,15 @@ dissect_copy_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of /* file name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string_format(tree, hf_smb_file_name, tvb, offset, - fn_len, fn, "Source File Name: %s", format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + fn_len, fn, "Source File Name: %s", format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); COUNT_BYTES(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Source Name: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); /* buffer format */ CHECK_BYTE_COUNT(1); @@ -3797,15 +3801,15 @@ dissect_copy_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of /* file name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string_format(tree, hf_smb_file_name, tvb, offset, fn_len, fn, "Destination File Name: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); COUNT_BYTES(fn_len); - col_append_fstr(pinfo->cinfo, COL_INFO, ", Destination Name: %s", format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + col_append_fstr(pinfo->cinfo, COL_INFO, ", Destination Name: %s", format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); END_OF_SMB @@ -3817,8 +3821,8 @@ dissect_move_copy_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr { int fn_len; const char *fn; - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; DISSECTOR_ASSERT(si); @@ -3837,7 +3841,7 @@ dissect_move_copy_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr /* file name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, @@ -3854,8 +3858,8 @@ dissect_open_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i { int fn_len; const char *fn; - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; smb_fid_saved_info_t *fsi; /* eo_smb needs to track this info */ DISSECTOR_ASSERT(si); @@ -3877,7 +3881,7 @@ dissect_open_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i /* file name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, @@ -3896,7 +3900,7 @@ dissect_open_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i } col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); END_OF_SMB @@ -3907,7 +3911,7 @@ dissect_open_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i static int dissect_nt_create_bits(tvbuff_t *tvb, proto_tree *parent_tree, int offset, - int len, guint32 mask) + int len, uint32_t mask) { proto_item *item = NULL; /* @@ -3944,7 +3948,7 @@ dissect_nt_create_bits(tvbuff_t *tvb, proto_tree *parent_tree, int offset, /* FIXME: need to call dissect_nt_access_mask() instead */ static int dissect_smb_access_mask_bits(tvbuff_t *tvb, proto_tree *parent_tree, - int offset, int len, guint32 mask) + int offset, int len, uint32_t mask) { proto_item *item; /* @@ -3992,7 +3996,7 @@ dissect_smb_access_mask_bits(tvbuff_t *tvb, proto_tree *parent_tree, int dissect_smb_access_mask(tvbuff_t *tvb, proto_tree *parent_tree, int offset) { - guint32 mask; + uint32_t mask; mask = tvb_get_letohl(tvb, offset); @@ -4007,7 +4011,7 @@ dissect_smb_access_mask(tvbuff_t *tvb, proto_tree *parent_tree, int offset) static int dissect_nt_share_access_bits(tvbuff_t *tvb, proto_tree *parent_tree, - int offset, int len, guint32 mask) + int offset, int len, uint32_t mask) { proto_item *item; static int * const fields[] = { @@ -4030,7 +4034,7 @@ dissect_nt_share_access_bits(tvbuff_t *tvb, proto_tree *parent_tree, int dissect_nt_share_access(tvbuff_t *tvb, proto_tree *parent_tree, int offset) { - guint32 mask; + uint32_t mask; mask = tvb_get_letohl(tvb, offset); @@ -4042,7 +4046,7 @@ dissect_nt_share_access(tvbuff_t *tvb, proto_tree *parent_tree, int offset) static int dissect_nt_create_options_bits(tvbuff_t *tvb, proto_tree *parent_tree, - int offset, int len, guint32 mask) + int offset, int len, uint32_t mask) { proto_item *item; /* @@ -4086,7 +4090,7 @@ dissect_nt_create_options_bits(tvbuff_t *tvb, proto_tree *parent_tree, int dissect_nt_create_options(tvbuff_t *tvb, proto_tree *parent_tree, int offset) { - guint32 mask; + uint32_t mask; mask = tvb_get_letohl(tvb, offset); @@ -4099,7 +4103,7 @@ dissect_nt_create_options(tvbuff_t *tvb, proto_tree *parent_tree, int offset) /* fids are scoped by tcp session */ smb_fid_info_t * dissect_smb_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, - int len, guint16 fid, gboolean is_created, gboolean is_closed, gboolean is_generated, smb_info_t* si) + int len, uint16_t fid, bool is_created, bool is_closed, bool is_generated, smb_info_t* si) { smb_saved_info_t *sip; proto_item *it; @@ -4167,9 +4171,9 @@ dissect_smb_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, if (sip && (!is_generated) && (!pinfo->fd->visited)) { sip->fid = fid; if (si->request) { - sip->fid_seen_in_request = TRUE; + sip->fid_seen_in_request = true; } else { - sip->fid_seen_in_request = FALSE; + sip->fid_seen_in_request = false; } } @@ -4209,19 +4213,19 @@ dissect_smb_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, static int dissect_open_file_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 bc; - guint16 fid; + uint8_t wc; + uint16_t bc; + uint16_t fid; smb_fid_info_t *fid_info = NULL; /* eo_smb needs to track this info */ - guint16 fattr; - gboolean isdir = FALSE; + uint16_t fattr; + bool isdir = false; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - fid_info = dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, TRUE, FALSE, FALSE, si); + fid_info = dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, true, false, false, si); if (fid_info) { /* This command is used to create and open a new file or open and truncate an existing file to zero length */ @@ -4264,15 +4268,15 @@ dissect_open_file_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static int dissect_query_information2_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 bc; - guint16 fid; + uint8_t wc; + uint16_t bc; + uint16_t fid; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; BYTE_COUNT; @@ -4285,15 +4289,15 @@ dissect_query_information2_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree static int 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) { - guint8 wc; - guint16 bc; - guint16 fid; + uint8_t wc; + uint16_t bc; + uint16_t fid; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, TRUE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, true, false, si); offset += 2; BYTE_COUNT; @@ -4306,15 +4310,15 @@ dissect_close_print_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree * static int 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) { - guint8 wc; - guint16 bc; - guint16 fid; + uint8_t wc; + uint16_t bc; + uint16_t fid; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; BYTE_COUNT; @@ -4327,15 +4331,15 @@ dissect_open_print_file_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree * static int dissect_create_new_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 bc; - guint16 fid; + uint8_t wc; + uint16_t bc; + uint16_t fid; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, TRUE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, true, false, false, si); offset += 2; BYTE_COUNT; @@ -4348,15 +4352,15 @@ dissect_create_new_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static int dissect_flush_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 bc; - guint16 fid; + uint8_t wc; + uint16_t bc; + uint16_t fid; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; BYTE_COUNT; @@ -4369,18 +4373,18 @@ dissect_flush_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static int dissect_create_file_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 bc; - guint16 fid; + uint8_t wc; + uint16_t bc; + uint16_t fid; smb_fid_info_t *fid_info = NULL; /* eo_smb needs to track this info */ - guint16 fattr; - gboolean isdir = FALSE; + uint16_t fattr; + bool isdir = false; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - fid_info = dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, TRUE, FALSE, FALSE, si); + fid_info = dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, true, false, false, si); if (fid_info) { /* This command is used to create and open a new file or open and truncate an existing file to zero length */ @@ -4412,10 +4416,10 @@ dissect_create_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { int fn_len; const char *fn; - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; smb_fid_saved_info_t *fsi; /* eo_smb needs to track this info */ - guint32 file_attributes = 0; + uint32_t file_attributes = 0; DISSECTOR_ASSERT(si); @@ -4438,7 +4442,7 @@ dissect_create_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* File Name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, @@ -4459,7 +4463,7 @@ dissect_create_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); END_OF_SMB @@ -4469,14 +4473,14 @@ dissect_create_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static int dissect_close_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 bc, fid; + uint8_t wc; + uint16_t bc, fid; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, TRUE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, true, false, si); offset += 2; /* last write time */ @@ -4494,8 +4498,8 @@ dissect_delete_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { int fn_len; const char *fn; - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; DISSECTOR_ASSERT(si); @@ -4513,7 +4517,7 @@ dissect_delete_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* file name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if ((!pinfo->fd->visited) && si->sip) { si->sip->extra_info_type = SMB_EI_FILENAME; @@ -4527,7 +4531,7 @@ dissect_delete_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, COUNT_BYTES(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); END_OF_SMB @@ -4539,8 +4543,8 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { int fn_len; const char *fn, *old_name = NULL, *new_name = NULL; - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; smb_rename_saved_info_t *rni = NULL; DISSECTOR_ASSERT(si); @@ -4559,7 +4563,7 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* old file name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; old_name = fn; @@ -4568,7 +4572,7 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, COUNT_BYTES(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Old Name: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); /* buffer format */ CHECK_BYTE_COUNT(1); @@ -4577,7 +4581,7 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* file name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; new_name = fn; @@ -4586,7 +4590,7 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, COUNT_BYTES(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", New Name: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); END_OF_SMB @@ -4608,8 +4612,8 @@ dissect_nt_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr { int fn_len; const char *fn; - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; DISSECTOR_ASSERT(si); @@ -4633,7 +4637,7 @@ dissect_nt_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* old file name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_old_file_name, tvb, offset, fn_len, @@ -4641,7 +4645,7 @@ dissect_nt_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr COUNT_BYTES(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Old Name: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); /* buffer format */ CHECK_BYTE_COUNT(1); @@ -4650,7 +4654,7 @@ dissect_nt_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* file name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, @@ -4658,7 +4662,7 @@ dissect_nt_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr COUNT_BYTES(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", New Name: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); END_OF_SMB @@ -4669,8 +4673,8 @@ dissect_nt_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr static int dissect_query_information_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint16 bc; - guint8 wc; + uint16_t bc; + uint8_t wc; const char *fn; int fn_len; @@ -4687,7 +4691,7 @@ dissect_query_information_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree /* File Name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, @@ -4695,7 +4699,7 @@ dissect_query_information_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree COUNT_BYTES(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); END_OF_SMB @@ -4705,8 +4709,8 @@ dissect_query_information_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree static int 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_) { - guint16 bc; - guint8 wc; + uint16_t bc; + uint8_t wc; WORD_COUNT; @@ -4736,8 +4740,8 @@ dissect_set_information_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t { int fn_len; const char *fn; - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; DISSECTOR_ASSERT(si); @@ -4762,7 +4766,7 @@ dissect_set_information_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t /* file name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, @@ -4770,7 +4774,7 @@ dissect_set_information_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t COUNT_BYTES(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); END_OF_SMB @@ -4778,17 +4782,17 @@ dissect_set_information_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t } typedef struct _rw_info_t { - guint64 offset; - guint32 len; - guint16 fid; + uint64_t offset; + uint32_t len; + uint16_t fid; } rw_info_t; static int dissect_read_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 cnt = 0, bc; - guint32 ofs = 0; + uint8_t wc; + uint16_t cnt = 0, bc; + uint32_t ofs = 0; unsigned int fid; rw_info_t *rwi = NULL; @@ -4796,7 +4800,7 @@ dissect_read_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, (guint16) fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, (uint16_t) fid, false, false, false, si); offset += 2; /* read count */ @@ -4835,7 +4839,7 @@ dissect_read_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i } int -dissect_file_data(tvbuff_t *tvb, proto_tree *tree, int offset, guint16 bc, int dataoffset, guint16 datalen) +dissect_file_data(tvbuff_t *tvb, proto_tree *tree, int offset, uint16_t bc, int dataoffset, uint16_t datalen) { int tvblen; @@ -4862,7 +4866,7 @@ dissect_file_data(tvbuff_t *tvb, proto_tree *tree, int offset, guint16 bc, int d static int dissect_file_data_dcerpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - proto_tree *top_tree, int offset, guint16 bc, guint16 datalen, guint16 fid, + proto_tree *top_tree, int offset, uint16_t bc, uint16_t datalen, uint16_t fid, void *data) { int tvblen; @@ -4896,8 +4900,8 @@ dissect_file_data_dcerpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, */ static int dissect_file_data_maybe_dcerpc(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree, proto_tree *top_tree, int offset, guint16 bc, - int dataoffset, guint16 datalen, guint32 ofs, guint16 fid, smb_info_t *si) + proto_tree *tree, proto_tree *top_tree, int offset, uint16_t bc, + int dataoffset, uint16_t datalen, uint32_t ofs, uint16_t fid, smb_info_t *si) { DISSECTOR_ASSERT(si); @@ -4915,11 +4919,11 @@ dissect_file_data_maybe_dcerpc(tvbuff_t *tvb, packet_info *pinfo, static int dissect_read_file_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint16 cnt = 0, bc; - guint8 wc; + uint16_t cnt = 0, bc; + uint8_t wc; int fid = 0; - guint32 datalen = 0, dataoffset = 0; - guint32 tvblen; + uint32_t datalen = 0, dataoffset = 0; + uint32_t tvblen; rw_info_t *rwi = NULL; DISSECTOR_ASSERT(si); @@ -4951,7 +4955,7 @@ dissect_read_file_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* file data, might be DCERPC on a pipe */ if (bc) { offset = dissect_file_data_maybe_dcerpc(tvb, pinfo, tree, - top_tree_global, offset, bc, -1, bc, 0, (guint16) fid, si); + top_tree_global, offset, bc, -1, bc, 0, (uint16_t) fid, si); bc = 0; } @@ -4990,8 +4994,8 @@ dissect_read_file_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static int 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_) { - guint16 cnt, bc; - guint8 wc; + uint16_t cnt, bc; + uint8_t wc; WORD_COUNT; @@ -5026,12 +5030,12 @@ dissect_lock_and_read_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree static int dissect_write_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint32 ofs = 0; - guint16 cnt = 0, bc, fid = 0; - guint8 wc; + uint32_t ofs = 0; + uint16_t cnt = 0, bc, fid = 0; + uint8_t wc; rw_info_t *rwi = NULL; - guint32 datalen = 0, dataoffset = 0; - guint32 tvblen; + uint32_t datalen = 0, dataoffset = 0; + uint32_t tvblen; DISSECTOR_ASSERT(si); @@ -5039,7 +5043,7 @@ dissect_write_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; /* write count */ @@ -5118,8 +5122,8 @@ dissect_write_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static int dissect_write_file_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 bc, cnt; + uint8_t wc; + uint16_t bc, cnt; rw_info_t *rwi = NULL; DISSECTOR_ASSERT(si); @@ -5157,14 +5161,14 @@ dissect_write_file_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static int dissect_lock_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 bc, fid; + uint8_t wc; + uint16_t bc, fid; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; /* lock count */ @@ -5187,8 +5191,8 @@ dissect_create_temporary_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree * { int fn_len; const char *fn; - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; DISSECTOR_ASSERT(si); @@ -5215,7 +5219,7 @@ dissect_create_temporary_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree * * it's always ASCII, so we honor the "Unicode strings" flag. */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_dir_name, tvb, offset, fn_len, @@ -5223,7 +5227,7 @@ dissect_create_temporary_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree * COUNT_BYTES(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); END_OF_SMB @@ -5235,8 +5239,8 @@ dissect_create_temporary_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree { int fn_len; const char *fn; - guint8 wc; - guint16 bc, fid; + uint8_t wc; + uint16_t bc, fid; DISSECTOR_ASSERT(si); @@ -5244,7 +5248,7 @@ dissect_create_temporary_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, TRUE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, true, false, false, si); offset += 2; BYTE_COUNT; @@ -5255,8 +5259,8 @@ dissect_create_temporary_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree * MS-CIFS says "The string SHOULD be a null-terminated array of * ASCII characters.", so we ignore the "Unicode strings" flag. */ - fn = get_unicode_or_ascii_string(tvb, &offset, FALSE, &fn_len, - TRUE, FALSE, &bc); + fn = get_unicode_or_ascii_string(tvb, &offset, false, &fn_len, + true, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, @@ -5278,14 +5282,14 @@ static const value_string seek_mode_vals[] = { static int dissect_seek_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 bc, fid; + uint8_t wc; + uint16_t bc, fid; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; /* Seek Mode */ @@ -5306,8 +5310,8 @@ dissect_seek_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i static int 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_) { - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; WORD_COUNT; @@ -5325,30 +5329,30 @@ dissect_seek_file_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_set_information2_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 bc, fid; + uint8_t wc; + uint16_t bc, fid; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; /* create time */ offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_create_time, - hf_smb_create_dos_date, hf_smb_create_dos_time, FALSE); + hf_smb_create_dos_date, hf_smb_create_dos_time, false); /* access time */ offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_access_time, - hf_smb_access_dos_date, hf_smb_access_dos_time, FALSE); + hf_smb_access_dos_date, hf_smb_access_dos_time, false); /* last write time */ offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_last_write_time, - hf_smb_last_write_dos_date, hf_smb_last_write_dos_time, FALSE); + hf_smb_last_write_dos_date, hf_smb_last_write_dos_time, false); BYTE_COUNT; @@ -5360,25 +5364,25 @@ dissect_set_information2_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree * static int 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_) { - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; WORD_COUNT; /* create time */ offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_create_time, - hf_smb_create_dos_date, hf_smb_create_dos_time, FALSE); + hf_smb_create_dos_date, hf_smb_create_dos_time, false); /* access time */ offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_access_time, - hf_smb_access_dos_date, hf_smb_access_dos_time, FALSE); + hf_smb_access_dos_date, hf_smb_access_dos_time, false); /* last write time */ offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_last_write_time, - hf_smb_last_write_dos_date, hf_smb_last_write_dos_time, FALSE); + hf_smb_last_write_dos_date, hf_smb_last_write_dos_time, false); /* data size */ proto_tree_add_item(tree, hf_smb_data_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); @@ -5401,15 +5405,15 @@ dissect_query_information2_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto static int 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) { - guint8 wc; - guint16 cnt = 0; - guint16 bc, fid; + uint8_t wc; + uint16_t cnt = 0; + uint16_t bc, fid; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, TRUE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, true, false, si); offset += 2; /* write count */ @@ -5448,8 +5452,8 @@ dissect_write_and_close_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t static int 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_) { - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; WORD_COUNT; @@ -5467,14 +5471,14 @@ dissect_write_and_close_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr /* Timeout is defined on page 117 of SMB Protocol Extensions version 2.0 available at http://us1.samba.org/samba/ftp/SMB-info/DOSEXTP.TXT */ -static gchar * -smbext20_timeout_msecs_to_str(gint32 timeout) +static char * +smbext20_timeout_msecs_to_str(int32_t timeout) { - gchar *buf; + char *buf; #define SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN 60 if (timeout <= 0) { - buf = (gchar *)wmem_alloc(wmem_packet_scope(), SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN+1); + buf = (char *)wmem_alloc(wmem_packet_scope(), SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN+1); if (timeout == 0) { snprintf(buf, SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN+1, "Return immediately (0)"); } else if (timeout == -1) { @@ -5493,15 +5497,15 @@ smbext20_timeout_msecs_to_str(gint32 timeout) static int dissect_read_raw_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 bc, fid; - guint32 to; + uint8_t wc; + uint16_t bc, fid; + uint32_t to; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; /* offset */ @@ -5541,8 +5545,8 @@ dissect_read_raw_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in static int 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_) { - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; WORD_COUNT; @@ -5576,14 +5580,14 @@ dissect_query_information_disk_response(tvbuff_t *tvb, packet_info *pinfo _U_, p static int dissect_read_mpx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc; - guint16 bc, fid; + uint8_t wc; + uint16_t bc, fid; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; /* offset */ @@ -5612,8 +5616,8 @@ dissect_read_mpx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in static int 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_) { - guint16 datalen = 0, bc; - guint8 wc; + uint16_t datalen = 0, bc; + uint8_t wc; WORD_COUNT; @@ -5689,7 +5693,7 @@ static const true_false_string tfs_write_mode_connectionless = { static int dissect_write_mode(tvbuff_t *tvb, proto_tree *parent_tree, int offset, int bm) { - guint16 mask; + uint16_t mask; proto_item *item; proto_tree *tree; @@ -5728,15 +5732,15 @@ dissect_write_mode(tvbuff_t *tvb, proto_tree *parent_tree, int offset, int bm) static int dissect_write_raw_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint32 to; - guint16 datalen = 0, bc, fid; - guint8 wc; + uint32_t to; + uint16_t datalen = 0, bc, fid; + uint8_t wc; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; /* total data length */ @@ -5787,8 +5791,8 @@ dissect_write_raw_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i static int 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_) { - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; WORD_COUNT; @@ -5806,15 +5810,15 @@ dissect_write_raw_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_write_mpx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint32 to; - guint16 datalen = 0, bc, fid; - guint8 wc; + uint32_t to; + uint16_t datalen = 0, bc, fid; + uint8_t wc; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; /* total data length */ @@ -5865,8 +5869,8 @@ dissect_write_mpx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i static int 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_) { - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; WORD_COUNT; @@ -5882,15 +5886,18 @@ dissect_write_mpx_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr } static int -dissect_sid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si _U_) +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_) { - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; + uint32_t search_id; WORD_COUNT; - /* sid */ - proto_tree_add_item(tree, hf_smb_search_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); + /* search ID */ + proto_tree_add_item_ret_uint(tree, hf_smb_search_id, tvb, offset, 2, + ENC_LITTLE_ENDIAN, &search_id); + col_append_fstr(pinfo->cinfo, COL_INFO, ", Search ID: %u", (uint16_t)search_id); offset += 2; BYTE_COUNT; @@ -5902,8 +5909,8 @@ dissect_sid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, static int dissect_search_resume_key(tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *parent_tree, int offset, guint16 *bcp, gboolean *trunc, - gboolean has_find_id, smb_info_t *si) + proto_tree *parent_tree, int offset, uint16_t *bcp, bool *trunc, + bool has_find_id, smb_info_t *si) { proto_tree *tree; int fn_len; @@ -5921,8 +5928,8 @@ dissect_search_resume_key(tvbuff_t *tvb, packet_info *pinfo _U_, /* file name */ fn_len = 11; - fn = get_unicode_or_ascii_string(tvb, &offset, FALSE/*never Unicode*/, &fn_len, - TRUE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, false/*never Unicode*/, &fn_len, + true, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, 11, fn); COUNT_BYTES_SUBR(fn_len); @@ -5948,14 +5955,14 @@ dissect_search_resume_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree_add_item(tree, hf_smb_resume_client_cookie, tvb, offset, 4, ENC_NA); COUNT_BYTES_SUBR(4); - *trunc = FALSE; + *trunc = false; return offset; } static int dissect_search_dir_info(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *parent_tree, int offset, guint16 *bcp, gboolean *trunc, - gboolean has_find_id, smb_info_t *si) + proto_tree *parent_tree, int offset, uint16_t *bcp, bool *trunc, + bool has_find_id, smb_info_t *si) { proto_tree *tree; int fn_len; @@ -5982,7 +5989,7 @@ dissect_search_dir_info(tvbuff_t *tvb, packet_info *pinfo, offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_last_write_time, hf_smb_last_write_dos_date, hf_smb_last_write_dos_time, - TRUE); + true); *bcp -= 4; /* File Size */ @@ -5995,13 +6002,13 @@ dissect_search_dir_info(tvbuff_t *tvb, packet_info *pinfo, not supported; names are returned in the extended ASCII (OEM) character set only." */ fn_len = 13; - fn = get_unicode_or_ascii_string(tvb, &offset, FALSE/*Never Unicode*/, &fn_len, - TRUE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, false/*Never Unicode*/, &fn_len, + true, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_SUBR(fn_len); - *trunc = FALSE; + *trunc = false; return offset; } @@ -6009,14 +6016,14 @@ dissect_search_dir_info(tvbuff_t *tvb, packet_info *pinfo, static int dissect_search_find_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si, - gboolean has_find_id) + bool has_find_id) { int fn_len; const char *fn; - guint16 rkl; - guint8 wc; - guint16 bc; - gboolean trunc; + uint16_t rkl; + uint8_t wc; + uint16_t bc; + bool trunc; DISSECTOR_ASSERT(si); @@ -6038,7 +6045,7 @@ dissect_search_find_request(tvbuff_t *tvb, packet_info *pinfo, /* file name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - TRUE, FALSE, &bc); + true, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, @@ -6046,7 +6053,7 @@ dissect_search_find_request(tvbuff_t *tvb, packet_info *pinfo, COUNT_BYTES(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); /* buffer format */ CHECK_BYTE_COUNT(1); @@ -6077,7 +6084,7 @@ dissect_search_dir_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { return dissect_search_find_request(tvb, pinfo, tree, offset, - smb_tree, si, FALSE); + smb_tree, si, false); } static int @@ -6085,7 +6092,7 @@ dissect_find_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { return dissect_search_find_request(tvb, pinfo, tree, offset, - smb_tree, si, TRUE); + smb_tree, si, true); } static int @@ -6093,18 +6100,18 @@ dissect_find_close_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { return dissect_search_find_request(tvb, pinfo, tree, offset, - smb_tree, si, TRUE); + smb_tree, si, true); } static int dissect_search_find_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, - gboolean has_find_id, smb_info_t *si) + bool has_find_id, smb_info_t *si) { - guint16 count = 0; - guint8 wc; - guint16 bc; - gboolean trunc; + uint16_t count = 0; + uint8_t wc; + uint16_t bc; + bool trunc; WORD_COUNT; @@ -6141,23 +6148,23 @@ static int dissect_search_dir_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { return dissect_search_find_response(tvb, pinfo, tree, offset, smb_tree, - FALSE, si); + false, si); } static int dissect_find_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { return dissect_search_find_response(tvb, pinfo, tree, offset, smb_tree, - TRUE, si); + true, si); } static int dissect_find_close_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si _U_) { - guint8 wc; - guint16 bc; - guint16 data_len; + uint8_t wc; + uint16_t bc; + uint16_t data_len; WORD_COUNT; @@ -6219,9 +6226,9 @@ static const true_false_string tfs_lock_type_shared = { static int dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { - guint8 wc, cmd = 0xff, lt = 0, ol = 0; - guint16 andxoffset = 0, un = 0, ln = 0, bc, fid, num_lock = 0, num_unlock = 0; - guint32 to; + uint8_t wc, cmd = 0xff, lt = 0, ol = 0; + uint16_t andxoffset = 0, un = 0, ln = 0, bc, fid, num_lock = 0, num_unlock = 0; + uint32_t to; proto_item *it = NULL; proto_tree *tr = NULL; int old_offset = offset; @@ -6240,7 +6247,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree WORD_COUNT; /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -6259,16 +6266,16 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; /* lock type */ - lt = tvb_get_guint8(tvb, offset); + lt = tvb_get_uint8(tvb, offset); proto_tree_add_bitmask(tree, tvb, offset, hf_smb_lock_type, ett_smb_lock_type, locks, ENC_NA); offset += 1; /* oplock level */ - ol = tvb_get_guint8(tvb, offset); + ol = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_smb_locking_ol, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; @@ -6312,10 +6319,10 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree while (un--) { proto_tree *ltree_2; if (lt&0x10) { - guint64 val; - guint16 lock_pid; - guint64 lock_offset; - guint64 lock_length; + uint64_t val; + uint16_t lock_pid; + uint64_t lock_offset; + uint64_t lock_length; /* large lock format */ ltree_2 = proto_tree_add_subtree(tr, tvb, offset, 20, ett_smb_unlock, NULL, "Unlock"); @@ -6333,7 +6340,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* offset */ CHECK_BYTE_COUNT(8); - val = ((guint64)tvb_get_letohl(tvb, offset)) << 32 + val = ((uint64_t)tvb_get_letohl(tvb, offset)) << 32 | tvb_get_letohl(tvb, offset+4); lock_offset = val; proto_tree_add_uint64(ltree_2, hf_smb_lock_long_offset, tvb, offset, 8, val); @@ -6341,7 +6348,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* length */ CHECK_BYTE_COUNT(8); - val = ((guint64)tvb_get_letohl(tvb, offset)) << 32 + val = ((uint64_t)tvb_get_letohl(tvb, offset)) << 32 | tvb_get_letohl(tvb, offset+4); lock_length = val; proto_tree_add_uint64(ltree_2, hf_smb_lock_long_length, tvb, offset, 8, val); @@ -6389,10 +6396,10 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree while (ln--) { proto_tree *ltree_2; if (lt&0x10) { - guint64 val; - guint16 lock_pid; - guint64 lock_offset; - guint64 lock_length; + uint64_t val; + uint16_t lock_pid; + uint64_t lock_offset; + uint64_t lock_length; /* large lock format */ ltree_2 = proto_tree_add_subtree(tr, tvb, offset, 20, ett_smb_lock, NULL, "Lock"); @@ -6410,7 +6417,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* offset */ CHECK_BYTE_COUNT(8); - val = ((guint64)tvb_get_letohl(tvb, offset)) << 32 + val = ((uint64_t)tvb_get_letohl(tvb, offset)) << 32 | tvb_get_letohl(tvb, offset+4); lock_offset = val; proto_tree_add_uint64(ltree_2, hf_smb_lock_long_offset, tvb, offset, 8, val); @@ -6418,7 +6425,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* length */ CHECK_BYTE_COUNT(8); - val = ((guint64)tvb_get_letohl(tvb, offset)) << 32 + val = ((uint64_t)tvb_get_letohl(tvb, offset)) << 32 | tvb_get_letohl(tvb, offset+4); lock_length = val; proto_tree_add_uint64(ltree_2, hf_smb_lock_long_length, tvb, offset, 8, val); @@ -6473,7 +6480,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree if (andxoffset < offset) { THROW(ReportedBoundsError); } - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } return offset; @@ -6482,9 +6489,9 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree static int dissect_locking_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { - guint8 wc, cmd = 0xff; - guint16 andxoffset = 0; - guint16 bc; + uint8_t wc, cmd = 0xff; + uint16_t andxoffset = 0; + uint16_t bc; DISSECTOR_ASSERT(si); @@ -6535,7 +6542,7 @@ dissect_locking_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre WORD_COUNT; /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -6560,7 +6567,7 @@ dissect_locking_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre if (andxoffset < offset) { THROW(ReportedBoundsError); } - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } return offset; @@ -6615,7 +6622,7 @@ static const true_false_string tfs_open_flags_ealen = { static int dissect_open_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset, int bm) { - guint16 mask; + uint16_t mask; proto_item *item; proto_tree *tree; @@ -6662,9 +6669,9 @@ static const value_string filetype_vals[] = { static int dissect_open_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { - guint8 wc, cmd = 0xff; - guint16 andxoffset = 0, bc; - guint32 to; + uint8_t wc, cmd = 0xff; + uint16_t andxoffset = 0, bc; + uint32_t to; int fn_len; const char *fn; @@ -6673,7 +6680,7 @@ dissect_open_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i WORD_COUNT; /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -6725,7 +6732,7 @@ dissect_open_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i /* file name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, @@ -6745,7 +6752,7 @@ dissect_open_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i } col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); END_OF_SMB @@ -6753,7 +6760,7 @@ dissect_open_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i if (andxoffset < offset) { THROW(ReportedBoundsError); } - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } return offset; @@ -6780,7 +6787,7 @@ static const value_string ipc_state_read_mode_vals[] = { }; int -dissect_ipc_state(tvbuff_t *tvb, proto_tree *parent_tree, int offset, gboolean setstate_flag) +dissect_ipc_state(tvbuff_t *tvb, proto_tree *parent_tree, int offset, bool setstate_flag) { static int * const setstate_flags[] = { &hf_smb_ipc_state_nonblocking, @@ -6809,18 +6816,18 @@ dissect_ipc_state(tvbuff_t *tvb, proto_tree *parent_tree, int offset, gboolean s static int dissect_open_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { - guint8 wc, cmd = 0xff; - guint16 andxoffset = 0, bc; - guint16 fid; - guint16 ftype; - guint16 fattr; + uint8_t wc, cmd = 0xff; + uint16_t andxoffset = 0, bc; + uint16_t fid; + uint16_t ftype; + uint16_t fattr; smb_fid_info_t *fid_info = NULL; - gboolean isdir = FALSE; + bool isdir = false; WORD_COUNT; /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -6840,7 +6847,7 @@ dissect_open_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* fid */ fid = tvb_get_letohs(tvb, offset); /* we add fid_info= to this call so that we save the result */ - fid_info = dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, TRUE, FALSE, FALSE, si); + fid_info = dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, true, false, false, si); offset += 2; @@ -6855,7 +6862,7 @@ dissect_open_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* File Size */ /* We store the file_size in the fid_info */ if (fid_info) { - fid_info->end_of_file = (guint64) tvb_get_letohl(tvb, offset); + fid_info->end_of_file = (uint64_t) tvb_get_letohl(tvb, offset); } proto_tree_add_item(tree, hf_smb_file_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; @@ -6892,7 +6899,7 @@ dissect_open_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* IPC State */ - offset = dissect_ipc_state(tvb, tree, offset, FALSE); + offset = dissect_ipc_state(tvb, tree, offset, false); /* open_action */ offset = dissect_open_action(tvb, tree, offset); @@ -6926,7 +6933,7 @@ dissect_open_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (andxoffset < offset) { THROW(ReportedBoundsError); } - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } return offset; @@ -6935,12 +6942,12 @@ dissect_open_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static int dissect_read_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { - guint8 wc, cmd = 0xff; - guint16 andxoffset = 0, bc, maxcnt_low; - guint32 maxcnt_high; - guint32 maxcnt = 0; - guint32 offsetlow, offsethigh = 0; - guint64 ofs; + uint8_t wc, cmd = 0xff; + uint16_t andxoffset = 0, bc, maxcnt_low; + uint32_t maxcnt_high; + uint32_t maxcnt = 0; + uint32_t offsetlow, offsethigh = 0; + uint64_t ofs; unsigned int fid; rw_info_t *rwi = NULL; @@ -6950,7 +6957,7 @@ dissect_read_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i WORD_COUNT; /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -6969,7 +6976,7 @@ dissect_read_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, (guint16) fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, (uint16_t) fid, false, false, false, si); offset += 2; /* offset */ @@ -7085,7 +7092,7 @@ dissect_read_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i if (andxoffset < offset) { THROW(ReportedBoundsError); } - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } return offset; @@ -7094,20 +7101,20 @@ dissect_read_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i static int dissect_read_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { - guint8 wc, cmd = 0xff; - guint16 andxoffset = 0, bc, datalen_low, dataoffset = 0; - guint32 datalen = 0, datalen_high; + uint8_t wc, cmd = 0xff; + uint16_t andxoffset = 0, bc, datalen_low, dataoffset = 0; + uint32_t datalen = 0, datalen_high; rw_info_t *rwi = NULL; - guint16 fid = 0; /* was int fid = 0; */ + uint16_t fid = 0; /* was int fid = 0; */ - guint32 tvblen; + uint32_t tvblen; DISSECTOR_ASSERT(si); WORD_COUNT; /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -7128,7 +7135,7 @@ dissect_read_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* first check if we have seen the request */ if ((si->sip != NULL) && (si->sip->frame_req > 0) && (si->sip->extra_info_type == SMB_EI_FID)) { fid = GPOINTER_TO_INT(si->sip->extra_info); - dissect_smb_fid(tvb, pinfo, tree, 0, 0, (guint16) fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, 0, 0, (uint16_t) fid, false, false, false, si); } if (si->sip && (si->sip->extra_info_type == SMB_EI_RWINFO)) { @@ -7204,7 +7211,7 @@ dissect_read_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* file data, might be DCERPC on a pipe */ if (bc) { offset = dissect_file_data_maybe_dcerpc(tvb, pinfo, tree, - top_tree_global, offset, bc, -1, (guint16) datalen, 0, (guint16) fid, si); + top_tree_global, offset, bc, -1, (uint16_t) datalen, 0, (uint16_t) fid, si); bc = 0; } @@ -7220,7 +7227,7 @@ dissect_read_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (andxoffset < offset) { THROW(ReportedBoundsError); } - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } return offset; @@ -7232,23 +7239,23 @@ dissect_read_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static int dissect_write_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { - guint8 wc, cmd = 0xff; - guint16 andxoffset = 0, bc, dataoffset = 0, datalen_low, datalen_high; - guint32 offsetlow, offsethigh = 0; - guint64 ofs; - guint32 datalen = 0; - guint16 fid = 0; /* was unsigned int fid = 0; */ - guint16 mode = 0; + uint8_t wc, cmd = 0xff; + uint16_t andxoffset = 0, bc, dataoffset = 0, datalen_low, datalen_high; + uint32_t offsetlow, offsethigh = 0; + uint64_t ofs; + uint32_t datalen = 0; + uint16_t fid = 0; /* was unsigned int fid = 0; */ + uint16_t mode = 0; rw_info_t *rwi = NULL; - guint32 tvblen; + uint32_t tvblen; DISSECTOR_ASSERT(si); WORD_COUNT; /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -7267,7 +7274,7 @@ dissect_write_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, (guint16) fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, (uint16_t) fid, false, false, false, si); offset += 2; /* offset */ @@ -7389,7 +7396,7 @@ dissect_write_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, SMB_Data.Bytes will not be contiguous. */ offset = dissect_file_data_maybe_dcerpc(tvb, pinfo, tree, - top_tree_global, offset, bc, dataoffset, (guint16) datalen, 0, (guint16) fid, si); + top_tree_global, offset, bc, dataoffset, (uint16_t) datalen, 0, (uint16_t) fid, si); bc = 0; } @@ -7405,7 +7412,7 @@ dissect_write_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (andxoffset < offset) { THROW(ReportedBoundsError); } - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } return offset; @@ -7414,9 +7421,9 @@ dissect_write_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static int dissect_write_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { - guint8 wc, cmd = 0xff; - guint16 andxoffset = 0, bc, count_low, count_high; - guint32 count = 0; + uint8_t wc, cmd = 0xff; + uint16_t andxoffset = 0, bc, count_low, count_high; + uint32_t count = 0; rw_info_t *rwi = NULL; DISSECTOR_ASSERT(si); @@ -7424,7 +7431,7 @@ dissect_write_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, WORD_COUNT; /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -7490,7 +7497,7 @@ dissect_write_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (andxoffset < offset) { THROW(ReportedBoundsError); } - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } return offset; @@ -7519,17 +7526,17 @@ dissect_setup_action(tvbuff_t *tvb, proto_tree *parent_tree, int offset) static int dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { - guint8 wc, cmd = 0xff; - guint16 bc; - guint16 andxoffset = 0; + uint8_t wc, cmd = 0xff; + uint16_t bc; + uint16_t andxoffset = 0; int an_len; const char *an; int dn_len; const char *dn; - guint16 pwlen = 0; - guint16 sbloblen = 0, sbloblen_short; - guint16 apwlen = 0, upwlen = 0; - gboolean unicodeflag; + uint16_t pwlen = 0; + uint16_t sbloblen = 0, sbloblen_short; + uint16_t apwlen = 0, upwlen = 0; + bool unicodeflag; static int ntlmssp_tap_id = 0; const ntlmssp_header_t *ntlmssph; @@ -7545,7 +7552,7 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree if (!error_string) { ntlmssp_tap_id = find_tap_id("ntlmssp"); } else { - g_string_free(error_string, TRUE); + g_string_free(error_string, true); } } @@ -7554,7 +7561,7 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree WORD_COUNT; /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -7720,7 +7727,7 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree } /* OS - * Eventhough this field should honour the unicode flag + * Even though this field should honour the unicode flag * some ms clients gets this wrong. * At least XP SP1 sends this in ASCII * even when the unicode flag is on. @@ -7729,10 +7736,10 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree */ unicodeflag = si->unicode; if ( tvb_strneql(tvb, offset, "Win", 3) == 0 ) { - unicodeflag = FALSE; + unicodeflag = false; } an = get_unicode_or_ascii_string(tvb, &offset, - unicodeflag, &an_len, FALSE, FALSE, &bc); + unicodeflag, &an_len, false, false, &bc); if (an == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_os, tvb, @@ -7746,7 +7753,7 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree * suspect that, in practice, nobody ever looks at that field * because the bug didn't appear to get fixed until NT 5.0.... * - * Eventhough this field should honour the unicode flag + * Even though this field should honour the unicode flag * some ms clients gets this wrong. * At least XP SP1 sends this in ASCII * even when the unicode flag is on. @@ -7755,10 +7762,10 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree */ unicodeflag = si->unicode; if ( tvb_strneql(tvb, offset, "Win", 3) == 0 ) { - unicodeflag = FALSE; + unicodeflag = false; } an = get_unicode_or_ascii_string(tvb, &offset, - unicodeflag, &an_len, FALSE, FALSE, &bc); + unicodeflag, &an_len, false, false, &bc); if (an == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_lanman, tvb, @@ -7771,7 +7778,7 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree * ASCII and the account name is empty. Another bug? */ dn = get_unicode_or_ascii_string(tvb, &offset, - si->unicode, &dn_len, FALSE, FALSE, &bc); + si->unicode, &dn_len, false, false, &bc); if (dn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_primary_domain, tvb, @@ -7822,7 +7829,7 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree /* Account Name */ an = get_unicode_or_ascii_string(tvb, &offset, - si->unicode, &an_len, FALSE, FALSE, &bc); + si->unicode, &an_len, false, false, &bc); if (an == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_account, tvb, offset, an_len, @@ -7835,7 +7842,7 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree * ASCII and the account name is empty. Another bug? */ dn = get_unicode_or_ascii_string(tvb, &offset, - si->unicode, &dn_len, FALSE, FALSE, &bc); + si->unicode, &dn_len, false, false, &bc); if (dn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_primary_domain, tvb, @@ -7849,12 +7856,12 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree else col_append_fstr(pinfo->cinfo, COL_INFO, "%s\\%s", - format_text(wmem_packet_scope(), (const guchar*)dn, strlen(dn)), - format_text(wmem_packet_scope(), (const guchar*)an, strlen(an))); + format_text(wmem_packet_scope(), (const unsigned char*)dn, strlen(dn)), + format_text(wmem_packet_scope(), (const unsigned char*)an, strlen(an))); /* OS */ an = get_unicode_or_ascii_string(tvb, &offset, - si->unicode, &an_len, FALSE, FALSE, &bc); + si->unicode, &an_len, false, false, &bc); if (an == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_os, tvb, @@ -7869,7 +7876,7 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree * because the bug didn't appear to get fixed until NT 5.0.... */ an = get_unicode_or_ascii_string(tvb, &offset, - si->unicode, &an_len, FALSE, FALSE, &bc); + si->unicode, &an_len, false, false, &bc); if (an == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_lanman, tvb, @@ -7883,7 +7890,7 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree if (andxoffset < offset) { THROW(ReportedBoundsError); } - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } return offset; @@ -7892,9 +7899,9 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree static int dissect_session_setup_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { - guint8 wc, cmd = 0xff; - guint16 andxoffset = 0, bc; - guint16 sbloblen = 0; + uint8_t wc, cmd = 0xff; + uint16_t andxoffset = 0, bc; + uint16_t sbloblen = 0; int an_len; const char *an; @@ -7912,7 +7919,7 @@ dissect_session_setup_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tre } /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -7983,7 +7990,7 @@ dissect_session_setup_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tre /* OS */ an = get_unicode_or_ascii_string(tvb, &offset, - si->unicode, &an_len, FALSE, FALSE, &bc); + si->unicode, &an_len, false, false, &bc); if (an == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_os, tvb, @@ -7992,7 +7999,7 @@ dissect_session_setup_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tre /* LANMAN */ an = get_unicode_or_ascii_string(tvb, &offset, - si->unicode, &an_len, FALSE, FALSE, &bc); + si->unicode, &an_len, false, false, &bc); if (an == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_lanman, tvb, @@ -8002,7 +8009,7 @@ dissect_session_setup_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tre if ((wc == 3) || (wc == 4)) { /* Primary domain */ an = get_unicode_or_ascii_string(tvb, &offset, - si->unicode, &an_len, FALSE, FALSE, &bc); + si->unicode, &an_len, false, false, &bc); if (an == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_primary_domain, tvb, @@ -8016,7 +8023,7 @@ dissect_session_setup_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tre if (andxoffset < offset) { THROW(ReportedBoundsError); } - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } return offset; @@ -8026,14 +8033,14 @@ dissect_session_setup_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tre static int dissect_empty_andx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si _U_) { - guint8 wc, cmd = 0xff; - guint16 andxoffset = 0; - guint16 bc; + uint8_t wc, cmd = 0xff; + uint16_t andxoffset = 0; + uint16_t bc; WORD_COUNT; /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -8058,7 +8065,7 @@ dissect_empty_andx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offs if (andxoffset < offset) { THROW(ReportedBoundsError); } - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } return offset; @@ -8146,18 +8153,18 @@ dissect_connect_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset) static int dissect_tree_connect_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { - guint8 wc, cmd = 0xff; - guint16 bc; - guint16 andxoffset = 0, pwlen = 0; + uint8_t wc, cmd = 0xff; + uint16_t bc; + uint16_t andxoffset = 0, pwlen = 0; int an_len; - const guint8 *an; + const uint8_t *an; DISSECTOR_ASSERT(si); WORD_COUNT; /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -8192,7 +8199,7 @@ dissect_tree_connect_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree /* Path */ an = get_unicode_or_ascii_string(tvb, &offset, - si->unicode, &an_len, FALSE, FALSE, &bc); + si->unicode, &an_len, false, false, &bc); if (an == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_path, tvb, @@ -8208,7 +8215,7 @@ dissect_tree_connect_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree } col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(wmem_packet_scope(), (const guchar*)an, strlen(an))); + format_text(wmem_packet_scope(), (const unsigned char*)an, strlen(an))); /* * NOTE: the Service string is always ASCII, even if the @@ -8230,7 +8237,7 @@ dissect_tree_connect_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree if (andxoffset < offset) { THROW(ReportedBoundsError); } - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } return offset; @@ -8240,18 +8247,18 @@ dissect_tree_connect_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree static int dissect_tree_connect_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { - guint8 wc, cmd = 0xff; - guint16 andxoffset = 0; - guint16 bc; + uint8_t wc, cmd = 0xff; + uint16_t andxoffset = 0; + uint16_t bc; int an_len; - const guint8 *an; + const uint8_t *an; DISSECTOR_ASSERT(si); WORD_COUNT; /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -8351,7 +8358,7 @@ dissect_tree_connect_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree /* Native FS */ an = get_unicode_or_ascii_string(tvb, &offset, - si->unicode, &an_len, /*TRUE*/FALSE, FALSE, + si->unicode, &an_len, /*true*/false, false, &bc); if (an == NULL) goto endofcommand; @@ -8366,7 +8373,7 @@ dissect_tree_connect_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree if (andxoffset < offset) { THROW(ReportedBoundsError); } - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } return offset; @@ -8903,10 +8910,10 @@ dissect_security_information_mask(tvbuff_t *tvb, proto_tree *parent_tree, int of } int -dissect_nt_user_quota(tvbuff_t *tvb, proto_tree *tree, int offset, guint16 *bcp) +dissect_nt_user_quota(tvbuff_t *tvb, proto_tree *tree, int offset, uint16_t *bcp) { int old_offset, old_sid_offset; - guint32 qsize; + uint32_t qsize; do { old_offset = offset; @@ -8923,8 +8930,9 @@ dissect_nt_user_quota(tvbuff_t *tvb, proto_tree *tree, int offset, guint16 *bcp) /* change time */ CHECK_BYTE_COUNT_TRANS_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, - hf_smb_user_quota_change_time); + dissect_nttime(tvb, tree, offset, + hf_smb_user_quota_change_time, ENC_LITTLE_ENDIAN); + COUNT_BYTES_TRANS_SUBR(8); /* number of bytes for used quota */ CHECK_BYTE_COUNT_TRANS_SUBR(8); @@ -8957,10 +8965,10 @@ dissect_nt_user_quota(tvbuff_t *tvb, proto_tree *tree, int offset, guint16 *bcp) int -dissect_nt_get_user_quota(tvbuff_t *tvb, proto_tree *tree, int offset, guint32 *bcp) +dissect_nt_get_user_quota(tvbuff_t *tvb, proto_tree *tree, int offset, uint32_t *bcp) { int old_offset, old_sid_offset; - guint32 qsize; + uint32_t qsize; do { old_offset = offset; @@ -8991,11 +8999,11 @@ dissect_nt_get_user_quota(tvbuff_t *tvb, proto_tree *tree, int offset, guint32 * static int -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, guint32 sd_len, guint32 ea_len) +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) { proto_tree *tree; int old_offset = offset; - guint16 bcp = bc; /* XXX fixme */ + uint16_t bcp = bc; /* XXX fixme */ struct access_mask_info *ami = NULL; tvbuff_t *ioctl_tvb; @@ -9010,7 +9018,7 @@ dissect_nt_trans_data_request(tvbuff_t *tvb, packet_info *pinfo, int offset, pro /* security descriptor */ if (sd_len) { offset = dissect_nt_sec_desc( - tvb, offset, pinfo, tree, NULL, TRUE, + tvb, offset, pinfo, tree, NULL, true, sd_len, NULL); } @@ -9025,7 +9033,7 @@ dissect_nt_trans_data_request(tvbuff_t *tvb, packet_info *pinfo, int offset, pro /* ioctl data */ ioctl_tvb = tvb_new_subset_length_caplen(tvb, offset, MIN((int)bc, tvb_reported_length_remaining(tvb, offset)), bc); if (nti) { - dissect_smb2_ioctl_data(ioctl_tvb, pinfo, tree, top_tree_global, nti->ioctl_function, TRUE, NULL); + dissect_smb2_ioctl_data(ioctl_tvb, pinfo, tree, top_tree_global, nti->ioctl_function, true, NULL); } offset += bc; @@ -9044,7 +9052,7 @@ dissect_nt_trans_data_request(tvbuff_t *tvb, packet_info *pinfo, int offset, pro } offset = dissect_nt_sec_desc( - tvb, offset, pinfo, tree, NULL, TRUE, bc, ami); + tvb, offset, pinfo, tree, NULL, true, bc, ami); if (offset < (old_offset + bc)) { offset = old_offset + bc; @@ -9086,10 +9094,10 @@ dissect_nt_trans_data_request(tvbuff_t *tvb, packet_info *pinfo, int offset, pro } static int -dissect_nt_trans_param_request(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *parent_tree, int len, guint16 bc, smb_nt_transact_info_t *nti, smb_info_t *si, int subcmd, guint32 *sd_len, guint32 *ea_len) +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) { proto_tree *tree; - guint32 fn_len, create_flags, access_mask, share_access, create_options; + uint32_t fn_len, create_flags, access_mask, share_access, create_options; const char *fn; DISSECTOR_ASSERT(si); @@ -9145,7 +9153,7 @@ dissect_nt_trans_param_request(tvbuff_t *tvb, packet_info *pinfo, int offset, pr COUNT_BYTES(4); /* file name len */ - fn_len = (guint32)tvb_get_letohl(tvb, offset); + fn_len = (uint32_t)tvb_get_letohl(tvb, offset); proto_tree_add_uint(tree, hf_smb_file_name_len, tvb, offset, 4, fn_len); COUNT_BYTES(4); @@ -9165,7 +9173,7 @@ dissect_nt_trans_param_request(tvbuff_t *tvb, packet_info *pinfo, int offset, pr } /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, TRUE, TRUE, &bc); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, true, true, &bc); if (fn != NULL) { proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); @@ -9176,12 +9184,12 @@ dissect_nt_trans_param_request(tvbuff_t *tvb, packet_info *pinfo, int offset, pr case NT_TRANS_IOCTL: break; case NT_TRANS_SSD: { - guint16 fid; + uint16_t fid; smb_fid_info_t *fid_info; /* fid */ fid = tvb_get_letohs(tvb, offset); - fid_info = dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + fid_info = dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; if (nti) { if (fid_info) { @@ -9205,12 +9213,12 @@ dissect_nt_trans_param_request(tvbuff_t *tvb, packet_info *pinfo, int offset, pr /* XXX not documented */ break; case NT_TRANS_QSD: { - guint16 fid; + uint16_t fid; smb_fid_info_t *fid_info; /* fid */ fid = tvb_get_letohs(tvb, offset); - fid_info = dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + fid_info = dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; if (nti) { if (fid_info) { @@ -9261,14 +9269,14 @@ dissect_nt_trans_setup_request(tvbuff_t *tvb, packet_info *pinfo, int offset, pr offset += len; break; case NT_TRANS_IOCTL: { - guint16 fid; + uint16_t fid; /* function code */ offset = dissect_smb2_ioctl_function(tvb, pinfo, tree, offset, nti ? &nti->ioctl_function : NULL); /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; /* isfsctl */ @@ -9284,14 +9292,14 @@ dissect_nt_trans_setup_request(tvbuff_t *tvb, packet_info *pinfo, int offset, pr offset += len; break; case NT_TRANS_NOTIFY: { - guint16 fid; + uint16_t fid; /* completion filter */ offset = dissect_nt_notify_completion_filter(tvb, tree, offset); /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; /* watch tree */ @@ -9327,18 +9335,18 @@ dissect_nt_trans_setup_request(tvbuff_t *tvb, packet_info *pinfo, int offset, pr static int dissect_nt_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc, sc; - guint32 pc = 0, pd = 0, po = 0, dc = 0, od = 0, dd = 0; - guint32 td = 0, tp = 0; + uint8_t wc, sc; + uint32_t pc = 0, pd = 0, po = 0, dc = 0, od = 0, dd = 0; + uint32_t td = 0, tp = 0; smb_saved_info_t *sip; int subcmd; - guint32 sd_len, ea_len; - guint16 bc; - guint32 padcnt; + uint32_t sd_len, ea_len; + uint16_t bc; + uint32_t padcnt; smb_nt_transact_info_t *nti = NULL; fragment_head *r_fd = NULL; tvbuff_t *pd_tvb = NULL; - gboolean save_fragmented; + bool save_fragmented; save_fragmented = pinfo->fragmented; @@ -9432,7 +9440,7 @@ dissect_nt_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* setup count */ if (wc >= 19) { /* primary request */ - sc = tvb_get_guint8(tvb, offset); + sc = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_smb_setup_count, tvb, offset, 1, sc); offset += 1; } else { @@ -9504,7 +9512,7 @@ dissect_nt_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* oh yeah, either data or parameter section needs reassembly... */ - pinfo->fragmented = TRUE; + pinfo->fragmented = true; if (smb_trans_reassembly) { /* ...and we were told to do reassembly */ if (pc) { @@ -9533,7 +9541,7 @@ dissect_nt_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if (pd_tvb) { /* we have reassembled data, grab param and data from there */ dissect_nt_trans_param_request(pd_tvb, pinfo, 0, tree, tp, - (guint16) tvb_reported_length(pd_tvb), + (uint16_t) tvb_reported_length(pd_tvb), nti, si, subcmd, &sd_len, &ea_len); dissect_nt_trans_data_request(pd_tvb, pinfo, tp, tree, td, nti, si, subcmd, sd_len, ea_len); @@ -9542,7 +9550,7 @@ dissect_nt_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* we do not have reassembled data, just use what we have in the packet as well as we can */ /* parameters */ - if (po > (guint32)offset) { + if (po > (uint32_t)offset) { /* We have some initial padding bytes. */ padcnt = po-offset; @@ -9560,7 +9568,7 @@ dissect_nt_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr } /* data */ - if (od > (guint32)offset) { + if (od > (uint32_t)offset) { /* We have some initial padding bytes. */ padcnt = od-offset; @@ -9591,7 +9599,7 @@ dissect_nt_trans_data_response(tvbuff_t *tvb, packet_info *pinfo, smb_nt_transact_info_t *nti, smb_info_t *si) { proto_tree *tree = NULL; - guint16 bcp; + uint16_t bcp; struct access_mask_info *ami = NULL; tvbuff_t *ioctl_tvb; @@ -9622,7 +9630,7 @@ dissect_nt_trans_data_response(tvbuff_t *tvb, packet_info *pinfo, case NT_TRANS_IOCTL: /* ioctl data */ ioctl_tvb = tvb_new_subset_length_caplen(tvb, offset, MIN((int)len, tvb_reported_length_remaining(tvb, offset)), len); - dissect_smb2_ioctl_data(ioctl_tvb, pinfo, tree, top_tree_global, nti->ioctl_function, FALSE, NULL); + dissect_smb2_ioctl_data(ioctl_tvb, pinfo, tree, top_tree_global, nti->ioctl_function, false, NULL); offset += len; @@ -9646,7 +9654,7 @@ dissect_nt_trans_data_response(tvbuff_t *tvb, packet_info *pinfo, } } offset = dissect_nt_sec_desc( - tvb, offset, pinfo, tree, NULL, TRUE, len, ami); + tvb, offset, pinfo, tree, NULL, true, len, ami); break; case NT_TRANS_GET_USER_QUOTA: bcp = len; @@ -9663,20 +9671,20 @@ dissect_nt_trans_data_response(tvbuff_t *tvb, packet_info *pinfo, static int dissect_nt_trans_param_response(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *parent_tree, - int len, guint16 bc, smb_info_t *si) + int len, uint16_t bc, smb_info_t *si) { proto_tree *tree = NULL; - guint32 fn_len; + uint32_t fn_len; const char *fn; smb_nt_transact_info_t *nti; - guint16 fid; + uint16_t fid; int old_offset; - guint32 neo; + uint32_t neo; int padcnt; smb_fid_info_t *fid_info = NULL; - guint16 ftype; - guint8 isdir; - guint8 ext_resp = 0; + uint16_t ftype; + uint8_t isdir; + uint8_t ext_resp = 0; DISSECTOR_ASSERT(si); @@ -9711,13 +9719,13 @@ dissect_nt_trans_param_response(tvbuff_t *tvb, packet_info *pinfo, offset += 1; /* response type, as per MS-SMB 2.2.7.1.2 */ - ext_resp = tvb_get_guint8(tvb, offset); + ext_resp = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_smb_response_type, tvb, offset, 1, ENC_NA); offset += 1; /* fid */ fid = tvb_get_letohs(tvb, offset); - fid_info = dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, TRUE, FALSE, FALSE, si); + fid_info = dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, true, false, false, si); offset += 2; /* create action */ @@ -9729,20 +9737,24 @@ dissect_nt_trans_param_response(tvbuff_t *tvb, packet_info *pinfo, offset += 4; /* create time */ - offset = dissect_nt_64bit_time(tvb, tree, offset, - hf_smb_create_time); + dissect_nttime(tvb, tree, offset, + hf_smb_create_time, ENC_LITTLE_ENDIAN); + offset += 8; /* access time */ - offset = dissect_nt_64bit_time(tvb, tree, offset, - hf_smb_access_time); + dissect_nttime(tvb, tree, offset, + hf_smb_access_time, ENC_LITTLE_ENDIAN); + offset += 8; /* last write time */ - offset = dissect_nt_64bit_time(tvb, tree, offset, - hf_smb_last_write_time); + dissect_nttime(tvb, tree, offset, + hf_smb_last_write_time, ENC_LITTLE_ENDIAN); + offset += 8; /* last change time */ - offset = dissect_nt_64bit_time(tvb, tree, offset, - hf_smb_change_time); + dissect_nttime(tvb, tree, offset, + hf_smb_change_time, ENC_LITTLE_ENDIAN); + offset += 8; /* Extended File Attributes */ offset = dissect_file_ext_attr(tvb, tree, offset); @@ -9761,10 +9773,10 @@ dissect_nt_trans_param_response(tvbuff_t *tvb, packet_info *pinfo, offset += 2; /* device state */ - offset = dissect_ipc_state(tvb, tree, offset, FALSE); + offset = dissect_ipc_state(tvb, tree, offset, false); /* is directory */ - isdir = tvb_get_guint8(tvb, offset); + isdir = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_smb_is_directory, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; @@ -9837,7 +9849,7 @@ dissect_nt_trans_param_response(tvbuff_t *tvb, packet_info *pinfo, if (len < 0) break; /* file name len */ - fn_len = (guint32)tvb_get_letohl(tvb, offset); + fn_len = (uint32_t)tvb_get_letohl(tvb, offset); proto_tree_add_uint(tree, hf_smb_file_name_len, tvb, offset, 4, fn_len); COUNT_BYTES(4); len -= 4; @@ -9845,7 +9857,7 @@ dissect_nt_trans_param_response(tvbuff_t *tvb, packet_info *pinfo, if (len < 0) break; /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, TRUE, TRUE, &bc); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, true, true, &bc); if (fn == NULL) break; proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, @@ -9962,15 +9974,15 @@ dissect_nt_trans_setup_response(tvbuff_t *tvb, packet_info *pinfo, static int dissect_nt_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc, sc; - guint32 pc = 0, po = 0, pd = 0, dc = 0, od = 0, dd = 0; - guint32 td = 0, tp = 0; + uint8_t wc, sc; + uint32_t pc = 0, po = 0, pd = 0, dc = 0, od = 0, dd = 0; + uint32_t td = 0, tp = 0; smb_nt_transact_info_t *nti = NULL; - guint16 bc; - gint32 padcnt; + uint16_t bc; + int32_t padcnt; fragment_head *r_fd = NULL; tvbuff_t *pd_tvb = NULL; - gboolean save_fragmented; + bool save_fragmented; DISSECTOR_ASSERT(si); @@ -10037,7 +10049,7 @@ dissect_nt_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t offset += 4; /* setup count */ - sc = tvb_get_guint8(tvb, offset); + sc = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_smb_setup_count, tvb, offset, 1, sc); offset += 1; @@ -10059,7 +10071,7 @@ dissect_nt_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t /* oh yeah, either data or parameter section needs reassembly... */ - pinfo->fragmented = TRUE; + pinfo->fragmented = true; if (smb_trans_reassembly) { /* ...and we were told to do reassembly */ if (pc) { @@ -10090,14 +10102,14 @@ dissect_nt_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t if (pd_tvb) { /* we have reassembled data, grab param and data from there */ dissect_nt_trans_param_response(pd_tvb, pinfo, 0, tree, tp, - (guint16) tvb_reported_length(pd_tvb), si); + (uint16_t) tvb_reported_length(pd_tvb), si); dissect_nt_trans_data_response(pd_tvb, pinfo, tp, tree, td, nti, si); COUNT_BYTES(bc); /* We are done */ } else { /* we do not have reassembled data, just use what we have in the packet as well as we can */ /* parameters */ - if (po > (guint32)offset) { + if (po > (uint32_t)offset) { /* We have some initial padding bytes. */ padcnt = po-offset; @@ -10114,7 +10126,7 @@ dissect_nt_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t } /* data */ - if (od > (guint32)offset) { + if (od > (uint32_t)offset) { /* We have some initial padding bytes. */ padcnt = od-offset; @@ -10151,8 +10163,8 @@ dissect_open_print_file_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre { int fn_len; const char *fn; - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; DISSECTOR_ASSERT(si); @@ -10174,7 +10186,7 @@ dissect_open_print_file_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre COUNT_BYTES(1); /* print identifier */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, TRUE, FALSE, &bc); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, true, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_print_identifier, tvb, offset, fn_len, @@ -10191,14 +10203,14 @@ static int 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) { int cnt; - guint8 wc; - guint16 bc, fid; + uint8_t wc; + uint16_t bc, fid; WORD_COUNT; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; BYTE_COUNT; @@ -10215,7 +10227,7 @@ dissect_write_print_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree * COUNT_BYTES(2); /* file data */ - offset = dissect_file_data(tvb, tree, offset, (guint16) cnt, -1, (guint16) cnt); + offset = dissect_file_data(tvb, tree, offset, (uint16_t) cnt, -1, (uint16_t) cnt); END_OF_SMB @@ -10236,8 +10248,8 @@ static const value_string print_status_vals[] = { static int 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_) { - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; WORD_COUNT; @@ -10258,7 +10270,7 @@ dissect_get_print_queue_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre static int dissect_print_queue_element(tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *parent_tree, int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) + proto_tree *parent_tree, int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { proto_tree *tree; int fn_len; @@ -10273,7 +10285,7 @@ dissect_print_queue_element(tvbuff_t *tvb, packet_info *pinfo _U_, CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_print_queue_date, - hf_smb_print_queue_dos_date, hf_smb_print_queue_dos_time, FALSE); + hf_smb_print_queue_dos_date, hf_smb_print_queue_dos_time, false); *bcp -= 4; /* status */ @@ -10298,23 +10310,23 @@ dissect_print_queue_element(tvbuff_t *tvb, packet_info *pinfo _U_, /* file name */ fn_len = 16; - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, TRUE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, true, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string(tree, hf_smb_print_spool_file_name, tvb, offset, 16, fn); COUNT_BYTES_SUBR(fn_len); - *trunc = FALSE; + *trunc = false; return offset; } static int 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_) { - guint16 cnt = 0, len; - guint8 wc; - guint16 bc; - gboolean trunc; + uint16_t cnt = 0, len; + uint8_t wc; + uint16_t bc; + bool trunc; WORD_COUNT; @@ -10358,9 +10370,9 @@ static int 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_) { int name_len; - guint16 bc; - guint8 wc; - guint16 message_len; + uint16_t bc; + uint8_t wc; + uint16_t message_len; WORD_COUNT; @@ -10419,8 +10431,8 @@ static int 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_) { int name_len; - guint16 bc; - guint8 wc; + uint16_t bc; + uint8_t wc; WORD_COUNT; @@ -10460,8 +10472,8 @@ dissect_send_multi_block_message_start_request(tvbuff_t *tvb, packet_info *pinfo static int 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_) { - guint16 bc; - guint8 wc; + uint16_t bc; + uint8_t wc; WORD_COUNT; @@ -10479,9 +10491,9 @@ dissect_message_group_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree static int 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_) { - guint16 bc; - guint8 wc; - guint16 message_len; + uint16_t bc; + uint8_t wc; + uint16_t message_len; WORD_COUNT; @@ -10514,8 +10526,8 @@ static int 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_) { int name_len; - guint16 bc; - guint8 wc; + uint16_t bc; + uint8_t wc; WORD_COUNT; @@ -10543,8 +10555,8 @@ static int 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_) { int name_len; - guint16 bc; - guint8 wc; + uint16_t bc; + uint8_t wc; WORD_COUNT; @@ -10572,20 +10584,20 @@ dissect_get_machine_name_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_t static int 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_) { - guint8 wc, cmd = 0xff; - guint16 andxoffset = 0; - guint16 bc; + uint8_t wc, cmd = 0xff; + uint16_t andxoffset = 0; + uint16_t bc; int fn_len = -1; const char *fn; - guint32 create_flags = 0, access_mask = 0, file_attributes = 0; - guint32 share_access = 0, create_options = 0, create_disposition = 0; + uint32_t create_flags = 0, access_mask = 0, file_attributes = 0; + uint32_t share_access = 0, create_options = 0, create_disposition = 0; DISSECTOR_ASSERT(si); WORD_COUNT; /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -10664,7 +10676,7 @@ dissect_nt_create_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr tvb, 0, 0); goto endofcommand; } - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, FALSE, &bc); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, false, &bc); if (fn == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, @@ -10691,14 +10703,14 @@ dissect_nt_create_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr } col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); END_OF_SMB if (cmd != 0xff) { /* there is an andX command */ if (andxoffset < offset) THROW(ReportedBoundsError); - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } return offset; @@ -10708,18 +10720,18 @@ dissect_nt_create_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr static int dissect_nt_create_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si) { - guint8 wc, cmd = 0xff; - guint16 andxoffset = 0; - guint16 bc; - guint16 fid = 0; - guint16 ftype; - guint8 isdir; + uint8_t wc, cmd = 0xff; + uint16_t andxoffset = 0; + uint16_t bc; + uint16_t fid = 0; + uint16_t ftype; + uint8_t isdir; smb_fid_info_t *fid_info = NULL; WORD_COUNT; /* next smb command */ - cmd = tvb_get_guint8(tvb, offset); + cmd = tvb_get_uint8(tvb, offset); if (cmd != 0xff) { proto_tree_add_uint(tree, hf_smb_andxcmd, tvb, offset, 1, cmd); } else { @@ -10742,7 +10754,7 @@ dissect_nt_create_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t /* fid */ fid = tvb_get_letohs(tvb, offset); - fid_info = dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, TRUE, FALSE, FALSE, si); + fid_info = dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, true, false, false, si); offset += 2; /* create action */ @@ -10752,17 +10764,21 @@ dissect_nt_create_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t offset += 4; /* create time */ - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_create_time); + dissect_nttime(tvb, tree, offset, hf_smb_create_time, ENC_LITTLE_ENDIAN); + offset += 8; /* access time */ - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_access_time); + dissect_nttime(tvb, tree, offset, hf_smb_access_time, ENC_LITTLE_ENDIAN); + offset += 8; /* last write time */ - offset = dissect_nt_64bit_time(tvb, tree, offset, - hf_smb_last_write_time); + dissect_nttime(tvb, tree, offset, + hf_smb_last_write_time, ENC_LITTLE_ENDIAN); + offset += 8; /* last change time */ - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_change_time); + dissect_nttime(tvb, tree, offset, hf_smb_change_time, ENC_LITTLE_ENDIAN); + offset += 8; /* Extended File Attributes */ offset = dissect_file_ext_attr(tvb, tree, offset); @@ -10785,10 +10801,10 @@ dissect_nt_create_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t offset += 2; /* IPC State */ - offset = dissect_ipc_state(tvb, tree, offset, FALSE); + offset = dissect_ipc_state(tvb, tree, offset, false); /* is directory */ - isdir = tvb_get_guint8(tvb, offset); + isdir = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_smb_is_directory, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; @@ -10850,12 +10866,12 @@ dissect_nt_create_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t if (cmd != 0xff) { /* there is an andX command */ if (andxoffset < offset) THROW(ReportedBoundsError); - dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, FALSE, si); + dissect_smb_command(tvb, pinfo, andxoffset, smb_tree, cmd, false, si); } /* if there was an error, add a generated filename to the tree */ if (si->nt_status) { - dissect_smb_fid(tvb, pinfo, tree, 0, 0, fid, TRUE, TRUE, TRUE, si); + dissect_smb_fid(tvb, pinfo, tree, 0, 0, fid, true, true, true, si); } return offset; @@ -10865,8 +10881,8 @@ dissect_nt_create_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t static int 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_) { - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; WORD_COUNT; @@ -10936,7 +10952,7 @@ static const true_false_string tfs_ff2_close = { }; /* used by - TRANS2_FIND_FIRST2 + TRANS2_FIND_FIRST2 and TRANS2_FIND_NEXT2 */ static const value_string ff2_il_vals[] = { { 1, "Info Standard"}, @@ -11285,7 +11301,7 @@ static const true_false_string tfs_fs_attr_ssv = { static int dissect_ff2_flags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, smb_info_t *si) { - guint16 mask; + uint16_t mask; smb_transact2_info_t *t2i; static int * const flags[] = { &hf_smb_ff2_backup, @@ -11333,11 +11349,11 @@ dissect_sfi_ioflag(tvbuff_t *tvb, proto_tree *parent_tree, int offset) int dissect_get_dfs_request_data(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree, int offset, guint16 *bcp, gboolean unicode) + proto_tree *tree, int offset, uint16_t *bcp, bool unicode) { int fn_len; const char *fn; - guint16 bc = *bcp; + uint16_t bc = *bcp; /* referral level */ CHECK_BYTE_COUNT_TRANS(2); @@ -11345,14 +11361,14 @@ dissect_get_dfs_request_data(tvbuff_t *tvb, packet_info *pinfo, COUNT_BYTES_TRANS(2); /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, unicode, &fn_len, FALSE, FALSE, &bc); + fn = get_unicode_or_ascii_string(tvb, &offset, unicode, &fn_len, false, false, &bc); CHECK_STRING_TRANS(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_TRANS(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); *bcp = bc; return offset; @@ -11360,12 +11376,13 @@ dissect_get_dfs_request_data(tvbuff_t *tvb, packet_info *pinfo, static int dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *parent_tree, int offset, int subcmd, guint16 bc, smb_info_t *si) + proto_tree *parent_tree, int offset, int subcmd, uint16_t bc, smb_info_t *si) { proto_tree *tree; smb_transact2_info_t *t2i; int fn_len; const char *fn; + uint32_t search_id; DISSECTOR_ASSERT(si); @@ -11406,7 +11423,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_create_time, hf_smb_create_dos_date, hf_smb_create_dos_time, - TRUE); + true); bc -= 4; /* open function */ @@ -11425,14 +11442,14 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, COUNT_BYTES_TRANS(10); /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, FALSE, &bc); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, false, &bc); CHECK_STRING_TRANS(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_TRANS(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); break; case 0x0001: /*TRANS2_FIND_FIRST2*/ /* Search Attributes */ @@ -11442,7 +11459,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, /* search count */ CHECK_BYTE_COUNT_TRANS(2); - proto_tree_add_item(tree, hf_smb_search_count, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_smb_search_count_max, tvb, offset, 2, ENC_LITTLE_ENDIAN); COUNT_BYTES_TRANS(2); /* Find First2 flags */ @@ -11464,7 +11481,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, COUNT_BYTES_TRANS(4); /* search pattern */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, FALSE, &bc); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, false, &bc); CHECK_STRING_TRANS(fn); if (t2i && !t2i->name) { t2i->name = wmem_strdup(wmem_file_scope(), fn); @@ -11474,18 +11491,22 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, COUNT_BYTES_TRANS(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Pattern: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", + val_to_str(si->info_level, ff2_il_vals, "Unknown (0x%02x)")); break; case 0x0002: /*TRANS2_FIND_NEXT2*/ /* sid */ CHECK_BYTE_COUNT_TRANS(2); - proto_tree_add_item(tree, hf_smb_search_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item_ret_uint(tree, hf_smb_search_id, tvb, offset, 2, + ENC_LITTLE_ENDIAN, &search_id); + col_append_fstr(pinfo->cinfo, COL_INFO, ", Search ID: %u", (uint16_t)search_id); COUNT_BYTES_TRANS(2); /* search count */ CHECK_BYTE_COUNT_TRANS(2); - proto_tree_add_item(tree, hf_smb_search_count, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_smb_search_count_max, tvb, offset, 2, ENC_LITTLE_ENDIAN); COUNT_BYTES_TRANS(2); /* Find First2 information level */ @@ -11496,6 +11517,9 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_uint(tree, hf_smb_ff2_information_level, tvb, offset, 2, si->info_level); COUNT_BYTES_TRANS(2); + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", + val_to_str(si->info_level, ff2_il_vals, "Unknown (0x%02x)")); + /* resume key */ CHECK_BYTE_COUNT_TRANS(4); proto_tree_add_item(tree, hf_smb_resume, tvb, offset, 4, ENC_LITTLE_ENDIAN); @@ -11507,15 +11531,18 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, bc -= 2; /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, FALSE, &bc); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, false, &bc); CHECK_STRING_TRANS(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_TRANS(fn_len); - col_append_fstr(pinfo->cinfo, COL_INFO, ", Continue: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); - + if (strlen(fn)) { + col_append_fstr(pinfo->cinfo, COL_INFO, ", Continue after: %s", + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); + } else { + col_append_fstr(pinfo->cinfo, COL_INFO, ", Continue after previous file"); + } break; case 0x0003: /*TRANS2_QUERY_FS_INFORMATION*/ /* level of interest */ @@ -11576,7 +11603,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, } col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); break; case 0x0006: /*TRANS2_SET_PATH_INFORMATION*/ @@ -11594,23 +11621,23 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, COUNT_BYTES_TRANS(4); /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, FALSE, &bc); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, false, &bc); CHECK_STRING_TRANS(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_TRANS(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); break; case 0x0007: { /*TRANS2_QUERY_FILE_INFORMATION*/ - guint16 fid; + uint16_t fid; /* fid */ CHECK_BYTE_COUNT_TRANS(2); fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); COUNT_BYTES_TRANS(2); /* level of interest */ @@ -11629,12 +11656,12 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, break; } case 0x0008: { /*TRANS2_SET_FILE_INFORMATION*/ - guint16 fid; + uint16_t fid; /* fid */ CHECK_BYTE_COUNT_TRANS(2); fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); COUNT_BYTES_TRANS(2); /* level of interest */ @@ -11720,14 +11747,14 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, COUNT_BYTES_TRANS(4); /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, FALSE, &bc); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, false, &bc); CHECK_STRING_TRANS(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_TRANS(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); break; case 0x000c: /*TRANS2_FIND_NOTIFY_NEXT*/ @@ -11750,14 +11777,14 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, /* dir name */ fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, - FALSE, FALSE, &bc); + false, false, &bc); CHECK_STRING_TRANS(fn); proto_tree_add_string(tree, hf_smb_dir_name, tvb, offset, fn_len, fn); COUNT_BYTES_TRANS(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Dir: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); break; case 0x000e: /*TRANS2_SESSION_SETUP*/ /* XXX unknown structure*/ @@ -11767,14 +11794,14 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, break; case 0x0011: /*TRANS2_REPORT_DFS_INCONSISTENCY*/ /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, FALSE, &bc); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, false, &bc); CHECK_STRING_TRANS(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_TRANS(fn_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); break; } @@ -11790,10 +11817,10 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, /* * XXX - just use "dissect_connect_flags()" here? */ -static guint16 +static uint16_t dissect_transaction_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset) { - guint16 mask; + uint16_t mask; static int * const flags[] = { &hf_smb_transaction_flags_owt, &hf_smb_transaction_flags_dtid, @@ -11842,14 +11869,14 @@ dissect_dfs_referral_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset) */ static int dissect_dfs_inconsistency_data(tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *tree, int offset, guint16 *bcp, smb_info_t *si) + proto_tree *tree, int offset, uint16_t *bcp, smb_info_t *si) { int fn_len; const char *fn; DISSECTOR_ASSERT(si); - /*XXX shouldn this data hold version and size? unclear from doc*/ + /*XXX should this data hold version and size? unclear from doc*/ /* referral version */ CHECK_BYTE_COUNT_TRANS_SUBR(2); proto_tree_add_item(tree, hf_smb_dfs_referral_version, tvb, offset, 2, ENC_LITTLE_ENDIAN); @@ -11871,7 +11898,7 @@ dissect_dfs_inconsistency_data(tvbuff_t *tvb, packet_info *pinfo _U_, *bcp -= 2; /* node name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, FALSE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, false, bcp); CHECK_STRING_TRANS_SUBR(fn); proto_tree_add_string(tree, hf_smb_dfs_referral_node, tvb, offset, fn_len, fn); @@ -11883,7 +11910,7 @@ dissect_dfs_inconsistency_data(tvbuff_t *tvb, packet_info *pinfo _U_, static int dissect_dfs_referral_strings(tvbuff_t *tvb, proto_tree *tree, int hfindex, int nstring, int stroffset, int oldoffset, int offset, - guint16 bc, gboolean unicode, int *end) + uint16_t bc, bool unicode, int *end) { int istring; const char *str; @@ -11894,8 +11921,8 @@ dissect_dfs_referral_strings(tvbuff_t *tvb, proto_tree *tree, int hfindex, bc -= (stroffset - offset); for (istring = 0; istring < nstring; istring++) { - if ((gint16)bc > 0) { - str = get_unicode_or_ascii_string(tvb, &stroffset, unicode, &str_len, FALSE, FALSE, &bc); + if ((int16_t)bc > 0) { + str = get_unicode_or_ascii_string(tvb, &stroffset, unicode, &str_len, false, false, &bc); CHECK_STRING_TRANS_SUBR(str); proto_tree_add_string(tree, hfindex, tvb, stroffset, str_len, str); stroffset += str_len; @@ -11912,7 +11939,7 @@ dissect_dfs_referral_strings(tvbuff_t *tvb, proto_tree *tree, int hfindex, static int dissect_dfs_referral_string(tvbuff_t *tvb, proto_tree *tree, int hfindex, int stroffset, int oldoffset, int offset, - guint16 bc, gboolean unicode, int *end) + uint16_t bc, bool unicode, int *end) { return dissect_dfs_referral_strings(tvb, tree, hfindex, 1, stroffset, oldoffset, offset, @@ -11921,12 +11948,12 @@ dissect_dfs_referral_string(tvbuff_t *tvb, proto_tree *tree, int hfindex, static int dissect_dfs_referral_entry_v2(tvbuff_t *tvb, proto_tree *tree, int oldoffset, int offset, - guint16 refflags _U_, guint16 *bcp, gboolean unicode, int *ucstring_end) + uint16_t refflags _U_, uint16_t *bcp, bool unicode, int *ucstring_end) { - guint16 pathoffset; - guint16 altpathoffset; - guint16 nodeoffset; + uint16_t pathoffset; + uint16_t altpathoffset; + uint16_t nodeoffset; /* proximity */ CHECK_BYTE_COUNT_TRANS_SUBR(4); @@ -11984,14 +12011,14 @@ dissect_dfs_referral_entry_v2(tvbuff_t *tvb, proto_tree *tree, int oldoffset, in static int dissect_dfs_referral_entry_v3(tvbuff_t *tvb, proto_tree *tree, int oldoffset, int offset, - guint16 refflags, guint16 *bcp, gboolean unicode, int *ucstring_end) + uint16_t refflags, uint16_t *bcp, bool unicode, int *ucstring_end) { - guint16 domoffset; - guint16 nexpnames; - guint16 expoffset; - guint16 pathoffset; - guint16 altpathoffset; - guint16 nodeoffset; + uint16_t domoffset; + uint16_t nexpnames; + uint16_t expoffset; + uint16_t pathoffset; + uint16_t altpathoffset; + uint16_t nodeoffset; /* ttl */ CHECK_BYTE_COUNT_TRANS_SUBR(4); @@ -12091,11 +12118,11 @@ dissect_dfs_referral_entry_v3(tvbuff_t *tvb, proto_tree *tree, int oldoffset, in */ int dissect_get_dfs_referral_data(tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *tree, int offset, guint16 *bcp, gboolean unicode) + proto_tree *tree, int offset, uint16_t *bcp, bool unicode) { - guint16 numref; - guint16 refsize; - guint16 refflags; + uint16_t numref; + uint16_t refsize; + uint16_t refflags; int fn_len; const char *fn; int unklen; @@ -12139,7 +12166,7 @@ dissect_get_dfs_referral_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_item *ri; proto_tree *rt; int old_offset_2 = offset; - guint16 version; + uint16_t version; rt = proto_tree_add_subtree(ref_tree, tvb, offset, *bcp, ett_smb_dfs_referral, &ri, "Referral"); @@ -12172,7 +12199,7 @@ dissect_get_dfs_referral_data(tvbuff_t *tvb, packet_info *pinfo _U_, case 1: /* node name */ - fn = get_unicode_or_ascii_string(tvb, &offset, unicode, &fn_len, FALSE, FALSE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, unicode, &fn_len, false, false, bcp); CHECK_STRING_TRANS_SUBR(fn); proto_tree_add_string(rt, hf_smb_dfs_referral_node, tvb, offset, fn_len, fn); @@ -12239,30 +12266,30 @@ dissect_get_dfs_referral_data(tvbuff_t *tvb, packet_info *pinfo _U_, static int dissect_smb_standard_8byte_timestamps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* create time */ CHECK_BYTE_COUNT_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_create_time); - *bcp -= 8; + dissect_nttime(tvb, tree, offset, hf_smb_create_time, ENC_LITTLE_ENDIAN); + COUNT_BYTES_SUBR(8); /* access time */ CHECK_BYTE_COUNT_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_access_time); - *bcp -= 8; + dissect_nttime(tvb, tree, offset, hf_smb_access_time, ENC_LITTLE_ENDIAN); + COUNT_BYTES_SUBR(8); /* last write time */ CHECK_BYTE_COUNT_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, - hf_smb_last_write_time); - *bcp -= 8; + dissect_nttime(tvb, tree, offset, + hf_smb_last_write_time, ENC_LITTLE_ENDIAN); + COUNT_BYTES_SUBR(8); /* last change time */ CHECK_BYTE_COUNT_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_change_time); - *bcp -= 8; + dissect_nttime(tvb, tree, offset, hf_smb_change_time, ENC_LITTLE_ENDIAN); + COUNT_BYTES_SUBR(8); - *trunc = FALSE; + *trunc = false; return offset; } @@ -12276,27 +12303,27 @@ dissect_smb_standard_8byte_timestamps(tvbuff_t *tvb, */ static int dissect_qsfi_SMB_INFO_STANDARD(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* create time */ CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_create_time, hf_smb_create_dos_date, hf_smb_create_dos_time, - FALSE); + false); *bcp -= 4; /* access time */ CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_access_time, hf_smb_access_dos_date, hf_smb_access_dos_time, - FALSE); + false); *bcp -= 4; /* last write time */ CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_last_write_time, hf_smb_last_write_dos_date, hf_smb_last_write_dos_time, - FALSE); + false); *bcp -= 4; /* data size */ @@ -12344,7 +12371,7 @@ dissect_qsfi_SMB_INFO_STANDARD(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree COUNT_BYTES_SUBR(4); } - *trunc = FALSE; + *trunc = false; return offset; } @@ -12354,27 +12381,27 @@ dissect_qsfi_SMB_INFO_STANDARD(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree */ static int dissect_qfi_SMB_INFO_QUERY_EA_SIZE(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* create time */ CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_create_time, hf_smb_create_dos_date, hf_smb_create_dos_time, - FALSE); + false); *bcp -= 4; /* access time */ CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_access_time, hf_smb_access_dos_date, hf_smb_access_dos_time, - FALSE); + false); *bcp -= 4; /* last write time */ CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_last_write_time, hf_smb_last_write_dos_date, hf_smb_last_write_dos_time, - FALSE); + false); *bcp -= 4; /* data size */ @@ -12397,19 +12424,20 @@ dissect_qfi_SMB_INFO_QUERY_EA_SIZE(tvbuff_t *tvb, packet_info *pinfo _U_, proto_ proto_tree_add_item(tree, hf_smb_ea_list_length, tvb, offset, 4, ENC_LITTLE_ENDIAN); COUNT_BYTES_SUBR(4); - *trunc = FALSE; + *trunc = false; return offset; } -/* this dissects the SMB_INFO_QUERY_EAS_FROM_LIST and SMB_INFO_QUERY_ALL_EAS - as described in 4.2.16.2 +/* this dissects the SMB_INFO_QUERY_EAS_FROM_LIST, SMB_INFO_QUERY_ALL_EAS, +* and TRANS2_SET_FILE_INFORMATION as described in 4.2.16.2 and +* [MS-CIFS] 2.2.6.9. This the "EA (Extended Attribute) subtree. */ static int dissect_4_2_16_2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { - guint8 name_len; - guint16 data_len; + uint8_t name_len; + uint32_t data_len; /* EA size */ CHECK_BYTE_COUNT_SUBR(4); @@ -12434,7 +12462,7 @@ dissect_4_2_16_2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* EA name length */ - name_len = tvb_get_guint8(tvb, offset); + name_len = tvb_get_uint8(tvb, offset); CHECK_BYTE_COUNT_SUBR(1); proto_tree_add_item( @@ -12462,15 +12490,19 @@ dissect_4_2_16_2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* EA data */ - CHECK_BYTE_COUNT_SUBR(data_len); + /* If the data length is greater than the buffer size then SECONDARY requests will follow. + * This often occurs with LOI "Info Set EAs". */ + if (data_len > *bcp) + break; + proto_tree_add_item( subtree, hf_smb_ea_data, tvb, offset, data_len, ENC_NA); - COUNT_BYTES_SUBR(data_len); + COUNT_BYTES_SUBR(data_len); proto_item_set_len(item, offset - start_offset); } - *trunc = FALSE; + *trunc = false; return offset; } @@ -12479,7 +12511,7 @@ dissect_4_2_16_2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, */ static int dissect_4_2_16_3(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) + int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { int fn_len; const char *fn; @@ -12487,13 +12519,13 @@ dissect_4_2_16_3(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, DISSECTOR_ASSERT(si); /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, FALSE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, false, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_SUBR(fn_len); - *trunc = FALSE; + *trunc = false; return offset; } @@ -12502,7 +12534,7 @@ dissect_4_2_16_3(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, */ static int dissect_4_2_16_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { offset = dissect_smb_standard_8byte_timestamps(tvb, pinfo, tree, offset, bcp, trunc); @@ -12515,7 +12547,7 @@ dissect_4_2_16_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset = dissect_file_ext_attr(tvb, tree, offset); *bcp -= 4; - *trunc = FALSE; + *trunc = false; return offset; } @@ -12525,7 +12557,7 @@ dissect_4_2_16_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, */ int dissect_qfi_SMB_FILE_STANDARD_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* allocation size */ CHECK_BYTE_COUNT_SUBR(8); @@ -12552,7 +12584,7 @@ dissect_qfi_SMB_FILE_STANDARD_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_ proto_tree_add_item(tree, hf_smb_is_directory, tvb, offset, 1, ENC_LITTLE_ENDIAN); COUNT_BYTES_SUBR(1); - *trunc = FALSE; + *trunc = false; return offset; } @@ -12560,14 +12592,14 @@ dissect_qfi_SMB_FILE_STANDARD_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_ */ int dissect_qfi_SMB_FILE_INTERNAL_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* file id */ CHECK_BYTE_COUNT_SUBR(8); proto_tree_add_item(tree, hf_smb_index_number, tvb, offset, 8, ENC_LITTLE_ENDIAN); COUNT_BYTES_SUBR(8); - *trunc = FALSE; + *trunc = false; return offset; } @@ -12575,14 +12607,14 @@ dissect_qfi_SMB_FILE_INTERNAL_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_ */ int dissect_qsfi_SMB_FILE_POSITION_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* file position */ CHECK_BYTE_COUNT_SUBR(8); proto_tree_add_item(tree, hf_smb_position, tvb, offset, 8, ENC_LITTLE_ENDIAN); COUNT_BYTES_SUBR(8); - *trunc = FALSE; + *trunc = false; return offset; } @@ -12590,14 +12622,14 @@ dissect_qsfi_SMB_FILE_POSITION_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto */ int dissect_qsfi_SMB_FILE_MODE_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* mode */ CHECK_BYTE_COUNT_SUBR(4); proto_tree_add_item(tree, hf_smb_mode, tvb, offset, 4, ENC_LITTLE_ENDIAN); COUNT_BYTES_SUBR(4); - *trunc = FALSE; + *trunc = false; return offset; } @@ -12605,14 +12637,14 @@ dissect_qsfi_SMB_FILE_MODE_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre */ int dissect_qfi_SMB_FILE_ALIGNMENT_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* alignment */ CHECK_BYTE_COUNT_SUBR(4); proto_tree_add_item(tree, hf_smb_t2_alignment, tvb, offset, 4, ENC_LITTLE_ENDIAN); COUNT_BYTES_SUBR(4); - *trunc = FALSE; + *trunc = false; return offset; } @@ -12622,14 +12654,14 @@ dissect_qfi_SMB_FILE_ALIGNMENT_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto */ int dissect_qfi_SMB_FILE_EA_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* ea length */ CHECK_BYTE_COUNT_SUBR(4); proto_tree_add_item(tree, hf_smb_ea_list_length, tvb, offset, 4, ENC_LITTLE_ENDIAN); COUNT_BYTES_SUBR(4); - *trunc = FALSE; + *trunc = false; return offset; } @@ -12641,14 +12673,14 @@ dissect_qfi_SMB_FILE_EA_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * */ int dissect_qsfi_SMB_FILE_ALLOCATION_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* allocation size */ CHECK_BYTE_COUNT_SUBR(8); proto_tree_add_item(tree, hf_smb_alloc_size64, tvb, offset, 8, ENC_LITTLE_ENDIAN); COUNT_BYTES_SUBR(8); - *trunc = FALSE; + *trunc = false; return offset; } @@ -12660,14 +12692,14 @@ dissect_qsfi_SMB_FILE_ALLOCATION_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, pro */ int dissect_qsfi_SMB_FILE_ENDOFFILE_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* offset of end of file */ CHECK_BYTE_COUNT_SUBR(8); proto_tree_add_item(tree, hf_smb_end_of_file, tvb, offset, 8, ENC_LITTLE_ENDIAN); COUNT_BYTES_SUBR(8); - *trunc = FALSE; + *trunc = false; return offset; } @@ -12687,7 +12719,7 @@ dissect_qsfi_SMB_FILE_ENDOFFILE_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, prot */ int dissect_qfi_SMB_FILE_NAME_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc, gboolean unicode) + int offset, uint16_t *bcp, bool *trunc, bool unicode) { int fn_len; const char *fn; @@ -12698,7 +12730,7 @@ dissect_qfi_SMB_FILE_NAME_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree COUNT_BYTES_SUBR(4); /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, unicode, &fn_len, TRUE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, unicode, &fn_len, true, true, bcp); CHECK_STRING_SUBR(fn); @@ -12706,7 +12738,7 @@ dissect_qfi_SMB_FILE_NAME_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree fn); COUNT_BYTES_SUBR(fn_len); - *trunc = FALSE; + *trunc = false; return offset; } @@ -12716,9 +12748,9 @@ dissect_qfi_SMB_FILE_NAME_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree */ static int dissect_qfi_SMB_FILE_ALL_INFO(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) + int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { - guint32 fn_len; + uint32_t fn_len; const char *fn; DISSECTOR_ASSERT(si); @@ -12773,14 +12805,14 @@ dissect_qfi_SMB_FILE_ALL_INFO(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre /* file name len */ CHECK_BYTE_COUNT_SUBR(4); - fn_len = (guint32)tvb_get_letohl(tvb, offset); + fn_len = (uint32_t)tvb_get_letohl(tvb, offset); proto_tree_add_uint(tree, hf_smb_file_name_len, tvb, offset, 4, fn_len); COUNT_BYTES_SUBR(4); /* file name */ CHECK_BYTE_COUNT_SUBR(fn_len); - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, TRUE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, true, true, bcp); if (fn != NULL) { proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); @@ -12800,12 +12832,12 @@ dissect_qfi_SMB_FILE_ALL_INFO(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre */ int dissect_qfi_SMB_FILE_STREAM_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, - int offset, guint16 *bcp, gboolean *trunc, int unicode) + int offset, uint16_t *bcp, bool *trunc, int unicode) { proto_item *item; proto_tree *tree; int old_offset; - guint32 neo; + uint32_t neo; int fn_len; const char *fn; int padcnt; @@ -12839,13 +12871,13 @@ dissect_qfi_SMB_FILE_STREAM_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr COUNT_BYTES_SUBR(8); /* stream name */ - fn = get_unicode_or_ascii_string(tvb, &offset, unicode, &fn_len, FALSE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, unicode, &fn_len, false, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string(tree, hf_smb_t2_stream_name, tvb, offset, fn_len, fn); COUNT_BYTES_SUBR(fn_len); - proto_item_append_text(item, ": %s", format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + proto_item_append_text(item, ": %s", format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); if (neo == 0) @@ -12865,7 +12897,7 @@ dissect_qfi_SMB_FILE_STREAM_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr } } - *trunc = FALSE; + *trunc = false; return offset; } @@ -12875,7 +12907,7 @@ dissect_qfi_SMB_FILE_STREAM_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr */ int dissect_qfi_SMB_FILE_COMPRESSION_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* compressed file size */ CHECK_BYTE_COUNT_SUBR(8); @@ -12907,7 +12939,7 @@ dissect_qfi_SMB_FILE_COMPRESSION_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, pro proto_tree_add_item(tree, hf_smb_reserved, tvb, offset, 3, ENC_NA); COUNT_BYTES_SUBR(3); - *trunc = FALSE; + *trunc = false; return offset; } @@ -12926,7 +12958,7 @@ static const value_string unix_file_type_vals[] = { static int dissect_4_2_16_12(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* End of file (file size) */ CHECK_BYTE_COUNT_SUBR(8); @@ -12940,18 +12972,18 @@ dissect_4_2_16_12(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* Last status change */ CHECK_BYTE_COUNT_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_unix_file_last_status); - *bcp -= 8; /* dissect_nt_64bit_time() increments offset */ + dissect_nttime(tvb, tree, offset, hf_smb_unix_file_last_status, ENC_LITTLE_ENDIAN); + COUNT_BYTES_SUBR(8); /* Last access time */ CHECK_BYTE_COUNT_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_unix_file_last_access); - *bcp -= 8; + dissect_nttime(tvb, tree, offset, hf_smb_unix_file_last_access, ENC_LITTLE_ENDIAN); + COUNT_BYTES_SUBR(8); /* Last modification time */ CHECK_BYTE_COUNT_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_unix_file_last_change); - *bcp -= 8; + dissect_nttime(tvb, tree, offset, hf_smb_unix_file_last_change, ENC_LITTLE_ENDIAN); + COUNT_BYTES_SUBR(8); /* File owner uid */ CHECK_BYTE_COUNT_SUBR(8); @@ -12997,7 +13029,7 @@ dissect_4_2_16_12(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guess could be padding, but we are only using 4 or 8 byte data types so this is a bit confusing. -tpot */ - *trunc = FALSE; + *trunc = false; return offset; } @@ -13005,7 +13037,7 @@ dissect_4_2_16_12(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, static int dissect_4_2_16_13(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) + int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { const char *fn; int fn_len = 0; @@ -13015,14 +13047,14 @@ dissect_4_2_16_13(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* Link destination */ fn = get_unicode_or_ascii_string( - tvb, &offset, si->unicode, &fn_len, FALSE, TRUE, bcp); + tvb, &offset, si->unicode, &fn_len, false, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string( tree, hf_smb_unix_file_link_dest, tvb, offset, fn_len, fn); COUNT_BYTES_SUBR(fn_len); - *trunc = FALSE; + *trunc = false; return offset; } @@ -13030,9 +13062,9 @@ dissect_4_2_16_13(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, */ static int dissect_qspi_unix_acl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { - guint16 num_file_aces; + uint16_t num_file_aces; static int * const perm_fields[] = { &hf_smb_posix_ace_perm_read, &hf_smb_posix_ace_perm_write, @@ -13060,13 +13092,13 @@ dissect_qspi_unix_acl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *it, *type_item; proto_tree *tr; int old_offset = offset; - guint8 ace_type; + uint8_t ace_type; tr = proto_tree_add_subtree(tree, tvb, offset, 0, ett_smb_posix_ace, &it, "ACE"); /* ace type */ CHECK_BYTE_COUNT_SUBR(1); - ace_type = tvb_get_guint8(tvb, offset); + ace_type = tvb_get_uint8(tvb, offset); type_item = proto_tree_add_item(tr, hf_smb_posix_ace_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); COUNT_BYTES_SUBR(1); @@ -13130,67 +13162,67 @@ dissect_qspi_unix_acl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item_set_len(it, offset-old_offset); } - *trunc = FALSE; + *trunc = false; return offset; } static int dissect_qspi_unix_xattr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - int offset, guint16 *bcp _U_, gboolean *trunc) + int offset, uint16_t *bcp _U_, bool *trunc) { proto_tree_add_expert(tree, pinfo, &ei_smb_not_implemented, tvb, offset, 0); - *trunc = FALSE; + *trunc = false; return offset; } static int dissect_qspi_unix_attr_flags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - int offset, guint16 *bcp _U_, gboolean *trunc) + int offset, uint16_t *bcp _U_, bool *trunc) { proto_tree_add_expert(tree, pinfo, &ei_smb_not_implemented, tvb, offset, 0); - *trunc = FALSE; + *trunc = false; return offset; } static int dissect_qpi_unix_permissions(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - int offset, guint16 *bcp _U_, gboolean *trunc) + int offset, uint16_t *bcp _U_, bool *trunc) { proto_tree_add_expert(tree, pinfo, &ei_smb_not_implemented, tvb, offset, 0); - *trunc = FALSE; + *trunc = false; return offset; } static int dissect_qspi_unix_lock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - int offset, guint16 *bcp _U_, gboolean *trunc) + int offset, uint16_t *bcp _U_, bool *trunc) { proto_tree_add_expert(tree, pinfo, &ei_smb_not_implemented, tvb, offset, 0); - *trunc = FALSE; + *trunc = false; return offset; } static int dissect_qspi_unix_open(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - int offset, guint16 *bcp _U_, gboolean *trunc) + int offset, uint16_t *bcp _U_, bool *trunc) { proto_tree_add_expert(tree, pinfo, &ei_smb_not_implemented, tvb, offset, 0); - *trunc = FALSE; + *trunc = false; return offset; } static int dissect_qspi_unix_unlink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - int offset, guint16 *bcp _U_, gboolean *trunc) + int offset, uint16_t *bcp _U_, bool *trunc) { proto_tree_add_expert(tree, pinfo, &ei_smb_not_implemented, tvb, offset, 0); - *trunc = FALSE; + *trunc = false; return offset; } @@ -13254,7 +13286,7 @@ dissect_unix_info2_file_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset static int dissect_qspi_unix_info2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* End of file (file size) */ CHECK_BYTE_COUNT_SUBR(8); @@ -13269,18 +13301,18 @@ dissect_qspi_unix_info2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* Last status change */ CHECK_BYTE_COUNT_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_unix_file_last_status); - *bcp -= 8; + dissect_nttime(tvb, tree, offset, hf_smb_unix_file_last_status, ENC_LITTLE_ENDIAN); + COUNT_BYTES_SUBR(8); /* Last access time */ CHECK_BYTE_COUNT_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_unix_file_last_access); - *bcp -= 8; + dissect_nttime(tvb, tree, offset, hf_smb_unix_file_last_access, ENC_LITTLE_ENDIAN); + COUNT_BYTES_SUBR(8); /* Last modification time */ CHECK_BYTE_COUNT_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_unix_file_last_change); - *bcp -= 8; + dissect_nttime(tvb, tree, offset, hf_smb_unix_file_last_change, ENC_LITTLE_ENDIAN); + COUNT_BYTES_SUBR(8); /* File owner uid */ CHECK_BYTE_COUNT_SUBR(8); @@ -13324,8 +13356,8 @@ dissect_qspi_unix_info2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* Creation time */ CHECK_BYTE_COUNT_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_unix_file_creation_time); - *bcp -= 8; + dissect_nttime(tvb, tree, offset, hf_smb_unix_file_creation_time, ENC_LITTLE_ENDIAN); + COUNT_BYTES_SUBR(8); /* File flags */ CHECK_BYTE_COUNT_SUBR(4); @@ -13337,7 +13369,7 @@ dissect_qspi_unix_info2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, offset = dissect_unix_info2_file_flags(tvb, tree, offset, hf_smb_unix_info2_file_flags_mask); *bcp -= 4; - *trunc = FALSE; + *trunc = false; return offset; } @@ -13346,7 +13378,7 @@ dissect_qspi_unix_info2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int dissect_qfi_SMB_FILE_NETWORK_OPEN_INFO(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { offset = dissect_smb_standard_8byte_timestamps(tvb, pinfo, tree, offset, bcp, trunc); @@ -13374,7 +13406,7 @@ dissect_qfi_SMB_FILE_NETWORK_OPEN_INFO(tvbuff_t *tvb, proto_tree_add_item(tree, hf_smb_reserved, tvb, offset, 4, ENC_NA); COUNT_BYTES_SUBR(4); - *trunc = FALSE; + *trunc = false; return offset; } @@ -13383,7 +13415,7 @@ dissect_qfi_SMB_FILE_NETWORK_OPEN_INFO(tvbuff_t *tvb, int dissect_qfi_SMB_FILE_ATTRIBUTE_TAG_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* attribute */ CHECK_BYTE_COUNT_SUBR(4); @@ -13395,7 +13427,7 @@ dissect_qfi_SMB_FILE_ATTRIBUTE_TAG_INFO(tvbuff_t *tvb, proto_tree_add_item(tree, hf_smb_reparse_tag, tvb, offset, 4, ENC_LITTLE_ENDIAN); COUNT_BYTES_SUBR(4); - *trunc = FALSE; + *trunc = false; return offset; } @@ -13404,14 +13436,14 @@ dissect_qfi_SMB_FILE_ATTRIBUTE_TAG_INFO(tvbuff_t *tvb, */ static int dissect_4_2_19_2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* marked for deletion? */ CHECK_BYTE_COUNT_SUBR(1); proto_tree_add_item(tree, hf_smb_t2_marked_for_deletion, tvb, offset, 1, ENC_LITTLE_ENDIAN); COUNT_BYTES_SUBR(1); - *trunc = FALSE; + *trunc = false; return offset; } @@ -13424,10 +13456,10 @@ static const true_false_string tfs_smb_replace = { static int dissect_rename_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) + int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { const char *fn; - guint32 target_name_len; + uint32_t target_name_len; int fn_len; DISSECTOR_ASSERT(si); @@ -13451,24 +13483,24 @@ dissect_rename_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* Target name */ fn_len = target_name_len; fn = get_unicode_or_ascii_string( - tvb, &offset, si->unicode, &fn_len, FALSE, TRUE, bcp); + tvb, &offset, si->unicode, &fn_len, false, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string( tree, hf_smb_target_name, tvb, offset, fn_len, fn); COUNT_BYTES_SUBR(fn_len); - *trunc = FALSE; + *trunc = false; return offset; } static int dissect_disposition_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) + int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { #if 0 const char *fn; - guint32 target_name_len;*/ + uint32_t target_name_len;*/ int fn_len; #endif @@ -13479,20 +13511,20 @@ dissect_disposition_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree proto_tree_add_item(tree, hf_smb_disposition_delete_on_close, tvb, offset, 1, ENC_LITTLE_ENDIAN); COUNT_BYTES_SUBR(1); - *trunc = FALSE; + *trunc = false; return offset; } int dissect_sfi_SMB_FILE_PIPE_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - int offset, guint16 *bcp, gboolean *trunc) + int offset, uint16_t *bcp, bool *trunc) { /* pipe info flag */ CHECK_BYTE_COUNT_SUBR(1); proto_tree_add_item(tree, hf_smb_pipe_info_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN); COUNT_BYTES_SUBR(1); - *trunc = FALSE; + *trunc = false; return offset; } @@ -13500,9 +13532,9 @@ dissect_sfi_SMB_FILE_PIPE_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree TRANS2_QUERY_FILE_INFORMATION*/ static int dissect_qpi_loi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, - proto_item *item, int offset, guint16 *bcp, smb_info_t *si) + proto_item *item _U_, int offset, uint16_t *bcp, smb_info_t *si) { - gboolean trunc = FALSE; + bool trunc = false; if (!*bcp) { return offset; @@ -13584,7 +13616,7 @@ dissect_qpi_loi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, &trunc, si->unicode); break; case 1022: /* SMB_FILE_STREAM_INFORMATION */ - si->unicode = TRUE; + si->unicode = true; /* FALLTHRU */ case 0x0109: /*Query File Stream Info*/ offset = dissect_qfi_SMB_FILE_STREAM_INFO(tvb, pinfo, tree, offset, bcp, @@ -13641,13 +13673,10 @@ dissect_qpi_loi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, proto_tree_add_expert(tree, pinfo, &ei_smb_info_level_unknown, tvb, offset, *bcp); offset += *bcp; *bcp = 0; - trunc = FALSE; + trunc = false; break; } - if (trunc) { - expert_add_info(pinfo, item, &ei_smb_mal_information_level); - } return offset; } @@ -13655,9 +13684,9 @@ dissect_qpi_loi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, TRANS2_SET_FILE_INFORMATION*/ static int dissect_spi_loi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, - proto_item *item, int offset, guint16 *bcp, smb_info_t *si) + proto_item *item, int offset, uint16_t *bcp, smb_info_t *si) { - gboolean trunc; + bool trunc; if (!*bcp) { return offset; @@ -13766,14 +13795,14 @@ dissect_spi_loi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, proto_tree_add_expert(tree, pinfo, &ei_smb_info_level_not_understood, tvb, offset, *bcp); offset += *bcp; *bcp = 0; - trunc = FALSE; + trunc = false; break; default: proto_tree_add_expert(tree, pinfo, &ei_smb_info_level_unknown, tvb, offset, *bcp); offset += *bcp; *bcp = 0; - trunc = FALSE; + trunc = false; break; } @@ -13816,7 +13845,7 @@ dissect_quota_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset) } int -dissect_nt_quota(tvbuff_t *tvb, proto_tree *tree, int offset, guint16 *bcp) +dissect_nt_quota(tvbuff_t *tvb, proto_tree *tree, int offset, uint16_t *bcp) { /* first 24 bytes are unknown */ CHECK_BYTE_COUNT_TRANS_SUBR(24); @@ -13850,7 +13879,7 @@ dissect_nt_quota(tvbuff_t *tvb, proto_tree *tree, int offset, guint16 *bcp) static int dissect_sfsi_request(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, - int offset, guint16 *bcp, smb_info_t *si) + int offset, uint16_t *bcp, smb_info_t *si) { if (!*bcp) { return offset; @@ -13903,7 +13932,7 @@ dissect_sfsi_request(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, static int dissect_sfsi_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, - int offset, guint16 *bcp, smb_info_t *si) + int offset, uint16_t *bcp, smb_info_t *si) { if (!*bcp) { return offset; @@ -13956,7 +13985,7 @@ dissect_sfsi_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, static int dissect_transaction2_request_data(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *parent_tree, int offset, int subcmd, guint16 dc, smb_info_t *si) + proto_tree *parent_tree, int offset, int subcmd, uint16_t dc, smb_info_t *si) { proto_item *item; proto_tree *tree; @@ -14072,10 +14101,17 @@ dissect_transaction2_request_data(tvbuff_t *tvb, packet_info *pinfo, break; } - /* ooops there were data we didn't know how to process */ - if (dc != 0) { - proto_tree_add_item(tree, hf_smb_unknown, tvb, offset, dc, ENC_NA); - offset += dc; + if (dc > 0) { + if (si->info_level == 2) { + /* The LOI is "Info Set EAs (2), and dc is greater than zero, thus + * SECONDARY requests will follow carrying the remainder of the data. */ + proto_tree_add_item(tree, hf_smb_secondaries_will_follow, tvb, offset, dc, ENC_NA); + dc = 0; + } else { + /* ooops there were data we didn't know how to process */ + proto_tree_add_item(tree, hf_smb_unknown, tvb, offset, dc, ENC_NA); + offset += dc; + } } return offset; @@ -14088,7 +14124,7 @@ dissect_trans_data(tvbuff_t *s_tvb, tvbuff_t *p_tvb, tvbuff_t *d_tvb, { int i; int offset; - guint length; + unsigned length; /* * Show the setup words. @@ -14135,21 +14171,23 @@ dissect_trans_data(tvbuff_t *s_tvb, tvbuff_t *p_tvb, tvbuff_t *d_tvb, static int dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 wc, sc = 0; + uint8_t wc, sc = 0; int so = offset; int sl = 0; int spo = offset; int spc = 0; - guint16 od = 0, po = 0, pc = 0, dc = 0, pd, dd = 0; + uint16_t od = 0, po = 0, pc = 0, dc = 0, pd, dd = 0; + uint16_t tdc = 0; int subcmd = -1; - guint32 to; + uint32_t to; int an_len; const char *an = NULL; smb_transact2_info_t *t2i; smb_transact_info_t *tri; - guint16 bc; + uint16_t bc; int padcnt; - gboolean dissected_trans; + bool dissected_trans; + proto_item *it; DISSECTOR_ASSERT(si); @@ -14163,6 +14201,7 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += 2; /* total data count , only 16bit integer here*/ + tdc = tvb_get_letohs(tvb, offset); proto_tree_add_item(tree, hf_smb_total_data_count, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; @@ -14191,17 +14230,30 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint(tree, hf_smb_data_offset16, tvb, offset, 2, od); offset += 2; - /* data disp */ + /* data displacement (dd) + * The amount of data sent NOT including the data in this packet. If there are more + * data to send per "Total Data Count" (tdc) [MS-CIFS] 2.2.4.46.1, additional + * "TRANS2 Secondary Requests" ([MS-CIFS] 2.2.4.46.2) will follow, each increasing dd + * until the tdc is reached (dd + dc = tdc). + */ dd = tvb_get_letohs(tvb, offset); proto_tree_add_uint(tree, hf_smb_data_disp16, tvb, offset, 2, dd); offset += 2; + if (tdc && tdc >= dc ) { + uint16_t diff = tdc - (dc + dd); + it = proto_tree_add_uint(tree, hf_bytes_until_total_data_count, tvb, 0, 0, diff); + proto_item_set_generated(it); + } + if (tdc) + col_append_fstr(pinfo->cinfo, COL_INFO, ", Data: %u of %u", dd + dc, tdc); + if (si->cmd == SMB_COM_TRANSACTION2 || si->cmd == SMB_COM_TRANSACTION2_SECONDARY) { - guint16 fid; + uint16_t fid; /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, FALSE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, false, false, false, si); offset += 2; } @@ -14210,13 +14262,14 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, so = offset; sl = 0; } else { - /* it is not a secondary request */ + /* it is NOT a secondary request */ /* total param count , only a 16 bit integer here*/ proto_tree_add_item(tree, hf_smb_total_param_count, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; /* total data count , only 16bit integer here*/ + tdc = tvb_get_letohs(tvb, offset); proto_tree_add_item(tree, hf_smb_total_data_count, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; @@ -14259,11 +14312,22 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint(tree, hf_smb_param_offset16, tvb, offset, 2, po); offset += 2; - /* data count */ + /* Data_Count (dc) + * The amount of data carried in this request. If there are more data to send per + * Total Data Count (tdc) [MS-CIFS] 2.2.4.46.1, TRANS2 Secondary Requests + * ([MS-CIFS] 2.2.4.46.2) will follow, each increasing Data displacement (dd)until + * tdc is reached (dd + dc = tdc). + */ dc = tvb_get_letohs(tvb, offset); proto_tree_add_uint(tree, hf_smb_data_count16, tvb, offset, 2, dc); offset += 2; + if (tdc && tdc >= dc) { + uint16_t diff = tdc - dc; + it = proto_tree_add_uint(tree, hf_bytes_until_total_data_count, tvb, 0, 0, diff); + proto_item_set_generated(it); + } + /* data offset */ od = tvb_get_letohs(tvb, offset); proto_tree_add_uint(tree, hf_smb_data_offset16, tvb, offset, 2, od); @@ -14273,7 +14337,7 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dd = 0; /* setup count */ - sc = tvb_get_guint8(tvb, offset); + sc = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_smb_setup_count, tvb, offset, 1, sc); offset += 1; @@ -14301,6 +14365,8 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_ext(subcmd, &trans2_cmd_vals_ext, "Unknown (0x%02x)")); + if (tdc) + col_append_fstr(pinfo->cinfo, COL_INFO, ", Data: %u of %u", dc, tdc); if (!si->unidir) { if (!pinfo->fd->visited && si->sip) { @@ -14312,7 +14378,7 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, t2i = wmem_new(wmem_file_scope(), smb_transact2_info_t); t2i->subcmd = subcmd; t2i->info_level = -1; - t2i->resume_keys = FALSE; + t2i->resume_keys = false; t2i->name = NULL; si->sip->extra_info = t2i; si->sip->extra_info_type = SMB_EI_T2I; @@ -14342,7 +14408,7 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (si->cmd == SMB_COM_TRANSACTION) { /* Transaction Name */ an = get_unicode_or_ascii_string(tvb, &offset, - si->unicode, &an_len, FALSE, FALSE, &bc); + si->unicode, &an_len, false, false, &bc); if (an == NULL) goto endofcommand; proto_tree_add_string(tree, hf_smb_trans_name, tvb, @@ -14486,7 +14552,7 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, */ tri = NULL; } - dissected_trans = FALSE; + dissected_trans = false; if (an == NULL) goto endofcommand; if (strncmp("\\PIPE\\", an, 6) == 0) { @@ -14532,9 +14598,9 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } if (!dissected_trans) dissect_trans_data(s_tvb, p_tvb, d_tvb, tree); - } else { - col_append_str(pinfo->cinfo, COL_INFO, - "[transact continuation]"); + + } else if (tdc) { + col_append_fstr(pinfo->cinfo, COL_INFO, ", Data: %u of %u", dc + dd, tdc); } } @@ -14546,8 +14612,8 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static int -dissect_4_3_4_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, - int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) +dissect_4_3_4_1(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, + int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { int fn_len; const char *fn; @@ -14555,8 +14621,8 @@ dissect_4_3_4_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, proto_item *item; proto_tree *tree; smb_transact2_info_t *t2i; - gboolean resume_keys = FALSE; - guint32 bytes_needed = 0; + bool resume_keys = false; + uint32_t bytes_needed = 0; DISSECTOR_ASSERT(si); @@ -14578,7 +14644,7 @@ dissect_4_3_4_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, tvb_ensure_bytes_exist(tvb, offset, bytes_needed); /* Now, get the length */ - fn_len = tvb_get_guint8(tvb, offset + bytes_needed - 1); + fn_len = tvb_get_uint8(tvb, offset + bytes_needed - 1); tvb_ensure_bytes_exist(tvb, offset, bytes_needed + fn_len); if (resume_keys) { @@ -14592,21 +14658,21 @@ dissect_4_3_4_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_create_time, - hf_smb_create_dos_date, hf_smb_create_dos_time, FALSE); + hf_smb_create_dos_date, hf_smb_create_dos_time, false); *bcp -= 4; /* access time */ CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_access_time, - hf_smb_access_dos_date, hf_smb_access_dos_time, FALSE); + hf_smb_access_dos_date, hf_smb_access_dos_time, false); *bcp -= 4; /* last write time */ CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_last_write_time, - hf_smb_last_write_dos_date, hf_smb_last_write_dos_time, FALSE); + hf_smb_last_write_dos_date, hf_smb_last_write_dos_time, false); *bcp -= 4; /* data size */ @@ -14626,7 +14692,7 @@ dissect_4_3_4_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, /* file name len */ CHECK_BYTE_COUNT_SUBR(1); - fn_len = tvb_get_guint8(tvb, offset); + fn_len = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_smb_file_name_len, tvb, offset, 1, fn_len); COUNT_BYTES_SUBR(1); if (si->unicode) @@ -14635,25 +14701,22 @@ dissect_4_3_4_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, fn_len++; /* include terminating '\0' */ /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_SUBR(fn_len); - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(wmem_packet_scope(), fn, strlen(fn))); - - proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); - *trunc = FALSE; + *trunc = false; return offset; } static int -dissect_4_3_4_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, - int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) +dissect_4_3_4_2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, + int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { int fn_len; const char *fn; @@ -14661,8 +14724,8 @@ dissect_4_3_4_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, proto_item *item; proto_tree *tree; smb_transact2_info_t *t2i; - gboolean resume_keys = FALSE; - guint32 bytes_needed = 0; + bool resume_keys = false; + uint32_t bytes_needed = 0; DISSECTOR_ASSERT(si); @@ -14684,7 +14747,7 @@ dissect_4_3_4_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, tvb_ensure_bytes_exist(tvb, offset, bytes_needed); /* Now, get the length */ - fn_len = tvb_get_guint8(tvb, offset + bytes_needed - 1); + fn_len = tvb_get_uint8(tvb, offset + bytes_needed - 1); tvb_ensure_bytes_exist(tvb, offset, bytes_needed + fn_len); if (resume_keys) { @@ -14698,21 +14761,21 @@ dissect_4_3_4_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_create_time, - hf_smb_create_dos_date, hf_smb_create_dos_time, FALSE); + hf_smb_create_dos_date, hf_smb_create_dos_time, false); *bcp -= 4; /* access time */ CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_access_time, - hf_smb_access_dos_date, hf_smb_access_dos_time, FALSE); + hf_smb_access_dos_date, hf_smb_access_dos_time, false); *bcp -= 4; /* last write time */ CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_last_write_time, - hf_smb_last_write_dos_date, hf_smb_last_write_dos_time, FALSE); + hf_smb_last_write_dos_date, hf_smb_last_write_dos_time, false); *bcp -= 4; /* data size */ @@ -14737,21 +14800,17 @@ dissect_4_3_4_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, /* file name len */ CHECK_BYTE_COUNT_SUBR(1); - fn_len = tvb_get_guint8(tvb, offset); + fn_len = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_smb_file_name_len, tvb, offset, 1, fn_len); COUNT_BYTES_SUBR(1); /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, TRUE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, true, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_SUBR(fn_len); - - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); - - proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); /* * To quote the footnote for FileName in Section 2.2.8.1.2: @@ -14771,7 +14830,7 @@ dissect_4_3_4_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, proto_item_set_len(item, offset-old_offset); - *trunc = FALSE; + *trunc = false; return offset; } @@ -14783,8 +14842,8 @@ dissect_4_3_4_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, * this soon. */ static int -dissect_4_3_4_3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, - int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) +dissect_4_3_4_3(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, + int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { int fn_len; const char *fn; @@ -14793,7 +14852,7 @@ dissect_4_3_4_3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, proto_item *item; proto_tree *tree; smb_transact2_info_t *t2i; - gboolean resume_keys = FALSE; + bool resume_keys = false; DISSECTOR_ASSERT(si); @@ -14818,21 +14877,21 @@ dissect_4_3_4_3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_create_time, - hf_smb_create_dos_date, hf_smb_create_dos_time, FALSE); + hf_smb_create_dos_date, hf_smb_create_dos_time, false); *bcp -= 4; /* access time */ CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_access_time, - hf_smb_access_dos_date, hf_smb_access_dos_time, FALSE); + hf_smb_access_dos_date, hf_smb_access_dos_time, false); *bcp -= 4; /* last write time */ CHECK_BYTE_COUNT_SUBR(4); offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_last_write_time, - hf_smb_last_write_dos_date, hf_smb_last_write_dos_time, FALSE); + hf_smb_last_write_dos_date, hf_smb_last_write_dos_time, false); *bcp -= 4; /* data size */ @@ -14863,7 +14922,7 @@ dissect_4_3_4_3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, /* file name len */ CHECK_BYTE_COUNT_SUBR(1); - fn_len = tvb_get_guint8(tvb, offset); + fn_len = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_smb_file_name_len, tvb, offset, 1, fn_len); COUNT_BYTES_SUBR(1); if (si->unicode) @@ -14872,16 +14931,13 @@ dissect_4_3_4_3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, fn_len++; /* include terminating '\0' */ /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_SUBR(fn_len); - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); - - proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); return offset; @@ -14889,14 +14945,14 @@ dissect_4_3_4_3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, static int dissect_4_3_4_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, - int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) + int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { int fn_len; const char *fn; int old_offset = offset; proto_item *item; proto_tree *tree; - guint32 neo; + uint32_t neo; int padcnt; DISSECTOR_ASSERT(si); @@ -14957,15 +15013,12 @@ dissect_4_3_4_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, COUNT_BYTES_SUBR(4); /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_SUBR(fn_len); - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); - /* skip to next structure */ if (neo) { padcnt = (old_offset + neo) - offset; @@ -14981,23 +15034,23 @@ dissect_4_3_4_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, } } - proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); - *trunc = FALSE; + *trunc = false; return offset; } static int dissect_4_3_4_5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, - int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) + int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { int fn_len; const char *fn; int old_offset = offset; proto_item *item; proto_tree *tree; - guint32 neo; + uint32_t neo; int padcnt; DISSECTOR_ASSERT(si); @@ -15064,15 +15117,12 @@ dissect_4_3_4_5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, COUNT_BYTES_SUBR(4); /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_SUBR(fn_len); - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); - /* skip to next structure */ if (neo) { padcnt = (old_offset + neo) - offset; @@ -15088,23 +15138,23 @@ dissect_4_3_4_5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, } } - proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); - *trunc = FALSE; + *trunc = false; return offset; } static int dissect_4_3_4_6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, - int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) + int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { int fn_len, sfn_len; const char *fn, *sfn; int old_offset = offset; proto_item *item; proto_tree *tree; - guint32 neo; + uint32_t neo; int padcnt; DISSECTOR_ASSERT(si); @@ -15180,7 +15230,7 @@ dissect_4_3_4_6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, /* short file name len */ CHECK_BYTE_COUNT_SUBR(1); - sfn_len = tvb_get_guint8(tvb, offset); + sfn_len = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_smb_short_file_name_len, tvb, offset, 1, sfn_len); COUNT_BYTES_SUBR(1); @@ -15190,22 +15240,19 @@ dissect_4_3_4_6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, COUNT_BYTES_SUBR(1); /* short file name - it's not always in Unicode */ - sfn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &sfn_len, FALSE, TRUE, bcp); + sfn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &sfn_len, false, true, bcp); CHECK_STRING_SUBR(sfn); proto_tree_add_string(tree, hf_smb_short_file_name, tvb, offset, 24, sfn); COUNT_BYTES_SUBR(24); /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_SUBR(fn_len); - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); - /* skip to next structure */ if (neo) { padcnt = (old_offset + neo) - offset; @@ -15221,23 +15268,23 @@ dissect_4_3_4_6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, } } - proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); - *trunc = FALSE; + *trunc = false; return offset; } static int dissect_4_3_4_6full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, - int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) + int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { int fn_len; const char *fn; int old_offset = offset; proto_item *item; proto_tree *tree; - guint32 neo; + uint32_t neo; int padcnt; DISSECTOR_ASSERT(si); @@ -15319,15 +15366,12 @@ dissect_4_3_4_6full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, COUNT_BYTES_SUBR(8); /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_SUBR(fn_len); - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); - /* skip to next structure */ if (neo) { padcnt = (old_offset + neo) - offset; @@ -15343,23 +15387,23 @@ dissect_4_3_4_6full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, } } - proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); - *trunc = FALSE; + *trunc = false; return offset; } static int dissect_4_3_4_6_id_both(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, - int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) + int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { int fn_len, sfn_len; const char *fn, *sfn; int old_offset = offset; proto_item *item; proto_tree *tree; - guint32 neo; + uint32_t neo; int padcnt; DISSECTOR_ASSERT(si); @@ -15435,7 +15479,7 @@ dissect_4_3_4_6_id_both(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr /* short file name len */ CHECK_BYTE_COUNT_SUBR(1); - sfn_len = tvb_get_guint8(tvb, offset); + sfn_len = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_smb_short_file_name_len, tvb, offset, 1, sfn_len); COUNT_BYTES_SUBR(1); @@ -15445,7 +15489,7 @@ dissect_4_3_4_6_id_both(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr COUNT_BYTES_SUBR(1); /* short file name - it's not always in Unicode */ - sfn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &sfn_len, FALSE, TRUE, bcp); + sfn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &sfn_len, false, true, bcp); CHECK_STRING_SUBR(sfn); proto_tree_add_string(tree, hf_smb_short_file_name, tvb, offset, 24, sfn); @@ -15462,15 +15506,12 @@ dissect_4_3_4_6_id_both(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr COUNT_BYTES_SUBR(8); /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_SUBR(fn_len); - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); - /* skip to next structure */ if (neo) { padcnt = (old_offset + neo) - offset; @@ -15486,23 +15527,23 @@ dissect_4_3_4_6_id_both(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr } } - proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); - *trunc = FALSE; + *trunc = false; return offset; } static int -dissect_4_3_4_7(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, - int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) +dissect_4_3_4_7(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, + int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { int fn_len; const char *fn; int old_offset = offset; proto_item *item; proto_tree *tree; - guint32 neo; + uint32_t neo; int padcnt; DISSECTOR_ASSERT(si); @@ -15543,15 +15584,12 @@ dissect_4_3_4_7(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, COUNT_BYTES_SUBR(4); /* file name */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); COUNT_BYTES_SUBR(fn_len); - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); - /* skip to next structure */ if (neo) { padcnt = (old_offset + neo) - offset; @@ -15567,10 +15605,10 @@ dissect_4_3_4_7(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, } } - proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const guchar*)fn, strlen(fn))); + proto_item_append_text(item, " File: %s", format_text(wmem_packet_scope(), (const unsigned char*)fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); - *trunc = FALSE; + *trunc = false; return offset; } @@ -15578,8 +15616,8 @@ dissect_4_3_4_7(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, static int dissect_4_3_4_8(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree, int offset, guint16 *bcp, - gboolean *trunc, smb_info_t *si) + proto_tree *tree, int offset, uint16_t *bcp, + bool *trunc, smb_info_t *si) { const char *fn; int fn_len; @@ -15605,7 +15643,7 @@ dissect_4_3_4_8(tvbuff_t *tvb, packet_info *pinfo, /* Name */ fn = get_unicode_or_ascii_string( - tvb, &offset, si->unicode, &fn_len, FALSE, FALSE, bcp); + tvb, &offset, si->unicode, &fn_len, false, false, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string( @@ -15619,17 +15657,17 @@ dissect_4_3_4_8(tvbuff_t *tvb, packet_info *pinfo, COUNT_BYTES_SUBR(pad); } - *trunc = FALSE; + *trunc = false; return offset; } static int dissect_find_file_unix_info2(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree, int offset, guint16 *bcp, - gboolean *trunc, smb_info_t *si) + proto_tree *tree, int offset, uint16_t *bcp, + bool *trunc, smb_info_t *si) { const char *fn; - guint32 namelen; + uint32_t namelen; int fn_len; int pad; @@ -15666,7 +15704,7 @@ dissect_find_file_unix_info2(tvbuff_t *tvb, packet_info *pinfo, tvb_ensure_bytes_exist(tvb, offset, namelen); fn_len = namelen; fn = get_unicode_or_ascii_string( - tvb, &offset, si->unicode, &fn_len, TRUE, TRUE, bcp); + tvb, &offset, si->unicode, &fn_len, true, true, bcp); CHECK_STRING_SUBR(fn); proto_tree_add_string( @@ -15681,17 +15719,17 @@ dissect_find_file_unix_info2(tvbuff_t *tvb, packet_info *pinfo, COUNT_BYTES_SUBR(pad); } - *trunc = FALSE; + *trunc = false; return offset; } /*dissect the data block for TRANS2_FIND_FIRST2*/ static int dissect_ff2_response_data(tvbuff_t * tvb, packet_info * pinfo, - proto_tree * tree, int offset, guint16 *bcp, gboolean *trunc, smb_info_t *si) + proto_tree * tree, int offset, uint16_t *bcp, bool *trunc, smb_info_t *si) { if (!*bcp) { - *trunc = FALSE; + *trunc = false; return offset; } @@ -15746,7 +15784,7 @@ dissect_ff2_response_data(tvbuff_t * tvb, packet_info * pinfo, trunc, si); break; default: /* unknown info level */ - *trunc = FALSE; + *trunc = false; break; } return offset; @@ -15864,16 +15902,16 @@ static const true_false_string tfs_smb_mac_streams = { }; int -dissect_qfsi_FS_VOLUME_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, int offset, guint16 *bcp, int unicode) +dissect_qfsi_FS_VOLUME_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, int offset, uint16_t *bcp, int unicode) { int fn_len, vll; const char *fn; /* create time */ CHECK_BYTE_COUNT_TRANS_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, - hf_smb_create_time); - *bcp -= 8; + dissect_nttime(tvb, tree, offset, + hf_smb_create_time, ENC_LITTLE_ENDIAN); + COUNT_BYTES_TRANS_SUBR(8); /* volume serial number */ CHECK_BYTE_COUNT_TRANS_SUBR(4); @@ -15893,7 +15931,7 @@ dissect_qfsi_FS_VOLUME_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree /* label */ fn_len = vll; - fn = get_unicode_or_ascii_string(tvb, &offset, unicode, &fn_len, FALSE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, unicode, &fn_len, false, true, bcp); CHECK_STRING_TRANS_SUBR(fn); proto_tree_add_string(tree, hf_smb_volume_label, tvb, offset, fn_len, fn); @@ -15903,7 +15941,7 @@ dissect_qfsi_FS_VOLUME_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree } int -dissect_qfsi_FS_SIZE_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, int offset, guint16 *bcp) +dissect_qfsi_FS_SIZE_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, int offset, uint16_t *bcp) { /* allocation size */ CHECK_BYTE_COUNT_TRANS_SUBR(8); @@ -15929,7 +15967,7 @@ dissect_qfsi_FS_SIZE_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * } int -dissect_qfsi_FS_DEVICE_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, int offset, guint16 *bcp) +dissect_qfsi_FS_DEVICE_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, int offset, uint16_t *bcp) { /* device type */ CHECK_BYTE_COUNT_TRANS_SUBR(4); @@ -15945,7 +15983,7 @@ dissect_qfsi_FS_DEVICE_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree } int -dissect_qfsi_FS_ATTRIBUTE_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, int offset, guint16 *bcp) +dissect_qfsi_FS_ATTRIBUTE_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, int offset, uint16_t *bcp) { int fn_len, fnl; const char *fn; @@ -15968,7 +16006,7 @@ dissect_qfsi_FS_ATTRIBUTE_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tr /* label */ fn_len = fnl; - fn = get_unicode_or_ascii_string(tvb, &offset, TRUE, &fn_len, FALSE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, true, &fn_len, false, true, bcp); CHECK_STRING_TRANS_SUBR(fn); proto_tree_add_string(tree, hf_smb_fs_name, tvb, offset, fn_len, fn); @@ -15978,7 +16016,7 @@ dissect_qfsi_FS_ATTRIBUTE_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tr } int -dissect_qfsi_FS_OBJECTID_INFO(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, int offset, guint16 *bcp) +dissect_qfsi_FS_OBJECTID_INFO(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, int offset, uint16_t *bcp) { CHECK_BYTE_COUNT_TRANS_SUBR(64); @@ -15990,7 +16028,7 @@ dissect_qfsi_FS_OBJECTID_INFO(tvbuff_t * tvb, packet_info * pinfo, proto_tree * } int -dissect_qfsi_FS_FULL_SIZE_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, int offset, guint16 *bcp) +dissect_qfsi_FS_FULL_SIZE_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, int offset, uint16_t *bcp) { /* allocation size */ CHECK_BYTE_COUNT_TRANS_SUBR(8); @@ -16022,7 +16060,7 @@ dissect_qfsi_FS_FULL_SIZE_INFO(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tr static int dissect_qfsi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, - int offset, guint16 *bcp, smb_info_t *si) + int offset, uint16_t *bcp, smb_info_t *si) { int fn_len, vll; const char *fn; @@ -16073,7 +16111,7 @@ dissect_qfsi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, COUNT_BYTES_TRANS_SUBR(1); /* label - not aligned! */ - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, TRUE, FALSE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, true, false, bcp); CHECK_STRING_TRANS_SUBR(fn); proto_tree_add_string(tree, hf_smb_volume_label, tvb, offset, fn_len, fn); @@ -16090,7 +16128,7 @@ dissect_qfsi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, /* label */ fn_len = vll; - fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, FALSE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, false, true, bcp); CHECK_STRING_TRANS_SUBR(fn); proto_tree_add_string(tree, hf_smb_volume_label, tvb, offset, fn_len, fn); @@ -16188,12 +16226,12 @@ dissect_qfsi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, case 0x202: { /* SMB_QUERY_POSIX_WHOAMI */ proto_tree *st_gids; - guint32 num_gids; - guint i; + uint32_t num_gids; + unsigned i; proto_tree *st_sids; int old_sid_offset; - guint32 num_sids; - guint32 sids_buflen; + uint32_t num_sids; + uint32_t sids_buflen; /* Mapping flags */ CHECK_BYTE_COUNT_TRANS_SUBR(4); @@ -16283,16 +16321,16 @@ dissect_qfsi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, /* Create time */ CHECK_BYTE_COUNT_TRANS_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_create_time); - *bcp -= 8; + dissect_nttime(tvb, tree, offset, hf_smb_create_time, ENC_LITTLE_ENDIAN); + COUNT_BYTES_TRANS_SUBR(8); /* Modify Time */ CHECK_BYTE_COUNT_TRANS_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_modify_time); - *bcp -= 8; + dissect_nttime(tvb, tree, offset, hf_smb_modify_time, ENC_LITTLE_ENDIAN); + COUNT_BYTES_TRANS_SUBR(8); /* Backup Time */ CHECK_BYTE_COUNT_TRANS_SUBR(8); - offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_backup_time); - *bcp -= 8; + dissect_nttime(tvb, tree, offset, hf_smb_backup_time, ENC_LITTLE_ENDIAN); + CHECK_BYTE_COUNT_TRANS_SUBR(8); /* Allocation blocks */ CHECK_BYTE_COUNT_TRANS_SUBR(4); proto_tree_add_item(tree, hf_smb_mac_alloc_block_count, tvb, @@ -16365,9 +16403,9 @@ dissect_transaction2_response_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree = NULL; smb_transact2_info_t *t2i; int count; - gboolean trunc = FALSE; + bool trunc = false; int offset = 0; - guint16 dc; + uint16_t dc; dc = tvb_reported_length(tvb); @@ -16405,17 +16443,18 @@ dissect_transaction2_response_data(tvbuff_t *tvb, packet_info *pinfo, if (count == -1) { break; } - + col_append_fstr(pinfo->cinfo, COL_INFO, + ", Files found: %u", count); if (count) { + while (count--) { + offset = dissect_ff2_response_data(tvb, pinfo, tree, + offset, &dc, &trunc, si); + if (trunc) + break; + } + } else { col_append_str(pinfo->cinfo, COL_INFO, - ", Files:"); - } - - while (count--) { - offset = dissect_ff2_response_data(tvb, pinfo, tree, - offset, &dc, &trunc, si); - if (trunc) - break; + ", No files found"); } break; case 0x0002: /*TRANS2_FIND_NEXT2*/ @@ -16426,15 +16465,17 @@ dissect_transaction2_response_data(tvbuff_t *tvb, packet_info *pinfo, break; } if (count) { + col_append_fstr(pinfo->cinfo, COL_INFO, + ", Files found: %u", count); + while (count--) { + offset = dissect_ff2_response_data(tvb, pinfo, tree, + offset, &dc, &trunc, si); + if (trunc) + break; + } + } else { col_append_str(pinfo->cinfo, COL_INFO, - ", Files:"); - } - - while (count--) { - offset = dissect_ff2_response_data(tvb, pinfo, tree, - offset, &dc, &trunc, si); - if (trunc) - break; + ", No files found"); } break; case 0x0003: /*TRANS2_QUERY_FS_INFORMATION*/ @@ -16540,10 +16581,11 @@ dissect_transaction2_response_parameters(tvbuff_t *tvb, packet_info *pinfo, prot proto_item *item = NULL; proto_tree *tree = NULL; smb_transact2_info_t *t2i; - guint16 fid; + uint16_t fid; int lno; int offset = 0; int pc; + uint32_t search_id; pc = tvb_reported_length(tvb); @@ -16574,7 +16616,7 @@ dissect_transaction2_response_parameters(tvbuff_t *tvb, packet_info *pinfo, prot case 0x00: /*TRANS2_OPEN2*/ /* fid */ fid = tvb_get_letohs(tvb, offset); - dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, TRUE, FALSE, FALSE, si); + dissect_smb_fid(tvb, pinfo, tree, offset, 2, fid, true, false, false, si); offset += 2; /* @@ -16597,7 +16639,7 @@ dissect_transaction2_response_parameters(tvbuff_t *tvb, packet_info *pinfo, prot /* create time */ offset = dissect_smb_datetime(tvb, tree, offset, hf_smb_create_time, - hf_smb_create_dos_date, hf_smb_create_dos_time, TRUE); + hf_smb_create_dos_date, hf_smb_create_dos_time, true); /* data size */ proto_tree_add_item(tree, hf_smb_data_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); @@ -16611,7 +16653,7 @@ dissect_transaction2_response_parameters(tvbuff_t *tvb, packet_info *pinfo, prot offset += 2; /* IPC State */ - offset = dissect_ipc_state(tvb, tree, offset, FALSE); + offset = dissect_ipc_state(tvb, tree, offset, false); /* open_action */ offset = dissect_open_action(tvb, tree, offset); @@ -16634,12 +16676,16 @@ dissect_transaction2_response_parameters(tvbuff_t *tvb, packet_info *pinfo, prot proto_tree_add_uint(tree, hf_smb_ff2_information_level, tvb, 0, 0, si->info_level); /* sid */ - proto_tree_add_item(tree, hf_smb_search_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); + + proto_tree_add_item_ret_uint(tree, hf_smb_search_id, tvb, offset, 2, + ENC_LITTLE_ENDIAN, &search_id); offset += 2; + col_append_fstr(pinfo->cinfo, COL_INFO, ", Search ID: %u", (uint16_t)search_id); + /* search count */ si->info_count = tvb_get_letohs(tvb, offset); - proto_tree_add_uint(tree, hf_smb_search_count, tvb, offset, 2, si->info_count); + proto_tree_add_uint(tree, hf_smb_search_count_found, tvb, offset, 2, si->info_count); offset += 2; /* end of search */ @@ -16659,7 +16705,7 @@ dissect_transaction2_response_parameters(tvbuff_t *tvb, packet_info *pinfo, prot case 0x02: /*TRANS2_FIND_NEXT2*/ /* search count */ si->info_count = tvb_get_letohs(tvb, offset); - proto_tree_add_uint(tree, hf_smb_search_count, tvb, offset, 2, si->info_count); + proto_tree_add_uint(tree, hf_smb_search_count_found, tvb, offset, 2, si->info_count); offset += 2; /* end of search */ @@ -16795,16 +16841,17 @@ dissect_transaction2_response_parameters(tvbuff_t *tvb, packet_info *pinfo, prot static int dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si) { - guint8 sc, wc; - guint16 od = 0, po = 0, pc = 0, pd = 0, dc = 0, dd = 0, td = 0, tp = 0; + uint8_t sc, wc; + uint16_t od = 0, po = 0, pc = 0, pd = 0, dc = 0, dd = 0, td = 0, tp = 0; smb_transact2_info_t *t2i = NULL; - guint16 bc; + uint32_t pid_mid = 0; + uint16_t bc; int padcnt; - gboolean dissected_trans; + bool dissected_trans; fragment_head *r_fd = NULL; tvbuff_t *pd_tvb = NULL, *d_tvb = NULL, *p_tvb = NULL; tvbuff_t *s_tvb = NULL, *sp_tvb = NULL; - gboolean save_fragmented; + bool save_fragmented; proto_item *item; DISSECTOR_ASSERT(si); @@ -16944,13 +16991,44 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree proto_tree_add_uint(tree, hf_smb_data_offset16, tvb, offset, 2, od); offset += 2; - /* data disp */ + /* data displacement + * The amount of data sent NOT including the data in this packet. If there are more + * data to send per "Total Data Count", transact continuation packets will follow + * until the td is reached (dd + dc = td). + */ dd = tvb_get_letohs(tvb, offset); proto_tree_add_uint(tree, hf_smb_data_disp16, tvb, offset, 2, dd); offset += 2; + /* Now that an FF2 FIND_NEXT2 or SET_FILE_INFO, or a SET_PATH_INFO response has been fully decoded, + * we can remove it from the unmatched table. They were left in there to prevent + * "response<unknown>" errors whenever there are multiple responses to the same request, + * or requests with "Subcommand: <UNKNOWN>" errors, respectively. + */ + if (pinfo->fd->visited && t2i) { + if (t2i->subcmd == 0x0001 || t2i->subcmd == 0x0002 || + t2i->subcmd == 0x0006 || t2i->subcmd == 0x0008 || + si->cmd == SMB_COM_TRANSACTION2_SECONDARY || + si->cmd == SMB_COM_TRANSACTION_SECONDARY || + si->cmd == SMB_COM_NT_TRANSACT_SECONDARY) { + + pid_mid = (si->pid << 16) | si->mid; + g_hash_table_remove(si->ct->unmatched, GUINT_TO_POINTER(pid_mid)); + } + } + + if (td && td >= dc + dd ) { + uint16_t diff = td - (dc + dd); + item = proto_tree_add_uint(tree, hf_bytes_until_total_data_count, tvb, 0, 0, diff); + proto_item_set_generated(item); + } + if (td && t2i) { + col_append_fstr(pinfo->cinfo, COL_INFO, + ", Data: %u of %u", dc + dd, td); + } + /* setup count */ - sc = tvb_get_guint8(tvb, offset); + sc = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_smb_setup_count, tvb, offset, 1, sc); offset += 1; @@ -16987,7 +17065,7 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* oh yeah, either data or parameter section needs reassembly */ - pinfo->fragmented = TRUE; + pinfo->fragmented = true; if (smb_trans_reassembly) { /* ...and we were told to do reassembly */ if (pc) { @@ -17107,7 +17185,7 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree if (si->cmd == SMB_COM_TRANSACTION) { smb_transact_info_t *tri; - dissected_trans = FALSE; + dissected_trans = false; if ((si->sip != NULL) && (si->sip->extra_info_type == SMB_EI_TRI)) tri = (smb_transact_info_t *)si->sip->extra_info; else @@ -17147,12 +17225,6 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } } - - if ( (p_tvb == 0) && (d_tvb == 0) ) { - col_append_str(pinfo->cinfo, COL_INFO, - "[transact continuation]"); - } - pinfo->fragmented = save_fragmented; END_OF_SMB @@ -17163,8 +17235,8 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree static int 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_) { - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; WORD_COUNT; @@ -17187,8 +17259,8 @@ dissect_find_notify_close(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre static int dissect_unknown(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, proto_tree *smb_tree _U_, smb_info_t *si _U_) { - guint8 wc; - guint16 bc; + uint8_t wc; + uint16_t bc; WORD_COUNT; @@ -17215,7 +17287,7 @@ typedef struct _smb_function { int (*response)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree, smb_info_t *si); } smb_function; -static smb_function smb_dissector[256] = { +static const smb_function smb_dissector[256] = { /* 0x00 Create Dir*/ {dissect_old_dir_request , dissect_empty}, /* 0x01 Delete Dir*/ {dissect_old_dir_request , dissect_empty}, /* 0x02 Open File*/ {dissect_open_file_request , dissect_open_file_response}, @@ -17271,7 +17343,7 @@ static smb_function smb_dissector[256] = { /* 0x31 Close And Tree Disconnect */ {dissect_close_file_request , dissect_empty}, /* 0x32 Transaction2*/ {dissect_transaction_request , dissect_transaction_response}, /* 0x33 Transaction2 Secondary*/ {dissect_transaction_request , dissect_unknown}, /*This SMB has no response */ - /* 0x34 Find Close2*/ {dissect_sid , dissect_empty}, + /* 0x34 Find Close2*/ {dissect_search_id , dissect_empty}, /* 0x35 Find Notify Close*/ {dissect_find_notify_close , dissect_empty}, /* 0x36 */ {dissect_unknown, dissect_unknown}, /* 0x37 */ {dissect_unknown, dissect_unknown}, @@ -17490,7 +17562,7 @@ static smb_function smb_dissector[256] = { }; static int -dissect_smb_command(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *smb_tree, guint8 cmd, gboolean first_pdu, smb_info_t *si) +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) { smb_saved_info_t *sip; @@ -17526,7 +17598,7 @@ dissect_smb_command(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *s if (sip && sip->fid) { if ( (si->request && (!sip->fid_seen_in_request)) || ((!si->request) && sip->fid_seen_in_request) ) { - dissect_smb_fid(tvb, pinfo, cmd_tree, offset, 0, sip->fid, FALSE, FALSE, TRUE, si); + dissect_smb_fid(tvb, pinfo, cmd_tree, offset, 0, sip->fid, false, false, true, si); } } @@ -17666,7 +17738,7 @@ value_string_ext smb_cmd_vals_ext = VALUE_STRING_EXT_INIT(smb_cmd_vals); static void -free_hash_tables(gpointer ctarg, gpointer user_data _U_) +free_hash_tables(void *ctarg, void *user_data _U_) { conv_tables_t *ct = (conv_tables_t *)ctarg; @@ -17775,31 +17847,25 @@ VALUE_STRING_ENUM(HRD_errors); VALUE_STRING_ARRAY(HRD_errors); static value_string_ext HRD_errors_ext = VALUE_STRING_EXT_INIT(HRD_errors); -static const char *decode_smb_error(guint8 errcls, guint16 errcode) +static const char *decode_smb_error(uint8_t errcls, uint16_t errcode) { switch (errcls) { case SMB_SUCCESS: - - return("No Error"); /* No error ??? */ + return "No Error"; /* No error ??? */ case SMB_ERRDOS: - - return(val_to_str_ext(errcode, &DOS_errors_ext, "Unknown DOS error (%x)")); + return val_to_str_ext(errcode, &DOS_errors_ext, "Unknown DOS error (%x)"); case SMB_ERRSRV: - - return(val_to_str_ext(errcode, &SRV_errors_ext, "Unknown SRV error (%x)")); + return val_to_str_ext(errcode, &SRV_errors_ext, "Unknown SRV error (%x)"); case SMB_ERRHRD: - - return(val_to_str_ext(errcode, &HRD_errors_ext, "Unknown HRD error (%x)")); + return val_to_str_ext(errcode, &HRD_errors_ext, "Unknown HRD error (%x)"); default: - - return("Unknown error class!"); - + return "Unknown error class!"; } } @@ -17940,20 +18006,21 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da proto_item *item; proto_tree *tree, *htree; proto_item *tmp_item = NULL; - guint8 flags; - guint16 flags2; + uint8_t flags; + uint16_t flags2; smb_info_t *si; smb_saved_info_t *sip = NULL; smb_saved_info_key_t key; smb_saved_info_key_t *new_key; - guint8 errclass = 0; - guint16 errcode = 0; - guint32 pid_mid; + uint8_t errclass = 0; + uint16_t errcode = 0; + uint32_t pid_mid; conversation_t *conversation; nstime_t t, deltat; + smb_transact2_info_t *t2i = NULL; + bool remove = true; si = wmem_new0(wmem_packet_scope(), smb_info_t); - top_tree_global = parent_tree; col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMB"); @@ -17961,8 +18028,8 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da /* start off using the local variable, we will allocate a new one if we need to*/ - si->cmd = tvb_get_guint8(tvb, offset+4); - flags = tvb_get_guint8(tvb, offset+9); + si->cmd = tvb_get_uint8(tvb, offset+4); + flags = tvb_get_uint8(tvb, offset+9); /* * XXX - in some SMB-over-OSI-transport and SMB-over-Vines traffic, * the direction flag appears never to be set, even for what appear @@ -17973,9 +18040,9 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da si->request = !(flags&SMB_FLAGS_DIRN); flags2 = tvb_get_letohs(tvb, offset+10); if (flags2 & 0x8000) { - si->unicode = TRUE; /* Mark them as Unicode */ + si->unicode = true; /* Mark them as Unicode */ } else { - si->unicode = FALSE; + si->unicode = false; } si->tid = tvb_get_letohs(tvb, offset+24); si->pid = tvb_get_letohs(tvb, offset+26); @@ -18035,17 +18102,11 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da /* this is a broadcast SMB packet, there will not be a reply. We don't need to do anything */ - si->unidir = TRUE; - } else if ( (si->cmd == SMB_COM_NT_CANCEL) /* NT Cancel */ - || (si->cmd == SMB_COM_TRANSACTION_SECONDARY) /* Transaction Secondary */ - || (si->cmd == SMB_COM_TRANSACTION2_SECONDARY) /* Transaction2 Secondary */ - || (si->cmd == SMB_COM_NT_TRANSACT_SECONDARY)) { /* NT Transaction Secondary */ - /* Ok, we got a special request type. This request is either - an NT Cancel or a continuation relative to a real request - in an earlier packet. In either case, we don't expect any - responses to this packet. For continuations, any later - responses we see really just belong to the original request. - Anyway, we want to remember this packet somehow and + si->unidir = true; + } else if (si->cmd == SMB_COM_NT_CANCEL) /* NT Cancel */ + /* Ok, we got a special request type. This request is an + an NT Cancel. We don't expect any responses to this packet. + Anyway, we want to remembe0 this packet somehow and remember which original request it is associated with so we can say nice things such as "This is a Cancellation to the request in frame x", but we don't want the @@ -18057,8 +18118,17 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da requests smb_saved_info_t but we don't touch it or change anything in it. */ - - si->unidir = TRUE; /*we don't expect an answer to this one*/ + si->unidir = true; /*we don't expect an answer to this one*/ + + else if ((si->cmd == SMB_COM_TRANSACTION_SECONDARY) /* Transaction Secondary */ + || (si->cmd == SMB_COM_TRANSACTION2_SECONDARY) /* Transaction2 Secondary */ + || (si->cmd == SMB_COM_NT_TRANSACT_SECONDARY)) { /* NT Transaction Secondary */ + /* In the case of secondariy requests there is response to the initial request + followed by one or more secondary *requests* then another response. Each + of the secondaries should point to the second response as the response + and have "Response in: <second response's frame number>". + */ + si->unidir = false; if (!pinfo->fd->visited) { /* try to find which original call we match and if we @@ -18077,8 +18147,24 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da new_key = wmem_new(wmem_file_scope(), smb_saved_info_key_t); new_key->frame = pinfo->num; new_key->pid_mid = pid_mid; - g_hash_table_insert(si->ct->matched, new_key, - sip); + /* + * With secondary requests there is a command such as + * SET_FILE_INFO, an immediate response, one or more + * secondaries containing the remaining data, followed by + * another response. Each secondary shows command as the + * request, and the *second* response as the response. + * The second request shows the command as the request. + * Finally the command request shows the second response + * as the response frame. We need to set sip->frame_res = 0 + * so that the second response will be matched to each + * secondary request. + */ + if ((si->cmd == SMB_COM_TRANSACTION_SECONDARY) || + (si->cmd == SMB_COM_TRANSACTION2_SECONDARY) || + (si->cmd == SMB_COM_NT_TRANSACT_SECONDARY)) { + sip->frame_res = 0; + } + g_hash_table_insert(si->ct->matched, new_key, sip); } else { if ((si->cmd == SMB_COM_TRANSACTION_SECONDARY) || (si->cmd == SMB_COM_TRANSACTION2_SECONDARY) || @@ -18114,7 +18200,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da case SMB_COM_TRANSACTION_SECONDARY: case SMB_COM_TRANSACTION2_SECONDARY: case SMB_COM_NT_TRANSACT_SECONDARY: - tmp_item = proto_tree_add_uint(htree, hf_smb_continuation_to, + tmp_item = proto_tree_add_uint(htree, hf_smb_continuation_of, tvb, 0, 0, sip->frame_req); proto_item_set_generated(tmp_item); break; @@ -18127,12 +18213,12 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da case SMB_COM_TRANSACTION_SECONDARY: case SMB_COM_TRANSACTION2_SECONDARY: case SMB_COM_NT_TRANSACT_SECONDARY: - proto_tree_add_uint_format_value(htree, hf_smb_continuation_to, tvb, 0, 0, 0, "<unknown frame>"); + proto_tree_add_uint_format_value(htree, hf_smb_continuation_of, tvb, 0, 0, 0, "<unknown frame>"); break; } } } else { /* normal bidirectional request or response */ - si->unidir = FALSE; + si->unidir = false; if (!pinfo->fd->visited) { /* first see if we find an unmatched smb "equal" to @@ -18140,7 +18226,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da */ sip = (smb_saved_info_t *)g_hash_table_lookup(si->ct->unmatched, GUINT_TO_POINTER(pid_mid)); if (sip != NULL) { - gboolean cmd_match = FALSE; + bool cmd_match = false; /* * Make sure the SMB we found was the @@ -18149,22 +18235,22 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da * to that command. */ if (si->cmd == sip->cmd) { - cmd_match = TRUE; + cmd_match = true; } else if (si->cmd == SMB_COM_NT_CANCEL) { - cmd_match = TRUE; + cmd_match = true; } else if ((si->cmd == SMB_COM_TRANSACTION_SECONDARY) && (sip->cmd == SMB_COM_TRANSACTION)) { - cmd_match = TRUE; + cmd_match = true; } else if ((si->cmd == SMB_COM_TRANSACTION2_SECONDARY) && (sip->cmd == SMB_COM_TRANSACTION2)) { - cmd_match = TRUE; + cmd_match = true; } else if ((si->cmd == SMB_COM_NT_TRANSACT_SECONDARY) && (sip->cmd == SMB_COM_NT_TRANSACT)) { - cmd_match = TRUE; + cmd_match = true; } if ( (si->request) || (!cmd_match) ) { @@ -18206,7 +18292,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da new_key->pid_mid = pid_mid; g_hash_table_insert(si->ct->matched, new_key, sip); /* We remove the entry for unmatched since we have found a match. - * We have to do this since the MID value wraps so quickly (effective only 10 bits) + * We have to do this since the MID value wraps so quickly * and if there is packetloss in the trace (maybe due to large holes * created by a sniffer device not being able to keep up * with the line rate. @@ -18217,14 +18303,37 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da * 4, <- Response MID:5 * We DON'T want #4 to be presented as a response to #1 */ - g_hash_table_remove(si->ct->unmatched, GUINT_TO_POINTER(pid_mid)); + /* Prevent "FIND_FIRST2 <unknown>", "FIND_NEXT2 <unknown>" + * "SET_FILE_INFO <unknown>" INFO and "SET_PATH_INFO <unknown>" responses + * when there are multiple responses to the same request. And prevent + * "Continuation of: <unknown frame>" in Trans2 Secondary requests. + * We leave the pid_mid of these responses and requests in the unmatched + * table until all of them have been fully processed. + */ + if (sip->extra_info_type == SMB_EI_T2I) { + t2i = (smb_transact2_info_t *)sip->extra_info; + if (t2i) { + /* FIND_FIRST2 or FIND_NEXT2 or + * SET_FILE INFO or SET_PATH_INFO + */ + if (t2i->subcmd == 0x0001 || t2i->subcmd == 0x0002 || + t2i->subcmd == 0x0006 || t2i->subcmd == 0x0008) { + remove = false; + } + } + } + if (si->cmd == SMB_COM_TRANSACTION2_SECONDARY || + si->cmd == SMB_COM_TRANSACTION_SECONDARY || + si->cmd == SMB_COM_NT_TRANSACT_SECONDARY) { + remove = false; + } + if (remove) { + g_hash_table_remove(si->ct->unmatched, GUINT_TO_POINTER(pid_mid)); + } + } else { /* We have already seen another response to this MID. - Since the MID in reality is only something like 10 bits - this probably means that we just have a MID that is being - reused due to the small MID space and that this is a new - command we did not see the original request for. - */ + */ sip = NULL; } } @@ -18235,6 +18344,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da sip = (smb_saved_info_t *)g_hash_table_lookup(si->ct->primaries, GUINT_TO_POINTER(pid_mid)); } } + if (si->request) { sip = wmem_new(wmem_file_scope(), smb_saved_info_t); sip->frame_req = pinfo->num; @@ -18322,7 +18432,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da } else { /* handle DOS error code & class */ - errclass = tvb_get_guint8(tvb, offset); + errclass = tvb_get_uint8(tvb, offset); proto_tree_add_uint(htree, hf_smb_error_class, tvb, offset, 1, errclass); offset += 1; @@ -18430,9 +18540,9 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da * need to track it */ if (!pinfo->fd->visited && (si->cmd == 0x75) && !si->request) { - offset = dissect_smb_tid(tvb, pinfo, htree, offset, (guint16)si->tid, TRUE, FALSE, si); + offset = dissect_smb_tid(tvb, pinfo, htree, offset, (uint16_t)si->tid, true, false, si); } else { - offset = dissect_smb_tid(tvb, pinfo, htree, offset, (guint16)si->tid, FALSE, FALSE, si); + offset = dissect_smb_tid(tvb, pinfo, htree, offset, (uint16_t)si->tid, false, false, si); } /* PID */ @@ -18450,7 +18560,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da the tap listener called even if there is an exception. */ tap_queue_packet(smb_tap, pinfo, si); - dissect_smb_command(tvb, pinfo, offset, tree, si->cmd, TRUE, si); + dissect_smb_command(tvb, pinfo, offset, tree, si->cmd, true, si); /* Append error info from this packet to info string. */ if (!si->request) { @@ -18486,22 +18596,22 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da return tvb_captured_length(tvb); } -static gboolean -dissect_smb_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_) +static bool +dissect_smb_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data) { /* must check that this really is a smb packet */ if (tvb_reported_length(tvb) < 4) - return FALSE; + return false; - if ( (tvb_get_guint8(tvb, 0) != 0xff) - || (tvb_get_guint8(tvb, 1) != 'S') - || (tvb_get_guint8(tvb, 2) != 'M') - || (tvb_get_guint8(tvb, 3) != 'B') ) { - return FALSE; + if ( (tvb_get_uint8(tvb, 0) != 0xff) + || (tvb_get_uint8(tvb, 1) != 'S') + || (tvb_get_uint8(tvb, 2) != 'M') + || (tvb_get_uint8(tvb, 3) != 'B') ) { + return false; } dissect_smb(tvb, pinfo, parent_tree, data); - return TRUE; + return true; } void @@ -18544,9 +18654,9 @@ proto_register_smb(void) { "Response in", "smb.response_in", FT_FRAMENUM, BASE_NONE, NULL, 0, "The response to this packet is in this packet", HFILL }}, - { &hf_smb_continuation_to, - { "Continuation to", "smb.continuation_to", FT_FRAMENUM, BASE_NONE, - NULL, 0, "This packet is a continuation to the packet in this frame", HFILL }}, + { &hf_smb_continuation_of, + { "Continuation of", "smb.continuation_of", FT_FRAMENUM, BASE_NONE, + NULL, 0, "This packet is a continuation of the packet in this frame", HFILL }}, { &hf_smb_nt_status, { "NT Status", "smb.nt_status", FT_UINT32, BASE_HEX | BASE_EXT_STRING, @@ -18902,6 +19012,10 @@ proto_register_smb(void) { "System Time", "smb.system.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0, NULL, HFILL }}, + { &hf_smb_secondaries_will_follow, + { "Secondaries will follow", "smb.secondaries_will_follow", FT_BYTES, BASE_NONE, + NULL, 0, "Level of interest is Info Set EAs and TDC > DC so SECONDARY reqs will follow", HFILL }}, + { &hf_smb_unknown, { "Unknown Data", "smb.unknown_data", FT_BYTES, BASE_NONE, NULL, 0, "Unknown Data. Should be implemented by someone", HFILL }}, @@ -19218,11 +19332,11 @@ proto_register_smb(void) { &hf_smb_mac_file_count, { "Root File Count", "smb.file.count", FT_UINT32, BASE_DEC, - NULL, 0, "File Count", HFILL}}, + NULL, 0, NULL, HFILL}}, { &hf_smb_mac_dir_count, { "Root Directory Count", "smb.dir.count", FT_UINT32, BASE_DEC, - NULL, 0, "Directory Count", HFILL}}, + NULL, 0, NULL, HFILL}}, { &hf_smb_mac_sup, { "Mac Support Flags", "smb.mac", FT_UINT32, BASE_HEX, @@ -19314,6 +19428,10 @@ proto_register_smb(void) { "Data Length High (multiply with 64K)", "smb.data_len_high", FT_UINT16, BASE_DEC, NULL, 0, "Length of data, High 16 bits", HFILL }}, + { &hf_bytes_until_total_data_count, + { "Bytes remaining until TDC", "smb.bytes_until_tdc", FT_UINT16, BASE_DEC, + NULL, 0, "Bytes remaining until the total data length is reached", HFILL }}, + { &hf_smb_seek_mode, { "Seek Mode", "smb.seek_mode", FT_UINT16, BASE_DEC, VALS(seek_mode_vals), 0, "Seek Mode, what type of seek", HFILL }}, @@ -19639,7 +19757,7 @@ proto_register_smb(void) NULL, 0, "Total number of parameter bytes", HFILL }}, { &hf_smb_total_data_count, - { "Total Data Count", "smb.tdc", FT_UINT32, BASE_DEC, + { "Total Data Count", "smb.tdc", FT_UINT16, BASE_DEC, NULL, 0, "Total number of data bytes", HFILL }}, { &hf_smb_max_param_count, @@ -19704,7 +19822,7 @@ proto_register_smb(void) { &hf_smb_nt_ioctl_isfsctl, { "IsFSctl", "smb.nt.ioctl.isfsctl", FT_UINT8, BASE_DEC, - VALS(nt_ioctl_isfsctl_vals), 0, "Is this a device IOCTL (FALSE) or FS Control (TRUE)", HFILL }}, + VALS(nt_ioctl_isfsctl_vals), 0, "Is this a device IOCTL (false) or FS Control (true)", HFILL }}, { &hf_smb_nt_ioctl_flags_completion_filter, { "Completion Filter", "smb.nt.ioctl.completion_filter", FT_UINT8, BASE_HEX, @@ -20105,7 +20223,7 @@ proto_register_smb(void) { &hf_smb_sec_desc_len, { "NT Security Descriptor Length", "smb.sec_desc_len", FT_UINT32, BASE_DEC, - NULL, 0, "Security Descriptor Length", HFILL }}, + NULL, 0, NULL, HFILL }}, { &hf_smb_nt_qsd, { "Security Information", "smb.nt_qsd", FT_UINT32, BASE_HEX, @@ -20287,10 +20405,14 @@ proto_register_smb(void) { "One Way Transaction", "smb.transaction.flags.owt", FT_BOOLEAN, 16, TFS(&tfs_tf_owt), 0x0002, "One Way Transaction (no response)?", HFILL }}, - { &hf_smb_search_count, - { "Search Count", "smb.search_count", FT_UINT16, BASE_DEC, + { &hf_smb_search_count_max, + { "Search Count Max", "smb.search_count_max", FT_UINT16, BASE_DEC, NULL, 0, "Maximum number of search entries to return", HFILL }}, + { &hf_smb_search_count_found, + { "Search Count Found", "smb.search_count_found", FT_UINT16, BASE_DEC, + NULL, 0, "The number of files found", HFILL }}, + { &hf_smb_search_pattern, { "Search Pattern", "smb.search_pattern", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, @@ -20320,15 +20442,15 @@ proto_register_smb(void) TFS(&tfs_ff2_close), 0x0001, "Close search after this request", HFILL }}, { &hf_smb_ff2_information_level, - { "Level of Interest", "smb.ff2_loi", FT_UINT16, BASE_DEC, + { "Level of Interest", "smb.ff2_loi", FT_UINT16, BASE_HEX, VALS(ff2_il_vals), 0, "Level of interest for FIND_FIRST2 command", HFILL }}, { &hf_smb_qpi_loi, - { "Level of Interest", "smb.qpi_loi", FT_UINT16, BASE_DEC, + { "Level of Interest", "smb.qpi_loi", FT_UINT16, BASE_HEX, VALS(qpi_loi_vals), 0, "Level of interest for TRANSACTION[2] QUERY_{FILE,PATH}_INFO commands", HFILL }}, { &hf_smb_spi_loi, - { "Level of Interest", "smb.spi_loi", FT_UINT16, BASE_DEC | BASE_EXT_STRING, + { "Level of Interest", "smb.spi_loi", FT_UINT16, BASE_HEX | BASE_EXT_STRING, &spi_loi_vals_ext, 0, "Level of interest for TRANSACTION[2] SET_{FILE,PATH}_INFO commands", HFILL }}, #if 0 @@ -21268,7 +21390,7 @@ proto_register_smb(void) NULL, 0x0, NULL, HFILL }}, }; - static gint *ett[] = { + static int *ett[] = { &ett_smb, &ett_smb_fid, &ett_smb_tid, |