dcerpc: fix tests to have a valid header

pull/5190/head
Shivani Bhardwaj 6 years ago
parent 9f9670ebdc
commit 2ce7d98af1

@ -1141,6 +1141,10 @@ mod tests {
#[test]
fn test_process_bind_pdu() {
let header: &[u8] = &[
0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
];
let bind: &[u8] = &[
0xd0, 0x16, 0xd0, 0x16, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x2c, 0xd0, 0x28, 0xda, 0x76, 0x91, 0xf6, 0x6e, 0xcb, 0x0f, 0xbf, 0x85,
@ -1221,11 +1225,16 @@ mod tests {
0x02, 0x00, 0x00, 0x00,
];
let mut dcerpc_state = DCERPCState::new();
assert_eq!(16, dcerpc_state.process_header(header));
assert_eq!(1068, dcerpc_state.process_bind_pdu(bind));
}
#[test]
fn test_handle_bindctxitem() {
let header: &[u8] = &[
0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
];
let bind: &[u8] = &[
0x00, 0x00, 0x01, 0x00, 0x2c, 0xd0, 0x28, 0xda, 0x76, 0x91, 0xf6, 0x6e, 0xcb, 0x0f,
0xbf, 0x85, 0xcd, 0x9b, 0xf6, 0x39, 0x01, 0x00, 0x03, 0x00, 0x04, 0x5d, 0x88, 0x8a,
@ -1233,6 +1242,7 @@ mod tests {
0x00, 0x00,
];
let mut dcerpc_state = DCERPCState::new();
assert_eq!(16, dcerpc_state.process_header(header));
assert_eq!(44, dcerpc_state.handle_bindctxitem(bind, 0));
}

@ -418,6 +418,7 @@ mod tests {
0xff, 0xff, 0xff, 0xff, 0x68, 0x00, 0x00, 0x00, 0x0a, 0x00,
];
let mut dcerpcudp_state = DCERPCUDPState::new();
assert_eq!(80, dcerpcudp_state.process_header(request));
assert_eq!(
0,
dcerpcudp_state.handle_fragment_data(request, request.len() as u16)

Loading…
Cancel
Save