diff options
author | Bill Meier <wmeier@newsguy.com> | 2014-12-24 10:44:03 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-12-26 20:55:25 +0000 |
commit | b68fb9b659b0debd7286195f9ad194be998cc3ff (patch) | |
tree | 6567357b78b917f85d50fe1842f864b0dc904e99 /epan | |
parent | 4cf6583b9e5bc7fa5d6f6ac17cdc1f634ae1567e (diff) |
Fix some dissectors doing termio (fprintf(stderr,..), g_warning()).
- Use report_...failure() (in most cases).
- Also: Do some misc fixes in certain disectors
- re-arrange order of #includes
- Fixup preferences help text
Change-Id: I385f6f97257f365f53ce611df02f57f9257dc5f9
Reviewed-on: https://code.wireshark.org/review/6039
Petri-Dish: Bill Meier <wmeier@newsguy.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-ber.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-dcom.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-dcom.h | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-diameter.c | 17 | ||||
-rw-r--r-- | epan/dissectors/packet-etch.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-giop.c | 13 | ||||
-rw-r--r-- | epan/dissectors/packet-smb-sidsnooping.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-ssl-utils.c | 29 | ||||
-rw-r--r-- | epan/dissectors/packet-tpncp.c | 15 | ||||
-rw-r--r-- | epan/dissectors/packet-uasip.c | 7 |
10 files changed, 54 insertions, 48 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index 398508106f..d5baf3c80b 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -2820,10 +2820,8 @@ printf("CHOICE dissect_ber_choice(%s) entered len:%d\n", name, tvb_reported_leng default: proto_tree_add_expert_format( tree, actx->pinfo, &ei_hf_field_not_integer_type, tvb, offset, len, - "dissect_ber_choice(): Was passed a HF field that was not integer type : %s", - hfinfo->abbrev); - g_warning("dissect_ber_choice(): frame:%u offset:%d Was passed a HF field that was not integer type : %s", - actx->pinfo->fd->num, offset, hfinfo->abbrev); + "dissect_ber_choice(): frame:%u offset:%d Was passed an HF field that was not integer type : %s", + actx->pinfo->fd->num, offset, hfinfo->abbrev); return end_offset; } } diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c index 45e9187738..9adb31f416 100644 --- a/epan/dissectors/packet-dcom.c +++ b/epan/dissectors/packet-dcom.c @@ -251,6 +251,7 @@ static const value_string dcom_boolean_flag_vals[] = { }; #endif +#ifdef DEBUG void dcom_interface_dump(void) { dcom_machine_t *machine; dcom_object_t *object; @@ -277,7 +278,7 @@ void dcom_interface_dump(void) { } } } - +#endif dcom_interface_t *dcom_interface_find(packet_info *pinfo _U_, const guint8 *ip _U_, e_uuid_t *ipid) { diff --git a/epan/dissectors/packet-dcom.h b/epan/dissectors/packet-dcom.h index 48343b1cc2..3d38131830 100644 --- a/epan/dissectors/packet-dcom.h +++ b/epan/dissectors/packet-dcom.h @@ -80,8 +80,9 @@ typedef struct dcom_marshaler_s { WS_DLL_PUBLIC dcom_interface_t *dcom_interface_new(packet_info *pinfo, const guint8 *ip, e_uuid_t *iid, guint64 oxid, guint64 oid, e_uuid_t *ipid); WS_DLL_PUBLIC dcom_interface_t *dcom_interface_find(packet_info *pinfo, const guint8 *ip, e_uuid_t *ipid); +#ifdef DEBUG extern void dcom_interface_dump(void); - +#endif extern int dcom_register_rountine(dcom_dissect_fn_t routine, e_uuid_t* uuid); extern void dcom_register_common_routines_(void); diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c index 7bcaf997f1..00174eeea7 100644 --- a/epan/dissectors/packet-diameter.c +++ b/epan/dissectors/packet-diameter.c @@ -44,7 +44,6 @@ #include <epan/packet.h> #include <epan/exceptions.h> -#include <wsutil/filesystem.h> #include <epan/prefs.h> #include <epan/sminmpec.h> #include <epan/expert.h> @@ -54,6 +53,8 @@ #include <epan/sctpppids.h> #include <epan/show_exception.h> #include <epan/to_str.h> +#include <wsutil/filesystem.h> +#include <wsutil/report_err.h> #include "packet-tcp.h" #include "packet-diameter.h" #include "packet-e212.h" @@ -1584,7 +1585,7 @@ build_simple_avp(const avp_type_t *type, guint32 code, diam_vnd_t *vendor, break; default: - fprintf(stderr,"Diameter Dictionary: AVP '%s' has a list of values but isn't of a 32-bit or shorter integral type\n", + report_failure("Diameter Dictionary: AVP '%s' has a list of values but isn't of a 32-bit or shorter integral type\n", name); return NULL; } @@ -1738,7 +1739,7 @@ dictionary_load(void) /* try to get the parent type */ if (t->name == NULL) { - fprintf(stderr,"Diameter Dictionary: Invalid Type (empty name): parent==%s\n", + report_failure("Diameter Dictionary: Invalid Type (empty name): parent==%s\n", t->parent ? t->parent : "(null)"); continue; } @@ -1789,7 +1790,7 @@ dictionary_load(void) item[0].strptr = v->name; if (v->name == NULL) { - fprintf(stderr,"Diameter Dictionary: Invalid Vendor (empty name): code==%d\n",v->code); + report_failure("Diameter Dictionary: Invalid Vendor (empty name): code==%d\n",v->code); continue; } @@ -1814,7 +1815,7 @@ dictionary_load(void) if ((c = d->cmds)) { for (; c; c = c->next) { if (c->vendor == NULL) { - fprintf(stderr,"Diameter Dictionary: Invalid Vendor (empty name) for command %s\n", + report_failure("Diameter Dictionary: Invalid Vendor (empty name) for command %s\n", c->name ? c->name : "(null)"); continue; } @@ -1829,7 +1830,7 @@ dictionary_load(void) /* Also add to all_cmds as used by RFC version */ g_array_append_val(all_cmds,item); } else { - fprintf(stderr,"Diameter Dictionary: No Vendor: %s\n",c->vendor); + report_failure("Diameter Dictionary: No Vendor: %s\n",c->vendor); } } } @@ -1843,7 +1844,7 @@ dictionary_load(void) void *avp_data = NULL; if (a->name == NULL) { - fprintf(stderr,"Diameter Dictionary: Invalid AVP (empty name)\n"); + report_failure("Diameter Dictionary: Invalid AVP (empty name)\n"); continue; } @@ -1856,7 +1857,7 @@ dictionary_load(void) g_array_append_val(vnd->vs_avps,vndvs); } else { - fprintf(stderr,"Diameter Dictionary: No Vendor: %s\n",vend); + report_failure("Diameter Dictionary: No Vendor: %s\n",vend); vnd = &unknown_vendor; } diff --git a/epan/dissectors/packet-etch.c b/epan/dissectors/packet-etch.c index a0c23b831c..82c0c43cf2 100644 --- a/epan/dissectors/packet-etch.c +++ b/epan/dissectors/packet-etch.c @@ -360,7 +360,7 @@ read_hashed_symbols_from_dir(const char *dirname) ws_dir_close(dir); gbl_symbols_vs_ext_new(); }else{ - report_failure("%s", err_p->message); + report_failure("etch: %s", err_p->message); g_error_free(err_p); } } diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c index 147eac7ddd..8012a5f7a6 100644 --- a/epan/dissectors/packet-giop.c +++ b/epan/dissectors/packet-giop.c @@ -287,13 +287,14 @@ #include <epan/prefs.h> #include <epan/expert.h> #include <epan/strutil.h> +#include <wsutil/file_util.h> +#include <wsutil/str_util.h> +#include <wsutil/pint.h> +#include <wsutil/report_err.h> #include "packet-giop.h" #include "packet-ziop.h" #include "packet-tcp.h" -#include <wsutil/file_util.h> -#include <wsutil/str_util.h> -#include <wsutil/pint.h> void proto_register_giop(void); void proto_reg_handoff_giop(void); @@ -1427,12 +1428,12 @@ static guint32 string_to_IOR(guchar *in, guint32 in_len, guint8 **out) { if ( g_ascii_isxdigit(in[i]) && g_ascii_isxdigit(in[i+1]) ) { /* hex ? */ if ( (tmpval_msb = ws_xton(in[i])) < 0 ) { - g_warning("giop: Invalid value in IOR %i \n", tmpval_msb); + report_failure("giop: Invalid value in IOR %i", tmpval_msb); } if ( (tmpval_lsb = ws_xton(in[i+1])) < 0 ) { - g_warning("giop: Invalid value in IOR %i \n", tmpval_lsb); + report_failure("giop: Invalid value in IOR %i", tmpval_lsb); } tmpval = tmpval_msb << 4; @@ -1488,7 +1489,7 @@ static void read_IOR_strings_from_file(const gchar *name, int max_iorlen) { if (fp == NULL) { if (errno == EACCES) - fprintf(stderr, "Error opening file %s for reading: %s\n", name, g_strerror(errno)); + report_open_failure(name, errno, FALSE); return; } diff --git a/epan/dissectors/packet-smb-sidsnooping.c b/epan/dissectors/packet-smb-sidsnooping.c index 33a573192d..fdcade96bc 100644 --- a/epan/dissectors/packet-smb-sidsnooping.c +++ b/epan/dissectors/packet-smb-sidsnooping.c @@ -28,6 +28,7 @@ #include <epan/packet.h> #include <epan/epan_dissect.h> #include <epan/tap.h> +#include <wsutil/report_err.h> #include "packet-dcerpc.h" #include "packet-dcerpc-nt.h" #include "packet-smb.h" @@ -348,7 +349,7 @@ sid_snooping_init(void) disabling it now so that it won't cause wireshark to abort due to unknown hf fields */ -sid_name_snooping=0; +sid_name_snooping=FALSE; if(!sid_name_snooping){ return; @@ -380,7 +381,7 @@ sid_name_snooping=0; if(error_string){ /* error, we failed to attach to the tap. clean up */ - fprintf(stderr, "tshark: Couldn't register proto_reg_handoff_smb_sidsnooping()/lsa_policy_information tap: %s\n", + report_failure( "Couldn't register proto_reg_handoff_smb_sidsnooping()/lsa_policy_information tap: %s\n", error_string->str); g_string_free(error_string, TRUE); return; @@ -394,7 +395,7 @@ sid_name_snooping=0; if(error_string){ /* error, we failed to attach to the tap. clean up */ - fprintf(stderr, "tshark: Couldn't register proto_reg_handoff_smb_sidsnooping()/samr_query_dispinfo tap: %s\n", + report_failure( "Couldn't register proto_reg_handoff_smb_sidsnooping()/samr_query_dispinfo tap: %s\n", error_string->str); g_string_free(error_string, TRUE); return; diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c index 66c96879ca..e2558cd6b4 100644 --- a/epan/dissectors/packet-ssl-utils.c +++ b/epan/dissectors/packet-ssl-utils.c @@ -31,6 +31,7 @@ #endif #include <stdlib.h> +#include <errno.h> #include <epan/packet.h> #include <epan/strutil.h> @@ -40,6 +41,7 @@ #include <epan/asn1.h> #include <wsutil/file_util.h> #include <wsutil/str_util.h> +#include <wsutil/report_err.h> #include "packet-x509af.h" #include "packet-x509if.h" #include "packet-ssl-utils.h" @@ -4086,19 +4088,16 @@ ssl_association_add(GTree* associations, dissector_handle_t handle, guint port, assoc->handle = find_dissector("data"); } - if (!assoc->handle) { - fprintf(stderr, "association_add() could not find handle for protocol:%s\n",protocol); - } else { - if (port) { - if (tcp) - dissector_add_uint("tcp.port", port, handle); - else - dissector_add_uint("udp.port", port, handle); - } - g_tree_insert(associations, assoc, assoc); - - dissector_add_uint("sctp.port", port, handle); + DISSECTOR_ASSERT(assoc->handle != NULL); + if (port) { + if (tcp) + dissector_add_uint("tcp.port", port, handle); + else + dissector_add_uint("udp.port", port, handle); } + g_tree_insert(associations, assoc, assoc); + + dissector_add_uint("sctp.port", port, handle); } void @@ -4309,7 +4308,7 @@ ssl_parse_key_list(const ssldecrypt_assoc_t * uats, GHashTable *key_hash, GTree* /* try to load keys file first */ fp = ws_fopen(uats->keyfile, "rb"); if (!fp) { - fprintf(stderr, "Can't open file %s\n",uats->keyfile); + report_open_failure(uats->keyfile, errno, FALSE); return; } @@ -4346,13 +4345,13 @@ ssl_parse_key_list(const ssldecrypt_assoc_t * uats, GHashTable *key_hash, GTree* char *err = NULL; private_key = ssl_load_pkcs12(fp, uats->password, &err); if (err) { - fprintf(stderr, "%s\n", err); + report_failure("%s\n", err); g_free(err); } } if (!private_key) { - fprintf(stderr,"Can't load private key from %s\n", uats->keyfile); + report_failure("Can't load private key from %s\n", uats->keyfile); fclose(fp); return; } diff --git a/epan/dissectors/packet-tpncp.c b/epan/dissectors/packet-tpncp.c index 0b1a43319a..ce4018cf3a 100644 --- a/epan/dissectors/packet-tpncp.c +++ b/epan/dissectors/packet-tpncp.c @@ -35,6 +35,7 @@ #include <epan/to_str.h> #include <wsutil/filesystem.h> #include <wsutil/file_util.h> +#include <wsutil/report_err.h> #include "packet-tcp.h" /*-------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -805,7 +806,7 @@ void proto_register_tpncp(void) { "TPNCP", "tpncp"); if(global_tpncp_load_db){ if (init_tpncp_db() == -1) { - g_warning("Could not load tpncp.dat file, tpncp dissector will not work"); + report_failure("tpncp: Could not load tpncp.dat file, tpncp dissector will not work"); return; } @@ -826,7 +827,7 @@ void proto_register_tpncp(void) { } CATCH_ALL { - g_warning("Corrupt tpncp.dat file, tpncp dissector will not work."); + report_failure("Corrupt tpncp.dat file, tpncp dissector will not work."); } ENDTRY; @@ -840,11 +841,11 @@ void proto_register_tpncp(void) { /* See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9569 for some discussion on this as well */ prefs_register_bool_preference(tpncp_module, "load_db", - "Whether to load DB or not, if DB not loaded dissector is passive", - "Whether to load the Data base or not, not loading the DB " - "dissaables the protocol, Wireshar has to be restarted for the" - "setting to take effect ", - &global_tpncp_load_db); + "Whether to load DB or not; if DB not loaded dissector is passive", + "Whether to load the Database or not; not loading the DB" + " disables the protocol; Wireshark has to be restarted for the" + " setting to take effect.", + &global_tpncp_load_db); prefs_register_uint_preference(tpncp_module, "tcp.trunkpack_port", "TPNCP \"well-known\" TrunkPack TCP Port", diff --git a/epan/dissectors/packet-uasip.c b/epan/dissectors/packet-uasip.c index 0df357fb92..b099573f87 100644 --- a/epan/dissectors/packet-uasip.c +++ b/epan/dissectors/packet-uasip.c @@ -23,10 +23,13 @@ #include "config.h" - #include "epan/packet.h" #include "epan/prefs.h" +#if 0 +#include <epan/tap.h> +#endif #include <epan/addr_resolv.h> +#include <wsutil/report_err.h> #include "packet-uaudp.h" @@ -481,7 +484,7 @@ void proto_reg_handoff_uasip(void) if (str_to_ip(pref_proxy_ipaddr_s, proxy_ipaddr)) { use_proxy_ipaddr = TRUE; } else { - g_warning("uasip: Invalid 'Proxy IP Address': \"%s\"", pref_proxy_ipaddr_s); + report_failure("uasip: Invalid 'Proxy IP Address': \"%s\"", pref_proxy_ipaddr_s); } } } |