summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2013-09-16 18:36:50 +0000
committerAnders Broman <anders.broman@ericsson.com>2013-09-16 18:36:50 +0000
commit038d3b0a56ad7f2f0b9b50a66a5581cf2ec5a716 (patch)
tree6548f98b1da8f8061be55faad8e99b0ada892f46
parent1821ed0404efb1d8470b2b792e22bc489b93bdb4 (diff)
downloadwireshark-038d3b0a56ad7f2f0b9b50a66a5581cf2ec5a716.tar.gz
Read the local services file.
svn path=/trunk/; revision=52104
-rw-r--r--epan/addr_resolv.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index 846c2efdca..8e14551f0e 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -752,11 +752,35 @@ destroy_serv_port(gpointer data)
static void
initialize_services(void)
{
+#ifdef _WIN32
+ char *hostspath;
+ char *sysroot;
+ static char rootpath_nt[] = "\\system32\\drivers\\etc\\services";
+#endif /* _WIN32 */
/* the hash table won't ignore duplicates, so use the personal path first */
g_assert(serv_port_hashtable == NULL);
serv_port_hashtable = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, destroy_serv_port);
+/* Read the system services file first */
+#ifdef _WIN32
+
+ sysroot = getenv_utf8("WINDIR");
+ if (sysroot != NULL) {
+ /*
+ * The file should be under WINDIR.
+ * If this is Windows NT (NT 4.0,2K,XP,Server2K3), it's in
+ * %WINDIR%\system32\drivers\etc\services.
+ */
+ hostspath = g_strconcat(sysroot, rootpath_nt, NULL);
+ parse_services_file(hostspath);
+ g_free(hostspath);
+ }
+#else
+ parse_services_file("/etc/services");
+
+#endif /* _WIN32 */
+
/* set personal services path */
if (g_pservices_path == NULL)
g_pservices_path = get_persconffile_path(ENAME_SERVICES, FALSE);