Commit graph

249 commits

Author SHA1 Message Date
Guy Harris
a2414d8909 Don't wire into the reassembly code the notion that reassemblies should
be done on flows from one address to another; reassembly for protocols
running atop TCP should be done on flows from one TCP endpoint to
another.

We do this by:

	adding "reassembly table" as a data structure;

	associating hash tables for both in-progress reassemblies and
	completed reassemblies with that data structure (currently, not
	all reassemblies use the latter; they might keep completed
	reassemblies in the first table);

	having functions to create and destroy keys in that table;

	offering standard routines for doing address-based and
	address-and-port-based flow processing, so that dissectors not
	needing their own specialized flow processing can just use them.

This fixes some mis-reassemblies of NIS YPSERV YPALL responses (where
the second YPALL response is processed as if it were a continuation of
a previous response between different endpoints, even though said
response is already reassembled), and also allows the DCE RPC-specific
stuff to be moved out of epan/reassembly.c into the DCE RPC dissector.

svn path=/trunk/; revision=48491
2013-03-22 23:59:54 +00:00
Anders Broman
55c498169d From beroset:
remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48400
2013-03-18 21:16:23 +00:00
Evan Huus
f5c82262b4 Add two missing NULL checks, fixes most of
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8456

svn path=/trunk/; revision=48224
2013-03-10 13:40:50 +00:00
Alexis La Goutte
a4eb0a12ed From Jose Pico via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8377 NEW FEATURE IMPLEMENTED: SMB2 SUPPORT FOR EXPORT->OBJECTS->SMB
Added functionality:
- SMB2 support for Export->Objects->SMB
- support for SMB_COM_CREATE, SMB_COM_OPEN, SMB_COM_READ and SMB_COM_WRITE commands
- Ability to choose between File Id and full file name as identifier for file re-building. Implemented as an option under Edit->Preferences->Protocols->SMB and Edit->Preferences->Protocols->SMB2.

Other minor changes and fixes:
- Full filename in file
- Inclusion of IP of SMB server when treeid name (i.e. hostname) is not known
- UTF-8 filenames encoding before passing them to Export Object Window
- Re-written insert_chunk function of export_object_smb.c to make it easier to debug
- Fixed of an error in insert_chunk function of export_object_smb.c (the verification of next free_chunk was always skipped after deleting one free_chunk).
- Removed duplicated code by inserting the function feed_eo_smb in packet-smb.c and packet-smb2.c
- Changed the label of Export->Objects->SMB menu into Export->Objects->SMB/SMB2

svn path=/trunk/; revision=48210
2013-03-09 08:44:14 +00:00
Pascal Quantin
b9f723bb18 From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 :
Remove C++ incompatibilities from packet-smb.C

svn path=/trunk/; revision=47977
2013-03-01 18:35:51 +00:00
Guy Harris
29715ccc8f How can I get a new tvbuff that starts at an offset within a given
tvbuff and runs to the end of the tvbuff?  Let me count the ways....

Replace a bunch of different ways of doing that (some incorrect, in that
they're not properly handling tvbuffs where the captured and reported
lengths are different) with tvb_new_subset_remaining().

svn path=/trunk/; revision=47751
2013-02-19 23:17:07 +00:00
Bill Meier
c439b805e2 Comment out unused hf[] entries & etc.
(found by checkhf)

svn path=/trunk/; revision=47389
2013-01-31 17:55:31 +00:00
Alexis La Goutte
b0b96f7f07 From Richard Sharpe via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7840
packet-smb.c does not handle truncated frames well when dealing with TRANS2 FIND_{FIRST/NEXT} responses

The current code simply throws an exception if any of the expected data is
missing, even though there might be several file's worth of data available.

I will attach a patch that does a better job of handling truncated frames in
such cases.

svn path=/trunk/; revision=45480
2012-10-11 20:09:44 +00:00
Alexis La Goutte
a6c72491e4 From Richard Sharpe via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7838
packet-smb.c does not correctly dissect INFO_QUERY_EAS_FROM_LIST

[MS-CIFS].pdf makes it clear that, contrary to what packet-smb.c says, handling
the response to a TRANS2/FIND_{FIRST,NEXT} with a level of
INFO_QUERY_EAS_FROM_LIST is not the same as handling INFO_QUERY_EA_SIZE.


