aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-04-03 02:57:48 +0000
committerTim Potter <tpot@samba.org>2003-04-03 02:57:48 +0000
commitefa0460d9c7a11560592e641d7aab62488d77b16 (patch)
treea5d1eabcd760fc909a77ee7ccc4178a75f7dfa4d
parentdd038966d7fb446dc2a3e10b0864deb48e6d851b (diff)
Add an extra argument to get_unicode_string() to optionally
pass back string data. Start adding some COL_INFO tidbits for NETLOGON PDC query and PDC query response. svn path=/trunk/; revision=7399
-rw-r--r--packet-smb-common.c9
-rw-r--r--packet-smb-common.h4
-rw-r--r--packet-smb-logon.c45
3 files changed, 41 insertions, 17 deletions
diff --git a/packet-smb-common.c b/packet-smb-common.c
index 6e1be15cc1..9c02b79c9f 100644
--- a/packet-smb-common.c
+++ b/packet-smb-common.c
@@ -2,7 +2,7 @@
* Common routines for smb packet dissection
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
*
- * $Id: packet-smb-common.c,v 1.15 2003/04/03 02:22:30 tpot Exp $
+ * $Id: packet-smb-common.c,v 1.16 2003/04/03 02:57:48 tpot Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -80,7 +80,7 @@ int display_ms_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index,
}
-int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index)
+int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index, char **data)
{
char *str, *p;
int len;
@@ -121,7 +121,10 @@ int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_i
proto_tree_add_string(tree, hf_index, tvb, offset, len, str);
- g_free(str);
+ if (data)
+ *data = str;
+ else
+ g_free(str);
return offset+len;
}
diff --git a/packet-smb-common.h b/packet-smb-common.h
index 1a23671f39..4fb27a3539 100644
--- a/packet-smb-common.h
+++ b/packet-smb-common.h
@@ -2,7 +2,7 @@
* Routines for SMB packet dissection
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
*
- * $Id: packet-smb-common.h,v 1.18 2003/04/03 02:22:30 tpot Exp $
+ * $Id: packet-smb-common.h,v 1.19 2003/04/03 02:57:48 tpot Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -45,7 +45,7 @@
int dissect_smb_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
-int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index);
+int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index, char **data);
int display_ms_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index, char **data);
diff --git a/packet-smb-logon.c b/packet-smb-logon.c
index 22bd679f56..9b7e606cfc 100644
--- a/packet-smb-logon.c
+++ b/packet-smb-logon.c
@@ -2,7 +2,7 @@
* Routines for SMB net logon packet dissection
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
*
- * $Id: packet-smb-logon.c,v 1.30 2003/04/03 02:22:30 tpot Exp $
+ * $Id: packet-smb-logon.c,v 1.31 2003/04/03 02:57:48 tpot Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -310,10 +310,18 @@ dissect_smb_logon_LM20_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t
static int
dissect_smb_pdc_query(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
+ char *name = NULL;
+
/*** 0x07 Query for Primary PDC ***/
/* computer name */
- offset = display_ms_string(tvb, tree, offset, hf_computer_name, NULL);
+ offset = display_ms_string(tvb, tree, offset, hf_computer_name, &name);
+
+ if (name && check_col(pinfo->cinfo, COL_INFO)) {
+ col_append_fstr(pinfo->cinfo, COL_INFO, " from %s", name);
+ g_free(name);
+ name = NULL;
+ }
/* mailslot name */
offset = display_ms_string(tvb, tree, offset, hf_mailslot_name, NULL);
@@ -331,7 +339,7 @@ dissect_smb_pdc_query(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, i
if (offset % 2) offset++; /* word align ... */
/* Unicode computer name */
- offset = display_unicode_string(tvb, tree, offset, hf_unicode_computer_name);
+ offset = display_unicode_string(tvb, tree, offset, hf_unicode_computer_name, NULL);
/* NT version */
proto_tree_add_item(tree, hf_nt_version, tvb, offset, 4, TRUE);
@@ -360,16 +368,29 @@ dissect_smb_pdc_startup(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
/* A short Announce will not have the rest */
if (tvb_reported_length_remaining(tvb, offset) != 0) {
+ char *name = NULL;
if (offset % 2) offset++; /* word align ... */
/* pdc name */
- offset = display_unicode_string(tvb, tree, offset, hf_unicode_pdc_name);
+ offset = display_unicode_string(tvb, tree, offset, hf_unicode_pdc_name, &name);
+
+ if (name && check_col(pinfo->cinfo, COL_INFO)) {
+ col_append_fstr(pinfo->cinfo, COL_INFO, ": host %s", name);
+ g_free(name);
+ name = NULL;
+ }
if (offset % 2) offset++;
/* domain name */
- offset = display_unicode_string(tvb, tree, offset, hf_domain_name);
+ offset = display_unicode_string(tvb, tree, offset, hf_domain_name, &name);
+
+ if (name && check_col(pinfo->cinfo, COL_INFO)) {
+ col_append_fstr(pinfo->cinfo, COL_INFO, ", domain %s", name);
+ g_free(name);
+ name = NULL;
+ }
/* NT version */
proto_tree_add_item(tree, hf_nt_version, tvb, offset, 4, TRUE);
@@ -446,10 +467,10 @@ dissect_announce_change(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
* XXX - older protocol versions don't have this stuff?
*/
/* pdc name */
- offset = display_unicode_string(tvb, tree, offset, hf_unicode_pdc_name);
+ offset = display_unicode_string(tvb, tree, offset, hf_unicode_pdc_name, NULL);
/* domain name */
- offset = display_unicode_string(tvb, tree, offset, hf_domain_name);
+ offset = display_unicode_string(tvb, tree, offset, hf_domain_name, NULL);
/* DB count */
info_count = tvb_get_letohl(tvb, offset);
@@ -521,10 +542,10 @@ dissect_smb_sam_logon_req(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre
offset += 2;
/* computer name */
- offset = display_unicode_string(tvb, tree, offset, hf_unicode_computer_name);
+ offset = display_unicode_string(tvb, tree, offset, hf_unicode_computer_name, NULL);
/* user name */
- offset = display_unicode_string(tvb, tree, offset, hf_user_name);
+ offset = display_unicode_string(tvb, tree, offset, hf_user_name, NULL);
/* mailslot name */
offset = display_ms_string(tvb, tree, offset, hf_mailslot_name, NULL);
@@ -684,13 +705,13 @@ dissect_smb_sam_logon_resp(tvbuff_t *tvb, packet_info *pinfo _U_,
/* Netlogon command 0x13 - decode the SAM logon response from server */
/* server name */
- offset = display_unicode_string(tvb, tree, offset, hf_server_name);
+ offset = display_unicode_string(tvb, tree, offset, hf_server_name, NULL);
/* user name */
- offset = display_unicode_string(tvb, tree, offset, hf_user_name);
+ offset = display_unicode_string(tvb, tree, offset, hf_user_name, NULL);
/* domain name */
- offset = display_unicode_string(tvb, tree, offset, hf_domain_name);
+ offset = display_unicode_string(tvb, tree, offset, hf_domain_name, NULL);
/* NT version */
proto_tree_add_item(tree, hf_nt_version, tvb, offset, 4, TRUE);