]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: remove unused
authorPhilippe Antoine <contact@catenacyber.fr>
Thu, 20 Apr 2023 06:49:48 +0000 (08:49 +0200)
committerVictor Julien <vjulien@oisf.net>
Fri, 9 Jun 2023 08:44:11 +0000 (10:44 +0200)
27 files changed:
rust/src/applayer.rs
rust/src/core.rs
rust/src/dcerpc/dcerpc.rs
rust/src/detect/byte_math.rs
rust/src/dhcp/dhcp.rs
rust/src/dhcp/parser.rs
rust/src/dns/dns.rs
rust/src/dns/log.rs
rust/src/dns/parser.rs
rust/src/filecontainer.rs
rust/src/filetracker.rs
rust/src/ike/ikev2.rs
rust/src/kerberos.rs
rust/src/krb/krb5.rs
rust/src/log.rs
rust/src/nfs/types.rs
rust/src/pgsql/parser.rs
rust/src/pgsql/pgsql.rs
rust/src/quic/parser.rs
rust/src/rdp/parser.rs
rust/src/sip/parser.rs
rust/src/smb/smb.rs
rust/src/smb/smb1_records.rs
rust/src/smb/smb2_records.rs
rust/src/ssh/ssh.rs
rust/src/telnet/telnet.rs
rust/src/x509/mod.rs

index 75e507de59af7bed3b79e81c7d732ebcf294b480..0c1d3a4ba8edc03fbae02c32acf8c40f288be5d2 100644 (file)
@@ -20,7 +20,6 @@
 use std;
 use crate::core::{self,DetectEngineState,Flow,AppLayerEventType,AppProto,Direction};
 use crate::filecontainer::FileContainer;
-use crate::applayer;
 use std::os::raw::{c_void,c_char,c_int};
 use crate::core::SC;
 use std::ffi::CStr;
@@ -42,6 +41,7 @@ pub struct StreamSlice {
 impl StreamSlice {
 
     /// Create a StreamSlice from a Rust slice. Useful in unit tests.
+    #[cfg(test)]
     pub fn from_slice(slice: &[u8], flags: u8, offset: u64) -> Self {
         Self {
             input: slice.as_ptr() as *const u8,
@@ -87,16 +87,6 @@ impl AppLayerTxConfig {
             log_flags: 0,
         }
     }
-
-    pub fn add_log_flags(&mut self, flags: u8) {
-        self.log_flags |= flags;
-    }
-    pub fn set_log_flags(&mut self, flags: u8) {
-        self.log_flags = flags;
-    }
-    pub fn get_log_flags(&self) -> u8 {
-        self.log_flags
-    }
 }
 
 #[repr(C)]
@@ -233,9 +223,6 @@ impl AppLayerStateData {
             file_flags: 0,
         }
     }
-    pub fn update_file_flags(&mut self, flags: u16) {
-        self.file_flags |= flags;
-    }
 }
 
 #[macro_export]
@@ -285,15 +272,9 @@ impl AppLayerResult {
         };
     }
 
-    pub fn is_ok(self) -> bool {
-        self.status == 0
-    }
     pub fn is_incomplete(self) -> bool {
         self.status == 1
     }
