diff options
author | Michael Mann <mmann78@netscape.net> | 2016-07-24 08:53:39 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-07-25 04:26:50 +0000 |
commit | 1da1f945e2988080add4923dc2021753e3b2f7c1 (patch) | |
tree | 2839b66064e34ba99a6d031778330f20497b5e93 /epan/dissectors | |
parent | ee7f9c33f63532bc69899a0750177756be53c0c1 (diff) |
Fix checkAPI.pl warnings about printf
Many of the complaints from checkAPI.pl for use of printf are when its embedded
in an #ifdef and checkAPI isn't smart enough to figure that out.
The other (non-ifdef) use is dumping internal structures (which is a type of
debug functionality)
Add a "ws_debug_printf" macro for printf to pacify the warnings.
Change-Id: I63610e1adbbaf2feffb4ec9d4f817247d833f7fd
Reviewed-on: https://code.wireshark.org/review/16623
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-beep.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-ber.c | 69 | ||||
-rw-r--r-- | epan/dissectors/packet-giop.c | 111 | ||||
-rw-r--r-- | epan/dissectors/packet-tacacs.c | 21 | ||||
-rw-r--r-- | epan/dissectors/packet-wtp.c | 4 |
5 files changed, 110 insertions, 102 deletions
diff --git a/epan/dissectors/packet-beep.c b/epan/dissectors/packet-beep.c index d3bae70d60..ba8a96e810 100644 --- a/epan/dissectors/packet-beep.c +++ b/epan/dissectors/packet-beep.c @@ -35,6 +35,9 @@ #include <epan/conversation.h> #include <epan/expert.h> #include <epan/proto_data.h> +#if defined(DEBUG_BEEP_HASH) +#include <wsutil/ws_printf.h> /* ws_debug_printf */ +#endif #define TCP_PORT_BEEP 10288 @@ -165,7 +168,7 @@ beep_equal(gconstpointer v, gconstpointer w) const struct beep_request_key *v2 = (const struct beep_request_key *)w; #if defined(DEBUG_BEEP_HASH) - printf("Comparing %08X\n and %08X\n", + ws_debug_printf("Comparing %08X\n and %08X\n", v1->conversation, v2->conversation); #endif @@ -185,7 +188,7 @@ beep_hash(gconstpointer v) val = key->conversation; #if defined(DEBUG_BEEP_HASH) - printf("BEEP Hash calculated as %u\n", val); + ws_debug_printf("BEEP Hash calculated as %u\n", val); #endif return val; diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index c2e4714836..dd1300e575 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -67,6 +67,9 @@ #include <epan/uat.h> #include <epan/decode_as.h> #include <wiretap/wtap.h> +#ifdef DEBUG_BER +#include <wsutil/ws_printf.h> /* ws_debug_printf */ +#endif #include "packet-ber.h" @@ -658,9 +661,9 @@ name = hfinfo->name; name = "unnamed"; } if (tvb_reported_length_remaining(tvb, offset) > 3) { -printf("dissect_ber_tagged_type(%s) entered implicit_tag:%d offset:%d len:%d %02x:%02x:%02x\n", name, implicit_tag, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); +proto_tree_add_debug_text(tree, "dissect_ber_tagged_type(%s) entered implicit_tag:%d offset:%d len:%d %02x:%02x:%02x\n", name, implicit_tag, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); } else { -printf("dissect_ber_tagged_type(%s) entered\n", name); +proto_tree_add_debug_text(tree, "dissect_ber_tagged_type(%s) entered\n", name); } } #endif @@ -1193,7 +1196,7 @@ get_ber_identifier(tvbuff_t *tvb, int offset, gint8 *ber_class, gboolean *pc, gi id = tvb_get_guint8(tvb, offset); offset += 1; #ifdef DEBUG_BER -printf ("BER ID=%02x", id); +ws_debug_printf("BER ID=%02x", id); #endif /* 8.1.2.2 */ tmp_class = (id >> 6) & 0x03; @@ -1205,7 +1208,7 @@ printf ("BER ID=%02x", id); while (tvb_reported_length_remaining(tvb, offset) > 0) { t = tvb_get_guint8(tvb, offset); #ifdef DEBUG_BER -printf (" %02x", t); +ws_debug_printf(" %02x", t); #endif offset += 1; tmp_tag <<= 7; @@ -1216,7 +1219,7 @@ printf (" %02x", t); } #ifdef DEBUG_BER -printf ("\n"); +ws_debug_printf("\n"); #endif if (ber_class) *ber_class = tmp_class; @@ -1354,7 +1357,7 @@ try_get_ber_length(tvbuff_t *tvb, int offset, guint32 *length, gboolean *ind, gi *ind = tmp_ind; #ifdef DEBUG_BER -printf("get BER length %d, offset %d (remaining %d)\n", tmp_length, offset, tvb_reported_length_remaining(tvb, offset)); +ws_debug_printf("get BER length %d, offset %d (remaining %d)\n", tmp_length, offset, tvb_reported_length_remaining(tvb, offset)); #endif return offset; @@ -1400,7 +1403,7 @@ dissect_ber_length(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int *ind = tmp_ind; #ifdef DEBUG_BER -printf("dissect BER length %d, offset %d (remaining %d)\n", tmp_length, offset, tvb_reported_length_remaining(tvb, offset)); +proto_tree_add_debug_text("dissect BER length %d, offset %d (remaining %d)\n", tmp_length, offset, tvb_reported_length_remaining(tvb, offset)); #endif last_length = tmp_length; @@ -1555,9 +1558,9 @@ name = hfinfo->name; name = "unnamed"; } if (tvb_reported_length_remaining(tvb, offset) > 3) { -printf("OCTET STRING dissect_ber_octet string(%s) entered implicit_tag:%d offset:%d len:%d %02x:%02x:%02x\n", name, implicit_tag, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); +proto_tree_add_debug_text(tree, "OCTET STRING dissect_ber_octet string(%s) entered implicit_tag:%d offset:%d len:%d %02x:%02x:%02x\n", name, implicit_tag, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); } else { -printf("OCTET STRING dissect_ber_octet_string(%s) entered\n", name); +proto_tree_add_debug_text(tree, "OCTET STRING dissect_ber_octet_string(%s) entered\n", name); } } #endif @@ -1860,9 +1863,9 @@ name = hfinfo->name; name = "unnamed"; } if (tvb_reported_length_remaining(tvb, offset) > 3) { -printf("INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d offset:%d len:%d %02x:%02x:%02x\n", name, implicit_tag, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); +proto_tree_add_debug_text(tree, "INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d offset:%d len:%d %02x:%02x:%02x\n", name, implicit_tag, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); } else { -printf("INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d \n", name, implicit_tag); +proto_tree_add_debug_text(tree, "INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d \n", name, implicit_tag); } } #endif @@ -2139,9 +2142,9 @@ name = hfinfo->name; name = "unnamed"; } if (tvb_reported_length_remaining(tvb, offset) > 3) { -printf("SEQUENCE dissect_ber_sequence(%s) entered offset:%d len:%d %02x:%02x:%02x\n", name, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); +proto_tree_add_debug_text(tree, "SEQUENCE dissect_ber_sequence(%s) entered offset:%d len:%d %02x:%02x:%02x\n", name, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); } else { -printf("SEQUENCE dissect_ber_sequence(%s) entered\n", name); +proto_tree_add_debug_text(tree, "SEQUENCE dissect_ber_sequence(%s) entered\n", name); } } #endif @@ -2397,9 +2400,9 @@ name = hfinfo->name; name = "unnamed"; } if (tvb_reported_length_remaining(next_tvb, 0) > 3) { -printf("SEQUENCE dissect_ber_sequence(%s) calling subdissector offset:%d len:%d %02x:%02x:%02x\n", name, offset, tvb_reported_length_remaining(next_tvb, 0), tvb_get_guint8(next_tvb, 0), tvb_get_guint8(next_tvb, 1), tvb_get_guint8(next_tvb, 2)); +proto_tree_add_debug_text(tree, "SEQUENCE dissect_ber_sequence(%s) calling subdissector offset:%d len:%d %02x:%02x:%02x\n", name, offset, tvb_reported_length_remaining(next_tvb, 0), tvb_get_guint8(next_tvb, 0), tvb_get_guint8(next_tvb, 1), tvb_get_guint8(next_tvb, 2)); } else { -printf("SEQUENCE dissect_ber_sequence(%s) calling subdissector\n", name); +proto_tree_add_debug_text(tree, "SEQUENCE dissect_ber_sequence(%s) calling subdissector\n", name); } } #endif @@ -2424,7 +2427,7 @@ name = hfinfo->name; } else { name = "unnamed"; } -printf("SEQUENCE dissect_ber_sequence(%s) subdissector ate %d bytes\n", name, count); +proto_tree_add_debug_text(tree, "SEQUENCE dissect_ber_sequence(%s) subdissector ate %d bytes\n", name, count); } #endif /* if it was optional and no bytes were eaten and it was */ @@ -2505,9 +2508,9 @@ name = hfinfo->name; name = "unnamed"; } if (tvb_reported_length_remaining(tvb, offset) > 3) { -printf("SET dissect_ber_set(%s) entered offset:%d len:%d %02x:%02x:%02x\n", name, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); +proto_tree_add_debug_text(tree, "SET dissect_ber_set(%s) entered offset:%d len:%d %02x:%02x:%02x\n", name, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); } else { -printf("SET dissect_ber_set(%s) entered\n", name); +proto_tree_add_debug_text(tree, "SET dissect_ber_set(%s) entered\n", name); } } #endif @@ -2651,9 +2654,9 @@ name = hfinfo->name; name = "unnamed"; } if (tvb_reported_length_remaining(next_tvb, 0) > 3) { -printf("SET dissect_ber_set(%s) calling subdissector offset:%d len:%d %02x:%02x:%02x\n", name, offset, tvb_reported_length_remaining(next_tvb, 0), tvb_get_guint8(next_tvb, 0), tvb_get_guint8(next_tvb, 1), tvb_get_guint8(next_tvb, 2)); +proto_tree_add_debug_text(tree, "SET dissect_ber_set(%s) calling subdissector offset:%d len:%d %02x:%02x:%02x\n", name, offset, tvb_reported_length_remaining(next_tvb, 0), tvb_get_guint8(next_tvb, 0), tvb_get_guint8(next_tvb, 1), tvb_get_guint8(next_tvb, 2)); } else { -printf("SET dissect_ber_set(%s) calling subdissector\n", name); +proto_tree_add_debug_text(tree, "SET dissect_ber_set(%s) calling subdissector\n", name); } } #endif @@ -2781,9 +2784,9 @@ name = hfinfo->name; name = "unnamed"; } if (tvb_reported_length_remaining(tvb, offset) > 3) { -printf("CHOICE dissect_ber_choice(%s) entered offset:%d len:%d %02x:%02x:%02x\n", name, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); +proto_tree_add_debug_text(tree, "CHOICE dissect_ber_choice(%s) entered offset:%d len:%d %02x:%02x:%02x\n", name, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); } else { -printf("CHOICE dissect_ber_choice(%s) entered len:%d\n", name, tvb_reported_length_remaining(tvb, offset)); +proto_tree_add_debug_text(tree, "CHOICE dissect_ber_choice(%s) entered len:%d\n", name, tvb_reported_length_remaining(tvb, offset)); } } #endif @@ -2846,7 +2849,7 @@ printf("CHOICE dissect_ber_choice(%s) entered len:%d\n", name, tvb_reported_leng } #ifdef DEBUG_BER_CHOICE -printf("CHOICE testing potential subdissector class[%p]:%d:(expected)%d tag:%d:(expected)%d flags:%d\n", ch, ber_class, ch->ber_class, tag, ch->tag, ch->flags); +proto_tree_add_debug_text(tree, "CHOICE testing potential subdissector class[%p]:%d:(expected)%d tag:%d:(expected)%d flags:%d\n", ch, ber_class, ch->ber_class, tag, ch->tag, ch->flags); #endif if ( (first_pass && (((ch->ber_class == ber_class) && (ch->tag == tag)) @@ -2901,9 +2904,9 @@ name = hfinfo->name; name = "unnamed"; } if (tvb_reported_length_remaining(next_tvb, 0) > 3) { -printf("CHOICE dissect_ber_choice(%s) calling subdissector start_offset:%d offset:%d len:%d %02x:%02x:%02x\n", name, start_offset, offset, tvb_reported_length_remaining(next_tvb, 0), tvb_get_guint8(next_tvb, 0), tvb_get_guint8(next_tvb, 1), tvb_get_guint8(next_tvb, 2)); +proto_tree_add_debug_text(tree, "CHOICE dissect_ber_choice(%s) calling subdissector start_offset:%d offset:%d len:%d %02x:%02x:%02x\n", name, start_offset, offset, tvb_reported_length_remaining(next_tvb, 0), tvb_get_guint8(next_tvb, 0), tvb_get_guint8(next_tvb, 1), tvb_get_guint8(next_tvb, 2)); } else { -printf("CHOICE dissect_ber_choice(%s) calling subdissector len:%d\n", name, tvb_reported_length(next_tvb)); +proto_tree_add_debug_text(tree, "CHOICE dissect_ber_choice(%s) calling subdissector len:%d\n", name, tvb_reported_length(next_tvb)); } } #endif @@ -2924,7 +2927,7 @@ name = hfinfo->name; } else { name = "unnamed"; } -printf("CHOICE dissect_ber_choice(%s) subdissector ate %d bytes\n", name, count); +proto_tree_add_debug_text(tree, "CHOICE dissect_ber_choice(%s) subdissector ate %d bytes\n", name, count); } #endif if ((count == 0) && (((ch->ber_class == ber_class) && (ch->tag == -1) && (ch->flags & BER_FLAGS_NOOWNTAG)) || !first_pass)) { @@ -2939,7 +2942,7 @@ name = hfinfo->name; } else { name = "unnamed"; } -printf("CHOICE dissect_ber_choice(%s) trying again\n", name); +proto_tree_add_debug_text(tree, "CHOICE dissect_ber_choice(%s) trying again\n", name); } #endif continue; @@ -3065,9 +3068,9 @@ name = hfinfo->name; name = "unnamed"; } if (tvb_reported_length_remaining(tvb, offset) > 3) { -printf("RESTRICTED STRING dissect_ber_octet string(%s) entered implicit_tag:%d offset:%d len:%d %02x:%02x:%02x\n", name, implicit_tag, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); +proto_tree_add_debug_text(tree, "RESTRICTED STRING dissect_ber_octet string(%s) entered implicit_tag:%d offset:%d len:%d %02x:%02x:%02x\n", name, implicit_tag, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); } else { -printf("RESTRICTED STRING dissect_ber_octet_string(%s) entered\n", name); +proto_tree_add_debug_text(tree, "RESTRICTED STRING dissect_ber_octet_string(%s) entered\n", name); } } #endif @@ -3161,9 +3164,9 @@ name = hfinfo->name; name = "unnamed"; } if (tvb_reported_length_remaining(tvb, offset) > 3) { -printf("OBJECT IDENTIFIER dissect_ber_any_oid(%s) entered implicit_tag:%d offset:%d len:%d %02x:%02x:%02x\n", name, implicit_tag, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); +proto_tree_add_debug_text(tree, "OBJECT IDENTIFIER dissect_ber_any_oid(%s) entered implicit_tag:%d offset:%d len:%d %02x:%02x:%02x\n", name, implicit_tag, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); } else { -printf("OBJECT IDENTIFIER dissect_ber_any_oid(%s) entered\n", name); +proto_tree_add_debug_text(tree, "OBJECT IDENTIFIER dissect_ber_any_oid(%s) entered\n", name); } } #endif @@ -3298,9 +3301,9 @@ name = hfinfo->name; name = "unnamed"; } if (tvb_reported_length_remaining(tvb,offset) > 3) { -printf("SQ OF dissect_ber_sq_of(%s) entered implicit_tag:%d offset:%d len:%d %02x:%02x:%02x\n", name, implicit_tag, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); +proto_tree_add_debug_text(tree, "SQ OF dissect_ber_sq_of(%s) entered implicit_tag:%d offset:%d len:%d %02x:%02x:%02x\n", name, implicit_tag, offset, tvb_reported_length_remaining(tvb, offset), tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2)); } else { -printf("SQ OF dissect_ber_sq_of(%s) entered\n", name); +proto_tree_add_debug_text(tree, "SQ OF dissect_ber_sq_of(%s) entered\n", name); } } #endif diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c index aaffa5efb4..8fff55bfc8 100644 --- a/epan/dissectors/packet-giop.c +++ b/epan/dissectors/packet-giop.c @@ -294,6 +294,7 @@ #include <wsutil/str_util.h> #include <wsutil/pint.h> #include <wsutil/report_err.h> +#include <wsutil/ws_printf.h> /* ws_debug_printf */ #include "packet-giop.h" #include "packet-ziop.h" @@ -1344,8 +1345,8 @@ void register_giop_user_module(giop_sub_dissector_t *sub, const gchar *name, con /* So, passed module name should NOT exist in hash at this point.*/ #if DEBUG - printf("giop:register_module: Adding Module %s to module hash \n", module); - printf("giop:register_module: Module sub dissector name is %s \n", name); + ws_debug_printf("giop:register_module: Adding Module %s to module hash \n", module); + ws_debug_printf("giop:register_module: Module sub dissector name is %s \n", name); #endif new_module_key = (struct giop_module_key *)wmem_alloc(wmem_epan_scope(), sizeof(struct giop_module_key)); @@ -1382,7 +1383,7 @@ static gint giop_hash_objkey_equal(gconstpointer v, gconstpointer w) { } #if DEBUG - printf("giop:giop_hash_objkey_equal: Objkey's DO NOT match"); + ws_debug_printf("giop:giop_hash_objkey_equal: Objkey's DO NOT match"); #endif return 0; /* found differences */ @@ -1405,7 +1406,7 @@ static guint32 giop_hash_objkey_hash(gconstpointer v) { */ #if DEBUG - printf("giop:hash_objkey: Key length = %u \n", key->objkey_len ); + ws_debug_printf("giop:hash_objkey: Key length = %u \n", key->objkey_len ); #endif for (i=0; i< key->objkey_len; i++) { @@ -1453,7 +1454,7 @@ static void insert_in_objkey_hash(GHashTable *hash, const gchar *obj, guint32 le #if DEBUG - printf("giop: ******* Inserting Objkey with RepoID = %s and key length = %u into hash \n", + ws_debug_printf("giop: ******* Inserting Objkey with RepoID = %s and key length = %u into hash \n", objkey_val->repo_id, new_objkey_key->objkey_len); #endif @@ -1656,13 +1657,13 @@ static gchar * get_repoid_from_objkey(GHashTable *hash, const guint8 *obj, guint if (objkey_val) { #if DEBUG - printf("Lookup of object key returns RepoId = %s \n", objkey_val->repo_id ); + ws_debug_printf("Lookup of object key returns RepoId = %s \n", objkey_val->repo_id ); #endif return objkey_val->repo_id; /* found */ } #if DEBUG - printf("FAILED Lookup of object key \n" ); + ws_debug_printf("FAILED Lookup of object key \n" ); #endif return NULL; /* not found */ @@ -1734,7 +1735,7 @@ static void display_module_hash(gpointer key, gpointer val, gpointer user_data) struct giop_module_val *mv = (struct giop_module_val *) val; struct giop_module_key *mk = (struct giop_module_key *) key; - printf("giop:module: Key = (%s) , Val = (%s) \n", mk->module, mv->subh->sub_name); + ws_debug_printf("giop:module: Key = (%s) , Val = (%s) \n", mk->module, mv->subh->sub_name); return; @@ -1749,7 +1750,7 @@ static void display_complete_reply_hash(gpointer key, gpointer val, gpointer use struct complete_reply_hash_val *mv = (struct complete_reply_hash_val *) val; struct complete_reply_hash_key *mk = (struct complete_reply_hash_key *) key; - printf("giop:complete_reply: FN (key) = %8u , MFN (val) = %8u \n", mk->fn, mv->mfn); + ws_debug_printf("giop:complete_reply: FN (key) = %8u , MFN (val) = %8u \n", mk->fn, mv->mfn); return; @@ -1766,10 +1767,10 @@ static void display_objkey_hash(gpointer key, gpointer val, gpointer user_data) struct giop_object_key *mk = (struct giop_object_key *) key; - printf("giop:objkey: Key->objkey_len = %u, Key->objkey ", mk->objkey_len); + ws_debug_printf("giop:objkey: Key->objkey_len = %u, Key->objkey ", mk->objkey_len); for (i=0; i<mk->objkey_len; i++) { - printf("%.2x ", mk->objkey[i]); + ws_debug_printf("%.2x ", mk->objkey[i]); } /* @@ -1777,10 +1778,10 @@ static void display_objkey_hash(gpointer key, gpointer val, gpointer user_data) */ if (mv->src == 0) { - printf(", Repo ID = %s \n", mv->repo_id); + ws_debug_printf(", Repo ID = %s \n", mv->repo_id); } else { - printf(", Repo ID = %s , (file) \n", mv->repo_id); + ws_debug_printf(", Repo ID = %s , (file) \n", mv->repo_id); } return; @@ -1804,7 +1805,7 @@ static void display_heuristic_user_list() { for (i=0; i<len; i++) { subh = ( giop_sub_handle_t *) g_slist_nth_data(giop_sub_list, i); /* grab entry */ - printf("giop:heuristic_user: Element = %i, Val (user) = %s \n", i, subh->sub_name); + ws_debug_printf("giop:heuristic_user: Element = %i, Val (user) = %s \n", i, subh->sub_name); } } @@ -1826,7 +1827,7 @@ static void display_complete_request_list() { for (i=0; i<len; i++) { entry = (comp_req_list_entry_t *) g_list_nth_data(giop_complete_request_list, i); /* grab entry */ - printf("giop:Index = %8i , FN = %8i, reqid = %8u , operation = %20s , repoid = %30s \n", i, entry->fn, + ws_debug_printf("giop:Index = %8i , FN = %8i, reqid = %8u , operation = %20s , repoid = %30s \n", i, entry->fn, entry->reqid, entry->operation, entry->repoid); } @@ -1845,73 +1846,73 @@ static void giop_dump_collection(collection_data_t collection_type) { switch (collection_type) { case cd_heuristic_users: - printf("+----------------------------------------------+ \n"); - printf("+-------------- Heuristic User (Begin) --------+ \n"); - printf("+----------------------------------------------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); + ws_debug_printf("+-------------- Heuristic User (Begin) --------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); display_heuristic_user_list(); - printf("+----------------------------------------------+ \n"); - printf("+-------------- Heuristic User (End) ----------+ \n"); - printf("+----------------------------------------------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); + ws_debug_printf("+-------------- Heuristic User (End) ----------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); break; case cd_complete_request_list: - printf("+----------------------------------------------+ \n"); - printf("+------------- Complete Request List (Begin) --+ \n"); - printf("+----------------------------------------------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); + ws_debug_printf("+------------- Complete Request List (Begin) --+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); display_complete_request_list(); - printf("+----------------------------------------------+ \n"); - printf("+------------ Complete Request List (End) -----+ \n"); - printf("+----------------------------------------------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); + ws_debug_printf("+------------ Complete Request List (End) -----+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); break; case cd_module_hash: - printf("+----------------------------------------------+ \n"); - printf("+-------------- Module (Begin) ----------------+ \n"); - printf("+----------------------------------------------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); + ws_debug_printf("+-------------- Module (Begin) ----------------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); g_hash_table_foreach(giop_module_hash, display_module_hash, NULL); - printf("+----------------------------------------------+ \n"); - printf("+-------------- Module ( End) -----------------+ \n"); - printf("+----------------------------------------------+ \n\n"); + ws_debug_printf("+----------------------------------------------+ \n"); + ws_debug_printf("+-------------- Module ( End) -----------------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n\n"); break; case cd_objkey_hash: - printf("+----------------------------------------------+ \n"); - printf("+-------------- Objkey (Begin) ----------------+ \n"); - printf("+----------------------------------------------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); + ws_debug_printf("+-------------- Objkey (Begin) ----------------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); g_hash_table_foreach(giop_objkey_hash, display_objkey_hash, NULL); - printf("+----------------------------------------------+ \n"); - printf("+-------------- Objkey (End) ------------------+ \n"); - printf("+----------------------------------------------+ \n\n"); + ws_debug_printf("+----------------------------------------------+ \n"); + ws_debug_printf("+-------------- Objkey (End) ------------------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n\n"); break; case cd_complete_reply_hash: - printf("+----------------------------------------------+ \n"); - printf("+-------------- Complete_Reply_Hash (Begin) ---+ \n"); - printf("+----------------------------------------------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); + ws_debug_printf("+-------------- Complete_Reply_Hash (Begin) ---+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); g_hash_table_foreach(giop_complete_reply_hash, display_complete_reply_hash, NULL); - printf("+----------------------------------------------+ \n"); - printf("+------------- Complete_Reply_Hash (End) ------+ \n"); - printf("+----------------------------------------------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); + ws_debug_printf("+------------- Complete_Reply_Hash (End) ------+ \n"); + ws_debug_printf("+----------------------------------------------+ \n"); break; default: - printf("giop: giop_dump_collection: Unknown type \n"); + ws_debug_printf("giop: giop_dump_collection: Unknown type \n"); } @@ -2035,7 +2036,7 @@ static gboolean try_explicit_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, p if (tvb_offset_exists(tvb, *offset)) { #if DEBUG - printf("giop:try_explicit_dissector calling sub = %s with module = (%s) \n", subdiss->sub_name , modname); + ws_debug_printf("giop:try_explicit_dissector calling sub = %s with module = (%s) \n", subdiss->sub_name , modname); #endif if (proto_is_protocol_enabled(subdiss->sub_proto)) { @@ -2948,7 +2949,7 @@ void get_CDR_fixed(tvbuff_t *tvb, packet_info *pinfo, proto_item *item, gchar ** */ #if DEBUG - printf("giop:get_CDR_fixed() called , digits = %u, scale = %u \n", digits, scale); + ws_debug_printf("giop:get_CDR_fixed() called , digits = %u, scale = %u \n", digits, scale); #endif if (scale <0) { @@ -2958,7 +2959,7 @@ void get_CDR_fixed(tvbuff_t *tvb, packet_info *pinfo, proto_item *item, gchar ** } #if DEBUG - printf("giop:get_CDR_fixed(): slen = %.2x \n", slen); + ws_debug_printf("giop:get_CDR_fixed(): slen = %.2x \n", slen); #endif tmpbuf = (gchar *)wmem_alloc0(wmem_packet_scope(), slen); /* allocate temp buffer */ @@ -2968,7 +2969,7 @@ void get_CDR_fixed(tvbuff_t *tvb, packet_info *pinfo, proto_item *item, gchar ** if (!(digits & 0x01)) { tval = get_CDR_octet(tvb, offset); #if DEBUG - printf("giop:get_CDR_fixed():even: octet = %.2x \n", tval); + ws_debug_printf("giop:get_CDR_fixed():even: octet = %.2x \n", tval); #endif tmpbuf[sindex] = (tval & 0x0f) + 0x30; /* convert top nibble to ascii */ sindex++; @@ -2983,7 +2984,7 @@ void get_CDR_fixed(tvbuff_t *tvb, packet_info *pinfo, proto_item *item, gchar ** for (i=0; i< ((digits-1)/2 ); i++) { tval = get_CDR_octet(tvb, offset); #if DEBUG - printf("giop:get_CDR_fixed():odd: octet = %.2x \n", tval); + v("giop:get_CDR_fixed():odd: octet = %.2x \n", tval); #endif tmpbuf[sindex] = ((tval & 0xf0) >> 4) + 0x30; /* convert top nibble to ascii */ @@ -2995,7 +2996,7 @@ void get_CDR_fixed(tvbuff_t *tvb, packet_info *pinfo, proto_item *item, gchar ** } /* digits > 3 */ #if DEBUG - printf("giop:get_CDR_fixed(): before last digit \n"); + ws_debug_printf("giop:get_CDR_fixed(): before last digit \n"); #endif @@ -3003,7 +3004,7 @@ void get_CDR_fixed(tvbuff_t *tvb, packet_info *pinfo, proto_item *item, gchar ** tval = get_CDR_octet(tvb, offset); #if DEBUG - printf("giop:get_CDR_fixed(): octet = %.2x \n", tval); + ws_debug_printf("giop:get_CDR_fixed(): octet = %.2x \n", tval); #endif tmpbuf[sindex] = (( tval & 0xf0)>> 4) + 0x30; /* convert top nibble to ascii */ sindex++; @@ -3019,7 +3020,7 @@ void get_CDR_fixed(tvbuff_t *tvb, packet_info *pinfo, proto_item *item, gchar ** *seq = wmem_alloc0_array(wmem_packet_scope(), gchar, slen + 3); /* allocate temp buffer , including space for sign, decimal point and * \0 -- TODO check slen is reasonable first */ #if DEBUG - printf("giop:get_CDR_fixed(): sign = %.2x \n", sign); + ws_debug_printf("giop:get_CDR_fixed(): sign = %.2x \n", sign); #endif switch (sign) { @@ -3076,7 +3077,7 @@ void get_CDR_fixed(tvbuff_t *tvb, packet_info *pinfo, proto_item *item, gchar ** } #if DEBUG - printf("giop:get_CDR_fixed(): value = %s \n", *seq); + ws_debug_printf("giop:get_CDR_fixed(): value = %s \n", *seq); #endif return; diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c index 5054f90126..bf40af19c3 100644 --- a/epan/dissectors/packet-tacacs.c +++ b/epan/dissectors/packet-tacacs.c @@ -39,6 +39,7 @@ #include <epan/expert.h> #include <epan/addr_resolv.h> #include <wsutil/md5.h> +#include <wsutil/ws_printf.h> /* ws_debug_printf */ #include "packet-tacacs.h" @@ -749,9 +750,9 @@ tacplus_print_key_entry( gpointer data, gpointer user_data ) s_str = address_to_str( NULL, tacplus_data->s ); c_str = address_to_str( NULL, tacplus_data->c ); if( user_data ) { - printf("%s:%s=%s\n", s_str, c_str, tacplus_data->k ); + ws_debug_printf("%s:%s=%s\n", s_str, c_str, tacplus_data->k ); } else { - printf("%s:%s\n", s_str, c_str ); + ws_debug_printf("%s:%s\n", s_str, c_str ); } wmem_free(NULL, s_str); wmem_free(NULL, c_str); @@ -764,9 +765,9 @@ cmp_conv_address( gconstpointer p1, gconstpointer p2 ) const tacplus_key_entry *a2=(const tacplus_key_entry *)p2; gint32 ret; /* - printf("p1=>"); + ws_debug_printf("p1=>"); tacplus_print_key_entry( p1, NULL ); - printf("p2=>"); + ws_debug_printf("p2=>"); tacplus_print_key_entry( p2, NULL ); */ ret=cmp_address( a1->s, a2->s ); @@ -774,9 +775,9 @@ cmp_conv_address( gconstpointer p1, gconstpointer p2 ) ret=cmp_address( a1->c, a2->c ); /* if(ret) - printf("No Client found!"); */ + ws_debug_printf("No Client found!"); */ } else { - /* printf("No Server found!"); */ + /* ws_debug_printf("No Server found!"); */ } return ret; } @@ -789,10 +790,10 @@ find_key( address *srv, address *cln ) data.s=srv; data.c=cln; -/* printf("Looking for: "); +/* ws_debug_printf("Looking for: "); tacplus_print_key_entry( (gconstpointer)&data, NULL ); */ match=g_slist_find_custom( tacplus_keys, (gpointer)&data, cmp_conv_address ); -/* printf("Finished (%p)\n", match); */ +/* ws_debug_printf("Finished (%p)\n", match); */ if( match ) return ((tacplus_key_entry*)match->data)->k; @@ -819,7 +820,7 @@ parse_tuple( char *key_from_option ) char *client,*key; tacplus_key_entry *tacplus_data=(tacplus_key_entry *)g_malloc( sizeof(tacplus_key_entry) ); /* - printf("keys: %s\n", key_from_option ); + ws_debug_printf("keys: %s\n", key_from_option ); */ client=strchr(key_from_option,'/'); if(!client) { @@ -834,7 +835,7 @@ parse_tuple( char *key_from_option ) } *key++='\0'; /* - printf("%s %s => %s\n", key_from_option, client, key ); + ws_debug_printf("%s %s => %s\n", key_from_option, client, key ); */ mkipv4_address( &tacplus_data->s, key_from_option ); mkipv4_address( &tacplus_data->c, client ); diff --git a/epan/dissectors/packet-wtp.c b/epan/dissectors/packet-wtp.c index f35d861921..3d16a51c15 100644 --- a/epan/dissectors/packet-wtp.c +++ b/epan/dissectors/packet-wtp.c @@ -403,7 +403,7 @@ dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pdut = pdu_type(b0); #ifdef DEBUG - printf("WTP packet %u: tree = %p, pdu = %s (%u) length: %u\n", + proto_tree_add_debug_text(tree, "WTP packet %u: tree = %p, pdu = %s (%u) length: %u\n", pinfo->num, tree, val_to_str(pdut, vals_wtp_pdu_type, "Unknown PDU type 0x%x"), pdut, tvb_captured_length(tvb)); @@ -721,7 +721,7 @@ dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "Reassembled WTP", fd_wtp, &wtp_frag_items, NULL, wtp_tree); #ifdef DEBUG - printf("WTP: Packet %u %s -> %d: wsp_tvb = %p, fd_wtp = %p, frame = %u\n", + proto_tree_add_debug_text(tree, "WTP: Packet %u %s -> %d: wsp_tvb = %p, fd_wtp = %p, frame = %u\n", pinfo->num, fd_wtp ? "Reassembled" : "Not reassembled", fd_wtp ? fd_wtp->reassembled_in : -1, |