svn path=/trunk/; revision=45479
2012-10-11 20:01:37 +00:00
Jeff Morriss
2552c750e5 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45017
2012-09-20 02:03:38 +00:00
Jakub Zawadzki
5a8783f5b1 Initial commit to support yet another method of passing data between dissectors.
Add new parameter 'data' to heur_dissector_t and new_dissector_t, for now it's always NULL

svn path=/trunk/; revision=44860
2012-09-10 21:40:21 +00:00
Jeff Morriss
aa5d9d78dd From Robert Bullen via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7683 :
The reassembled fragments tree in the Packet Details view is awesome, but it
lacks one thing: a field that exposes the reassembled data.

tcp.data already exists for exposing a single TCP segment's payload as a byte
array. It would be handy to have something similar for a single application
layer PDU when TCP segment reassembly is involved. I propose
tcp.reassembled.data, named and placed after the already existing field
tcp.reassembled.length.

My primary use case for this feature is outputting tcp.reassembled.data with
tshark for further processing with a script.

The attached patch implements this very feature. Because the reassembled
fragment tree code is general purpose, i.e. not specific to just TCP, any
dissector that relies upon it can add a similar field very cheaply. In that
vein I've also implemented ip.reassembled.data and ipv6.reassembled.data, which
expose reassembled fragment data as a single byte stream for IPv4 and IPv6,
respectively. All other protocols that use the reassembly code have been left
alone, other than inserting NULL into their initializer lists for the newly
introduced struct field reassemble.h:fragment_items.hf_reassembled_data.

svn path=/trunk/; revision=44802
2012-09-07 02:09:59 +00:00
Michael Mann
a3db9aedfb bugfix minor memory leaks with GString use
svn path=/trunk/; revision=44514
2012-08-15 13:55:29 +00:00
Bill Meier
638d74d43f Use val_to_str_const() where appropriate;
Also (for a few files):
- create/use some extended value strings;
- remove unneeded #include files;
- remove unneeded variable initialization;
- re-order fcns slightly so prefs_reg_handoff...() at end, etc

svn path=/trunk/; revision=44438
2012-08-10 22:55:02 +00:00
Jakub Zawadzki
b6bc9e65be Fix memleak of list
Valgrind log:
  = 2,656 (640 direct, 2,016 indirect) bytes in 40 blocks are definitely lost in loss record 41,241 of 41,608
  =    at 0x4C26ABB: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
  =    by 0xC5B0574: g_malloc (in /usr/lib64/libglib-2.0.so.0.2800.8)
  =    by 0xC5C94DF: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.2800.8)
  =    by 0xC5CA5ED: g_slist_insert_sorted (in /usr/lib64/libglib-2.0.so.0.2800.8)
  =    by 0x697E8B8: dissect_smb_fid (packet-smb.c:3499)

svn path=/trunk/; revision=44067
2012-07-27 08:50:28 +00:00
Jakub Zawadzki
bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Bill Meier
e3b8929a46 General cleanup:
- Remove _U_ when function arg is actually used;
- Use consistent formatting and whitespace style.

svn path=/trunk/; revision=43500
2012-06-26 21:45:06 +00:00
Bill Meier
f7d834b564 Validate 'offset' before calling proto_item_set_end(); prevents potential 'Dissector Bug' msg
Addresses comment in Bug #7390 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7390#c1

svn path=/trunk/; revision=43496
2012-06-26 16:06:26 +00:00
Bill Meier
9b21bf229f Tighten up validity checking when doing reassembly.
Fixes Bug #7390  https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7390
(Esentially: Do proper validity checking to prevent a "Dissector Bug" exception;
             throw a BoundsError exception instead).


svn path=/trunk/; revision=43483
2012-06-25 20:43:54 +00:00
Anders Broman
9ee8562c32 From Richard Sharpe:
Wireshark is unable to dissect Security Descriptors that span TCP segments where some are not captured or reassembled

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7363

svn path=/trunk/; revision=43352
2012-06-19 10:30:51 +00:00
Guy Harris
86a888bc0d Set save_fragmented at the beginning of the routine, so it can always be
used at the end to restore pinfo->fragmented.

svn path=/trunk/; revision=43350
2012-06-19 08:24:23 +00:00
Guy Harris
98c0e827d0 In dissect_nt_transaction_request(), restore pinfo->fragmented before
returning.

svn path=/trunk/; revision=43348
2012-06-19 08:09:28 +00:00
Anders Broman
99e919bf8b From Richard Sharpe:
packet-smb.c does not properly handle NT TRANSACT requests (and probably TRANSACT and TRANSACT2 requests)

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7351

