aboutsummaryrefslogtreecommitdiffstats
path: root/epan/addr_resolv.c
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2023-07-09 12:43:12 +0100
committerJoão Valverde <j@v6e.pt>2023-07-09 12:50:29 +0100
commit959259453e2300cb91b2a26f2ae53fb6374002f9 (patch)
treebb3075d54d05ad526187b690caa8d4d5c5c525dd /epan/addr_resolv.c
parent75a778e8932270dfb3173e1a3a2074b0cacb869a (diff)
Keep global services file as optional
We don't ship an external services file anymore but keep the global file as an optional resource to load at start-up, in case anyone depends on this or to allow an administrator to provide a system services file, similar to the personal file but system-wide.
Diffstat (limited to 'epan/addr_resolv.c')
-rw-r--r--epan/addr_resolv.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index 6a526ceb28..5ebd4020d8 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -304,6 +304,7 @@ gchar *g_wka_path = NULL; /* global well-known-addresses file */
gchar *g_manuf_path = NULL; /* global manuf file */
gchar *g_ipxnets_path = NULL; /* global ipxnets file */
gchar *g_pipxnets_path = NULL; /* personal ipxnets file */
+gchar *g_services_path = NULL; /* global services file */
gchar *g_pservices_path = NULL; /* personal services file */
gchar *g_pvlan_path = NULL; /* personal vlans file */
gchar *g_ss7pcs_path = NULL; /* personal ss7pcs file */
@@ -872,10 +873,15 @@ serv_name_lookup(port_type proto, guint port)
static void
initialize_services(void)
{
- gboolean parse_file = TRUE;
ws_assert(serv_port_hashtable == NULL);
serv_port_hashtable = wmem_map_new(wmem_epan_scope(), g_direct_hash, g_direct_equal);
+ /* Compute the pathname of the global services file. */
+ if (g_services_path == NULL) {
+ g_services_path = get_datafile_path(ENAME_SERVICES);
+ }
+ parse_services_file(g_services_path);
+
/* Compute the pathname of the personal services file */
if (g_pservices_path == NULL) {
/* Check profile directory before personal configuration */
@@ -883,19 +889,17 @@ initialize_services(void)
if (!parse_services_file(g_pservices_path)) {
g_free(g_pservices_path);
g_pservices_path = get_persconffile_path(ENAME_SERVICES, FALSE);
- } else {
- parse_file = FALSE;
+ parse_services_file(g_pservices_path);
}
}
- if (parse_file) {
- parse_services_file(g_pservices_path);
- }
}
static void
service_name_lookup_cleanup(void)
{
serv_port_hashtable = NULL;
+ g_free(g_services_path);
+ g_services_path = NULL;
g_free(g_pservices_path);
g_pservices_path = NULL;
}