]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dcerpc: fix tests to have a valid header
authorShivani Bhardwaj <shivanib134@gmail.com>
Fri, 5 Jun 2020 14:35:21 +0000 (20:05 +0530)
committerShivani Bhardwaj <shivanib134@gmail.com>
Wed, 15 Jul 2020 16:52:34 +0000 (22:22 +0530)
rust/src/dcerpc/dcerpc.rs
rust/src/dcerpc/dcerpc_udp.rs

index 7617e56d3c74b045dd786ac744e7f57b10923820..d271ab3dd72f05d870438b896bfebe09ab332883 100644 (file)
@@ -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));
     }
 
index 3d1adf663dfefc8e8457830bd6bd0ed09a6c0b06..cd168408c86ba5f742ce073348e095bfa1b6f415 100644 (file)
@@ -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)