-    pub fn is_err(self) -> bool {
-        self.status == -1
-    }
 }
 
 impl From<bool> for AppLayerResult {
@@ -501,20 +482,11 @@ pub const APP_LAYER_PARSER_OPT_ACCEPT_GAPS: u32 = BIT_U32!(0);
 
 pub const APP_LAYER_TX_SKIP_INSPECT_FLAG: u64 = BIT_U64!(62);
 
-pub type AppLayerGetTxIteratorFn = unsafe extern "C" fn (ipproto: u8,
-                                                  alproto: AppProto,
-                                                  alstate: *mut c_void,
-                                                  min_tx_id: u64,
-                                                  max_tx_id: u64,
-                                                  istate: &mut u64) -> applayer::AppLayerGetTxIterTuple;
-
 extern {
     pub fn AppLayerParserStateSetFlag(state: *mut c_void, flag: u16);
     pub fn AppLayerParserStateIssetFlag(state: *mut c_void, flag: u16) -> u16;
     pub fn AppLayerParserSetStreamDepth(ipproto: u8, alproto: AppProto, stream_depth: u32);
     pub fn AppLayerParserConfParserEnabled(ipproto: *const c_char, proto: *const c_char) -> c_int;
-    pub fn AppLayerParserRegisterGetTxIterator(ipproto: u8, alproto: AppProto, fun: AppLayerGetTxIteratorFn);
-    pub fn AppLayerParserRegisterOptionFlags(ipproto: u8, alproto: AppProto, flags: u32);
 }
 
 #[repr(C)]
index 6ad9004ea611ee93e9e0812f4650841986a56615..f3057c0ed896915bedf71dd79dde3ff7ef97d225 100644 (file)
@@ -24,7 +24,6 @@ use crate::debug_validate_fail;
 /// Opaque C types.
 pub enum DetectEngineState {}
 pub enum AppLayerDecoderEvents {}
-pub enum AppLayerParserState {}
 
 // From app-layer-events.h
 pub type AppLayerEventType = std::os::raw::c_int;
index 1b93ce9b731cf0bbca0b2cd642881bdb755bd6e5..d5ade3fcdfa4ea6acc10f6e9ac8d69ae146a6bc8 100644 (file)
@@ -435,15 +435,6 @@ impl DCERPCState {
         None
     }
 
-    pub fn get_hdr_rpc_vers(&self) -> Option<u8> {
-        debug_validate_bug_on!(self.header.is_none());
-        if let Some(ref hdr) = self.header {
-            return Some(hdr.rpc_vers);
-        }
-        // Shouldn't happen
-        None
-    }
-
     pub fn get_hdr_call_id(&self) -> Option<u32> {
         debug_validate_bug_on!(self.header.is_none());
         if let Some(ref hdr) = self.header {
@@ -453,20 +444,6 @@ impl DCERPCState {
         None
     }
 
-    pub fn handle_gap_ts(&mut self) -> u8 {
-        if !self.buffer_ts.is_empty() {
-            self.buffer_ts.clear();
-        }
-        return 0;
-    }
-
-    pub fn handle_gap_tc(&mut self) -> u8 {
-        if !self.buffer_tc.is_empty() {
-            self.buffer_tc.clear();
-        }
-        return 0;
-    }
-
     pub fn clean_buffer(&mut self, direction: Direction) {
         match direction {
             Direction::ToServer => {
index c6bbec88bd34c12c58854eec72f2f9fe19c20daa..a2bead3745f3fb8566b4e71a3daa29dac3574600 100644 (file)
@@ -63,7 +63,7 @@ pub enum ByteMathOperator {
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
 // endian <big|little|dce>
 pub enum ByteMathEndian {
-    EndianNone = 0,
+    _EndianNone = 0,
     BigEndian = 1,
     LittleEndian = 2,
     EndianDCE = 3,
@@ -73,7 +73,7 @@ pub const DETECT_BYTEMATH_ENDIAN_DEFAULT: ByteMathEndian = ByteMathEndian::BigEn
 #[repr(u8)]
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
 pub enum ByteMathBase {
-    BaseNone = 0,
+    _BaseNone = 0,
     BaseOct = 8,
     BaseDec = 10,
     BaseHex = 16,
index 00291757c8037c016de2d6c4d53391263fc0088f..5afa1efb376dac15c926c815235c3e8d926f1aed 100644 (file)
@@ -38,7 +38,7 @@ pub const DHCP_OPT_HOSTNAME: u8 = 12;
 pub const DHCP_OPT_REQUESTED_IP: u8 = 50;
 pub const DHCP_OPT_ADDRESS_TIME: u8 = 51;
 pub const DHCP_OPT_TYPE: u8 = 53;
-pub const DHCP_OPT_SERVER_ID: u8 = 54;
+//unused pub const DHCP_OPT_SERVER_ID: u8 = 54;
 pub const DHCP_OPT_PARAMETER_LIST: u8 = 55;
 pub const DHCP_OPT_RENEWAL_TIME: u8 = 58;
 pub const DHCP_OPT_REBINDING_TIME: u8 = 59;
index 9f6397fd44041a6709e3c235ee15fe1101aa414f..48acccff2c71e4d157f90f4bebd318d1fad827f1 100644 (file)
@@ -19,8 +19,7 @@ use std::cmp::min;
 
 use crate::dhcp::dhcp::*;
 use nom7::bytes::streaming::take;
-use nom7::combinator::{complete, verify};
-use nom7::multi::many0;
+use nom7::combinator::verify;
 use nom7::number::streaming::{be_u16, be_u32, be_u8};
 use nom7::IResult;
 
@@ -196,12 +195,6 @@ pub fn parse_option(i: &[u8]) -> IResult<&[u8], DHCPOption> {
     }
 }
 
-// Parse and return all the options. Upon the end of option indicator
-// all the data will be consumed.
-pub fn parse_all_options(i: &[u8]) -> IResult<&[u8], Vec<DHCPOption>> {
-    many0(complete(parse_option))(i)
-}
-
 pub fn dhcp_parse(input: &[u8]) -> IResult<&[u8], DHCPMessage> {
     match parse_header(input) {
         Ok((rem, header)) => {
index 67eb3085547f87897355a0d2626dc0f35305df1f..382c76ae59b5ac985d3be9ef548bd108e570322f 100644 (file)
@@ -104,7 +104,7 @@ pub const DNS_RCODE_NOTZONE: u16 = 10;
 // Support for OPT RR from RFC6891 will be needed to
 // parse RCODE values over 15
 pub const DNS_RCODE_BADVERS: u16 = 16;
-pub const DNS_RCODE_BADSIG: u16 = 16;
+//also pub const DNS_RCODE_BADSIG: u16 = 16;
 pub const DNS_RCODE_BADKEY: u16 = 17;
 pub const DNS_RCODE_BADTIME: u16 = 18;
 pub const DNS_RCODE_BADMODE: u16 = 19;
index 01dac80d0b831047625697bf3a61890fccad7922..5212b1a0da7ce39596f3d9e9b91eac99951286b4 100644 (file)
@@ -22,9 +22,6 @@ use std::string::String;
 use crate::dns::dns::*;
 use crate::jsonbuilder::{JsonBuilder, JsonError};
 
-pub const LOG_QUERIES: u64 = BIT_U64!(0);
-pub const LOG_ANSWER: u64 = BIT_U64!(1);
-
 pub const LOG_A: u64 = BIT_U64!(2);
 pub const LOG_NS: u64 = BIT_U64!(3);
 pub const LOG_MD: u64 = BIT_U64!(4);
index 25e8abc23c695bd975f31704be5c0ac577adb15f..a1d97a53fd028017872d6b9b3c9bff35e2079143 100644 (file)
@@ -191,13 +191,6 @@ fn dns_parse_answer<'a>(
     return Ok((input, answers));
 }
 
-/// Parse a DNS response.
-pub fn dns_parse_response(message: &[u8]) -> IResult<&[u8], DNSResponse> {
-    let i = message;
-    let (i, header) = dns_parse_header(i)?;
-    dns_parse_response_body(i, message, header)
-}
-
 pub fn dns_parse_response_body<'a>(
     i: &'a [u8], message: &'a [u8], header: DNSHeader,
 ) -> IResult<&'a [u8], DNSResponse> {
@@ -529,6 +522,13 @@ mod tests {
         }
     }
 
+    /// Parse a DNS response.
+    fn dns_parse_response(message: &[u8]) -> IResult<&[u8], DNSResponse> {
+        let i = message;
+        let (i, header) = dns_parse_header(i)?;
+        dns_parse_response_body(i, message, header)
+    }
+
     #[test]
     fn test_dns_parse_response() {
         // DNS response from dig-a-www.suricata-ids.org.pcap.
index ff4ff2e2ab1db96f60861dd2355ffd8f86c8c4e4..b1784b6c2f302d91cc30f48e6292e50ba50d0e97 100644 (file)
@@ -27,26 +27,6 @@ extern {
 pub const FILE_USE_DETECT:    u16 = BIT_U16!(13);
 
 
-// Generic file structure, so it can be used by different protocols
-#[derive(Debug, Default)]
-pub struct Files {
-    pub files_ts: FileContainer,
-    pub files_tc: FileContainer,
-    pub flags_ts: u16,
-    pub flags_tc: u16,
-}
-
-impl Files {
-    pub fn get(&mut self, direction: Direction) -> (&mut FileContainer, u16)
-    {
-        if direction == Direction::ToServer {
-            (&mut self.files_ts, self.flags_ts)
-        } else {
-            (&mut self.files_tc, self.flags_tc)
-        }
-    }
-}
-
 #[repr(C)]
 #[derive(Debug)]
 pub struct FileContainer {
index 0aab94bffb04bc3e4fd465a287ecac63285f28d6..d372882ed12f3c473fd7be0fb673c572101f80de 100644 (file)
@@ -122,12 +122,6 @@ impl FileTransferTracker {
         self.cur_ooo = 0;
     }
 
-    pub fn create(&mut self, _name: &[u8], _file_size: u64) {
-        if self.file_open { panic!("close existing file first"); }
-
-        SCLogDebug!("CREATE: name {:?} file_size {}", _name, _file_size);
-    }
-
     pub fn new_chunk(&mut self, config: &'static SuricataFileContext,
             name: &[u8], data: &[u8], chunk_offset: u64, chunk_size: u32,
             fill_bytes: u8, is_last: bool, xid: &u32) -> u32
index 9e464876cdc52127a50bcfa36afe6447e582ba14..ecb54613da0678388f173c17d219fb22847ac49e 100644 (file)
@@ -35,8 +35,6 @@ pub enum IKEV2ConnectionState {
     InitNonceSent,
     RespSASent,
     RespKESent,
-    RespNonceSent,
-    RespCertReqSent,
 
     ParsingDone,
 
@@ -52,8 +50,7 @@ impl IKEV2ConnectionState {
             (&InitKESent, &IkeV2PayloadContent::Nonce(_)) => InitNonceSent,
             (&InitNonceSent, &IkeV2PayloadContent::SA(_)) => RespSASent,
             (&RespSASent, &IkeV2PayloadContent::KE(_)) => RespKESent,
-            (&RespKESent, &IkeV2PayloadContent::Nonce(_)) => ParsingDone, // RespNonceSent,
-            (&RespNonceSent, &IkeV2PayloadContent::CertificateRequest(_)) => ParsingDone, // RespCertReqSent,
+            (&RespKESent, &IkeV2PayloadContent::Nonce(_)) => ParsingDone, // should go to RespNonceSent,
             (&ParsingDone, _) => self.clone(),
             (_, &IkeV2PayloadContent::Notify(_)) => self.clone(),
             (_, &IkeV2PayloadContent::Dummy) => self.clone(),
index 3b152735a4da1ab7045eff6478c33befcd157301..0a5e9517abfe473b54de37c7a0d9bd54fdcfd2c0 100644 (file)
@@ -28,7 +28,6 @@ use kerberos_parser::krb5_parser::parse_ap_req;
 pub enum SecBlobError {
     NotSpNego,
     KrbFmtError,
-    KrbReqError,
     Ber(BerError),
     NomError(ErrorKind),
 }
index 69c89461d2d71bd80c176544b9eb7d42fbca810e..3282d50ba78bc3c669e1efca2b7daa1460af424f 100644 (file)
@@ -97,14 +97,6 @@ impl Transaction for KRB5Transaction {
     }
 }
 
-pub fn to_hex_string(bytes: &[u8]) -> String {
-    let mut s = String::new();
-    for &b in bytes {
-        s.push_str(&format!("{:02X}", b));
-    }
-    s
-}
-
 impl Default for KRB5State {
     fn default() -> Self {
         Self::new()
index 3652d030960db6974dd6cf023b9467aa5cac8274..05344b6e6cd9c50ab4999f6c67f726bf9a41438a 100644 (file)
@@ -25,13 +25,14 @@ use crate::core::*;
 #[repr(C)]
 pub enum Level {
     NotSet = -1,
-    None = 0,
+    _None = 0,
     Error,
-    Warning,
+    _Warning,
     Notice,
     Info,
-    Perf,
+    _Perf,
     Config,
+    #[cfg(feature = "debug")]
     Debug,
 }
 
index 749f710546b8fa57283f23b689dbbb0046f64f18..96195b9940ce7a33fa7988b37c5360223302f679 100644 (file)
@@ -185,53 +185,6 @@ pub fn rpc_auth_type_known(auth_type: u32) -> i8 {
     return -1;
 }
 
-/* http://www.iana.org/assignments/rpc-authentication-numbers/rpc-authentication-numbers.xhtml */
-pub const RPCAUTH_OK:                   u32 = 0;  // success/failed at remote end    [RFC5531]
-pub const RPCAUTH_BADCRED:              u32 = 1;  // bad credential (seal broken)    [RFC5531]
-pub const RPCAUTH_REJECTEDCRED:         u32 = 2;  // client must begin new session   [RFC5531]
-pub const RPCAUTH_BADVERF:              u32 = 3;  // bad verifier (seal broken)  [RFC5531]
-pub const RPCAUTH_REJECTEDVERF:         u32 = 4;  // verifier expired or replayed    [RFC5531]
-pub const RPCAUTH_TOOWEAK:              u32 = 5;  // rejected for security reasons/failed locally    [RFC5531]
-pub const RPCAUTH_INVALIDRESP:          u32 = 6;  // bogus response verifier     [RFC5531]
-pub const RPCAUTH_FAILED:               u32 = 7;  // reason unknown/AUTH_KERB errors; deprecated. See [RFC2695]  [RFC5531]
-pub const RPCAUTH_KERB_GENERIC:         u32 = 8;  // kerberos generic error  [RFC5531]
-pub const RPCAUTH_TIMEEXPIRE:           u32 = 9;  // time of credential expired  [RFC5531]
-pub const RPCAUTH_TKT_FILE:             u32 = 10; // problem with ticket file    [RFC5531]
-pub const RPCAUTH_DECODE:               u32 = 11; // can't decode authenticator  [RFC5531]
-pub const RPCAUTH_NET_ADDR:             u32 = 12; // wrong net address in ticket/RPCSEC_GSS GSS related errors   [RFC5531]
-pub const RPCSEC_GSS_CREDPROBLEM:       u32 = 13; // no credentials for user     [RFC5531]
-pub const RPCSEC_GSS_CTXPROBLEM:        u32 = 14; // problem with context    [RFC5531]
-pub const RPCSEC_GSS_INNER_CREDPROBLEM: u32 = 15; // No credentials for multi-principal assertion inner context user     [RFC7861]
-pub const RPCSEC_GSS_LABEL_PROBLEM:     u32 = 16; // Problem with label assertion    [RFC7861]
-pub const RPCSEC_GSS_PRIVILEGE_PROBLEM: u32 = 17; // Problem with structured privilege assertion     [RFC7861]
-pub const RPCSEC_GSS_UNKNOWN_MESSAGE:   u32 = 18; // Unknown structured privilege assertion  [RFC7861]
-
-pub fn rpc_auth_status_string(auth_status: u32) -> String {
-    match auth_status {
-        RPCAUTH_OK                      => "OK",
-        RPCAUTH_BADCRED                 => "BADCRED",
-        RPCAUTH_REJECTEDCRED            => "REJECTEDCRED",
-        RPCAUTH_BADVERF                 => "BADVERF",
-        RPCAUTH_REJECTEDVERF            => "REJECTEDVERF",
-        RPCAUTH_TOOWEAK                 => "TOOWEAK",
-        RPCAUTH_INVALIDRESP             => "NVALIDRESP",
-        RPCAUTH_FAILED                  => "FAILED",
-        RPCAUTH_KERB_GENERIC            => "KERB_GENERIC",
-        RPCAUTH_TIMEEXPIRE              => "TIMEEXPIRE",
-        RPCAUTH_TKT_FILE                => "TKT_FILE",
-        RPCAUTH_DECODE                  => "DECODE",
-        RPCAUTH_NET_ADDR                => "NET_ADDR",
-        RPCSEC_GSS_CREDPROBLEM          => "GSS_CREDPROBLEM",
-        RPCSEC_GSS_CTXPROBLEM           => "GSS_CTXPROBLEM",
-        RPCSEC_GSS_INNER_CREDPROBLEM    => "GSS_INNER_CREDPROBLEM",
-        RPCSEC_GSS_LABEL_PROBLEM        => "GSS_LABEL_PROBLEM",
-        RPCSEC_GSS_PRIVILEGE_PROBLEM    => "GSS_PRIVILEGE_PROBLEM",
-        RPCSEC_GSS_UNKNOWN_MESSAGE      => "GSS_UNKNOWN_MESSAGE",
-        _ => {
-            return (auth_status).to_string();
-        },
-    }.to_string()
-}
 
 pub const NFSPROC4_NULL:                u32 = 0;
 pub const NFSPROC4_COMPOUND:            u32 = 1;
index 637bf576fba9069efd672a160ae6a9f419815eae..bcee6ae9a27bce13bee77d483fa050606077928b 100644 (file)
@@ -160,16 +160,6 @@ pub struct ErrorNoticeMessage {
     pub message_body: Vec<PgsqlErrorNoticeMessageField>,
 }
 
-impl ErrorNoticeMessage {
-    pub fn new(identifier: u8, length: u32) -> Self {
-        ErrorNoticeMessage {
-            identifier,
-            length,
-            message_body: Vec::new(),
-        }
-    }
-}
-
 #[derive(Debug, PartialEq, Eq)]
 pub enum SSLResponseMessage {
     SSLAccepted,
@@ -177,16 +167,6 @@ pub enum SSLResponseMessage {
     InvalidResponse,
 }
 
-impl SSLResponseMessage {
-    pub fn to_str(&self) -> &'static str {
-        match self {
-            SSLResponseMessage::SSLAccepted => "SSL Accepted",
-            SSLResponseMessage::SSLRejected => "SSL Rejected",
-            SSLResponseMessage::InvalidResponse => "Invalid server response",
-        }
-    }
-}
-
 impl From<u8> for SSLResponseMessage {
     fn from(identifier: u8) -> Self {
         match identifier {
@@ -1091,6 +1071,16 @@ mod tests {
     use super::*;
     use nom7::Needed;
 
+    impl ErrorNoticeMessage {
+        pub fn new(identifier: u8, length: u32) -> Self {
+            ErrorNoticeMessage {
+                identifier,
+                length,
+                message_body: Vec::new(),
+            }
+        }
+    }
+
     #[test]
     fn test_parse_request() {
         // An SSLRequest
index 63da68b56f8c17741007451a5853e36bfe3d6ca7..f5fbebc8f950e5d08315f7042b551b6b1589560b 100644 (file)
@@ -98,7 +98,6 @@ impl PgsqlTransaction {
 pub enum PgsqlStateProgress {
     IdleState,
     SSLRequestReceived,
-    SSLAcceptedReceived,
     SSLRejectedReceived,
     StartupMessageReceived,
     SASLAuthenticationReceived,
@@ -119,6 +118,7 @@ pub enum PgsqlStateProgress {
     CommandCompletedReceived,
     ErrorMessageReceived,
     ConnectionTerminated,
+    #[cfg(test)]
     UnknownState,
     Finished,
 }
@@ -244,7 +244,6 @@ impl PgsqlState {
     /// responses, we must track State progress to decide on tx completion
     fn is_tx_completed(&self) -> bool {
         if let PgsqlStateProgress::ReadyForQueryReceived
-        | PgsqlStateProgress::SSLAcceptedReceived
         | PgsqlStateProgress::SSLRejectedReceived
         | PgsqlStateProgress::SimpleAuthenticationReceived
         | PgsqlStateProgress::SASLAuthenticationReceived
index dfd09cb00c858cd7e2d8471a3e4f4da88252f4a3..5d9d700080b042ee99b7e26b1f789ad121c6f8f5 100644 (file)
@@ -40,7 +40,6 @@ use std::convert::TryFrom;
 pub struct QuicVersion(pub u32);
 
 impl QuicVersion {
-    pub const Q039: QuicVersion = QuicVersion(0x51303339);
     pub const Q043: QuicVersion = QuicVersion(0x51303433);
     pub const Q044: QuicVersion = QuicVersion(0x51303434);
     pub const Q045: QuicVersion = QuicVersion(0x51303435);
index 590ef6ff5b546dca9a12c0d7c967f4b74879c812..604d10a19c4ddb8ac4366e780a5e7e106a8dfd43 100644 (file)
@@ -99,7 +99,7 @@ pub enum T123TpktChild {
 pub enum X224Type {
     ConnectionConfirm = 0xd,
     ConnectionRequest = 0xe,
-    Data = 0xf,
+    _Data = 0xf,
 }
 
 /// x.224-spec, section 13.3
index 1f270f9fb8a24193963e0f6e2e134cfc4ff64a49..a34bc2615e5357d624b596d6a1b066c5e51cfb4d 100644 (file)
@@ -57,12 +57,6 @@ pub struct Response {
     pub body_len: u16,
 }
 
-#[derive(PartialEq, Eq, Debug, Clone)]
-pub enum Method {
-    Register,
-    Custom(String),
-}
-
 #[inline]
 fn is_token_char(b: u8) -> bool {
     is_alphanumeric(b) || b"!%'*+-._`".contains(&b)
index 86a20f634c70c840e584aa3de680f3f427197f9d..909925972902005576e3a5677961266a15a5567b 100644 (file)
@@ -132,9 +132,11 @@ pub fn smb_dos_error_string(c: u16) -> String {
 }
 
 pub const NTLMSSP_NEGOTIATE:               u32 = 1;
+#[cfg(feature = "debug")]
 pub const NTLMSSP_CHALLENGE:               u32 = 2;
 pub const NTLMSSP_AUTH:                    u32 = 3;
 
+#[cfg(feature = "debug")]
 pub fn ntlmssp_type_string(c: u32) -> String {
     match c {
         NTLMSSP_NEGOTIATE   => "NTLMSSP_NEGOTIATE",
@@ -560,7 +562,7 @@ pub const SMBHDR_TYPE_FILENAME:    u32 = 3;
 pub const SMBHDR_TYPE_OFFSET:      u32 = 4;
 pub const SMBHDR_TYPE_GENERICTX:   u32 = 5;
 pub const SMBHDR_TYPE_HEADER:      u32 = 6;
-pub const SMBHDR_TYPE_MAX_SIZE:    u32 = 7; // max resp size for SMB1_COMMAND_TRANS
+//unused pub const SMBHDR_TYPE_MAX_SIZE:    u32 = 7; // max resp size for SMB1_COMMAND_TRANS
 pub const SMBHDR_TYPE_TRANS_FRAG:  u32 = 8;
 pub const SMBHDR_TYPE_TREE:        u32 = 9;
 pub const SMBHDR_TYPE_DCERPCTX:    u32 = 10;
@@ -1041,26 +1043,6 @@ impl SMBState {
         return tx_ref.unwrap();
     }
 
-    pub fn get_create_tx_by_hdr(&mut self, hdr: &SMBCommonHdr)
-        -> Option<&mut SMBTransaction>
-    {
-        for tx in &mut self.transactions {
-            let found = match tx.type_data {
-                Some(SMBTransactionTypeData::CREATE(ref _d)) => {
-                    tx.hdr.compare(hdr)
-                },
-                _ => { false },
-            };
-
-            if found {
-                SCLogDebug!("SMB: Found SMB create TX with ID {}", tx.id);
-                return Some(tx);
-            }
-        }
-        SCLogDebug!("SMB: Failed to find SMB create TX with key {:?}", hdr);
-        return None;
-    }
-
     pub fn get_service_for_guid(&self, guid: &[u8]) -> (&'static str, bool)
     {
         let (name, is_dcerpc) = match self.guid2name_map.get(&guid.to_vec()) {
index 0d412da3d6b523ec30943f6c6ed1781fd2c72f2c..bf767da8b08b95945284843c4b648e0f4ea95110 100644 (file)
@@ -821,9 +821,6 @@ impl<'a> SmbRecord<'a> {
     pub fn has_unicode_support(&self) -> bool {
         self.flags2 & 0x8000_u16 != 0
     }
-    pub fn is_dos_error(&self) -> bool {
-        self.flags2 & 0x4000_u16 != 0
-    }
 
     /// Return true if record is a request.
     pub fn is_request(&self) -> bool {
index 84a6faf57246d1112fc3571d15b5ff3acb99c888..4a7721cdaa0ad64b102d0d56b75edfe8634ec750 100644 (file)
@@ -66,10 +66,6 @@ pub struct Smb2Record<'a> {
 }
 
 impl<'a> Smb2Record<'a> {
-    pub fn is_async(&self) -> bool {
-        self.async_id != 0
-    }
-
     pub fn is_request(&self) -> bool {
         self.direction == 0
     }
index aa05c59b72b22e4c920b2137bbe32885e25bcf26..3e2a15b9f1b7725d70d780a4672fe8b263622cae 100644 (file)
@@ -92,12 +92,6 @@ pub struct SSHTransaction {
     tx_data: AppLayerTxData,
 }
 
-impl SSHTransaction {
-    pub fn new() -> SSHTransaction {
-        Default::default()
-    }
-}
-
 #[derive(Default)]
 pub struct SSHState {
     state_data: AppLayerStateData,
index 9c068e2da2b882deb72fe3427df3aaaeef1a6b0f..f1e7eec50281ebbb26e1ac11f61ee18e88a173aa 100644 (file)
@@ -41,12 +41,6 @@ pub struct TelnetTransaction {
     tx_data: AppLayerTxData,
 }
 
-impl TelnetTransaction {
-    pub fn new() -> Self {
-        Default::default()
-    }
-}
-
 impl Transaction for TelnetTransaction {
     fn id(&self) -> u64 {
         self.tx_id
@@ -134,13 +128,6 @@ impl TelnetState {
         self.transactions.iter().find(|tx| tx.tx_id == tx_id + 1)
     }
 
-    fn _new_tx(&mut self) -> TelnetTransaction {
-        let mut tx = TelnetTransaction::new();
-        self.tx_id += 1;
-        tx.tx_id = self.tx_id;
-        return tx;
-    }
-
     fn _find_request(&mut self) -> Option<&mut TelnetTransaction> {
         // TODO
         None
index 1b00101e63a41d8571d9d32c5d17feec125e73c2..fa9706e9021102e9d9a87fa4f868e4290ec1d200 100644 (file)
@@ -27,7 +27,7 @@ mod log;
 
 #[repr(u32)]
 pub enum X509DecodeError {
-    Success = 0,
+    _Success = 0,
     /// Generic decoding error
     InvalidCert,
     /// Some length does not match, or certificate is incomplete