summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-dcerpc-ndr.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2010-01-20 06:02:42 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2010-01-20 06:02:42 +0000
commit9a9f7acffe9ec17519b1ae0d73c8db24e202c62e (patch)
tree87b3d9f2724d257b357eb4c20ad90b9cff96887d /epan/dissectors/packet-dcerpc-ndr.c
parentf817636cc6c9ef0d0b7c988c9b94ffa2822152dd (diff)
downloadwireshark-9a9f7acffe9ec17519b1ae0d73c8db24e202c62e.tar.gz
From Julien Kerihuel, add support for
unaligned unmarshalling of dissectors generated by PIDL. This will allow us to use PIDL and additional IDLs from the samba project since they use "noalign" for certain protocols. This may also allow us to use PIDL to describe, and machinegenerate dissectors for normal, non-DCERPC, protocols. This patch for PIDL is still under review, but the PIDL patch is l;ikely to be committed soonish. svn path=/trunk/; revision=31583
Diffstat (limited to 'epan/dissectors/packet-dcerpc-ndr.c')
-rw-r--r--epan/dissectors/packet-dcerpc-ndr.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/epan/dissectors/packet-dcerpc-ndr.c b/epan/dissectors/packet-dcerpc-ndr.c
index e87b4d8737..6ef87bed4b 100644
--- a/epan/dissectors/packet-dcerpc-ndr.c
+++ b/epan/dissectors/packet-dcerpc-ndr.c
@@ -129,7 +129,7 @@ dissect_ndr_uint16 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
}
- if (offset % 2) {
+ if (!di->no_align && (offset % 2)) {
offset++;
}
return dissect_dcerpc_uint16 (tvb, offset, pinfo,
@@ -151,7 +151,7 @@ PIDL_dissect_uint16 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
}
- if (offset % 2) {
+ if (!di->no_align && (offset % 2)) {
offset++;
}
offset=dissect_dcerpc_uint16 (tvb, offset, pinfo,
@@ -207,7 +207,7 @@ dissect_ndr_uint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
}
- if (offset % 4) {
+ if (!di->no_align && (offset % 4)) {
offset += 4 - (offset % 4);
}
return dissect_dcerpc_uint32 (tvb, offset, pinfo,
@@ -277,7 +277,7 @@ PIDL_dissect_uint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
}
- if (offset % 4) {
+ if (!di->no_align && (offset % 4)) {
offset += 4 - (offset % 4);
}
offset=dissect_dcerpc_uint32 (tvb, offset, pinfo,
@@ -337,7 +337,7 @@ dissect_ndr_duint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
return offset;
}
- if (offset % 4) {
+ if (!di->no_align && (offset % 4)) {
offset += 4 - (offset % 4);
}
return dissect_dcerpc_uint64 (tvb, offset, pinfo,
@@ -360,7 +360,7 @@ dissect_ndr_uint64 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
return offset;
}
- if (offset % 8) {
+ if (!di->no_align && (offset % 8)) {
offset += 8 - (offset % 8);
}
return dissect_dcerpc_uint64 (tvb, offset, pinfo,
@@ -381,7 +381,7 @@ PIDL_dissect_uint64 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
return offset;
}
- if (offset % 8) {
+ if (!di->no_align && (offset % 8)) {
offset += 8 - (offset % 8);
}
offset=dissect_dcerpc_uint64 (tvb, offset, pinfo,
@@ -437,7 +437,7 @@ dissect_ndr_float(tvbuff_t *tvb, gint offset, packet_info *pinfo,
return offset;
}
- if (offset % 4) {
+ if (!di->no_align && (offset % 4)) {
offset += 4 - (offset % 4);
}
return dissect_dcerpc_float(tvb, offset, pinfo,
@@ -459,7 +459,7 @@ dissect_ndr_double(tvbuff_t *tvb, gint offset, packet_info *pinfo,
return offset;
}
- if (offset % 8) {
+ if (!di->no_align && (offset % 8)) {
offset += 8 - (offset % 8);
}
return dissect_dcerpc_double(tvb, offset, pinfo,
@@ -481,7 +481,7 @@ dissect_ndr_time_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
}
- if (offset % 4) {
+ if (!di->no_align && (offset % 4)) {
offset += 4 - (offset % 4);
}
return dissect_dcerpc_time_t (tvb, offset, pinfo,
@@ -502,7 +502,7 @@ dissect_ndr_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
}
/* uuid's are aligned to 4 bytes, due to initial uint32 in struct */
- if (offset % 4) {
+ if (!di->no_align && (offset % 4)) {
offset += 4 - (offset % 4);
}
return dissect_dcerpc_uuid_t (tvb, offset, pinfo,
@@ -532,7 +532,7 @@ dissect_ndr_ctx_hnd (tvbuff_t *tvb, gint offset, packet_info *pinfo,
return offset;
}
- if (offset % 4) {
+ if (!di->no_align && (offset % 2)) {
offset += 4 - (offset % 4);
}
ctx_hnd.attributes = dcerpc_tvb_get_ntohl (tvb, offset, drep);