Commit Graph

73 Commits

Author SHA1 Message Date
João Valverde 2777003e12 Add version check for plugin compatibility
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-03 10:09:24 +00:00
João Valverde fd4dc6f115 plugins: Fixups for g9260461f4f
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-23 17:49:08 +00:00
João Valverde 25ba538bc5 plugins: Be more descriptive in "about wireshark"->"folders"
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-20 16:41:21 +00:00
João Valverde 8db4ddd40c Rename get_plugin_dir() for consistency
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-20 01:00:37 +00:00
João Valverde 0bfafb3e7a plugins: Change personal plugin dir path on Unix
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-17 16:56:06 +00:00
João Valverde 978f6b4e1a plugins: Fix paths to match WSUG
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-17 16:54:52 +00:00
Jakub Zawadzki 7c23f56a4d Fix compilation errors when configured --without-plugins and without lua.
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-15 13:07:48 +00:00
João Valverde 69f0cb0cef wsutil: Initialize and store plugin personal dir
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-11 16:48:49 +00:00
Guy Harris 3bcd0e142a Fix a comment.
\, 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-08 21:05:26 +00:00
João Valverde fb052a637f Use g_build_filename() instead, fix indentation
Change-Id: I459208eed4a76b104bc28aa44ab05374e57043de
Reviewed-on: https://code.wireshark.org/review/22873
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-08-01 21:20:37 +00:00
Stig Bjørlykke 3b5c88ea4b wsutil: Back out profile_write_info_file
Change-Id: I89a9aaeeba1689cce04f239dafdc9003492aba16
Reviewed-on: https://code.wireshark.org/review/22346
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-06-22 14:59:45 +00:00
Stig Bjørlykke 7af770dfa7 wsutil: Return error from profile_write_info_file
Change-Id: I1d91cef01ced6cceaa75d1618ffcb59eae5b8e6f
Reviewed-on: https://code.wireshark.org/review/22325
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-22 02:41:59 +00:00
Stig Bjørlykke 6117ff496b wsutil: Check return from ws_write
Change-Id: I73f65222dc23ebcb484f2598a12f43b284654420
Reviewed-on: https://code.wireshark.org/review/22321
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-06-21 20:09:52 +00:00
Stig Bjørlykke 6e0bc30a95 wsutil: Ignore return from ws_write
Change-Id: Idad4dd84538e3ccb7b258775704db8b6bd6c301e
Reviewed-on: https://code.wireshark.org/review/22319
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-06-21 20:04:43 +00:00
Anders 48a6487116 [filesystem.c] Add a cast to aviod a warning with VisualStudio 2017.
Change-Id: I95186bd54ae487e112fcb533c62bb8f9b210dc24
Reviewed-on: https://code.wireshark.org/review/22309
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-21 16:13:05 +00:00
Stig Bjørlykke 99c3c6d908 wsutil: Free files in reset_default_profile
This plugs a memory leak.

Change-Id: Ic989a89353d10de6f8f07df6a734d2b912facb7e
Reviewed-on: https://code.wireshark.org/review/22305
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-21 15:46:22 +00:00
Stig Bjørlykke a14ef98540 Qt: Write a list of profile files at startup
This file will contain all personal config files which will be
fetched from a profile.

Change-Id: I430ca84ccefc17f0e21c8efb93a92602ab8d5661
Reviewed-on: https://code.wireshark.org/review/22303
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-21 15:23:58 +00:00
Stig Bjørlykke 4f1053c546 Qt: Create the user profiles dir at startup
Ensure the user profiles directory is created at startup so that
users can put downloaded profiles without creating the directory.

Change-Id: Ib06bb3055daef8fd9e78d7887ce56f8fe50e48bf
Reviewed-on: https://code.wireshark.org/review/22275
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-20 19:45:03 +00:00
Max Dmitrichenko d1c0f2b95a Fix memory leak in create_persconffile_profile
found by valgrind

Change-Id: I15aef9d78dffac44e36849349dc57b4b36f23de1
Reviewed-on: https://code.wireshark.org/review/21228
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-19 22:27:27 +00:00
Guy Harris 2c44a7f930 Clean up handling of enabled/disabled protocols/heuristic dissectors.
Add a "report a warning message" routine to the "report_err" code in
libwsutil, and rename files and routines appropriately, as they don't
only handle errors any more.

Have a routine read_enabled_and_disabled_protos() that reads all the
files that enable or disable protocols or heuristic dissectors, enables
and disables them based on the contents of those files, and reports
errors itself (as warnings) using the new "report a warning message"
routine.  Fix that error reporting to report separately on the disabled
protocols, enabled protocols, and heuristic dissectors files.

