diff options
-rw-r--r-- | packet-smb-mailslot.c | 4 | ||||
-rw-r--r-- | packet-smb-mailslot.h | 6 | ||||
-rw-r--r-- | packet-smb-pipe.c | 89 | ||||
-rw-r--r-- | packet-smb-pipe.h | 6 | ||||
-rw-r--r-- | packet-smb.c | 521 | ||||
-rw-r--r-- | smb.h | 9 |
6 files changed, 325 insertions, 310 deletions
diff --git a/packet-smb-mailslot.c b/packet-smb-mailslot.c index 2095610c8e..dfc48f546b 100644 --- a/packet-smb-mailslot.c +++ b/packet-smb-mailslot.c @@ -2,7 +2,7 @@ * Routines for SMB mailslot packet dissection * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> * - * $Id: packet-smb-mailslot.c,v 1.14 2001/08/01 03:47:00 guy Exp $ + * $Id: packet-smb-mailslot.c,v 1.15 2001/08/05 00:16:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -39,7 +39,7 @@ static int ett_smb_msp = -1; gboolean dissect_mailslot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, - int SMB_offset, int errcode, int dirn, const u_char *command, + int SMB_offset, int errcode, const u_char *command, int DataOffset, int DataCount, int ParameterOffset, int ParameterCount){ diff --git a/packet-smb-mailslot.h b/packet-smb-mailslot.h index e22dd17405..ce46adb408 100644 --- a/packet-smb-mailslot.h +++ b/packet-smb-mailslot.h @@ -2,10 +2,10 @@ * Declaration of routines for SMB mailslot packet dissection * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> * - * $Id: packet-smb-mailslot.h,v 1.1 2001/03/18 03:23:30 guy Exp $ + * $Id: packet-smb-mailslot.h,v 1.2 2001/08/05 00:16:36 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or @@ -26,5 +26,5 @@ gboolean dissect_mailslot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, - int SMB_offset, int errcode, int dirn, const u_char *command, + int SMB_offset, int errcode, const u_char *command, int DataOffset, int DataCount, int ParameterOffset, int ParameterCount); diff --git a/packet-smb-pipe.c b/packet-smb-pipe.c index c9c7f4d1fc..73cda9f84b 100644 --- a/packet-smb-pipe.c +++ b/packet-smb-pipe.c @@ -2,7 +2,7 @@ * Routines for SMB named pipe packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-smb-pipe.c,v 1.22 2001/08/01 03:51:16 guy Exp $ + * $Id: packet-smb-pipe.c,v 1.23 2001/08/05 00:16:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -288,7 +288,7 @@ static int get_byte_count(const u_char *p_data) /* We display the parameters first, then the data, then any auxilliary data */ static int -dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) +dissect_transact_next(const u_char *pd, char *Name, gboolean request, proto_tree *tree) { /* guint8 BParam; */ guint16 WParam = 0; @@ -308,7 +308,7 @@ dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) case 'r': - if (dirn == 0) { /* We need to process the data ... */ + if (!request) { /* We need to process the data ... */ need_data = 1; @@ -318,7 +318,7 @@ dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) case 'h': /* A WORD parameter received */ - if (dirn == 0) { + if (!request) { WParam = GSHORT(pd, pd_p_current); @@ -336,7 +336,7 @@ dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) case 'e': /* An ent count .. */ - if (dirn == 0) { /* Only relevant in a response */ + if (!request) { /* Only relevant in a response */ WParam = GSHORT(pd, pd_p_current); @@ -354,7 +354,7 @@ dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) case 'W': /* Word Parameter */ - if (dirn == 1) { /* A request ... */ + if (request) { /* A request ... */ /* Insert a word param */ @@ -372,7 +372,7 @@ dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) case 'i': /* A long word is returned */ - if (dirn == 0) { + if (!request) { LParam = GWORD(pd, pd_p_current); @@ -388,7 +388,7 @@ dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) case 'D': /* Double Word parameter */ - if (dirn == 1) { + if (request) { LParam = GWORD(pd, pd_p_current); @@ -404,7 +404,7 @@ dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) case 'g': /* A byte or series of bytes is returned */ - if (dirn == 0) { + if (!request) { bc = get_byte_count(p_desc + p_offset); @@ -420,7 +420,7 @@ dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) case 'b': /* A byte or series of bytes */ - if (dirn == 1) { + if (request) { bc = get_byte_count(p_desc + p_offset); /* This is not clean */ @@ -438,7 +438,7 @@ dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) case 'O': /* A null pointer */ - if (dirn == 1) { + if (request) { proto_tree_add_text(tree, NullTVB, pd_p_current, 0, "%s: Null Pointer", (Name) ? Name : "Unknown"); @@ -450,7 +450,7 @@ dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) case 'z': /* An AsciiZ string */ - if (dirn == 1) { + if (request) { AsciiZ = pd + pd_p_current; @@ -466,7 +466,7 @@ dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) case 'F': /* One or more pad bytes */ - if (dirn == 1) { + if (request) { bc = get_byte_count(pd); @@ -482,7 +482,7 @@ dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) case 'L': /* Receive buffer len: Short */ - if (dirn == 1) { + if (request) { WParam = GSHORT(pd, pd_p_current); @@ -498,7 +498,7 @@ dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) case 's': /* Send buf ... */ - if (dirn == 1) { + if (request) { need_data = 1; @@ -516,7 +516,7 @@ dissect_transact_next(const u_char *pd, char *Name, int dirn, proto_tree *tree) case 'T': - if (dirn == 1) { + if (request) { WParam = GSHORT(pd, pd_p_current); @@ -570,11 +570,12 @@ static GMemChunk *lanman_proto_data; static gboolean dissect_pipe_lanman(const u_char *pd, int offset, frame_data *fd, - proto_tree *parent, proto_tree *tree, struct smb_info si, - int max_data, int SMB_offset, int errcode, int dirn, + proto_tree *parent, proto_tree *tree, + int max_data, int SMB_offset, int errcode, const u_char *command, int DataOffset, int DataCount, int ParameterOffset, int ParameterCount) { + struct smb_info *smb_info = pi.private; gboolean is_interim_response; guint32 loc_offset; guint16 FunctionCode; @@ -608,11 +609,11 @@ dissect_pipe_lanman(const u_char *pd, int offset, frame_data *fd, if (check_col(fd, COL_PROTOCOL)) col_set_str(fd, COL_PROTOCOL, "LANMAN"); - if (dirn == 1) { /* The request side */ + if (smb_info->request) { /* The request side */ FunctionCode = GSHORT(pd, loc_offset); - si.request_val -> last_lanman_cmd = FunctionCode; + smb_info->request_val -> last_lanman_cmd = FunctionCode; lanman = find_lanman(FunctionCode); @@ -646,13 +647,13 @@ dissect_pipe_lanman(const u_char *pd, int offset, frame_data *fd, /* Now, save these for later */ - si.request_val -> trans_response_seen = 0; + smb_info->request_val -> trans_response_seen = 0; - if (si.request_val -> last_param_descrip) - g_free(si.request_val -> last_param_descrip); - si.request_val -> last_param_descrip = g_malloc(strlen(ParameterDescriptor) + 1); - if (si.request_val -> last_param_descrip) - strcpy(si.request_val -> last_param_descrip, ParameterDescriptor); + if (smb_info->request_val -> last_param_descrip) + g_free(smb_info->request_val -> last_param_descrip); + smb_info->request_val -> last_param_descrip = g_malloc(strlen(ParameterDescriptor) + 1); + if (smb_info->request_val -> last_param_descrip) + strcpy(smb_info->request_val -> last_param_descrip, ParameterDescriptor); if (tree) { @@ -664,11 +665,11 @@ dissect_pipe_lanman(const u_char *pd, int offset, frame_data *fd, ReturnDescriptor = pd + loc_offset; - if (si.request_val -> last_data_descrip) - g_free(si.request_val -> last_data_descrip); - si.request_val -> last_data_descrip = g_malloc(strlen(ReturnDescriptor) + 1); - if (si.request_val -> last_data_descrip) - strcpy(si.request_val -> last_data_descrip, ReturnDescriptor); + if (smb_info->request_val -> last_data_descrip) + g_free(smb_info->request_val -> last_data_descrip); + smb_info->request_val -> last_data_descrip = g_malloc(strlen(ReturnDescriptor) + 1); + if (smb_info->request_val -> last_data_descrip) + strcpy(smb_info->request_val -> last_data_descrip, ReturnDescriptor); if (tree) { @@ -707,7 +708,7 @@ dissect_pipe_lanman(const u_char *pd, int offset, frame_data *fd, case NETSERVERENUM2: /* Process a NetServerEnum2 */ Level = GSHORT(pd, loc_offset); - si.request_val -> last_level = Level; + smb_info->request_val -> last_level = Level; if (tree) { @@ -753,7 +754,7 @@ dissect_pipe_lanman(const u_char *pd, int offset, frame_data *fd, if (lanman) name = lanman -> req[i]; /* Must be OK ... */ - while (dissect_transact_next(pd, name, dirn, lanman_tree)) + while (dissect_transact_next(pd, name, smb_info->request, lanman_tree)) if (name) name = lanman -> req[++i]; } @@ -761,7 +762,7 @@ dissect_pipe_lanman(const u_char *pd, int offset, frame_data *fd, } } - else { /* dirn == 0, response */ + else { /* response */ response_data *proto_data; guint16 Status; guint16 Convert; @@ -775,13 +776,13 @@ dissect_pipe_lanman(const u_char *pd, int offset, frame_data *fd, if (proto_data == NULL) { /* No. Allocate some, and set it up. */ proto_data = g_mem_chunk_alloc(lanman_proto_data); - proto_data->FunctionCode = si.request_val -> last_lanman_cmd; + proto_data->FunctionCode = smb_info->request_val -> last_lanman_cmd; /* * If we've already seen a response to the request, this must * be a continuation of that response. */ - proto_data->is_continuation = si.request_val -> trans_response_seen; + proto_data->is_continuation = smb_info->request_val -> trans_response_seen; /* * Attach it to the frame. @@ -815,7 +816,7 @@ dissect_pipe_lanman(const u_char *pd, int offset, frame_data *fd, } - si.request_val -> trans_response_seen = 1; + smb_info->request_val -> trans_response_seen = 1; lanman = find_lanman(FunctionCode); @@ -1027,7 +1028,7 @@ dissect_pipe_lanman(const u_char *pd, int offset, frame_data *fd, if (tree) { ti = proto_tree_add_text(server_tree, NullTVB, loc_offset, - (si.request_val -> last_level) ? 26 : 16, + (smb_info->request_val -> last_level) ? 26 : 16, "Server %s", Server); server = proto_item_add_subtree(ti, ett_lanman_server); @@ -1042,7 +1043,7 @@ dissect_pipe_lanman(const u_char *pd, int offset, frame_data *fd, loc_offset += 16; - if (si.request_val -> last_level) { /* Print out the rest of the info */ + if (smb_info->request_val -> last_level) { /* Print out the rest of the info */ ServerMajor = GBYTE(pd, loc_offset); @@ -1125,11 +1126,11 @@ dissect_pipe_lanman(const u_char *pd, int offset, frame_data *fd, int i = 0; char *name = NULL; - dissect_transact_engine_init(pd, si.request_val -> last_param_descrip, si.request_val -> last_data_descrip, SMB_offset, loc_offset, ParameterCount, DataOffset, DataCount); + dissect_transact_engine_init(pd, smb_info->request_val -> last_param_descrip, smb_info->request_val -> last_data_descrip, SMB_offset, loc_offset, ParameterCount, DataOffset, DataCount); if (lanman) name = lanman -> resp[i]; - while (dissect_transact_next(pd, name, dirn, lanman_tree)) + while (dissect_transact_next(pd, name, smb_info->request, lanman_tree)) if (name) name = lanman -> resp[++i]; } @@ -1146,7 +1147,7 @@ dissect_pipe_lanman(const u_char *pd, int offset, frame_data *fd, } gboolean -dissect_pipe_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn, const u_char *command, int DataOffset, int DataCount, int ParameterOffset, int ParameterCount) +dissect_pipe_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, int max_data, int SMB_offset, int errcode, const u_char *command, int DataOffset, int DataCount, int ParameterOffset, int ParameterCount) { if (!proto_is_protocol_enabled(proto_smb_lanman)) @@ -1155,8 +1156,8 @@ dissect_pipe_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *paren if (command != NULL && strcmp(command, "LANMAN") == 0) { /* Try to decode a LANMAN */ - return dissect_pipe_lanman(pd, offset, fd, parent, tree, si, max_data, - SMB_offset, errcode, dirn, command, DataOffset, + return dissect_pipe_lanman(pd, offset, fd, parent, tree, max_data, + SMB_offset, errcode, command, DataOffset, DataCount, ParameterOffset, ParameterCount); } diff --git a/packet-smb-pipe.h b/packet-smb-pipe.h index 5cb8554447..a0717aaf5a 100644 --- a/packet-smb-pipe.h +++ b/packet-smb-pipe.h @@ -2,7 +2,7 @@ * Declarations of routines for SMB named pipe packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-smb-pipe.h,v 1.2 2001/08/01 03:51:16 guy Exp $ + * $Id: packet-smb-pipe.h,v 1.3 2001/08/05 00:16:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -25,6 +25,6 @@ gboolean dissect_pipe_smb(const u_char *pd, int offset, frame_data *fd, - proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, - int SMB_offset, int errcode, int dirn, const u_char *command, + proto_tree *parent, proto_tree *tree, int max_data, + int SMB_offset, int errcode, const u_char *command, int DataOffset, int DataCount, int ParameterOffset, int ParameterCount); diff --git a/packet-smb.c b/packet-smb.c index 9aeb94e04b..c56a35f237 100644 --- a/packet-smb.c +++ b/packet-smb.c @@ -2,7 +2,7 @@ * Routines for smb packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-smb.c,v 1.92 2001/08/04 10:17:24 guy Exp $ + * $Id: packet-smb.c,v 1.93 2001/08/05 00:16:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -189,7 +189,7 @@ smb_init_protocol(void) smb_packet_init_count * sizeof(struct smb_request_val), G_ALLOC_AND_FREE); } -void (*dissect[256])(const u_char *, int, frame_data *, proto_tree *, proto_tree *, struct smb_info si, int, int, int, int); +static void (*dissect[256])(const u_char *, int, frame_data *, proto_tree *, proto_tree *, struct smb_info si, int, int, int); static const value_string smb_cmd_vals[] = { { 0x00, "SMBcreatedirectory" }, @@ -711,7 +711,7 @@ char *SMB_names[256] = { }; void -dissect_unknown_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_unknown_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { if (tree) { @@ -845,14 +845,15 @@ unicode_to_str(const guint8 *us, int *us_lenp) { */ void -dissect_flush_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_flush_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; guint16 FID; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -890,9 +891,8 @@ dissect_flush_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree offset += 2; /* Skip Byte Count */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -923,7 +923,7 @@ dissect_flush_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree } void -dissect_get_disk_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_get_disk_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -934,7 +934,8 @@ dissect_get_disk_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tr guint16 BlocksPerUnit; guint16 BlockSize; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -960,9 +961,8 @@ dissect_get_disk_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tr offset += 2; /* Skip Byte Count (BCC) */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -1057,7 +1057,7 @@ dissect_get_disk_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tr } void -dissect_set_file_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_set_file_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { proto_tree *Attributes_tree; @@ -1075,7 +1075,8 @@ dissect_set_file_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tr guint16 Attributes; const char *FileName; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -1238,9 +1239,8 @@ dissect_set_file_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tr offset += strlen(FileName) + 1; /* Skip File Name */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -1271,7 +1271,7 @@ dissect_set_file_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tr } void -dissect_write_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_write_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -1283,7 +1283,8 @@ dissect_write_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree guint16 Count; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -1390,9 +1391,8 @@ dissect_write_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree } - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -1435,7 +1435,7 @@ dissect_write_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree } void -dissect_read_mpx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *arent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_read_mpx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *arent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -1453,7 +1453,8 @@ dissect_read_mpx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *a guint16 Count; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -1551,9 +1552,8 @@ dissect_read_mpx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *a offset += 2; /* Skip Byte Count (BCC) */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count */ @@ -1684,7 +1684,7 @@ dissect_read_mpx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *a } void -dissect_delete_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *paernt, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_delete_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *paernt, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -1693,7 +1693,8 @@ dissect_delete_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree guint16 ByteCount; const char *FileName; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -1754,9 +1755,8 @@ dissect_delete_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree offset += strlen(FileName) + 1; /* Skip File Name */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -1787,7 +1787,7 @@ dissect_delete_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree } void -dissect_query_info2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_query_info2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { proto_tree *Attributes_tree; @@ -1805,7 +1805,8 @@ dissect_query_info2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree guint16 ByteCount; guint16 Attributes; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -1843,9 +1844,8 @@ dissect_query_info2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree offset += 2; /* Skip Byte Count */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -2001,7 +2001,7 @@ dissect_query_info2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree } void -dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -2015,7 +2015,8 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *pa const char *Service; const char *Password; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -2113,9 +2114,8 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *pa offset += strlen(Service) + 1; /* Skip Service */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -2173,7 +2173,7 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *pa /* Generated by build-dissect.pl Vesion 0.6 27-Jun-1999, ACT */ void -dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { proto_tree *Capabilities_tree; @@ -2202,7 +2202,8 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree const char *AccountName; const char *ANSIPassword; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ WordCount = GBYTE(pd, offset); @@ -2687,13 +2688,12 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (AndXCommand != 0xFF) { - (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn); + (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode); } - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -2817,7 +2817,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (AndXCommand != 0xFF) { - (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn); + (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode); } @@ -2826,7 +2826,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree } void -dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 wct, andxcmd = 0xFF; @@ -2841,8 +2841,8 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * * words ... */ - if (!((dirn == 1) && (wct == 4)) && !((dirn == 0) && (wct == 2)) && - !((dirn == 0) && (wct == 3)) && !(wct == 0)) { + if (!(si.request && (wct == 4)) && !(!si.request && (wct == 2)) && + !(!si.request && (wct == 3)) && !(wct == 0)) { if (tree) { @@ -3051,12 +3051,12 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (andxcmd != 0xFF) /* Process that next command ... ??? */ - (dissect[andxcmd])(pd, SMB_offset + andxoffs, fd, parent, tree, si, max_data - offset, SMB_offset, errcode, dirn); + (dissect[andxcmd])(pd, SMB_offset + andxoffs, fd, parent, tree, si, max_data - offset, SMB_offset, errcode); } void -dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 wct, enckeylen; guint16 bcc, mode, rawmode, dialect; @@ -3069,8 +3069,8 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *pa wct = pd[offset]; /* Should be 0, 1 or 13 or 17, I think */ - if (!((wct == 0) && (dirn == 1)) && !((wct == 1) && (dirn == 0)) && - !((wct == 13) && (dirn == 0)) && !((wct == 17) && (dirn == 0))) { + if (!((wct == 0) && si.request) && !((wct == 1) && !si.request) && + !((wct == 13) && !si.request) && !((wct == 17) && !si.request)) { if (tree) { proto_tree_add_text(tree, NullTVB, offset, 1, "Invalid Negotiate Protocol format. WCT should be zero or 1 or 13 or 17 ..., not %u", wct); @@ -3087,7 +3087,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *pa } - if (dirn == 0 && errcode != 0) return; /* No more info ... */ + if (!si.request && errcode != 0) return; /* No more info ... */ offset += 1; @@ -3598,7 +3598,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *pa } void -dissect_deletedir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_deletedir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -3606,7 +3606,8 @@ dissect_deletedir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * guint16 ByteCount; const char *DirectoryName; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -3656,9 +3657,8 @@ dissect_deletedir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * offset += strlen(DirectoryName) + 1; /* Skip Directory Name */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -3689,7 +3689,7 @@ dissect_deletedir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * } void -dissect_createdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_createdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -3697,7 +3697,8 @@ dissect_createdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * guint16 ByteCount; const char *DirectoryName; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -3747,9 +3748,8 @@ dissect_createdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * offset += strlen(DirectoryName) + 1; /* Skip Directory Name */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -3781,7 +3781,7 @@ dissect_createdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * void -dissect_checkdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_checkdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -3789,7 +3789,8 @@ dissect_checkdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p guint16 ByteCount; const char *DirectoryName; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -3839,9 +3840,8 @@ dissect_checkdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p offset += strlen(DirectoryName) + 1; /* Skip Directory Name */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -3872,7 +3872,7 @@ dissect_checkdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p } void -dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { static const value_string OpenFunction_0x10[] = { @@ -3974,7 +3974,8 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * guint16 Action; const char *FileName; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -4221,13 +4222,12 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (AndXCommand != 0xFF) { - (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn); + (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode); } - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -4450,7 +4450,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (AndXCommand != 0xFF) { - (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn); + (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode); } @@ -4459,7 +4459,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * } void -dissect_write_raw_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_write_raw_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { proto_tree *WriteMode_tree; @@ -4478,7 +4478,8 @@ dissect_write_raw_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * guint16 Count; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ WordCount = GBYTE(pd, offset); @@ -4780,9 +4781,8 @@ dissect_write_raw_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * } - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -4829,13 +4829,14 @@ dissect_write_raw_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * } void -dissect_tdis_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_tdis_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -4861,9 +4862,8 @@ dissect_tdis_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *paren offset += 2; /* Skip Byte Count (BCC) */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -4894,7 +4894,7 @@ dissect_tdis_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *paren } void -dissect_move_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_move_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { static const value_string Flags_0x03[] = { @@ -4916,7 +4916,8 @@ dissect_move_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *paren guint16 ByteCount; const char *ErrorFileName; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -4965,13 +4966,12 @@ dissect_move_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *paren proto_tree_add_text(Flags_tree, NullTVB, offset, 2, "%s", decode_enumerated_bitfield(Flags, 0x03, 16, Flags_0x03, "%s")); -} + } offset += 2; /* Skip Flags */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -5042,7 +5042,7 @@ dissect_move_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *paren } void -dissect_rename_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_rename_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -5053,7 +5053,8 @@ dissect_rename_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree const char *OldFileName; const char *NewFileName; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -5139,9 +5140,8 @@ dissect_rename_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree offset += strlen(NewFileName) + 1; /* Skip New File Name */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -5172,14 +5172,14 @@ dissect_rename_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree } void -dissect_open_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_open_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { static const value_string Mode_0x03[] = { { 0, "Text mode (DOS expands TABs)"}, { 1, "Graphics mode"}, { 0, NULL} -}; + }; proto_tree *Mode_tree; proto_item *ti; guint8 WordCount; @@ -5190,7 +5190,8 @@ dissect_open_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto_ guint16 ByteCount; const char *IdentifierString; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -5267,9 +5268,8 @@ dissect_open_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto_ offset += strlen(IdentifierString) + 1; /* Skip Identifier String */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -5312,14 +5312,15 @@ dissect_open_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto_ } void -dissect_close_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_close_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; guint16 FID; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -5357,9 +5358,8 @@ dissect_close_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto offset += 2; /* Skip Byte Count (BCC) */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count */ @@ -5390,7 +5390,7 @@ dissect_close_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto } void -dissect_read_raw_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_read_raw_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -5403,7 +5403,8 @@ dissect_read_raw_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p guint16 FID; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ WordCount = GBYTE(pd, offset); @@ -5623,16 +5624,15 @@ dissect_read_raw_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p } - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ } } void -dissect_read_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_read_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -5652,7 +5652,8 @@ dissect_read_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * guint32 OffsetHigh; int i; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -5804,13 +5805,12 @@ dissect_read_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (AndXCommand != 0xFF) { - (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn); + (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode); } - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -5960,7 +5960,7 @@ dissect_read_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (AndXCommand != 0xFF) { - (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn); + (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode); } @@ -5969,7 +5969,7 @@ dissect_read_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * } void -dissect_logoff_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_logoff_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -5978,7 +5978,8 @@ dissect_logoff_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree guint16 ByteCount; guint16 AndXOffset = 0; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -6043,13 +6044,12 @@ dissect_logoff_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (AndXCommand != 0xFF) { - (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn); + (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode); } - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -6114,7 +6114,7 @@ dissect_logoff_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (AndXCommand != 0xFF) { - (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn); + (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode); } @@ -6123,7 +6123,7 @@ dissect_logoff_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree } void -dissect_seek_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_seek_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { static const value_string Mode_0x03[] = { @@ -6131,7 +6131,7 @@ dissect_seek_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * { 1, "Seek from current position"}, { 2, "Seek from end of file"}, { 0, NULL} -}; + }; proto_tree *Mode_tree; proto_item *ti; guint8 WordCount; @@ -6140,7 +6140,8 @@ dissect_seek_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * guint16 FID; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -6205,9 +6206,8 @@ dissect_seek_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * offset += 2; /* Skip Byte Count (BCC) */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -6250,7 +6250,7 @@ dissect_seek_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * } void -dissect_write_and_unlock_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_write_and_unlock_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -6262,7 +6262,8 @@ dissect_write_and_unlock_smb(const u_char *pd, int offset, frame_data *fd, proto guint16 Count; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -6360,9 +6361,8 @@ dissect_write_and_unlock_smb(const u_char *pd, int offset, frame_data *fd, proto offset += 2; /* Skip Data Length */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -6405,7 +6405,7 @@ dissect_write_and_unlock_smb(const u_char *pd, int offset, frame_data *fd, proto } void -dissect_set_info2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_set_info2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -6418,7 +6418,8 @@ dissect_set_info2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * guint16 CreationDate; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count */ @@ -6528,9 +6529,8 @@ dissect_set_info2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * offset += 2; /* Skip Byte Count (BCC) */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCC) */ @@ -6561,7 +6561,7 @@ dissect_set_info2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * } void -dissect_lock_bytes_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_lock_bytes_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -6570,7 +6570,8 @@ dissect_lock_bytes_smb(const u_char *pd, int offset, frame_data *fd, proto_tree guint16 FID; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -6632,9 +6633,8 @@ dissect_lock_bytes_smb(const u_char *pd, int offset, frame_data *fd, proto_tree offset += 2; /* Skip Byte Count (BCC) */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -6665,7 +6665,7 @@ dissect_lock_bytes_smb(const u_char *pd, int offset, frame_data *fd, proto_tree } void -dissect_get_print_queue_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_get_print_queue_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -6677,7 +6677,8 @@ dissect_get_print_queue_smb(const u_char *pd, int offset, frame_data *fd, proto_ guint16 Count; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count */ @@ -6727,9 +6728,8 @@ dissect_get_print_queue_smb(const u_char *pd, int offset, frame_data *fd, proto_ offset += 2; /* Skip Byte Count (BCC) */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -6812,7 +6812,7 @@ dissect_get_print_queue_smb(const u_char *pd, int offset, frame_data *fd, proto_ } void -dissect_locking_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_locking_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { proto_tree *LockType_tree; @@ -6830,7 +6830,8 @@ dissect_locking_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tre guint16 AndXoffset; guint16 AndXOffset = 0; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -6978,13 +6979,12 @@ dissect_locking_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tre if (AndXCommand != 0xFF) { - (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn); + (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode); } - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -7054,7 +7054,7 @@ dissect_locking_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tre if (AndXCommand != 0xFF) { - (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn); + (dissect[AndXCommand])(pd, SMB_offset + AndXOffset, fd, parent, tree, si, max_data, SMB_offset, errcode); } @@ -7063,7 +7063,7 @@ dissect_locking_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tre } void -dissect_unlock_bytes_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_unlock_bytes_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -7072,7 +7072,8 @@ dissect_unlock_bytes_smb(const u_char *pd, int offset, frame_data *fd, proto_tre guint16 FID; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -7134,9 +7135,8 @@ dissect_unlock_bytes_smb(const u_char *pd, int offset, frame_data *fd, proto_tre offset += 2; /* Skip Byte Count (BCC) */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -7167,7 +7167,7 @@ dissect_unlock_bytes_smb(const u_char *pd, int offset, frame_data *fd, proto_tre } void -dissect_create_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_create_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { proto_tree *Attributes_tree; @@ -7180,7 +7180,8 @@ dissect_create_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree guint16 Attributes; const char *FileName; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -7267,9 +7268,8 @@ dissect_create_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree offset += strlen(FileName) + 1; /* Skip File Name */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -7316,7 +7316,7 @@ dissect_create_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree } void -dissect_search_dir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_search_dir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -7331,7 +7331,8 @@ dissect_search_dir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree guint16 ByteCount; const char *FileName; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -7429,9 +7430,8 @@ dissect_search_dir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree offset += 2; /* Skip Resume Key Length */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -7502,7 +7502,7 @@ dissect_search_dir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree } void -dissect_create_temporary_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_create_temporary_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -7515,7 +7515,8 @@ dissect_create_temporary_file_smb(const u_char *pd, int offset, frame_data *fd, const char *FileName; const char *DirectoryName; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -7601,9 +7602,8 @@ dissect_create_temporary_file_smb(const u_char *pd, int offset, frame_data *fd, offset += strlen(DirectoryName) + 1; /* Skip Directory Name */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -7674,7 +7674,7 @@ dissect_create_temporary_file_smb(const u_char *pd, int offset, frame_data *fd, } void -dissect_close_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_close_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -7683,7 +7683,8 @@ dissect_close_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *pare guint16 FID; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -7745,9 +7746,8 @@ dissect_close_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *pare offset += 2; /* Skip Byte Count (BCC) */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -7778,7 +7778,7 @@ dissect_close_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *pare } void -dissect_write_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_write_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -7787,7 +7787,8 @@ dissect_write_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto guint16 DataLength; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -7849,9 +7850,8 @@ dissect_write_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto offset += 2; /* Skip Data Length */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -7882,7 +7882,7 @@ dissect_write_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto } void -dissect_lock_and_read_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_lock_and_read_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -7898,7 +7898,8 @@ dissect_lock_and_read_smb(const u_char *pd, int offset, frame_data *fd, proto_tr guint16 Count; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -7972,9 +7973,8 @@ dissect_lock_and_read_smb(const u_char *pd, int offset, frame_data *fd, proto_tr offset += 2; /* Skip Byte Count (BCC) */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -8093,13 +8093,14 @@ dissect_lock_and_read_smb(const u_char *pd, int offset, frame_data *fd, proto_tr } void -dissect_process_exit_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_process_exit_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -8125,9 +8126,8 @@ dissect_process_exit_smb(const u_char *pd, int offset, frame_data *fd, proto_tre offset += 2; /* Skip Byte Count (BCC) */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -8158,7 +8158,7 @@ dissect_process_exit_smb(const u_char *pd, int offset, frame_data *fd, proto_tre } void -dissect_get_file_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_get_file_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { proto_tree *Attributes_tree; @@ -8177,7 +8177,8 @@ dissect_get_file_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tr guint16 Attributes; const char *FileName; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -8227,9 +8228,8 @@ dissect_get_file_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tr offset += strlen(FileName) + 1; /* Skip File Name */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -8385,7 +8385,7 @@ dissect_get_file_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tr } void -dissect_read_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_read_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; @@ -8401,7 +8401,8 @@ dissect_read_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * guint16 ByteCount; guint16 BufferFormat; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -8475,9 +8476,8 @@ dissect_read_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * offset += 2; /* Skip Byte Count (BCC) */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -8596,7 +8596,7 @@ dissect_read_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * } void -dissect_write_mpx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_write_mpx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { proto_tree *WriteMode_tree; @@ -8614,7 +8614,8 @@ dissect_write_mpx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * guint16 Count; guint16 ByteCount; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -8755,9 +8756,8 @@ dissect_write_mpx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * offset += 1; /* Skip Pad */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -8804,14 +8804,15 @@ dissect_write_mpx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * } void -dissect_find_close2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_find_close2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { guint8 WordCount; guint8 ByteCount; guint16 FID; - if (dirn == 1) { /* Request(s) dissect code */ + if (si.request) { + /* Request(s) dissect code */ /* Build display for: Word Count (WTC) */ @@ -8849,9 +8850,8 @@ dissect_find_close2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree offset += 2; /* Skip Byte Count (BCC) */ - } - - if (dirn == 0) { /* Response(s) dissect code */ + } else { + /* Response(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -8902,7 +8902,7 @@ static const value_string trans2_cmd_vals[] = { }; void -dissect_transact2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) +dissect_transact2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode) { proto_tree *Flags_tree; @@ -8965,7 +8965,7 @@ dissect_transact2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * request_val = (struct smb_request_val *) g_hash_table_lookup(smb_request_hash, &request_key); - if (!request_val && dirn == 1) { /* Create one */ + if (!request_val && si.request) { /* Create one */ new_request_key = g_mem_chunk_alloc(smb_request_keys); new_request_key -> conversation = conversation->index; @@ -8984,7 +8984,7 @@ dissect_transact2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * si.request_val = request_val; /* Save this for later */ - if (dirn == 1) { + if (si.request) { /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -9575,7 +9575,7 @@ dissect_transact2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * static void dissect_transact_params(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, - int SMB_offset, int errcode, int dirn, int DataOffset, int DataCount, + int SMB_offset, int errcode, int DataOffset, int DataCount, int ParameterOffset, int ParameterCount, int SetupAreaOffset, int SetupCount, const char *TransactName) { @@ -9604,17 +9604,22 @@ dissect_transact_params(const u_char *pd, int offset, frame_data *fd, else trans_cmd = NULL; + /* + * Pass "si" to the subdissector. + */ + pi.private = &si; + if ((trans_cmd == NULL) || (((trans_type == NULL || strcmp(trans_type, "MAILSLOT") != 0) || !dissect_mailslot_smb(pd, SetupAreaOffset, fd, parent, tree, si, - max_data, SMB_offset, errcode, dirn, trans_cmd, + max_data, SMB_offset, errcode, trans_cmd, SMB_offset + DataOffset, DataCount, SMB_offset + ParameterOffset, ParameterCount)) && ((trans_type == NULL || strcmp(trans_type, "PIPE") != 0) || - !dissect_pipe_smb(pd, offset, fd, parent, tree, si, max_data, - SMB_offset, errcode, dirn, trans_cmd, DataOffset, + !dissect_pipe_smb(pd, offset, fd, parent, tree, max_data, + SMB_offset, errcode, trans_cmd, DataOffset, DataCount, ParameterOffset, ParameterCount)))) { - + if (ParameterCount > 0) { /* Build display for: Parameters */ @@ -9668,8 +9673,10 @@ dissect_transact_params(const u_char *pd, int offset, frame_data *fd, } void -dissect_transact_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn) - +dissect_transact_smb(const u_char *pd, int offset, frame_data *fd, + proto_tree *parent, proto_tree *tree, + struct smb_info si, int max_data, int SMB_offset, + int errcode) { proto_tree *Flags_tree; proto_item *ti; @@ -9728,7 +9735,7 @@ dissect_transact_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p request_val = (struct smb_request_val *) g_hash_table_lookup(smb_request_hash, &request_key); - if (!request_val && dirn == 1) { /* Create one */ + if (!request_val && si.request) { /* Create one */ new_request_key = g_mem_chunk_alloc(smb_request_keys); new_request_key -> conversation = conversation -> index; @@ -9736,6 +9743,7 @@ dissect_transact_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p new_request_key -> pid = si.pid; request_val = g_mem_chunk_alloc(smb_request_vals); + request_val -> last_transact2_command = -1; /* unknown */ request_val -> last_transact_command = NULL; request_val -> last_param_descrip = NULL; request_val -> last_data_descrip = NULL; @@ -9746,7 +9754,7 @@ dissect_transact_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p si.request_val = request_val; /* Save this for later */ - if (dirn == 1) { + if (si.request) { /* Request(s) dissect code */ /* Build display for: Word Count (WCT) */ @@ -10063,7 +10071,10 @@ dissect_transact_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p /* Let's see if we can decode this */ - dissect_transact_params(pd, offset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn, DataOffset, DataCount, ParameterOffset, ParameterCount, SetupAreaOffset, SetupCount, TransactName); + dissect_transact_params(pd, offset, fd, parent, tree, si, max_data, + SMB_offset, errcode, DataOffset, DataCount, + ParameterOffset, ParameterCount, + SetupAreaOffset, SetupCount, TransactName); } else { /* Response(s) dissect code */ @@ -10109,10 +10120,12 @@ dissect_transact_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p offset += 2; /* Skip Byte Count (BCC) */ /* Dissect the interim response by showing the type of request to - which it's a reply. */ - dissect_transact_params(pd, offset, fd, parent, tree, si, max_data, - SMB_offset, errcode, dirn, -1, -1, -1, -1, -1, -1, - (request_val != NULL) ? request_val -> last_transact_command : NULL); + which it's a reply, if we have that information. */ + if (request_val != NULL) { + dissect_transact_params(pd, offset, fd, parent, tree, si, max_data, + SMB_offset, errcode, -1, -1, -1, -1, -1, -1, + request_val -> last_transact_command); + } return; @@ -10307,12 +10320,13 @@ dissect_transact_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p } - dissect_transact_params(pd, offset, fd, parent, tree, si, max_data, - SMB_offset, errcode, dirn, DataOffset, DataCount, - ParameterOffset, ParameterCount, - SetupAreaOffset, SetupCount, - (request_val != NULL) ? - request_val -> last_transact_command : NULL); + if (request_val != NULL) { + dissect_transact_params(pd, offset, fd, parent, tree, si, max_data, + SMB_offset, errcode, DataOffset, DataCount, + ParameterOffset, ParameterCount, + SetupAreaOffset, SetupCount, + request_val -> last_transact_command); + } } @@ -10322,7 +10336,7 @@ dissect_transact_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p -void (*dissect[256])(const u_char *, int, frame_data *, proto_tree *, proto_tree *, struct smb_info, int, int, int, int) = { +static void (*dissect[256])(const u_char *, int, frame_data *, proto_tree *, proto_tree *, struct smb_info, int, int, int) = { dissect_createdir_smb, /* unknown SMB 0x00 */ dissect_deletedir_smb, /* unknown SMB 0x01 */ @@ -10748,7 +10762,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int OLD_CHECK_DISPLAY_AS_DATA(proto_smb, pd, offset, fd, tree); - si.unicode = 0; + si.unicode = FALSE; cmd = pd[offset + SMB_hdr_com_offset]; @@ -10850,6 +10864,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int /* Now for the flags: Bit 0 = 0 means cmd, 0 = 1 means resp */ flags = pd[offset]; + si.request = !(flags&0x80); if (tree) { @@ -10934,7 +10949,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int } - if (flags2 & 0x8000) si.unicode = 1; /* Mark them as Unicode */ + if (flags2 & 0x8000) si.unicode = TRUE; /* Mark them as Unicode */ offset += 2; @@ -11034,10 +11049,8 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int /* Now vector through the table to dissect them */ - (dissect[cmd])(pd, offset, fd, tree, smb_tree, si, max_data, SMB_offset, errcode, - ((flags & 0x80) == 0)); - - + (dissect[cmd])(pd, offset, fd, tree, smb_tree, si, max_data, + SMB_offset, errcode); } /*** External routines called during the registration process */ @@ -2,10 +2,10 @@ * Defines for smb packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: smb.h,v 1.8 2001/08/04 10:17:24 guy Exp $ + * $Id: smb.h,v 1.9 2001/08/05 00:16:36 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998, 1999 Gerald Combs * * This program is free software; you can redistribute it and/or @@ -638,10 +638,11 @@ struct smb_request_val { }; struct smb_info { - int tid, uid, mid, pid; /* Any more? */ + int tid, uid, mid, pid; /* Any more? */ conversation_t *conversation; struct smb_request_val *request_val; - int unicode; + gboolean unicode; /* Are strings in this SMB Unicode? */ + gboolean request; /* Is this a request? */ }; #endif |