From b8293f95ad18bc1cc00363627471c880d0f4e5a2 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 17 Aug 2014 17:32:16 -0700 Subject: [PATCH] If we don't find a NetScaler signature, don't report an error. It's *NOT* an error; it's just a file that isn't a NetScaler file. Otherwise, we report errors on files that should just be passed on to other open routines. Also, NetScaler files are *NOT* text files, and we should *NOT* use ".txt" as the suffix. Change-Id: If001abbbbc3de3ea27439a44a47ce1d6071d38ae Reviewed-on: https://code.wireshark.org/review/3678 Reviewed-by: Guy Harris --- wiretap/file_access.c | 2 +- wiretap/netscaler.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/wiretap/file_access.c b/wiretap/file_access.c index a9c02d7341..ad0ee8f447 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -361,7 +361,7 @@ static struct open_info open_info_base[] = { { "Cosine", OPEN_INFO_HEURISTIC, cosine_open, "txt", NULL, NULL }, { "Hcidump", OPEN_INFO_HEURISTIC, hcidump_open, NULL, NULL, NULL }, { "Commview", OPEN_INFO_HEURISTIC, commview_open, "ncf", NULL, NULL }, - { "Nstrace", OPEN_INFO_HEURISTIC, nstrace_open, "txt", NULL, NULL }, + { "Nstrace", OPEN_INFO_HEURISTIC, nstrace_open, "cap", NULL, NULL }, { "Logcat ", OPEN_INFO_HEURISTIC, logcat_open, "logcat", NULL, NULL }, { "Logcat Text", OPEN_INFO_HEURISTIC, logcat_text_open, "txt", NULL, NULL }, /* ASCII trace files from Telnet sessions. */ diff --git a/wiretap/netscaler.c b/wiretap/netscaler.c index 978f10aec7..00cfd1f5cd 100644 --- a/wiretap/netscaler.c +++ b/wiretap/netscaler.c @@ -701,8 +701,7 @@ int nstrace_open(wtap *wth, int *err, gchar **err_info) break; default: - *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("nstrace: file type %d unsupported", wth->file_type_subtype); + /* No known signature found, assume it's not NetScaler */ g_free(nstrace_buf); return 0; } @@ -801,10 +800,12 @@ nspm_signature_func(20) nspm_signature_func(30) /* -** Check signature and return the version number of the signature. -** If not found, it returns 0. At the time of return from this function -** we might not be at the first page. So after a call to this function, there -** has to be a file seek to return to the start of the first page. +** Check signature and return the file type and subtype for files with +** that signature. If it finds no signature that it recognizes, it +** returns WTAP_FILE_TYPE_SUBTYPE_UNKNOWN. At the time of return from +** this function we might not be at the first page. So after a call to +** this function, there has to be a file seek to return to the start +** of the first page. */ static guint32 nspm_signature_version(wtap *wth, gchar *nstrace_buf, gint32 len) @@ -839,7 +840,7 @@ nspm_signature_version(wtap *wth, gchar *nstrace_buf, gint32 len) } } - return 0; /* no version found */ + return WTAP_FILE_TYPE_SUBTYPE_UNKNOWN; /* no version found */ } #define nspr_getv10recordtype(hdp) (pletoh16(&(hdp)->nsprRecordType))