Wireshark-bugs: [Wireshark-bugs] [Bug 1476] Allow users to specify where Wireshark stores plugin

Date: Sat, 24 Mar 2007 18:16:07 +0000 (GMT)
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1476





------- Comment #1 from ryker@xxxxxxxxx  2007-03-24 18:16 GMT -------
Bugzilla throws and error when I attempt to attach anything so I'm
dumping this short patch straight into the audit trail (sorry!).


--- doc/tshark.pod.old  2007-03-24 11:48:46.000000000 -0600
+++ doc/tshark.pod      2007-03-24 11:49:37.000000000 -0600
@@ -754,7 +754,7 @@
 F<C:\Program Files\Wireshark\preferences>) on Windows systems.

 The personal preferences file is looked for in
-F<$HOME/.wireshark/preferences> on
+F<$WIRESHARK_HOME/preferences> and then F<$HOME/.wireshark/preferences> on
 UNIX-compatible systems and F<%APPDATA%\Wireshark\preferences> (or, if
 %APPDATA% isn't defined, F<%USERPROFILE%\Application
 Data\Wireshark\preferences>) on Windows systems.
--- doc/wireshark.pod.old       2007-03-24 11:48:41.000000000 -0600
+++ doc/wireshark.pod   2007-03-24 11:17:28.000000000 -0600
@@ -1942,7 +1942,7 @@
 directories: the F<lib/wireshark/plugins/$VERSION> directory under the
 main installation directory (for example,
 F</usr/local/lib/wireshark/plugins/$VERSION>), and then
-F<$HOME/.wireshark/plugins>.
+F<$WIRESHARK_HOME/plugins>, and then F<$HOME/.wireshark/plugins>.

 On Windows systems, the plugins are looked for in the following
 directories: F<plugins\$VERSION> directory under the main installation
@@ -2003,8 +2003,9 @@
 systems, and in the main installation directory (for example,
 F<C:\Program Files\Wireshark\preferences>) on Windows systems.

-The personal preferences file is looked for in F<$HOME/.wireshark/preferences>
on
-UNIX-compatible systems and F<%APPDATA%\Wireshark\preferences> (or, if
+The personal preferences file is looked for in
+F<$WIRESHARK_HOME/preferences> and then F<$HOME/.wireshark/preferences> on
+UNIX-compatible systems, and F<%APPDATA%\Wireshark\preferences> (or, if
 %APPDATA% isn't defined, F<%USERPROFILE%\Application
 Data\Wireshark\preferences>) on Windows systems.

--- epan/filesystem.c.old       2007-03-24 11:06:08.000000000 -0600
+++ epan/filesystem.c   2007-03-24 12:04:14.000000000 -0600
@@ -628,7 +628,8 @@

 /*
  * Get the directory in which personal configuration files reside;
- * in UNIX-compatible systems, it's ".wireshark", under the user's home
+ * in UNIX-compatible systems, it's $WIRESHARK_HOME or, if
+ * $WIRESHARK_HOME isn't set, it's ".wireshark" under the user's home
  * directory, and on Windows systems, it's "Wireshark", under %APPDATA%
  * or, if %APPDATA% isn't set, it's "%USERPROFILE%\Application Data"
  * (which is what %APPDATA% normally is on Windows 2000).
@@ -696,26 +697,36 @@
        }
 #else
        /*
-        * If $HOME is set, use that.
+        * If $WIRESHARK_HOME is set, use that.
         */
-       homedir = getenv("HOME");
-       if (homedir == NULL) {
+       homedir = getenv("WIRESHARK_HOME");
+       if (homedir != NULL)
+               pf_dir = g_strdup(homedir);
+       else {
                /*
-                * Get their home directory from the password file.
-                * If we can't even find a password file entry for them,
-                * use "/tmp".
+                * Otherwise try $HOME.
                 */
-               pwd = getpwuid(getuid());
-               if (pwd != NULL) {
+               homedir = getenv("HOME");
+               if (homedir == NULL) {
                        /*
-                        * This is cached, so we don't need to worry
-                        * about allocating multiple ones of them.
+                        * Otherwise get their home directory from the
+                        * password file.  If we can't find an entry for
+                        * them, use "/tmp".
                         */
-                       homedir = g_strdup(pwd->pw_dir);
-               } else
-                       homedir = "/tmp";
+                       pwd = getpwuid(getuid());
+                       if (pwd != NULL) {
+                               /*
+                                * This is cached, so we don't need to worry
+                                * about allocating multiple ones of them.
+                                */
+                               homedir = g_strdup(pwd->pw_dir);
+                       }
+                       else {
+                               homedir = "/tmp";
+                       }
+               }
+               pf_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", homedir,
PF_DIR);
        }
-       pf_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", homedir, PF_DIR);
 #endif

        return pf_dir;


-- 
Configure bugmail: http://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.