From: Jason Ish Date: Mon, 16 Dec 2019 19:41:07 +0000 (-0600) Subject: rust: cargo fix for Rust 2018 edition X-Git-Tag: suricata-6.0.0-beta1~840 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e68dfa46a6614a0f2fc1ff2c86b90788e8f03f51;p=thirdparty%2Fsuricata.git rust: cargo fix for Rust 2018 edition --- diff --git a/rust/src/applayer.rs b/rust/src/applayer.rs index d0dd5c8157..d184072fa8 100644 --- a/rust/src/applayer.rs +++ b/rust/src/applayer.rs @@ -16,7 +16,7 @@ */ use std; -use core::{STREAM_TOSERVER}; +use crate::core::{STREAM_TOSERVER}; #[repr(C)] pub struct AppLayerGetTxIterTuple { diff --git a/rust/src/dns/lua.rs b/rust/src/dns/lua.rs index fddeeb9767..bbd6e0de43 100644 --- a/rust/src/dns/lua.rs +++ b/rust/src/dns/lua.rs @@ -17,9 +17,9 @@ use std::os::raw::c_int; -use lua::*; -use dns::dns::*; -use dns::log::*; +use crate::lua::*; +use crate::dns::dns::*; +use crate::dns::log::*; #[no_mangle] pub extern "C" fn rs_dns_lua_get_tx_id(clua: &mut CLuaState, diff --git a/rust/src/rdp/log.rs b/rust/src/rdp/log.rs index 40d7a154d0..0d8b2d7d2f 100644 --- a/rust/src/rdp/log.rs +++ b/rust/src/rdp/log.rs @@ -18,9 +18,9 @@ // Author: Zach Kelly use super::rdp::{RdpTransaction, RdpTransactionItem}; -use json::{Json, JsonT}; -use rdp::parser::*; -use rdp::windows; +use crate::json::{Json, JsonT}; +use crate::rdp::parser::*; +use crate::rdp::windows; use std; use x509_parser::parse_x509_der; @@ -78,7 +78,7 @@ fn to_json(tx: &RdpTransaction) -> Option { /// json helper for X224ConnectionRequest fn x224_req_to_json(js: &Json, x224: &X224ConnectionRequest) { - use rdp::parser::NegotiationRequestFlags as Flags; + use crate::rdp::parser::NegotiationRequestFlags as Flags; js.set_string("event_type", "initial_request"); if let Some(ref cookie) = x224.cookie { @@ -108,7 +108,7 @@ fn x224_req_to_json(js: &Json, x224: &X224ConnectionRequest) { /// json helper for X224ConnectionConfirm fn x224_conf_to_json(js: &Json, x224: &X224ConnectionConfirm) { - use rdp::parser::NegotiationResponseFlags as Flags; + use crate::rdp::parser::NegotiationResponseFlags as Flags; js.set_string("event_type", "initial_response"); if let Some(ref from_server) = x224.negotiation_from_server { @@ -292,7 +292,7 @@ fn mcs_req_to_json(js: &Json, mcs: &McsConnectRequest) { if let Some(ref early_capability_flags) = client.early_capability_flags { - use rdp::parser::EarlyCapabilityFlags as Flags; + use crate::rdp::parser::EarlyCapabilityFlags as Flags; if !early_capability_flags.is_empty() { let flags = Json::array(); diff --git a/rust/src/rdp/parser.rs b/rust/src/rdp/parser.rs index 0226a31c8f..ef51eb2797 100644 --- a/rust/src/rdp/parser.rs +++ b/rust/src/rdp/parser.rs @@ -27,11 +27,11 @@ //! * x.691-spec: use nom::{be_u16, be_u8, le_u16, le_u32, le_u8, ErrorKind, IResult}; -use rdp::error::RDP_NOT_X224_CLASS_0_ERROR; -use rdp::util::{ +use crate::rdp::error::RDP_NOT_X224_CLASS_0_ERROR; +use crate::rdp::util::{ le_slice_to_string, parse_per_length_determinant, utf7_slice_to_string, }; -use rdp::windows; +use crate::rdp::windows; /// constrains dimension to a range, per spec /// rdp-spec, section 2.2.1.3.2 Client Core Data @@ -1111,7 +1111,7 @@ fn parse_mcs_connect_response( #[cfg(test)] mod tests_cookie_21182 { - use rdp::parser::*; + use crate::rdp::parser::*; static BYTES: [u8; 37] = [ 0x03, 0x00, 0x00, 0x25, 0x20, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, @@ -1145,7 +1145,7 @@ mod tests_cookie_21182 { #[cfg(test)] mod tests_negotiate_49350 { - use rdp::parser::*; + use crate::rdp::parser::*; static BYTES: [u8; 20] = [ 0x03, 0x00, 0x00, 0x13, 0x0e, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, @@ -1188,7 +1188,7 @@ mod tests_negotiate_49350 { #[cfg(test)] mod tests_core_49350 { - use rdp::parser::*; + use crate::rdp::parser::*; static BYTES: [u8; 429] = [ 0x03, 0x00, 0x01, 0xac, 0x02, 0xf0, 0x80, 0x7f, 0x65, 0x82, 0x01, 0xa0, @@ -1310,7 +1310,7 @@ mod tests_core_49350 { #[cfg(test)] mod tests_x223_response_49350 { - use rdp::parser::*; + use crate::rdp::parser::*; // changed offset 9 from 0x65 to 0x66 so it is no longer an mcs connect static BYTES: [u8; 9] = @@ -1337,7 +1337,7 @@ mod tests_x223_response_49350 { #[cfg(test)] mod tests_t123_raw_49350 { - use rdp::parser::*; + use crate::rdp::parser::*; // changed offset 4 from 0x02 to 0x03 so it is no longer an X223 data object static BYTES: [u8; 9] = @@ -1360,7 +1360,7 @@ mod tests_t123_raw_49350 { #[cfg(test)] mod tests_x224_raw_49350 { - use rdp::parser::*; + use crate::rdp::parser::*; // changed offset 11 from 0x01 to 0x02 so it is not a known X224 payload type static BYTES: [u8; 19] = [ @@ -1396,7 +1396,7 @@ mod tests_x224_raw_49350 { #[cfg(test)] mod tests_x223_raw_49350 { - use rdp::parser::*; + use crate::rdp::parser::*; // changed offset 9 from 0x65 to 0xff so it is no longer an mcs connect static BYTES: [u8; 9] = @@ -1422,7 +1422,7 @@ mod tests_x223_raw_49350 { #[cfg(test)] mod tests_negotiate_incomplete_49350 { use nom; - use rdp::parser::*; + use crate::rdp::parser::*; static BYTES: [u8; 19] = [ 0x03, 0x00, 0x00, 0x13, 0x0e, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, @@ -1476,7 +1476,7 @@ mod tests_negotiate_incomplete_49350 { #[cfg(test)] mod tests_core_incomplete_49350 { use nom; - use rdp::parser::*; + use crate::rdp::parser::*; static BYTES: [u8; 428] = [ 0x03, 0x00, 0x01, 0xac, 0x02, 0xf0, 0x80, 0x7f, 0x65, 0x82, 0x01, 0xa0, diff --git a/rust/src/rdp/rdp.rs b/rust/src/rdp/rdp.rs index 3b66935413..4a349fe18a 100644 --- a/rust/src/rdp/rdp.rs +++ b/rust/src/rdp/rdp.rs @@ -19,13 +19,13 @@ //! RDP application layer -use core::{ +use crate::core::{ self, AppProto, DetectEngineState, Flow, ALPROTO_UNKNOWN, IPPROTO_TCP, }; -use conf; +use crate::conf; use nom; -use parser::*; -use rdp::parser::*; +use crate::parser::*; +use crate::rdp::parser::*; use std; use std::mem::transmute; use tls_parser::{ @@ -561,7 +561,7 @@ pub unsafe extern "C" fn rs_rdp_register_parser() { #[cfg(test)] mod tests { use super::*; - use rdp::parser::{RdpCookie, X224ConnectionRequest}; + use crate::rdp::parser::{RdpCookie, X224ConnectionRequest}; #[test] fn test_probe_rdp() { diff --git a/rust/src/rdp/util.rs b/rust/src/rdp/util.rs index dc44ff1663..41758b7210 100644 --- a/rust/src/rdp/util.rs +++ b/rust/src/rdp/util.rs @@ -21,7 +21,7 @@ use byteorder::ReadBytesExt; use memchr::memchr; use nom; use nom::{ErrorKind, IResult, Needed}; -use rdp::error::RDP_UNIMPLEMENTED_LENGTH_DETERMINANT; +use crate::rdp::error::RDP_UNIMPLEMENTED_LENGTH_DETERMINANT; use std::io::Cursor; use widestring::U16CString; @@ -105,7 +105,7 @@ pub fn parse_per_length_determinant(input: &[u8]) -> IResult<&[u8], u32> { mod tests { use super::*; use nom; - use rdp::error::RDP_UNIMPLEMENTED_LENGTH_DETERMINANT; + use crate::rdp::error::RDP_UNIMPLEMENTED_LENGTH_DETERMINANT; #[test] fn test_le_string_abc() { diff --git a/rust/src/sip/detect.rs b/rust/src/sip/detect.rs index ab50275ccb..7d987e6ed8 100644 --- a/rust/src/sip/detect.rs +++ b/rust/src/sip/detect.rs @@ -17,8 +17,8 @@ // written by Giuseppe Longo -use core::{STREAM_TOCLIENT, STREAM_TOSERVER}; -use sip::sip::SIPTransaction; +use crate::core::{STREAM_TOCLIENT, STREAM_TOSERVER}; +use crate::sip::sip::SIPTransaction; use std::ptr; #[no_mangle] diff --git a/rust/src/sip/log.rs b/rust/src/sip/log.rs index 8427a8775f..1c1813366e 100644 --- a/rust/src/sip/log.rs +++ b/rust/src/sip/log.rs @@ -17,8 +17,8 @@ // written by Giuseppe Longo -use json::*; -use sip::sip::{SIPState, SIPTransaction}; +use crate::json::*; +use crate::sip::sip::{SIPState, SIPTransaction}; #[no_mangle] pub extern "C" fn rs_sip_log_json(_state: &mut SIPState, tx: &mut SIPTransaction) -> *mut JsonT { diff --git a/rust/src/sip/sip.rs b/rust/src/sip/sip.rs index b33526003d..2c51e3c95d 100755 --- a/rust/src/sip/sip.rs +++ b/rust/src/sip/sip.rs @@ -19,13 +19,13 @@ extern crate nom; -use applayer; -use conf; -use core; -use core::{sc_detect_engine_state_free, AppProto, Flow, ALPROTO_UNKNOWN}; -use log::*; -use parser::*; -use sip::parser::*; +use crate::applayer; +use crate::conf; +use crate::core; +use crate::core::{sc_detect_engine_state_free, AppProto, Flow, ALPROTO_UNKNOWN}; +use crate::log::*; +use crate::parser::*; +use crate::sip::parser::*; use std; use std::ffi::{CStr, CString}; diff --git a/rust/src/smb/debug.rs b/rust/src/smb/debug.rs index 3387111ead..da1a94fe7a 100644 --- a/rust/src/smb/debug.rs +++ b/rust/src/smb/debug.rs @@ -18,7 +18,7 @@ use crate::smb::smb::*; #[cfg(feature = "debug")] -use log::*; +use crate::log::*; impl SMBState { #[cfg(not(feature = "debug"))]