whois: add query string to info column.
authorDario Lombardo <lomato@gmail.com>
Sun, 22 Dec 2019 16:04:52 +0000 (17:04 +0100)
committerMichael Mann <mmann78@netscape.net>
Tue, 24 Dec 2019 13:44:03 +0000 (13:44 +0000)
Keep track of it in the conversation to reuse the string in the
answer as well.

Bug: 16291
Change-Id: I1be6efe4456867b9e33ba15ca06d039a6fb9fed0
Reviewed-on: https://code.wireshark.org/review/35551
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
epan/dissectors/packet-whois.c

index 61cfc3d5a2fd65df1929f82ae758c750473a7abc..e7153d0b880aec1989de8b08c815044b0a9e279a 100644 (file)
@@ -34,6 +34,7 @@ typedef struct _whois_transaction_t {
     guint32  req_frame;
     guint32  rep_frame;
     nstime_t req_time;
+    guint8*  query;
 } whois_transaction_t;
 
 static int
@@ -60,10 +61,19 @@ dissect_whois(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
     conversation = find_or_create_conversation(pinfo);
     whois_trans = (whois_transaction_t *)conversation_get_proto_data(conversation, proto_whois);
     if (whois_trans == NULL) {
+        gint newline;
         whois_trans = wmem_new0(wmem_file_scope(), whois_transaction_t);
+        newline = tvb_find_guint8(tvb, 0, -1, '\n');
+        if (newline != -1)
+            whois_trans->query = (guint8*)tvb_memdup(wmem_file_scope(), tvb, 0, newline);
         conversation_add_proto_data(conversation, proto_whois, whois_trans);
     }
 
+    if (whois_trans->query) {
+        col_append_str(pinfo->cinfo, COL_INFO, ": ");
+        col_append_str(pinfo->cinfo, COL_INFO, whois_trans->query);
+    }
+
     len = tvb_reported_length(tvb);
     if (!PINFO_FD_VISITED(pinfo)) {
         if (pinfo->can_desegment) {