svn path=/trunk/; revision=43347
2012-06-19 06:24:30 +00:00
Pascal Quantin
08c7db0421 Display hf_smb_server_guid, hf_smb_volume_guid and hf_smb_dfs_referral_server_guid as FT_GUID
svn path=/trunk/; revision=42944
2012-05-31 13:22:52 +00:00
Pascal Quantin
48fee70339 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7307
svn path=/trunk/; revision=42939
2012-05-31 08:25:00 +00:00
Jeff Morriss
6341191d72 From Richard Sharpe on -dev:
Attached is a patch that fixes (I think) the handling of extended
responses on NTCreate&X requests.

svn path=/trunk/; revision=42923
2012-05-30 18:29:37 +00:00
Ronnie Sahlberg
ba54127556 SMB: Add dissection of TRANS2_REQUEST_TRANSPORT_ENCRYPTION messages
From Stefan Metzmacher <metze@samba.org>

svn path=/trunk/; revision=42771
2012-05-22 05:55:05 +00:00
Ronnie Sahlberg
50b992d139 SMB: Dissect TRANS2_SET_FS_INFORMATION infolevel
From Stefan Metzmacher <metze@samba.org>

svn path=/trunk/; revision=42770
2012-05-22 05:53:28 +00:00
Ronnie Sahlberg
920b760f15 SMB: Call dissect_nt_quota() via a new dissect_sfsi_request/response()
From Stefan Metzmacher <metze@samba.org>


svn path=/trunk/; revision=42769
2012-05-22 05:51:16 +00:00
Gerald Combs
bdb614e264 Fix a bunch of uninitialized variables found by Coverity Scan. CIDs
702403, 702404, 702405, 702406, 702407, 702408, 702409, 702410, 702411,
and 702412.

svn path=/trunk/; revision=42658
2012-05-16 16:29:12 +00:00
pascal
120f19310a From Evan Huus:
Remove unused variables in SMB dissector
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7211

svn path=/trunk/; revision=42318
2012-04-28 16:48:16 +00:00
Bill Meier
9c8a91f259 Use consistent indentation.
svn path=/trunk/; revision=40185
2011-12-13 21:03:57 +00:00
Bill Meier
4a976f1be7 Use tvb_new_child_real_data() instead of tvb_new_real_data() + tvb_set_child_real_data_tvbuff().
svn path=/trunk/; revision=40173
2011-12-13 04:01:33 +00:00
Bill Meier
54b72021bb Fix encoding arg for various fcn calls:
- proto_tree_add_bits_item
 - proto_tree_add_bits_ret_val
 - proto_tree_add_bitmask
 - tvb_get_bits
 - tvb_get_bits16
 - tvb_get_bits24
 - tvb_get_bits32
 - tvb_get_bits64


svn path=/trunk/; revision=39539
2011-10-24 19:57:53 +00:00
Bill Meier
794757ae8f For proto_tree_add_item(..., proto_xxx, ...)use ENC_NA as the encoding arg.
Also: remove trailing whitespace for a number of files.

svn path=/trunk/; revision=39503
2011-10-21 02:10:19 +00:00
Bill Meier
126aa85393 Convert proto_tree_add_item() 'encoding' arg for field types FT_STRING, FT_STRINGZ, FT_UINT_STRING as follows:
1. If there's no character encoding (ENC_ASCII, ...) specified
    then use ENC_ASCII.
 2. For all but FT_UINT_STRING, always use ENC_NA
    (replacing any existing True/1/FALSE/0
    /ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN).



