aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2007-06-17 23:58:01 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2007-06-17 23:58:01 +0000
commitf74d20b1422fa74bee83c4bd6511cba78fc05183 (patch)
tree5039998cc6d85514e490f269a7c96f9e9ea5ab09 /epan/dissectors
parent0adc338017048a79b29705f85e55d1f60be6484a (diff)
track filenames between rename requests and responses to make it easier to
diagnose why a rename failed svn path=/trunk/; revision=22122
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-smb.c46
-rw-r--r--epan/dissectors/packet-smb.h9
2 files changed, 52 insertions, 3 deletions
diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c
index a5f399875d..646673027d 100644
--- a/epan/dissectors/packet-smb.c
+++ b/epan/dissectors/packet-smb.c
@@ -2494,6 +2494,35 @@ dissect_empty(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offse
}
static int
+dissect_rename_file_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, proto_tree *smb_tree _U_)
+{
+ guint8 wc;
+ guint16 bc;
+ smb_info_t *si = pinfo->private_data;
+ proto_item *item=NULL;
+
+ DISSECTOR_ASSERT(si);
+
+ if(si->sip && si->sip->extra_info_type==SMB_EI_RENAMEDATA){
+ smb_rename_saved_info_t *rni=si->sip->extra_info;
+
+ item=proto_tree_add_string(tree, hf_smb_old_file_name, tvb, 0, 0, rni->old_name);
+ PROTO_ITEM_SET_GENERATED(item);
+ item=proto_tree_add_string(tree, hf_smb_file_name, tvb, 0, 0, rni->new_name);
+ PROTO_ITEM_SET_GENERATED(item);
+ }
+
+
+ WORD_COUNT;
+
+ BYTE_COUNT;
+
+ END_OF_SMB
+
+ return offset;
+}
+
+static int
dissect_echo_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, proto_tree *smb_tree _U_)
{
guint16 ec, bc;
@@ -3697,9 +3726,10 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
{
smb_info_t *si = pinfo->private_data;
int fn_len;
- const char *fn;
+ const char *fn, *old_name=NULL, *new_name=NULL;
guint8 wc;
guint16 bc;
+ smb_rename_saved_info_t *rni=NULL;
DISSECTOR_ASSERT(si);
@@ -3720,6 +3750,7 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
FALSE, FALSE, &bc);
if (fn == NULL)
goto endofcommand;
+ old_name=fn;
proto_tree_add_string(tree, hf_smb_old_file_name, tvb, offset, fn_len,
fn);
COUNT_BYTES(fn_len);
@@ -3739,6 +3770,7 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
FALSE, FALSE, &bc);
if (fn == NULL)
goto endofcommand;
+ new_name=fn;
proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len,
fn);
COUNT_BYTES(fn_len);
@@ -3750,6 +3782,16 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
END_OF_SMB
+ /* save the offset/len for this transaction */
+ if(si->sip && !pinfo->fd->flags.visited){
+ rni=se_alloc(sizeof(smb_rename_saved_info_t));
+ rni->old_name=se_strdup(old_name);
+ rni->new_name=se_strdup(new_name);
+
+ si->sip->extra_info_type=SMB_EI_RENAMEDATA;
+ si->sip->extra_info=rni;
+ }
+
return offset;
}
@@ -15031,7 +15073,7 @@ static smb_function smb_dissector[256] = {
/* 0x04 Close File*/ {dissect_close_file_request, dissect_empty},
/* 0x05 Flush File*/ {dissect_flush_file_request, dissect_empty},
/* 0x06 Delete File*/ {dissect_delete_file_request, dissect_empty},
- /* 0x07 Rename File*/ {dissect_rename_file_request, dissect_empty},
+ /* 0x07 Rename File*/ {dissect_rename_file_request, dissect_rename_file_response},
/* 0x08 Query Info*/ {dissect_query_information_request, dissect_query_information_response},
/* 0x09 Set Info*/ {dissect_set_information_request, dissect_empty},
/* 0x0a Read File*/ {dissect_read_file_request, dissect_read_file_response},
diff --git a/epan/dissectors/packet-smb.h b/epan/dissectors/packet-smb.h
index b9b5aea788..d866713a8a 100644
--- a/epan/dissectors/packet-smb.h
+++ b/epan/dissectors/packet-smb.h
@@ -210,7 +210,8 @@ typedef enum {
SMB_EI_FILENAME, /* filename tracking */
SMB_EI_UID, /* smb_uid_t */
SMB_EI_RWINFO, /* read/write offset/count info */
- SMB_EI_LOCKDATA /* locking and x data */
+ SMB_EI_LOCKDATA, /* locking and x data */
+ SMB_EI_RENAMEDATA /* renaame data */
} smb_extra_info_t;
typedef struct _smb_fid_into_t smb_fid_info_t;
typedef struct {
@@ -301,6 +302,12 @@ extern int dissect_file_data(tvbuff_t *tvb, proto_tree *tree, int offset,
#define SMB_FID_TYPE_DIR 2
#define SMB_FID_TYPE_PIPE 3
+/* used for tracking filenames from rename request to response */
+typedef struct _smb_rename_saved_info_t {
+ char *old_name;
+ char *new_name;
+} smb_rename_saved_info_t;
+
/* used for tracking lock data between lock request/response */
typedef struct _smb_lock_info_t {
struct _smb_lock_info_t *next;