Kerberos: define HostAddress/addr-type as a FT_UINT32 field

Fixes part of bug 10019

Change-Id: Id367d6c86533c840ea2ff40ef96b1c1854b96150
Reviewed-on: https://code.wireshark.org/review/1288
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Fix copy & paste error in tvb_extract_utf_16_string, tvb_extract_ucs_4_string.

Use proper p{le,n}toh16 macro depending on endianess.

Change-Id: I8323e4296ec88e2cb24f54a1d8dc89328edb1957
Reviewed-on: https://code.wireshark.org/review/1285
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Fix up get_hfi_length():

Treat FT_BYTES and a few others the same as FT_PROTOCOL: allow a zero length
but throw an exception if the offset is already beyond the end of the TVB
(prior to this change it would assert out).  This (when manually applied to
master-1.10) fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9999 .

While we're at it: tvb_captured_length_remaining() no longer returns -1 (see
r52571) so don't expect it to.  Instead just use
tvb_ensure_captured_length_remaining() to throw an exception if the offset is
bad.

Change-Id: I686722a4fed46b86139466afcf64ff02f319c702
Reviewed-on: https://code.wireshark.org/review/1289
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Fix generator to remove Dead Store (Dead assignement/Dead increment) warning found by Clang.

(not sure why, but regeneration also "moved" some hf_ variables from previous version)

Change-Id: I197eacbb3f892dbdca6e6bc354fc88240c1bfb34
Reviewed-on: https://code.wireshark.org/review/1291
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Another cut-and-pasteo - UCS-4/UTF-32 should fetch 4-byte characters.

Change-Id: Iff4a659cb0d0062cc149f451e49474c8db4143cd
Reviewed-on: https://code.wireshark.org/review/1292
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Bugfix generating a sequence of "native" types.  Bug 9532.

Previously a sequence of "native" types (int, float, etc) generated a proto_tree_add_uint (for the loop over the sequence) and a proto_tree_add_XXX (for the "native" type), but only 1 hf variable was created for the "loop" field, so DISSECTOR_ASSERT_NOT_REACHED would be generated if "native" type != uint.  Now a separate hf_ variable is generated for the "loop" and "native" type.

Also update existing IDL dissectors with new generator logic.

Change-Id: Ie4d1edfd67a8e6f02834573f29f07baf79058534
Reviewed-on: https://code.wireshark.org/review/1274
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Fix LISP dissectior regressions introduced in 1.11

This patch fixes dissection of some fields and restores some of the
output before the dissector was updated not to use proto_tree_add_text()
calls.

While at it improve the consistency in the code.

Change-Id: Ic30e60de1382f4325bd75e814444205f2fc5a359
Signed-off-by: Lorand Jakab <ljakab@ac.upc.edu>
Reviewed-on: https://code.wireshark.org/review/1283
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Kerberos: put PDU dissection under Kerberos tree and remove duplicate PDU name

Change-Id: Id4824ad3a7bca1959579e5fd0a17a67c6bcda174
Reviewed-on: https://code.wireshark.org/review/1293
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
CaptureDialog: Fix IF type for user created pipe

 - If a user adds a pipe via "Capture Options"->"Manage Interfaces"
   ->"Pipes" the device.if_type.type is either not filled out (in
   the case if no other interfaces exist), or will be set to the
   last set if_type of the device queried by the iteration in line
   3537.

 - One could argue, that this is just a fixup, as still the issue
   remains, that the device structure will not be resetted, after
   the search for an already existing pipe element. Maybe a separate
   variable should be used for searching as it is used for adding
   the pipe

Change-Id: Ia727bf3ce270a62d065e8c524a13768af389c346
Reviewed-on: https://code.wireshark.org/review/1296
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Hash map implementation for wmem.

This has two expected uses:
- Many current users of wmem_tree don't actually need the predecessor lookup
  it provides (the lookup_le function family). A hash map provides straight
  insertion and lookup much more efficiently than a wmem_tree when predecessor
  lookup isn't needed.

- Many current users of glib's hash table and hash functions use untrusted data
  for keys, making them vulnerable to algorithmic complexity attacks. Care has
  been taken to make this implementation secure against such attacks, so it
  should be used whenever data is untrusted.