Have a routine to set up the enabled and disabled protocols and
heuristic dissectors from the command-line arguments, so it's done the
same way in all programs.

If we try to enable or disable an unknown heuristic dissector via a
command-line argument, report an error.

Update a bunch of comments.

Update the name of disabled_protos_cleanup(), as it cleans up
information for disabled *and* enabled protocols and for heuristic
dissectors.

Support the command-line flags to enable and disable protocols and
heuristic dissectors in tfshark.

Change-Id: I9b8bd29947cccdf6dc34a0540b5509ef941391df
Reviewed-on: https://code.wireshark.org/review/20966
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-08 20:40:08 +00:00
Guy Harris 357cfd3b03 A bunch of "{Mac} OS X" -> "macOS" changes.
Avoid anachronisms, however; there was no "macOS 10.0" or even "OS X
10.0", for example.  It was "Mac OS X" until 10.8 (although 10.7 was
sometimes called "OS X" and sometimes called "Mac OS X"), and it was "OS
X" from 10.8 to 10.11.

Change-Id: Ie4a848997dcc6c45c2245c1fb84ec526032375c3
Reviewed-on: https://code.wireshark.org/review/20933
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-05 19:16:22 +00:00
Jakub Zawadzki dfc26accc0 Fix compilation without plugins:
filesystem.c: In function ‘free_progdirs’:
filesystem.c:2209:12: error: ‘plugin_dir’ undeclared (first use in this function)
     g_free(plugin_dir);

Change-Id: Ib52b86d41be79b8ed7e42f5fdfaddcae6b0ca5c8
Reviewed-on: https://code.wireshark.org/review/20270
Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-25 13:36:40 +00:00
Guy Harris 0327078837 Only do save_errno = errno and errno = save_errno around g_free();
There is *no* need to do it around an assignment statement.  (We
*probably* don't need to do it around g_free(), but better safe than
sorry - maybe some memory allocator makes system calls to hand regions
of the address space back.)

Change-Id: Ib57540cc36b505aadf4a5e8885b9a744a35b1f75
Reviewed-on: https://code.wireshark.org/review/20236
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-02-22 01:42:35 +00:00
Gerald Combs 012a179785 Fix a double free.
In create_persconffile_profile, pf_dir_path_copy needs to be allocated
separately since the subsequent call to get_dirname is destructive. Add
back a call to g_strdup. This should hopefully fix a crash in the Win32
buildbot.

Change-Id: I591b5845032c9b8a5324bf6ac60fc43d1e92ac2e
Reviewed-on: https://code.wireshark.org/review/20231
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-02-21 19:03:43 +00:00
Michael Mann 897c750127 Clean up some memory leaks in wsutil/filesystem.c
The fixes involve functions always returning a string that needs to be
freed by the caller.  That way the static string pointers within the functions
don't end up leaking at program end.

Change-Id: I35a8dc37536c2927d88f33217887f62efafcc8ca
Reviewed-on: https://code.wireshark.org/review/20175
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-02-19 01:27:14 +00:00
Dario Lombardo f792625b1d epan/wsutil: free memory on exit.
Change-Id: I1cf3a4ce3b21b2e10887cbef5576e5e028e55bab
Reviewed-on: https://code.wireshark.org/review/20052
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-18 14:11:45 +00:00
Dario Lombardo 6d79055ba6 wsutil: remove leaks from filesystem and plugins code.
Change-Id: Iac2805c0130bd2ba6cdb3c9dd997050274d58d99
Reviewed-on: https://code.wireshark.org/review/20020
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-18 13:45:14 +00:00
Stig Bjørlykke c01cdd4e47 Qt: Reset Default profile support
Add support for resetting the Default profile by deleting it in
the Profile Dialog.  All profile files will be deleted and all
other files will be kept.

Change-Id: I795a6db3ee7b2c29e7aba461183e6cc411798b75
Reviewed-on: https://code.wireshark.org/review/20097
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-02-14 18:15:12 +00:00
Peter Wu d5fdbef7f4 cmake,wslua,wsutil: load files from run/ instead of source tree
Fixes Lua on macOS, tested with an out-of-tree build:

    WS_BIN_PATH=$PWD/run ../wireshark/test/test.sh -s wslua

Previously programs that were ran from the build directory would load
data files (radius/, diameter/, init.lua) from the source directory.
Then in the case of Lua, files were loaded from the program directory
($BUILDDIR/run/init.lua on Linux) or source directory
(sSOURCEDIR/epan/wslua/console.lua).

