aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mongo.c
AgeCommit message (Collapse)AuthorFilesLines
2018-11-14Update MongoDB ObjectID dissector elementDerick Rethans1-8/+20
The MongoDB ObjectID spec traditionally included a "host hash" and "PID" field. These have for a while been treated as random data for the server, and the MongoDB drivers have recently addopted a specification that says the same: https://github.com/mongodb/specifications/blob/master/source/objectid.rst#random-value This patch reorganises the original Host Hash and PID fields under a new "Machine ID" field, to be able to show both the current interpretation of the field, as well as the historical one. Change-Id: Ib25b5552935781bc512fcdadb870ed20838d8808 Reviewed-on: https://code.wireshark.org/review/30604 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-09-25Rename packet-ssl* to packet-tls*Gerald Combs1-1/+1
Rename packet-ssl{,-utils}.[ch] to packet-tls{,-utils}.[ch]. Change-Id: I4732162ec131ddf0734b3dd191ccc9e48a76ce06 Reviewed-on: https://code.wireshark.org/review/29659 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-12dissectors: use SPDX identifiers.Dario Lombardo1-13/+1
Change-Id: I92c94448e6641716d03158a5f332c8b53709423a Reviewed-on: https://code.wireshark.org/review/25756 Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-14Register the MongoDB dissector as SSL capable.Derick Rethans1-0/+2
Bug: 14275 Change-Id: Ia0d8d0b333f69e59ba54b0d788587484dfae950e Reviewed-on: https://code.wireshark.org/review/24827 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-10Add support for MongoDB OP_COMPRESSED packetsDerick Rethans1-48/+216
Bug: 14259 Change-Id: Iab6b494bebaa913267f94d41b7950b67dd406cb6 Reviewed-on: https://code.wireshark.org/review/24705 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-07mongo: Fix Dead Store (Dead assignement/Dead increment) Warning found by ClangAlexis La Goutte1-1/+1
Change-Id: I60ee2a37ff166b80ce11cf1c12e9c575bba85529 Reviewed-on: https://code.wireshark.org/review/24722 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Derick Rethans <github@derickrethans.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-21Add support for MongoDB 3.6's OP_MSG to dissectorDerick Rethans1-4/+173
Bug: 14230 Change-Id: I008a0fb60c441c5f71788d695b398b73b76c0d69 Reviewed-on: https://code.wireshark.org/review/24450 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-08Combine Decode As and port preferences for tcp.port dissector table.Michael Mann1-24/+1
This patch introduces new APIs to allow dissectors to have a preference for a (TCP) port, but the underlying data is actually part of Decode As functionality. For now the APIs are intentionally separate from the regular APIs that register a dissector within a dissector table. It may be possible to eventually combine the two so that all dissectors that register with a dissector table have an opportunity to "automatically" have a preference to adjust the "table value" through the preferences dialog. The tcp.port dissector table was used as the guinea pig. This will eventually be expanded to other dissector tables as well (most notably UDP ports). Some dissectors that "shared" a TCP/UDP port preference were also converted. It also removed the need for some preference callback functions (mostly when the callback function was the proto_reg_handoff function) so there is cleanup around that. Dissectors that has a port preference whose default was 0 were switched to using the dissector_add_for_decode_as_with_preference API rather than dissector_add_uint_with_preference Also added comments for TCP ports used that aren't IANA registered. Change-Id: I99604f95d426ad345f4b494598d94178b886eb67 Reviewed-on: https://code.wireshark.org/review/17724 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-08-21mongo: add support for new mongodb 3.2 wire protocol opcodesAlexis La Goutte1-0/+81
Add OP_COMMAND (2010) and OP_COMMANDREPLY (2011) Bug:12723 Change-Id: Ib66e7136c7a6589286bbea11db2cff76d689db35 Reviewed-on: https://code.wireshark.org/review/17166 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-08-19mongo: set on subtree when Empty DocumentAlexis La Goutte1-1/+1
Change-Id: I2b6b7cf771ab7bc2f6dbc0aac5eddda2a9d2fb53 Reviewed-on: https://code.wireshark.org/review/17167 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-16mongo: return the number of bytes we actually consumedMartin Kaiser1-2/+3
even if the document length is 0, we consumed at least 4 bytes for the length field bug: 12534 Change-Id: I2f1612bf575b558c1bcc0afe8202b202747846e3 Reviewed-on: https://code.wireshark.org/review/15934 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-12mongo: don't THROW() an exception from a dissectorMartin Kaiser1-3/+3
just return the overall length even if the value is not in line with the protocol specification Change-Id: Ieeb5d1d265acb6de807a1175f07c7981db4b6c2b Reviewed-on: https://code.wireshark.org/review/15833 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-13Use result of register_dissectorPeter Wu1-4/+3
Assign result of `register_dissector(..., func, proto)` to FOO_handle and remove `FOO_handle = create_dissector_handle(func, proto)`. Found by looking for files named packet-FOO.c having the above create_dissector_handle pattern. Some files (with different dissect routines for the two functions) remain unchanged. Change-Id: Ifbed8202c6dbc63a1dae9acc03313980ffbbbb90 Reviewed-on: https://code.wireshark.org/review/13247 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-09new_register_dissector -> register_dissector for dissector directory.Michael Mann1-1/+1
Change-Id: Ie39ef054a4a942687bd079f3a4d8c2cc55d5f22c Reviewed-on: https://code.wireshark.org/review/12485 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-09new_create_dissector_handle -> create_dissector_handle for dissector directory.Michael Mann1-1/+1
Some of the ASN.1 dissectors still generate a new_create_dissector_handle from the tool itself, so leave those for now. Change-Id: Ic6e5803b1444d7ac24070949f5fd557909a5641f Reviewed-on: https://code.wireshark.org/review/12484 Petri-Dish: Anders Broman <a.broman58@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-06-23Replace more deprecated tvb_length callsEvan Huus1-2/+2
The return values of new-style dissectors always use the captured length, so replace those automagically with sed. Change-Id: Ic43072ee4a80d433cd4264444583a0e670adc26a Reviewed-on: https://code.wireshark.org/review/9065 Reviewed-by: Evan Huus <eapache@gmail.com>
2015-02-13Register the Mongo dissector by name so it can be used with TLS.Jeff Morriss1-0/+6
Change-Id: Ic9d688603747312aa29e5af038363f70c3cbae33 Reviewed-on: https://code.wireshark.org/review/7097 Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-01-27Lua: Expose tcp_dissect_pdus() to LuaHadriel Kaplan1-1/+1
Provide a way for Lua-based dissectors to invoke tcp_dissect_pdus() to make TCP-based dissection easier. Bug: 9851 Change-Id: I91630ebf1f1fc1964118b6750cc34238e18a8ad3 Reviewed-on: https://code.wireshark.org/review/6778 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2014-12-21Cleanup use of #includes in non-generated epan/dissector/*.cBill Meier1-2/+0
Specifically: - Set packet.h to be the first wireshark #include after config.h and "system" #includes. packet.h added as an #include in some cases when missing. - Remove some #includes included (directly/indirectly) in packet.h. E.g., glib.h. (Done only for those files including packet.h). - As needed, move "system" #includes to be after config.h and before wireshark #includes. - Rework various #include file specifications for consistency. - Misc. Change-Id: Ifaa1a14b50b69fbad38ea4838a49dfe595c54c95 Reviewed-on: https://code.wireshark.org/review/5923 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-06-19Revert "Fixup: tvb_* -> tvb_captured"Michael Mann1-2/+2
https://www.wireshark.org/lists/wireshark-dev/201406/msg00131.html This reverts commit 246fe2ca4c67d8c98caa84e2f57694f6322e2f96. Change-Id: Ib24bae0198c13a84bd7f731bf4af921212109a8f Reviewed-on: https://code.wireshark.org/review/2430 Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-18Fixup: tvb_* -> tvb_capturedDario Lombardo1-2/+2
Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f Reviewed-on: https://code.wireshark.org/review/2377 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18Fixup: tvb_get_string(z) -> tvb_get_string(z)_encDario Lombardo1-3/+3
Change-Id: I63a3704effe3fcab01a193dc39b6a22e9f1cf3fe Reviewed-on: https://code.wireshark.org/review/2376 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-25Grab-bag of dead initializers and two actual bugs.Evan Huus1-1/+1
All caught by cppcheck. The two (semi)-interesting bugs are: - in asn1/atn-cpdlc/packet-atn-cpdlc-template.c where the break statement should have been inside the brace, causing potential control-flow weirdness with exceptions - in epan/dissectors/packet-ieee80211.c where the bounds check for tag_len did not match the expert info given Change-Id: Ie173fb8d917aabb9b4571435d671d6f16e1c7569 Reviewed-on: https://code.wireshark.org/review/1793 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2013-12-14Fix warningsJakub Zawadzki1-3/+3
svn path=/trunk/; revision=54089
2013-11-11fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9409Martin Kaiser1-5/+2
don't call proto_item_get_len() when the argument can be NULL svn path=/trunk/; revision=53247
2013-11-10Add missing includes in order to remove exceptions.h from proto.h (next commit).Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53230
2013-11-09Add data parameter to tcp_dissect_pdus() as well as convert it to using ↵Michael Mann1-14/+12
"new" style dissectors. Now that "bytes consumed" can be determined, should tcp_dissect_pdus() take advantage of that? Should tcp_dissect_pdus return length (bytes consumed)? There are many dissectors that just call tcp_dissect_pdus() then return tvb_length(tvb). Seems like that could all be rolled into one. svn path=/trunk/; revision=53198
2013-10-23#if 0 numerous "unused const variables" (mostly value-string-arrays);Bill Meier1-0/+2
Also; fix a few "set but not used" warnings. svn path=/trunk/; revision=52780
2013-09-22More emem -> wmem conversion:Pascal Quantin1-3/+3
- tvb_get_g_stringz()/tvb_get_ephemeral_stringz()/tvb_get_seasonal_stringz() -> tvb_get_stringz() - tvb_get_g_stringz_enc()/tvb_get_ephemeral_stringz_enc() -> tvb_get_stringz_enc() - tvb_get_ephemeral_unicode_stringz() -> tvb_get_unicode_stringz() - tvb_bcd_dig_to_ep_str() -> tvb_bcd_dig_to_wmem_packet_str() - update docs accordingly svn path=/trunk/; revision=52180
2013-09-09expert_add_info_format_text -> expert_add_info_formatMichael Mann1-3/+3
svn path=/trunk/; revision=51852
2013-07-23Fix for Bug 8960 - All mongodb query show as [Malformed Packet: MONGO]Jörg Mayer1-1/+1
proto_tree_add_item doesn't link to be called with FT_STRINGZ and length -1. svn path=/trunk/; revision=50836
2013-06-10Batch of filterable expert infos.Michael Mann1-4/+17
svn path=/trunk/; revision=49868
2012-10-11Change 'for (i=1; i<=n;...' to 'for (i=0; i<n; ...)Bill Meier1-1/+1
The changes fix definite problems or are done "just in case" for cases not esily determined to be a problem by quick inspection. Note: in some cases for loop index variables have been renamed to ensure all required codes changes detected. ##backport svn path=/trunk/; revision=45477
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-3/+1
svn path=/trunk/; revision=45017
2012-08-10Use val_to_str_const() where appropriate;Bill Meier1-1/+1
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-06Check for a too-short BSON document length. Fixes a DoS reported by BenGerald Combs1-26/+46
Schmidt in bug 7572. Also check for a too-long BSON document length and too many nested BSON documents. svn path=/trunk/; revision=44288
2012-06-23Do not use same name for filters with incompatible typesPascal Quantin1-6/+6
svn path=/trunk/; revision=43450
2011-11-15(Trivial) Reformat some long lines & do some whitespace cleanup.Bill Meier1-22/+29
svn path=/trunk/; revision=39868
2011-10-20FromThomas Buchanan via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6467Alexis La Goutte1-16/+351
Add Binary JSON (BSON) decoding support to Mongo packet dissector Implement BSON spec to correctly see BSON document type and not in Bytes format... The specification for BSON can be found at http://bsonspec.org/ The decoding is not entirely complete, there are still potential enhancements to provide more information about a couple of data types, but it greatly enhances visibility into these packet types. From me : * Fix warning from fix-encoding-args.pl script. svn path=/trunk/; revision=39499
2011-10-16Do some conversions of proto_tree_add_item() 'encoding' arg.Bill Meier1-1/+1
(previously missed). 57 FT_BOOLEAN: FALSE-->ENC_BIG_ENDIAN 31 FT_BOOLEAN: TRUE-->ENC_LITTLE_ENDIAN 10 FT_BYTES: ENC_BIG_ENDIAN-->ENC_NA 1 FT_BYTES: ENC_LITTLE_ENDIAN-->ENC_NA 21 FT_BYTES: FALSE-->ENC_NA 2 FT_BYTES: TRUE-->ENC_NA 2 FT_IPXNET: ENC_BIG_ENDIAN-->ENC_NA 6 FT_IPv6: ENC_BIG_ENDIAN-->ENC_NA 1 FT_IPv6: FALSE-->ENC_NA 6 FT_NONE: ENC_BIG_ENDIAN-->ENC_NA 19 FT_NONE: FALSE-->ENC_NA 3 FT_NONE: TRUE-->ENC_NA 1 FT_STRING: ENC_BIG_ENDIAN-->ENC_ASCII|ENC_NA 1 FT_STRING: ENC_LITTLE_ENDIAN-->ENC_ASCII|ENC_NA 5 FT_STRING: FALSE-->ENC_ASCII|ENC_NA 1 FT_STRING: TRUE-->ENC_ASCII|ENC_NA 4 FT_STRINGZ: ENC_NA-->ENC_ASCII|ENC_NA 8 FT_STRINGZ: FALSE-->ENC_ASCII|ENC_NA 1 FT_INT32: FALSE-->ENC_BIG_ENDIAN 1 FT_INT32: TRUE-->ENC_LITTLE_ENDIAN 11 FT_UINT8: 0-->ENC_BIG_ENDIAN 111 FT_UINT8: FALSE-->ENC_BIG_ENDIAN 17 FT_UINT8: TRUE-->ENC_LITTLE_ENDIAN 1 FT_UINT16: 0-->ENC_BIG_ENDIAN 68 FT_UINT16: FALSE-->ENC_BIG_ENDIAN 18 FT_UINT16: TRUE-->ENC_LITTLE_ENDIAN 4 FT_UINT24: FALSE-->ENC_BIG_ENDIAN 70 FT_UINT32: FALSE-->ENC_BIG_ENDIAN 1 FT_UINT32: TRUE-->ENC_LITTLE_ENDIAN 4 FT_UINT64: FALSE-->ENC_BIG_ENDIAN 1 FT_UINT64: TRUE-->ENC_LITTLE_ENDIAN 1 FT_UINT_STRING: FALSE-->ENC_ASCII|ENC_BIG_ENDIAN svn path=/trunk/; revision=39442
2011-10-15Convert proto_tree_add_item() 'encoding' arg for field types FT_STRING, ↵Bill Meier1-3/+3
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-09-21Fix ex "modeline" so it works;Bill Meier1-1/+1
See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5748 svn path=/trunk/; revision=39081
2011-09-04Update insert flagsAlexis La Goutte1-4/+4
KeepGoing -> ContinueOnError svn path=/trunk/; revision=38880
2011-06-08* Add Keep Going bit flag in insert commandAlexis La Goutte1-459/+488
* Replace tab by space svn path=/trunk/; revision=37624
2011-03-31From Alexis La Goutte via bug 5790: Fix 8 clang warnings, all of which were:Chris Maynard1-7/+13
"warning: Value stored to 'offset' is never read". The 'offset' is now used. svn path=/trunk/; revision=36419
2011-03-29Change TCP_PORT_MANGO to TCP_PORT_MONGO.Chris Maynard1-2/+2
svn path=/trunk/; revision=36405
2011-03-29From Alexis La Goutte via bug 5790: Add partial bit flag in query.Chris Maynard1-0/+7
svn path=/trunk/; revision=36399
2010-12-20Rename the routines that handle dissector tables with unsigned integerGuy Harris1-2/+2
keys to have _uint in their names, to match the routines that handle dissector tables with string keys. (Using _port can confuse people into thinking they're intended solely for use with TCP/UDP/etc. ports when, in fact, they work better for things such as Ethernet types, where the binding of particular values to particular protocols are a lot stronger.) svn path=/trunk/; revision=35224
2010-12-02From Alexis La Goutte via ↵Jeff Morriss1-1/+1
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5460 : MongoDB dissector improperly decodes cursorID in OP_KILL_CURSORS command. The size of the CursorID is 64 bits, while the code assumes they are 4 bits, though correctly incrementing the pointer. Fix this typo. svn path=/trunk/; revision=35103