diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2015-10-06 09:11:46 +0100 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-10-18 02:33:02 +0000 |
commit | 48d46e67fd7938262df658c0b459e2e926faa9ab (patch) | |
tree | bbd4a5ef287a4d7d471f0e7453f4519bcbe9c508 /epan/addr_resolv.c | |
parent | 01b00fd8a10ae034b92719fddecac6fadf8f6c02 (diff) |
Don't parse services file twice, respect user settings
Platform file '/etc/services' is the same as Wireshark's
'/usr/share/wireshark/services', only Wireshark's is more recent
(on my system, same goes for other platforms I assume).
Use only Wireshark's IANA services files.
Other benefits would be removing some platform specific #ifdefs and making
service names more consistent.
Also respect user services settings by parsing $PERSCONFIG_DIR/services
after $SYSCONFIG_DIR/services.
Change-Id: I9890473af92763e02dabd2386eaa767aed2f2899
Reviewed-on: https://code.wireshark.org/review/10941
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/addr_resolv.c')
-rw-r--r-- | epan/addr_resolv.c | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c index fb36e88117..2a384bc59a 100644 --- a/epan/addr_resolv.c +++ b/epan/addr_resolv.c @@ -685,49 +685,21 @@ 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); - - parse_services_file(g_pservices_path); - /* Compute the pathname of the services file. */ if (g_services_path == NULL) { g_services_path = get_datafile_path(ENAME_SERVICES); } - parse_services_file(g_services_path); -} /* initialize_services */ + /* Compute the pathname of the personal services file */ + if (g_pservices_path == NULL) { + g_pservices_path = get_persconffile_path(ENAME_SERVICES, FALSE); + } + parse_services_file(g_pservices_path); +} static void service_name_lookup_cleanup(void) |