return itl;
}
-static guint8
+static guint8
get_ndmp_protocol_version(ndmp_conv_data_t *ndmp_conv_data)
{
if(!ndmp_conv_data || (ndmp_conv_data->version==NDMP_PROTOCOL_UNKNOWN)){
err=tvb_get_ntohl(tvb, offset);
proto_tree_add_item(tree, hf_ndmp_error, tvb, offset, 4, FALSE);
if(err && check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(pinfo->cinfo, COL_INFO,
+ col_append_fstr(pinfo->cinfo, COL_INFO,
" NDMP Error:%s",
val_to_str(err, error_vals,
"Unknown NDMP error code %#x"));
}
-
+
offset += 4;
return offset;
proto_tree_add_uint(tree, hf_len, tvb, offset, 4, payload_len);
offset += 4;
- if (payload_len != 0) {
+ if ((int) payload_len > 0) {
tvbuff_t *data_tvb;
int tvb_len, tvb_rlen;
/* IP addr */
proto_tree_add_item(tree, hf_ndmp_addr_ip, tvb, offset, 4, FALSE);
offset+=4;
-
+
/* TCP port */
proto_tree_add_item(tree, hf_ndmp_addr_tcp, tvb, offset, 4, FALSE);
offset+=4;
top_tree=tree; /* scsi should open its expansions on the top level */
/*
- * We need to keep track of conversations so that we can track NDMP
+ * We need to keep track of conversations so that we can track NDMP
* versions.
*/
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
}
- hdr_item = proto_tree_add_text(ndmp_tree, tvb, 0, 4,
- "Fragment header: %s%u %s",
- (ndmp_rm & RPC_RM_LASTFRAG) ? "Last fragment, " : "",
+ hdr_item = proto_tree_add_text(ndmp_tree, tvb, 0, 4,
+ "Fragment header: %s%u %s",
+ (ndmp_rm & RPC_RM_LASTFRAG) ? "Last fragment, " : "",
ndmp_rm & RPC_RM_FRAGLEN, plurality(ndmp_rm & RPC_RM_FRAGLEN, "byte", "bytes"));
hdr_tree = proto_item_add_subtree(hdr_item, ett_ndmp_fraghdr);
proto_tree_add_boolean(hdr_tree, hf_ndmp_lastfrag, tvb, 0, 4, ndmp_rm);
"NDMP Header", "ndmp.header", FT_NONE, 0,
NULL, 0, "NDMP Header", HFILL }},
- { &hf_ndmp_response_frame, {
+ { &hf_ndmp_response_frame, {
"Response In", "ndmp.response_frame", FT_FRAMENUM, BASE_NONE,
NULL, 0, "The response to this NDMP command is in this frame", HFILL }},
{ "Time from request", "ndmp.time", FT_RELATIVE_TIME, BASE_NONE, NULL,
0, "Time since the request packet", HFILL }},
- { &hf_ndmp_request_frame, {
+ { &hf_ndmp_request_frame, {
"Request In", "ndmp.request_frame", FT_FRAMENUM, BASE_NONE,
NULL, 0, "The request to this NDMP command is in this frame", HFILL }},
static se_tree_t *nfs_name_snoop_known = NULL;
static se_tree_t *nfs_file_handles = NULL;
-/* This function will store one nfs filehandle in our global tree of
+/* This function will store one nfs filehandle in our global tree of
* filehandles.
* We store all filehandles we see in this tree so that every unique
* filehandle is only stored once with a unique pointer.
se_tree_insert32_array(nfs_file_handles, &fhkey[0], new_nfs_fh);
return new_nfs_fh;
-}
+}
static gint
nfs_name_snoop_matched_equal(gconstpointer k1, gconstpointer k2)
fhkey[1].length=fhlen/4;
fhkey[1].key=(guint32 *)tvb_get_ptr(tvb, fh_offset, fh_length);
fhkey[2].length=0;
-
+
nns=se_tree_lookup32_array(nfs_name_snoop_known, &fhkey[0]);
}
if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
rpc_call_info_value *civ=pinfo->private_data;
- /* NFS v3 LOOKUP, CREATE, MKDIR, READDIRPLUS
+ /* NFS v3 LOOKUP, CREATE, MKDIR, READDIRPLUS
calls might give us a mapping*/
if( (civ->prog==100003)
&&(civ->vers==3)
}
-/* RFC 1813, Page 22
- * The levels parameter tells this helper how many levels up in the tree it
+/* RFC 1813, Page 22
+ * The levels parameter tells this helper how many levels up in the tree it
* should display useful info such as type,mode,uid,gid
* If level has the COL_INFO_LEVEL flag set it will also display
* this info in the info column.
/* RFC 1813, Page 23 */
int
-dissect_nfs_post_op_attr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
+dissect_nfs_post_op_attr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
const char* name)
{
proto_item* post_op_attr_item = NULL;
len=tvb_get_ntohl(tvb, offset);
offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
-
+
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x Offset:%" PRIu64 " Len:%u", hash, off, len);
}
&&(!civ->request)
&&((civ->proc==17))
) {
- nfs_name_snoop_add_name(civ->xid, tvb, 0, 0,
- 0/*parent offset*/, 0/*parent len*/,
+ nfs_name_snoop_add_name(civ->xid, tvb, 0, 0,
+ 0/*parent offset*/, 0/*parent len*/,
name);
}
}
#define FATTR4_BITMAP_ONLY 0
#define FATTR4_FULL_DISSECT 1
+/* XXX - What's a good maximum? Linux appears to use 10.
+ * FreeBSD appears to use 2. OpenSolaris appears to use 2. */
+#define MAX_BITMAP_LEN 10
static int
dissect_nfs_attributes(tvbuff_t *tvb, int offset, packet_info *pinfo,
int attr_vals_offset;
bitmap_len = tvb_get_ntohl(tvb, offset);
+ if (bitmap_len > MAX_BITMAP_LEN) {
+ proto_tree_add_text(tree, tvb, offset, 4,
+ "Huge bitmap length: %u", bitmap_len);
+ THROW(ReportedBoundsError);
+ }
tvb_ensure_bytes_exist(tvb, offset, 4 + bitmap_len * 4);
fitem = proto_tree_add_text(tree, tvb, offset, 4 + bitmap_len * 4,
"%s", "attrmask");
proto_item *fitem = NULL;
delegation_type = tvb_get_ntohl(tvb, offset);
- fitem = proto_tree_add_uint(tree, hf_nfs_open_delegation_type4, tvb,
+ fitem = proto_tree_add_uint(tree, hf_nfs_open_delegation_type4, tvb,
offset+0, 4, delegation_type);
offset += 4;
if (opcode == NFS4_OP_ILLEGAL)
newftree = proto_item_add_subtree(fitem, ett_nfs_illegal4);
else
- newftree = proto_item_add_subtree(fitem,
+ newftree = proto_item_add_subtree(fitem,
*nfsv4_operation_ett[opcode - 3]);
if (newftree == NULL) break;
if (opcode == NFS4_OP_ILLEGAL)
newftree = proto_item_add_subtree(fitem, ett_nfs_illegal4);
else
- newftree = proto_item_add_subtree(fitem,
+ newftree = proto_item_add_subtree(fitem,
*nfsv4_operation_ett[opcode - 3]);
if (newftree == NULL)
/*
* With the exception of NFS4_OP_LOCK, NFS4_OP_LOCKT, and
* NFS4_OP_SETATTR, all other ops do *not* return data with the
- * failed status code.
+ * failed status code.
*/
if ((status != NFS4_OK) &&
((opcode != NFS4_OP_LOCK) && (opcode != NFS4_OP_LOCKT) &&
/* end of NFS Version 3 */
-/* the call to dissect_nfs3_null_call & dissect_nfs3_null_reply is
+/* the call to dissect_nfs3_null_call & dissect_nfs3_null_reply is
* intentional. The V4 NULLPROC is the same as V3.
*/
static const vsff nfs4_proc[] = {