On macOS, this does not work for Lua since files are installed into
$BUILDDIR/run/Wireshark.app/Contents/Resources/share/wireshark/init.lua
instead. Since CMake always copies data files (radius, console.lua,
etc.) into the build directory, make get_datafile_dir() return this
"run" directory instead.

Change-Id: If97d2f5686271caf9ad4d4e4fc58e902dc592a98
Reviewed-on: https://code.wireshark.org/review/19330
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-12-20 13:16:57 +00:00
Dario Lombardo 43000acd74 ui: move filesystem code to wsutil/filesystem.c
This function can be used by code outside ui (eg. extcap).

Ping-Bug: 13218
Change-Id: Ic11f7acebefeaf777692df044ebff9b1bc387aa3
Reviewed-on: https://code.wireshark.org/review/19178
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-09 15:50:04 +00:00
Guy Harris faf70602a8 Update a comment to reflect current reality.
Change-Id: Ied84e0363161ebc42c8cf24e7ade4b1b4e536448
Reviewed-on: https://code.wireshark.org/review/19074
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-12-05 03:21:59 +00:00
João Valverde a02e90da41 filesystem.c: Don't constify mallocated pointer
Change-Id: I8991682bda256c5e1c09a303b0243e240b276101
Reviewed-on: https://code.wireshark.org/review/16602
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-23 12:44:34 +00:00
Gerald Combs d9fb7f9a5e Handle ENAMETOOLONG.
g_strerror doesn't appear to handle ENAMETOOLONG. Check for it ourselves.

Change-Id: Icd113a81e8d95bb3c84c91bb420a1a6a19bf5d40
Reviewed-on: https://code.wireshark.org/review/16041
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-22 23:53:00 +00:00
Peter Wu dabbaaf418 filesystem: Fix build dir detection when using cmake
Fixes loading of plugins by detecting the build output directory of
cmake. This requires a "CMakeCache.txt" file to be present in the parent
directory (above run/).

Change-Id: I297432cdcd0981646058410f3eadf5f73b5248c8
Reviewed-on: https://code.wireshark.org/review/7453
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-16 04:40:55 +00:00
João Valverde ecb4dc396e Include ws_diag_control.h in config.h
Change-Id: Ia394071710ecda3b0e6686a51fbca45a8ff20317
Reviewed-on: https://code.wireshark.org/review/14749
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>
2016-04-04 23:05:31 +00:00
João Valverde 80a80edd5e wsutil: Remove getenv_utf8(), replaced with g_getenv()
Replace getenv() calls in filesystem.c too for consistency.

Change-Id: I31425179290e556e6696953531989d93777adf92
Reviewed-on: https://code.wireshark.org/review/14752
Petri-Dish: João Valverde <j@v6e.pt>
Reviewed-by: João Valverde <j@v6e.pt>
Tested-by: João Valverde <j@v6e.pt>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-03 16:30:33 +00:00
Gerald Combs 6ed543dbe6 Remove the last remnants of U3 support.
Change-Id: Ide4c177e67a77c5f9495b3b4c0f817f40e6dde30
Reviewed-on: https://code.wireshark.org/review/14425
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-03-11 19:55:57 +00:00
Guy Harris ccdb8be0e9 Clean up indentation.
Change-Id: Ica6615ef80867e911a1244a8a54411519033b275
Reviewed-on: https://code.wireshark.org/review/13105
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-07 09:41:14 +00:00
Guy Harris 97378a5bad Don't assume a stat() fails only if the target file doesn't exist.
If the error is something other than ENOENT, return that error
indication.

Change-Id: If866cab5f0de0e4fa8b1ed1cead1290feb88a3cb
Reviewed-on: https://code.wireshark.org/review/13091
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-07 03:02:08 +00:00
João Valverde fbf2e3cf8f Make init_progfile_dir() take a function pointer [-Wpedantic]
Change-Id: I45f8ea5ee6ccc5a484c60ad6e686aaf30f6b0c98
Reviewed-on: https://code.wireshark.org/review/12557
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-14 23:52:28 +00:00
Guy Harris 0162e54075 Clean up includes of unistd.h, fcntl.h, and sys/stat.h.
Have wsutil/file_util.h include them on UN*X, just as it includes io.h
on Windows, so we can have a rule of "if you do file operations, include
<wsutil/file_util.h> and use the routines in it".

