summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/wireshark.pod.template4
-rw-r--r--epan/addr_resolv.c33
2 files changed, 30 insertions, 7 deletions
diff --git a/doc/wireshark.pod.template b/doc/wireshark.pod.template
index a8ec549ccf..60307b3659 100644
--- a/doc/wireshark.pod.template
+++ b/doc/wireshark.pod.template
@@ -2656,6 +2656,8 @@ will not be consulted for capture filter name resolution.
If an IPv4 address cannot be translated via name resolution (no exact
match is found) then a partial match is attempted via the F<subnets> file.
+Both the global F<subnets> file and personal F<subnets> files are used
+if they exist.
Each line of this file consists of an IPv4 address, a subnet mask length
separated only by a / and a name separated by whitespace. While the address
@@ -2725,6 +2727,8 @@ preferences file.
=item Name Resolution (services)
The F<services> file is used to translate port numbers into names.
+Both the global F<services> file and personal F<services> files are used
+if they exist.
The file has the standard F<services> file syntax; each line contains one
(service) name and one transport identifier separated by white space. The
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index 73b2452a64..3f09388691 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -549,7 +549,7 @@ add_serv_port_cb(const guint32 port)
}
-static void
+static gboolean
parse_services_file(const char * path)
{
FILE *serv_p;
@@ -560,13 +560,14 @@ parse_services_file(const char * path)
serv_p = ws_fopen(path, "r");
if (serv_p == NULL)
- return;
+ return FALSE;
while (fgetline(&buf, &size, serv_p) >= 0) {
parse_service_line(buf);
}
fclose(serv_p);
+ return TRUE;
}
/* -----------------
@@ -643,6 +644,7 @@ serv_name_lookup(port_type proto, guint port)
static void
initialize_services(void)
{
+ gboolean parse_file = TRUE;
g_assert(serv_port_hashtable == NULL);
serv_port_hashtable = wmem_map_new(wmem_epan_scope(), g_int_hash, g_int_equal);
@@ -654,9 +656,17 @@ initialize_services(void)
/* Compute the pathname of the personal services file */
if (g_pservices_path == NULL) {
- g_pservices_path = get_persconffile_path(ENAME_SERVICES, FALSE);
+ /* Check profile directory before personal configuration */
+ g_pservices_path = get_persconffile_path(ENAME_SERVICES, TRUE);
+ if (!parse_services_file(g_pservices_path)) {
+ g_pservices_path = get_persconffile_path(ENAME_SERVICES, FALSE);
+ } else {
+ parse_file = FALSE;
+ }
+ }
+ if (parse_file) {
+ parse_services_file(g_pservices_path);
}
- parse_services_file(g_pservices_path);
}
static void
@@ -2302,9 +2312,18 @@ subnet_name_lookup_init(void)
subnet_length_entries[i].mask = g_htonl(ip_get_subnet_mask(length));
}
- subnetspath = get_persconffile_path(ENAME_SUBNETS, FALSE);
- if (!read_subnets_file(subnetspath) && errno != ENOENT) {
- report_open_failure(subnetspath, errno, FALSE);
+ /* Check profile directory before personal configuration */
+ subnetspath = get_persconffile_path(ENAME_SUBNETS, TRUE);
+ if (!read_subnets_file(subnetspath)) {
+ if (errno != ENOENT) {
+ report_open_failure(subnetspath, errno, FALSE);
+ }
+
+ g_free(subnetspath);
+ subnetspath = get_persconffile_path(ENAME_SUBNETS, FALSE);
+ if (!read_subnets_file(subnetspath) && errno != ENOENT) {
+ report_open_failure(subnetspath, errno, FALSE);
+ }
}
g_free(subnetspath);