In my benchmarks it is measurably slower than GHashTable, but not excessively
so. Given the additional security it provides this seems like a reasonable
trade-off (and it is still faster than a wmem_tree).

Change-Id: I2d67a0d06029f14c153eaa42d5cfc774aefd9918
Reviewed-on: https://code.wireshark.org/review/1272
Reviewed-by: Evan Huus <eapache@gmail.com>
Add a cast to satisfy mac buildbot.

Change-Id: I625b025d3f8a57812512497c6104977ae5d10232
Reviewed-on: https://code.wireshark.org/review/1298
Reviewed-by: Evan Huus <eapache@gmail.com>
Revert "Create the HTTP tree after we're assured it's HTTP.  Otherwise a bogus tree is created when HTTP2 traffic is found."

It causes the DTLS decryption test suite to fail for some reason, and I don't have time/energy to investigate further, so we should probably revert it until that gets resolved.

This reverts commit fc5d8db74dc473610b9fc6c0c4b571d4aa65264a.

Change-Id: Iac9a7592047d2e080e380a70752efa076303e442
Reviewed-on: https://code.wireshark.org/review/1297
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Kerberos: use auto generated code for ADDR-TYPE instead of a hand made value_string array

Change-Id: I74089fe609368fdd582aef1f2cb00a3905e0641b
Reviewed-on: https://code.wireshark.org/review/1301
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Conversation/memory scope fixes for LBM dissectors. See bug 9718.

Change-Id: I58aa249d73ab44f5f56b1559b38b216cdb542ecb
Reviewed-on: https://code.wireshark.org/review/1280
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Continuation of bug 9532.

Ie4d1edfd67a8e6f02834573f29f07baf79058534 created a several duplicate hf_ registrations.  That led to the exposure of some other potential problems with generating sequences.

Still not quite complete, but want to pacify the buildbots, so there is a small amount of manual editing to comment out a few duplicated hfs in packet-parlay.c.

Change-Id: I0ff8a9795e213ab966db8d6333b9477bad06250b
Reviewed-on: https://code.wireshark.org/review/1302
Reviewed-by: Michael Mann <mmann78@netscape.net>
Don't throw for offset at end of TVB with len -1.

g867a1827e7dc88896ee27a107eb35c4b3973d270 introduced a change to cleanup/fix
handling of bounds checks for -1 length fields, but it ended up guaranteeing a
throw for 0-length tvbs, which isn't good; we ought to be able to add 0-length
FT_PROTOCOL items at the very least.

Better names for the function than _cheat are welcome, but I want to shut up the
buildbot.

Change-Id: I24610f947d03dac32766e2a0ffa0ff7bcc74c3e8
Reviewed-on: https://code.wireshark.org/review/1303
Reviewed-by: Evan Huus <eapache@gmail.com>
packet-mqtt.c: Minor cleanup

- Create/use an extended value string;
- Use ...add_text() instead of ..._add_string() for a packet details "header" line
   (Removes a filter named "mqtt" (not the 'protocol' filter));
- Fix what is (IMO) a slightly misleading display of "Connect Flags";
- Remove two lines of duplicate code;
- Localize some variables;
- Remove some unneeded initializers;
- Set tab-stops, etc in editor mode-lines to 8;
- 'offset++' ==> 'offset += 1';
- Do some minor whitespace changes.

Change-Id: Ia891c6893643790dbb26510f060c4fb6dfe1fe3a
Reviewed-on: https://code.wireshark.org/review/1304
Reviewed-by: Bill Meier <wmeier@newsguy.com>
MBIM: fix dissection of GSM SMS messages

Change-Id: I07e753e50a42513daa704e56ee5c9b399a91fec9
Reviewed-on: https://code.wireshark.org/review/1305
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Move kerberos to dirty dissector list

It currently generates some unused functions.

Change-Id: I59e2ffefbf66975d35f2a89c2c49c3ab61f41a84
Reviewed-on: https://code.wireshark.org/review/1306
Reviewed-by: Evan Huus <eapache@gmail.com>
Fix format warning.

Change-Id: I6627af8d90299d599db779bde0061191fc514fb3
Reviewed-on: https://code.wireshark.org/review/1307
Reviewed-by: Evan Huus <eapache@gmail.com>