svn path=/trunk/; revision=39426
2011-10-15 18:46:26 +00:00
Bill Meier
94f36ca4ff Use ENC_NA as encoding for proto_tree_add_item() calls which directly reference an hf item (in hf[] with types:
FT_NONE
   FT_BYTES
   FT_IPV6
   FT_IPXNET
   FT_OID

Note: Encoding field set to ENC_NA only if the field was previously TRUE|FALSE|ENC_LITTLE_ENDIAN|ENC_BIG_ENDIAN

svn path=/trunk/; revision=39260
2011-10-04 22:44:31 +00:00
Anders Broman
5d342b64ae Set encoding.
Should 
hf_smb_server_guid
hf_smb_dfs_referral_server_guid
be FT_GUIDS?

svn path=/trunk/; revision=39209
2011-10-01 08:11:06 +00:00
Bill Meier
c4b4394936 From Stefan Metzmacher: Support for SMB 2.22 features;
"Patches to add most things for SMB 2.22"

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6394

svn path=/trunk/; revision=39205
2011-10-01 01:57:38 +00:00
Bill Meier
7e1977c4d5 From Stefan Metzmacher: Fix flags in packet-smb
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6320

svn path=/trunk/; revision=38940
2011-09-08 16:19:35 +00:00
Stig Bjørlykke
6c6c045e3a Initialize trunc.
Fix CID 1229.

svn path=/trunk/; revision=38572
2011-08-16 19:25:29 +00:00
Jeff Morriss
7ad71a2d78 Treat TVBs as opaque: use the accessor functions instead of accessing the fields
directly.

svn path=/trunk/; revision=37420
2011-05-27 01:57:33 +00:00
Jeff Morriss
11ac49f225 Use tvb_get_ephemeral_string() instead of tvb_get_ptr().
svn path=/trunk/; revision=37322
2011-05-20 03:20:20 +00:00
Guy Harris
375b1bf4b4 Give some routines used for info levels that appear both in set and get
names beginning with dissect_qspi_, and give some of them names with the
info level structure in them rather than the SNIA CIFS specification
section number.

Have separate routines for SMB_INFO_STANDARD and SMB_INFO_QUERY_EA_SIZE;
SMB_INFO_STANDARD is specified differently in the SNIA CIFS
specification and the MS-CIFS specification, and some captures have the
SNIA CIFS version, with the EA length and some have the MS-CIFS version
without it.  The dissector for SMB_INFO_STANDARD will dissect it if it's
there and not say "this structure is truncated" if it's not there.

Rename dissect_qfi_SMB_FILE_ALTERNATE_NAME_INFO() to
dissect_qfi_SMB_FILE_NAME_INFO(), as it also dissects
SMB_QUERY_FILE_NAME_INFO.

Merge the dissectors for SMB_FILE_ALLOCATION_INFO and
SMB_SET_FILE_ALLOCATION_INFO, and for SMB_FILE_END_OF_FILE_INFO and
SMB_SET_FILE_END_OF_FILE_INFO, as the structures are the same.

Dissect some presumed "passthrough info levels" the same way the
corresponding official SMB infos are dissected.

Expand some comments for info level dissectors to give the MS-CIFS
section number and to give some other details.
 
If an info level is truncated, put in an expert info error.

If we don't know about a given info level, just dissect the body as
"Information level unknown", rather than having it dissected as an
"unknown information" trailer.

svn path=/trunk/; revision=37297
2011-05-19 16:22:21 +00:00
Guy Harris
0f41b64142 The routines declared in packet-smb.h are defined in packet-smb.c;
include packet-smb.h in packet-smb.c so that we check the declarations
against the definitions.

In query ops, info level 2 is Query EA Size, not Query EAs From List. 
In set ops, info level 2 is Set EAs, not Query EA Size.

Expand the constants for the Trans2 subcodes to 16 bits.

The tvb argument to dissect_find_file_unix_info2() is used.

svn path=/trunk/; revision=37286
2011-05-19 09:47:03 +00:00
Guy Harris
092b0120ae Don't leave the truncation flag unset in any of the info level
dissectors.

svn path=/trunk/; revision=37209
2011-05-17 20:04:22 +00:00
Guy Harris
9927d1ff31 Give the UNIX-extension routines used for info levels that appear both
in set and get names beginning with dissect_qspi_.

svn path=/trunk/; revision=37192
2011-05-16 22:55:22 +00:00
Guy Harris
88fe523c48 Fix some comments.
Get rid of null-pointer tests for t2i in the "not null" branch of an
earlier test whether it's null, as those tests are redundant.

Use a switch statement to check the subcommand for Trans2.

If t2i->info_level is -1, it means we don't know the info level, for
whatever reason (e.g., the request was cut short by the snapshot length
before the info level).  Report it as such.

svn path=/trunk/; revision=37183
2011-05-16 18:32:35 +00:00
Guy Harris
2a1e380545 Remove the qpi_ from info level dissectors used for set info calls as
well.

svn path=/trunk/; revision=37139
2011-05-14 02:52:04 +00:00
Guy Harris
03cd4f2cfd For Find File Unix and Unix Info2, spell it "Unix", to match Query File
and Set File.

Add Query and Set File Unix Info2; use common code to dissect the Unix
Info2 structure.  Use common code for Unix Basic, while we're at it.

svn path=/trunk/; revision=37138
2011-05-14 01:28:49 +00:00