aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
AgeCommit message (Collapse)AuthorFilesLines
2017-10-30Add wsutil/inet_ipv4.h.Guy Harris2-0/+45
It defines a ws_in4_addr type, which is intended to hold IPv4 addresses in network byte order, and some macros to test for IPv4 addresses in the local network control block and multicast IPv4 addresses. Use those macros in places where dissectors had their own code for that purpose. Change-Id: I4252b410e37207157be85119a332e2a6913b332f Reviewed-on: https://code.wireshark.org/review/24178 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-29Do not assert in ws_inet_ntop()João Valverde2-11/+17
Change-Id: I9d420c5f6bc29ce94855017739169dc8e8ce4d48 Reviewed-on: https://code.wireshark.org/review/24173 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2017-10-29More ws_inet_ntop() tweaks.João Valverde1-2/+20
Change-Id: I8f77f189337f9299e566a4149ae6ea481d3dbed6 Reviewed-on: https://code.wireshark.org/review/24162 Reviewed-by: João Valverde <j@v6e.pt>
2017-10-29Go with the RFC 2133-and-successors values for IPv4 and IPv6 address strings.Guy Harris1-4/+31
Add a comment explaining why Windows has different, larger values for INET_ADDRSTRLEN and INET6_ADDRSTRLEN. Change-Id: I4ad53c6cffae46d108f778460ce653dcc9343c64 Reviewed-on: https://code.wireshark.org/review/24155 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-26Improve our inet_ntop() wrapperJoão Valverde3-11/+25
Also fix buffer length define, as it is not guaranteed to be 46 on Windows (it never was guaranteed anyway for the libc implementation, but the likelyhood of being greater was small). Change-Id: I2db705d86f825765ed32ec70b8d22058b5d629e8 Reviewed-on: https://code.wireshark.org/review/24074 Reviewed-by: João Valverde <j@v6e.pt>
2017-10-26Rename some IPv6 address test functions.Guy Harris1-3/+3
They test where the address is XXX, for various values of XXX, so name them accordingly. Change-Id: I437175f02b3f97fecee77e8bb9416bb5b71cd0d0 Reviewed-on: https://code.wireshark.org/review/24075 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-26Add a ws_in6_addr typedef for struct e_in6_addr.Guy Harris3-10/+10
That allows a parallel typedef of ws_in4_addr for guint32. Change-Id: I03b230247065e0e3840eb87635315a8e523ef562 Reviewed-on: https://code.wireshark.org/review/24073 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-26CMake: Don't check for windows.h or winsock2.h.Gerald Combs2-13/+3
If we're building on Windows we're going to have windows.h and winsock2.h. Don't bother checking for them. Change-Id: I0004c44d7364ab3f41682f34b8c84cd8617c9603 Reviewed-on: https://code.wireshark.org/review/24068 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-25Remove replacement inet_pton/inet_ntopJoão Valverde7-538/+21
Should be available on every platform we support. Change-Id: Ib65d78e351d22d581b427e5e93fc8d5e5348b260 Reviewed-on: https://code.wireshark.org/review/24047 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-25Remove inet_aton() usage everywhereJoão Valverde5-217/+0
Including where it says not to in comments. Use IPv4 dotted-decimal notation. Change-Id: Iafe1f6fbd2bd5867c41642dc27411f47dff8ce6a Reviewed-on: https://code.wireshark.org/review/24044 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2017-10-24Test g_printf() thousands grouping flag at runtimeJoão Valverde1-13/+29
This tests the runtime environment so avoid hard-coding it during the build. For now we avoid messing with locales for the test, unless it turns out to be necessary (ISO C printf behaviour with invalid conversion specifier is undefined). Change-Id: I341c2ab5e716973689cf9002f13435404a41369f Reviewed-on: https://code.wireshark.org/review/24038 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2017-10-23Make plugin support a runtime propertyJoão Valverde2-1/+17
Keep the option to disable at compile-time but use AC_ARG_ENABLE instead. Change-Id: Ie8c3f5ba0db1eb6d9d4ffd742cd3aa049ead5007 Reviewed-on: https://code.wireshark.org/review/24026 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2017-10-20file_util.c: do not leak service handlePascal Quantin2-5/+4
Follow-up of gd64c30052 Change-Id: I620b3fb44fe3090120f2d29809961623e00d55a4 Reviewed-on: https://code.wireshark.org/review/23999 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2017-10-20Do not add Npcap path if npf.sys service is foundPascal Quantin1-5/+18
Otherwise you can end with 2 Packet.dll (the one from WinPcap and the one from Npcap) being loaded at the same time, which can create incompatibilities. Bug: 14134 Change-Id: Ia06066fd54b60296e55dbfce6c6f2ddd99367479 Reviewed-on: https://code.wireshark.org/review/23969 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-18Refresh wsutil/Makefile.amJoão Valverde1-29/+24
Change-Id: I6a70a2dc45257826c930f57a59cdd9bf5b4c3c73 Reviewed-on: https://code.wireshark.org/review/23973 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2017-10-18autotools: Remove abi-compliance-checker codeJoão Valverde1-20/+0
It's been broken for over a year, needs to be modernized and as implemented it's a maintenance nightmare. Get rid of it. Ping-Bug: 13036 Change-Id: I34a6e4c28b6d3b96dd6550dd21e9cbeaf050d58f Reviewed-on: https://code.wireshark.org/review/23967 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2017-10-17autotools: remove macOS Frameworks supportJoão Valverde1-9/+0
This treats macOS/OSX like any other Unix-like build target (Darwin), thus removing autotools support for macOS-specific build options. Anyone needing that is advised to use the fully-supported-on-macOS CMake build. Change-Id: I88e2fa7a8eea42241efcf84223ac2362d38b1e12 Reviewed-on: https://code.wireshark.org/review/23951 Petri-Dish: João Valverde <j@v6e.pt> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-10-17autotools: Fix bogus checkAPI targetsJoão Valverde1-1/+1
Change-Id: Ifc8884fc0f0e4548db79a68e3fbc35c7e5fb9be9 Reviewed-on: https://code.wireshark.org/review/23947 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-10-15autotools: make maintainer-clean should allow rerunning 'configure'João Valverde1-3/+0
Change-Id: Iedae94ffefe27b13b1967d69cacb757b5aa4576d Reviewed-on: https://code.wireshark.org/review/23928 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-10-15Remove superfluous null-checks before strdup/freeAhmad Fatoum1-2/+1
NULL checks were removed for following free functions: - g_free "If mem is NULL it simply returns" https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-free - g_slist_free(_full)? "NULL is considered to be the empty list" https://developer.gnome.org/glib/stable/glib-Singly-Linked-Lists.html - g_strfreev "If str_array is NULL, this function simply returns." https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strfreev - g_slice_free "If mem is NULL, this macro does nothing." https://developer.gnome.org/glib/stable/glib-Memory-Slices.html#g-slice-free - g_match_info_free "not NULL... otherwise does nothing" https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-expressions.html#g-match-info-free - dfilter_free defined in Wireshark code. Returns early when passed NULL epan/dfilter/dfilter.c They were also removed around calls to g_strdup where applicable: - g_strdup "If str is NULL it returns NULL." https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strdup Change-Id: Ie80c2db89bef531edc3aed7b7c9f654e1d654d04 Reviewed-on: https://code.wireshark.org/review/23406 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-10-13CMake: Allow user build flags to override default build flagsJoão Valverde1-2/+2
Autotools has the very useful feature by design of allowing the user to override the default build flags (you break it you keep it). Apparently CMake applies COMPILE_OPTIONS target property after CMAKE_{C,CXX}_FLAGS so that doesn't work here. Prepend our flags to those variables instead to make it work then. Specific target flag overrides can still be added with COMPILER_OPTIONS (e.g: generated files with -Wno-warning) but this is less effective and then we're back at the point where this overrides user flags. It's less of a concern though. Change-Id: I44761a79be4289238e02d4e781fef0099628817b Reviewed-on: https://code.wireshark.org/review/23675 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-10-03Add version check for plugin compatibilityJoão Valverde2-7/+20
Only plugins built for the same feature release (X.Y) are assured binary compatibility. Make sure we don't try to run unsuitable code and, if so, warn the user. This might happen for example if the user manually copies a binary plugin to the wrong folder, intentionally or by accident. I'm using "release version" to loosely mean not a patch release (i.e: a feature release). Change-Id: I896e9cbbd2d3843623fff6af8ef51002ec06f1f8 Reviewed-on: https://code.wireshark.org/review/23807 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-10-01plugins: Improve output formatJoão Valverde1-11/+13
And some minor code style changes. Change-Id: I97e53848db42c3981af69152b171b3a77f831da5 Reviewed-on: https://code.wireshark.org/review/23806 Reviewed-by: João Valverde <j@v6e.pt>
2017-09-26plugins: Move the build dir scanning code to a separate functionJoão Valverde1-68/+68
Change-Id: Iee476ac84d530810e5b70547c462050f1c03ee1b Reviewed-on: https://code.wireshark.org/review/23755 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-09-26plugins: No need to allocate a new structJoão Valverde1-30/+26
Change-Id: Ic39cf1c7f199dc5e4879d954a649d21453dcc5e5 Reviewed-on: https://code.wireshark.org/review/23753 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-09-26plugins: Build the description string while loadingJoão Valverde1-45/+18
Change-Id: Ia67133c1c9d005fc4a81b0727a7b1849571ab29c Reviewed-on: https://code.wireshark.org/review/23742 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-09-26plugins: Sort the descriptionsJoão Valverde2-20/+36
Change-Id: I8113ba9782962856ce86475cddf40d69ed267fb4 Reviewed-on: https://code.wireshark.org/review/23733 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-09-26plugins: Use hash table for book-keepingJoão Valverde1-98/+55
Avoid having to walk the list to check for existence on every file load. Now the binary plugin description list in About Wireshark is randomized instead of sorted by load order. We may want to change that. Add missing "const" to plugin->version. Fix an apparent trivial leak where the GModule handle was not closed on exit. Change-Id: I774215a84b080bbe889f88cc6a9b777bcf60b335 Reviewed-on: https://code.wireshark.org/review/23732 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-09-25plugins: Fix crash loading binary module twiceJoão Valverde2-30/+29
If a plugin is repeated we destroy the GModuleHandle in plugins_scan_dir() but we have already added the entry points to the list of registered plugins. Check for repeated plugins before adding it to the list of registered plugins, not after. Don't check for both name and version, check only for repeated names. Give the plugin callback a more descriptive name. Change-Id: I22cbbb059b8029877580fc33517310496c93e5d5 Reviewed-on: https://code.wireshark.org/review/23726 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-09-24autotools: Use package flags to configure libpcapJoão Valverde1-1/+3
Change-Id: Icd64014b597a8e60d2aff9d180c441c6ffccff26 Reviewed-on: https://code.wireshark.org/review/23329 Reviewed-by: João Valverde <j@v6e.pt>
2017-09-23plugins: Fixups for g9260461f4fJoão Valverde1-1/+1
Put plugins in CMake build dir with a version subdir. This avoids some weird special cases, however running with autotools from build dir displays the wrong global folder in about->folders. Unfortunately the hack to run from the autotools build dir is troublesome. Various fixes for Windows builds. Try to fix also build dir issue loading plugins on macOS with ENABLE_APPLICATION_BUNDLE (blind). Change-Id: Ic3c7c21f5850c12a53844202d61fa0592b45739c Reviewed-on: https://code.wireshark.org/review/23657 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-09-20plugins: Be more descriptive in "about wireshark"->"folders"João Valverde3-20/+46
Display separate entries for binary plugins and lua scripts. This is explained in the user guide, that the binary folder is a subfolder of the lua folder, but it's probably a good idea to be more explicit about it, at the risk of cluttering the interface a bit. Move GeoIP information down because it seems the least important. Add helper functions to provide plugin version subdir. Change some #ifdefs while at it for legibility. Change-Id: Ieb8665df029b3c14de19e2c973bd9b1cc4ec4621 Reviewed-on: https://code.wireshark.org/review/23609 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-09-20Rename get_plugin_dir() for consistencyJoão Valverde3-4/+4
WS_DLL_PUBLIC const char *get_plugin_dir(void); WS_DLL_PUBLIC const char *get_plugins_pers_dir(void); Opt for the plural form consistently (for public functions at least). Change-Id: I8a5861ad7f90f9c87168bd3275bd9dbc5c83b749 Reviewed-on: https://code.wireshark.org/review/23608 Petri-Dish: João Valverde <j@v6e.pt> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-09-17plugins: Change personal plugin dir path on UnixJoão Valverde1-0/+4
Installing machine code to XDG_CONFIG_HOME is problematic. Use ~/.local/lib/wireshark/plugins instead. XDG_CONFIG_HOME should be architecture independent. This allows copying the configuration between different architectures safely. Reference: https://www.freedesktop.org/software/systemd/man/file-hierarchy.html Change-Id: I1b18f64aab4dd351d611cfbea3b9333f23c98bfa Reviewed-on: https://code.wireshark.org/review/23498 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-09-17plugins: Use minor version number for plugin install pathJoão Valverde1-2/+4
Wireshark patch releases (X.Y.Z) are binary compatible so reflect that in the plugin installation path. By installing to $pkglibdir/plugins/X.Y out-of-tree plugins don't need to be reinstalled with every patch release. Change-Id: I9d1728e6fb12bcb51d2a723af22c750cb7a966cf Reviewed-on: https://code.wireshark.org/review/23497 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-09-17plugins: Fix paths to match WSUGJoão Valverde4-5/+15
The Wireshark User Guide seems to say: Global lua plugins are in $pkglibdir/plugins Personal lua plugins are in XDG_CONFIG_HOME/plugins Global binary plugins are in $pkglibdir/plugins/$version Personal binary plugins are in XDG_CONFIG_HOME/plugins/$version Fix code to match that. This is a backward-incompatible change for global lua plugins and personal binary plugins. Adds a version subfolder to the personal plugin folder for binary plugins. This allows for safe upgrades and side-by-side installations with different prefixes (they no longer use the same personal dir). Change-Id: Ie0f039113628a257625a9a9fb2cb30e532f5dd47 Reviewed-on: https://code.wireshark.org/review/23516 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-09-17CMake: Initial work to install headers for the benefit of pluginsJoão Valverde1-0/+64
To be continued incrementally to fix gaps and omissions. If we are willing to reorganize the source tree to have one or two header include folders this could be simplified considerably. It would also force developers to give more consideration to API issues, which is a good thing. See also e7ef19efc0e928b50644b37772ccbf176e74f766. Bug: 14062 Change-Id: I0759da2f9793cfb5cf92c9e231457bba43df4353 Reviewed-on: https://code.wireshark.org/review/23548 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-09-15Fix compilation errors when configured --without-plugins and without lua.Jakub Zawadzki1-1/+6
filesystem.c: In function ‘init_plugin_pers_dir’: filesystem.c:1041:5: error: ‘plugin_pers_dir’ undeclared (first use in this function) plugin_pers_dir = get_persconffile_path(PLUGINS_DIR_NAME, FALSE); ^~~~~~~~~~~~~~~ filesystem.c:1041:5: note: each undeclared identifier is reported only once for each function it appears in filesystem.c: In function ‘get_plugins_pers_dir’: filesystem.c:1062:10: error: ‘plugin_pers_dir’ undeclared (first use in this function) if (!plugin_pers_dir) ^~~~~~~~~~~~~~~ Change-Id: I9ace17da42665d135b9432b1f19970491589e3bf Reviewed-on: https://code.wireshark.org/review/23545 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-09-15autotools: Initial work to install headers for the benefit of pluginsJoão Valverde1-1/+5
Install public headers required to build plugins for libwireshark (taps and dissectors). The source tree is organized to serve the CLI/GUI parts of wireshark. Plugins are built in tree. This change is intende to allow plugins to be built out-of-tree but we want to avoid dumping all headers into /usr/include. To be continued incrementally to fix errors and omissions. Change-Id: Iaa0def0ba3de4b456a29114c315544d2d64fa748 Reviewed-on: https://code.wireshark.org/review/23374 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-09-11wsutil: Initialize and store plugin personal dirJoão Valverde3-18/+24
Obviate allocation on every call to get_plugins_pers_dir(). Change-Id: I089ae499f93739d490d4552f59b5db5996f7d26f Reviewed-on: https://code.wireshark.org/review/23495 Petri-Dish: João Valverde <j@v6e.pt> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: João Valverde <j@v6e.pt>
2017-09-09ws_cpuid: include ws_attributesUli Heilmeier1-0/+2
Otherwise _U_ is not defined. Change-Id: I221f64c7d89c221e5a63a573e06457699d0a177e Reviewed-on: https://code.wireshark.org/review/23440 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-09-08sharkd: implement proper JSON string unescaping, based on JSON dissector.Jakub Zawadzki2-0/+108
Change-Id: I749b78b759f98c78526840b8bb1cbccfc17a5611 Reviewed-on: https://code.wireshark.org/review/23365 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com> Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
2017-09-06plugins: config.h must not be included by public headersJoão Valverde8-12/+2
For a sane plugin build environment. Include config.h as the first header in the .c file instead. Fix by moving required compiler attribute macros to a new "ws_attributes.h" API header. Change-Id: I34f58a927f68c1a0e59686c14d214825149749e1 Reviewed-on: https://code.wireshark.org/review/23400 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-08-21More explanation in the comments.Guy Harris1-1/+5
Change-Id: I1e5597ac291d38370e8b1537a75f3ba1d9a86bc9 Reviewed-on: https://code.wireshark.org/review/23156 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-08-12Include xtea.[hs] in CMakeLists.txt and Makefile.amAhmad Fatoum2-1/+3
CMake part was missing. Autotools part didn't include header. Change-Id: I5a642a80d30b02bb16eb48e0e4e1f8e0e8332a75 Reviewed-on: https://code.wireshark.org/review/23051 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-08-08Fix a comment.Guy Harris1-1/+1
\, not /, is the standard pathname separator on Windows. Change-Id: Ia1f1be5e4bd76519e27df430e8ef46967ffe35f5 Reviewed-on: https://code.wireshark.org/review/23024 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-08-05Further cleanups.Guy Harris1-11/+32
If a variable is initialized in a loop body or an if clause or a switch clause, declare it inside the loop body/clause, and de-initialize it before leaving the loop body/clause. De-initialize the gnutls_pkcs12_t before leaving rsa_load_pkcs12(), so as not to leak it. Always leave the per-bag loop by "goto done", even if we're not within an inner loop, to make it clearer what we're doing. We initialize the bag structure at the beginning of that loop body; de-initialize it at the end. If we leave the loop without a private key, and we don't have an error message, the error is "we didn't find a PKCS8 key"; report that. Change-Id: I87cf296876c8f1879f69d01ce67ca2829b4f8d16 Reviewed-on: https://code.wireshark.org/review/22958 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-08-05rsa.c: strerror -> g_strerrorMichael Mann1-2/+2
Pacify checkAPIs.pl Change-Id: I637a6cd678b99d05cd1b26fd3cba6ad4dd19e8d2 Reviewed-on: https://code.wireshark.org/review/22957 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-08-04Fix up indentation.Guy Harris1-1/+1
Change-Id: I99445d9934dbb4c97c4c41192c8fe908441f2843 Reviewed-on: https://code.wireshark.org/review/22942 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-08-04Clean up private key file error reporting.Guy Harris1-13/+48
Ensure that rsa_load_pem_key() and rsa_load_pkcs12() always return an error message string if they fail, so that 1) they don't return NULL without supplying an error string; 2) they don't supply an error string if they succeed. If either of them fails, report the error; if there's no error string, report an unknown error (that shouldn't happen, but the wsutil/rsa.c code needs more cleanup before I'll believe it can't happen). While we're at it, clean up some of those error strings, return NULL rather than 0 as the failure case from rsa_load_pkcs12() as we do in rsa_load_pem_key() (they mean the same thing, but NULL makes it a bit clearer), and de-initialize the private key structure in rsa_load_pem_key() if we fail (so that we don't leak memory). Change-Id: Id9dd331800d87b017a500a6f579df446057f555b Reviewed-on: https://code.wireshark.org/review/22941 Reviewed-by: Guy Harris <guy@alum.mit.edu>