Remove includes of unistd.h, fcntl.h, and sys/stat.h that aren't
necessary (whether because of the addition of them to wsutil/file_util.h
or because they weren't needed in the first place).

Change-Id: Ie241dd74deff284e39a5f690a297dbb6e1dc485f
Reviewed-on: https://code.wireshark.org/review/11619
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-07 21:52:23 +00:00
Guy Harris 6ada7d5389 Just use g_mkdir_with_parents() to make the .config directory on UN*X.
It will create all the relevant directories (if it can), using
g_mkdir(), which is a wrapper for mkdir() on UN*X - just as ws_mkdir()
is, so we don't need to make our own copy that uses ws_mkdir.

Bug: 11645
Change-Id: I68affc6fabccf58dace75af078d9bfd67a1b47b2
Reviewed-on: https://code.wireshark.org/review/11373
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-10-28 23:07:07 +00:00
Guy Harris 0f8e32c515 Do the "create parent of config file directory" stuff on UN*X as well.
~ obviously exists, but ~/.config might not, making it impossible to
create ~/.config/wireshark.

Bug: 11645
Change-Id: Ia267b168eb7b1438d4c35a6bb89df9d7bfcbd3f3
Reviewed-on: https://code.wireshark.org/review/11368
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-10-28 19:46:05 +00:00
Guy Harris b0b53fa593 On UN*X, use XDG_CONFIG_HOME/wireshark for configuration files.
If it doesn't exist, but ~/.wireshark does, continue to use that, for
backwards compatibility.

Derived from change I7fa64d6e8bd43c6a5dec93e30a4f69a747c34256.

Bug: 6353
Change-Id: I937f94b19a371486b7ea2228e51994cc4c72b501
Reviewed-on: https://code.wireshark.org/review/11137
Petri-Dish: Guy Harris <guy@alum.mit.edu>
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>
2015-10-19 20:49:10 +00:00
Tobias Stoeckmann a68518f499 terminate readlink result
The readlink function does not guarantee to nul-terminate its result string.
Therefore, it should be done in wsutil/filesystem.c.

Change-Id: Id96533e825a302a1922ce9ac7ee47d5525ac9c39
Reviewed-on: https://code.wireshark.org/review/9597
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-11 18:18:35 +00:00
Guy Harris 63a78d45bc Use ws_fstat64() to determine the size of an open file.
fseek() to the end, followed by ftell(), is a bit of an odd way to get
the file size.  Use ws_fstat64() instead.

Check that the file is a regular file, while we're at it.  This means we
don't have to check before opening.

Bug: 11268
Change-Id: I31ee20dd5568d10541375cf97b286abfc1384d1c
Reviewed-on: https://code.wireshark.org/review/9230
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-30 02:34:54 +00:00
Evan Huus 5dcd207cc6 Check _MSC_VER is defined before we use it
Otherwise it breaks a bunch of stuff on Linux machines because of the way gcc's
preprocessor works (buildbot decryption tests, extcap, etc).

Originally added in Ic5360089f96be620fbe99ba4e819e0caa5ca0215

Change-Id: Iad43fa1415aa331ae375771adac0818ea1b99060
Reviewed-on: https://code.wireshark.org/review/9091
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-24 15:34:18 +00:00
AndersBroman 89fbf02ab5 [MSVC 2015] file_exists() fails on MSVC2105 as file_stat.st_ino gets reset
to zero in the function call if the file does not exist. The general code
seems to work with MSVC2015 so use that.

Change-Id: Ic5360089f96be620fbe99ba4e819e0caa5ca0215
Reviewed-on: https://code.wireshark.org/review/9070
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-23 20:12:39 +00:00
Gerald Combs 3d7b728173 Make androiddump loadable on OS X.
Make sure the target location for extcap executables and extcap_dir
match on OS X.

Set the extcap directory to Contents/MacOS/extcap. The Mac Developer
Library documentation doesn't explicitly define "Resources", but
examples include data files and not executables. It does state that
executables shouldn't go into PlugIns.

Make sure we rpathify androiddump.

Change-Id: If36c762e2a1991c26e5c01a870deaf191bcf9f94
Reviewed-on: https://code.wireshark.org/review/8093
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-04-17 18:08:36 +00:00
Gerald Combs cec99abac9 Win32: Restore the versioned plugin installation path.
Revert parts of g2ef72cb and g7710da4 so that the NSIS installer once
again places plugins in $INSTDIR\plugins\$VERSION. This matches the
behavior of Autotools and previous Windows installers, and reduces the
chances of a version mismatch if the user happens to install a custom
plugin.

Leave the development plugin path unversioned. Leave the extcap path
unversioned for now.

Change-Id: I861d4ee12975fba4b642e391871c5e852d92a2fe
Reviewed-on: https://code.wireshark.org/review/7976
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-04-07 23:01:40 +00:00